diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-08-09 16:23:19 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-08-09 16:23:19 +0200 |
| commit | 93a95d4be4d754a901ab42a8174ae0e725680a01 (patch) | |
| tree | 914b9e0699cb3107cbfde7fcf86798a6624883cc /ci/docker/starteduvpn.sh | |
| parent | 9abd93ee4d6345967c1b5aa1b220a5c2bd4b1f01 (diff) | |
Docker: Run without a systemctl helper script
Diffstat (limited to 'ci/docker/starteduvpn.sh')
| -rwxr-xr-x | ci/docker/starteduvpn.sh | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/ci/docker/starteduvpn.sh b/ci/docker/starteduvpn.sh index 36c881d..fab2d2d 100755 --- a/ci/docker/starteduvpn.sh +++ b/ci/docker/starteduvpn.sh @@ -15,10 +15,11 @@ fi # Replace expiry ./replaceexpiry.sh /etc/vpn-user-portal/config.php -# Start the preliminary systemd units -systemctl start php-fpm -systemctl start httpd -systemctl start crond +# Start the preliminary services +mkdir /run/php-fpm +php-fpm --nodaemonize & +crond & +httpd -DFOREGROUND & # Start the daemon in the background and get the PID vpn-daemon & @@ -27,8 +28,32 @@ pid_daemon=$! # Wait a bit sleep 5 -# Apply the vpn configuration -vpn-maint-apply-changes +# Snippet from vpn-maint-apply-changes +# Enable & Start WireGuard +rm -rf /etc/wireguard/* +if ! /usr/libexec/vpn-server-node/server-config; then + exit 1 +fi +for F in /etc/wireguard/*.conf +do + case ${F} in + *.conf) + CONFIG_NAME=$(basename "${F}" .conf) + wg-quick up "${CONFIG_NAME}" + ;; + esac +done +# sync with vpn-daemon, no need to wait for the cron, but *ONLY* do this when +# this is a machine with vpn-user-portal installed +if [ -d /etc/vpn-user-portal ]; then + if [ -f /etc/redhat-release ]; then + sudo -u apache /usr/libexec/vpn-user-portal/daemon-sync + fi + if [ -f /etc/debian_version ]; then + sudo -u www-data /usr/libexec/vpn-user-portal/daemon-sync + fi +fi + # Add the user with the env variables sudo -u apache vpn-user-portal-account --add "${PORTAL_USER}" --password "${PORTAL_PASS}" |
