fix(infra): size Postgres /dev/shm via tmpfs mount (shm_size ignored under Swarm)
The prod stack runs under Docker Swarm (docker stack deploy), which SILENTLY
IGNORES `shm_size` — container inspect showed ShmSize still 64MB after the
a183be7 fix, and vacuum_analyze kept hitting DiskFull resizing a ~64MB POSIX
DSM segment in /dev/shm (operator-flagged 2026-06-07). Replace the ignored
`shm_size: 512m` with a tmpfs mount on /dev/shm (size 512MB), which Swarm AND
plain Compose both honor. Requires a stack redeploy to take effect.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+11
-5
@@ -21,17 +21,23 @@ services:
|
|||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: pgvector/pgvector:pg16
|
image: pgvector/pgvector:pg16
|
||||||
# Docker's default /dev/shm is 64MB; VACUUM (ANALYZE) and parallel queries
|
|
||||||
# allocate larger shared-memory segments and fail with
|
|
||||||
# "could not resize shared memory segment ... No space left on device"
|
|
||||||
# (operator-flagged 2026-06-07, vacuum_analyze on import_task needed 67MB).
|
|
||||||
shm_size: 512m
|
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: ${DB_USER:-fabledcurator}
|
POSTGRES_USER: ${DB_USER:-fabledcurator}
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-fabledcurator_dev}
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-fabledcurator_dev}
|
||||||
POSTGRES_DB: ${DB_NAME:-fabledcurator}
|
POSTGRES_DB: ${DB_NAME:-fabledcurator}
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
# Docker's default /dev/shm is 64MB; VACUUM (ANALYZE) + parallel queries
|
||||||
|
# allocate a POSIX dynamic-shared-memory segment in /dev/shm and fail with
|
||||||
|
# "could not resize shared memory segment ... No space left on device"
|
||||||
|
# (operator-flagged 2026-06-07, vacuum_analyze on import_task needed 67MB).
|
||||||
|
# NOTE: a `shm_size:` key is SILENTLY IGNORED under Docker Swarm
|
||||||
|
# (`docker stack deploy` — the prod deployment here), so size /dev/shm via
|
||||||
|
# a tmpfs mount instead — honored by both Swarm and plain Compose.
|
||||||
|
- type: tmpfs
|
||||||
|
target: /dev/shm
|
||||||
|
tmpfs:
|
||||||
|
size: 536870912 # 512 MB
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-fabledcurator}"]
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-fabledcurator}"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
|||||||
Reference in New Issue
Block a user