railway-postgres-setup
2026-03-14
## Railway PostgreSQL Setup
- Single PostgreSQL instance (v16.11) shared by n8n and Mattermost
- n8n uses `railway` database, Mattermost uses `postgres` database
- Umami has its own service but is NOT connected to this PostgreSQL (needs separate DATABASE_URL config)
- Volume: upgraded from 500MB to 1GB on 2026-03-14
- Redis service for n8n, Valkey service for Umami
## Incident: 2026-03-13 21:34 UTC — PostgreSQL PANIC crash
- Root cause: `No space left on device` on WAL file fdatasync
- WAL default `max_wal_size` was 1GB, could exceed the 500MB volume during spikes
- Actual data usage was only ~40MB across all databases
- Volume usage chart showed steady ~100MB — crash was caused by transient WAL spike
## Changes applied (2026-03-14)
```sql
ALTER SYSTEM SET max_wal_size = '128MB'; -- was 1GB
ALTER SYSTEM SET min_wal_size = '32MB'; -- was 80MB
ALTER SYSTEM SET temp_file_limit = '50MB'; -- was unlimited (-1)
```
- `checkpoint_completion_target` was already 0.9 (good)
- Volume upgraded from 500MB to 1GB for extra headroom