postgres-container-ops
БесплатноБез исполняемых скриптовНе проверенPostgreSQL container operations for the docker instance: volume persistence audit (PGDATA layout and the PG18 version-specific data-directory change)…
от fmflurry★ 173 звезды на GitHubОб этом скилле
PostgreSQL Container Operations
Target version: postgres:16-alpine — this repository's gc-platform-postgres container (db gcplatform, owner role gcplatform, data on named volume postgres-data → /var/lib/postgresql/data). The second Postgres, gc-platform-langfuse-postgres (Langfuse observability tier), is out of scope for this skill unless explicitly asked.
Contract: auditing is read-only (docker volume inspect, docker inspect, docker ps, pg_isready). Every upgrade, dump/restore, volume, or server-config command below is emitted ONLY as a ⚠️ HUMAN CONFIRMATION REQUIRED block — if postgres-dba is installed, that agent never executes upgrades, restores, or config changes; otherwise database-reviewer or the main agent does not either. Image-layout facts marked (verified) are confirmed against the official docker-library postgres README; facts marked ⚠️ are established guidance to verify before acting.
Source of truth for image behaviour: https://github.com/docker-library/docs/blob/master/postgres/README.md (verified). pg_upgrade mechanics: https://www.postgresql.org/docs/current/pgupgrade.html ⚠️.
Connection / inspection:
docker exec gc-platform-postgres psql -U gcplatform -d gcplatform -c "<query>"
docker exec gc-platform-postgres pg_isready -U gcplatform -d gcplatform
1. Volume persistence audit
Where the data physically lives is the single most important container fact. Get it wrong and a container re-create silently loses the database.
# Named volume + its host mountpoint:
docker volume inspect postgres-data
# What is actually mounted inside the container, and where:
docker inspect --format '{{range .Mounts}}{{.Type}} {{.Name}} -> {{.Destination}}{{println}}{{end}}' gc-platform-postgres
# Restart-survival probe (read-only): the data dir must be on the named volume, not an anonymous one:
docker inspect --format '{{range .Mounts}}{{if eq .Destination "/var/lib/postgresql/data"}}{{.Name}} ({{.Type}}){{end}}{{end}}' gc-platform-postgres
Interpretation:
- PG ≤ 17 (this repo, on 16): the image declares its
VOLUMEat/var/lib/postgresql/data, andPGDATAdefaults there. The data volume must be mounted at/var/lib/postgresql/data. (verified) Mounting at/var/lib/postgresqlon PG ≤ 17 WILL NOT PERSIST data: the runtime auto-creates an anonymous volume at the declared path and data is written there instead, lost on container deletion. (verified) - PG18+ layout change (matters for any 16→18 upgrade plan): from PostgreSQL 18 the image makes
PGDATAversion-specific —/var/lib/postgresql/<major>/docker(e.g./var/lib/postgresql/18/docker) — and moves the declaredVOLUMEup to/var/lib/postgresql. Mounts/volumes must target the new location. (verified) This is precisely what enables the fastpg_upgrade --linkpath (see §5): old and new data directories coexist under one mounted/var/lib/postgresql. (verified) - Opt-in early: you can adopt the PG18 layout on 16/17 by setting
PGDATAexplicitly (PGDATA=/var/lib/postgresql/17/docker) and mounting the volume at/var/lib/postgresql— but to migrate pre-existing data you must first move all database files into a<PG_MAJOR>/dockersubdirectory of the volume. (verified) Treat that move as a mutation (human-only, with a fresh backup). - Anonymous volume or bind-mount into the repo tree = CRITICAL. Anonymous volumes vanish with
docker compose down; repo-tree bind-mounts corrupt on macOS Docker file-sharing.docker volume rm postgres-datastays on the never-execute list ifpostgres-dbais installed, anddatabase-revieweror the main agent does not run it otherwise — deletion is a human decision taken with a verified backup in hand.
Severity: CRITICAL (data not on the named volume postgres-data; anonymous volume; restart loses data); HIGH (bind-mount into repo tree); else OK.
Remediation: a volume/mount fix is a compose change. If coder is installed, dispatch to that agent with a precise brief, then a human applies it. Otherwise the main agent loads the coder skill, writes the compose change inline, and a human applies it. Never re-point or delete a volume without a verified restorable backup (see postgres-backup-restore §5 restore-drill).
2. /dev/shm sizing (shm_size)
docker inspect --format '{{.HostConfig.ShmSize}}' gc-platform-postgres # bytes; 67108864 = 64MB
Interpretation: Docker defaults a container's /dev/shm to 64MB. PostgreSQL uses POSIX shared memory for parallel-query coordination; when /dev/shm is exhausted, parallel workers fail with ERROR: could not resize shared memory segment ... : No space left on device. The official postgres image documents 64MB as a known pitfall and recommends raising it (its compose example uses shm_size: 128mb; ⚠️ heuristic: ≥ 256MB for parallel workloads). (verified re: the 64MB default + the error; the 256MB figure is
Установить postgres-container-ops в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл postgres-container-ops?
PostgreSQL container operations for the docker instance: volume persistence audit (PGDATA layout and the PG18 version-specific data-directory change), /dev/shm sizing (shm_size), pg_isready healthcheck tuning, minor-version pin policy (16-alpine to explicit 16.x-alpine), the major-version upgrade runbook (pg_upgrade --link vs pg_dump/restore fallback), and the /docker-entrypoint-initdb.d init-scripts caveat. Use when asked about container upgrade, pg_upgrade, postgres version bump, volume persistence, shm_size, healthcheck tuning, init scripts, or pin tag. Target: postgres:16-alpine (container gc-platform-postgres). If `postgres-dba` is installed, read this alongside that agent; otherwise read it alongside `database-reviewer` or do the work in the main agent.
Как установить скилл postgres-container-ops?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл postgres-container-ops запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic