diff --git a/ente/config.json b/ente/config.json index f7ad2a9bc..6d6b6289e 100644 --- a/ente/config.json +++ b/ente/config.json @@ -77,7 +77,7 @@ "startup": "services", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons", - "version": "1.0.0test4", + "version": "1.0.0test5", "video": true, "webui": "http://[HOST]:[PORT:3000]" } diff --git a/ente/rootfs/etc/cont-init.d/99-run.sh b/ente/rootfs/etc/cont-init.d/99-run.sh index 5246d62af..86d3cab52 100644 --- a/ente/rootfs/etc/cont-init.d/99-run.sh +++ b/ente/rootfs/etc/cont-init.d/99-run.sh @@ -63,3 +63,22 @@ SQL bashio::log.info "Internal Postgres ready." done + +################# +# Minio startup # +################# + +MINIO_USER="$(bashio::config 'MINIO_ROOT_USER')" +MINIO_PASS="$(bashio::config 'MINIO_ROOT_PASSWORD')" +S3_BUCKET="$(bashio::config 'S3_BUCKET')" + +bashio::log.info "Waiting for MinIO API…" +until /usr/local/bin/mc alias set h0 http://localhost:3200 "${MINIO_USER}" "${MINIO_PASS}" 2>/dev/null; do + sleep 1 +done + +bashio::log.info "Ensuring bucket ${S3_BUCKET} exists…" +/usr/local/bin/mc mb -p "h0/${S3_BUCKET}" || true +bashio::log.info "MinIO bucket ready." + +sleep infinity \ No newline at end of file diff --git a/ente/rootfs/etc/services.d/02-museum/run b/ente/rootfs/etc/services.d/02-museum/run new file mode 100644 index 000000000..b4ac0ccdd --- /dev/null +++ b/ente/rootfs/etc/services.d/02-museum/run @@ -0,0 +1,27 @@ +#!/usr/bin/with-contenv bashio +set -euo pipefail + +CFG=/config/museum.yaml +if ! bashio::fs.file_exists "$CFG"; then + bashio::log.error "$CFG not found; aborting museum start." + exit 1 +fi + +if bashio::config.true 'USE_EXTERNAL_DB'; then + DB_HOST="$(bashio::config 'DB_HOSTNAME')" + DB_PORT="$(bashio::config 'DB_PORT')" + DB_USER="$(bashio::config 'DB_USERNAME')" + bashio::log.info "Waiting for external Postgres at ${DB_HOST}:${DB_PORT}…" + until pg_isready -q -h "${DB_HOST}" -p "${DB_PORT}" -U "${DB_USER}"; do + sleep 2 + done +else + DB_USER="postgres" + bashio::log.info "Waiting for internal Postgres…" + until pg_isready -q -h localhost -p 5432 -U "${DB_USER}"; do + sleep 2 + done +fi + +bashio::log.info "Starting museum." +exec /usr/bin/museum --config "$CFG" diff --git a/ente/rootfs/etc/services.d/03-web/run b/ente/rootfs/etc/services.d/03-web/run new file mode 100644 index 000000000..3f2038ef3 --- /dev/null +++ b/ente/rootfs/etc/services.d/03-web/run @@ -0,0 +1,8 @@ +#!/usr/bin/with-contenv bashio +set -euo pipefail +if bashio::config.true 'DISABLE_WEB_UI'; then + bashio::log.info "Web UI disabled by option." + exit 0 +fi +bashio::log.info "Starting Ente web." +exec /usr/bin/ente-web