| 1 | # Managed by Ansible — edits here are overwritten on next deploy. |
| 2 | # Tunes for shithub's MVP single-droplet workload. |
| 3 | |
| 4 | listen_addresses = 'localhost' # over WG only; no public Postgres |
| 5 | port = 5432 |
| 6 | max_connections = 100 |
| 7 | shared_buffers = 512MB # ~25% of 2GB droplet RAM |
| 8 | effective_cache_size = 1500MB # rough working set hint |
| 9 | maintenance_work_mem = 64MB |
| 10 | work_mem = 8MB |
| 11 | wal_level = replica # required for WAL archiving (S37) |
| 12 | archive_mode = on |
| 13 | archive_command = '/usr/local/bin/shithub-pg-archive %p %f' |
| 14 | archive_timeout = 60 # at least one segment per minute |
| 15 | checkpoint_completion_target = 0.9 |
| 16 | |
| 17 | # pg_stat_statements (S36 perf-pass requirement; S37 deploy installs). |
| 18 | shared_preload_libraries = 'pg_stat_statements' |
| 19 | pg_stat_statements.max = 5000 |
| 20 | pg_stat_statements.track = all |
| 21 | |
| 22 | # Logging — minimal noise, slow-query attention. |
| 23 | log_destination = 'stderr' |
| 24 | logging_collector = on |
| 25 | log_directory = 'log' |
| 26 | log_filename = 'postgresql-%a.log' |
| 27 | log_rotation_age = 1d |
| 28 | log_rotation_size = 0 |
| 29 | log_min_duration_statement = 500 # log queries slower than 500ms |
| 30 | log_line_prefix = '%t [%p]: db=%d,user=%u,app=%a ' |
| 31 | log_lock_waits = on |
| 32 | log_temp_files = 0 |
| 33 | |
| 34 | # Autovacuum — defaults are fine for our row volume; document here so |
| 35 | # the next operator knows we considered it. |
| 36 | autovacuum = on |