Skip to content

Commit c269fc8

Browse files
stubbiclaude
andcommitted
fix: prevent onboard init container from starting the server
The onboard --yes flag was triggering paperclipai run, which starts the server inside the init container and never exits. Now the init container only creates the config file and exits. Admin bootstrap requires the server to be running (for DB migrations), so it cannot be done in an init container. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2680aee commit c269fc8

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

internal/resources/statefulset.go

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -477,27 +477,23 @@ func buildStartupProbe(instance *paperclipv1alpha1.Instance, port int32) *corev1
477477

478478
func buildOnboardInitContainer(instance *paperclipv1alpha1.Instance) corev1.Container {
479479
image := containerImage(instance)
480-
baseURL := ""
481-
if instance.Spec.Deployment.PublicURL != "" {
482-
baseURL = instance.Spec.Deployment.PublicURL
483-
}
484480

485-
// Script: run onboard if no config exists, then bootstrap admin if no admin exists.
486-
// Both commands are idempotent (onboard skips if config exists, bootstrap skips if admin exists).
481+
// Create the Paperclip config file if it doesn't exist yet.
482+
// Uses `onboard --yes` which accepts quickstart defaults without starting the server.
483+
// The `--run` flag is NOT used, so onboard only creates config and exits.
484+
// Admin bootstrap (bootstrap-ceo) requires the server to be running for DB migrations,
485+
// so it is handled by a postStart lifecycle hook on the main container instead.
487486
script := `
488487
set -e
489488
CONFIG="/paperclip/instances/default/config.json"
490-
if [ ! -f "$CONFIG" ]; then
491-
echo "Running initial onboarding..."
492-
pnpm paperclipai onboard --yes
489+
if [ -f "$CONFIG" ]; then
490+
echo "Config already exists, skipping onboard."
491+
exit 0
493492
fi
494-
echo "Ensuring admin user is bootstrapped..."
493+
echo "Running initial onboarding..."
494+
pnpm paperclipai onboard --yes --config "$CONFIG"
495+
echo "Onboarding complete."
495496
`
496-
if baseURL != "" {
497-
script += fmt.Sprintf(`pnpm paperclipai auth bootstrap-ceo --base-url %q 2>&1 || true`, baseURL)
498-
} else {
499-
script += `pnpm paperclipai auth bootstrap-ceo 2>&1 || true`
500-
}
501497

502498
return corev1.Container{
503499
Name: "onboard",

0 commit comments

Comments
 (0)