Skip to content

πŸ›‘οΈ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!

Docker: silence transient nginx boot errors and duplicate supervisord logs

sassanixff72508a41a2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 449ce64..9c2075b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -82,6 +82,8 @@
- _Files: `backend/warranties_routes.py`, `tests/test_frontend_and_locales.py`_
- **Docker image no longer logs a startup permission error:** Gunicorn 26 tried to write to the home directory on startup, but the container process had no home set, so every start logged a Permission denied error for /root/.gunicorn. The app still started and worked, the error was only log noise. The gunicorn process now runs with HOME set to /home/warracker, so the error is gone.
- _Files: `Docker/supervisord.conf`, `tests/docker_smoke_test.sh`_
+- **Cleaner Docker startup logs:** the startup banner check polled Nginx before Gunicorn finished booting, which logged a few transient `connect() failed (111: Connection refused)` Nginx errors on every normal container start, and supervisord logged every lifecycle line twice because `nodaemon=true` and `logfile=/dev/stdout` both wrote to stdout. The banner check now waits for Gunicorn (`127.0.0.1:5000/api/health`) before probing Nginx, and `supervisord.conf` sets `logfile=/dev/null`, keeping startup logs clean and single-printed.
+ - _Files: `Docker/entrypoint.sh`, `Docker/supervisord.conf`, `tests/docker_smoke_test.sh`_
## 1.0.6 - 2026-11-10
diff --git a/Docker/entrypoint.sh b/Docker/entrypoint.sh
index 55747b7..c547dd8 100644
--- a/Docker/entrypoint.sh
+++ b/Docker/entrypoint.sh
@@ -129,12 +129,16 @@ log "Setup completed successfully!"
# the supervisor start below is not delayed by it, and if the app never
# becomes healthy the banner simply never prints.
print_banner_when_ready() {
+ local backend_url="http://127.0.0.1:5000/api/health"
local health_url="http://localhost/api/health"
if [ "${DISABLE_NGINX:-false}" = "true" ]; then
- health_url="http://localhost:5000/api/health"
+ health_url="$backend_url"
fi
for i in {1..45}; do
- if curl -fs "$health_url" > /dev/null 2>&1; then
+ # Check gunicorn directly first so nginx does not log transient
+ # "connect() failed (111: Connection refused)" errors during boot,
+ # then verify the public health URL (through nginx when enabled).
+ if curl -fs "$backend_url" > /dev/null 2>&1 && curl -fs "$health_url" > /dev/null 2>&1; then
cat <<'BANNER'
β–ˆ β–ˆ β–ˆ
β–ˆ β–„ β–ˆ β–€β–€β–€β–„ β–ˆβ–€β–€β–€β–„ β–ˆβ–€β–€β–€β–„ β–€β–€β–€β–„ β–„β–€β–€β–€β–„ β–ˆ β–„β–€ β–„β–€β–€β–€β–„ β–ˆβ–€β–€β–€β–„
diff --git a/Docker/supervisord.conf b/Docker/supervisord.conf
index 9ceb554..03f296c 100644
--- a/Docker/supervisord.conf
+++ b/Docker/supervisord.conf
@@ -1,7 +1,7 @@
[supervisord]
nodaemon=true
user=root
-logfile=/dev/stdout
+logfile=/dev/null
logfile_maxbytes=0
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
diff --git a/tests/docker_smoke_test.sh b/tests/docker_smoke_test.sh
index 07c8aae..d4b66fd 100755
--- a/tests/docker_smoke_test.sh
+++ b/tests/docker_smoke_test.sh
@@ -146,6 +146,11 @@ grep -q "=== Warracker ${EXPECTED_VERSION} ===" <<< "${app_logs}" \
if grep -q "Control server error" <<< "${app_logs}"; then
fail "Gunicorn logged a control server permission error"
fi
+sup_count="$(grep -c "supervisord started with pid 1" <<< "${app_logs}" || true)"
+[ "${sup_count}" -eq 1 ] || fail "Expected 1 supervisord start line, saw ${sup_count}"
+if grep -q 'Connection refused.*host: "localhost"' <<< "${app_logs}"; then
+ fail "Startup banner probe triggered transient nginx Connection refused error"
+fi
# Persisted generated SECRET_KEY must live in /data/uploads/.secret_key with 0600 & 999:999.
key_meta="$(docker exec "${APP_CTR}" stat -c '%u:%g:%a:%s' /data/uploads/.secret_key)"