⬆️ Upgrade to the 3.0.0 base and migrate to bashio

This commit is contained in:
Timmo 2019-03-19 19:41:50 +00:00
parent a53eaef465
commit a6dfb6b231
8 changed files with 63 additions and 77 deletions

View file

@ -8,7 +8,7 @@ variables:
ADDON_ARMV7: "false" ADDON_ARMV7: "false"
ADDON_AARCH64_BASE: "hassioaddons/base-aarch64:2.3.2" ADDON_AARCH64_BASE: "hassioaddons/base-aarch64:3.0.0"
ADDON_AMD64_BASE: "hassioaddons/base-amd64:2.3.2" ADDON_AMD64_BASE: "hassioaddons/base-amd64:3.0.0"
ADDON_ARMHF_BASE: "hassioaddons/base-armhf:2.3.2" ADDON_ARMHF_BASE: "hassioaddons/base-armhf:3.0.0"
ADDON_I386_BASE: "hassioaddons/base-i386:2.3.2" ADDON_I386_BASE: "hassioaddons/base-i386:3.0.0"

View file

@ -1,4 +1,4 @@
ARG BUILD_FROM=hassioaddons/base:2.3.2 ARG BUILD_FROM=hassioaddons/base:3.0.0
# hadolint ignore=DL3006 # hadolint ignore=DL3006
FROM ${BUILD_FROM} FROM ${BUILD_FROM}
@ -6,12 +6,12 @@ FROM ${BUILD_FROM}
# hadolint ignore=DL3003 # hadolint ignore=DL3003
RUN \ RUN \
apk add --no-cache --virtual .build-dependencies \ apk add --no-cache --virtual .build-dependencies \
yarn=1.7.0-r0 \ yarn=1.12.3-r0 \
git=2.18.1-r0 \ git=2.20.1-r0 \
\ \
&& apk add --no-cache \ && apk add --no-cache \
nodejs-current=9.11.1-r2 \
nginx=1.14.2-r0 \ nginx=1.14.2-r0 \
nodejs-current=11.3.0-r0 \
\ \
&& git clone --branch "v0.5.0" --depth=1 \ && git clone --branch "v0.5.0" --depth=1 \
"https://github.com/timmo001/home-panel-api.git" /opt/api \ "https://github.com/timmo001/home-panel-api.git" /opt/api \

View file

@ -1,10 +1,10 @@
{ {
"args": {}, "args": {},
"build_from": { "build_from": {
"aarch64": "hassioaddons/base-aarch64:2.3.2", "aarch64": "hassioaddons/base-aarch64:3.0.0",
"amd64": "hassioaddons/base-amd64:2.3.2", "amd64": "hassioaddons/base-amd64:3.0.0",
"armhf": "hassioaddons/base-armhf:2.3.2", "armhf": "hassioaddons/base-armhf:3.0.0",
"i386": "hassioaddons/base-i386:2.3.2" "i386": "hassioaddons/base-i386:3.0.0"
}, },
"squash": false "squash": false
} }

View file

@ -1,30 +1,27 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bashio
# ============================================================================== # ==============================================================================
# Community Hass.io Add-ons: Home Panel # Community Hass.io Add-ons: Home Panel
# This checks if all user configuration requirements are met # This checks if all user configuration requirements are met
# ============================================================================== # ==============================================================================
# shellcheck disable=SC1091
source /usr/lib/hassio-addons/base.sh
# Check SSL requirements, if enabled # Check SSL requirements, if enabled
if hass.config.true 'ssl'; then if bashio::config.true 'ssl'; then
if ! hass.config.has_value 'certfile'; then if ! bashio::config.has_value 'certfile'; then
hass.die 'SSL is enabled, but no certfile was specified' bashio::exit.nok 'SSL is enabled, but no certfile was specified'
fi fi
if ! hass.config.has_value 'keyfile'; then if ! bashio::config.has_value 'keyfile'; then
hass.die 'SSL is enabled, but no keyfile was specified' bashio::exit.nok 'SSL is enabled, but no keyfile was specified'
fi fi
if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then if ! bashio::fs.file_exists "/ssl/$(bashio::config 'certfile')"; then
hass.die 'The configured certfile is not found' bashio::exit.nok 'The configured certfile is not found'
fi fi
if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then if ! bashio::fs.file_exists "/ssl/$(bashio::config 'keyfile')"; then
hass.die 'The configured keyfile is not found' bashio::exit.nok 'The configured keyfile is not found'
fi fi
fi fi
if ! hass.config.has_value 'config_file'; then if ! bashio::config.has_value 'config_file'; then
hass.die 'No config file was specified' bashio::exit.nok 'No config file was specified'
fi fi

View file

@ -1,17 +1,14 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bashio
# ============================================================================== # ==============================================================================
# Community Hass.io Add-ons: Home Panel # Community Hass.io Add-ons: Home Panel
# This copies the configs to their respective locations # This copies the configs to their respective locations
# ============================================================================== # ==============================================================================
# shellcheck disable=SC1091
source /usr/lib/hassio-addons/base.sh
declare config_file declare config_file
config_file="/config/$(hass.config.get 'config_file')" config_file="/config/$(bashio::config 'config_file')"
if ! hass.file_exists "${config_file}"; then if ! bashio::fs.file_exists "${config_file}"; then
hass.log.info "Config file does not exist. Creating.." bashio::log.info "Config file does not exist. Creating.."
cp /etc/home-panel/home-panel-config.default.json "${config_file}" cp /etc/home-panel/home-panel-config.default.json "${config_file}"
hass.log.info "Created. You should now edit this file at '${config_file}'" bashio::log.info "Created. You should now edit this file at '${config_file}'"
fi fi

View file

@ -1,18 +1,15 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bashio
# ============================================================================== # ==============================================================================
# Community Hass.io Add-ons: Home Panel # Community Hass.io Add-ons: Home Panel
# Configures NGINX for use with Home Panel # Configures NGINX for use with Home Panel
# ============================================================================== # ==============================================================================
# shellcheck disable=SC1091
source /usr/lib/hassio-addons/base.sh
declare certfile declare certfile
declare keyfile declare keyfile
# Enable SSL # Enable SSL
if hass.config.true 'ssl'; then if bashio::config.true 'ssl'; then
certfile=$(hass.config.get 'certfile') certfile=$(bashio::config 'certfile')
keyfile=$(hass.config.get 'keyfile') keyfile=$(bashio::config 'keyfile')
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx-ssl.conf sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx-ssl.conf
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx-ssl.conf sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx-ssl.conf

View file

@ -1,23 +1,20 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bashio
# ============================================================================== # ==============================================================================
# Community Hass.io Add-ons: Home Panel # Community Hass.io Add-ons: Home Panel
# Starts server to serve the API # Starts server to serve the API
# ============================================================================== # ==============================================================================
# shellcheck disable=SC1091 bashio::log.info "Run API.."
source /usr/lib/hassio-addons/base.sh
hass.log.info "Run API.."
cd /opt/api \ cd /opt/api \
|| hass.die "Could not change into API directory" || bashio::exit.nok "Could not change into API directory"
LOG_LEVEL=$(hass.config.get 'log_level') LOG_LEVEL=$(bashio::config 'log_level')
DB_PATH=/config/home-panel.db DB_PATH=/config/home-panel.db
CONFIG_PATH=/config/$(hass.config.get 'config_file') CONFIG_PATH=/config/$(bashio::config 'config_file')
if hass.config.true 'ssl'; then if bashio::config.true 'ssl'; then
SSL_PATH_CERT="/ssl/$(hass.config.get 'certfile')" SSL_PATH_CERT="/ssl/$(bashio::config 'certfile')"
SSL_PATH_KEY="/ssl/$(hass.config.get 'keyfile')" SSL_PATH_KEY="/ssl/$(bashio::config 'keyfile')"
fi fi
export LOG_LEVEL export LOG_LEVEL

View file

@ -1,13 +1,11 @@
#!/bin/bash #!/usr/bin/with-contenv bashio
# ============================================================================== # ==============================================================================
# Community Hass.io Add-ons: Home Panel # Community Hass.io Add-ons: Home Panel
# Runs the NGINX daemon # Runs the NGINX daemon
# ============================================================================== # ==============================================================================
# shellcheck disable=SC1091 bashio::log.info "Starting NGINX..."
source /usr/lib/hassio-addons/base.sh
hass.log.info "Starting NGINX..." if bashio::config.true 'ssl'; then
if hass.config.true 'ssl'; then
options='/etc/nginx/nginx-ssl.conf' options='/etc/nginx/nginx-ssl.conf'
else else
options='/etc/nginx/nginx.conf' options='/etc/nginx/nginx.conf'