Files
ci/orchestrator
ozan 5f676dfb6b feat: switch orchestrator from Fargate to EC2 Spot
Dispatcher now launches Spot instances instead of Fargate tasks:
- t3.small for go/node builds ($0.005/hr)
- t3.medium for docker/godot builds ($0.01/hr)
- t3.micro for deploy jobs ($0.004/hr)

Instances self-terminate via user-data trap on exit.
Cancel: ec2:TerminateInstances instead of ecs:StopTask.
Cleanup cron also sweeps orphan instances by tinqs-ci tag.

Pre-baked AMI with act_runner + tools = instant boot, no install.
2026-05-22 19:24:33 +01:00
..

tinqs/ci orchestrator

Lambda-based CI dispatcher for Tinqs Studio. Receives Gitea webhooks and routes jobs to the right execution environment.

Architecture

Gitea push webhook
       │
       ▼
  API Gateway POST /webhook
       │
       ▼
  ci-dispatch Lambda
       │
       ├── runs-on: go/node/docker/godot
       │     → Start Fargate task with matching image
       │     → Track in DynamoDB for cancel
       │
       ├── runs-on: deploy
       │     → Invoke ci-exec Lambda directly
       │
       └── runs-on: host
             → Skip (handled by registered runner)

Deploy

Requires: AWS SAM CLI, AWS credentials, Gitea token.

# First time (interactive)
GITEA_TOKEN=xxx make deploy-guided

# Subsequent deploys
GITEA_TOKEN=xxx SUBNETS=subnet-abc,subnet-def SECURITY_GROUP=sg-xxx make deploy

After deploy, configure the webhook URL as a Gitea system webhook:

  • URL: https://<api-id>.execute-api.eu-west-1.amazonaws.com/prod/webhook
  • Method: POST
  • Content type: application/json
  • Events: Push, Workflow Job (for cancel)

Cancel support

When a user cancels a job in the Gitea UI, the workflow_job webhook fires with action: cancelled. The dispatcher looks up the Fargate task ARN in DynamoDB and calls ecs:StopTask.

A cleanup cron (every 5 min) also kills Fargate tasks that have been running longer than 30 minutes.

Local testing

make build
make test-local  # requires SAM CLI + Docker