From 825beadc339fc0503001eb0b0f8bd72b278f82b0 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 1 Mar 2023 21:13:12 +0100 Subject: [PATCH] Switch s6 --- .../s6-overlay /s6-rc.d/init-portainer/run | 34 +++++++++++++++++++ .../cont-init.d/00-aaa_portainer_install.sh | 23 ------------- 2 files changed, 34 insertions(+), 23 deletions(-) create mode 100755 portainer/rootfs /etc/s6-overlay /s6-rc.d/init-portainer/run delete mode 100755 portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh diff --git a/portainer/rootfs /etc/s6-overlay /s6-rc.d/init-portainer/run b/portainer/rootfs /etc/s6-overlay /s6-rc.d/init-portainer/run new file mode 100755 index 000000000..04b9cb8fc --- /dev/null +++ b/portainer/rootfs /etc/s6-overlay /s6-rc.d/init-portainer/run @@ -0,0 +1,34 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash + +################# +# NGINX SETTING # +################# + +#declare admin_port +declare portainer_protocol=http + +# Generate Ingress configuration +if bashio::config.true 'ssl'; then + bashio::config.require.ssl + portainer_protocol=https + sed -i "s|9000|9443|g" /etc/nginx/includes/upstream.conf + sed -i "s|9000|9443|g" /etc/services.d/nginx/run + sed -i "s|9099 default_server|9099 ssl|g" /etc/nginx/templates/ingress.gtpl + sed -i '7 i ssl_certificate /ssl/{{ .certfile }};' /etc/nginx/templates/ingress.gtpl + sed -i '7 i ssl_certificate_key /ssl/{{ .keyfile }};' /etc/nginx/templates/ingress.gtpl + bashio::log.info "Ssl enabled, please use https for connection" +fi + +bashio::var.json \ + interface "$(bashio::addon.ip_address)" \ + port "^$(bashio::addon.ingress_port)" \ + protocol "${portainer_protocol}" \ + certfile "$(bashio::config 'certfile')" \ + keyfile "$(bashio::config 'keyfile')" \ + ssl "^$(bashio::config 'ssl')" | +tempio \ + -template /etc/nginx/templates/ingress.gtpl \ + -out /etc/nginx/servers/ingress.conf + +bashio::require.unprotected diff --git a/portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh b/portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh deleted file mode 100755 index 3eb804c9e..000000000 --- a/portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/with-contenv bashio -# shellcheck shell=bash -if [ -e "/PORTFILE" ]; then - echo "Installing portainer..." - BUILD_UPSTREAM=$(/dev/null - echo "... success!" -fi