summaryrefslogtreecommitdiff
path: root/ci/docker/starteduvpn.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/docker/starteduvpn.sh')
-rw-r--r--ci/docker/starteduvpn.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/ci/docker/starteduvpn.sh b/ci/docker/starteduvpn.sh
index 39eb53e..580150b 100644
--- a/ci/docker/starteduvpn.sh
+++ b/ci/docker/starteduvpn.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+# Check if credentials are set
+# If not fail with exit code 1
if [[ -z "${PORTAL_USER}" ]]; then
printf "Error: No portal username set, set the PORTAL_USER env var\n"
exit 1
@@ -10,16 +12,23 @@ if [[ -z "${PORTAL_PASS}" ]]; then
exit 1
fi
+# Start the preliminary systemd units
systemctl start php-fpm
systemctl start httpd
systemctl start crond
+# Start the daemon in the background and get the PID
vpn-daemon &
pid_daemon=$!
+
+# Wait a bit
sleep 5
+# Apply the vpn configuration
vpn-maint-apply-changes
+# Add the user with the env variables
sudo -u apache vpn-user-portal-account --add "${PORTAL_USER}" --password "${PORTAL_PASS}"
+# Wait for the daemon to finish
wait $pid_daemon