Skip to content
Snippets Groups Projects
Commit d36a79d5 authored by Pierre Ozoux's avatar Pierre Ozoux
Browse files

Adds start to provision script, closes #23

parent 75537dae
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@
# - Generates the TLS certificate associated
# - Configures the DNS
# - Configures the mail forwarding
# - Starts the application
#
# Version 0.0.2
#
......@@ -31,10 +32,11 @@ read -r -d '' usage <<-'EOF'
-e [arg] Email of the user of the application. Required.
-u [arg] URL to process. Required.
-f [arg] Certificate file to use.
-g Generate the necessary certificate.
-b Buy the associated domain name.
-c Configure DNS on Namecheap.
-g Generates the necessary certificate.
-b Buys the associated domain name.
-c Configures DNS on Namecheap.
-d Enables debug mode
-s Starts the application
-h This page
EOF
......@@ -248,6 +250,21 @@ function configure_dns () {
}
function start_application () {
case "${arg_a}" in
"static" )
service_file="static"
;;
* )
service_file="lamp"
;;
esac
# Enable and start application (Sorry Systemd)
systemctl enable ${service_file}@${arg_u}
systemctl start ${service_file}@${arg_u}
}
function _fmt () {
local color_ok="\x1b[32m"
local color_bad="\x1b[31m"
......@@ -382,5 +399,7 @@ scaffold
[ ${arg_g} -eq 1 ] && generate_certificate
[ ! -z "${arg_f}" ] && provision_certificate
[ ${arg_c} -eq 1 ] && configure_dns
[ ${arg_s} -eq 1 ] && start_application
exit 0
......@@ -3,15 +3,11 @@
image=$1
# prepare data
/data/indiehosters/scripts/provision.sh -e test@test.org -a $image -u $image.test -f /data/indiehosters/tests/unsecure-certs/indiehosters.dev.pem
/data/indiehosters/scripts/provision.sh -s -e test@test.org -a $image -u $image.test -f /data/indiehosters/tests/unsecure-certs/indiehosters.dev.pem
if [ "$image" == "static" ]; then
systemctl start $image@$image.test
systemctl enable $image@$image.test
sleep 30
else
systemctl start lamp@$image.test
systemctl enable lamp@$image.test
sleep 60
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment