mirror of
https://github.com/tmdinosaurcenter/kiosk-guestbook.git
synced 2026-06-03 21:37:51 -06:00
fix: add set -e and gunicorn worker timeout to entrypoint
set -e ensures the script aborts on any error (e.g. failed chown) rather than silently continuing. --timeout 30 kills hung workers to prevent slow-client attacks from exhausting the worker pool.
This commit is contained in:
+7
-1
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
# Fix ownership of the data directory so appuser can write the database.
|
# Fix ownership of the data directory so appuser can write the database.
|
||||||
# This runs as root (no USER directive in Dockerfile) and is safe because
|
# This runs as root (no USER directive in Dockerfile) and is safe because
|
||||||
# we immediately drop privileges via gosu before starting the app.
|
# we immediately drop privileges via gosu before starting the app.
|
||||||
@@ -9,4 +11,8 @@ chown -R appuser:appuser "$DATA_DIR"
|
|||||||
envsubst < /app/templates/index.html.template > /app/templates/index.html
|
envsubst < /app/templates/index.html.template > /app/templates/index.html
|
||||||
|
|
||||||
# Drop to appuser and start Gunicorn
|
# Drop to appuser and start Gunicorn
|
||||||
exec gosu appuser gunicorn --bind 0.0.0.0:8000 app:app --workers ${GUNICORN_WORKERS:-3}
|
exec gosu appuser gunicorn \
|
||||||
|
--bind 0.0.0.0:8000 \
|
||||||
|
--workers ${GUNICORN_WORKERS:-3} \
|
||||||
|
--timeout 30 \
|
||||||
|
app:app
|
||||||
|
|||||||
Reference in New Issue
Block a user