AppsWorker
Production
Deploy the Worker to Railway.
Railway service
- Add a service → Docker Image →
ghcr.io/yannickarmspach/sherpa-worker:latest - 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=5000The worker polls the provision_jobs table every 5 seconds. When it finds a pending job, it:
- Calls the Railway GraphQL API to create or destroy a service
- Updates the job status in Supabase
- 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';