Update .gitignore to exclude specific database backup files, modify docker-compose.yaml to use the standard PostgreSQL image, enhance PostgreSQL configuration with custom settings, and update backup file naming in helper.md for consistency.

This commit is contained in:
Yuri-Lima
2026-03-08 10:06:09 +01:00
parent 04b0a70806
commit 481af56193
4 changed files with 739 additions and 8 deletions

View File

@@ -46,7 +46,7 @@ services:
network_mode: bridge
postgres:
restart: always
image: "postgres:17.5-alpine"
image: "postgres:17.5"
container_name: phoenixDB # Hostname
logging:
driver: "json-file"
@@ -71,6 +71,57 @@ services:
TZ: Europe/Berlin
volumes:
- "./database:/var/lib/postgresql/data"
shm_size: 1gb
command:
- postgres
# Connection (listen_addresses=* needed for Docker; localhost is default) Without keepalives, PostgreSQL can keep “zombie” connections until something times out
- -c
- tcp_keepalives_idle=600
- -c
- tcp_keepalives_interval=30
- -c
- tcp_keepalives_count=3
# Memory (defaults: shared_buffers=128MB, work_mem=4MB, maintenance_work_mem=64MB)
- -c
- shared_buffers=512MB
- -c
- effective_cache_size=1536MB
- -c
- work_mem=16MB
- -c
- maintenance_work_mem=256MB
# WAL (defaults: min_wal=80MB, max_wal=1GB, checkpoint_timeout=5min) This reduces checkpoint frequency and related I/O spikes.
- -c
- min_wal_size=1GB
- -c
- max_wal_size=4GB
- -c
- checkpoint_timeout=10min
- -c
- checkpoint_warning=5min
# Query planner (defaults: random_page_cost=4, effective_io_concurrency=1; tuned for SSD)
- -c
- random_page_cost=1.1
- -c
- effective_io_concurrency=200
# Logging (defaults: log_statement=none, log_min_duration=-1, log_connections=off)
- -c
- log_statement=mod
- -c
- log_min_duration_statement=5000
- -c
- log_lock_waits=on
# - -c
# - "log_line_prefix=%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h "
# Autovacuum (more aggressive scale factors than defaults 0.2 / 0.1)
- -c
- autovacuum_vacuum_scale_factor=0.1
- -c
- autovacuum_analyze_scale_factor=0.05
# Locale
- -c
- timezone=Europe/Berlin
# deploy:
# restart_policy: # Define how the service should restart when it fails
# condition: on-failure # Only restart if the container exits with a non-zero code
@@ -79,11 +130,11 @@ services:
# window: 120s # Time window to evaluate restart attempts (resets counter after this period)
# resources: # Resource allocation and limits for the container
# limits: # Maximum resources the container can use
# cpus: "0.75" # Maximum CPU cores (75% of one core)
# memory: 768M # Maximum memory usage (768 megabytes)
# cpus: "2" # Maximum CPU cores (2.5 cores for medium resources)
# memory: 2G # Maximum memory usage (2 gigabytes)
# reservations: # Guaranteed minimum resources for the container
# cpus: "0.25" # Reserved CPU cores (25% of one core)
# memory: 256M # Reserved memory (256 megabytes)
# cpus: "0.5" # Reserved CPU cores (50% of one core)
# memory: 512M # Reserved memory (512 megabytes)
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s # Time between each health check
@@ -285,6 +336,8 @@ services:
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
- "./temp_backups:/usr/src/app/packages/dev-server/temp-backups" # Staging for backup creation; pre-restore asset copy; restore marker -> Mostly short-lived -> Clean periodically to free disk space.
- "./backups:/usr/src/app/packages/dev-server/backups" # Long-term storage for LOCAL backups -> Persistent
# - "./logs:/usr/src/app/packages/dev-server/logs"
phoenix-worker:
restart: always
@@ -348,6 +401,8 @@ services:
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
- "./temp_backups:/usr/src/app/packages/dev-server/temp-backups" # Staging for backup creation; pre-restore asset copy; restore marker -> Mostly short-lived -> Clean periodically to free disk space.
- "./backups:/usr/src/app/packages/dev-server/backups" # Long-term storage for LOCAL backups -> Persistent
# - "./logs:/usr/src/app/packages/dev-server/logs"
phoenix-redis:
image: redis:7.2-alpine