Switch s6

This commit is contained in:
Alexandre
2023-03-01 21:13:12 +01:00
committed by GitHub
parent b31a27a898
commit 825beadc33
2 changed files with 34 additions and 23 deletions

View File

@@ -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

View File

@@ -1,23 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
if [ -e "/PORTFILE" ]; then
echo "Installing portainer..."
BUILD_UPSTREAM=$(</PORTFILE)
BUILD_ARCH=$(uname -m)
echo "${BUILD_ARCH}"
BUILD_ARCH=${BUILD_ARCH:-x86}
if [[ "${BUILD_ARCH}" == *aarch64* ]]; then ARCH="arm64"; fi
if [[ "${BUILD_ARCH}" == *armv8* ]]; then ARCH="arm64"; fi
if [[ "${BUILD_ARCH}" == *arm64* ]]; then ARCH="arm64"; fi
if [[ "${BUILD_ARCH}" == *armhf* ]]; then ARCH="arm"; fi
if [[ "${BUILD_ARCH}" == *armv7* ]]; then ARCH="arm"; fi
if [[ "${BUILD_ARCH}" == arm ]]; then ARCH="arm"; fi
if [[ "${BUILD_ARCH}" == *x86* ]]; then ARCH="amd64"; fi
curl -f -L -s -S \
"https://github.com/portainer/portainer/releases/download/${BUILD_UPSTREAM}/portainer-${BUILD_UPSTREAM}-linux-${ARCH}.tar.gz" |
tar zxvf - -C /opt/ >/dev/null
echo "... success!"
fi