Basecamp Sherpa
AppsWorker

Production

Deploy the Worker to Railway.

Railway service

  1. Add a service → Docker Image → ghcr.io/yannickarmspach/sherpa-worker:latest
  2. Add ghcr.io registry credentials (GitHub username + PAT with read:packages)

See Deploy for the build & push workflow.

Environment variables

SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJ...

RAILWAY_TOKEN=<railway api token>

CONSOLE_CALLBACK_URL=https://your-console-domain.com/api/webhooks/instance-status
WORKER_SECRET=<same secret as console>

DOCKER_IMAGE=ghcr.io/yannickarmspach/sherpa-agent:latest
POLL_INTERVAL_MS=5000

The worker polls the provision_jobs table every 5 seconds. When it finds a pending job, it:

  1. Calls the Railway GraphQL API to create or destroy a service
  2. Updates the job status in Supabase
  3. POSTs the result to the Console callback URL

Monitoring

Health checks

GET /health returns "ok".

Check the Railway service status.

Monitor the provision_jobs table for stuck jobs (status = 'processing' for too long).

Job queue health

Query the provision_jobs table to monitor the queue:

-- Pending jobs (should be picked up within 5s)
SELECT * FROM provision_jobs WHERE status = 'pending';

-- Failed jobs (investigate error column)
SELECT * FROM provision_jobs WHERE status = 'failed' ORDER BY created_at DESC;

-- Stuck jobs (processing for more than 5 minutes)
SELECT * FROM provision_jobs
WHERE status = 'processing'
AND updated_at < now() - interval '5 minutes';