diff --git a/config/confd/templates/open-balena-vpn.service.tmpl b/config/confd/templates/open-balena-vpn.service.tmpl index b49cbef4..a02c07b5 100644 --- a/config/confd/templates/open-balena-vpn.service.tmpl +++ b/config/confd/templates/open-balena-vpn.service.tmpl @@ -35,6 +35,11 @@ KillMode=mixed # https://www.freedesktop.org/software/systemd/man/systemd.service.html#TimeoutStopSec= # ensure k8s/terminationGracePeriodSeconds matches TimeoutStopSec={{ if getenv "DEFAULT_SIGTERM_TIMEOUT" }}{{ getenv "DEFAULT_SIGTERM_TIMEOUT" }}{{ else }}120{{ end }} +# https://www.freedesktop.org/software/systemd/man/systemd.kill.html#SendSIGHUP= +# Specifies whether to send SIGHUP to remaining processes immediately after sending the +# signal configured with KillSignal=. This is useful to indicate to shells and shell-like +# programs that their connection has been severed. +SendSIGHUP=yes Restart=always SyslogIdentifier=vpn diff --git a/config/services/open-balena-vpn.service b/config/services/open-balena-vpn.service index 69240f52..9d00be9d 100644 --- a/config/services/open-balena-vpn.service +++ b/config/services/open-balena-vpn.service @@ -1,42 +1,9 @@ -# Copyright (C) 2015 Balena Ltd. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - [Unit] -Description=open-balena-vpn -Requires=confd.service haproxy.service -After=confd.service -StartLimitIntervalSec=0 +Description=open-balena-vpn service stub [Service] -StandardOutput=journal+console -StandardError=journal+console -WorkingDirectory=/usr/src/app -EnvironmentFile=/usr/src/app/config/env -ExecStart=/usr/src/app/bin/start.sh -ExecStop=-/usr/src/app/bin/stop.sh -# https://www.freedesktop.org/software/systemd/man/systemd.kill.html#KillMode= -# only send SIGTERM to master process, send SIGKILL to all remaining processes in the -# group after TimeoutStopSec has elapsed; this setting prevents VPN worker(s) from -# restarting after SIGTERM is received and before SIGKILL -KillMode=mixed -# https://www.freedesktop.org/software/systemd/man/systemd.service.html#TimeoutStopSec= -# ensure k8s/terminationGracePeriodSeconds matches -TimeoutStopSec=${DEFAULT_SIGTERM_TIMEOUT} - -Restart=always -SyslogIdentifier=vpn +Type=simple +ExecStart=true [Install] WantedBy=basic.target