Enhance PostgreSQL configuration in Docker setup, add custom settings, and update environment variable handling

This commit is contained in:
Joakim Hellsén 2026-02-15 19:11:40 +01:00
commit 8675c5193c
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
3 changed files with 49 additions and 15 deletions

View file

@ -48,6 +48,7 @@
"noopener",
"noreferrer",
"otherchannel",
"pgautoupgrade",
"platformdirs",
"prefetcher",
"psutil",

View file

@ -152,6 +152,7 @@ INSTALLED_APPS: list[str] = [
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.staticfiles",
"django.contrib.postgres",
"twitch.apps.TwitchConfig",
]

View file

@ -1,21 +1,54 @@
services:
ttvdrops_postgres:
container_name: ttvdrops_postgres
image: postgres:17
image: docker.io/pgautoupgrade/pgautoupgrade:latest
command:
- "-c"
- "max_connections=200"
- "-c"
- "shared_buffers=4GB"
- "-c"
- "effective_cache_size=12GB"
- "-c"
- "maintenance_work_mem=1GB"
- "-c"
- "checkpoint_completion_target=0.9"
- "-c"
- "wal_buffers=16MB"
- "-c"
- "default_statistics_target=100"
- "-c"
- "random_page_cost=1.1"
- "-c"
- "effective_io_concurrency=200"
- "-c"
- "work_mem=20MB"
- "-c"
- "huge_pages=off"
- "-c"
- "min_wal_size=1GB"
- "-c"
- "max_wal_size=4GB"
- "-c"
- "max_worker_processes=12"
- "-c"
- "max_parallel_workers_per_gather=4"
- "-c"
- "max_parallel_workers=12"
- "-c"
- "max_parallel_maintenance_workers=4"
environment:
- POSTGRES_DB=ttvdrops
- POSTGRES_USER=ttvdrops
- POSTGRES_PASSWORD=changeme
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ports:
- "5442:5432"
volumes:
- /mnt/Docker/Data/ttvdrops/postgres:/var/lib/postgresql
shm_size: '8gb'
restart: unless-stopped
networks:
- internal
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ttvdrops"]
interval: 10s
timeout: 5s
retries: 5
ttvdrops:
container_name: ttvdrops
@ -25,22 +58,21 @@ services:
user: 1000:1000
environment:
- DEBUG=False
- DJANGO_SECRET_KEY=
- TWITCH_CLIENT_ID=
- TWITCH_CLIENT_SECRET=
- DJANGO_SECRET_KEY=$(DJANGO_SECRET_KEY)
- TWITCH_CLIENT_ID=$(TWITCH_CLIENT_ID)
- TWITCH_CLIENT_SECRET=$(TWITCH_CLIENT_SECRET)
- EMAIL_HOST=smtp.gmail.com
- EMAIL_PORT=587
- EMAIL_HOST_USER=
- EMAIL_HOST_PASSWORD=
- EMAIL_HOST_USER=$(EMAIL_HOST_USER)
- EMAIL_HOST_PASSWORD=$(EMAIL_HOST_PASSWORD)
- EMAIL_USE_TLS=True
- EMAIL_USE_SSL=False
- POSTGRES_DB=ttvdrops
- POSTGRES_USER=ttvdrops
- POSTGRES_PASSWORD=changeme
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=ttvdrops_postgres
- POSTGRES_PORT=5432
volumes:
# Data is stored in /root/.local/share/TTVDrops" inside the container
- /mnt/Docker/Data/ttvdrops/data:/root/.local/share/TTVDrops
restart: unless-stopped
networks:
@ -48,7 +80,7 @@ services:
- internal
depends_on:
ttvdrops_postgres:
condition: service_healthy
condition: service_started
networks:
web: