Relay BYO deployment example

This walkthrough self-hosts ArcFlow Relay beside your own arcflow-server using Docker Compose. Browser clients use site tokens and Origin checks identical to managed Relay.

Primary example: Relay BYO deployment walkthrough.

What this example demonstrates

Bring-your-own (BYO) Relay lets operators run the browser proxy in their VPC while upstream execution stays on arcflow-server. Site configuration (allowed origins, rate limits, upstream runtime keys) loads from ARCFLOW_RELAY_SITES_JSON.

Prerequisites

ItemRequired
arcflow-server reachableDefault http://localhost:8080
Docker Compose v2For compose.yml in example dir
Published workflowe.g. chat workflow on server
FrontendStatic app with Relay env vars
Tutorial trackTrack F (Relay section)

Step 1: Start upstream server

From repository root:

bash
docker compose -f docker/docker-compose.server.yml up -d
curl -sf http://localhost:8080/ready

Step 2: Configure Relay sites JSON

Export upstream URL and site definition (from README.md):

bash
export ARCFLOW_UPSTREAM_URL=http://host.docker.internal:8080
export ARCFLOW_RELAY_SITES_JSON='[{
 "id": "s_dev",
 "display_name": "Dev",
 "allowed_origins": ["http://localhost:5173"],
 "rate_limit_rpm": 60,
 "allow_inline": false,
 "default_workflow_name": "chat",
 "kb_namespace": "site-s_dev-kb",
 "upstream_runtime_key": "dev-secret",
 "token": "st_live_devtoken"
}]'

On Linux Docker, replace host.docker.internal with the host gateway IP if needed.

Step 3: Start BYO Relay

bash
cd examples/relay/byo-docker
docker compose -f compose.yml up --build

Verify health:

bash
curl -sf http://localhost:8090/health

Step 4: Point static frontend at BYO Relay

bash
VITE_ARCFLOW_RELAY_URL=http://localhost:8090/v1/sites/s_dev
VITE_ARCFLOW_SITE_TOKEN=st_live_devtoken

Run Static chat widget walkthrough or your own static bundle against port 8090.

Relay routes

MethodPathPurpose
GET/healthLiveness
POST/v1/sites/{site_id}/runsCreate run
GET/v1/sites/{site_id}/runs/{run_id}Poll status
GET/v1/sites/{site_id}/runs/{run_id}/traceFetch trace

Auth: Authorization: Bearer {site_token} plus allowed Origin header on browser requests.

Expected output

Health endpoint returns 200. Browser chat through Relay creates runs on upstream server with site-scoped runtime key. Rate limiting applies per rate_limit_rpm when configured.

Pass criteria:

CheckExpected
/health200
POST run from allowed origin201 with run_id
POST from disallowed originRejected at Relay
Upstream receives runVisible in server logs or GET /v1/runs with server key

Trace events you should see

Retrieve via Relay trace route or server admin tools. Expect standard workflow lifecycle events on published workflow runs (WorkflowStarted, StepCompleted, WorkflowCompleted, optional MemoryRetrieved for RAG sites).

Troubleshooting

SymptomLikely causeFix
Relay cannot reach upstreamWrong ARCFLOW_UPSTREAM_URL from containerUse host gateway or shared Docker network
401 from upstreamupstream_runtime_key mismatchMatch ARCFLOW_SERVER_API_KEY on server
403 OriginBrowser origin not in JSONAdd exact origin string to allowed_origins
Inline workflow rejectedallow_inline: falsePublish workflow on server; use runPublished
ResourceLink
Static chat widgetstatic-chat-widget.md
Static examples indexStatic chat widget walkthrough
Tutorial trackTrack F