Site administration
Give a repository its own Ravion hosts
A CI job on Ravion can wait for a new host. On TanStack/source, a job waited a median of 17.6 s for its host, and one job in 20 waited 60 s or more. Give one repository an execution environment of its own. Then Ravion keeps hosts ready for the jobs of that repository only.
5 min read
You need psql, and neonctl signed in to the Neon organization of the forge. The rows of the forge are in Postgres on Neon (README.md, "Database"). Put the URL of its database in PG_URL. The URL holds a password, so keep it in your shell only:
PG_URL="$(neonctl connection-string main --project-id tiny-unit-38538247 --role-name app --database-name source)"
Ravion keeps a reserve in each execution environment: hosts that are stopped and ready for the next job. All the repositories with no environment of their own share the reserve of the US East environment.
You need:
- To be a site admin, on a site where Ravion is set up.
- A repository whose CI jobs run on Ravion.
- A Ravion API key with the permission
executionEnvironment:create. The key of the runner Worker does not need it. - The Source repository with its packages (
pnpm install), and wrangler signed in to the Cloudflare account of the deploy. src, signed in to the forge.
1. Make the environment in Ravion
The new environment uses the AWS account and the network of the environment that the repository uses now. It gets a reserve of its own. Run these commands in Git Bash or a Linux shell.
Put the API key in a header file that only you can read. The command asks for the key, so the key stays off the command line:
(umask 077 && read -rsp 'Ravion API key: ' key && printf 'Authorization: Bearer %s\n' "$key" > ~/ravion-header)Read the US East environment, which the jobs of the repository use now. Its id is the value of
RAVION_EE_US_EASTinapps/web/wrangler.runner.jsonc:curl -sS -H @"$HOME/ravion-header" https://api.ravion.com/execution-environments/<US East environment id>Save this body as
~/ravion-environment.json:{ "data": { "givenId": "<owner>-<name>-<region>", "name": "<owner>/<name> (<region>)", "type": "AWS", "region": "<region>", "awsAccountId": "<awsAccountId>", "vpcId": "<vpcId>", "securityGroupId": "<securityGroupId>", "subnetSelection": { "mode": "PUBLIC" }, "sandboxes": { "performanceProfile": "BALANCED", "capacityTypes": ["ON_DEMAND", "SPOT"], "reservePolicy": { "type": "FIXED", "value": 1, "windowDays": 7 } } } }Then change these values:
<owner>and<name>: the owner and the name of the repository.<region>,<awsAccountId>,<vpcId>,<securityGroupId>andsubnetSelection: copy them from the environment that you read.valueinreservePolicy: the number of hosts that Ravion keeps ready. A job starts at once only on a ready host, and each ready host costs money while it waits. TanStack/source keeps 1 host ready, in its environment "TanStack/source (690236089307, us-east-1)". The shared US East environment, "Shared (690236089307, us-east-1)", also keeps 1.
A host of the reserve can wait as a stopped EC2 instance that keeps its disk. Then AWS charges only for the disk, 60 GiB by default. But a host often waits while it runs, and then AWS charges for the whole host: about $18 to $109 a month for each host, by its market (spot or on-demand) and how long it waits (an estimate of 2026-11-25).
Make the environment:
curl -sS -X POST -H @"$HOME/ravion-header" -H 'Content-Type: application/json' --data @"$HOME/ravion-environment.json" https://api.ravion.com/execution-environmentsThe answer holds the id of the new environment, which starts with
ee_. Write it down.If Ravion answers
Missing permission: executionEnvironment:create, your key cannot make environments. Ask an owner of the Ravion organization to make the environment with these values, or to give your key that permission.Delete the two files:
rm ~/ravion-header ~/ravion-environment.json
2. Find the id of the repository
psql "$PG_URL" -c "SELECT r.id FROM repos r LEFT JOIN orgs o ON r.owner_kind = 'org' AND o.id = r.owner_id LEFT JOIN users u ON r.owner_kind = 'user' AND u.id = r.owner_id WHERE r.name = '<name>' AND coalesce(o.name, u.username) = '<owner>'"
Type the owner with the same capital letters as on the forge, for example TanStack. The answer has one row: the id of the repository.
3. Add the repository to both Worker configs
Add the repository to RAVION_EE_REPOS, under vars, in apps/web/wrangler.runner.jsonc and in apps/web/wrangler.jsonc. Both files must have the same value:
"RAVION_EE_REPOS": { "<repository id>": "<new environment id>" },
Commit the change, and merge it to main. The ci/deploy job deploys the runner Worker. See "Deploying" in README.md.
4. Make sure that the jobs run in the new environment
After the deploy, start a CI run of the repository, for example with a push.
Find the id of one of its jobs.
<run id>is the end of the address of the run page,/@<owner>/<name>/ci/<run id>:src run view <run id> -R <owner>/<name> --json jobsThe
databaseIdof each job is its job id.In Ravion, open the run of the pipeline with the description
Source CI job <job id>.Make sure that its input
environmentis the id of the new environment.
The disk cache belongs to the environment. So the first runs in the new environment start with no cache, and pull the CI images again.
Done
Every Ravion job of the repository runs in its own environment. Ravion keeps the hosts of the reserve ready for these jobs only.
- Trusted and untrusted runs both go there, whatever the CI region of the repository.
- A trusted run keeps the disk of the repository (
src-<repository id>). The jobs of a hidden workflow in a trusted run keep a second disk (src-<repository id>-hidden). An untrusted run gets a clean disk.
Delete the environment
- Remove the repository from
RAVION_EE_REPOSin both Worker configs. - Merge the change to
main. After the deploy, the jobs of the repository run in the environment of its region again. - After the deploy, delete the environment in Ravion. Then AWS no longer charges for the disks of its hosts.