# Arcane Compute: Developers and AI agents

> How to run apps on your own servers with Arcane Compute: connecting a server, arcane.yml key by key, services and the variables apps get, clusters, Cloudflare, the arcane CLI and the HTTP API.

Arcane Compute runs your apps, databases, caches and queues on Linux servers you own or rent, and can put parts of them on Cloudflare. An app is an Arcane Git repository with an `arcane.yml` that says where each environment runs and what it uses. This guide is for whoever sets it up or drives it without the browser: a developer, a CI job, or an AI agent. Everything is on this page, and the same text is at [/compute/llms.txt](https://arcanesuite.com/compute/llms.txt) for agents to read.

This page for people: https://arcanesuite.com/compute/docs

## Quick start

1. Add a server: in [compute.arcanesuite.com](https://compute.arcanesuite.com), Servers → Add a server, give it a name, and run the command it shows on the machine as root. It connects in about a minute.

   ```sh
   curl -fsSL https://compute.arcanesuite.com/install.sh | sudo sh -s -- <install token>
   ```

2. Make the services the app uses, in Compute's Databases, Cache, Queues or Search menu, or with the CLI. `arcane.yml` attaches services; it never makes them.

   ```sh
   npm install -g @arcana-labs/cli --registry https://npm.arcanesuite.com/
   arcane login
   arcane db create main-db --engine postgres --server big-box
   ```

3. Commit an `arcane.yml` at the root of the repository (in Arcane Git), with an environment named like one of your project's (a new account's project has `production`).

   ```sh
   cat > arcane.yml <<'EOF'
   environments:
     production:
       run_on: { server: big-box }
       deploy: npm run migrate
       web: { port: 3000, health: /healthz }
       database: main-db
   EOF
   git add arcane.yml && git commit -m "Deploy with Arcane Compute" && git push
   ```

4. In Compute, Apps → New app: pick the repository and its branch. Compute reads the file, makes the environment's container on `big-box` and deploys it. From then on every push to the branch deploys.

5. Open the app's free address (`<name>-<id>.arcn-compute.dev`), or point your domain at the server and add it under `domains`.

## How it's organized

| Thing | What it is |
|---|---|
| Server | A Linux machine of yours running the Arcane agent. The agent connects out to Arcane and applies what you ask; Arcane never logs in to it over SSH. |
| Cluster | Three or more of your servers joined on a private network. Apps spread their web replicas over it, and databases and caches on it fail over. |
| Project and environment | Projects group everything; each has environments (`production`, `staging`…). The sidebar's picker is the environment the lists show and new things go into. An environment can have shared variables every app in it gets. |
| App | An Arcane Git repository with an `arcane.yml`. Each environment in the file is one deployment target of the app. |
| Container | What runs on the servers: each app environment's, plus images, Docker Compose files and templates run on their own (Containers menu). |
| Service | A database, cache, queue or search engine running on a server or a cluster, made in Compute and attached to apps by name or ID. |
| Bucket | S3-compatible object storage, with no server, made in the Buckets menu. |

Your apps' traffic goes straight from visitors to your servers: it never passes through Arcane. If Arcane can't be reached, what runs on your servers keeps running; only changes wait.

## Who may do what

The organization's admins can do everything. Everyone else has a role per project: **viewer** (the default where they have none) reads apps, logs, metrics and deployments; **developer** also deploys, changes settings and variables, sees passwords, runs commands and terminals, and makes apps, services and jobs in the project; a project **admin** also manages its environments and members. Servers, clusters, deploy keys, notifications and new projects are the organization's admins'. A personal account is its own admin.

Deployments, rollbacks, settings, variables viewed, commands, terminals, passwords viewed, restores and what's made or deleted are kept in Settings → Audit log.

## Connecting a server

- **What it needs:** Linux with systemd (Ubuntu, Debian and others), 1 vCPU and 1 GB of memory at least, ports 80 and 443 open to the internet, root or sudo. amd64 and arm64 both work. Any provider, or a machine at home.
- **What the install does:** installs Docker when it's missing, Git, the `arcane-agent` binary as a systemd service, and Traefik as a container on ports 80 and 443 (routing and Let's Encrypt certificates). The install token works once: the agent swaps it for its own key in `/etc/arcane-agent/`.
- **Its page** shows CPU, memory, disk and network now and over the last day, its containers, Docker's disk use with a cleanup, and a terminal (admins).
- **Removing it** in Compute disconnects the agent. What runs on the machine keeps running; `sudo arcane-agent uninstall` then removes the agent and Traefik (apps and volumes stay).

| On the server | Does |
|---|---|
| `sudo systemctl status arcane-agent` | Whether the agent runs. Its log: `journalctl -u arcane-agent`. |
| `sudo arcane-agent update` | Updates the agent now. It also updates by itself: Compute offers new versions when it reconnects and every 15 minutes. |
| `sudo systemctl restart arcane-agent` | Reconnects it, which also picks up a new version. Apps keep running. |
| `sudo arcane-agent mesh` | The private network's peers and their last handshakes. |
| `sudo arcane-agent uninstall` | Removes the agent, its config and Traefik. |

`/etc/arcane-agent/env` can set `ARCANE_HTTP_PORT` and `ARCANE_HTTPS_PORT` (when 80 and 443 are taken) or `ARCANE_TRAEFIK=off` (you route traffic yourself). Restart the agent after changing it.

> A server's ID never changes; its name can. `run_on` and the CLI take either, but IDs never become ambiguous. The ID is in the server's Settings, with a copy button.

## Several servers and clusters

Servers that work together are joined on a private WireGuard network (UDP 51820 between them; Docker 28 or later). Each gets a private address, and services on one server are reachable from apps on the others.

- **A cluster** is 3 or more servers (a majority decides a failover; with 2 it can't). Make one in Clusters, then put an environment on it with `run_on: { cluster: <id or name> }`: its web replicas are spread over every server and each server's Traefik answers for the app's domains.
- **Clustered services:** PostgreSQL, MySQL and MariaDB (a primary and replicas, automatic failover, a router on each server so apps keep one address), Redis and Valkey (cluster mode, a replica of each primary on another server), MongoDB (a replica set), NATS, Typesense and Elasticsearch. Choose “A cluster” when making the service.
- **What differs on several servers:** volumes are per server, autoscaling and sleeping are off, and maintenance mode's page is served by the first server.

## Deploy keys

A deploy key lets another account's apps run on one of your servers or clusters, and use the services that run there, while their apps, deployments, variables and logs stay in their own account. Nothing else is shared: they don't see or manage your servers.

1. The owner's admin: Settings → Deploy keys → New key, for one server or one cluster. The key (`arck_…`) is shown once.

2. The other account's admin: Settings → Deploy keys → Other accounts' servers → paste it. A key belongs to the first account that pastes it.

3. That account's `arcane.yml` names the server or cluster in `run_on` and the owner's services by their IDs, which its Deploy keys page lists.

Revoking a key leaves what runs there running and refuses new deployments; “Take its apps off” also removes their containers from the owner's servers.

## The file

`arcane.yml` sits at the root of the app's repository (or of its folder, for an app made from a folder of a monorepo). It's read at every deployment of each environment, from the commit being deployed. Unknown keys are refused, so a typo fails the deployment with where it is, instead of doing nothing.

arcane.yml (a Laravel API):

```yaml
name: shop-api
environments:
  production:
    run_on: { cluster: 3f0c9a52-6d1e-4c1b-9a7e-2b8f5d0c4e11 }
    build: { builder: dockerfile }
    deploy: php artisan migrate --force
    web:
      port: 8000
      health: /up
      autoscale: { min: 2, max: 6, cpu: 70 }
    processes:
      horizon: php artisan horizon
      reverb: { command: php artisan reverb:start --port=8080, port: 8080, domains: [ws.shop.com] }
    jobs:
      prune: { schedule: "0 3 * * *", command: php artisan model:prune }
    volumes: { storage: /app/storage/app }
    domains: [api.shop.com]
    database:
      id: ada9dd2e-8c6e-4b30-8a59-aa7734ab9a6a   # a MySQL cluster
      database: shop
      user: shop_app
    cache: 475c8351-1f2a-4f0e-9d3b-6c1a2e7b9f30
    buckets: [uploads]
  staging:
    branch: staging
    run_on: { server: small-box }
    deploy: php artisan migrate --force
    web: { port: 8000, health: /up }
    database: shop-staging-db
    cache: shop-staging-cache
```

- **The file makes the app, never a service.** Each database, cache, queue, search engine or bucket it names must already exist (made in Compute or with `arcane db create`). A missing one fails the deployment before anything is built, naming every missing one and the menu to make it in. A service that's stopped or failed to start fails it too.
- **What the file sets wins** over the container's settings in the app's page, which say which keys came from the file. Settings it leaves out keep their value from the page.
- **A service that leaves the file** is detached from the app, never deleted: it keeps running, and the canvas shows it dashed with a link to delete it. Services you attached by hand on the page stay attached.
- **Without the file,** nothing deploys: the app's page shows a starting file to commit.
- `name` (optional) is the app's name in Compute.

## Environments and branches

`environments` maps each environment's name to what it runs. The name has to be one of the project's environments, or one that means the same: `production`/`prod`, `staging`/`stage`/`stg`, `development`/`dev`/`develop`, `testing`/`test`/`qa`, `preview`/`previews`, in any case. Add new environments to the project first (Projects in Compute); a file naming one the project doesn't have is refused, saying which it has.

- `branch`: the branch the environment deploys from. Unsaid: the app's branch (picked when it was made).
- A push deploys every environment whose branch was pushed; a push to a branch no environment uses is ignored.
- An environment is made the first time it's read, where its `run_on` says. Without `run_on` (and without `sites`) it isn't made.
- “Read arcane.yml and deploy” on the app's page (or `POST /api/applications/<id>/sync`) does the same as a push, at any branch.

## run_on: where it runs

| Value | Runs |
|---|---|
| `{ server: <id or name> }` | On one of your servers. |
| `{ cluster: <id or name> }` | On every server of a cluster, web replicas balanced over them. |
| `{ server: …, fallback: cloudflare }` or `{ cluster: …, fallback: cloudflare }` | On the servers, and the same image on Cloudflare Containers in your Cloudflare account, which answers only while the servers don't. See [Cloudflare](#cloudflare). |
| `cloudflare` | On Cloudflare Containers in your own Cloudflare account, with no server. |
| `pages`, or `{ pages: arcane }` | Static files built at every push and served by Cloudflare Pages, in Arcane's Cloudflare account: nothing to connect. |
| `{ pages: own }` | Static pages in your own Cloudflare account, with Pages Functions and bindings. |

Changing `run_on` moves the environment: the new place starts first, then the old one stops (volumes don't move). Moving from servers to `cloudflare` or `pages` leaves the old container in place, no longer deployed: delete it once the new one answers.

> Cloudflare (`cloudflare`, `fallback`, `{ pages: own }`, `sites`, `kv`, `streams`, Cloudflare queues and load balancers) uses your own Cloudflare account, connected once in Arcane Store → Integrations. Without it, the deployment fails with a link to connect it.

## build

| Key | Means |
|---|---|
| `builder` | `auto` (the default): the repository's `Dockerfile` when it has one, otherwise Railpack, which detects the language and builds without one. `dockerfile` or `railpack` forces either. |
| `dockerfile` | The Dockerfile's path, when it isn't `Dockerfile` at the root. |
| `build_command` | Railpack's build command, when the detected one isn't right. Static pages: the command that builds the site. |
| `start_command` | The web process's command, when the image's own isn't the one. |
| `static` | A folder of the built image served as a static site by the agent (no runtime). Static pages: the folder to publish; unsaid, the first of `dist`, `build`, `out`, `public`, `_site` the build left. |
| `spa` | With `static`: unknown paths without an extension get `index.html`. |
| `install_command` | Static pages only: the install step. Unsaid: what the lockfile asks for. |

Builds run on the server itself, with the app's variables available (as Docker build secrets for Railpack). Each deployment's image is kept, the newest five, so a rollback runs one again without building.

## deploy and web

`deploy` is a command run once per deployment, in a container of the new image with the app's variables and services, before the new version takes traffic: migrations. If it fails, the deployment stops and the running version keeps serving.

| Key of `web` | Means |
|---|---|
| `port` | The port the web process listens on (it also gets it as `PORT`). `0`: no web process, an app of background processes only. |
| `health` | A path that answers under 500 once the app is ready. Without it, an open port is enough. A new container has 2 minutes to pass. |
| `replicas` | How many web containers run, 1 to 20. |
| `autoscale` | `{ min, max, cpu }`: the web replicas' average CPU is read each minute; above `cpu`% for two minutes adds a replica, under 40% of it for ten removes one. On one server only. |
| `sleep_after` | Minutes without a request before the web stops; the first request then gets a short “Starting…” page while it starts. `0` or unsaid: never. On one server only. |
| `cpus`, `memory` | Limits per container: CPUs (`0.5`, `2`) and memory in MB. |
| `instance` | On Cloudflare only: the instance type, `lite`, `basic` (the default), `standard-1` … `standard-4`. |

A deployment starts the new containers, waits for each to pass its health check, moves traffic to them, then stops the old ones: no request is dropped. When anything fails, the new containers are removed and the old version keeps serving.

## processes, jobs and volumes

```yaml
processes:
  worker: node worker.js                     # a command: one replica
  emails: { command: node emails.js, replicas: 3 }
  ws: { command: node ws.js, port: 8080, domains: [ws.acme.com] }
jobs:
  report: { schedule: "0 3 * * *", command: node report.js }
  cleanup: { schedule: "@hourly", command: node cleanup.js }
volumes:
  uploads: /app/uploads
```

- **processes** run beside the web from the same image, kept running and restarted if they stop: queue workers, schedulers. Names are lowercase letters, digits and dashes. A process with a `port` takes traffic too (WebSockets, for example): on its `domains` and on `<process>.<the app's free address>`, and the web reaches it inside at `<process>-<app id>:<port>`.
- **jobs** run a command on a cron schedule, in UTC: five fields (`*`, lists, ranges, steps, names) or `@hourly`, `@daily`, `@weekly`, `@monthly`, `@yearly`. Each run is a new container from the live image with the app's variables and volumes, at most an hour; a run is skipped while the previous one still runs. Runs and their output are on the Scheduled jobs page.
- **volumes** are folders kept across deployments (`name: /path`), at most 10, shared by the app's containers on a server. Deleting the app deletes them. A pull request preview gets its own, empty.

## domains and load_balancer

- `domains`: your domains for the web. Point each one's DNS (an A or AAAA record, or a CNAME) at the server; Traefik gets a Let's Encrypt certificate once it does, and HTTP redirects to HTTPS. The Domains page shows whether each one points at the server and its certificate.
- `free_domain`: `false` turns off the free address, `<name>-<id>.arcn-compute.dev`, which every app gets so it works before any DNS. It's needed by `fallback: cloudflare`.
- `load_balancer`: `worker` (a Worker in your Cloudflare account on your domains: each request goes to a server in turn, and to the next one when a server doesn't answer), `cloudflare` (Cloudflare Load Balancing: needs its add-on on your account), or `none`. `{ mode: worker, primary: <server id> }` sends everything to one server while it answers and the others only while it's down. The Load balancers page shows each server's state and the traffic.

> Behind a load balancer or Cloudflare's proxy, an app's allowed-address list sees Cloudflare's addresses, not your visitors'.

## Naming services

Each kind of service has its key. A key takes one service or a list; each is an ID (in the service's Settings, “Service ID”, with the line to paste) or a name. IDs never change and never collide; a name that two services share in one account is refused.

| Key | Attaches |
|---|---|
| `database` or `databases` | PostgreSQL, MySQL, MariaDB, MongoDB |
| `cache` | Redis, Valkey |
| `queues` or `queue` | RabbitMQ, NATS, ElasticMQ; or a Cloudflare Queue with `engine: cloudflare` |
| `search` | Meilisearch, Typesense, Elasticsearch |
| `buckets` | Buckets (object storage) |
| `kv`, `streams` | Workers KV namespaces and K2 streams in your Cloudflare account |

```yaml
database:
  id: ada9dd2e-8c6e-4b30-8a59-aa7734ab9a6a   # by ID
  database: shop                     # one of the service's databases
  user: shop_app                     # a user made for it
cache: shop-cache                    # by name
queues: [jobs, events]               # a list
search: { id: 9d2f61c4-3b7a-4e0d-8f15-c2a9e7b05d38, engine: meilisearch }   # engine: only checked
```

- `engine` is optional and only checked: a deployment fails if the service runs another engine.
- On a PostgreSQL, MySQL or MariaDB service, `database` and `user` choose what the app connects as, both made first in the service's Access tab. `user` alone: its database. `database` alone: that database, as Compute's own user. Neither: the database `app` as Compute's user. The deployment fails if the user doesn't exist, is temporary, or is for another database.
- A service still starting is waited for (up to 10 minutes) before the deploy command runs.
- `version`, `cluster`, `server`, `cpus` and `memory` on a service are accepted for older files and ignored, as the deployment's log says: a service is made and changed in Compute.

## Cloudflare

Everything below runs in your own Cloudflare account, connected once in Arcane Store → Integrations (the token's permissions are checked there), and Cloudflare bills it to you. Compute never gives your token to a container: apps on servers reach KV, Queues and streams through Arcane's gateway with a key for that service alone.

### KV, Queues, streams and sites

```yaml
environments:
  production:
    run_on: { server: big-box }
    kv: [sessions]                                  # Workers KV
    queues: [{ name: jobs, engine: cloudflare }]    # a Cloudflare Queue
    streams: [events]                               # a K2 stream
    sites:
      docs: { build: npm run build, output: dist, spa: false, domains: [docs.acme.com] }
```

- KV namespaces, Queues and streams are made in Compute first (the Cache and Queues pages have an “On Cloudflare” section), like any service. An app on a server gets `KV_<NAME>_URL` and `KV_<NAME>_TOKEN`, `QUEUE_<NAME>_URL` and `_TOKEN`, `STREAM_<NAME>_URL` and `_TOKEN`.
- `sites` are static sites built from the repository (`install`, `build`, `output`, `spa`, `domains`) and published as Workers with static assets, with the environment's KV, Queues and streams bound by name (`env.SESSIONS`). Their domains must be zones of the account. An environment with only sites needs no `run_on`.
- K2 is in beta at Cloudflare: 20 streams per account.

### run_on: cloudflare and the fallback

- `run_on: cloudflare` builds the repository's Dockerfile (`build.dockerfile`) on Arcane Git Actions (billed as Actions minutes, shown in the repository's Actions tab) and runs it on Cloudflare Containers. It reads `deploy`, `web` (`port`, `health`, `replicas`, `sleep_after`: idle minutes, 10 when unsaid, `instance`), `processes`, `domains` and the services. `jobs`, `volumes`, `free_domain`, `kv` and `streams` aren't read there.
- Its services are reached at their **public addresses** (Cloudflare isn't on your private network): each one needs public access turned on, or the deployment fails saying so. Its own variables are set in the app's canvas, in its dialog.
- `fallback: cloudflare` keeps the environment on its servers and publishes the same image on Cloudflare too, in front of them: each request goes to the servers, and to Cloudflare's containers only while they don't answer. The fallback runs the web only (no processes, no deploy command), needs `free_domain` on, and the app's domains must be zones of the Cloudflare account.

### Static pages

```yaml
name: acme-web
environments:
  production:
    run_on: pages                    # Arcane's account; { pages: own } for yours
    build: { build_command: npm run build, static: dist }
    domains: [www.acme.com]
```

- For Vite, Astro, Hugo, plain HTML: built at every push and served by Cloudflare Pages. No server, no container. `_headers` and `_redirects` in the output work as Pages reads them, and a `404.html` replaces the single-page fallback.
- `run_on: pages` uses Arcane's Cloudflare account: only the files are published (no `_worker.js`, no `functions/`), and `kv`, `queues` and `streams` are refused. Limits there: 20,000 files a deployment, 25 MiB a file.
- `{ pages: own }` uses yours (the token needs Cloudflare Pages: Edit): the repository's `functions/` become Pages Functions, the environment's KV namespaces and Cloudflare Queues are bound to them, and a domain whose zone is in the account gets its record when the token may edit DNS. Switching between the two makes a new project with a new pages.dev address.
- Variables set in the pages' dialog reach the install and the build (a `VITE_…` ends up in the files) and, in your account, the Functions.

## Every key

| Key | Type | Where |
|---|---|---|
| `name` | text | The app's name. |
| `environments.<env>.branch` | text | All |
| `run_on` | see [run_on](#run-on) | All |
| `build.builder` | `auto` · `dockerfile` · `railpack` | Servers |
| `build.dockerfile` | path | Servers, Cloudflare |
| `build.build_command`, `build.start_command` | command | Servers (build: pages too) |
| `build.static`, `build.spa` | folder, true/false | Servers (static: pages too) |
| `build.install_command` | command | Pages |
| `deploy` | command | Servers, Cloudflare |
| `web.port`, `web.health`, `web.replicas` | number, path, 1–20 | Servers, Cloudflare |
| `web.autoscale` | `{ min, max, cpu }` | Servers |
| `web.sleep_after` | minutes | Servers, Cloudflare |
| `web.cpus`, `web.memory` | number, MB | Servers |
| `web.instance` | `lite` … `standard-4` | Cloudflare |
| `processes.<name>` | command, or `{ command, replicas, port, domains }` | Servers, Cloudflare |
| `jobs.<name>` | `{ schedule, command }` | Servers |
| `volumes.<name>` | path | Servers |
| `domains` | list | All |
| `free_domain` | true/false | Servers |
| `load_balancer` | `worker` · `cloudflare` · `none` · `{ mode, primary }` | Servers |
| `database(s)`, `cache`, `queue(s)`, `search` | ID or name, `{ id, engine, database, user }`, or a list | Servers, Cloudflare |
| `buckets` | ID or name, or a list | Servers, Cloudflare |
| `kv`, `streams` | name, or a list | Servers; `kv` on own pages |
| `sites.<name>` | `{ build, install, output, spa, domains }` | Your Cloudflare |

## Deployments

A deployment of an environment on servers goes through five steps, shown live on its page with its output: **source** (clone the commit), **build**, **release** (the `deploy` command), **start** (the new containers, each waited on until it's healthy) and **route** (traffic moves, the old containers stop). A new deployment cancels one still running.

- **Triggers:** a push to the environment's branch; Deploy on the app's page; `arcane app deploy`; the deploy hook (below).
- **Rollback:** any earlier deployment whose image is still kept (the newest five) runs again without building, from the deployment's menu.
- **Pull request previews:** a copy of an environment per open pull request, see [Pull request previews](#previews).
- **The deploy hook** is a URL (`https://compute.arcanesuite.com/api/hooks/srvh_…`, `arcane app hook <app>`) that deploys on a POST. With a GitHub, GitLab, Gitea or Arcane push event header it deploys only for the container's branch.
- **Commands:** a one-off command in a new container of the live image, with the app's variables and volumes, at most an hour (Commands tab, or `arcane app run`). Its exit code and the last 64 KB of output are kept.

## Pull request previews

Each open pull request can get its own running copy of an environment, built from the pull request's branch, at its own free address. Every push to the pull request deploys it again; closing or merging it removes the copy, its containers and images. It's a way to try a change, or show it to someone, before it reaches the environment.

1. In [Compute](https://compute.arcanesuite.com), Apps → your app → the environment the previews should copy → Settings → **Pull request previews**. Pick an environment that deploys from the app's branch (the one pull requests are opened against); a staging or sandbox environment is the safer choice, since previews use its databases.

2. Turn on **Make previews of pull requests**, choose what a preview takes (below) and Save. One environment is enough.

3. Open a pull request against the app's branch. Compute builds its preview in a minute or two: it's listed on the environment's Previews tab, and on GitHub a comment on the pull request carries its address and latest deployment, kept up to date on each push.

4. Merge or close the pull request: the preview goes away by itself.

| Setting | Unless changed | What it does |
|---|---|---|
| Attach the app's databases | On | The preview uses the environment's databases, caches and queues. Off: it gets none. |
| Run the deploy command | Off | Runs the environment's `deploy` command (migrations, usually) on each preview deployment. |
| Run the background processes | Off | Starts the `processes` (queue workers, schedulers) too. Off: the preview only serves web requests. |

> With the databases attached, a preview shares the environment's data. Keep **Run the deploy command** off then: a pull request's migrations would run on that data. When a change needs its migrations, preview a staging or sandbox environment instead of production.

- **What a preview is:** the environment's settings with the pull request's branch, on the same server (on a cluster, one of its servers), one replica, no custom domains, its own free address, the environment's variables, and its own empty volumes.
- **Which environments:** each environment that deploys from the app's branch and has previews on gets its own copy of each pull request.
- **Where:** environments on servers and clusters. Static pages (`run_on: pages`) get none.
- **Git hosts:** Arcane Git and the GitHub App send pull requests by themselves. Another host can post GitHub-shaped `pull_request` events, or GitLab's "Merge Request Hook", to the app's deploy hook.
- **Forks:** pull requests from forks get no preview, since their code would get the environment's secrets.

## Variables

An app's variables are set on its container (Variables tab, or `arcane app env`) and apply at the next deployment. Secrets go there, never in `arcane.yml`. On top of them Compute gives each container, in this order (a later one wins over an earlier one, and yours win over all):

| From | Variables |
|---|---|
| Arcane | `PORT` (the web's port), `APP_URL` (its first domain, else its free address). |
| Its services | Each attached service's connection variables: see [Services](#services). |
| Its buckets | `BUCKET_<NAME>_NAME`, `_ENDPOINT`, `_REGION`, `_ACCESS_KEY_ID`, `_SECRET_ACCESS_KEY`; the first bucket also as `AWS_*`, `AWS_ENDPOINT_URL_S3`, `AWS_USE_PATH_STYLE_ENDPOINT=true`, `FILESYSTEM_DISK=s3` and `S3_*`. |
| Cloudflare | `KV_<NAME>_URL`/`_TOKEN`, `QUEUE_<NAME>_URL`/`_TOKEN`, `STREAM_<NAME>_URL`/`_TOKEN`. |
| Arcane Oversight | `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_SERVICE_NAME`, `OTEL_RESOURCE_ATTRIBUTES`: an OpenTelemetry SDK in the app sends traces there by itself. |
| The environment | Its shared variables (Projects → the environment). |

The container's Variables tab lists what Compute adds, and from where, with secrets hidden.

## Services

Made in Compute's menus or with `arcane db create`, on a server or a cluster, in the environment the sidebar shows. Each runs as a container with its data in a Docker volume, a generated password, optional CPU and memory limits (the engine's memory settings follow them), and an optional public port.

| Engine | Menu | Port | Backups | Cluster |
|---|---|---|---|---|
| PostgreSQL | Databases | 5432 | Yes | Yes |
| MySQL | Databases | 3306 | Yes | Yes |
| MariaDB | Databases | 3306 | Yes | Yes |
| MongoDB | Databases | 27017 | Yes | Yes |
| Redis | Cache | 6379 | Yes | Yes |
| Valkey | Cache | 6379 | Yes | Yes |
| RabbitMQ | Queues | 5672 | No | No |
| NATS (JetStream) | Queues | 4222 | No | Yes |
| ElasticMQ (Amazon SQS's API) | Queues | 9324 | No | No |
| Meilisearch | Search | 7700 | No | No |
| Typesense | Search | 8108 | No | Yes |
| Elasticsearch | Search | 9200 | No | Yes |

### What an app gets

The names frameworks read by themselves (Laravel's among them). Hosts are the service's address as the app's server reaches it: its container's name on the same server, its private address on another.

| Engine | Variables |
|---|---|
| PostgreSQL | `DATABASE_URL`, `DB_CONNECTION=pgsql`, `DB_HOST`, `DB_PORT`, `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD` |
| MySQL, MariaDB | The same, with `DB_CONNECTION=mysql` or `mariadb` |
| A SQL cluster | Also `DATABASE_READ_URL`, `DB_READ_HOST`, `DB_READ_PORT`: the replicas, on the primary's port + 1. The address stays the same after a failover. |
| MongoDB | `MONGODB_URI`, `MONGO_URL`, `MONGODB_URL`, `MONGODB_HOST`, `MONGODB_PORT`, `MONGODB_DATABASE`, `MONGODB_USERNAME`, `MONGODB_PASSWORD` (clusters: `MONGODB_REPLICA_SET`) |
| Redis, Valkey | `REDIS_URL`, `REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD` (clusters: `REDIS_CLUSTER=redis`, `REDIS_CLUSTER_NODES`) |
| RabbitMQ | `RABBITMQ_URL`, `AMQP_URL`, `RABBITMQ_HOST`, `RABBITMQ_PORT`, `RABBITMQ_USER`, `RABBITMQ_PASSWORD`, `RABBITMQ_VHOST` |
| NATS | `NATS_URL`, `NATS_HOST`, `NATS_PORT`, `NATS_USER`, `NATS_PASSWORD` |
| ElasticMQ | `SQS_PREFIX`, `SQS_QUEUE=default`, `SQS_ENDPOINT`, `AWS_ENDPOINT_URL_SQS` (any AWS key works) |
| Meilisearch | `MEILISEARCH_HOST`, `MEILISEARCH_KEY`, `MEILI_MASTER_KEY`, `SCOUT_DRIVER=meilisearch` |
| Typesense | `TYPESENSE_HOST`, `TYPESENSE_PORT`, `TYPESENSE_PROTOCOL`, `TYPESENSE_API_KEY`, `SCOUT_DRIVER=typesense` (clusters: `TYPESENSE_NODES`) |
| Elasticsearch | `ELASTICSEARCH_URL`, `ELASTICSEARCH_HOST`, `ELASTICSEARCH_PORT`, `ELASTICSEARCH_SCHEME`, `ELASTICSEARCH_USER(NAME)`, `ELASTICSEARCH_PASSWORD`, `ELASTIC_PASSWORD` (clusters: `ELASTICSEARCH_HOSTS`) |

> Two services of one kind attached to one app set the same variables, and the last one wins. Attach one of each kind, or set the other's address in your own variables.

### Databases, users and temporary access

- A PostgreSQL, MySQL or MariaDB service holds `app` (made with it) and any more databases made in its Access tab, one per app if you like.
- **Users** (Access tab): for one database or all, as read, read and write, or admin. Name one in `arcane.yml` with `database` and `user` so the app connects as it.
- **Temporary access**: a read-only login that ends by itself after 15 minutes, an hour, 8 hours, a day or 7 days, made for someone named (“Claude, sales analysis”). It can't write even inside a read-write transaction, and allows 5 connections. Its password is shown once. Made for AI agents and one-off analysis.
- **SQL editor** and **schema** on the service's page, and its tables, sizes and slowest queries in Arcane Oversight.
- A Redis or Valkey service's **Queues** tab shows the Laravel, BullMQ or Sidekiq queues kept in it: waiting, delayed, running and failed jobs.

### Public access

- A single service can publish its port on its server's address. ElasticMQ never: it has no authentication.
- A SQL cluster's Settings → Public access gives two names, `<id>-write.db-cluster.arcn-compute.dev` and `<id>-read.db-cluster.arcn-compute.dev`, on ports Compute picks (shown there), following the cluster's servers that are online. PostgreSQL clusters serve TLS (`sslmode=require`).
- A Redis or Valkey cluster's public access is a proxy at `<id>.cache.arcn-compute.dev`, which clients use as a single Redis, not in cluster mode. It has no TLS, and commands that block or subscribe (BLPOP, SUBSCRIBE…) don't work through it. Apps on your servers keep the nodes' private addresses and the full protocol.
- **Allowed addresses** limit public access to IPv4 addresses and ranges. Apps on your servers are never refused.
- **Serverless access** (a SQL service's Settings): Cloudflare Hyperdrive configurations in your Cloudflare account, for Workers, with the bindings to paste.

### Backups

- PostgreSQL, MySQL, MariaDB, MongoDB, Redis and Valkey. **Back up now** on the service's page (or `arcane db backup <db>`), or a schedule: every few hours between two hours, daily, or weekly, keeping the newest N.
- A schedule can keep every database of the service in one file or a file for each database.
- **Restore** replaces the service's data with a backup; a backup can also be restored into a new service or a new database of the same one, or downloaded.
- Kept in Arcane's storage, billed per GB a month. Backups to your own S3-compatible bucket, set before in Settings → Backup buckets, cost nothing here.

## Buckets

S3-compatible object storage that needs no server: Buckets → New bucket, then `buckets: [uploads]` in `arcane.yml`. Each bucket has its own keys, which reach only it. Browsers may upload straight to it with a signed address. A bucket's dialog shows its address, name, access key, the secret on request, and what it holds.

The app gets `BUCKET_<NAME>_…` and, for the first bucket, the names Laravel and the AWS SDKs read (see [Variables](#variables)). Deleting a bucket an app names is refused; its keys stop at once when deleted.

## Logs, metrics and traces

- Every container's output and every deployment's, command's and job's go to **Arcane Oversight**, kept 15 days: the app's Logs tab, or Oversight's search with `@arcane_app:<id>`, `@arcane_deployment:<id>`, `@arcane_server:<id>` or `@arcane_resource:<id>`.
- Each container's CPU and memory every minute (`compute.container.cpu`, `compute.container.memory`), on the app's Overview and in Oversight; each server in Oversight's Hosts; each database's connections, size, tables and queries in Oversight's Databases.
- **Traces:** add an OpenTelemetry SDK to the app; the `OTEL_*` variables Compute gives send its traces to Oversight, with the same service name as its logs.
- **Notifications** (Settings → Notifications): a deployment failed or went live, a server offline for 5 minutes, a disk 90% full, a backup or a scheduled job failed. By push, email, or webhooks: a JSON POST signed with `X-Arcane-Signature: sha256=<HMAC of the body>`.

## Access and maintenance

- **Access** (the container's Settings → Access): allowed IP addresses or ranges (others get 403) and users with passwords (HTTP Basic). Applied at the next deployment.
- **Maintenance mode**: applies at once. Visitors get a 503 page with your message; the app keeps running behind it.
- **Terminal**: a shell in a container of the app or of a service, in the browser, for developers and admins. Every one opened is in the audit log.

## Containers without a repository

The Containers menu also runs things that aren't an app: an image (from Arcane Artifacts or any registry, with a login for a private one), a Docker Compose file written in Compute, or a template (WordPress, Ghost, n8n, Uptime Kuma, Metabase, Umami, Vaultwarden, NocoDB, Grafana, Directus) with its secrets generated. They get the same domains, free address, variables, services, logs and deployments; a Compose project keeps its own services and volumes.

## The arcane CLI

`npm install -g @arcana-labs/cli --registry https://npm.arcanesuite.com/` (Node 18 or newer), then `arcane login`: a person confirms the code in the browser once. A server, a database or an app is named by its ID or its name. The [Arcane CLI's guide](https://arcanesuite.com/cli#compute) has every option of `app set`.

| Command | Does |
|---|---|
| `arcane servers list` | Your servers: ID, name, state and address. |
| `arcane db list` | Your services: ID, name, engine, status, server and address. |
| `arcane db create <name> --engine <engine> [--version v] [--server s] [--public-port p]` | A new service, and waits until it runs. |
| `arcane db password <db>` | Its connection URL, password included. |
| `arcane db backup <db>` | A backup now. |
| `arcane app list` | Your containers: ID, name, status, source and address. |
| `arcane app show <app>` | Everything about one, as JSON. |
| `arcane app env <app> [KEY=value …] [--file .env] [--unset KEY]` | Prints or changes its variables. |
| `arcane app deploy <app> [--no-wait]` | Deploys and follows each step; exits 1 when it fails. |
| `arcane app logs <app> [--process p] [--lines n]` | Its latest log lines. |
| `arcane app run <app> -- <command>` | A one-off command; exits with the command's failure. |
| `arcane app hook <app>` | Its deploy hook. |
| `arcane api compute <METHOD> <path> [--data <json> \| --data @file]` | Any route of the HTTP API. |

> For an app with an `arcane.yml`, change the file and push: settings changed with `arcane app set` are overwritten by the file's at the next deployment, for the keys the file sets.

## HTTP API

JSON over HTTPS at `https://compute.arcanesuite.com`, with the token of a computer signed in with `arcane login` (`Authorization: Bearer …`, which `arcane api compute` adds). These are the routes the app itself uses, under the same roles. Errors answer with a status and `{ "error": "…" }` in words.

- `GET /api/servers` — Your servers.
- `GET /api/clusters` — Your clusters and their servers.
- `GET /api/applications` — Your apps (repositories with an `arcane.yml`), with the file last read and its error.
- `POST /api/applications` — A new app from an Arcane Git repository; reads its `arcane.yml` and deploys.
  Body: `repoId`, `branch`, `name?`, `directory?`
- `POST /api/applications/:id/sync` — Reads `arcane.yml` at a branch and deploys its environments.
  Body: `branch?` (the app's when unsaid)
- `GET /api/apps` — Containers: each environment of an app, and images, Compose files and templates.
- `GET /api/apps/:id` — One container: settings, domains, processes, services.
- `PATCH /api/apps/:id` — Changes its settings or variables; they apply at the next deployment.
  Body: the fields of `GET`, e.g. `env` (`KEY=value` lines)
- `POST /api/apps/:id/deploy` — Deploys now, or runs an earlier deployment's image again.
  Body: `rollbackOf?` (a deployment's id)
- `GET /api/apps/:id/deployments` — Its deployments, newest first.
- `GET /api/apps/:id/deployments/:number` — One deployment with its steps and status.
- `POST /api/apps/:id/actions` — Stops, starts or restarts it.
  Body: `action`: `stop` · `start` · `restart`
- `POST /api/apps/:id/commands` — Runs a one-off command; `GET /api/apps/:id/commands/:cid` gives its output and exit code.
  Body: `command`
- `GET /api/apps/:id/logs` — Its latest log lines.
- `GET /api/resources` — Your services.
- `POST /api/resources` — A new service.
  Body: `serverId`, `kind`, `version`, `name`, `publicPort?`
- `GET /api/resources/:id/password` — Its connection URL and password (developers).
- `POST /api/resources/:id/backups` — A backup now.
- `POST /api/hooks/:token` — The deploy hook: deploys the container it belongs to. Needs no other token.

Deploy an app's environments:

```sh
arcane api compute POST /api/applications/<app id>/sync --data '{"branch":"main"}'
```

## A Node app with Postgres and a worker

1. Make the database (once)

   ```sh
   arcane db create acme-db --engine postgres --server big-box
   ```

2. Commit the file

   ```yaml
   environments:
     production:
       run_on: { server: big-box }
       deploy: npm run migrate
       web: { port: 3000, health: /healthz, replicas: 2 }
       processes:
         worker: node dist/worker.js
       database: acme-db
       domains: [app.acme.com]
   ```

3. Push, then follow the deployment

   ```sh
   git push
   arcane app list
   arcane app logs <container id> --lines 100
   ```

4. Set a secret (it applies at the next deployment)

   ```sh
   arcane app env <container id> STRIPE_KEY=sk_live_…
   arcane app deploy <container id>
   ```

## Staging from another branch

1. Add `staging` to the project in Compute (Projects), and make its services in that environment.

2. Add the environment to the file, on its branch

   ```yaml
     staging:
       branch: staging
       run_on: { server: small-box }
       deploy: npm run migrate
       web: { port: 3000, health: /healthz }
       database: acme-staging-db
   ```

3. Push the branch: Compute makes the environment and deploys it

   ```sh
   git push origin staging
   ```

## Moving to a cluster

1. In Clusters, make a cluster of three servers. Make a PostgreSQL service on it (“A cluster”), and move the data with a backup restored into it.

2. Change `run_on` to the cluster and `database` to the new service's ID, and push. The app starts on the cluster's servers before it stops on the old one; its volumes don't move.

3. Optionally add `load_balancer: worker` so a server that goes down stops getting requests.

## Rules for agents

- Start with `arcane whoami`. If the computer isn't signed in, run `arcane login --no-browser`, give the person the link and the code it prints, and wait. Never ask for a password or a token in the conversation.
- Deploy by changing `arcane.yml` or the code and pushing to the environment's branch. Don't change settings the file sets with `arcane app set`: the next deployment puts the file's back.
- Name servers, clusters and services by ID. Take them from `arcane servers list` and `arcane db list`; never guess.
- Before naming a service in `arcane.yml`, check it exists with `arcane db list`. The file doesn't make services: ask the person before making one, since it runs on their server.
- After a push, follow the deployment (`arcane app list`, then `arcane app logs`, or the API's deployments). When it fails, read its error and output before changing anything.
- Never put a secret in `arcane.yml`, a commit or the conversation. Set it with `arcane app env <app> KEY=value` or `--file`. Read `arcane db password` into a variable instead of printing it.
- To look at a database's data, ask the person for a temporary access (read-only, it ends by itself) instead of the service's own password.
- Don't delete services, volumes, buckets or servers, restore a backup, or run commands that change data in production unless the person asked for it.
- Show an error's text to the person as it is. It says what went wrong and where to fix it.

### AGENTS.md

Paste this into your project's `AGENTS.md` or `CLAUDE.md`, with your app's names.

AGENTS.md:

```md
## Arcane Compute

This app deploys with Arcane Compute from arcane.yml at the repository's root.
Full guide for agents: https://arcanesuite.com/compute/llms.txt

- Run `arcane whoami` first. If it fails, run `arcane login --no-browser`, show me the link and the code, and wait.
- Deploys happen on push: production from main, staging from staging. Don't push to main unless I ask.
- Change how the app runs in arcane.yml, not with `arcane app set`.
- Services must exist before arcane.yml names them: check with `arcane db list`, and ask me before making one.
- After a push, follow the deployment with `arcane app list` and `arcane app logs <id>`. If it failed, read why first.
- Secrets: `arcane app env <id> KEY=value`. Never commit or print them.
- For data, ask me for a temporary read-only access; never use the database's own password.
```

## When a deployment fails

| It says | Do |
|---|---|
| `arcane.yml has no "<env>" environment` | The file's environments don't match the container's. Add it to the file, or name it as the project does. |
| `names a service that doesn't exist` | Make it in the menu it names (or `arcane db create`), with that name, then deploy again. |
| `… is stopped` / `… didn't start` | Start or fix the service on its page. |
| `there's no server called …` / `two servers are called …` | Use the server's ID from its Settings. |
| `… exists as Redis, not Valkey` | `engine` doesn't match the service: fix or remove `engine`. |
| `isn't valid YAML` / `at <path>: Unrecognized key(s) in object` | A typo or a key in the wrong place; the path says where. |
| The health check doesn't pass | The app must listen on `PORT` on 0.0.0.0, and `health` must answer under 500 within 2 minutes. The deployment's output and the app's logs say why. |
| A Cloudflare permission is missing | Add the permission it names to the token in Arcane Store → Integrations. |

A failed deployment changes nothing: the running version keeps serving.

## Limits and prices

| What | Value |
|---|---|
| Servers, apps, services and deployments | No fee |
| Traffic between your servers and Arcane (metrics, terminal, task output) | $0.05 per GB |
| Backups in Arcane's storage | $0.10 per GB a month |
| Buckets, static page and site builds | By use, on the monthly invoice |
| Logs, metrics and traces | Arcane Oversight's prices |
| Builds for `run_on: cloudflare` | Arcane Git Actions' minutes; Cloudflare bills the containers |
| Web replicas | 1 to 20 |
| Volumes per app | 10 |
| Images kept for rollback | The newest 5 |
| A new container's health check | 2 minutes |
| A command or a job's run | 1 hour; the last 64 KB of output kept |
| Logs kept in Oversight | 15 days |
| A cluster | 3 servers or more |

Your apps' own traffic goes straight to your servers and is never billed by Arcane. Adding a server needs a payment method on your Arcane Account.

## Links

- [compute.arcanesuite.com](https://compute.arcanesuite.com): the app.
- [/compute/llms.txt](https://arcanesuite.com/compute/llms.txt): this guide as plain Markdown, for agents.
- [Arcane Compute](https://arcanesuite.com/compute): what it is and what it costs.
- [The Arcane CLI](https://arcanesuite.com/cli): every command.
- [Arcane Git's guide](https://arcanesuite.com/git/docs): repositories, pull requests and Actions.
