add example in docker-compose, clarify README, add clearer validation, longer timeouts for websocket connections

This commit is contained in:
Zimeng Xiong
2025-12-01 13:27:31 -08:00
parent f9986513f8
commit f8830a8b0f
4 changed files with 25 additions and 10 deletions
+8 -3
View File
@@ -1,7 +1,8 @@
#!/bin/sh
# Alpine-based image uses /bin/sh (busybox ash), not bash
set -e
# Set default backend URL if not provided
# Set default backend URL if not provided (host:port format, no protocol)
export BACKEND_URL="${BACKEND_URL:-backend:8000}"
echo "Configuring nginx with BACKEND_URL: ${BACKEND_URL}"
@@ -11,7 +12,11 @@ echo "Configuring nginx with BACKEND_URL: ${BACKEND_URL}"
envsubst '${BACKEND_URL}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
# Validate the generated nginx configuration before starting
nginx -t -c /etc/nginx/nginx.conf
echo "Validating nginx configuration..."
if ! nginx -t -c /etc/nginx/nginx.conf; then
echo "ERROR: nginx configuration validation failed" >&2
exit 1
fi
# Execute the main command (nginx)
exec "$@"
exec "$@"