diff --git a/Dockerfile b/Dockerfile index 63cd60e58..7251a18cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN mkdir -p /etc/apt/keyrings \ && apt-get update \ && apt-get upgrade -y \ && apt-get -y --no-install-recommends --only-upgrade install openssl openssh-server \ - && apt-get -y --no-install-recommends install rsync "/tmp/dokku-$(dpkg --print-architecture).deb" \ + && DOKKU_INIT_SYSTEM=sv apt-get -y --no-install-recommends install rsync "/tmp/dokku-$(dpkg --print-architecture).deb" \ && apt-get purge -y syslog-ng-core \ && apt-get autoremove -y \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/docker/etc/my_init.d/10_dokku_init b/docker/etc/my_init.d/10_dokku_init index 6e5ad28e3..14299cd2e 100755 --- a/docker/etc/my_init.d/10_dokku_init +++ b/docker/etc/my_init.d/10_dokku_init @@ -71,13 +71,13 @@ main() { dokku --quiet domains:set-global "$DOKKU_HOSTNAME" fi + touch /etc/default/dokku + echo "export DOKKU_INIT_SYSTEM=sv" >>/etc/default/dokku if [[ -x /usr/local/bin/docker ]]; then - mkdir -p /home/dokku/.dokkurc - echo "export DOCKER_BIN=/usr/local/bin/docker" >"/home/dokku/.dokkurc/DOCKER_BIN" + echo "export DOCKER_BIN=/usr/local/bin/docker" >>/etc/default/dokku fi if [[ -n "$DOKKU_HOST_ROOT" ]]; then - touch /etc/default/dokku echo "export DOKKU_HOST_ROOT=$DOKKU_HOST_ROOT" >>/etc/default/dokku chown dokku:dokku /etc/default/dokku fi diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index 229b6485f..551b29cf6 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -82,7 +82,9 @@ trigger-nginx-vhosts-install() { ;; ubuntu) - if [[ -x "$systemctl_path" ]]; then + if [[ "$DOKKU_INIT_SYSTEM" == "sv" ]]; then + echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv enable $NGINX_INIT_NAME, /usr/bin/sv disable $NGINX_INIT_NAME, /usr/bin/sv reload $NGINX_INIT_NAME, /usr/bin/sv start $NGINX_INIT_NAME, /usr/bin/sv stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" + elif [[ -x "$systemctl_path" ]]; then echo "%dokku ALL=(ALL) NOPASSWD:$systemctl_path enable $NGINX_INIT_NAME, $systemctl_path disable $NGINX_INIT_NAME, $systemctl_path reload $NGINX_INIT_NAME, $systemctl_path start $NGINX_INIT_NAME, $systemctl_path stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" elif [[ -x /usr/bin/sv ]]; then echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/sv enable $NGINX_INIT_NAME, /usr/bin/sv disable $NGINX_INIT_NAME, /usr/bin/sv reload $NGINX_INIT_NAME, /usr/bin/sv start $NGINX_INIT_NAME, /usr/bin/sv stop $NGINX_INIT_NAME, $NGINX_BIN -t, $NGINX_BIN -t -c *" >"$NGINX_SUDOERS_FILE" diff --git a/plugins/nginx-vhosts/internal-functions b/plugins/nginx-vhosts/internal-functions index 92455ee1e..1aad3a948 100755 --- a/plugins/nginx-vhosts/internal-functions +++ b/plugins/nginx-vhosts/internal-functions @@ -549,7 +549,9 @@ fn-nginx-vhosts-nginx-init-cmd() { ubuntu) # support docker-based installations - if [[ -x "$systemctl_path" ]]; then + if [[ "$DOKKU_INIT_SYSTEM" == "sv" ]]; then + sudo /usr/bin/sv "$CMD" "$NGINX_INIT_NAME" + elif [[ -x "$systemctl_path" ]]; then sudo "$systemctl_path" "$CMD" "$NGINX_INIT_NAME" elif [[ -x /usr/bin/sv ]]; then sudo /usr/bin/sv "$CMD" "$NGINX_INIT_NAME"