fix: Add database stability monitoring and improve PostgreSQL config

- Add monitor-db-stability.sh for automatic recovery
- Improve PostgreSQL shutdown settings to prevent data loss
- Add checkpoint and WAL settings for better persistence
This commit is contained in:
Apple
2025-12-03 09:59:41 -08:00
parent 0c75ded63a
commit 19e8436a02
2 changed files with 92 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ services:
POSTGRES_DB: daarion
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
# Prevent data loss: ensure proper shutdown
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
ports:
- "5432:5432"
volumes:
@@ -24,6 +26,8 @@ services:
timeout: 5s
retries: 5
start_period: 30s
# Add command to ensure proper shutdown and prevent data loss
command: postgres -c shared_buffers=256MB -c max_connections=200 -c checkpoint_timeout=15min -c wal_level=replica -c max_wal_size=1GB
# Automatic database backups
db-backup: