mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-02-02 01:47:44 +01:00
add portainer
This commit is contained in:
64
portainer/rootfs/etc/cont-init.d/90-configuration.sh
Normal file
64
portainer/rootfs/etc/cont-init.d/90-configuration.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bashio
|
||||
|
||||
##################
|
||||
# DEFINE OPTIONS #
|
||||
##################
|
||||
declare -a options
|
||||
options+=(--data /data)
|
||||
options+=(--bind 0.0.0.0:9000)
|
||||
options+=(--templates /opt/portainer/templates.json)
|
||||
options+=(--host unix:///var/run/docker.sock)
|
||||
|
||||
bashio::log.info "Starting Portainer..."
|
||||
|
||||
################
|
||||
# SET PASSWORD #
|
||||
################
|
||||
|
||||
PASSWORD=$(bashio::config 'password')
|
||||
echo -n $PASSWORD > /tmp/portainer_password
|
||||
options+=(--admin-password-file /tmp/portainer_password)
|
||||
bashio::log.info "... password set to $PASSWORD"
|
||||
|
||||
##############
|
||||
# SSL CONFIG #
|
||||
##############
|
||||
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||
#set variables
|
||||
CERTFILE="/ssl/$(bashio::config 'certfile')"
|
||||
KEYFILE="/ssl/$(bashio::config 'keyfile')"
|
||||
options+=(--ssl true)
|
||||
options+=(--sslcert /ssl/$CERTFILE)
|
||||
options+=(--sslkey /ssl/$KEYFILE)
|
||||
bashio::log.info "... ssl activated"
|
||||
fi
|
||||
|
||||
###################
|
||||
# HIDE CONTAINERS #
|
||||
###################
|
||||
|
||||
# Hide Hassio containers by default, but only eforce on first run
|
||||
if ! bashio::fs.file_exists "/data/hidden"; then
|
||||
options+=(--hide-label io.hass.type=supervisor)
|
||||
options+=(--hide-label io.hass.type=homeassistant)
|
||||
options+=(--hide-label io.hass.type=base)
|
||||
options+=(--hide-label io.hass.type=core)
|
||||
# options+=(--hide-label io.hass.type=addon)
|
||||
options+=(--hide-label io.hass.type=audio)
|
||||
options+=(--hide-label io.hass.type=cli)
|
||||
options+=(--hide-label io.hass.type=dns)
|
||||
options+=(--hide-label io.hass.type=multicast)
|
||||
options+=(--hide-label io.hass.type=observer)
|
||||
bashio::log.info "... non-addon containers hidden"
|
||||
touch /data/hidden
|
||||
fi
|
||||
|
||||
####################
|
||||
# LAUNCH PORTAINER #
|
||||
####################
|
||||
bashio::log.info "... portainer launched"
|
||||
|
||||
exec /opt/portainer/portainer "${options[@]}"
|
||||
6
portainer/rootfs/etc/cont-init.d/portainer.sh
Normal file
6
portainer/rootfs/etc/cont-init.d/portainer.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Portainer
|
||||
# Runs some initializations for Portainer
|
||||
# ==============================================================================
|
||||
bashio::require.unprotected
|
||||
9
portainer/rootfs/etc/services.d/portainer/finish
Normal file
9
portainer/rootfs/etc/services.d/portainer/finish
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Portainer
|
||||
# Take down the S6 supervision tree when Portainer fails
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
64
portainer/rootfs/etc/services.d/portainer/run
Normal file
64
portainer/rootfs/etc/services.d/portainer/run
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bashio
|
||||
|
||||
##################
|
||||
# DEFINE OPTIONS #
|
||||
##################
|
||||
declare -a options
|
||||
options+=(--data /data)
|
||||
options+=(--bind 0.0.0.0:9000)
|
||||
options+=(--templates /opt/portainer/templates.json)
|
||||
options+=(--host unix:///var/run/docker.sock)
|
||||
|
||||
bashio::log.info "Starting Portainer..."
|
||||
|
||||
################
|
||||
# SET PASSWORD #
|
||||
################
|
||||
|
||||
PASSWORD=$(bashio::config 'password')
|
||||
echo -n $PASSWORD > /tmp/portainer_password
|
||||
options+=(--admin-password-file /tmp/portainer_password)
|
||||
bashio::log.info "... password set to $PASSWORD"
|
||||
|
||||
##############
|
||||
# SSL CONFIG #
|
||||
##############
|
||||
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||
#set variables
|
||||
CERTFILE="/ssl/$(bashio::config 'certfile')"
|
||||
KEYFILE="/ssl/$(bashio::config 'keyfile')"
|
||||
options+=(--ssl true)
|
||||
options+=(--sslcert /ssl/$CERTFILE)
|
||||
options+=(--sslkey /ssl/$KEYFILE)
|
||||
bashio::log.info "... ssl activated"
|
||||
fi
|
||||
|
||||
###################
|
||||
# HIDE CONTAINERS #
|
||||
###################
|
||||
|
||||
# Hide Hassio containers by default, but only eforce on first run
|
||||
if ! bashio::fs.file_exists "/data/hidden"; then
|
||||
options+=(--hide-label io.hass.type=supervisor)
|
||||
options+=(--hide-label io.hass.type=homeassistant)
|
||||
options+=(--hide-label io.hass.type=base)
|
||||
options+=(--hide-label io.hass.type=core)
|
||||
# options+=(--hide-label io.hass.type=addon)
|
||||
options+=(--hide-label io.hass.type=audio)
|
||||
options+=(--hide-label io.hass.type=cli)
|
||||
options+=(--hide-label io.hass.type=dns)
|
||||
options+=(--hide-label io.hass.type=multicast)
|
||||
options+=(--hide-label io.hass.type=observer)
|
||||
bashio::log.info "... non-addon containers hidden"
|
||||
touch /data/hidden
|
||||
fi
|
||||
|
||||
####################
|
||||
# LAUNCH PORTAINER #
|
||||
####################
|
||||
bashio::log.info "... portainer launched"
|
||||
|
||||
exec /opt/portainer/portainer "${options[@]}"
|
||||
Reference in New Issue
Block a user