RemoteMux environments are durable cloud VMs. CI runners can create ephemeral workspaces inside them to run tests, then clean up. The environment stays warm between runs, so Docker images, build caches, and databases are already there.Documentation Index
Fetch the complete documentation index at: https://docs.remotemux.com/llms.txt
Use this file to discover all available pages before exploring further.
CI never creates or destroys environments. A developer provisions the
environment once. CI only creates and removes workspaces.
Why Use RemoteMux for CI
RemoteMux workspaces skip the setup tax that ephemeral CI runners pay on every run:| Step | GitHub runner | RemoteMux workspace |
|---|---|---|
| Checkout repo | ~15s | ~5s (git worktree) |
| Install dependencies | 60-120s (cold) | 10-20s (warm cache) |
| Start services (Docker Compose) | 120-300s (pull images) | 0s (already running) |
| DB migrations / seed | 30-60s | 0s (already done) |
| Total setup | 3-8 min | ~15-30s |
- Your project has a complex dev environment (Docker Compose stacks, databases, GPUs)
- Environment setup time dominates test execution time
- You need VPC access or internal services that runners can’t reach
- You want dev/CI parity (tests run in the same environment developers use)
Setup
Create a CI token
Create a service token for the CI runner. This only needs to happen once.Prefer a project-scoped token for CI so the runner can only access the one hosted project it needs. Use
--org-id <organization-id> if you need to target an organization other than your active default.Copy the token value for the next step.Add GitHub secrets
In your repo settings, add two secrets:
The environment must already be provisioned and in
| Secret | Value |
|---|---|
RMUX_CI_TOKEN | The token from step 1 |
RMUX_ENVIRONMENT | Environment name (e.g. my-project) or ID (e.g. env_abc123) |
ready state.Make config available to the runner
The runner still needs RemoteMux config so the CLI can resolve the backend and control plane URL.Choose one:
-
Commit a minimal
./.rmux.tomlto the repository: -
Or set these workflow environment variables:
RMUX_ENVIRONMENT tells the runner which environment to target, but it does not replace backend or API base URL config.Example Workflow
.github/workflows/test.yml
workspace new creates a git worktree on the remote environment. Multiple
PRs can run concurrently since each workspace is isolated at the filesystem
level.
If your repository already includes a minimal .rmux.toml with backend and
apiBaseUrl, you can omit RMUX_BACKEND and RMUX_API_BASE_URL from the
workflow env block.
Config Resolution In CI
RemoteMux resolves config separately from environment targeting:RMUX_BACKENDor./.rmux.tomlselects the backendRMUX_API_BASE_URLor./.rmux.tomlselects the control plane URLRMUX_API_KEYauthenticates the runnerRMUX_ENVIRONMENTselects the target environment
.rmux.toml, set all four in the
job environment.
Environment Resolution
Workspace commands resolve the target environment in this order:--envflag (explicit override)RMUX_ENVIRONMENTenv var.rmux/state.jsondirectory binding (local dev)
RMUX_ENVIRONMENT once in the
workflow env block and all workspace commands pick it up.
You can also override per-command:
env_*) are accepted.
Token Scope
Service tokens are scoped to the hosted organization and, optionally, a hosted project.- Project-scoped tokens are the safest default for CI.
- Organization-scoped tokens are useful when one workflow needs to operate across multiple hosted projects in the same organization.
- CI workspace commands still target a concrete environment through
RMUX_ENVIRONMENT; token scope controls what the runner is allowed to see.
Cleaning Up Stale Workspaces
If a CI runner is killed or GitHub has an outage, the cleanup step may not run. Useworkspace prune to remove orphaned workspaces.
Manual prune
Scheduled prune
Add a cron workflow to your repository:.github/workflows/prune.yml
Prune options
| Option | Description |
|---|---|
--prefix <prefix> | Only prune workspaces whose name starts with this prefix |
--stale <duration> | Only prune workspaces idle longer than this duration (30s, 5m, 2h, 1d) |
--dry-run | List candidates without deleting |
-f, --force | Skip the confirmation prompt (required in non-TTY / CI) |
Concurrency
Multiple CI workspaces share a single VM. They are isolated at the filesystem level (separate git worktrees) but share CPU, memory, disk, and the Docker daemon. Shared resources can be an advantage: Docker layer caches,node_modules
caches, and pre-started services are available to all workspaces without
redundant setup.
If concurrent CI runs overwhelm the VM, size the environment appropriately or
use GitHub Actions concurrency groups to limit parallel runs.