fix: detect and use systemd on Debian systems

Debian Bookworm completely removes invoke-rc.d, thus breaking interactions with nginx.

Closes #6020
This commit is contained in:
Jose Diaz-Gonzalez committed 2023-07-11 20:34:50 -04:00
1 parent 30a94d1f9d
commit c44d779695
3 files changed
+12 -6

No files matched your search

+2 -4
View File
@@ -58,10 +58,8 @@ A value of 64 would allow domains with up to 64 characters. Set it to 128 if you
Save the file and try stopping nginx and starting it again: Save the file and try stopping nginx and starting it again:
```shell ```shell
/etc/init.d/nginx stop dokku nginx:stop
## * Stopping nginx nginx [ OK ] dokku nginx:start
/etc/init.d/nginx start
## * Starting nginx nginx [ OK ]
``` ```
--- ---
+5 -1
View File
@@ -69,7 +69,11 @@ trigger-nginx-vhosts-install() {
local mode="0440" local mode="0440"
case "$DOKKU_DISTRO" in case "$DOKKU_DISTRO" in
debian | raspbian) debian | raspbian)
echo "%dokku ALL=(ALL) NOPASSWD:/usr/sbin/invoke-rc.d $NGINX_INIT_NAME enable, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME disable, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME reload, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME start, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME stop, $NGINX_BIN -t, ${NGINX_BIN} -t -c *" >"$NGINX_SUDOERS_FILE" if [[ -x /usr/bin/systemctl ]]; then
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl enable $NGINX_INIT_NAME, /usr/bin/systemctl disable $NGINX_INIT_NAME, /usr/bin/systemctl reload $NGINX_INIT_NAME, /usr/bin/systemctl start $NGINX_INIT_NAME, /usr/bin/systemctl stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE"
else
echo "%dokku ALL=(ALL) NOPASSWD:/usr/sbin/invoke-rc.d $NGINX_INIT_NAME enable, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME disable, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME reload, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME start, /usr/sbin/invoke-rc.d $NGINX_INIT_NAME stop, $NGINX_BIN -t, ${NGINX_BIN} -t -c *" >"$NGINX_SUDOERS_FILE"
fi
;; ;;
ubuntu) ubuntu)
+5 -1
View File
@@ -125,7 +125,11 @@ fn-nginx-vhosts-nginx-init-cmd() {
case "$DOKKU_DISTRO" in case "$DOKKU_DISTRO" in
debian | raspbian) debian | raspbian)
sudo /usr/sbin/invoke-rc.d "$NGINX_INIT_NAME" "$CMD" if [[ -x /usr/bin/systemctl ]]; then
sudo /usr/bin/systemctl "$CMD" "$NGINX_INIT_NAME"
else
sudo /usr/sbin/invoke-rc.d "$NGINX_INIT_NAME" "$CMD"
fi
;; ;;
ubuntu) ubuntu)