Setup: public hub provision (GitHub-hosted)
Follow this after Phase 1 code is on main. You create the public GitHub repo yourself; the agent cannot create repos with your account.
The default workflow template runs Terraform and provision scripts on ubuntu-latest in the public repo (checks out private home-dashboard with a PAT). Hub signup jobs should finish in roughly the same time as a manual provision on GitHub-hosted runners (~2 minutes), without queuing on the VPS self-hosted runner.
1. Create the public repository
- GitHub → New repository.
- Name:
lovely-hub-provision(or your org’s naming convention). - Visibility: Public.
- Do not initialize with a README if you plan to push a single workflow file from the template.
2. Add the workflow
From a machine with gh auth login and push access to the public repo:
node scripts/sync-public-provision-workflow.mjs --repo marklovely/lovely-hub-provisionAfter #504 or any template change on main, re-run that command (or sync everything):
node scripts/sync-all-public-orchestrator-workflows.mjs --repo marklovely/lovely-hub-provisionManual fallback: copy public-repo-workflow-template.yml into .github/workflows/hub-provision-dispatch.yml on the public repo (strip the header comments above name: Hub provision dispatch).
PR CI (optional, same public repo): add .github/workflows/hub-ci-dispatch.yml from public-repo-workflow-template-ci-dispatch.yml and follow public-ci-dispatch.md.
Hub Pages CD (optional, same public repo): add .github/workflows/hub-cd-dispatch.yml via node scripts/sync-public-cd-workflow.mjs and follow public-cd-dispatch.md (Cloudflare secrets on the public repo).
Rollback to thin forward (VPS-heavy): use public-repo-workflow-template-thin-forward.yml and --profile orchestrator for secrets instead.
3. Configure public repo secrets
Sync the full provision secret set plus checkout credentials (never commit hub.tfvars):
# Env-only values if not in tfvars / terraform state:
# export TF_STATE_R2_ACCESS_KEY_ID=...
# export TF_STATE_R2_SECRET_ACCESS_KEY=...
# export GOOGLE_PLACES_API_KEY=...
# export OS_PLACES_API_KEY=...
# export HUB_PROXY_SECRETS_JSON='...' # or --hub-proxy-secrets-json path
node scripts/sync-hub-tfvars-to-github-secrets.mjs \
--repo marklovely/lovely-hub-provision \
--profile provision \
--from-terraform-state \
--skip-missingThis sets Cloudflare, Stripe, Terraform state, PLATFORM_GITHUB_TOKEN, and:
| Secret | Purpose |
|---|---|
HOME_DASHBOARD_REPO | marklovely/home-dashboard |
HOME_DASHBOARD_REF | Branch to checkout (default main). Lifecycle test homes (e2e-*) are provisioned from the commit platform-sandbox serves instead (public-lifecycle-dispatch.md, #1129). |
HOME_DASHBOARD_DISPATCH_TOKEN | PAT with Contents: Read on the private repo (checkout + optional dispatch; defaults to platform_github_token from tfvars) |
Override if the hub PAT should not read the private repo:
export HOME_DASHBOARD_DISPATCH_TOKEN='github_pat_...'Use --dry-run to list names without writing.
Keep the same provision secrets on marklovely/home-dashboard if you still run manual or push-triggered provision on the self-hosted runner.
PAT requirements
HOME_DASHBOARD_DISPATCH_TOKEN (public repo, checkout):
- Fine-grained: repository
home-dashboard, Contents: Read. - Classic:
reposcope for the private monorepo.
PLATFORM_GITHUB_TOKEN (on public repo, synced from tfvars):
- Must push registry snapshots and update GitHub secrets (
HUB_PROXY_SECRETS_JSONprune) — same as on the private repo.
Hub-jobs PLATFORM_GITHUB_TOKEN:
- Must dispatch
hub-provision-dispatch.ymlon the public repo (actions:writeonlovely-hub-provision).
4. Grant hub-jobs access to the public repo
Test from a shell (replace token):
curl -sS -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer YOUR_HUB_JOBS_PAT" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/marklovely/lovely-hub-provision/actions/workflows/hub-provision-dispatch.yml/dispatches \
-d '{"ref":"main","inputs":{"site_id":"demo","job_action":"provision","skip_pages":"false","skip_platform_admin":"true"}}'Expect HTTP 204. Confirm a run on the public repo completes on ubuntu-latest (provision + registry enqueue). No child run is required on the private repo for hub-jobs provision/teardown.
Hosted jobs must set PLATFORM_GITHUB_REPO to marklovely/home-dashboard in the workflow (GitHub does not allow overriding GITHUB_REPOSITORY). The workflow template sets this from HOME_DASHBOARD_REPO.
5. Deploy hub-jobs Worker code
Marketing signup enqueues provision on lovely-home-hub-jobs. The Worker script must be redeployed from this repo (platform admin Terraform apply). As of the default in code, provision/teardown target marklovely/lovely-hub-provision unless USE_LEGACY_VPS_HUB_PROVISION=true on the Worker.
Set on the Worker (recommended, overrides code default):
PLATFORM_GITHUB_REPO=marklovely/home-dashboardGITHUB_PROVISION_REPO=marklovely/lovely-hub-provision
Redeploy platform Pages production after merging billing/queue fixes so Stripe webhooks use the queue path on main.
6. Flip hub-jobs (Phase 3)
Option A — Terraform (recommended)
In platform hub.tfvars (not committed):
github_provision_repo = "marklovely/lovely-hub-provision"
github_provision_workflow = "hub-provision-dispatch.yml"Run Actions → Platform admin Terraform with apply-platform-admin.
Option B — Cloudflare dashboard
On Worker lovely-home-hub-jobs, add plain-text vars:
GITHUB_PROVISION_REPO=marklovely/lovely-hub-provisionGITHUB_PROVISION_WORKFLOW=hub-provision-dispatch.yml(optional)
Leave PLATFORM_GITHUB_REPO as marklovely/home-dashboard for registry jobs. Do not point PLATFORM_GITHUB_REPO at the public repo unless you also set GITHUB_PROVISION_REPO — hub-jobs needs the split so registry jobs stay on the private monorepo.
7. Verify end-to-end
- Trigger a test provision (Stripe test signup or manual dispatch).
- Public repo:
Hub provision dispatch→ jobsresolve-stack,provisiononubuntu-latest(~2 min typical). - Private repo:
platform-site-registry.ymlstill runs for registry record/drop from hub-jobs queue. - Push-to-
mainauto-provision on the private repo still uses the self-hosted runner unless you change that workflow separately.
Rollback
- Routing: Remove
GITHUB_PROVISION_REPOfrom the Worker (or clear tfvars and re-apply). Hub-jobs dispatches private workflows again. - Hosted → VPS forward: Replace the public workflow with public-repo-workflow-template-thin-forward.yml and sync
--profile orchestratoronly.
Reference
- hub-provision-public-actions.md — phases, secret names, env vars