Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

3.9 KB
Raw Blame

Switch Console BYOI Testing Kit

A copy-pasteable setup for testing Switch Console's BYOI (Bring Your Own Infrastructure) feature. Each task gets its own Docker container running a full Linux dev environment with Node.js, git, and Claude Code pre-installed.

How it works

  1. When you create a task, Switch Console runs provision.sh
  2. The script builds a Docker image (first run only), starts a new container, clones your repo into it, and prints a JSON object to stdout
  3. Switch Console SSH-connects to the container using password auth and opens the workspace at /home/devuser/workspace
  4. When you terminate the task, Switch Console runs terminate.sh which stops and removes the container

Prerequisites

  • Docker running on your machine
  • jq for JSON output — install with brew install jq on macOS

Setup

Copy these files into the root of the repo you want to test with:

Dockerfile
entrypoint.sh
scripts/
  provision.sh
  terminate.sh
switchdash.json.example  →  rename to .switchdash.json

Make the scripts executable:

chmod +x scripts/provision.sh scripts/terminate.sh

Add the project in Switch Console, then create a task. That's it.

First provision

The first provision builds the Docker image (2-3 minutes, one-time). Subsequent provisions start a new container and clone the repo (10-20 seconds).

Provision output

The provision script must print only one JSON object to stdout. Send logs and progress messages to stderr.

This sample prints:

Field Value Notes
id Docker container name Passed to terminate.sh as REMOTE_WORKSPACE_ID
host localhost Host Switch Console connects to
port Random Docker host port for 22 Must be a JSON number
username devuser SSH username
password devpass SSH password
worktreePath /home/devuser/workspace Repository path inside the container
forwardAgent false JSON boolean; set the script constant to "true" to enable it

Forwarding API keys

The provision script forwards API keys from your host environment into the container automatically. Just make sure the relevant variables are set in your shell before Switch Console runs the provision script:

export ANTHROPIC_API_KEY=sk-ant-...
export GH_TOKEN=ghp_...

To add more keys, edit the docker run call in scripts/provision.sh and the AGENT_VARS list in entrypoint.sh.

Container credentials

  • Username: devuser
  • Password: devpass
  • Workspace path: /home/devuser/workspace

Change the password in Dockerfile (devuser:devpass) and scripts/provision.sh (CONTAINER_PASS) if needed.

SSH agent forwarding

This sample sets "forwardAgent" from the FORWARD_AGENT script constant. It defaults to "false".

Change FORWARD_AGENT to "true" if Git commit signing or nested SSH/Git commands need your local SSH agent inside the container. Only enable forwarding for BYOI hosts you trust.

Cleanup

Containers are removed automatically when a task is terminated. To manually clean up any leftover containers:

docker ps --filter label=switch-console.purpose=byoi-workspace
docker rm -f $(docker ps -aq --filter label=switch-console.purpose=byoi-workspace)

To remove the cached Docker image and force a rebuild on the next provision:

docker rmi switch-console-byoi-workspace