mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 05:44:03 +02:00
Update maintainerr/rootfs/ha_entrypoint.sh
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -59,14 +59,31 @@ export DATA_DIR
|
|||||||
# ─── Start Maintainerr as unprivileged node user ─────────────────────────────
|
# ─── Start Maintainerr as unprivileged node user ─────────────────────────────
|
||||||
echo "[Maintainerr] Starting application on port ${UI_PORT:-6246}..."
|
echo "[Maintainerr] Starting application on port ${UI_PORT:-6246}..."
|
||||||
gosu node /opt/app/start.sh &
|
gosu node /opt/app/start.sh &
|
||||||
|
APP_PID=$!
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if [ -n "${APP_PID:-}" ] && ps -p "$APP_PID" >/dev/null 2>&1; then
|
||||||
|
kill "$APP_PID" 2>/dev/null || true
|
||||||
|
wait "$APP_PID" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap 'cleanup' EXIT TERM INT
|
||||||
|
|
||||||
# ─── Wait for Maintainerr to become available, then start Nginx ──────────────
|
# ─── Wait for Maintainerr to become available, then start Nginx ──────────────
|
||||||
echo "[Maintainerr] Waiting for application to be ready..."
|
echo "[Maintainerr] Waiting for application to be ready..."
|
||||||
|
app_ready=0
|
||||||
for _ in $(seq 1 900); do
|
for _ in $(seq 1 900); do
|
||||||
if curl -s -o /dev/null -f "http://127.0.0.1:${UI_PORT:-6246}" 2>/dev/null; then
|
if curl -s -o /dev/null -f "http://127.0.0.1:${UI_PORT:-6246}" 2>/dev/null; then
|
||||||
|
app_ready=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$app_ready" -ne 1 ]; then
|
||||||
|
echo "[Maintainerr] ERROR: Application did not become ready within timeout. Aborting nginx startup."
|
||||||
|
# cleanup trap will handle stopping APP_PID if still running
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "[Maintainerr] Starting Nginx..."
|
echo "[Maintainerr] Starting Nginx..."
|
||||||
exec nginx -c /etc/nginx/nginx.conf
|
exec nginx -c /etc/nginx/nginx.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user