Skip to content

fix(docker): auto-init on empty /data so first Render deploy can boot#5

Merged
aaronbrethorst merged 2 commits into
mainfrom
hooksyml
May 9, 2026
Merged

fix(docker): auto-init on empty /data so first Render deploy can boot#5
aaronbrethorst merged 2 commits into
mainfrom
hooksyml

Conversation

@aaronbrethorst
Copy link
Copy Markdown
Member

Summary

  • Render Blueprint deploys crash-loop on first boot because the freshly-mounted /data disk has no hooks.yaml, and Render's Shell tab is gated on a running instance — so the documented hooks init recovery is unreachable.
  • New docker-entrypoint.sh runs hooks init --dir /data only when both hooks.yaml and hooks.db are absent, then execs the binary. The admin token + bootstrap signup URL print to the service log on first boot.
  • Subcommands (init, invite, prune, verify, help, -h, --help) bypass the auto-init so docker run hooks prune ... etc. still pass through unchanged.
  • Updated docs/quickstart.md 3b and added TestImageFirstBootAutoInit covering the empty-/data path end-to-end.

Test plan

  • make lint — 0 issues
  • make test — all unit suites pass
  • go test -tags docker ./dockertest/ -count=1 — 10 PASS, 1 expected SKIP (UID-translating Docker Desktop)
  • TestImageFirstBootAutoInit (new) confirms: empty /data → server reaches /healthz 200 → hooks.yaml and hooks.db materialize → admin token line printed
  • Existing TestImageInitFailsClearlyOn0o755HostDir still skips/passes — explicit init subcommand still goes through unchanged
  • Re-deploy on Render to confirm the crash loop is gone (manual)

A fresh Render Blueprint deploy provisions an empty 1 GiB disk at /data,
so the server entrypoint hit `read config: open hooks.yaml: no such file`
and crash-looped. The documented "Shell in and run `hooks init`" recovery
path is unreachable on first deploy because Render's Shell tab requires a
running instance.

Add docker-entrypoint.sh that runs `hooks init --dir /data` exactly when
both hooks.yaml and hooks.db are absent, then exec's the binary. Explicit
subcommands (init/invite/prune/verify/help) bypass the bootstrap. The
admin token + bootstrap signup URL print to the service log on first
boot — same place they'd land if run from Shell.

Update docs/quickstart.md section 3b to reflect the new flow, and add
TestImageFirstBootAutoInit covering the empty-/data path end-to-end.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

Warning

Rate limit exceeded

@aaronbrethorst has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 59 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 607df70d-2137-41bc-857b-78e2fce59a55

📥 Commits

Reviewing files that changed from the base of the PR and between 9a0f3f0 and 28b84b4.

📒 Files selected for processing (4)
  • Dockerfile
  • docker-entrypoint.sh
  • dockertest/docker_test.go
  • docs/quickstart.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hooksyml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…n gate

Sonar flagged 17.9% duplication on new code: TestImageFirstBootAutoInit
and TestImageServesHealthEndpoints share the same docker-run + cleanup +
hostPort envelope. Lift it into runImageDetached and call from both.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 9, 2026

@aaronbrethorst aaronbrethorst merged commit 776bf8e into main May 9, 2026
7 checks passed
@aaronbrethorst aaronbrethorst deleted the hooksyml branch May 9, 2026 22:51
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