From 43b02d79a4c11d2c72bc81aac1d36521c1f67538 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 7 Jun 2026 16:22:09 -0400 Subject: [PATCH] fix(infra): size Postgres /dev/shm via tmpfs mount (shm_size ignored under Swarm) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- docker-compose.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f1088ef..ee793f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,17 +21,23 @@ services: postgres: 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: POSTGRES_USER: ${DB_USER:-fabledcurator} POSTGRES_PASSWORD: ${DB_PASSWORD:-fabledcurator_dev} POSTGRES_DB: ${DB_NAME:-fabledcurator} volumes: - 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: test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-fabledcurator}"] interval: 10s