fix: bootstrap waits for S3 instead of aborting the rest of deploy

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-08-24 06:05:50 -05:00
parent ca9e4b6676
commit 86e330d004

View File

@ -365,9 +365,16 @@ start_stack() {
}
ensure_bucket_and_admin() {
sleep 3
"$APP_DIR/backend/.venv/bin/python" - <<PY
import boto3
log "wait for S3 then create bucket"
local i
for i in $(seq 1 20); do
if curl -fsS -o /dev/null --max-time 2 "http://127.0.0.1:${S3_PORT}/" || ss -lnt | grep -q ":${S3_PORT}$"; then
break
fi
sleep 2
done
"$APP_DIR/backend/.venv/bin/python" - <<PY || log "WARN: S3 bucket create skipped (app still runs)"
import boto3, sys
from botocore.client import Config
c=boto3.client("s3", endpoint_url="http://127.0.0.1:${S3_PORT}",
aws_access_key_id="${S3_ACCESS}", aws_secret_access_key="${S3_SECRET}",
@ -380,7 +387,7 @@ except Exception as e:
print(c.list_buckets())
PY
mkdir -p "$APP_DIR/pb/pb_data"
"$APP_DIR/pb/pocketbase" superuser upsert "$PB_ADMIN_EMAIL" "$ADMIN_PASS" || true
"$APP_DIR/pb/pocketbase" superuser upsert "$PB_ADMIN_EMAIL" "$ADMIN_PASS" || log "WARN: pb superuser upsert skipped"
}
write_nginx_vhost() {