diff --git a/ente/Dockerfile b/ente/Dockerfile index f180406fb..974d96452 100644 --- a/ente/Dockerfile +++ b/ente/Dockerfile @@ -74,11 +74,14 @@ ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templat RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && \ /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh +ENTRYPOINT [ "/usr/bin/env" ] +CMD [ "/ha_entrypoint.sh" ] + # ---------- Healthcheck ---------- -ENV HEALTH_PORT="8080" \ - HEALTH_URL="/ping" -HEALTHCHECK --interval=10s --retries=5 --timeout=20s CMD \ - curl -A "HealthCheck: Docker/1.0" -fs "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" || exit 1 +#ENV HEALTH_PORT="8080" \ +# HEALTH_URL="/ping" +#HEALTHCHECK --interval=10s --retries=5 --timeout=20s CMD \ +# curl -A "HealthCheck: Docker/1.0" -fs "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" || exit 1 ############ # 5 Labels # diff --git a/ente/config.json b/ente/config.json index 663942bf5..6ef462d58 100644 --- a/ente/config.json +++ b/ente/config.json @@ -80,7 +80,7 @@ "startup": "services", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons", - "version": "1.0.0test", + "version": "1.0.0test2", "video": true, "webui": "http://[HOST]:[PORT:3000]" } diff --git a/ente/rootfs/etc/config/museum.yaml b/ente/rootfs/etc/config/museum.yaml new file mode 100644 index 000000000..d6f5ac8eb --- /dev/null +++ b/ente/rootfs/etc/config/museum.yaml @@ -0,0 +1,15 @@ +db: + host: "${DB_HOSTNAME}" + port: ${DB_PORT} + name: "${DB_DATABASE_NAME}" + user: "${DB_USERNAME}" + password: "${DB_PASSWORD}" + +s3: + are_local_buckets: true + b2-eu-cen: + key: "${MINIO_ROOT_USER}" + secret: "${MINIO_ROOT_PASSWORD}" + endpoint: "http://localhost:3200" + region: "eu-central-2" + bucket: "${S3_BUCKET}" \ No newline at end of file diff --git a/ente/rootfs/etc/cont-init.d/99-run.sh b/ente/rootfs/etc/cont-init.d/99-run.sh index fd5ce623f..452b19981 100755 --- a/ente/rootfs/etc/cont-init.d/99-run.sh +++ b/ente/rootfs/etc/cont-init.d/99-run.sh @@ -3,11 +3,16 @@ # shellcheck disable=SC2155,SC2016 set -e -bashio::log.info "Starting ente..." -exec /usr/bin/museum & +bashio::log.info "Starting services" -bashio::log.info "Starting minio..." -exec /usr/local/bin/minio server /data --address ":3200" & - -bashio::log.info "Starting ente-web..." -[ -n "$DISABLE_WEB_UI" ] || exec /usr/bin/ente-web +# Loop through each directory in /etc/services.d/ +for dir in /etc/services.d/*; do + # Check if the directory contains a 'run' file + if [ -f "$dir/run" ]; then + # Execute the 'run' file + echo "Starting service in $dir" + bash "$dir/run" + else + echo "No run file found in $dir" + fi +done diff --git a/ente/rootfs/etc/services.d/01-museum/run b/ente/rootfs/etc/services.d/01-museum/run new file mode 100644 index 000000000..4ae59932e --- /dev/null +++ b/ente/rootfs/etc/services.d/01-museum/run @@ -0,0 +1,13 @@ +#!/usr/bin/with-contenv bash +set -e + +CONFIG_FILE="/config/museum.yaml" + +# Safety: refuse to start if the config file is missing +if [[ ! -f "$CONFIG_FILE" ]]; then + echo "[museum] ERROR: $CONFIG_FILE not found" >&2 + exit 1 +fi + +# Exec so that S6 can reap the PID +exec /usr/bin/museum --config "$CONFIG_FILE" diff --git a/ente/rootfs/etc/services.d/02-minio/run b/ente/rootfs/etc/services.d/02-minio/run new file mode 100644 index 000000000..23c28e2a5 --- /dev/null +++ b/ente/rootfs/etc/services.d/02-minio/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash +set -e +exec /usr/local/bin/minio server /data --address ":3200" 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..4f496bd11 --- /dev/null +++ b/ente/rootfs/etc/services.d/03-web/run @@ -0,0 +1,4 @@ +#!/usr/bin/with-contenv bash +set -e +[[ "${DISABLE_WEB_UI,,}" == "true" ]] && exit 0 +exec /usr/bin/ente-web