Skip to content

fix(image): name the role and database in the health check - #3

Merged
AnnatarHe merged 1 commit into
mainfrom
fix/healthcheck-role
Oct 24, 2026
Merged

AnnatarHe merged 1 commit into
mainfrom
fix/healthcheck-role

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The image's HEALTHCHECK ran pg_isready -q -h 127.0.0.1 with no user. pg_isready then connects as the OS user (root) to a database named root. It still exits 0, so the container shows healthy, but the server logs FATAL: role "root" does not exist on every probe: 8,640 lines a day at the 10 s interval. We saw this right after moving the rta staging Postgres onto ghcr.io/rawback-app/db:1.0.0.

  • Dockerfile: the health check is now pg_isready -q -h 127.0.0.1 -U "${POSTGRES_USER:-postgres}" -d postgres, in shell form so POSTGRES_USER expands inside the container. The postgres database always exists after initdb, whatever POSTGRES_USER and POSTGRES_DB are. It still probes over TCP, so first start behaves as before.
  • test/smoke.sh: runs the same line, then fails if the server logged FATAL: role/database … does not exist. Without that check, the old command would have passed the smoke test, since pg_isready exits 0 either way.
  • README / AGENTS.md: document the new command and why it names a role and database.

Component versions: unchanged (PostgreSQL 18.6, PostGIS 3.6.4, PGroonga 4.0.9). As a fix, this cuts a patch release. Consumers only need to pull the new tag and recreate the container. The data directory and extensions are untouched, so update-extensions.sh isn't needed for this one.

Testing

On a throwaway ghcr.io/rawback-app/db:1.0.0 container, with --health-cmd set to the new line (Docker stores it as CMD-SHELL, the same as the shell-form HEALTHCHECK):

  • It went healthy in 6 s, and its probes logged 0 FATAL lines.
  • Setting POSTGRES_USER in the probe made the server log a FATAL for that role, so the variable expands in the container.
  • The old pg_isready -q -h 127.0.0.1 logged FATAL: role "root" does not exist, and the smoke test's new grep matches that line.
  • bash -n test/smoke.sh passes. shellcheck isn't installed locally; SC2016 is disabled on the one intentionally single-quoted line.

The image build plus test/smoke.sh runs in this PR's Build workflow.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

pg_isready defaulted to the OS user, so every probe connected as root to
a database named root. It still reported healthy, but the server logged
`FATAL: role "root" does not exist` every 10 s.

The HEALTHCHECK now passes -U "${POSTGRES_USER:-postgres}" -d postgres in
shell form, so the variable expands inside the container. test/smoke.sh
runs the same line and fails if the server logged a missing role or
database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-24T12:18:06.489732Z
We couldn’t complete this review. Comment @codex review to try again.
b2ba973 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@shelltime

shelltime Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

🤖 Claude Code · Migrate DB image and fix configurable health check

Migrated the remote database deployment to the rawback-app/db 1.0.0 image with 256 MB shared memory, then updated the image repository so its health check uses the configured PostgreSQL user.

💰 Cost 🔢 Tokens ⏱️ Duration 🧠 Model 💬 Prompts ✏️ Lines
$4.50 10.2M 30m (18m active) claude-opus-5-5 6 +23 / −4

10.2M tokens: 130 input · 56.3K output · 10M cache read · 170.7K cache write

📝 AI summary

Inspected the deployment over ssh rta, produced a migration plan, and carried out steps 1–5 as requested. The database container was switched to the rawback-app/db image pinned at version 1.0.0, with --shm-size=256m added. Work stopped before enabling PGroonga, preserving that as a separate future step.

In a scratch clone of rawback-app/db, updated the Dockerfile HEALTHCHECK so pg_isready runs with -U "${POSTGRES_USER:-postgres}" -d postgres. The smoke test in test/smoke.sh and documentation in README.md and AGENTS.md were also adjusted to cover and explain the health-check behavior. The changes were prepared for the requested upstream PR; no PGroonga enablement or additional follow-up work was performed after the user declined it.

View this session on ShellTime →

Updated 2026-10-25 12:18 UTC by ShellTime · totals for the whole session so far · the session page is visible to its owner

@AnnatarHe
AnnatarHe merged commit 0d2db28 into main Oct 24, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant