Skip to content

Environments

Push one tree to a development, a staging and a production project.

Updated

A Run project is one environment. To get development, staging and production, create three projects and push the same tree to each one. Push from your computer with the rakerun CLI, or from CI with the CloudRaker/run-deploy GitHub Action.

What each project holds

Each project keeps its own records, knowledge index, secrets, grants and commits. A push to one project changes none of them in the other projects. The table definitions of _schemas/ are different: they belong to the org. Read Tables are shared in the org.

Part In each project
Records The records of the Structured Memory tables, and the access and filing settings of _schemas/ for them. A record of one project never shows in another one.
Knowledge The search index of the knowledge/ folders.
Secrets The secret values that you set on the project. They win over the org values.
Connector grants The connectors that the agents of the project can use.
Live commit The commit that the default branch deploys. Each project also has its own branch previews.
Base path The first segment of the agent URLs: https://{org}.cloudraker.run/{base}/{agent}. By default, it is the project name.
Front doors The doors of doors/, and the phone numbers, email aliases and Slack and Teams channels that you bind to them.

Run does not link the projects. It never copies records, secrets, grants or commits from one project to another. To move a change to the next environment, push the same commit to the next project.

Run lints each push. If the configuration is not valid, Run refuses the push, and the output names the file, the line and the rule. So a project holds only a tree that passed the lint. But Run is not a backup of your code. Keep your own origin (GitHub or another git host) as the source of truth.

Tables are shared in the org

Each project has its own records, but each table definition belongs to the org. The projects of an org share one definition for each _schemas name. The shared definition holds these settings:

  • The fields, with required, unique and the options of each field.
  • label and label_field.
  • to and many of each relation field.

Only access and filing come from the files of each project.

Each live push writes the _schemas/ files of its project to the shared definition. Some examples of a change that you push to the development project only:

Change in development Effect in staging and production
Remove unique: true from email data.upsert with on: email fails: email is not a unique field now.
Add required: true to a field data.create fails for a record that has no value for that field.
Add a field or an option The field or the option shows in each project.
Change to or many of a relation field The push fails with type_change_blocked while one project of the org has records in the table.

Lint compares a push only with the live tree of the same project, so it does not find these problems. To prevent them, do one of these:

  • Keep _schemas/ the same in every project of the org. Push a schema change to all the environments together, and make sure that the agents of each environment work with the new table. A new optional field or a new option is the safest change.
  • For a strict boundary, put production in another org. Each org has its own tables.

With the rakerun CLI

The CLI keeps each environment as a git remote of your clone. Your origin stays on GitHub or on your other git host.

  1. Create the projects

    Create one project for each environment. This needs a token with the admin scope. The token of rakerun login has every scope.

    rakerun repo create acme-agents-dev
    rakerun repo create acme-agents-staging
    rakerun repo create acme-agents
  2. Add the environments

    In your clone, add one environment for each project:

    rakerun env add dev acme-agents-dev
    rakerun env add staging acme-agents-staging
    rakerun env add prod acme-agents

    env add adds a git remote with the name of the environment. For example, the remote dev points at https://acme.cloudraker.run/_git/acme-agents-dev. env add refuses a project that does not exist, and a remote name that is already in use.

    git gets the token from rakerun git-credential, so rakerun must be on your PATH. If you use npx rakerun only, install the CLI first: npm install -g rakerun.

    env add makes rakerun git-credential the only credential helper of the org host in your global git configuration. So the macOS keychain or the Git Credential Manager does not keep an old token after a new login.

    The remotes are in the git configuration of your clone, not in the tree. Each person adds the environments once in their own clone.

  3. Push

    Commit your change, then push it to an environment:

    git commit -am "triage: ask for a repro"
    rakerun push dev

    rakerun push lints the last commit, then pushes it. It makes no commit, so a change that you did not commit stays out of the push. If the lint finds an error, the push stops before git starts, with exit code 1.

    The push goes to the branch of the project that has the name of your current branch. The default branch of the project (main) deploys live. Another branch gets a branch preview. To deploy live from another local branch, add --branch main:

    rakerun push staging --branch main

    A new project has no branch. The first branch that you push to a project becomes its default branch, and that branch deploys live. So rakerun push refuses the first push of a branch other than main to a project with no branch, also with --branch. This keeps main as the live branch. For example, on your develop branch, push the last commit to main first. That push makes the commit live:

    rakerun push dev --branch main

    After that first push, rakerun push dev from develop gets a preview.

    rakerun deploy has the same rule: deploy main first. rakerun new makes no commit, so its folder can have no main branch. Then git switch -c main makes a copy of your branch, and the deploy of that copy makes all of your branch live.

    The output shows the deploy log of Run:

    Pushing main (3f2c9d8) to acme-agents-dev at acme.cloudraker.run...
    deployed 4 agent(s) at 3f2c9d81e5a4b7c6d0e1f2a3b4c5d6e7f8091a2b
  4. Check the environments

    rakerun env list shows each environment with the live commit of its project:

    ENV      PROJECT              HOST                 LIVE     DEPLOYED AT
    dev      acme-agents-dev      acme.cloudraker.run  3f2c9d8  2026-11-02T17:48:32.512Z
    staging  acme-agents-staging  acme.cloudraker.run  3f2c9d8  2026-11-02T17:52:10.044Z
    prod     acme-agents          acme.cloudraker.run  9a17c4e  2026-10-30T15:02:11.871Z

    A remote that does not point at Run, for example origin on GitHub, does not show. Add --json to get the full commit of each project.

To move a change from development to production, push the same commit to each environment in turn:

rakerun push dev
rakerun push staging
rakerun push prod

An environment in another org

A project can be in another org, for example a production org with its own admins and tokens. Sign in to that org with its own profile. Then name the profile when you add the environment:

rakerun login --org acme-prod --profile prod
rakerun profile use default        # login makes the new profile the current one
rakerun env add prod acme-agents --profile prod

rakerun push prod and rakerun env list find the token in the saved profile of each host, so they need no --profile. The token that git gets from rakerun git-credential follows the same rule.

The CLI never sends CRR_TOKEN to another host. CRR_TOKEN goes only to one host: the host of CRR_BASE_URL, else the host of the current profile. In CI with no saved profile, set CRR_BASE_URL to the org host and CRR_TOKEN to a token of that org. Or give --base-url and --token to rakerun push.

--profile, --base-url and --token of rakerun push also apply to its git push. The CLI gives them to rakerun git-credential, so git uses the same token as the lint.

With GitHub Actions

The CloudRaker/run-deploy action pushes the checked-out commit to a branch of a project. Run lints the push, and the action prints the lint result and the deploy log.

You keep no CloudRaker secret in GitHub. The job gets an ID token from GitHub, and Run exchanges it for a short-lived token. An org admin adds one trust for each job.

The workflow below has three jobs, one for each environment, in the repository acme/agents. Each job pushes to its own project:

Environment Git event Project Subject rule of the trust
Development a push to develop acme-agents-dev repo:acme@1234/agents@5678:ref:refs/heads/develop
Staging a push to main acme-agents-staging repo:acme@1234/agents@5678:ref:refs/heads/main
Production a published GitHub release acme-agents repo:acme@1234/agents@5678:environment:production

GitHub puts the owner ID and the repository ID in the subject, for example repo:acme@1234/agents@5678. To see the prefix of your repository, run gh api repos/OWNER/REPO/actions/oidc/customization/sub --jq .sub_claim_prefix. An older repository can have the prefix repo:acme/agents.

name: Deploy agents

on:
  push:
    branches: [develop, main]
  release:
    types: [published]

permissions:
  contents: read
  id-token: write

jobs:
  development:
    if: github.event_name == 'push' && github.ref_name == 'develop'
    runs-on: ubuntu-latest
    concurrency:
      group: run-deploy-development
      cancel-in-progress: false
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0
      - uses: CloudRaker/run-deploy@v1
        with:
          org: acme
          project: acme-agents-dev

  staging:
    if: github.event_name == 'push' && github.ref_name == 'main'
    runs-on: ubuntu-latest
    concurrency:
      group: run-deploy-staging
      cancel-in-progress: false
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0
      - uses: CloudRaker/run-deploy@v1
        with:
          org: acme
          project: acme-agents-staging

  production:
    if: github.event_name == 'release'
    runs-on: ubuntu-latest
    # Restrict this environment in GitHub before you add its trust. Read "Add a trust".
    environment: production
    concurrency:
      group: run-deploy-production
      cancel-in-progress: false
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0
      - uses: CloudRaker/run-deploy@v1
        with:
          org: acme
          project: acme-agents
  • fetch-depth: 0: Run needs the full history of the commit. If the checkout is shallow, the action fetches the history first, and the job takes longer.
  • A concurrency group for each project: two deploys to one project never run at the same time. With cancel-in-progress: false, a new deploy waits until the current one ends.
  • permissions: id-token: write lets the job ask GitHub for an ID token. contents: read lets the job read the repository. The token from Run does the push.
Input Default What it does
project The name of the Run project. Required.
org The org slug. The action pushes to https://{org}.cloudraker.run.
base-url The org host, for example https://acme.cloudraker.run. Give org or base-url, not both.
branch main The branch of the project that gets the commit. The default branch deploys live.
force false true replaces the project branch with the commit. Read Force a push.

The action also sets the outputs sha, deployed, preview-url and log, and writes a job summary. Each lint issue becomes an annotation on the workflow run.

Add a trust

A trust tells Run which GitHub jobs can deploy to the org. An org admin adds one for each job, before its first deploy:

  1. In Dash, open Trusted issuers and click Add issuer.
  2. Set Issuer type to GitHub Actions. The issuer is https://token.actions.githubusercontent.com.
  3. Fill in Subject prefix and Branch. To find the prefix, run gh api repos/OWNER/REPO/actions/oidc/customization/sub --jq .sub_claim_prefix. The subject rule becomes PREFIX:ref:refs/heads/BRANCH.
  4. Select the scopes git and run.
  5. Keep Environment on live. Run has no test mode, and it refuses a token of a test trust.

The production job sets a GitHub environment. So its subject names the environment, not the branch: change the subject rule to repo:acme@1234/agents@5678:environment:production. Without an environment, a release job has the subject of its tag (repo:acme@1234/agents@5678:ref:refs/tags/v1.2.0), which changes with each release.

Do these steps before you add a trust with an environment subject:

  1. In GitHub, open Settings, then Environments, then the production environment.
  2. Add Required reviewers. Or set Deployment branches and tags to Selected branches and tags, and add a tag rule, for example v*. A release job runs on its tag, so a branch rule refuses it.
  3. In Claim conditions of the trust, add the claim event_name with the value release. Then a job of another event gets no token.

A person with write access can create a tag and publish a release. So only required reviewers stop that person. GitHub plans limit these rules for private repositories.

The action asks GitHub for an ID token with the audience https://{org}.cloudraker.run. It sends the ID token to https://{org}.cloudraker.run/v2/oauth/token, and Run gives a crt_ token if a trust matches. By default, this token stops working after 15 minutes. The action masks both tokens in the log and uses the crt_ token for the push.

To stop the deploys of a job, delete its trust in Dash. This also stops the tokens that it gave.

Secrets and connectors

The tree names secrets and connectors. It never holds their values. Give each project the values and the grants of its own environment.

Secrets

Set the value of a secret on each project with --repo:

rakerun secret set LINEAR_TOKEN --repo acme-agents-dev       # the CLI asks for the value
rakerun secret set LINEAR_TOKEN --repo acme-agents-staging
rakerun secret set LINEAR_TOKEN --repo acme-agents

A run uses the first value that it finds, in this order:

  1. The secrets of the run request, for a secret with overridable: true.
  2. The value of the agent in the project (--repo and --agent).
  3. The value of the project (--repo).
  4. The value of the org (no --repo). It applies to each project that has no value of its own.

Read Secrets and network.

Connectors

A connector belongs to the org. Grant it to each project that uses it:

rakerun connector grant linear --repo acme-agents-dev
rakerun connector grant linear --repo acme-agents

A grant on the org covers every project. To keep a connector out of an environment, grant it to the projects, not to the org.

The organization account of a connector is the same in every project. To use a different account in each environment, do one of these:

  • Use a connector with Header from a secret auth. The secret resolves with the scope of the run, so each project can hold its own key.
  • Put production in another org, with its own connectors.

The account of each person (“Each person’s own account”) belongs to that person. It works in every project that has the grant. Read Connectors.

Token scopes

Step Token scope
rakerun repo create admin
rakerun env add (it finds the project) read
rakerun env list (it reads the live commit) read
rakerun push and git push git
The CloudRaker/run-deploy action (the trust) git, run
rakerun secret set secrets
rakerun connector grant admin

The token of rakerun login has every scope of the org. In GitHub Actions, the action needs no key: a trust gives its scopes. In another CI system, create one live key for each environment, with the git scope only, on the API keys page of Dash. Copy each value and store it in the secrets of the CI system, because Dash shows it once.

A token opens every project of its org. So a key or a GitHub job that a trust accepts for development can also push to the production project of the same org. With one key or one trust for each environment, you can revoke one and keep the others. For a strict boundary, put production in another org.

Previews in each environment

A push to a branch other than the default branch deploys a preview of that project only. The preview host is https://{branch}--{org}.cloudraker.run, and the base path selects the project:

https://try-it--acme.cloudraker.run/acme-agents-dev/triage

A preview runs with the records, the secrets and the connector grants of its project. So a preview of the production project reads and changes production records. Test a change in the development project first. To call a preview, a token needs the preview scope. Read Protection and previews.

Force a push

By default, rakerun push and the action do not force a push. So git refuses the push when the project branch has commits that your commit does not have. This occurs in these cases:

  • A publisher made a Draft live in the console.
  • Another clone or another workflow pushed to the project.
  • You changed the history of your branch.

The refused push changes nothing. rakerun push tells you what to do:

acme-agents-dev has commits that your branch does not have (for example a Draft merged in the console). Get them first: git pull dev main. To replace them, push with --force.

To keep those commits, merge them into your branch. Then push again:

git pull dev main
rakerun push dev

To replace those commits, force the push: rakerun push dev --force, or force: true in the action. A forced push removes the commits that only the project had. Force a push only when your origin is the only source of the project.

If it fails

You see Do this
No project acme-agents-dev at acme.cloudraker.run. Create the project: rakerun repo create acme-agents-dev. Or check the org of the profile: rakerun whoami.
The remote dev exists Use another name, or change the remote: git remote set-url dev <url>.
rakerun is not on your PATH, or a git credential error Install the CLI: npm install -g rakerun.
A lint issue and exit code 1 Fix the file and the line that the issue names. Commit, then push again.
has commits that your branch does not have Read Force a push.
This clone is shallow. Run git fetch --unshallow. In GitHub Actions, set fetch-depth: 0.
dev: no token for acme.cloudraker.run. Sign in to that host: rakerun login --base-url https://acme.cloudraker.run.
rakerun has no token for acme-prod.cloudraker.run. Sign in to that org with its own profile: rakerun login --org acme-prod --profile prod. In CI, set CRR_BASE_URL and CRR_TOKEN for that host.
HEAD is detached. Name the branch: rakerun push dev --branch main.
acme-agents-dev has no branch yet. The first branch of a project goes live. Make this commit live: rakerun push dev --branch main. Then push your branch again: it gets a preview.
The working tree has changes that are not committed. The push sends the last commit only. Commit the changes, then push again.
GitHub gives no ID token to this job. Add id-token: write to the permissions of the job or of the workflow.
Run found no trust for this job Add a trust with the subject of the job and the scopes git and run. Or check the subject rule of the trust.

Type to search…

↑↓ navigate↵ selectEsc close