mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 12:20:09 +00:00
6f0d71ee9b
Improve entrypoint handling for external services and startup wrappers. entrypoint.sh now more robustly parses REDIS_URL (handles optional :password@host) and masks credentials when printing DATABASE_URL/REDIS_URL. It exports USE_EXTERNAL_POSTGRES and USE_EXTERNAL_REDIS so supervisor wrappers can decide behavior without re-parsing URLs. The temporary PostgreSQL shutdown was moved to after Prisma migrations and a warning was added when pushing schema to an external DB. postgres-start.sh and redis-start.sh were simplified to check the USE_EXTERNAL_* flags and sleep if an external service is configured. Also cleaned up formatting of the PostgreSQL ownership error message.
22 lines
639 B
Bash
22 lines
639 B
Bash
#!/bin/bash
|
|
# PostgreSQL startup wrapper for unified container
|
|
# Checks USE_EXTERNAL_POSTGRES flag (set by entrypoint) to decide whether
|
|
# to start the local instance or sleep to keep supervisord happy.
|
|
|
|
set -e
|
|
|
|
# Load environment from /etc/environment (set by entrypoint)
|
|
if [ -f /etc/environment ]; then
|
|
set -a
|
|
source /etc/environment
|
|
set +a
|
|
fi
|
|
|
|
if [ "$USE_EXTERNAL_POSTGRES" = "true" ]; then
|
|
echo "[PostgreSQL] External database configured - skipping local instance"
|
|
exec sleep infinity
|
|
fi
|
|
|
|
echo "[PostgreSQL] Starting local PostgreSQL server..."
|
|
exec /usr/lib/postgresql/16/bin/postgres -D /var/lib/postgresql/data
|