Synq
Skip to content
[ synq / docs ]Synq home

CI and deploy

What GitHub Actions checks on every push and how main reaches the production host.

CI (.github/workflows/verify.yml)#

The verify workflow runs on every push (except to deploy) and every pull request. Third-party actions are pinned by commit SHA, Node is pinned (22.23.1) and the repository is checked out without persisted credentials.

JobSteps
typescriptcorepack pnpm install --frozen-lockfile; Prettier check; ESLint; strict typecheck (API and web); dependency boundaries (architecture); whole-tree secret scan; schema compatibility; plugin contract tests; rejection of demo identities in shipped runtime; unit tests with machine-readable results; build; Envio indexer codegen and typecheck. Test results are kept as an artifact
sastCodeQL for JavaScript and TypeScript with the security-extended queries; any error-level finding fails the job. Results stay inside the job
contractsforge fmt --check, forge build, forge test with Foundry pinned
integration (needs typescript and contracts)Preflight, forge build, a pinned Temporal CLI with a verified checksum, corepack pnpm infra:up (Postgres 17 and Redis from infra/compose.yaml), then corepack pnpm test:integration against Anvil, Postgres and Redis
promote (main only, needs all jobs above)Fast-forwards the deploy branch to the green commit

Locally the same gates are corepack pnpm verify (preflight, typecheck, lint, secrets, format check, build, unit tests, contract tests, integration tests).

Deploy model#

Continuous delivery is pull-based: the host builds the commit CI has already verified. The host is too small to run the app and build it at the same time, so the site is down for the length of a build (roughly 10 to 15 minutes).

 push to main
     |
     v
 GitHub Actions: typescript, sast, contracts, integration  (all green)
     |
     v
 promote job: fast-forward `deploy` branch
     |
     v   host polls `deploy` every 2 minutes (systemd timer)
 host-deploy.sh:
   1. fetch `deploy` with a read-only deploy key; stop if it has not moved
   2. refresh runtime config and key files from the cloud secret store
   3. stop the bot and web (Caddy and Postgres keep running)
   4. build the bot image, then the web image, one at a time
      (a failed build restarts the previous images and stops)
   5. docker compose up -d --wait   (health-gated restart)
   6. prune old images and cap the build cache
   7. record the deployed commit

The host#

infra/aws/synq.cfn.yaml defines one small Graviton EC2 instance in a CloudFormation stack: an instance profile that can read only its own parameters from the secret store, an Elastic IP, a gp3 root volume, and a security group that allows only HTTP and HTTPS. There is no SSH; operators use the cloud's session manager. The stack, runtime config, deploy key, bootstrap, status, logs and an operator console are driven by scripts/deploy/aws.sh from an operator's machine. Values are never printed.

The stack (infra/compose.aws.yaml)#

ServiceImageRole
caddyCaddy 2.10TLS termination for synqlabs.world, its www redirect and its api host, with HSTS and security headers
webBuilt from infra/docker/web.DockerfileNext.js on port 3100, read-only filesystem. Its /api/v1, /v2 and /v3 rewrites target the bot. The API origin is a build argument because Next.js fixes rewrites at build time
botBuilt from infra/docker/bot.DockerfileThe apps/demo/src/telegram.ts service: embedded API on port 3292, Telegram, workspaces, Kernel, execution wiring
postgresPostgres 17.6, digest-pinnedApplication database on a named volume, tuned for a small host

All containers run with no-new-privileges, capped log size and memory limits. Secrets are mounted read-only from a host directory that the deploy script fills from the secret store; the bot runs as a non-root user with state and evidence on volumes.

Other images and a self-contained stack#

infra/docker/api.Dockerfile (the /v1 API) and worker.Dockerfile (the Temporal workflow worker) are not part of the single-host deployment but are used by infra/compose.prod.yaml, a deploy-ready full stack with API, web, workflow worker, Postgres, Redis and a single-node Temporal that builds its own images (corepack pnpm stack:prod:up). It publishes only the web app, on loopback. See Self-hosting.

What does not change at deploy time#

  • Contracts: they are deployed deliberately with Foundry scripts and recorded in the chain registry, never by the host.
  • Keys: created and stored by the operator in the secret store, never baked into images or the repository. The secret scanner checks the whole tree in CI.
  • Mainnet: the broadcast lock stays on.

Edit this page on GitHub