Skip to content

Latest commit

 

History

History
520 lines (320 loc) · 57.1 KB

INTEGRATIONS.md

File metadata and controls

520 lines (320 loc) · 57.1 KB

Integrations with Atlas, Pilot, and Cargo

Purpose

Central owns identity, Team capabilities, catalog policy, and billing. Atlas owns regional images, virtual machines, placement, and proxy routing. Pilot owns the benches and sites inside a server. Cargo builds the prepared images.

Central reaches each service through central/integrations/. Team authorization follows IAM and Capabilities.

Who owns what?

Customer -> Central Team -> trial VM -> Pilot site
                |
Central: permissions, product choice, operation record, domain claim
                |
                +-> Atlas: VM creation, placement, power, sleep, host migration
                +-> Regional proxy: applied hostname routes
                +-> Pilot: site/admin rename, site configuration, certificates
                +-> Cargo: regional storage lifecycle and bucket operations

Atlas/Cargo report -> central.api.state_delivery.receive -> scoped state update
Central repair scan -> same state update

Central does not issue certificates, edit guest nginx, transfer VM disks, or select Metal hosts. All remote calls stay under central/integrations/.

Central owns authorization and the customer-visible result. It verifies that a requested domain belongs to the caller before it changes a regional route.

The customer Team owns the trial before and after a paid upgrade. A Team can own several VMs with the same network tenant ID.

Regional authentication

Region stores the direct regional URL and numeric region ID, alongside its geography and display identity. Central signs a short-lived token for that region. Each request carries the Team tenant ID in X-Tenant-ID. Atlas verifies the token and enforces the tenant boundary. Each request also carries the Central trace ID in X-Frappe-Request-Id. Atlas uses it as its own trace ID, so a Central Error Log and the Atlas logs of the same work share one ID. Both need monitor on in the site config.

System images form a shared regional catalog. The tenant header identifies the authorized caller. It does not make those images Team-owned. Operator connection checks use the system tenant.

See Regional configuration for trust setup and connection checks.

How are tenants and regional keys managed?

Allocate unique, immutable, unsigned 32-bit Team tenant IDs through a persistent sequence. Reserve tenant zero for infrastructure. Preserve verified existing mappings and reject ambiguous data.

Do not reuse committed tenant IDs. Backfill before you enforce constraints. Test concurrent allocation and the actual migration order.

Store regional VM references with their Region. A VM name alone is not globally unique. Do not change existing Central resource IDs without need.

Central owns image offering presentation and matching tags. Central fetches regional System image builds from Atlas on demand. See Image offerings.

The Atlas image response exposes tags, architecture, availability, and disk size. Declare and test software resource requirements at the image builder. Do not duplicate regional builds or copy runtime metadata into Central by hand.

A matching size permits a warm start but does not guarantee that the selected host has the warm artifact. Cold startup must stay usable.

Regional tokens use Ed25519 keys with a central: key identifier. Atlas tokens carry iss=central, aud=atlas-admin:<region ID>, scope=*, and tenant=*. See SSO for every token type.

The client supplies X-Tenant-ID from the authorized Team. Never accept a customer-supplied tenant header as authority.

Publish keys before use and verify consumer acceptance. Serialize first-use key creation. Restrict key changes to operators.

A public key-set read must not rotate keys. Keep private keys and bootstrap credentials out of customer responses.

Region is the single owner of regional identity and connection configuration.

Image contract

Central fetches available System images when the customer selects a region and Image Offering. An offering contains presentation fields, allowed flows, and required tags. It does not store regional builds.

Atlas must return the following fields with each build:

Field Central use
ID, title, tags, and architecture Identify and describe the selected build.
Enabled flag and availability state Show only usable builds.
Root filesystem size in MiB Reject plans whose disk cannot hold the image.

Cargo's current Pilot image contains default-bench and site.local. Server and signup flows use that image layout. Ubuntu uses a base image. SSH keys are optional. See Image Offering for selectors and pagination.

Server creation has three network options. Central sends an option to Atlas only when the customer selects it:

Option Atlas create field
Public IPv4 public_ipv4: "auto". Refused when the region has no IPv4 price.
Public IPv6 public_ipv6: "auto"
Firewall firewall.enabled: true with the rules below

Each option has a flag in Central Settings > Feature Flags > Networking: Enable Public IPv4, Enable Public IPv6, and Enable Firewall. Each flag is off by default. When a flag is off, the New server page hides that option, and Central refuses a creation request that selects it.

Every creation also sends the disk IOPS, disk throughput, and private and public network throughput from Central Settings > Servers > Server Limits. A change applies to servers created after it.

Every new server gets the default rules in Firewall: inbound all traffic from the private network, ICMP, and TCP ports 22, 80, and 443, and all outbound traffic. The option only sets firewall.enabled. A disabled firewall permits all traffic and keeps the rules for when the customer turns it on.

A creation request can carry user_data of up to 16 KiB, which is also the Atlas limit. Central sends it to Atlas unchanged as guest.user_data, and cloud-init in the guest runs it on first boot. A caller uses it to set up a server without signing in after creation. Central saves it on the Resource Action with the other creation inputs, so it must not hold a long-lived secret.

Atlas reports the guest public IPv6 as a /128 prefix. Central stores the address without the prefix length in public_ipv6, and stores public_ipv4 as reported. See Public addresses for changes after creation. The overview shows ssh root@<address> for every image and uses the IPv6 address first. See Team SSH Key for selected keys and rotation.

A member with server:console can open the web console of a running server of any image. In the server actions, Web console opens a submenu with two modes. Central sends the selected mode to Atlas through POST /virtual-machines/{id}/actions/console-token.

Mode Session Password
ssh A new shell as root. Atlas adds a temporary key for the session and removes it when the session ends. The guest SSH service must run. Not necessary.
tty The shared serial console. It replays recent boot output and stays open across a restart. Use it when SSH does not respond. Necessary. The guest shows a login prompt.

open_console(team, resource_id, mode) accepts only ssh or tty. Central does not change the mode. If Atlas refuses an ssh token, the member sees a message that tells them to open the serial console. Central returns <region base URL>/vm_console#token=<token>. The dashboard asks for a new token each time a member opens the console from the overview or the server actions, because Atlas spends the token on first use. It opens the Atlas URL in one popup window per server, so a second request replaces the session in that window. The token expires after 30 seconds and stays in the URL fragment, so the browser does not send it to a server.

Firewall

The Networking tab of a server shows its firewall. A member with server:network can change it.

Change What Central sends Confirmation
Turn the firewall on or off enabled, plus default rules when enabling an empty firewall When it opens every port, or blocks SSH or all outbound traffic
Apply changes inbound and outbound only When the saved rules block SSH or all outbound traffic on an enabled firewall
Apply rulesets enabled: true with the merged rules of the selected rulesets When the merged rules block the private network, SSH, or all outbound traffic

Rule edits stay in the browser until the customer selects Apply changes. Each direction is a table with the columns Service, Port and Allowed from or Allowed to. Removing a rule takes it out of the table at once. Undo, or Cmd+Z on macOS and Ctrl+Z elsewhere, restores the draft one step at a time. Quick edits to one rule count as one step. In a text field and in a dialog, the shortcut keeps its normal text behavior. A footer below the rules always shows the number of unsaved changes or the reason Apply changes is blocked, with Undo, Discard and Apply changes. Discard restores the saved lists. An unchanged background observation does not replace a pending draft. If the saved rules change, Apply changes is blocked until the customer discards the draft to load the latest saved rules. The built-in rule sets Web server, SSH only, and Private only are in the Apply ruleset dialog and fill the rule lists for review before applying. Enabling a firewall with no saved rules allows SSH, HTTP, HTTPS and all outgoing connections.

Each row selects a service and has one field for its addresses. The field shows each address as a removable chip and has a list of named sources: Any IPv4, Any IPv6, Frappe Cloud network (fdaa::/16), Your VPN devices (fdac::/16), each WireGuard VPN device, and the addresses that other rules in the same direction use. A name shows its range on hover. A typed IP address or canonical CIDR range is added with Enter, or when the field loses focus. A single IP becomes a one-address range. Incomplete rules show guidance and cannot be applied. Invalid entries show a field error. An empty TCP or UDP port means all ports for that protocol. Custom ports stay editable when their value matches a preset service port. Central validates the complete change before sending it to Atlas.

update_server_firewall takes a list of servers and returns an error or null for each one. Central validates the change first: protocol any, tcp, udp, or icmp; ports only for TCP and UDP, as one port or one ascending range; address ranges in canonical CIDR form; and each rule only once.

Central sends the change through PATCH /virtual-machines/{id}/network. Atlas replaces each firewall field it gets and keeps the others. Central sends exactly the customer's rules and adds none of its own, so the dashboard shows every rule that Atlas enforces. A new server starts with these inbound rules, which the customer can remove:

Rule Why
All traffic from fdaa::/16 The regional proxy and the team's other servers reach a machine over the mesh, and an enabled firewall filters mesh traffic too. The web console does not need it, because Atlas opens the console inside the machine's network namespace.
ICMP from anywhere IPv6 neighbour discovery and path MTU need it.
TCP 22, 80, and 443 from anywhere SSH, HTTP, and HTTPS.

A WireGuard VPN device reaches a server only through a rule that allows its address in fdac::/16. Central used to add all traffic from fdac::/16 to every server and hide it. The patch remove_wireguard_device_firewall_rule queues a background job that reads each live server from Atlas and removes the fdac::/16 rule when the server has it. The job is safe to run again: central.integrations.servers.remove_legacy_device_rules.

Atlas checks at most 50 address ranges across all rules. The PATCH reply does not hold the firewall, so Central reads the VM again. Every read stores is_firewall_enabled and the customer's rules in firewall_rules. A server that Central has not read since this field was added shows its firewall after the next reconcile, which runs every 10 minutes.

Firewall rulesets

A Firewall Ruleset holds named inbound and outbound rules for one Team. Members manage rulesets in Settings > Firewall rulesets. A member needs team-wide server:network to create, change, or delete a ruleset, because a ruleset changes every server that uses it.

A server can use more than one ruleset. Virtual Machine.firewall_rulesets lists them. Central merges their rules, keeps each rule once, and sends the result as the firewall of the server. Central refuses a selection that holds more than 50 address ranges together.

Operation Behavior
set_server_firewall_rulesets(team, resource_id, rulesets) Sends the merged rules with enabled: true, then saves the list on the server. An empty list removes every ruleset and the server keeps the rules as its own.
Change the rules of a ruleset A background job sends the merged rules again to each server that uses the ruleset. A server that fails is named in last_sync_error, and Desk has a Sync Servers button to send again.
update_server_firewall with rule lists Refused while the server uses a ruleset. The firewall state can still change.
Delete a ruleset Refused while a server uses it.

The Apply ruleset dialog shows the merged rules before it applies them, with the ruleset each rule comes from. It names a rule that a wider rule already covers, a sensitive service that is open to anyone, and a ruleset that adds no rule.

Public addresses

A member with server:network on a server can attach or detach its public IPv4 and IPv6 addresses, and turn IPv4 internet access on or off, from the Networking tab.

Operation Atlas request Notes
Attach PUT /virtual-machines/{id}/public-ipv{4,6} with {"public_ip": "auto"} Atlas picks an address from the region's pool. For IPv4, Central first turns on IPv4 internet access, because Atlas requires it.
Detach DELETE /virtual-machines/{id}/public-ipv{4,6} The address goes back to the pool. The customer cannot get it back.
IPv4 internet access PATCH /virtual-machines/{id}/network with ipv4_internet_access Stays on while the server has a public IPv4.

Atlas applies an attach or detach after it replies. Central waits up to 30 seconds for Atlas to report the change, then reads the server. A slower change appears on the next reconcile. Central does not use reserved addresses yet, so an address always belongs to one server.

A public IPv4 is billed from the first read that reports it until a read no longer reports it, or the server is terminated. VirtualMachine.sync_public_ipv4_billing opens and closes one Subscription per server, linked by public_ip_server. The price is the Catalog Rate of the IP Resource Type for the team's currency, optionally per region. The starter rates are INR 170 and USD 2 per month. Central refuses to attach an IPv4, or to create a server with one, in a region without a rate. IPv6 is free.

WireGuard gateway

A region with WireGuard Gateway on serves customer devices at https://wireguard.<region zone>. Central signs a token with audience atlas-wg-gateway:<region ID> and scope peers:read peers:update, with no tenant claim. Each device is the Team tenant_id and a client ID. See WireGuard Device.

Operation Request Notes
Add a device POST /v1/peers Central retries once on HTTP 503. HTTP 409 means the key is in use.
Remove a device DELETE /v1/peers A missing device is not an error, so the retry job is safe.
Restore a region GET /v1/peers, then PUT /v1/peers Operator action on Region. Never retried by itself.
Server access PATCH /virtual-machines/{id}/network with wireguard_gateway_access Needs server:network. Off by default.

Compute settings

Atlas owns the sleep and CPU burst settings of a VM. Central stores no copy. Compute Settings on the Virtual Machine form reads them from GET /virtual-machines/{id} and sends only the changed fields to POST /virtual-machines/{id}/actions/resize. Atlas takes these fields in any VM state. A customer server that sleeps answers its first request late.

The server owner changes only sleep_after_idle_seconds, on the Settings tab of the server. Only internal teams, which have Is Internal set on their Billing Profile, get this section, until a sleeping server costs customers less. Both routes refuse other teams. central.api.servers.get_idle_sleep needs server:view. central.api.servers.set_idle_sleep needs server:resize, and refuses an open free trial. It takes zero, or 5 minutes to 24 hours. Zero also turns deep sleep and coma off. Deep sleep, coma, and CPU burst stay in Desk.

Field Atlas field Effect
Sleep After Idle (seconds) sleep_after_idle_seconds Saves memory and stops the VM after this idle time. The next request wakes it.
Deep Sleep After Idle (seconds) deep_sleep_after_idle_seconds Moves the saved memory to object storage.
Coma After Idle (seconds) coma_after_idle_seconds Also moves the disk to object storage. It must be longer than deep sleep.
Burstable is_burstable Lets the VM use CPU above its baseline. Off clears the baseline and the window.
Baseline CPU (millicores) baseline_cpu_millicores CPU the VM can always use. Zero uses 20% of its CPU.
Sliding Window (minutes) sliding_window_minutes How far back Atlas measures average CPU use. Zero uses 60.

Zero turns a setting off. Atlas refuses deep sleep and coma on a VM with more than 4 GiB of memory or 50 GiB of disk. Desk makes these two fields read-only on a larger server. Atlas explains sleep in Sleepy VMs.

A resize keeps the sleep settings, because Atlas keeps every field that a resize leaves out. When the new size is past the offload limit, Central first turns deep sleep and coma off, because Atlas refuses that size while they are set. A resize off a trial plan turns all three sleep settings off.

Termination protection

A member with server:terminate can turn termination protection on or off with the lock button in the server header, or in Desk with Server > Turn On Termination Protection on the Virtual Machine form. Central sends PATCH /virtual-machines/{id}/termination-protection and stores the is_termination_protected value that Atlas returns on the Virtual Machine. Atlas does not report this value in a VM read, so the stored value changes only through this request. Central refuses a terminate request for a protected server before it queues a Resource Action, and Atlas also refuses to delete a protected VM.

Server operation contract

Central stores each authorized operation in Resource Action before dispatch. Atlas receives one create or power request. Central saves the accepted VM identity before local finalization. A lost mutation response remains uncertain and must not trigger another remote mutation.

Scoped regional reads confirm VM state and repair interrupted local finalization. A failed read does not prove deletion. A scoped not-found response can confirm deletion and trigger local credential and billing cleanup.

Central builds the automatic management address itself. The regional proxy decodes a VM's mesh address from its hostname label, so Central encodes the same label from the observed mesh address and the region's proxy domain. The tenant API does not publish the regional zone, so an operator sets proxy_domain on Region. A management address alone does not prove Pilot readiness. Pilot creation also receives credential-bound pilot-central metadata and pilot-common-config metadata with the telemetry settings when the region has a telemetry host. When Central Settings has a Common Site Config, every server also gets it as pilot-common-site-config, which Pilot merges into sites/common_site_config.json at bootstrap, such as an app's relay URL. The customer can read it, so it holds nothing Central keeps from them (a trial's Grove key is the customer's own credential). Every Pilot server's pilot-common-site-config also holds fc_team, the server's Team, so Frappe's Pulse telemetry on each site files its events under that Team. When the region links an enabled FrappeMail Service, Central takes a ready mailbox from that service's pool, records it as a User Mail Account for the creation, and adds its SMTP settings to pilot-common-site-config: the SMTP server on port 587 with STARTTLS, the mailbox as login and sender, and always_use_account_email_id_as_sender. Pilot and every site then send mail through it. The password belongs to that one server. An empty pool fails the creation. A job every 5 minutes fills the pool to the service's minimum with send-only mailboxes, named notifications-<hash>@<domain>, through the Suite site's admin API. It adds at most 50 in one run. Central removes a server's mailbox from the Suite site when the server is terminated. Atlas refuses guest metadata with more than 16 entries or more than 48 KiB as compact JSON, and the region's host refuses a key longer than 128 bytes. AtlasClient.create_vm refuses the same metadata before it calls Atlas, because Atlas saves a draft machine before the host rejects a key.

When the region has a Max Storage Bundle Size above 0, Central creates a Cargo bucket for each new Pilot server, named <tenant>-<region>-<server>, and caps it at that size in GiB through the Cargo quota API. Central sends the bucket key as the [s3] section of pilot-config, which Pilot merges into bench.toml and uses for backups. Cargo enforces the quota. A failure to create the bucket fails the creation. When a creation fails before it gets a server, Central deletes its bucket. A retry first deletes a bucket that an earlier attempt left.

Pilot creation includes the requesting user's email as letsencrypt.email in pilot-common-config. Pilot saves it in common_config.toml for certificate requests. Central reads the user from Resource Action.requested_by, not from the dispatch worker session. This setting is sent even when telemetry is unavailable. A request with no user email leaves the setting unset. This applies to new VMs; existing VMs keep their current setting.

A free-trial creation also gets a Grove key when AI Settings keeps a pool of them for its product (a Trial Products row with a pool size above 0). Central mints each product's pool ahead, every 5 minutes, under the fixed Grove Team Central Trial, which an operator makes at Grove first, in the geography AI Settings names and, when the product's row names one, in that Model Group on top of the team's catalog; each key is capped for its life at Trial Key Cap and carries no expiry at Grove: Central revokes it Revokes Automatically After days after its assignment, or sooner when its server is terminated. Each key is an AI Trial Key record that holds the secret; the record's id is the key's title at Grove. The creation takes the oldest ready key of its product, records the creation on it, and adds it to pilot-common-site-config as ai_keys: the key's gateway URL and secret, the entry Pilot writes for a team's own keys. A paid creation gets no key. An empty pool does not fail the creation: the trial starts without AI. Central revokes the key at Grove when the creation fails, when the server is terminated and when AI Settings' Revokes Automatically After days have passed since the key was assigned, and tries a refused revoke again every hour. When the trial converts, Central hands the key to the team at Grove in the background: the same secret, now the team's, titled by the site, out of the product's group and without the trial's expiry, so the server's config keeps working and the team finds the key in its dashboard (AI is turned on for the team first; every conversion path has a payment method). The record goes Converting, then Converted. While it is Converting the team creates no key (create_api_key refuses and the dashboard says why), so none takes the key count, the spend-limit room or the title the hand-over needs. A hand-over Grove refuses or cannot hear is tried again every hour and given up after three attempts as Conversion Failed, said on the record and the Site with Grove's last answer (the record's Last Error, kept from any failed hand-over or revoke until one lands); the key is then revoked like any trial key's (the record's Revoked box ticks once Grove has it; its status keeps the failure) and the team creates its own key, told once by the ai_key_handover_failed notification that the old one will stop working. A trial's end stops its server and leaves its key, so an operator's Extend Trial of an ended trial starts it with the key it still holds. The gateway closes the key's books at the push that moves it, so what the trial spent stays Central Trial's and what follows is the team's.

See Resource Action for states, authorization, recovery, accepted quotes, and customer responses.

How does a site prove its team to an outside service?

An app on a site, such as Raven, asks Central for a token through Pilot's Central proxy: central.api.pilot.get_team_identity_token(audience). Pilot's credential names the team, so a site cannot get a token for another team.

get_team_identity_token returns a token that Central signs with its Pilot key. The token is valid for 5 minutes. Central stores no account and no secret for the outside service.

Claim Value
iss Central's issuer URL
aud The service URL that the site gave as audience
sub The team, such as TEAM-00042
team_name The team's name
scope team-identity
hosts The hostnames of the team's sites on the Pilot's server: each site's own address and its active Site Domain records. Empty when the credential has no server.

The service gets Central's public keys from central.api.jwks.get_jwks and verifies the signature, iss, aud, exp and scope. Then the service decides what access the team gets, for example a team account and its API keys. The Pilot credential names the team and its server, so a site cannot get a token for another team or for a hostname that the team does not serve. A service uses hosts to accept a site's hostname as the team's. A Pilot refuses a team-identity token as a login token.

How does a Pilot read private GitHub repositories?

Central owns the GitHub App, set on the GitHub tab of Central Settings. The App private key and secrets stay in Central. A Pilot gets only a token for one repository, with contents: read, that expires in about an hour.

Pilot ── start_connection ──> Central ── authorize, install ──> GitHub
  ^                             │ user with server:console picks repositories
  └──── repository_token ───────┘ GitHub Connection (grant)
  1. Pilot calls central.api.integrations.github.start_connection(return_url) with its credential and gets a link to /dashboard/github/connect/<attempt>. The attempt lives in Redis for 1 hour after the last activity. The return_url lives 24 hours, so an expired link still leads back to the server.
  2. The first user who opens the link must hold server:console on the Pilot's server. The attempt binds to that user. The OAuth state and a PKCE verifier bind the GitHub callback to the attempt and the user's session.
  3. The user authorizes or installs the App, then selects repositories in one or more accounts. The user must be a GitHub admin of each one. complete_connection saves one GitHub Connection per Pilot credential and installation. An account sent with no repositories loses its grant.
  4. Pilot calls status, repositories and repository_token(repository) with its credential. Each grant change increases the connection version. Central refuses a token when the grant changed while GitHub minted it.
  5. The signed GitHub webhook disables a connection when its installation is deleted or suspended, removes repositories the installation lost, and updates the name of a renamed repository. The App must subscribe to the repository event for renames. disconnect disables the Pilot's grants. Issued tokens stay valid until they expire.

The App needs one callback URL, on Central's issuer URL (central_url()). "Create GitHub App" in Central Settings creates the App from a manifest and fills the GitHub tab. A new App ID disables every grant, so each Pilot must connect GitHub again.

How does the trial flow work?

  1. Authenticate the customer and resolve the Team.
  2. Validate the trial limit, approved image, size, region, and existing eligibility.
  3. Persist the request and its unique customer request key.
  4. Issue and store a VM-specific Pilot credential and audience.
  5. Call Atlas with the image, size, sleep policy, and pilot-central metadata.
  6. Store the returned VM reference and automatic site and admin names.
  7. Observe the VM and verify bounded Pilot and site readiness.
  8. Record the site already present in the prepared image.
  9. Return the site login through the dashboard.

Metadata contains central_endpoint, central_auth_token, jwks_url, jwks_audience_id, and initial_jwks_cache. Do not put customer credentials into the shared image.

A VM running event can finish VM provisioning. It cannot prove that the site is ready for login. Keep VM state and site readiness separate.

Persist the request before remote work and enqueue after commit. A recovery sweep finds requests lost between commit and enqueue.

Central request deduplication does not make Atlas creation safe to repeat after a network timeout. Keep uncertain acceptance as an explicit state. Resolve an uncertain create through a verified lookup or operator recovery. Do not send a second create automatically without an upstream idempotency contract.

Bind credentials to the known VM. Revoke unused credentials after confirmed provisioning failure and bound credentials after confirmed deletion.

Do not disable eligibility, Team authorization, size validation, or trial-abuse checks.

How do server creation and lifecycle work?

Trial, Pilot-server, and plain-Ubuntu creation use the same authorized Atlas adapter. Each flow has an explicit readiness rule.

Resource Configuration Completion
Trial Prepared Pilot image, one existing site, metadata credential, approved idle timeout. VM accepted, Pilot ready, site reachable, and site login succeeds.
Pilot server Cargo Pilot image with its prepared bench and site, plus metadata credential. VM is ready and Central can open the correct Pilot admin.
Plain Ubuntu Approved Ubuntu image, allowed size, hostname, and SSH keys. Atlas confirms the requested running state and the agreed access configuration. No Pilot or Site record is required.
App server Cargo app image and user data from Cargo, built from the answers to the app's inputs. Atlas confirms the requested running state. The service sets itself up at first boot. See How is an app server created?.

Show Open Pilot only for a Pilot-managed resource. A plain Ubuntu VM must not fail because it has no Pilot process or site.

Do not expose privileged VM creation or system tenant zero to customers.

Idle sleep is on for a trial server. Other servers sleep only when the owner turns sleep on.

Record each operation separately from observed state and show a useful error on failure.

An explicit stop sets the desired state to stopped. It is different from idle sleep, where desired state stays running. Customer traffic must not undo an explicit stop.

A restart completes when the region accepts it and Central then reads the server as Running. The host stores the restart before Atlas replies, and the region never reports a state other than running during a restart. A failed restart shows as an error on the server, which Central records as Failed.

Opening Pilot uses a short-lived audience-bound token and the automatic admin name. Deny another Team's access.

A System Manager has five more actions on the Virtual Machine form in Desk. Central records Open Bench as Administrator, Revoke Pilot Access and a changed Compute Settings as a Comment on the server.

Action Effect
Open Bench as Administrator Opens the bench with the same one-click token, for a Running server with a gateway.
Revoke Pilot Access Revokes every Pilot Credential of the server, so its Pilot can no longer reach Central.
Retry Admin Domain Asks Pilot again for the admin hostname, when the server shows an admin domain error.
Web Console Opens an SSH session or the serial console (TTY) of a Running server, through open_console.
Compute Settings Reads and changes the sleep and CPU burst settings of a live server. See compute settings.

Pilot links back to its server in the console with /dashboard/servers?pilot=<jwks_audience_id>&action=<action>. The action is overview or resize; any other value opens the overview. A resize link opens the dialog only when the server can take a change and the user may resize it. The server list returns each server's active audience as pilot_audience, and the console matches the link against it. When the active Team does not hold that server, the console shows the server list and a message. On a fresh page, the link waits for the first server list load before it looks for the server.

Display supported network and SSH information for a plain Ubuntu server. Do not imply that a private mesh address is publicly reachable.

Delete only after the customer confirms the action. Confirm remote absence, revoke any Pilot credential, and preserve existing billing cancellation behavior.

How is an app server created?

An app is a fixed service, such as Redis or MariaDB, that a region's Cargo builds into an Atlas image tagged purpose: one-click. The Apps Image Offering lists these images.

  1. The console lists the region's apps with central.api.images.list_apps, and reads the inputs and minimum size of the selected one with central.api.images.get_app_requirements. Central gets both from Cargo.
  2. eligible_plans shows only the plans with enough CPU, memory and disk for the app.
  3. The customer sends the answers as app_inputs. Central refuses a plan below the app's minimum size, refuses customer user data, checks each answer against the app's inputs, and writes the answers as cloud-init user data to /etc/one-click/inputs.env. A blank answer is left out, and the server makes the value itself.
  4. The server boots from the image. Its first-boot script sets up the service and keeps the settings, including generated passwords, in /etc/one-click/app.env on the server.

Cargo also returns the app's documentation link, from the documentation field of its template. Central keeps it only when it is an https:// address. The console links to it in the app picker, and Central saves it with the app name on the Virtual Machine as documentation_url and application, so the server page shows Getting started. A server restored from a snapshot has neither.

An app server is a normal server after creation. Central does not route a name to it and does not open its ports. Without a public address, the service is reachable only on the region's private network. A server restored from a snapshot of an app server has no app requirements.

What does creation depend on?

The current creation flow requires the Atlas VM API and automatic management hostname. Staging also needs current schema, key trust, a healthy host, available images, and wildcard DNS.

Central receives signed state reports at central.api.state_delivery.receive. See Inbound webhooks for the contract. State reports supplement repair reads. They do not replace durable intent, and a callback is never the only recovery path. Resize uses the Atlas resize API, which moves a VM to another host when its host cannot fit the new size. When no host in the region can fit the new size, Atlas keeps the old size. Central then starts the server again if it was running, and fails the resize with REGION_AT_CAPACITY. Atlas does not stop a sleeping VM, so a CPU or memory resize starts a sleeping server first.

Central verifies domain ownership and owns the proxy route through Site Domain. The regional proxy terminates TLS for a regional name. For a custom domain, the proxy passes TLS to the VM, and Pilot holds the certificate. Central does not issue or store certificates.

How does state delivery work?

Atlas uses Framework's Webhook DocType to send reports. Do not rebuild an Atlas event service or a generic message platform.

Atlas and Cargo both deliver to central.api.state_delivery.receive. X-FC-Source selects the handler. Inbound webhooks is the contract.

Atlas sender

Configure a Webhook on Virtual Machine State with on_update. Verify that it covers insertion and later saves in the deployed Framework revision.

The payload carries the event, the VM ID, the observed status, and observed_at. Do not serialize an entire document.

The state writer saves on each host report, even when the status is unchanged. Use a tested condition for first observation or status change to avoid continuous duplicate callbacks. Do not assume that editing a Webhook filters unchanged values.

The state row has no tenant, desired state, operation ID, or site readiness. Central resolves the Team through its stored Region and VM mapping.

A callback can arrive before Central stores the create response. Central drops it as unknown server, and a repair read records the state later. Do not create a Team or resource from untrusted callback fields. The callback must not assign a machine to a customer based on its name.

Verification and ordering

Central verifies X-Frappe-Webhook-Signature with base64 HMAC-SHA256 over the exact raw request body. Each region has its own secret for each sender. A region identifier selects a candidate secret. It becomes trusted only after signature verification.

Central validates the source, fields, status, and resource mapping. It rejects unknown senders and bad signatures uniformly.

Central orders Atlas reports by the region's observed_at, stored as Virtual Machine.last_reported_at. It ignores a report that is not newer. A signature authenticates the body but does not prevent replay. Monotonic ordering prevents state regression.

Central does not persist a receipt and does not deduplicate by payload digest. A queued job holds the accepted report.

Do not run provisioning, billing, or remote calls in the HTTP receiver. Do not put bearer tokens, passwords, or private keys in payloads or delivery logs.

Delivery limits and recovery

Framework queues after commit and records configured delivery retries. A process can still fail between commit and enqueue. Retries can also be exhausted.

Verify sender workers, scheduler, retry configuration, and Webhook Request Log on staging. A supported DocType is not proof of active delivery.

Webhooks give the normal prompt state update. A paginated scan of known Region and tenant assignments (central.integrations.servers.reconcile, every 10 minutes) repairs missed observations.

Use bounded detail checks for active operations and deletion. Do not poll every guest or replace the webhook with a high-frequency fleet loop.

Atlas deletes the Virtual Machine State row through frappe.db.delete. That path does not produce a document deletion webhook. Central confirms VM deletion through the correctly scoped Atlas API.

A scoped 404 is also Atlas's response for another tenant's resource. Check the stored Region and tenant before you mark a known resource absent.

Fleet reads, detail reads, and webhook reports share one writer and freshness policy. Keep source observation time separate from local fetch time. An older callback or delayed read must not undo a newer result.

Follow all pages. An incomplete scan, timeout, or server error cannot prove deletion.

Sleep

A state callback can report stopped when a VM sleeps. It does not carry the desired state.

Read Atlas detail when that difference matters. Do not mark sleep as customer shutdown, cancel a subscription, or report a failed deployment from the callback alone.

Routine synchronization must not call the guest. Signup readiness and user-requested actions may contact Pilot with bounded retries.

How does Central register Cargo?

Central registers each region's Cargo after a health check. cargo_connection.register_cargo calls CargoClient.configure_webhooks, which sends Central's receiver URL and a fresh secret. Central stores the secret in Region.cargo_webhook_secret and sets cargo_status to Registered. Enroll Cargo on the Region form runs this on demand. register_pending_cargo retries Draft regions every 10 minutes.

Cargo reports service, status, and service_endpoint. Central records availability in Service Detail. Do not label a service healthy from a provisioning event.

How do Central errors reach Beacon?

Each minute, Central sends its new Error Logs to the Datum of one region: the Region with Central Telemetry Region set. Only one Region can have it. Without it, Central sends nothing. Set it on the region where Central runs, so the telemetry does not cross regions. Central signs each request with a Datum token for resource central and keeps its place in the cache key central:telemetry:error_log_cursor. The telemetry host reports an internal- address on the WireGuard mesh, which Pilots use. Central is not on the mesh, so it sends to https://telemetry-svc.<proxy_domain> of that region, and only while the telemetry Service Detail is Available. Beacon reads the rule beacon/rules/central-errors.sql from this repository and alerts when one error repeats. Change the rule in the same pull request as the data that it reads.

What does Central report to Datum?

Each minute, central.integrations.metrics.publish_metrics sends gauges to the same Datum. Each gauge is a count or an age, never a label for each record. All gauges of one collection share one timestamp, and the rules read only the newest collection, so a gauge that Central stops sending clears its alert.

Gauge Meaning
central_requests{group,status_class} API requests since the last accepted push, by central.api module and status class. The after_request hook count_request counts them in Redis. The minute job reads and resets the counts, and puts them back when the push fails.
central_resource_action_oldest_open_seconds{region,resource_type,action}, central_resource_actions_finished_last_hour{...,status} Open and finished Resource Actions.
central_payment_attempts_last_hour{gateway,status}, central_payment_last_capture_seconds{gateway} Payment Attempts and the newest capture.
central_gateway_webhooks_unprocessed{gateway}, central_gateway_webhook_oldest_unprocessed_seconds{gateway}, central_gateway_webhooks_failed_last_hour{gateway} Webhook Events that wait or failed.
central_billing_run_oldest_open_seconds, central_invoices_sync_failed Billing Runs that did not complete, and invoices that failed to sync to accounting.
central_site_domains_failed_last_hour{route_type}, central_site_domain_oldest_pending_seconds{route_type} Proxy routes.
central_vm_snapshots_failed_last_day{snapshot_type}, central_vm_snapshot_oldest_pending_seconds VM Snapshots.
central_emails_failed_last_hour, central_email_oldest_unsent_seconds The Email Queue. An email with a later send_after waits from that time.
central_job_queue_length{queue}, central_scheduled_job_late_seconds{job} Queues, and how late each scheduled Central job is. Failed jobs write Error Logs, so central-errors covers them.
frappe_webhook_requests_last_day{webhook,status} Webhook Request Logs of the last day. Exhausted means Frappe gave up after its retries.

The rules in beacon/rules/ read these gauges, and the runbooks in beacon/runbooks/ tell the responder what to do.

Two SLOs in beacon/services/ read the same data. dashboard-api counts the requests that did not fail with 5xx. server-actions counts the finished create, start, stop, restart and resize actions that succeeded. Both are global, so in Beacon set their Query Region to the Central Telemetry Region. billing is a declared service with no query: a published incident in Beacon sets its status.

Three checks in beacon/rules/ call Central from outside: central-dashboard-unreachable.http, central-api-unreachable.http and central-certificate.tls. They use {central_url} from Beacon Settings and have no region, so Beacon adds them turned off. In Beacon, set their Regions to the Central Telemetry Region and turn them on.

How do rename, routes, and TLS work?

Central calls the Pilot Admin API for renames.

Operation Pilot endpoint
Rename site POST /api/v1/sites/<name>/actions/rename with new_name and keep_old_hostname.
Rename admin domain POST /api/v1/settings/admin-domain with domain and tls.

Central stores the returned task ID. An accepted response is not completion. Central keeps the stable Site identity while the Pilot site name changes. Preserve an automatic management alias for recovery.

A Pilot registers its site and custom-domain routes through central.api.pilot.register_domain and removes them through deregister_domain. Central verifies DNS ownership and applies the proxy route through Site Domain.

Name Route owner TLS owner
Automatic VM name Proxy computes the VM address. No map write. Proxy regional wildcard certificate.
Friendly regional name Proxy site map. Proxy regional wildcard certificate.
Customer domain Proxy domain map to the VM. Pilot on the VM.

Atlas provisions the regional proxy and its wildcard certificate. The separate proxy control API applies map changes. Do not give a customer VM an unrestricted regional proxy token.

Wildcard or shared-proxy DNS resolution alone does not prove customer ownership. A domain-specific ownership check is required before a route can move between Teams.

The proxy forwards customer HTTPS as TLS with PROXY protocol v2 to VM port 443. Certificates and renewal stay in Pilot. Central stores the domain record, the operation result, and useful failure information.

How does the investigator read and change a server?

The Central Investigator is a Flow agent for operators. It is defined in central/investigator/agents.py and uses the first enabled Flow Model. It follows the server-support-guide, performance-inspection, and virtual-machine-investigation skills in skills/.

Layer Read Change Contract
Central read_records, run_report run_desk_action, call_central_api The permissions of the user. A change runs a whitelisted document method or a central.api method.
Pilot send_pilot_read_request, get_performance_snapshot, run_database_query send_pilot_write_request Central mints the bench token for each call and attaches it. The agent never sees the token.
Insights run_region_dashboard_queries None Runs the SQL of an Atlas workbook query on Region.telemetry_data_source. Only workbook queries, no free SQL.
Atlas start_region_investigation, get_region_investigation_status, get_region_investigation None POST /investigations and GET /investigations/<id> with the operator client of the region.

A session starts read-only. A change needs these, in order:

  1. The agent asks the user to switch the session to read-write, and the user approves the switch_to_read_write call. The switch lasts one hour.
  2. The user approves each change call.

A session whose approval mode is not Ask cannot switch: in Auto a model approves its tool calls, and in Auto-approve, as in a Trigger session, nobody does. central/investigator/access.py refuses any change that terminates or destroys a resource, or that returns a login, a console, or a secret. The operator does these in Desk.

The agent can read any Pilot GET path except those in PILOT_DENIED_READ_PATHS, which return a credential, a login, or a backup file. Performance data (database, monitor, metrics, system, storage, and site monitoring) comes back exact, because a scrub changes numbers and query text. Other results are scrubbed. run_database_query runs one SELECT, WITH, EXPLAIN, SHOW, or DESCRIBE statement in a read-only transaction. A SELECT stops after 10 seconds. A read-only transaction does not stop DDL, so the tool refuses any other statement. PILOT_DENIED_WRITE_PATHS refuses code, credentials, setup, and SQL changes.

The Central and Pilot knowledge bases hold the Central documents and the Pilot documents from GitHub, including the generated docs/admin-api-reference.md. Each migrate reloads the changed documents. If the load fails, for example without GitHub access, the migrate prints the error and continues. To load them without a migrate:

pilot --site <site> execute central.investigator.knowledge.load_knowledge_bases

How does Central create and list support tickets?

Central calls a Frappe Helpdesk site through central/integrations/helpdesk.py. Ticket policy lives in central/support.py. Central uses one service user on that site with the Agent role. That user also needs the Agent Manager role, because Central creates HD Customer and Contact rows. An operator sets the Helpdesk URL, the API key and the API secret in Central Settings under General > Helpdesk. Central stores the secret in a Password field.

A request to Helpdesk carries Authorization: token <key>:<secret>. Frappe reads the key, finds the service user and runs the request as that user. No customer session and no Central token reaches Helpdesk. The service user is the actor that Helpdesk records as owner and modified_by.

Central sends stock HD Ticket fields only. It does not change the Helpdesk schema or its forms.

Field Value
subject [<Category> · <Topic>] <customer subject>
description The customer's escaped text, then a Context block with Team, User, Category, Topic, the Server and Site that the caller can view, and links to the Team and records in Central
raised_by The caller's email
customer The team id, such as TEAM-00012
via_customer_portal 1

A critical issue is Unreachable or down, Site setup or provisioning failed, or Payment method or failed charge. A ticket for one of these is Critical, a priority that must exist in Helpdesk. Every other ticket gets the Helpdesk default priority. The client cannot set a priority.

Each Context block ends with an Open in Central line. It links the Team, and the Server or Site when the ticket names one, to the Desk record. An agent opens the record from the ticket.

Each Central Team is one HD Customer, named by the team id, such as TEAM-00012. Helpdesk names a customer by its customer_name, so Central creates the customer once and reuses it. Every Active member of the team is a Contact of that customer, one Contact per member email. A member who holds support:manage in the team is a Customer Manager, with is_manager set to 1. Every other member has is_manager set to 0. Helpdesk grants and removes the HD Customer and HD Customer Manager roles from these rows itself, so Central writes only the rows.

Central writes the customer's contact table from the team's Active members. It does this in a background job when a team is created, its members change, or its status changes. Before it opens a ticket, Central creates the customer only when Helpdesk does not have it. The job is deduplicated per team and runs after the commit. A System Manager can also run the sync by hand with Sync to Helpdesk on the Team form. The sync creates only the Contacts that Helpdesk does not have, then replaces the customer's contact table with the full list. A member who leaves the team loses the customer role at the next sync.

Every ticket Central opens carries customer set to the team id. The Context block still starts with <hr><p><strong>Context</strong><br>Team: <team><br>, which names the team for an agent. A list request asks for the tickets of the team's customer where status_category is not Resolved. A member without support:manage gets only the tickets they raised, because Central adds a raised_by filter to the request. Related-ticket search uses the same rule. Helpdesk indexes HD Ticket.customer, so the list is one indexed filter and does not read descriptions. A ticket that waits on the customer is Paused, not Resolved, and stays in the list. When Helpdesk is unreachable, the list fails at once and does not try again.

The data patch sync_helpdesk_customers makes every existing Team a customer. It queues one sync per team, so a slow Helpdesk cannot time out the whole run, and each team that fails is logged by its own job. It then runs central.support.assign_marked_tickets on the long queue after the commit. That job reads the tickets that the service user owns and that have no customer, reads the team from the Team: line of each description, and sets the customer for each team that exists. A team whose ticket write fails is logged and does not stop the rest. Central reads the service user once with frappe.auth.get_logged_user and caches it for a day. The patch is safe to run again.

Before a customer opens a ticket, the console asks Helpdesk for up to 5 matching articles and up to 5 of the team's tickets. An operator turns on Show Help Articles in Central Settings under Helpdesk after the desk publishes articles. While it is off, the dialog opens on the contact form and does not search. Central first reads up to 500 of the team's ticket names by customer, then sends those names in a POST body to Helpdesk's search for the customer's query, so a match in the subject or in the thread counts. Central keeps only ticket and email rows. It drops agent comments, because Helpdesk returns them to an agent and Central reads Helpdesk as an agent. The ticket search accepts any status, because a resolved ticket can still answer the question. Central drops a search row that points to a ticket outside the team list. A failed search returns no tickets and never blocks ticket creation.

Central waits up to 3 seconds to connect and 5 seconds for a search or list answer, because a late answer is no use while the customer types. It waits up to 30 seconds for a new ticket. A user can open 10 tickets an hour and run 60 searches a minute.

Central logs each failed Helpdesk call once in the Error Log, with the status and the body. When Helpdesk cannot be reached, or answers 502, 503, or 504, the customer reads that support is unavailable. Any other refusal, or a reply that is not Frappe JSON, shows a generic message. An operator also sees the status and the start of the body.

A ticket row opens <Helpdesk URL>/help/my-tickets/<ticket name>. This is the Helpdesk customer portal, so the customer needs a Helpdesk account there. The portal opens a ticket only for the person who raised it, so a teammate's ticket shows who raised it and has no link. The portal opens a teammate's ticket for a Customer Manager once Helpdesk links their Contact to their Helpdesk user. An operator keeps every link.

A member needs support:view in an Active team to open or list tickets. Owner, Admin, Billing, Developer and Viewer have it, and Viewer does not have support:manage. A member of a suspended team can create and list their own tickets without it, because a suspended team holds no grants and that member needs support to learn why the team was suspended. See Capabilities. When Helpdesk is not configured, the console keeps the external Support Ticket URL and shows no in-app form.

Validation

Run the shared contract tests before deployment. Complete the live journeys in Staging validation against the actual staging revisions. Mocked responses do not prove VM startup, Pilot login, SSH access, or webhook delivery.

Rescue mode

The server Settings tab and the operator's Desk Rescue mode action read the two nullable rescue fields directly from Atlas. Central does not persist a rescue selection. Unknown state is not disabled state. Use Refresh status after boot; a successful power action alone does not confirm the boot image.

Changing the selection requires both server:power and server:console on the server, and the existing server-access restriction applies to trials. The selection takes effect at the next cold boot. Start or restart remains a separate action. Enabling rescue can wake a sleeping server. Repairs modify the original disk; take a snapshot first.

CPU or memory resizing is refused before power changes while rescue is selected or active. Disk-only growth remains available unless the VM is in rescue with idle shutdown configured: Central cannot complete its required idle-setting update in that state, so it refuses before growing the disk. Leave rescue and boot normally before that resize.