Enhance PostgreSQL configuration in Docker setup, add custom settings, and update environment variable handling
This commit is contained in:
parent
c41524e517
commit
8675c5193c
3 changed files with 49 additions and 15 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
|
@ -48,6 +48,7 @@
|
||||||
"noopener",
|
"noopener",
|
||||||
"noreferrer",
|
"noreferrer",
|
||||||
"otherchannel",
|
"otherchannel",
|
||||||
|
"pgautoupgrade",
|
||||||
"platformdirs",
|
"platformdirs",
|
||||||
"prefetcher",
|
"prefetcher",
|
||||||
"psutil",
|
"psutil",
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,7 @@ INSTALLED_APPS: list[str] = [
|
||||||
"django.contrib.contenttypes",
|
"django.contrib.contenttypes",
|
||||||
"django.contrib.sessions",
|
"django.contrib.sessions",
|
||||||
"django.contrib.staticfiles",
|
"django.contrib.staticfiles",
|
||||||
|
"django.contrib.postgres",
|
||||||
"twitch.apps.TwitchConfig",
|
"twitch.apps.TwitchConfig",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,54 @@
|
||||||
services:
|
services:
|
||||||
ttvdrops_postgres:
|
ttvdrops_postgres:
|
||||||
container_name: 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:
|
environment:
|
||||||
- POSTGRES_DB=ttvdrops
|
- POSTGRES_DB=ttvdrops
|
||||||
- POSTGRES_USER=ttvdrops
|
- POSTGRES_USER=ttvdrops
|
||||||
- POSTGRES_PASSWORD=changeme
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- "5442:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/Docker/Data/ttvdrops/postgres:/var/lib/postgresql
|
- /mnt/Docker/Data/ttvdrops/postgres:/var/lib/postgresql
|
||||||
|
shm_size: '8gb'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U ttvdrops"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
ttvdrops:
|
ttvdrops:
|
||||||
container_name: ttvdrops
|
container_name: ttvdrops
|
||||||
|
|
@ -25,22 +58,21 @@ services:
|
||||||
user: 1000:1000
|
user: 1000:1000
|
||||||
environment:
|
environment:
|
||||||
- DEBUG=False
|
- DEBUG=False
|
||||||
- DJANGO_SECRET_KEY=
|
- DJANGO_SECRET_KEY=$(DJANGO_SECRET_KEY)
|
||||||
- TWITCH_CLIENT_ID=
|
- TWITCH_CLIENT_ID=$(TWITCH_CLIENT_ID)
|
||||||
- TWITCH_CLIENT_SECRET=
|
- TWITCH_CLIENT_SECRET=$(TWITCH_CLIENT_SECRET)
|
||||||
- EMAIL_HOST=smtp.gmail.com
|
- EMAIL_HOST=smtp.gmail.com
|
||||||
- EMAIL_PORT=587
|
- EMAIL_PORT=587
|
||||||
- EMAIL_HOST_USER=
|
- EMAIL_HOST_USER=$(EMAIL_HOST_USER)
|
||||||
- EMAIL_HOST_PASSWORD=
|
- EMAIL_HOST_PASSWORD=$(EMAIL_HOST_PASSWORD)
|
||||||
- EMAIL_USE_TLS=True
|
- EMAIL_USE_TLS=True
|
||||||
- EMAIL_USE_SSL=False
|
- EMAIL_USE_SSL=False
|
||||||
- POSTGRES_DB=ttvdrops
|
- POSTGRES_DB=ttvdrops
|
||||||
- POSTGRES_USER=ttvdrops
|
- POSTGRES_USER=ttvdrops
|
||||||
- POSTGRES_PASSWORD=changeme
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
- POSTGRES_HOST=ttvdrops_postgres
|
- POSTGRES_HOST=ttvdrops_postgres
|
||||||
- POSTGRES_PORT=5432
|
- POSTGRES_PORT=5432
|
||||||
volumes:
|
volumes:
|
||||||
# Data is stored in /root/.local/share/TTVDrops" inside the container
|
|
||||||
- /mnt/Docker/Data/ttvdrops/data:/root/.local/share/TTVDrops
|
- /mnt/Docker/Data/ttvdrops/data:/root/.local/share/TTVDrops
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
|
|
@ -48,7 +80,7 @@ services:
|
||||||
- internal
|
- internal
|
||||||
depends_on:
|
depends_on:
|
||||||
ttvdrops_postgres:
|
ttvdrops_postgres:
|
||||||
condition: service_healthy
|
condition: service_started
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
web:
|
web:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue