From 60fb25919603d1d8c2b30a09c0ca18594d752980 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 4 Nov 2026 08:34:50 +0100 Subject: [PATCH] photoprism: run as PID 1 and start PhotoPrism as a service so SIGTERM reaches it (#3183) (#3195) Without an init key Supervisor runs Docker's tini as PID 1. ha_entrypoint.sh was then its child, skipped its SIGTERM trap, and died by the default handler (exit 143) while 99-run.sh still held the cont-init loop with exec nginx, so PhotoPrism was killed at teardown without its graceful shutdown. Follow the seerr pattern: init: false, the launch script moves to services.d/photoprism/run and execs the upstream entrypoint, and nginx gets its own run file that waits for port 2341. ha_entrypoint.sh then forwards the stop to each service's process group and exits 0. Co-authored-by: Claude Opus 5.5 --- photoprism/CHANGELOG.md | 3 +++ photoprism/config.yaml | 3 ++- photoprism/rootfs/etc/services.d/nginx/run | 11 +++++++++++ .../99-run.sh => services.d/photoprism/run} | 9 +-------- 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100755 photoprism/rootfs/etc/services.d/nginx/run rename photoprism/rootfs/etc/{cont-init.d/99-run.sh => services.d/photoprism/run} (96%) diff --git a/photoprism/CHANGELOG.md b/photoprism/CHANGELOG.md index c62f070000..0adb474cf7 100644 --- a/photoprism/CHANGELOG.md +++ b/photoprism/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2026.10.29.3 (04-11-2026) +- Stop PhotoPrism cleanly: run the add-on's entrypoint as PID 1 (`init: false`) and start PhotoPrism and nginx as services, so a stop now reaches PhotoPrism as SIGTERM and it closes its database before exiting. Previously the stop killed the entrypoint shell (exit code 143) and PhotoPrism was killed without shutting down (#3183) + ## 2026.10.29.2 (03-11-2026) - Fix ~5 minute delay before Home Assistant reports the add-on as started: the healthcheck interval was 5 minutes, so when PhotoPrism took longer than the 30 s start period to open its port, the first successful probe came 5 minutes later. Use the standard 5 s interval now that the check is a cheap curl (#3183) diff --git a/photoprism/config.yaml b/photoprism/config.yaml index a31785178e..8adaab0834 100644 --- a/photoprism/config.yaml +++ b/photoprism/config.yaml @@ -76,6 +76,7 @@ homeassistant: 0.92.0b2 image: ghcr.io/alexbelgium/photoprism-{arch} ingress: true ingress_stream: true +init: false map: - app_config:rw - homeassistant_config:rw @@ -131,5 +132,5 @@ services: slug: photoprism udev: true url: https://github.com/alexbelgium/hassio-addons -version: "2026.10.29.2" +version: "2026.10.29.3" video: true diff --git a/photoprism/rootfs/etc/services.d/nginx/run b/photoprism/rootfs/etc/services.d/nginx/run new file mode 100755 index 0000000000..d4caabd5f8 --- /dev/null +++ b/photoprism/rootfs/etc/services.d/nginx/run @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash +set -e +# ============================================================================== + +# Wait for PhotoPrism to become available +bashio::net.wait_for 2341 localhost 900 + +bashio::log.info "Starting NGinx..." + +exec nginx diff --git a/photoprism/rootfs/etc/cont-init.d/99-run.sh b/photoprism/rootfs/etc/services.d/photoprism/run similarity index 96% rename from photoprism/rootfs/etc/cont-init.d/99-run.sh rename to photoprism/rootfs/etc/services.d/photoprism/run index 10dc50638c..aa0e45dbd2 100755 --- a/photoprism/rootfs/etc/cont-init.d/99-run.sh +++ b/photoprism/rootfs/etc/services.d/photoprism/run @@ -148,11 +148,4 @@ fi bashio::log.info "Please wait 1 or 2 minutes to allow the server to load" bashio::log.info 'Default username : admin, default password: "please_change_password"' -# shellcheck disable=SC1091 -. /scripts/entrypoint.sh photoprism start & -bashio::log.info "Starting, please wait for next green text..." - -bashio::net.wait_for 2341 localhost 900 -bashio::log.info "App launched" - -exec nginx +exec /scripts/entrypoint.sh photoprism start