Quick start
Get a local instance running, send a request, then sign in to manage it. Docker
and Cargo below use http://localhost:8080. The Compose file uses port 80.
No AI provider key is needed for the built-in mocks.
Choose a setup
| Use | You need | Start here |
|---|---|---|
| A local container | Docker | Docker |
| The repository's multi-instance setup | Docker Compose and a checkout | Docker Compose |
| A native server and CLI | Rust 1.88+ and a checkout | Cargo |
| A hosted demo | Fly CLI and an account | Fly.io |
Docker
Start the published image:
docker run -d --name rustybin \
-p 8080:80 -p 8443:443 -p 50051:50051 \
ghcr.io/coldbathcode/rustybin:latest
Check that it is ready:
curl -i http://localhost:8080/_rustybin/ready
Expect 200 OK. Then send your first requests or open the
console. If it does not answer, run
docker logs rustybin and see connection troubleshooting.
Image tags, signature verification and building from source
latest and edge follow the main branch, a release vX.Y.Z also publishes X.Y.Z, X.Y
and X, and every build publishes sha-<commit>; the image is multi-arch (amd64 and
arm64) and every push is signed with cosign, keyless, by the publishing workflow's GitHub
identity, so you can check what you pull:
cosign verify ghcr.io/coldbathcode/rustybin:latest \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp '^https://github.com/coldbathcode/rustybin/'
A second image carries the suffix -http3 on every tag (latest-http3, X.Y.Z-http3): the
same build with the cargo feature harness-http3, for load tests of an HTTP/3
gateway. It is signed the same way and verified with the same
command and its own tag. The default image has no QUIC stack.
Or build it yourself:
git clone https://github.com/coldbathcode/rustybin && cd rustybin
docker build -t rustybin .
docker run -d --name rustybin -p 8080:80 -p 8443:443 -p 50051:50051 rustybin
The container listens on 80 (HTTP), 443 (HTTPS) and 50051 (gRPC) and runs as an
unprivileged user (uid 10001). On first start it generates a demo PKI in /app/certs
(a CA, the HTTPS server certificate and a client certificate for mTLS demos); mount
a volume on /app/certs to keep it across restarts (a bind-mounted host directory
must be writable by uid 10001). The image also runs with --read-only when
/app/certs is a volume, see Containers.
To keep settings, secrets and created mocks across restarts, also set
RUSTYBIN_STATE_DIR and mount a state volume; see
persistence.
Settings are environment variables, see Configuration. For example, on an alternative port if the first container is still running:
docker run -d -p 8081:80 -e RUSTYBIN_INSTANCE_ID=demo-1 \
-e RUSTYBIN_ADMIN_TOKEN=change-me-to-a-long-random-value \
ghcr.io/coldbathcode/rustybin:latest
An admin token shorter than 24 characters works but warns at startup.
First requests
These use the built-in services on a default instance. No console token or real
LLM key is needed. The fault example deliberately returns 503.
See what arrived
Send a custom header and query parameter:
curl -s 'http://localhost:8080/anything/hello?demo=1' -H 'X-Demo: rustybin'
Expect a JSON echo with path set to /anything/hello and your x-demo header.
Call the mock LLM
Send an OpenAI-format chat request. Any model name works:
curl -s http://localhost:8080/ai/openai/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"hello"}]}'
Expect choices[0].message.content to start with Hello! I'm Rustybin.
This is a simulated response, with no upstream AI call.
Try a mock API
The Petstore sample is already deployed:
curl -s http://localhost:8080/mock/petstore/v1/pets/42
Expect a pet with id equal to 42. To create your own, open Mock APIs in the
console or follow OpenAPI mocks.
Try MCP, A2A, fault injection and OAuth
# MCP: start a session (2025-06-18 handshake)
curl -si http://localhost:8080/mcp -H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
# A2A: the default agent card
curl -s http://localhost:8080/.well-known/agent-card.json
# Chaos on any route
curl -si http://localhost:8080/echo -H 'X-Rustybin-Fail: 503'
# An access token from the built-in identity provider
curl -s http://localhost:8080/oauth/token \
-d grant_type=client_credentials -d client_id=rustybin -d client_secret=secret
The same requests as a tested Hurl file
GET {{base_url}}/_rustybin/ready
HTTP 200
GET {{base_url}}/anything/hello?demo=1
X-Demo: rustybin
HTTP 200
[Asserts]
jsonpath "$.path" == "/anything/hello"
jsonpath "$.headers['x-demo'][0]" == "rustybin"
POST {{base_url}}/ai/openai/v1/chat/completions
Content-Type: application/json
{"model": "gpt-4o", "messages": [{"role": "user", "content": "hello"}]}
HTTP 200
[Asserts]
jsonpath "$.choices[0].message.content" startsWith "Hello! I'm Rustybin"
GET {{base_url}}/mock/petstore/v1/pets/42
HTTP 200
[Asserts]
header "X-Rustybin-Mock-Operation" == "getPetById"
jsonpath "$.id" == 42
POST {{base_url}}/mcp
Accept: application/json, text/event-stream
Content-Type: application/json
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "curl", "version": "1"}}}
HTTP 200
[Asserts]
header "Mcp-Session-Id" exists
jsonpath "$.result.serverInfo.name" == "rustybin-mcp"
GET {{base_url}}/.well-known/agent-card.json
HTTP 200
[Asserts]
jsonpath "$.name" == "Echo Agent"
GET {{base_url}}/echo
X-Rustybin-Fail: 503
HTTP 503
POST {{base_url}}/oauth/token
[Form]
grant_type: client_credentials
client_id: rustybin
client_secret: secret
HTTP 200
[Asserts]
jsonpath "$.token_type" == "Bearer"
Then open http://localhost:8080/ for the endpoint list with runnable examples,
/docs for the interactive API reference and /ui for the
web console.
First sign-in
The web console at http://localhost:8080/ui and the control plane
(/_rustybin/*) ask for a user name and password: rustybin / rustybin. The
instance warns in its log and the console shows a banner until you change it under
Management, Sign-in (the current password is required; the new one is stored as
a hash, and every other session ends). Or set it before the first start:
docker run -d -p 8081:80 -e RUSTYBIN_CONSOLE_PASSWORD=change-me \
ghcr.io/coldbathcode/rustybin:latest
Scripts (with curl and jq installed) sign in the same way and get a token that opens everything, the management MCP server included:
TOKEN=$(curl -s http://localhost:8080/_rustybin/login -H 'Content-Type: application/json' \
-d '{"username":"rustybin","password":"rustybin"}' | jq -r .token)
curl -s http://localhost:8080/_rustybin/status -H "Authorization: Bearer $TOKEN"
RUSTYBIN_CONTROL_AUTH=open turns the control-plane sign-in off for a laptop or
lab. Ordinary echo, mock LLM and protocol routes work without console sign-in;
authentication demo routes, secured mocks and required API keys have their own
credential checks. Details:
Control-plane security.
Build and publish a mock
These five steps are optional. They use a local rustybin binary on your PATH
(see Cargo), a running instance and an Anthropic key in key.txt. For a
Docker-only setup, run CLI commands as docker exec -it rustybin rustybin ...;
inside the container the login URL is http://localhost:80, and file paths refer
to files inside the container. The console steps below need no local CLI.
The same binary is the command line (install it on the machine you run commands from). Build a mock with your own AI, publish it for testers and export it as code:
# 1. Sign in (rustybin / rustybin); the token lands in a profile.
rustybin login --url http://localhost:8080
# 2. Your own AI key (Anthropic here; openai, gemini or compatible work the same).
rustybin settings set assist.provider anthropic
rustybin settings set-secret assist.anthropic_key --stdin < key.txt
# 3. Describe the API; the spec is checked and deployed as the mock "orders".
rustybin mocks describe "an orders API with customers, orders and refunds" > orders.json
rustybin mocks create orders --spec orders.json
# 4. Publish it: testers open http://localhost:8080/portal, no password needed.
rustybin portal publish mock:orders --title "Orders"
# 5. The whole instance as code (secrets as references), ready for git.
rustybin config export > rustybin.yaml
The console does the same: Management, AI for the key, the mock wizard's
Describe it tab, Publish to portal on the mock, Management, Export; and
an agent does it through the management MCP server with the
build_instance prompt (connect your coding agent: Claude Code,
Codex CLI, Cursor, VS Code and others). Without an AI key, skip step 2 and replace step 3 with
rustybin mocks create orders --spec your-spec.yaml. To explore without any spec,
use the built-in Petstore mock and publish it with
rustybin portal publish mock:petstore --title "Petstore".
Docker Compose
docker-compose.yml builds the image, publishes ports 80, 443 and 50051 and keeps
the demo PKI in the named volume rustybin-certs so it survives restarts (download
the CA with curl -s http://localhost/auth/mtls/get-ca-cert | jq -r .ca_cert_pem > ca.crt):
docker compose up -d
curl http://localhost/health
The file also contains a commented-out block for two more instances
(rustybin-02, rustybin-03) with their own RUSTYBIN_INSTANCE_ID, for load
balancing demos (see Identity and load balancing).
Cargo
From a repository checkout with Rust 1.88 or newer, choose high ports for a normal user account:
RUSTYBIN_HTTP_PORT=8080 RUSTYBIN_HTTPS_PORT=8443 cargo run --release
The build also produces the CLI. To use the rustybin commands in these docs
from this checkout, add it to your current shell's PATH:
export PATH="$PWD/target/release:$PATH"
rustybin --version
cargo run writes the demo PKI to certs/ in the working directory (the default
RUSTYBIN_TLS_CERT is certs/server.crt); the files are git-ignored. Other flags:
cargo run -- --version # print the version
cargo run -- --print-endpoints-markdown # print the endpoint tables (from the route catalogue)
cargo run -- --config rustybin.yaml # run with OpenAPI mocks declared in a file
cargo run -- mock --help # the OpenAPI mock CLI
See OpenAPI mocks for rustybin.yaml, mounting specs into the
container and the rustybin mock commands.
Fly.io
fly.toml deploys the Dockerfile with the web surface behind Fly's edge TLS and the
gRPC port as raw TCP passthrough:
fly launch --copy-config --no-deploy # once: pick an app name and region
fly deploy
Things to know about the provided configuration:
RUSTYBIN_TRUST_FORWARD=true: Fly's proxy setsFly-Client-IPandX-Forwarded-*, so/ip,/echoand the OIDC issuer report the real client andhttpsscheme.- The HTTP health check targets
GET /_rustybin/ready(always 200 while serving), not/health, which is a demo toggle that can return 503. - The image runs as an unprivileged user, so the configuration moves the listeners
to ports 8080 (HTTP, Fly's
internal_port) and 8443 (HTTPS). - To serve gRPC through Fly's TLS edge on 443 instead of a raw port, set
RUSTYBIN_GRPC_ON_HTTP=trueand give the 443 service an HTTP/2 backend (see gRPC). - Because Fly terminates TLS for the web surface, Rustybin's own HTTPS listener and
mTLS on it are not reachable; use the
RUSTYBIN_MTLS_IN_HEADERmode for mTLS demos behind a gateway instead (see Authentication). - gRPC on port 50051 is plaintext h2c:
grpcurl -plaintext <app>.fly.dev:50051 list. - For a shared, internet-facing instance set
RUSTYBIN_PUBLIC_MODE=true(see Sessions, public mode and the admin token).