Scion Hub Bootstrap, Upgrade & Reconciliation (`scion-hub-setup`)
This skill provides an end-to-end operational guide and idempotent Python reconciliation script for standing up, upgrading, or reconciling a self-hosted Scion Hub instance (combo Hub + Runtime Broker + Web UI) on Google Cloud Compute Engine (GCE).
1. Prerequisites
gcloudCLI authenticated with access to the target GCP project and GCE instance.- Passphrase-less SSH key for non-interactive GCE automation:
If
~/.ssh/google_compute_engineis passphrase-protected, generate an ephemeral key so non-interactivegcloud compute sshcommands do not hang on passphrase prompts:Terminal window ssh-keygen -t ed25519 -f /tmp/gce_tmp_key -N "" -q - Local checkout of
GoogleCloudPlatform/scion(./scripts/starter-hub/gce-start-hub.sh).
2. Helper Scripts
scripts/hub-reconcile.py— Idempotent Python reconciliation script that executes on the Hub VM (or via SSH stdin) to:- Ensure the bootstrap admin user exists in
~/.scion/hub.dband holds thesuper-adminsystem role binding (role_bindings). - Deterministically derive the HS256
user_signing_keyfromSCION_SERVER_SESSION_SECRET(~/.scion/hub.env) and mint a 365-day CLI JWT token. - Configure
server-configoperational defaults (default_harness_config,default_template). - Create the per-broker
max_agents_per_brokerentitlement binding (e.g.100or200, overriding the upstream default ceiling of12). - Set Hub-scoped Vertex AI
globalregion environment variables (GOOGLE_CLOUD_PROJECT,GOOGLE_CLOUD_REGION=global,GOOGLE_CLOUD_LOCATION=global,CLOUD_ML_REGION=global,ANTHROPIC_VERTEX_PROJECT_ID). - Update global harness configs (
claude→claude-opus-5-5@default,antigravity→Gemini 3.8 Flash (Medium),opencode), write theirconfig.yamlfiles, and optionally prune unused seeded harness configs. - Batch-import all 13 global
agent-teamtemplates (coordinator,eng-manager,developer,code-reviewer,architect,investigator,qa-tester,test-engineer,doc-writer,researcher,security-auditor,release-notes,web-builder).
- Ensure the bootstrap admin user exists in
3. End-to-End Reconciliation Workflow
Phase 1: Hub Server Upgrade & Optional Clean Database Reset
- Back up the existing SQLite database and point the VM's checkout to upstream:
Terminal window CLOUDSDK_CORE_PROJECT=<gcp-project> gcloud compute ssh scion@<vm-name> \--zone=<zone> --ssh-key-file=/tmp/gce_tmp_key --command='cp ~/.scion/hub.db ~/.scion/hub.db.bak-$(date +%Y%m%d) || truecd /home/scion/scion && git remote set-url origin https://github.com/GoogleCloudPlatform/scion.git' - Deploy the latest
mainbuild (add--reset-dbonly when wiping an unused/drifted database):Terminal window CLOUDSDK_CORE_PROJECT=<gcp-project> PROJECT_ID=<gcp-project> \HUB_NAME=<hub-short-name> CERT_DOMAIN=<hub-domain> HUB_DOMAIN=<hub-domain> \./scripts/starter-hub/gce-start-hub.sh --full --reset-db --branch main
Phase 2: Build & Push Harness Container Images
Build core-base, scion-base, and the desired agent harnesses (claude, antigravity, opencode) directly on the GCE VM and push to Artifact Registry:
CLOUDSDK_CORE_PROJECT=<gcp-project> gcloud compute ssh scion@<vm-name> \ --zone=<zone> --ssh-key-file=/tmp/gce_tmp_key --command=' cd /home/scion/scion for target in core-base scion-base claude antigravity opencode; do ./image-build/scripts/build-images.sh \ --registry us-central1-docker.pkg.dev/<gcp-project>/scion \ --target "$target" \ --push done 'Phase 3: Run Idempotent Hub Reconciliation (hub-reconcile.py)
Pipe scripts/hub-reconcile.py over SSH to bootstrap the admin user, derive the CLI token, configure quotas, environment variables, harness configs, and global agent-team templates:
CLOUDSDK_CORE_PROJECT=<gcp-project> gcloud compute ssh scion@<vm-name> \ --zone=<zone> --ssh-key-file=/tmp/gce_tmp_key \ --command='python3 - --admin-email ghchinoy@gmail.com --gcp-project <gcp-project> --registry us-central1-docker.pkg.dev/<gcp-project>/scion --broker-ceiling 100 --prune-unused-harnesses' \ < ./scripts/hub-reconcile.pySave the emitted SCION_ADMIN_TOKEN=<jwt> in ~/.scion/credentials.json under both "https://<hub-domain>" and "https://<hub-domain>/".
Phase 4: Verify Agent Service Account IAM Bindings
Ensure the Hub VM's service account (<vm-sa>@<gcp-project>.iam.gserviceaccount.com) holds roles/iam.serviceAccountTokenCreator on each agent runner service account so the Hub can mint GCP tokens for agent containers:
for SA in scion-agent-runner@<gcp-project>.iam.gserviceaccount.com sa-scion-warmup@<gcp-project>.iam.gserviceaccount.com; do gcloud iam service-accounts add-iam-policy-binding "$SA" \ --project="<gcp-project>" \ --member="serviceAccount:<vm-sa>@<gcp-project>.iam.gserviceaccount.com" \ --role="roles/iam.serviceAccountTokenCreator" \ --condition=None \ --quietdone