Synced from Hive. This page is pulled from hivecommons/hive@v5 during the docs build. Edit the canonical source in the Hive repository.
Self-hosted hub deployment
Hive can run either as a spoke dashboard or as the hub. The same Go binary serves both roles; HIVE_MODE=hub selects the hub server in cmd/hive/main.go.
Use a self-hosted hub when you need a private registry, private SaaS provisioning, air-gapped control, or a hub URL other than https://hive.hivecommons.dev. If you only need a hosted spoke, use the hosted Hive Hub instead.
What Dockerfile.hub builds
src/Dockerfile.hub builds only ./cmd/hive, installs kubectl, creates /data and /etc/hive, sets HIVE_MODE=hub, and runs:
hive --config /etc/hive/hive.yaml
The hub listen port is still controlled by HIVE_HUB_PORT in the binary and defaults to 3001. The Dockerfile exposes port 80, so set HIVE_HUB_PORT=80 if your container platform expects the process to bind that exposed port.
Required storage
Use a persistent volume mounted at /data. The production/manual-provisioning docs describe the live hub as namespace hive-hub, PVC hive-hub-data-rwx, mounted at /data.
The hub stores live SaaS state under /data:
| Path | Purpose |
|---|---|
/data/saas/hives/<id>/meta.json | Per-hive SaaS record used by auth, upgrades, assignments, and dashboard links. |
/data/hub-registry.json | Fleet registry populated by spoke heartbeats. |
/data/saas/hub-secret.key | Optional fallback heartbeat bearer secret when HIVE_HUB_SECRET is not set on the hub. |
/data/saas/clusters.json | Cluster definitions used by automated provisioning. |
Use ReadWriteMany storage for hosted spoke PVCs. The provisioning template in pkg/hub/saas_provision.go requests ReadWriteMany and its rolling update strategy relies on both old and new pods being able to mount /data during a surge.
Minimal hub environment
| Variable | Required | Notes |
|---|---|---|
HIVE_MODE=hub | Yes | Selects hub mode. |
HIVE_HUB_PORT | No | Defaults to 3001. Set to 80 for the published hub image contract if needed. |
HIVE_CONFIG or --config | No | Defaults to /etc/hive/hive.yaml; Dockerfile.hub passes --config /etc/hive/hive.yaml. |
HIVE_HUB_SECRET | Strongly recommended | Master secret from which heartbeat bearers and per-hive keys derive. If unset, the hub reads /data/saas/hub-secret.key when present. The hub additionally maintains a rotation generation set alongside it — see security-model.md; rotate via the admin endpoint, never by swapping the master in place. Rotation does not reach spokes the hub cannot patch with kubectl; see Master rotation and spokes that hold only derived keys. |
HIVE_HUB_OAUTH_CLIENT_ID / HIVE_HUB_OAUTH_CLIENT_SECRET | Enables GitHub login | These two enable the GitHub provider specifically. Human login is multi-provider: Google, IBMid, Red Hat, Microsoft Entra ID, and a generic OIDC slot are each enabled independently via HIVE_HUB_OIDC_<PROVIDER>_CLIENT_ID (+ _CLIENT_SECRET, _ISSUER, _SCOPES, _DISPLAY — see env-vars.md). With two or more providers configured the hub shows a provider picker at /login; with exactly one it redirects straight into it; with none it logs OAuth disabled and registers no login routes. A provider with a client id but a missing/invalid issuer is silently skipped (check the hub login enabled providers= startup log line). |
HIVE_GITHUB_TOKEN or GitHub App config | Required for operations that call GitHub | Same GitHub auth rules as a spoke. |
HIVE_HUB_SLACK_BOT_TOKEN, HIVE_NTFY_SERVER, HIVE_NTFY_TOPIC | No | Optional hub notifications. |
HIVE_BACKUP_*, OCI_*, HIVE_KUBECONFIG_DIR | No | Required only for disaster-recovery backup and OCI/FSS provisioning flows. See backup-restore.md. |
Hub config shape
The hub still reads hive.yaml. The hub-specific code mainly uses the hub block, GitHub credentials, dashboard/auth settings, and any provisioning-related data under /data/saas. A minimal seed keeps the normal project and GitHub validation satisfied:
project:
org: your-org
repos: [your-repo]
primary_repo: your-repo
github:
token: ${HIVE_GITHUB_TOKEN}
dashboard:
auth_token: ${HIVE_DASHBOARD_TOKEN}
hub:
enabled: true
url: https://hive.example.com
Keep secret values in Kubernetes Secrets or environment variables; do not write token values directly into hive.yaml.
Registering spokes to your hub
A spoke points at the hub with its config hub.url or the HIVE_HUB_URL override. Protected hubs require the same heartbeat secret on every spoke:
hub:
enabled: true
url: https://hive.example.com
env:
- name: HIVE_HUB_URL
value: https://hive.example.com
- name: HIVE_HUB_SECRET
valueFrom:
secretKeyRef:
name: hive-secrets
key: HIVE_HUB_SECRET
Without HIVE_HUB_SECRET, a protected hub returns 401 unauthorized, the spoke logs hub heartbeat rejected status=401, and the hub shows the hive offline. This matches the gotcha in manual-provisioning.md.
Master rotation and spokes that hold only derived keys
A spoke can run without the master: give it the per-hive keys the hub derives (HIVE_HEARTBEAT_KEY, HIVE_SSO_PUBLIC_KEY, HIVE_SESSION_PUBLIC_KEY, HIVE_TERMINAL_KEY, HIVE_INVITE_KEY, HIVE_CUSTOMER_MATCH_KEY) instead of HIVE_HUB_SECRET. A self-service byo- hive is different: its heartbeat key is random, not derived from the master, so a master rotation does not change it. This section describes what the code does when the hub master is rotated for such a spoke. In short, there is no supported rotation procedure for a spoke that the hub cannot reach with kubectl.
What a rotation changes. POST /api/saas/admin/rotate-master-key generates a new master and writes the generation set to /data/saas/hub-generations.json. It never rewrites HIVE_HUB_SECRET or /data/saas/hub-secret.key. Once the generations file exists, the hub loads the current master from it, and HIVE_HUB_SECRET is used only when the file does not exist. After a rotation, HIVE_HUB_SECRET therefore still holds the old master, which is now the previous generation.
- The previous generation keeps verifying for seven days (
verify_until), and at most two generations are live. When the window ends, the previous generation is retired. - A second rotation inside eight hours is refused unless the request sets
force. - The hub signs with keys from the generation set, not from
HIVE_HUB_SECRET. The exception is a hub whose generations file could not be read at startup: it falls back toHIVE_HUB_SECRETand refuses to rotate until the file is fixed. Session cookies are signed with the current generation. SSO handoff tokens and heartbeat response signatures are signed per hive, with the current generation unless one of these applies while the previous generation is still inside its window:- The sweep’s last read of that hive’s Deployment found it on the previous generation. The hub signs with the previous generation, which is the only key such a spoke holds.
- The sweep has not read the hive since the hub started, and the hive’s SaaS record was created before the rotation. The hub also signs with the previous generation. A spoke the sweep has already patched holds that key as
_PREV, so it accepts the signature too.
- The sweep reads the Deployment spec, not the running pod. If a patched spoke’s new pod never becomes ready, the old pod still holds only the previous keys, and it rejects SSO handoffs and heartbeat signatures once the sweep has recorded the spoke on the current generation.
- During the window the hub verifies session cookies and heartbeat bearers against both generations. A swept spoke verifies SSO tokens, session cookies and heartbeat signatures against
HIVE_SSO_PUBLIC_KEY/HIVE_SESSION_PUBLIC_KEYplus their_PREVcopies. A spoke the sweep has not patched yet has no_PREVkeys and only the previous generation’s public keys, so it rejects session cookies minted after the rotation until the sweep patches it. - After retirement the sweep removes the
_PREVvariables over its following cycles, at most three spokes per cycle. Until a spoke’s_PREVis removed, that spoke still accepts signatures from the retired generation, which matters only to someone holding the retired master. A swept spoke keeps working, because its current keys already match what the hub signs with, and this survives a hub restart: the hub keeps the generation set as its source of truth even thoughHIVE_HUB_SECRETstill holds the retired master. Nobody is logged out at retirement. A session cookie lasts seven days, as long as the window, so every cookie minted before the rotation has expired by the time its generation retires. - A heartbeat key derived from
HIVE_HUB_SECRETafter a rotation is a previous-generation key. The hub checks heartbeat bearers against its generation set, so that key stops verifying when the previous generation retires.HIVE_TERMINAL_KEYandHIVE_INVITE_KEYare minted and verified on the spoke itself, so hub generations do not apply to them.
How spokes get the new keys. The only delivery path is the per-hive env reconcile sweep. Every 15 minutes, it reads the spoke’s hive Deployment with kubectl and patches the derived keys into its env, at most three spokes per cycle, so a large fleet takes hours to converge. While a previous generation is live it also delivers HIVE_SSO_PUBLIC_KEY_PREV and HIVE_SESSION_PUBLIC_KEY_PREV, which is how SSO and session verification on a swept spoke accept the previous generation. It covers only hives the hub has a SaaS record for that are not in provisioning status, on clusters the hub can reach. Pull-only and unreachable clusters are skipped. A spoke whose keys an operator copied into its environment by hand gets nothing from a rotation. The same is true for a spoke outside the sweep that derives its keys from HIVE_HUB_SECRET. The rotation check counts only hives the sweep considers, so it does not stop a rotation for either kind. From the moment of rotation such a spoke fails to verify the hub’s session cookies, and it fails to verify SSO handoffs and heartbeat signatures unless the hub signs them with the previous generation as described above. When the previous generation retires it fails all three until its keys are updated.
Rotation is refused when the sweep cannot see the whole fleet. The endpoint refuses to rotate unless the last sweep considered at least one hive and reached every hive it considered. force does not override this check. A hub with no kubectl access to its spokes, or with no hub-provisioned hives, cannot rotate through the endpoint at all, so its master stays on the current generation.
Where to read the current keys. No hub route or CLI returns the master or a key derived from it. GET /api/saas/admin/key-generations returns generation IDs, timestamps, status flags, the rotation cooldown and the persist path, and the rotate response carries no key material. (The self-service routes return a byo- hive’s random key, which is not master-derived.) Do not replace the master in place to get around this; that strands every spoke, as security-model.md says.
HIVE_HEARTBEAT_KEY_PREVIOUS covers the keystore only. The spoke’s secrets keystore reads it as previous key material, so secrets sealed under an old heartbeat key stay readable after that key changes. It is decrypt-only when a current key (HIVE_SECRETS_KEY or HIVE_HEARTBEAT_KEY) is set; with neither set, the keystore uses it as the sealing key. The heartbeat bearer, SSO, session, terminal, invite and customer-match checks do not read it, and the hub never sets it. The previous-key variables for SSO and sessions are the _PREV ones above. Copying an old heartbeat key into it does not keep a spoke’s heartbeat working.
Delivering a new master to a spoke the hub cannot patch exists only as a design, in design/master-delivery-wrapped.md. Until it is built, a spoke that holds only derived keys needs its keys updated by hand after a rotation, and an operator has no hub-supported way to obtain them.
Customer profile sharing
HIVE_HUB_CUSTOMERS_SHARE_ENABLED is off by default. Set it to 1, true,
yes, or on in the hub environment to enable Profile sharing in Fleet
and on hive cards where the signed-in person holds a grant. The hub dashboard’s
operator settings show the effective state. With the switch off, the page and
its API return 404; stored choices are not deleted.
People can enter or clear their real name, organization, and country, then confirm or withdraw their own selections separately for each hive. A real name is shared only with that consent, and only if the person entered it themselves. Country and organization are treated as public and are sent, labeled with their source, to the hives where the person holds a grant, without a consent record (#19306). A material disclosure change requires reconfirmation: disclosure version 2, which replaced the version that said nothing was sent yet, suspends every earlier consent until the person confirms again.
Trust domain. The hub answers only the project’s own hives, listed by hive
ID in HIVE_HUB_CUSTOMERS_TRUSTED_HIVES (comma-separated, empty by default).
The hub and those hives are one trust domain: what the hub knows about a person
may reach their Customers records, labelled with its source. Every other hive
gets an empty answer, whatever its own switch says and whatever a person
consented to for it, so with the list empty no hive receives anything. The
hub decides by the hive identity the per-hive bearer proves; a hive cannot
widen the domain from its side.
The labeled answer to a trusted hive also carries affiliation, a separate
field from organization so the hive can tell a derivation from a statement
(#19856). It is the
hub-derived affiliation of a github.com user, labeled with its derivation
(company_field, contributions, org_membership or colony:<provider>),
and only when it comes from public github.com data: the identity-provider and
GHE-host fallbacks, and anything derived from an email, never cross.
A hive asks for these values only when its owner turns on
customers.hub_import.enabled (see
Customers hub import). The hive posts
salted hashes of its confirmed customers’ GitHub logins to
POST /api/customers/match with its per-hive bearer. The hub answers only for
people with an effective consent for that hive (real name) and for grant
holders of that hive (labeled public country and organization; set
HIVE_HUB_CUSTOMERS_ORG_DOMAINS to let an organization be derived from a
listed email domain); an unknown, blocked or non-grant-holder person gets the
same empty answer. A withdrawal, a lost grant, a
blocked account or a deleted hub user makes the next answer tell the hive to
clear what it was sent.
What each role sees:
- The person, on the Profile sharing page: per hive, what was last sent and when, which fields were sent at any time, and when the first delivery was.
- A hub admin, in the dashboard’s Scale Controls, under Customers profile
sharing: the number of consents per hive, and how many await
reconfirmation. No person, field choice or value is shown, and no admin route
can grant, change or read a consent. The same counts are at
GET /api/saas/admin/profile-share/counts. - The hive owner and anyone with Customers access on that hive: the values the hive received, shown as “from the hub”. They can export them, and the hub cannot recall an exported copy.
Audit lines carry names of fields, never values: audit: customer consent grant, change and withdrawal per consent change, and audit: customer match
per request with the hive id and counts.
Hub CRM on the colony store
colony is the only hub customer store
(#20150). Every hub
boots the colony-only store described under colony-only
below, whatever HIVE_HUB_CUSTOMER_STORE says. json and shadow are
retired: a hub that still sets either (or an unknown value) logs
hub customer store: retired or unknown mode; the colony store is used and
runs colony-only. A hub that ran on the old json, shadow or colony
mode is moved on its first boot of this release: the boot sync imports and
verifies every user, then copies /data/saas/users to users.migrated and
renames /data/saas/consents to consents.migrated; nothing is deleted. If
the sync has no parity, a user cannot be held in colony, or the read-back
does not match, the hub logs why and keeps running on the JSON (colony
mode, a fail-safe state, not a setting) until a later boot verifies. Setting
another mode no longer writes the JSON back: the way out is
hive colony export --format hive-hub-json (see Rolling back below). The
rest of this section describes the earlier modes for reference.
HIVE_HUB_CUSTOMER_STORE (default colony since
#19972; before that
json) moves the hub’s person and fact data
onto the colony store
(/data/saas/colony.db, next to /data/saas/users), phase 4 of the
Colony customer-data backend design
(#19856). Account and
access data (hives, expiry, quota, tokens, engagement stats) stays in the
per-user JSON.
| Mode | Reads | Writes | On boot |
|---|---|---|---|
json | JSON | JSON | Nothing. An existing colony.db is opened only so a deleted user is erased from it too. |
shadow | JSON | JSON and colony | Backs up colony.db, imports every user on the first boot (one transaction, source fingerprint recorded), reconciles each person, erases people whose JSON record is gone, logs counts only. A missing users directory fails the boot closed to json. |
colony (default) | colony, then JSON per field and per person | JSON and colony | As shadow. |
Unset or blank means colony. A value that is set but unknown (a typo) means
json, and the boot logs hub customer store: unknown mode; using json, so a
mistyped rollback never moves the hub onto colony.
Upgrading from the json default. A hub that ran with the variable
unset and is upgraded to a release with the colony default runs the boot
sync on its first boot: the one-time import, the person-by-person reconcile
and the count check, exactly as a first shadow boot does. The JSON files are
not rewritten, so they are the backup, and every later boot keeps a
colony.db.bak-<UTC time> copy. If the import cannot run (the users directory
is missing, colony.db is locked, unreadable or from a newer release), the
boot logs hub customer store: running in json mode and the hub keeps working
on the JSON. Check the first boot’s hub customer store: boot sync line for
parity=true and failed=0. To stay on JSON through the upgrade, set
HIVE_HUB_CUSTOMER_STORE=json before rolling the new image.
- Provenance. Each field is one colony fact at the rank its JSON source
names:
user(*_source: user,country_set_by_user),admin(*_source: admin, and a legacy value with no recorded source), orenrichment(a browser-language country, the GitHub-footprint and colony affiliation with its confidence, the profile and top-repo cache). Slack id, notes, location, bio, the top-repo cache and every email arelocal_only; colony’s ownShareable()export never carries them. - Precedence is unchanged: a user-set value is never replaced by an admin edit or a login inference.
- Migration safety. The migration never rewrites a JSON file, so the JSON
is the backup and the rollback. Once a
shadoworcolonyboot holds the file lock, it writes a full colony snapshot (with its tombstones) ascolony.db.bak-<UTC time>, mode0600, only when it differs from the newest one, and keeps the newest 3. Running the boot sync again changes nothing. A value colony refuses (a note over 4096 bytes, a control character) stays JSON-only. A person whose last mirror failed or was skipped reads from the JSON until a mirror succeeds, so a colony copy that fell behind is never written back. One boot erases at most 10 people, or 10% of the store if that is more; a larger burst of missing JSON records is logged and held, never erased. - Rollback. Set
HIVE_HUB_CUSTOMER_STORE=jsonand roll the hub. Nothing is lost, because every mode writes the JSON: the hub reads the per-user files as it did before the colony store, andcolony.dbis opened only to erase a deleted user. Settingcolonyagain later reconciles colony from the JSON on the next boot.shadowis the half-way step: colony is still written and checked, but reads come from the JSON. - Erasure. Deleting a user erases them from
colony.dbin every mode and tombstones their identities, so a later mirror never re-adds them; a person deleted whilecolony.dbwas closed is erased on the nextshadoworcolonyboot. bbolt does not zero freed pages, and a boot backup holds what it held when taken, so compact the file and remove the backups when an erasure must reach the disk. Injsonmode an existingcolony.dbis not mirrored, so a value cleared meanwhile stays in it until the nextshadoworcolonyboot reconciles it, or until the user is deleted. - Signing up again after an erasure. The tombstones stay. In
shadow,colonyandcolony-onlya new account whose sign-in identity colony erased before becomes a new colony person with a new random id (recorded ascrm_person_idin the user’s JSON) and no identities, so the erased identity is never attached and nothing the erased person held comes back. The account works normally and its consent is its own, granted fresh. Deleting it erases that new person the same way. Its id starts withhub-resignup-; while any user file is unreadable, a boot never erases such a person. Releases before #20117 do not knowcrm_person_id: rolling the hub back to one erases these people’s colony records as orphans on its next boot, so export first (hive colony export) if any account signed up again after an erasure. An account saved after an erasure by such a release gets its own person at the next boot sync or on its first consent grant. - Consent records are mirrored as colony Consent records. In
colonymode the match answer and the Profile sharing page also read the grant from colony, which can only narrow what the file grants (a field crosses only when both grant it, and a withdrawal on either side holds); the delivery bookkeeping is still read from/data/saas/consentsin this mode (colony holds a copy since colony v0.4.0), and a person whose last sync failed is read from the file alone. Consent writes still go to the file first and are mirrored, sojsonstays the rollback. A consent the hub prunes is deleted from colony too. - Long notes (up to colony’s 64 KiB
noteslimit, carriage returns included) are stored in colony since v0.4.0, and a linked login or email another user owns is kept as a held identity instead of being skipped. - Affiliation in the answer is not a delivered field: it is not stamped on
a consent record and carries no
clearedsignal, so when it stops crossing the hive drops it at its 72-hour refresh expiry. A person who cleared their organization on the hub gets no derived affiliation either. - Single writer. bbolt takes a file lock, so the hub stays one replica on
its PVC. When another process holds the lock at boot, the hub retries the
open with doubling backoff for up to
HIVE_HUB_CUSTOMER_STORE_LOCK_WAIT(default2m;0means one attempt), logginghub customer store: colony.db locked by another process; retryingon each try, and stays injsononly if the lock is still held after that (#20103). A boot can wait up to the setting plus one 5-second attempt. The open runs before the hub serves HTTP, so the pod is not Ready while it waits: give the hub astartupProbewhosefailureThresholdtimesperiodSecondsis at least 135 seconds with the default, or the kubelet may restart it mid-wait. - Run the hub Deployment with
strategy: Recreate. WithRollingUpdatethe new pod starts while the old one still holds the lock, and the old pod only exits once the new one is Ready, so the new pod can never get the lock and runs injsonfor its whole life.Recreatestops the old pod before the new one starts. The boot retry covers a lock that is still held after that, such as the server-side release of a lock on the RWX volume after an unclean node loss, or a stray process holding the file. The cost is a short hub outage on every roll, including hub self-upgrades.src/deploy/check-hub-manifest.pyfails on any other strategy.
colony-only (opt-in)
HIVE_HUB_CUSTOMER_STORE=colony-only makes colony.db the only copy of the
CRM fields and the consent records (#19972).
It is never the default. Account data (hives, expiry, quota, tokens) stays in
the user JSON.
Moving the hub to colony-only:
- Run a release in
colonywith clean boot logs:hub customer store: boot syncwithparity=true,failed=0,skipped=0,orphans_held=0. - Take a volume backup of
/data/saas(users, consents,colony.db). - Set
HIVE_HUB_CUSTOMER_STORE=colony-onlyand roll the hub. - On that boot the hub runs the colony boot sync, which must report parity,
writes every person’s CRM fields and consent records into colony in one
transaction, reads them all back and compares them with the JSON. Only
then does it copy
/data/saas/userstousers.migrated, rename/data/saas/consentstoconsents.migrated(a taken name gets a-<time>suffix; nothing is overwritten or deleted), write thehub.colony-onlymarker incolony.dband logcolony-only took over. Only that marker, written after the renames, says the hub is colony-only. If the sync has no parity or the read-back does not match, it logs why (counts only), clears the records it wrote and runs incolonymode with every file where it was. A boot after a crash part-way through the migration renamesconsents.migratedback first. - From then on a user record is written without its CRM fields
(
crm_in_colony: true), only after the colony write succeeded; when the colony write fails the full record is written as before. Consent records are read, written, stamped and swept in colony only. - Every later colony-only boot skips the boot sync but still runs its
forget pass, after the boot backup of
colony.db: a person whose user file is gone from/data/saas/users(deleted while the hub was down, or removed by an operator) is erased from colony. A burst of such people is held, not erased, as in the boot sync. The boot logshub customer store: colony-only forget passwithforgottenandorphans_heldwhen either is non-zero; if the users directory cannot be listed it logscolony-only forget pass failedand erases nobody.
A consents directory beside a colony-only store is never read as the records, because it could forget consents colony holds or bring back one a person withdrew:
- one that matches colony exactly, or was last changed before the
migration (a stale copy put back), is set aside as
consents.ignored(kept for the retention window below, never overwritten); - one changed after the migration that differs from colony (written by an
older hub image, or while the hub fell back to
json) is merged into colony narrow-only, then set aside like an older one: a withdrawal on either side wins, a grant both hold keeps only the fields both grant, a grant only the directory holds is not added, and delivery bookkeeping is kept from both. Anything the merge cannot classify (a file that is not a consent file of a known user, a field this release does not know, a grant colony holds that the directory lacks, a delivered grant colony has no record of) refuses colony-only before anything is written. The hub then runs injsonmode and logsconsents_newer_than_colony_only. To resolve it, setHIVE_HUB_CUSTOMERS_SHARE_ENABLED=falsefirst, so nothing is delivered from either copy meanwhile; move the directory aside (for example toconsents.held); boot again; apply any withdrawal or narrowed grant from it on the people’s Profile sharing pages; then turn sharing back on.
While colony-only is not running (any fallback to json with a
colony-only colony.db), a change to the CRM fields of a stripped record is
refused, and deleting a user answers 503 until the hub has opened
colony.db again, so a deleted person is always forgotten there too.
Getting the JSON back out: no mode writes the JSON back any more
(#20150); this release has no automatic restore. Stop the hub, run
hive colony export --format hive-hub-json --dir /data/saas --out /tmp/hub-export (without --out it writes /data/saas/hub-export; it never
writes over the live files and never overwrites a file without --force),
and check the files. Only an older image that still has the json mode can
then run a hub from them: copy users/*.json and consents/*.json into
place, set HIVE_HUB_CUSTOMER_STORE=json on that image and start it. Its
restore on that boot finds the same files and drops the marker.
users.migrated and consents.migrated are the JSON as it stood when
colony-only took over. They are never removed (#20150); deleting a user
scrubs that user out of them. consents.ignored, and consents.pre-restore
left by an older release’s restore, are removed by the daily consent sweep
90 days after they were set aside (never while a colony.db on disk is not
open).
Never run a hub image older than colony-only against a colony-only
store; roll back first. While the store is colony-only, the hub records a
schema_version in colony.db that no colony release accepts, from the
moment it opens the store (so also after a crash), and puts the real one
back before its own next open; an older release’s restore drops it with the marker. An older
image therefore fails to open colony.db (ErrSchemaTooNew) and runs in
json mode without writing it, so its boot sync can no longer empty colony’s
typed facts and consents. It still serves the stripped records with their
CRM fields empty and saves them without crm_in_colony: colony keeps the
hub.crm copy and fills every field such a save left empty, but a field that
image cleared comes back. Any other tool that opens a colony-only
colony.db with store.Open gets the same refusal; use hive colony export.
Ask AI help
Ask AI help is an optional docs-help backend for the hub dashboard (design:
Dashboard Ask AI help). On the hub it is
off by default. Hosted hives default to Ask on in hub mode (Ask Hive in
their Settings and Help menu), so turning it on here serves every hosted hive
whose owner has not switched it off; HIVE_ASK_RELAY_DISABLED_HIVES refuses
single hives and HIVE_ASK_RELAY_HIVES=none refuses all of them. With it off,
or switched on but missing a value, the hub registers no
Ask route, reads no key and sends nothing. The hub calls the Kapa.ai Chat API
itself, server side; the browser only ever talks to the hub, and no
third-party script or Content-Security-Policy change is involved.
To wire it once a Kapa API key exists:
-
In the Kapa project, create an HTTP API integration and an API key. Keep both out of the repository.
-
Store the key in a Kubernetes Secret and mount it under one of the allowed secret dirs (
/secretsor/data/secrets), for example:kubectl -n <hub-namespace> create secret generic hive-ask-kapa \ --from-file=api-key=<path-to-key-file>and add a volume plus
volumeMounts: [{name: hive-ask-kapa, mountPath: /secrets/kapa, readOnly: true}]to the hub Deployment. -
Set the hub environment:
env: - name: HIVE_ASK_ENABLED value: "true" - name: HIVE_ASK_KAPA_PROJECT_ID value: <project id> - name: HIVE_ASK_KAPA_INTEGRATION_ID value: <integration id> - name: HIVE_ASK_KAPA_API_KEY_FILE value: /secrets/kapa/api-keyThe project id and integration id may also come from the same Secret through
valueFrom.secretKeyRef. There is no env var that holds the key itself. -
Restart the hub. It logs
ask: enabledwith the effective limits, or oneask: requested but staying offline with the reason. Neither line, nor any API response, carries the key, the project id or the integration id.
What leaves the hub per question: the question text (refused, not sent, when
it looks like a password, token or key), the label of the dashboard section
from a closed list of ids in pkg/askai/sections.go (set
HIVE_ASK_SEND_SECTION_LABEL=false to drop it), the integration id and, for a
follow-up, the vendor’s thread id. No login, email, page content, URL, hive or
repo name is sent. Each person confirms a disclosure before their first
question and can withdraw; the record lives under /data/saas/ask-consents/
and is deleted with the user. Answers without an allowlisted source
(docs.hivecommons.dev or the GitHub docs path under hivecommons/hive) are
shown as “no cited answer” with a docs link.
Limits (env overrides in Environment variables): per person 3 a
minute, 20 an hour and one in flight; hub-wide 4 a minute (a fifth of the
vendor’s 20 a minute per-team limit, and never more than half of it), 2 in
flight and 500 a day. A vendor 429 backs every caller off for its
Retry-After; three upstream failures in a row open a circuit breaker for five
minutes. Audit lines (audit: ask request, audit: ask consent grant,
audit: ask consent withdraw, audit: ask breaker opened, audit: ask daily budget spent) carry outcomes and counts, never text. Hub admins can read the
counters at GET /api/ask/stats.
Ask AI help
Ask AI help is an optional docs-help backend for the hub dashboard (design:
Dashboard Ask AI help). On the hub it is
off by default. Hosted hives default to Ask on in hub mode (Ask Hive in
their Settings and Help menu), so turning it on here serves every hosted hive
whose owner has not switched it off; HIVE_ASK_RELAY_DISABLED_HIVES refuses
single hives and HIVE_ASK_RELAY_HIVES=none refuses all of them. With it off,
or switched on but missing a value, the hub registers no
Ask route, reads no key and sends nothing. The hub calls the Kapa.ai Chat API
itself, server side; the browser only ever talks to the hub, and no
third-party script or Content-Security-Policy change is involved.
To wire it once a Kapa API key exists:
-
In the Kapa project, create an HTTP API integration and an API key. Keep both out of the repository.
-
Store the key in a Kubernetes Secret and mount it under one of the allowed secret dirs (
/secretsor/data/secrets), for example:kubectl -n <hub-namespace> create secret generic hive-ask-kapa \ --from-file=api-key=<path-to-key-file>and add a volume plus
volumeMounts: [{name: hive-ask-kapa, mountPath: /secrets/kapa, readOnly: true}]to the hub Deployment. -
Set the hub environment:
env: - name: HIVE_ASK_ENABLED value: "true" - name: HIVE_ASK_KAPA_PROJECT_ID value: <project id> - name: HIVE_ASK_KAPA_INTEGRATION_ID value: <integration id> - name: HIVE_ASK_KAPA_API_KEY_FILE value: /secrets/kapa/api-keyThe project id and integration id may also come from the same Secret through
valueFrom.secretKeyRef. There is no env var that holds the key itself. -
Restart the hub. It logs
ask: enabledwith the effective limits, or oneask: requested but staying offline with the reason. Neither line, nor any API response, carries the key, the project id or the integration id.
With it on, the hub dashboard shows an Ask button in the header. It opens a
panel docked to the side (a bottom sheet on a phone) that first shows the
disclosure and a single confirm; after that the person can ask, read the answer
with its Sources and the “AI generated, may be wrong” label, and withdraw
with Stop sending my questions. Every state keeps a plain docs link: no
consent, Kapa.ai unreachable or busy, or no cited answer. The panel is our own
same-origin script and stylesheet (/ask-panel.js, /ask-panel.css); with Ask
off the hub serves neither and the dashboard document is unchanged. Hub
operators see the effective switch under Scale controls.
What leaves the hub per question: the question text (refused, not sent, when
it looks like a password, token or key), the label of the dashboard section
from a closed list of ids in pkg/askai/sections.go (set
HIVE_ASK_SEND_SECTION_LABEL=false to drop it), the integration id and, for a
follow-up, the vendor’s thread id. No login, email, page content, URL, hive or
repo name is sent. Each person confirms a disclosure before their first
question and can withdraw; the record lives under /data/saas/ask-consents/
and is deleted with the user. Answers without an allowlisted source
(docs.hivecommons.dev or the GitHub docs path under hivecommons/hive) are
shown as “no cited answer” with a docs link.
Hosted hives ask through the hub: with Ask on, the hub also serves
POST /api/hub/ask/relay, authenticated with each hive’s per-hive heartbeat
bearer, so the key stays on the hub. It serves hosted hives only in this round
(HIVE_ASK_RELAY_HIVES, default hosted; none turns the relay off;
registered is accepted and treated as hosted until self-hosted hives are
approved), refuses hives listed in HIVE_ASK_RELAY_DISABLED_HIVES, and charges
each hive at most 60 relayed questions an hour (HIVE_ASK_LIMIT_HIVE_PER_HOUR)
inside the hub-wide limits. See Ask AI help for the hive
side.
Limits (env overrides in Environment variables): per person 3 a
minute, 20 an hour and one in flight; hub-wide 4 a minute (a fifth of the
vendor’s 20 a minute per-team limit, and never more than half of it), 2 in
flight and 500 a day. A vendor 429 backs every caller off for its
Retry-After; three upstream failures in a row open a circuit breaker for five
minutes. Audit lines (audit: ask request, audit: ask consent grant,
audit: ask consent withdraw, audit: ask breaker opened, audit: ask daily budget spent) carry outcomes and counts, never text. Hub admins can read the
counters at GET /api/ask/stats.
Reserved byo- hive IDs (credential fence)
Hive IDs that start with byo- are reserved for hives that their owners run and register themselves (#18060). A hub lists such a hive as directory metadata only, so its heartbeat response never carries hub-held credentials or management actions, whatever key the spoke authenticated with. The hub withholds these fields: the GitHub App config (including cluster, secondary and webhook relay keys), the pending gateway, the claimed project config, the cluster ID, the authorized-user list, visibility, upgrade and branch-switch instructions, the upgrade announcement and policy, spoke restarts, agent-restart resets, fleet-breaker instructions, and self-experiment flags. Display-only data such as admin banners still flows. When the fence withholds a field, the hub logs heartbeat: credential fence withheld fields from self-service hive with the field names, never the values. Do not give an operator-provisioned hive a byo- ID.
Self-service registration
The fence above is always on. The registration flow that fills the byo- namespace is opt-in. With it enabled, a signed-in hub user lists a hive they run on their own infrastructure without an operator issuing anything. The owner-facing steps are in Register a self-hosted hive on a hub; this section is for the operator running the hub.
Enable it
| Variable | Default | What it controls |
|---|---|---|
HIVE_HUB_SELFSERVICE_REGISTRATION | off | Turns on /api/hub/selfservice/* and the Register your own hive form on the dashboard. Accepts 1/true/yes/on. Read per request, so no restart is needed. While off, every route except GET /api/hub/selfservice/status answers 404, and the dashboard button sends users to the self-hosting guide instead of the form. |
HIVE_HUB_SELFSERVICE_MAX_PER_USER | 5 | How many byo- hives one GitHub login may hold at once. The next registration answers 429 until the user removes one. |
HIVE_HUB_SELFSERVICE_MAX_REPOS | 20 | How many repos one registration may list (#18642). Each repo is one read-only GitHub ownership check, so values above 500 are clamped to 500. POST /api/hub/selfservice/hives answers 400 over the cap; POST /api/hub/v1/registrations answers 413 with limit: max_repos. Advertised to clients by GET /api/hub/v1 as limits.max_repos. Read per request. |
HIVE_HUB_PROOF_GITHUB_USER_TOKEN | off | Offers the github-user-token ownership proof on POST /api/hub/v1/registrations and PATCH /api/hub/v1/registrations/{id} (#19238). See Proving ownership with your own token. Accepts 1/true/yes/on. Read per request. Only meaningful while HIVE_HUB_SELFSERVICE_REGISTRATION is on. |
HIVE_HUB_SELFSERVICE_KEY_GRACE | off | Key rotation with a grace window (#19235); see Rotation. Accepts 1/true/yes/on. Read per request. |
HIVE_HUB_SELFSERVICE_KEY_GRACE_WINDOW | 1h | How long the old key keeps working after a rotation while HIVE_HUB_SELFSERVICE_KEY_GRACE is on. Clamped to 168h. Read per request. |
HIVE_HUB_SELFSERVICE_EXPIRY | 24h | How long a registered hive may go without an accepted heartbeat before the sweep removes it. Counted from the last accepted heartbeat, or from registration while there has been none. |
HIVE_HUB_SELFSERVICE_SWEEP_INTERVAL | 10m | How often the expiry sweep runs. Read at startup; restart after changing. |
All of them are listed with the other hub variables in env-vars.md.
What a registration does
- The user is signed in through the hub’s GitHub OAuth, so the hub holds their encrypted GitHub token. Without a stored token or a GitHub login the request is refused.
- The user supplies a short name, an org, up to 20
owner/namerepos and anhttpsdashboard URL. The hub builds the ID asbyo-<github login>--<name>; the double hyphen keeps IDs unambiguous, since logins may contain-but never--, and a name may not start with-. Nothing the user sends can produce an ID outside thebyo-prefix, and a name that would borrow another namespace (such ashosted-) is refused. - For every repo the hub calls GitHub with the user’s own token and requires
permissions.admin.maintainandwriteare not enough. One failing repo refuses the whole request with403naming that repo, and nothing is stored. - The hub checks the per-user cap and that the ID is not already taken, in the registry or by a hub-provisioned hive.
- The hub mints a random heartbeat key, stores only its hash in
/data/hub-selfservice.json, and returns the raw key in the201response together with Compose, Podman and Kubernetes snippets. The raw key appears nowhere else: not in the list route, not in a log line, not on disk.
The registry entry becomes a self-hosted hive in Active Hives and the fleet views once a heartbeat is accepted. The type is assigned by the hub; the spoke cannot claim it.
What a byo- key can and cannot do
- It authenticates heartbeats for exactly one hive ID, the one it was minted for. Presenting it with any other ID fails.
- A
byo-ID is verified only against its stored hash. The master-derived paths are never tried for abyo-ID, soHIVE_HUB_SECRETand keys derived from it never authenticate a self-service hive, and a self-service key never authenticates ahosted-or operator-provisioned ID. - The owner never receives
HIVE_HUB_SECRET. The hub never consults it in the self-service routes and never returns it. - Everything the fence withholds still applies: the hub sends the hive no GitHub App config, gateway, cluster ID, authorized users, upgrade or branch-switch instructions, restarts or fleet-breaker actions. Listing is directory metadata only.
Editing a registration
PATCH /api/hub/v1/registrations/{id} changes repos and dashboard_url in place, so adding a repo no longer means deleting the registration and registering again (which revoked the key and took the spoke offline). The heartbeat key is not touched: the spoke keeps heartbeating with the key it has.
- Who: the owner, signed in to the hub. A registration key cannot edit its own record, and a hub admin who does not own the hive gets
404. If-Matchis required.GET /api/hub/v1/registrations/{id}returns theETag; send it back on thePATCH. A missing header is428, a stale one is412with the currentETag, so two operators editing at once cannot silently overwrite each other. Heartbeats do not change theETag.repos: a full list replaces the repos, or{"add": [...], "remove": [...]}changes them. Only the repos an edit adds are checked against GitHub (the same read-onlypermissions.admincheck as registration, with the owner’s own stored token); one failing repo refuses the whole edit and nothing is applied. Kept repos keep their proof time, and removed repos lose theirs. At least one repo must remain, andHIVE_HUB_SELFSERVICE_MAX_REPOSapplies (413 {limit: "max_repos"}).dashboard_url: anhttpsURL to a public address, or""to clear it.- Not editable:
org, the owner, the ID and the keys. To change theorg, delete the registration and register it again. - No GitHub writes. The edit changes the hub’s own registry only.
The route is part of the v1 registration protocol and follows the same switch as the rest of it, HIVE_HUB_SELFSERVICE_REGISTRATION; discovery (GET /api/hub/v1) lists it under operations with if_match: "required" and its fields under patch_fields, so a hub that does not offer it does not advertise it. The v6 /api/hub/selfservice/* routes are unchanged.
Proving ownership with your own token
The hub signs users in with no GitHub scope, so when an org restricts OAuth apps GitHub hides the admin role from the stored token and registration says not an admin for repos the user does administer. With HIVE_HUB_PROOF_GITHUB_USER_TOKEN on, a v1 create or PATCH can prove ownership with a token sent on that request only:
X-Hive-Proof-Method: github-user-token
X-Hive-Proof-Token: <a GitHub token>
- Scopes: none for public repos; the classic
reposcope for private repos. A fine-grained token needs read access (Metadata) to every repo in the request. Discovery lists this underproof_method_details. - Whose token: the token must belong to the signed-in GitHub account (
GET /user); a token made by another account is refused. - Never kept: the token is used for the read-only
GET /userandGET /repos/{owner}/{repo}calls and then dropped. It is not stored, logged or echoed, and the stored sign-in token stays scopeless. - Clear refusals: a failed proof answers
403 {error, proof_method, reason, repo, required_scopes, granted_scopes}, wherereasonis one oftoken_rejected,token_user_mismatch,sso_not_authorized,missing_scope,repo_not_visible,admin_role_not_visible(GitHub showed the repo but not the role) ornot_admin.granted_scopesappears only when GitHub reported the token’s scopes. - Off means off: while the flag is off, asking for the method is
400listing the methods the hub offers; it never falls back to the stored token. WithoutX-Hive-Proof-Methodthe hub proves with the stored token as before (hub-session-token). The v6/api/hub/selfservice/*routes ignore both headers.
Heartbeat feature negotiation
A spoke may send protocol: {"version": 1, "features": [...]} in its heartbeat (#19237). With HIVE_HUB_HEARTBEAT_PROTOCOL on (1/true/yes/on, default off, read per request), the hub answers with protocol: {"version", "accepted", "ignored"}: the version it speaks for this beat, the requested features it honours, and the requested features it does not. The features a v1 hub accepts are activity_digest, activity_events and host_aliases, all of which it already serves to every spoke; negotiation changes nothing else in the response.
- No offer, or the flag off: the response is exactly what it was before, with no
protocolfield. - Unknown version (below
1): the beat is still accepted, every requested feature is listed underignored, andunsupported_versionechoes what the spoke sent. A version above the hub’s is answered with the hub’s version, so a newer spoke can fall back to it. - Bounds: at most 32 features are evaluated per beat. Names must be lowercase letters, digits,
_,-or., start with a letter and be at most 64 bytes; anything else is not echoed back.
Rotation
The owner can rotate from the Self-hosted hives list or with POST /api/hub/selfservice/hives/{id}/rotate. The hub mints a new key and keeps the previous hash live for a 10 minute overlap so a running spoke can pick up the new value without a gap. After the overlap only the new key is accepted. Only the owner can rotate; a hub admin who does not own the hive gets 404, the same answer as for a missing hive.
With HIVE_HUB_SELFSERVICE_KEY_GRACE on (#19235), the overlap is the configurable grace window HIVE_HUB_SELFSERVICE_KEY_GRACE_WINDOW (default 1h) instead of 10 minutes, on both the v6 route and POST /api/hub/v1/registrations/{id}/keys. Rotating again while a window is open keeps the old key, the one the spoke is still running, and replaces the pending key: the key from the earlier rotation stops working at once, and the window restarts. So rotating twice by mistake never cuts off the running spoke. The overlap in the response and limits.key_rotation_overlap in discovery report the window in effect. Existing registrations need no change.
Expiry sweep
A background sweep runs every HIVE_HUB_SELFSERVICE_SWEEP_INTERVAL and removes any byo- hive whose last accepted heartbeat is older than HIVE_HUB_SELFSERVICE_EXPIRY, or that never heartbeated within that window after registration. The key is revoked and the registry entry is removed in the same pass. The owner registers again when the hive is back; there is no grace list.
Revoking as admin
A hub admin removes any self-service hive with DELETE /api/hub/selfservice/hives/{id} or from the dashboard. The key stops authenticating immediately and the listing disappears. The owner’s own Remove button does the same for their hives. The audit line records who did it and whether it was the owner or an admin. If you need to stop all registrations at once, unset HIVE_HUB_SELFSERVICE_REGISTRATION; existing entries keep heartbeating until they expire or are removed.
Audit events
Every decision writes one structured log line, documented in audit-log.md:
| Event | When |
|---|---|
selfservice_hive_registered | A registration passed every check and a key was minted. |
selfservice_hive_refused | A registration was turned away; reason is one of invalid_name, reserved_prefix, duplicate_id, invalid_repos, invalid_dashboard_url, invalid_update (a PATCH body that was refused), per_user_cap, no_github_token, no_github_login, not_repo_admin, ownership_check_error. |
selfservice_hive_updated | The owner edited the repos or dashboard URL with PATCH; the line counts repos added and removed and carries no key. |
selfservice_hive_rotated | The owner rotated the key; overlap is how long the old key keeps working, grace whether the grace window is on, replaced_pending whether a pending key inside an open window was replaced, old_key_expires_at when the old key stops working. No key or hash. |
selfservice_hive_revoked | The owner or an admin removed the hive; by_admin tells which. |
selfservice_hive_expired | The sweep removed a hive; last_heartbeat is RFC 3339 or never. |
No audit line ever carries a key or a hash.
Hosted spoke provisioning model
The hub’s SaaS provisioner creates or records:
- Namespace, RBAC, Secret, ConfigMap, Service, route/ingress, Deployment, and an RWX
hive-dataPVC. - A mounted
/datavolume where the spoke writes runtime config and state. HIVE_ID,POD_NAMESPACE,HIVE_LEVEL,HIVE_HUB_URL,HIVE_HUB_SECRET, optionalHIVE_AUTHORIZED_USERS, and inference endpoint env vars in the spoke Deployment./data/saas/hives/<id>/meta.jsonon the hub PVC. Heartbeats can be accepted without this record, but hub-driven upgrades and dashboard links need it.
For push-reported clusters where the hub cannot run kubectl, follow the manifest-level workflow in manual-provisioning.md; this guide intentionally keeps the hub setup consistent with that battle-tested path.
Push-reported cluster entries
/data/saas/clusters.json also accepts per-cluster network overrides for hives it provisions: upstream_proxy ({url, hosts[], no_proxy[]}, a CONNECT forward proxy, injected as HIVE_UPSTREAM_PROXY_* env) and host_aliases ([{ip, hostnames[]}], rendered as Pod hostAliases for a GHE reachable only via a TLS reverse proxy on a fixed IP; existing hives are converged by a rate-limited reconcile sweep and, on every cluster including push-reported ones, by each spoke from its heartbeat response). See network-requirements.md.
/data/saas/clusters.json keeps the historical compatibility key pull_only. Set pull_only: true when the hub cannot reach that cluster’s Kubernetes API and the spokes must dial out to the hub instead. Operator-facing surfaces call these clusters push-reported because their node stats, dashboard token proofs, and liveness arrive in spoke heartbeats pushed from the cluster.
A push-reported entry still needs its stable identity (for example id, name, domain, app/forge fields), but it does not need a usable kubeconfig_path for hub-side reads. If node stats are absent, upgrade the spokes to a build that sends heartbeat cluster health and then check the error reason shown in the Clusters panel.
Each spoke must also know its hub registry cluster ID. Hosted provisioning writes
both hub.cluster_id and HIVE_CLUSTER_ID; manual or older hosted manifests
must set one of them to the cluster entry ID (for example vllm-d). Without
that identity, the heartbeat still proves liveness but deliberately omits
cluster_health, because the spoke cannot know which cluster row it is
authoritative for.
Heartbeat node health needs read-only cluster-scoped RBAC for:
- core
nodesget,list(capacity, allocatable, readiness, GPU labels) metrics.k8s.ionodeslist(live CPU/memory usage from metrics-server)
Do not grant nodes/proxy to a tenant ServiceAccount: it reaches every kubelet’s /exec, /attach and /pods endpoints through the API server. The spoke’s kubelet stats/summary disk-usage read is best-effort; without it the Node card shows disk capacity but no live usage percentage.
When metrics.k8s.io is unavailable or forbidden, spokes still report node count, vCPU, memory and disk capacity from the core Node API. The hub marks only the live-usage data partial and carries the precise node_health_error reason, such as metrics API failed: ... HTTP 403 or a missing metrics API, instead of the generic “check RBAC and metrics-server” note.
Tenant roles deliberately omit nodes/proxy (which permits cross-tenant kubelet exec) and cluster-wide pods list (which exposes other tenants’ pod specs). Push-reported tenant health therefore has no live disk percentage, pod/hive counts or request-based remaining hive capacity; the collector reports partial health (pods API failed: ... HTTP 403) while retaining node capacity and available CPU/memory metrics. Do not restore those grants to suppress the partial-health warning.
On hub startup and every 15 minutes, the SHA poller narrows existing registered tenants’ hive-node-health-reader-* roles on kubectl-reachable clusters. It does not restart pods, create missing roles, or touch shared operator roles. Failed reads/patches are logged and retried. For push-reported clusters the hub cannot perform this migration: a cluster administrator must replace each existing tenant role’s rules with the safe node/NodeMetrics rules in Manual provisioning. Apply the same correction to orphaned roles no longer represented in the hub registry. Deploy the hub fix as well as the provisioning template fix; upgrading tenant pods alone does not revoke previously issued RBAC grants.
API surface to know
The hub registers heartbeat, registry, SaaS, contributor, OAuth, webhook, backup, and callback-related routes from the Go hub packages. Operators normally interact through the dashboard, but the important external contracts are:
POST /api/heartbeat— spoke heartbeat, bearer-authenticated byHIVE_HUB_SECRETwhen configured.POST /api/saas/hives— hub-admin SaaS hive creation path./api/saas/auth-check— ingress auth check used by hub-proxied spoke dashboards./contributeand/api/contribute/*— contributor relay registration and WebSocket flow./api/registryand leaderboard/fleet views — public or authenticated hub registry views.
See api-reference.md and the dashboard OpenAPI file for route details, and manual-provisioning.md for known failure modes.
Search engine indexing
Only the hub’s public landing pages (/, /learn, /get-started, /reading, /contribute) are meant to be indexed; everything else is an API, an auth gate, or an operator console, and a crawler walking it just collects 401/403s (the “Blocked due to unauthorized request” errors in Google Search Console). The hub enforces that in three layers, all in src/pkg/hub/robots.go:
GET /robots.txtis generated per request host. On the configured public host (HIVE_HUB_PUBLIC_URL, defaulthive.hivecommons.dev, pluslocalhost) it allows/and emits oneDisallow:line per gated route group (/api/,/metrics,/openapi.json,/login,/logout,/auth/,/oauth,/openrouter/,/dashboard,/access-denied,/error/,/fleet,/my-hives,/gh-setup,/ws,/static/) followed by theSitemap:pointer;sitemap.xmllists public pages only. On any other host — a hosted tenant, an internal Service name, a preview hostname — it answersUser-agent: */Disallow: /. A CI test derives the auth-gated routes from the mux registrations and fails if one is not covered by aDisallowline.- Every response under a disallowed group, every 401 or 403, and every redirect into
/logincarriesX-Robots-Tag: noindex, nofollow; the login pages also carry “. - Hosted spoke dashboards (
<id>.hive.hivecommons.dev) are never indexable: the hub’s ingress auth-check lets/robots.txtthrough unauthenticated and the spoke servesDisallow: /for it, and every spoke response — including the 401 login page — carriesX-Robots-Tag: noindex, nofollow(src/pkg/dashboard/robots.go).
Verify from outside with curl -A Googlebot https://hive.hivecommons.dev/robots.txt and curl -sI https://hive.hivecommons.dev/api/hub/stats | grep -i x-robots.
Running several spokes under one hub
Splitting one large hive into several subject-scoped spokes stops agents competing over unrelated work. It also surfaces things that are fleet-wide in reality but per-hive in the implementation — provider quota, the shared GitHub App rate limit, agent credentials, and repo ownership (#5691 is the RFC tracking those).
The first of those the hub now checks for you is repo ownership.
Repo-ownership overlap
Two spokes managing the same repo puts two fleets on one backlog, opening competing PRs on it — the exact thing a split exists to prevent. Nothing stopped that, even though the hub receives every spoke’s repo list on every heartbeat.
The hub now compares those lists and reports any repo claimed by more than one spoke:
GET /api/registrygains arepoOverlapsarray. It is omitted entirely when the fleet is clean, so its presence is the signal:
�BRACE_PROTECT_9�
- A warning fleet alert (
repo-overlap) is raised on both hives in the pair, naming the other spoke and the shared repos. Either operator can act, and alerting on only one would read as that hive being at fault rather than the pair being ambiguous.
Matching is deliberate about what counts as the same repo, because two spokes are configured separately and so are the pair most likely to spell one repo differently:
| Compared | Rule |
|---|---|
docs, tuna-os/docs, https://github.com/tuna-os/docs.git | the same repo — bare, owner-qualified and URL forms all resolve to owner/repo |
Tuna-OS/Docs vs tuna-os/docs | the same repo — GitHub owner/repo names are case-insensitive |
acme/ui on github.com vs on github.ibm.com | different repos — the GitHub host is part of the identity |
a spoke listing its own primary repo in repos[] | one claim, not a conflict with itself |
a repo with no owner (no org recorded) | ignored — inventing an owner would invent conflicts between unrelated repos that share a name |
This is read-side only: it is derived per request from data the registry already holds, adds nothing to the heartbeat protocol, and is not persisted. It reports and does not refuse — an overlap is a warning, not a bar. A repo two subject areas legitimately share (a docs repo is the common case) is real, so the alert is acknowledgeable like any other; whether overlap should ever block assignment, and how such a repo would be allowlisted, is still open on the RFC.
Verifying the hub Deployment
The hub’s own container is named hub and it is the only container in the Deployment. Always scope container-level kubectl commands with -c hub (for example kubectl -n hive-hub logs deploy/hive-hub -c hub); kubectl set env without -c hub writes to every container. HIVE_HUB_OAUTH_CLIENT_SECRET and HIVE_NPS_RELAY_PULL_SECRET must come from a Secret via valueFrom.secretKeyRef, never a literal value:. Check a live or rendered Deployment with:
�BRACE_PROTECT_10�
Cluster-side cleanup that cannot be done from the repo: remove any stray hive-hub container from the running Deployment, move the two secrets into a Secret, and rotate both values. The check also rejects a secret env fed from a ConfigMap or field and looks at initContainers, and it fails a Deployment whose spec.strategy.type is not Recreate (an unset strategy is Kubernetes’ RollingUpdate), because a rolling update leaves the new pod unable to take colony.db’s lock (see Hub CRM on the colony store). Switching the live Deployment is an operator step: kubectl -n hive-hub patch deploy hive-hub --type merge -p '\{"spec":\{"strategy":\{"type":"Recreate","rollingUpdate":null\}\}\}'.
The hub also checks itself: before each self-upgrade set image, it reads its own Deployment’s container names and logs hub deployment has unexpected containers (with unexpected=<names>) when anything besides hub is present. The warning never blocks the upgrade.