Skip to content

Guides for organizations that run fctl in their own cloud #614

Open

Description

@fctl-sh

An organization that runs fctl in its own cloud finds a reference page for each piece (enrollment tokens, fctl host drain, service accounts, webhooks, identity tokens) and an overview that ties them together, "fctl for organizations" (docs/organizations.md). What it doesn't find is a worked guide for the jobs it actually has: an autoscaling fleet of runners that drains as machines go, a Slack bot on a service account, an instance its network keeps private, and agents' work in its data warehouse. Each team pieces these together from the references and runs into the traps on its own. These guides need no code. They go in docs/, which fctl.sh renders.

How it works now

These pages exist already. The guides should link to them rather than repeat them:

  • docs/organizations.md has an example of each piece:

    • the container, with FCTL_ADMIN_TOKENS and FCTL_WEBHOOK_PRIVATE_HOSTS;
    • the settings organizations change, including fctl admin allow '*@acme.dev';
    • admin tokens' calls;
    • a portal server that starts sessions with Fctl-On-Behalf-Of and answers questions with messages;
    • a standardwebhooks receiver;
    • an OIDC table;
    • "Runners for a fleet": an enrollment token and a two-line boot script.
  • docs/getting-started.md#many-machines-and-autoscaling covers enrollment, loginctl enable-linger, approval and --remove-offline-after.

  • docs/cli.md#hosts covers draining and the host's settings:

    • fctl host drain --wait returns once no turn runs, since idle sessions stop after a minute;
    • fctl host uninstall --wait drains, then uninstalls; --force stops sessions, and their agents push their work;
    • the host's defaults in crates/fctl-host/src/config.rs: capacity 4, cpus 4, memory_mb 8192, min_free_disk_gb 20.

    Uninstalling an enrolled runner removes it (ADR 0071).

  • docs/sandbox-images.md#how-hosts-get-it: the default image is ghcr.io/hyperstructure/sandbox:<the host's version> (default_image). The host pulls it at start and every 6 hours, and updates itself to the control plane's version (ADR 0053).

  • docs/architecture.md#a-runner-that-goes-away: ten minutes after a runner goes unreachable, its sessions stop, and a message resumes each one elsewhere, without its conversation. Removing a runner stops its sessions at once.

  • docs/self-hosting.md covers:

    • reverse proxies and tailscale serve;
    • webhooks to your own network;
    • the GitHub App's and Linear's webhook addresses;
    • that the clouds must reach /oidc/ from the internet, and GitHub's image proxy must reach published screenshots.
  • docs/automation.md covers webhook events and their payloads, and has a one-line chat recipe under "Other uses".

  • docs/identity-tokens.md shows Vault's JWT login with fctl id-token "in a session", and that the setup script gets the clouds' credentials.

  • Firecracker (ADR 0070) needs /dev/kvm, passt and mkfs.ext4. ADR 0070 records runs under QEMU, and CI runs it on GitHub's x86_64 runners. No doc or test covers it on an organization's own EC2, Compute Engine or Azure machines.

  • Publishing: fctl.sh renders the pages that fctl-site's PAGES lists (scripts/pages.mjs), as a flat navigation of 13 pages. cargo test -p xtask checks links in docs/*.md, docs/adr and docs/llms.txt, but not in subfolders (xtask/src/docs.rs).

The code says two things that change the guides as first sketched:

  • A provisioned account can't sign in with Google until its person links Google (Accounts that admin tokens create can't sign in with Google, though the docs say they can #613). The docs (docs/self-hosting.md#provision-people-with-admin-tokens, docs/organizations.md#people-from-your-directory) say an account made by an admin token can sign in with Google. But crates/fctl-control/src/api/google.rs refuses a Google sign-in for any address whose account isn't linked to Google (google_link_required: "An account with this email exists. Sign in with your password, then link Google in Settings."), and provision::create links none.
  • fctl id-token refuses in setup scripts. Their environment has the project's variables, secrets and the clouds' variables (crates/fctl-agent/src/supervisor.rs), but not FCTL_SESSION_SOCKET or FCTL_SESSION_ID, which fctl id-token needs (this_sandbox in crates/fctl/src/cmd/sessions.rs).

What should happen

  • (a) Runners in your cloud, a new page docs/runners-in-your-cloud.md, linked from docs/organizations.md#runners-for-a-fleet. It covers AWS, Google Cloud and Azure, with the same steps in the same order:

    • A machine image with Docker, a user for the host (fctl) in docker with lingering on, fctl at the instance's version (FCTL_VERSION), and ghcr.io/hyperstructure/sandbox:<that version> already pulled, so that a new machine's first session doesn't wait. It's rebuilt for each release, because hosts move to the control plane's version and then pull that version's image. Projects' images come from a registry, not built on every machine.

    • The launch template, instance template or scale set model. Its user data fetches the enrollment token from the cloud's secret store, then runs FCTL_SERVER=https://fctl.acme.dev FCTL_ENROLL_TOKEN=… fctl host install --capacity 3 --cpus 4 --memory 8g as fctl. Without a prepared image, it first runs curl -fsSL https://fctl.sh/install | sh and loginctl enable-linger fctl. The token is created with --max-runners and --remove-offline-after 1m.

    • Capacity: capacity × memory_mb must fit in memory, with room for the host. The disk holds min_free_disk_gb, the images, the sandboxes and the caches. Worked example: an 8-vCPU, 32 GiB machine runs 3 sessions.

    • Hardening: the cloud hardening any machine that runs untrusted code needs, such as an instance role that reads only the enrollment token's secret, and the cloud's recommended settings for its instance metadata service.

    • Draining when the cloud takes a machine. The guide runs fctl host drain --wait, then fctl host uninstall, and --force at the deadline:

      • EC2 Auto Scaling: a lifecycle hook. Its heartbeat timeout is at most 2 hours, extendable to 48. The machine sees the hook in autoscaling/target-lifecycle-state and ends it with complete-lifecycle-action.
      • Compute Engine: graceful shutdown, set in the instance template, of up to 6 hours. Google's docs say it runs when a managed instance group scales in.
      • Azure: the terminate notification, 5 to 15 minutes ahead.

      The guide also says what --force leaves: the session resumes elsewhere, without its conversation.

    • Spot: the notice is 2 minutes on EC2 and about 30 seconds elsewhere, and Compute Engine skips graceful shutdown on preemption. Run uninstall --force at the notice, and keep an on-demand base for long sessions.

    • Check: the machine shows on Acme's Runners tab as online. After scale-in, its runner is gone.

    The guide covers what works today. Runner pools that grow and shrink with the sessions waiting for them #615 adds demand for autoscalers, drain --timeout, hosts that retire when idle and a Terraform module, and the guide takes them up as they ship. Sessions keep their conversation and uncommitted work when they resume on another runner #616 would let a forced stop keep the conversation.

  • (b) Each session in a microVM, a section of the same page, written once the driver has been tried. Nested virtualization gives /dev/kvm:

    • on EC2's Intel instances since February 2026 (C8i, M8i and R8i; also C7i, M7i, R7i and more since June 2026; not Graviton);
    • on Compute Engine's Intel series except E2 (plus AMD's N4D);
    • on Azure series such as Dsv6 and Dasv6.

    The section adds passt, e2fsprogs, the kvm group and --driver firecracker, then checks with fctl host doctor. The first step: on one machine in each cloud, run the driver's --ignored KVM tests and a session end to end. Record start times, snapshots and the jailer.

  • (c) A Slack bot of your own, a new page docs/chat-bot.md, linked from docs/organizations.md#agents-from-your-own-portal-or-bot. It uses Bolt for JavaScript in Socket Mode, so the bot needs no public address for Slack:

    • On app_mention, it finds the person's address (users.info, users:read.email) and the project from the channel (#web → web). It calls POST /api/v1/projects/web/sessions with the service account's secret and Fctl-On-Behalf-Of: ada@acme.dev, then answers in the thread with the session's link.
    • It keeps each session's channel and thread_ts in a store that outlives restarts. A reply in that thread goes to POST /api/v1/sessions/{id}/messages, on behalf of whoever wrote it.
    • It takes a webhook (--events session.finished,session.question,session.ready_for_review,session.failed --started-by service-accounts), checks it and answers its challenge. It then posts in the thread (chat.postMessage): the start of the agent's reply, a question with a button per option, the pull requests waiting (data.ready), or why the session failed.
    • It passes on fctl's refusals as fctl words them, for example to someone who hasn't allowed the service account.
    • Its limits: the agent reads only what the bot sends; files reach the agent only if the bot uploads them (…/attachments); fctl's webhook needs a public https:// address unless the instance lists the bot's address in FCTL_WEBHOOK_PRIVATE_HOSTS; the person's Slack address must be one of their addresses in fctl.

    A short section covers Teams. A native Slack app, whose agents can read the thread they were asked from, is Start and steer agents from Slack, with agents that read only what they should there #620.

  • (d) Accounts only from your directory, a section of docs/organizations.md#people-from-your-directory. It covers:

    • no *@acme.dev allowlist entries: fctl admin disallow '*@acme.dev' leaves alone the accounts that admin tokens made, since each has its own entry (ADR 0085);
    • --members-create-workspaces off;
    • accounts made by admin tokens, with a first sign-in through fctl admin reset-link;
    • --require-two-factor and --two-factor-google;
    • disabling an account the day its person leaves.

    It waits on the Google mismatch above (Accounts that admin tokens create can't sign in with Google, though the docs say they can #613). Either provisioned accounts take a first Google sign-in when Google vouches for the address, or the guide says to link Google after signing in with a password, and the two pages stop promising Google. SAML through Keycloak or authentik needs generic OpenID Connect sign-in first, so it belongs to Sign in with the organization's own identity provider, and require it #618, and SCIM to Provision people with SCIM, and give roles from the identity provider's groups #619.

  • (e) A private instance, a section of docs/self-hosting.md after its HTTPS and reverse proxies section, for the container. People and runners reach it over the company's network; runners dial out. Only these paths face the internet, each only where it's used:

    • /api/v1/github/webhook: signed with GITHUB_WEBHOOK_SECRET, from the hooks ranges in https://api.github.com/meta. Without it, sessions learn of merges and checks late, reviews start only when asked, and follow-ups never come.
    • /api/v1/linear/webhook: signed with LINEAR_WEBHOOK_SECRET. Without it, delegating a ticket starts nothing.
    • /oidc/: where agents reach AWS, Google Cloud or Azure with identity tokens. The clouds fetch the issuer's keys, and the issuer is under FCTL_PUBLIC_URL, so the public host name must be the instance's own.
    • /api/v1/published/: where projects publish screenshots, which GitHub's image proxy fetches.

    Sign-ins through GitHub, Linear and Google come back through people's browsers, so they need no public path. The guide shows three setups, each with the same host name inside and out: a Cloudflare Tunnel whose ingress matches these paths and ends in http_status:404; on AWS, an internet-facing load balancer that forwards these path patterns and answers everything else with a 404; and Tailscale Funnel, once someone has checked how it keeps the rest private. To check it: from outside, the sign-in page answers 404 while /oidc/wsp_…/.well-known/openid-configuration answers, and GitHub's Recent deliveries show 200.

  • (f) Agents' work in your data warehouse, a new page docs/data-warehouse.md, linked from docs/organizations.md#your-tools-hear-what-agents-do. A webhook for session.*, pull_request.* and review.finished goes to a small receiver: a Cloud Run function for BigQuery, or a Lambda for Snowflake. The receiver checks each request and answers within 10 seconds. It's for teams that want dashboards before Insights: what agents got done, for a workspace, a project and each person #621.

    • The table: one row per event: id (to drop repeats, since it's the same in every attempt), type, timestamp, project, the session's ref, started_by, created_by.id, status, model, turns, and the payload as JSON.
    • Example queries: sessions a day by project and by how they started; time from start to ready for review; merged pull requests; review findings by repository.
    • What events don't carry: tokens and changed lines live in the session's stats. The receiver fetches them with a read token on session.finished (GET /api/v1/sessions/{id}), and the API covers history from before the webhook.
    • Limits: events arrive out of order, so go by timestamp. A webhook drops events once 1,000 are waiting. Payloads name people and hold up to 2,000 characters of agents' replies, so keep the tables to the people who see those sessions.
  • (g) No separate guide for secrets in setup scripts. docs/identity-tokens.md already covers Vault's login in a session and the clouds' credentials in the setup script. Instead, that page gets two additions:

    • an example of a setup script reading a secret from AWS Secrets Manager with the project's role, with Google's Secret Manager and Azure Key Vault in a line each;
    • a sentence that Vault's login doesn't work in a setup script, until fctl id-token works there.
  • Each new page goes in fctl-site's PAGES, docs/llms.txt, docs/README.md's "Where to go next", and organizations.md's table.

Design and UX

Each guide takes an engineer from an empty cloud account to a working setup in one sitting, with commands they copy as they are and a check after each step that tells them it worked.

  • Each page's shape:
    • A title that names the outcome ("Runners in your cloud").
    • A lead: what you'll have at the end, who must act (an admin of Acme for the enrollment token and the service account), and how long it takes.
    • A diagram where it helps, such as the fleet draining on scale-in, or the edge letting four paths in.
    • "Your values" first: FCTL_SERVER (https://fctl.acme.dev), the workspace acme and the region, set once as shell variables that every command uses.
    • Numbered steps, titled by what they achieve, with one command per block. Each step ends with how you know it worked ("acme-runner-1 shows on Acme's Runners tab as online within a minute").
    • Other ways as the question that leads to them ("No Packer?").
    • Last, what goes wrong, as the message the reader sees and the fix ("fctl host install stops because the user's systemd manager doesn't answer: run loginctl enable-linger fctl as root first").
  • The clouds: three clouds, one order, and a table of their differences: the notice before a machine goes, where the drain hook lives, and the secret store.
  • The examples: Acme, acme, web, Ada (an admin) and Grace. The bot's thread shows Ada asking for a fix and Grace answering the agent's question with a button.
  • States:
    • First visit: prerequisites up front.
    • Waiting: steps that take minutes say how long.
    • Errors and refusals: fctl's own words, such as a full enrollment token, a service account Ada didn't allow, or a 404 at the edge.
    • Partial setups: what breaks without each part. Without a drain hook, scale-in cuts turns off. Without /oidc/, the clouds refuse tokens.
    • Long lists: tables of at most four columns, which fit a phone.
  • Follow hyperstructure/design's docs: docs/principles.md (say what happens, plainly; a runner is the machine, the host is fctl host). Name the web app's pages and buttons as docs/web-app/explaining.md does, and lay out commands to copy as docs/web-app/kit.md's CodeBox does.
  • Design every part of each guide before writing it: the first visit, waiting, errors and refusals, partial setups and long lists.
  • Say what happens, plainly, and never leave a reader at a step they can't take without saying who can: a workspace's admins make enrollment tokens and service accounts, and instance admins make admin tokens.
  • Try each guide end to end with Acme's names on a real account in each cloud, and have someone who didn't write it follow it before it's merged.
  • Check the pages as fctl.sh renders them (fctl-site built with FCTL_DOCS_DIR) in both themes, at a phone's width, with the keyboard, a screen reader (headings, and text for diagrams) and reduced motion. Show screenshots in each pull request.
  • Give commands the same care: complete, with the reader's values, --json where a script reads the output, and the errors each can give with what to do next.
  • Where a guide needs something fctl.sh's docs pages don't have yet (diagrams, per-cloud sections), add it to fctl-site, and write down the reasons behind its choices, as hyperstructure/design's docs do for the app.

Compatibility

  • Docs only. There's no release, migration or protocol change, so hosts and agents one version behind don't matter here. Guides say which release a command needs wherever it's newer.
  • Publishing: new pages need fctl-site's PAGES. An fctl session's token can't push to hyperstructure/fctl-site, so the pull request names the change. Pages also need docs/llms.txt. fctl.sh shows them once CI pins the docs after the merge.
  • Link checks: cargo test -p xtask checks only flat docs/ pages. Keep the guides flat, or extend the test.
  • Privacy: nothing changes what app.fctl.sh stores or shares, so fctl-site's privacy policy stays. Guide (f) says what personal data the events carry into an organization's own warehouse.
  • Code changes: two findings need code or a decision: Google sign-in for provisioned accounts (Accounts that admin tokens create can't sign in with Google, though the docs say they can #613), and fctl id-token in setup scripts (below).

Decisions for a person

  • Pages: should each guide get a page of its own, or should (d) and (e) be sections as outlined? And should fctl.sh's docs navigation get a Guides group?
  • Clouds: should every guide cover all three clouds, or start with AWS?
  • Google sign-in: should provisioned accounts take a first Google sign-in, or should the docs stop promising it?
  • fctl id-token in setup scripts: should it get the session socket there, or should the docs state the limit?
  • Keeping guides current: should guides be retried by hand for each release, or on a schedule?

Related: #615, #618, #620, #621, #613

Session: https://app.fctl.sh/s/ses_01M8450BECFP8DN88R0ZP0N0MS

Activity

  1. added
    documentation
    on Nov 23, 2026
  2. fctl-sh commented on Nov 23, 2026

    @fctl-sh
    ContributorAuthor

    Progress, in #633 (fctl) and hyperstructure/fctl-site#137 (fctl.sh's PAGES, a draft until CI pins the docs):

    Written:

    • (a) docs/runners-in-your-cloud.md covers AWS, Google Cloud and Azure in the same order: one Packer template, the token in each cloud's secret store, sizing, hardening, a drain watcher per cloud (lifecycle hook, graceful shutdown, terminate notification), Spot, and a table of the clouds' differences.
    • (c) docs/chat-bot.md: a Bolt bot in Socket Mode on a service account, and a short section on Teams.
    • (d) organizations.md#accounts-only-from-your-directory. It follows fix(control): let accounts that admin tokens make sign in with Google #632: a provisioned account links Google at its first Google sign-in where Google hosts the address, and otherwise its person signs in with a reset link, which works for an hour.
    • (e) self-hosting.md#a-private-instance, with a Cloudflare Tunnel or an AWS load balancer, and a check from outside.
    • (f) docs/data-warehouse.md: BigQuery through a Cloud Run function, and Snowflake through a Lambda function, S3 and Snowpipe.
    • (g) identity-tokens.md#secrets-for-the-setup-script, and a note in the Vault section.
    • The pages are in the docs README, docs/llms.txt, organizations.md's table and fctl-site's PAGES.

    Found along the way:

    • Paths with ..: fctl resolves . and .. in paths, including %2e, so an edge that lets /oidc/ through also lets /oidc/../api/… through. The private-instance setups refuse such paths first, and their check tests for it.
    • The metadata service: fix(host): keep sandboxes off cloud metadata services #631 now keeps the host's sandboxes off it. The runner guide adds a DOCKER-USER rule as a second fence: it covers Azure's WireServer, which fix(host): keep sandboxes off cloud metadata services #631 doesn't, and hosts of fctl 0.37.1 and earlier. It keeps DNS open, because Google Cloud and Azure serve DNS from those addresses.
    • Tailscale Funnel can't keep the rest private. It makes a whole port public, and fctl serves people, runners and the issuer from one origin.

    Left:

    • (b) The microVM section. The guide says Firecracker hasn't been tried on the clouds' machines yet. Running the driver's --ignored KVM tests and a session on one machine in each cloud is still to do.
    • Trying each guide end to end on real AWS, Google Cloud, Azure, Cloudflare and Snowflake accounts, and having someone who didn't write them follow them. This session had no cloud accounts. The bot and the receivers ran only against stubs.
    • The decisions in the issue: the Guides group in fctl.sh's navigation (the pages are flat for now), fctl id-token in setup scripts (the docs state the limit), and how the guides stay current.
  3. fctl-sh commented on Nov 23, 2026

    @fctl-sh
    ContributorAuthor

    #631 has merged. Once it's released (the release after v0.37.1), hosts keep Docker and Firecracker sandboxes off cloud metadata services by default (ADR 0093). Docker sandboxes run without NET_RAW and get routes they can't remove. Firecracker VMs' frames to those addresses are dropped on the host, except DNS. allow_cloud_metadata = true in host.toml turns it off. So guide (a) can point to that setting and docs/security.md#sandboxes instead of a firewall rule. It should still say: keep the enrollment token in the cloud's secret store, give the machine's role nothing else, and use Docker or Firecracker rather than Apple container or Lima on cloud machines.

  4. fctl-sh commented on Nov 23, 2026

    @fctl-sh
    ContributorAuthor

    #633 merged (cb9b22a). It's docs only, so no release is needed: fctl.sh shows the new pages once fctl's CI pins this commit and hyperstructure/fctl-site#137 adds them to the navigation; I'm doing that now. Still open here: (b), the microVM section, which waits for the driver to be tried on a machine in each cloud; trying each guide end to end on real accounts, with someone who didn't write them following them; and the issue's remaining decisions (a Guides group in fctl.sh's navigation, fctl id-token in setup scripts, how the guides stay current).

  5. fctl-sh commented on Nov 23, 2026

    @fctl-sh
    ContributorAuthor

    fctl.sh now shows the guides: hyperstructure/fctl-site#137 merged and deployed. Runners in your cloud, A Slack bot of your own and Agents' work in your data warehouse are live, in /llms.txt, and in the docs' search. Still open here: (b), the microVM section; trying each guide on real accounts; and the issue's remaining decisions.

  6. fctl-sh commented on Nov 26, 2026

    @fctl-sh
    ContributorAuthor

    The three decisions left here are now taken, each in a pull request:

    What's left needs cloud accounts, so it moves to #655: (b), the microVM section, and trying each guide end to end on real accounts, with someone who didn't write it. Once #654, #656 and hyperstructure/fctl-site#142 merge, this issue holds nothing #655 doesn't, and can close.

    Session: https://app.fctl.sh/s/ses_01M8AE8T9M05SW673SZJX7W74Y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions