mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-20 16:51:10 +00:00
Add configurable POSTGRES_PORT and REDIS_PORT for external databases
Make database ports configurable for users with external PostgreSQL/Redis. - Add POSTGRES_PORT and REDIS_PORT to docker-compose.yml (web and celery) - Remove hardcoded CELERY_BROKER_URL (Django builds it from components) - Add REDIS_PORT export to entrypoint.sh and profile variables - Add Redis connection check for modular mode (matches PostgreSQL pattern) Users can now specify custom ports for external databases: [defaults] POSTGRES_PORT=5432 REDIS_PORT=6379
This commit is contained in:
parent
557e192d4c
commit
47b591bacb
2 changed files with 28 additions and 3 deletions
|
|
@ -12,11 +12,12 @@ services:
|
|||
environment:
|
||||
- DISPATCHARR_ENV=modular
|
||||
- POSTGRES_HOST=db
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_DB=dispatcharr
|
||||
- POSTGRES_USER=dispatch
|
||||
- POSTGRES_PASSWORD=secret
|
||||
- REDIS_HOST=redis
|
||||
- CELERY_BROKER_URL=redis://redis:6379/0
|
||||
- REDIS_PORT=6379
|
||||
- DISPATCHARR_LOG_LEVEL=info
|
||||
# Legacy CPU Support (Optional)
|
||||
# Uncomment to enable legacy NumPy build for older CPUs (circa 2009)
|
||||
|
|
@ -60,11 +61,12 @@ services:
|
|||
environment:
|
||||
- DISPATCHARR_ENV=modular
|
||||
- POSTGRES_HOST=db
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_DB=dispatcharr
|
||||
- POSTGRES_USER=dispatch
|
||||
- POSTGRES_PASSWORD=secret
|
||||
- REDIS_HOST=redis
|
||||
- CELERY_BROKER_URL=redis://redis:6379/0
|
||||
- REDIS_PORT=6379
|
||||
- DISPATCHARR_LOG_LEVEL=info
|
||||
#- CELERY_NICE_LEVEL=5 #Celery/EPG/Background tasks (default:5, low priority; Range: -20 to 19)
|
||||
- DJANGO_SETTINGS_MODULE=dispatcharr.settings
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ export POSTGRES_PORT=${POSTGRES_PORT:-5432}
|
|||
export PG_VERSION=$(ls /usr/lib/postgresql/ | sort -V | tail -n 1)
|
||||
export PG_BINDIR="/usr/lib/postgresql/${PG_VERSION}/bin"
|
||||
export REDIS_HOST=${REDIS_HOST:-localhost}
|
||||
export REDIS_PORT=${REDIS_PORT:-6379}
|
||||
export REDIS_DB=${REDIS_DB:-0}
|
||||
export DISPATCHARR_PORT=${DISPATCHARR_PORT:-9191}
|
||||
export LIBVA_DRIVERS_PATH='/usr/local/lib/x86_64-linux-gnu/dri'
|
||||
|
|
@ -115,7 +116,7 @@ if [[ ! -f /etc/profile.d/dispatcharr.sh ]]; then
|
|||
PATH VIRTUAL_ENV DJANGO_SETTINGS_MODULE PYTHONUNBUFFERED PYTHONDONTWRITEBYTECODE
|
||||
POSTGRES_DB POSTGRES_USER POSTGRES_PASSWORD POSTGRES_HOST POSTGRES_PORT
|
||||
DISPATCHARR_ENV DISPATCHARR_DEBUG DISPATCHARR_LOG_LEVEL
|
||||
REDIS_HOST REDIS_DB POSTGRES_DIR DISPATCHARR_PORT
|
||||
REDIS_HOST REDIS_PORT REDIS_DB POSTGRES_DIR DISPATCHARR_PORT
|
||||
DISPATCHARR_VERSION DISPATCHARR_TIMESTAMP LIBVA_DRIVERS_PATH LIBVA_DRIVER_NAME LD_LIBRARY_PATH
|
||||
CELERY_NICE_LEVEL UWSGI_NICE_LEVEL DJANGO_SECRET_KEY
|
||||
)
|
||||
|
|
@ -192,6 +193,28 @@ except Exception:
|
|||
echo "✅ External PostgreSQL is ready"
|
||||
fi
|
||||
|
||||
# Wait for Redis to be ready (modular mode uses external Redis)
|
||||
if [[ "$DISPATCHARR_ENV" == "modular" ]]; then
|
||||
echo "🔗 Modular mode: Using external Redis at ${REDIS_HOST}:${REDIS_PORT}"
|
||||
echo_with_timestamp "Waiting for external Redis to be ready..."
|
||||
until python3 -c "
|
||||
import socket
|
||||
import sys
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.settimeout(2)
|
||||
s.connect(('${REDIS_HOST}', ${REDIS_PORT}))
|
||||
s.close()
|
||||
sys.exit(0)
|
||||
except Exception:
|
||||
sys.exit(1)
|
||||
" 2>/dev/null; do
|
||||
echo_with_timestamp "Waiting for Redis at ${REDIS_HOST}:${REDIS_PORT}..."
|
||||
sleep 1
|
||||
done
|
||||
echo "✅ External Redis is ready"
|
||||
fi
|
||||
|
||||
# Ensure database encoding is UTF8 (handles both internal and external databases)
|
||||
ensure_utf8_encoding
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue