|
| 1 | +# Dev Deploy Workflow |
| 2 | + |
| 3 | +`Deploy Dev` is the operator entrypoint for deploying the SST dev stage and, |
| 4 | +optionally, rolling out a runner binary to the dev runner EC2 instances. |
| 5 | + |
| 6 | +## User Flow |
| 7 | + |
| 8 | +Open GitHub Actions, select `Deploy Dev`, then click `Run workflow`. |
| 9 | + |
| 10 | +The branch selector is the source checkout. Use `main` for normal dev deploys |
| 11 | +or a PR branch for dev validation. |
| 12 | + |
| 13 | +Inputs: |
| 14 | + |
| 15 | +| Input | Values | Meaning | |
| 16 | +| ------------- | --------------------------------------------------------- | ------------------------------------------- | |
| 17 | +| `deploy_mode` | `diff-only`, `deploy` | Preview SST changes or actually deploy dev. | |
| 18 | +| `runner_mode` | `skip`, `existing-release`, `temporary-build`, `rollback` | Runner rollout strategy. | |
| 19 | +| `runner_ref` | `0.9.5`, empty | Required only for `existing-release`. | |
| 20 | +| `confirm` | `dev` | Required safety confirmation. | |
| 21 | + |
| 22 | +Common runs: |
| 23 | + |
| 24 | +| Goal | Inputs | |
| 25 | +| ------------------------------------------------------ | ---------------------------------------------------------------------------- | |
| 26 | +| Preview dev infra/service changes | `deploy_mode=diff-only`, `runner_mode=skip` | |
| 27 | +| Deploy SST dev only | `deploy_mode=deploy`, `runner_mode=skip` | |
| 28 | +| Deploy dev and install a released runner | `deploy_mode=deploy`, `runner_mode=existing-release`, `runner_ref=<version>` | |
| 29 | +| Deploy dev and test the selected branch's runner | `deploy_mode=deploy`, `runner_mode=temporary-build` | |
| 30 | +| Roll back dev runner to the previous recorded artifact | `deploy_mode=deploy`, `runner_mode=rollback` | |
| 31 | + |
| 32 | +`diff-only` never rolls out a runner. |
| 33 | + |
| 34 | +## Runner Artifact Model |
| 35 | + |
| 36 | +There are three artifact classes: |
| 37 | + |
| 38 | +| Class | Storage | Lifetime | Intended use | |
| 39 | +| ------------------- | ------------------------------ | -------------------------------------- | -------------------------------------------------------- | |
| 40 | +| Official release | GitHub Release asset | Long-lived | Stage/prod and durable rollbacks. | |
| 41 | +| Temporary dev build | Dev deploy-artifacts S3 bucket | Short-lived, default lifecycle 30 days | Dev-only branch validation without publishing a release. | |
| 42 | +| Rollout manifest | Dev deploy-artifacts S3 bucket | Long-lived | Current/previous runner deployment record. | |
| 43 | + |
| 44 | +Temporary builds are versioned as: |
| 45 | + |
| 46 | +```text |
| 47 | +<Cargo.toml version>-dev.<commit-sha> |
| 48 | +``` |
| 49 | + |
| 50 | +Dirty local worktree builds get a `-dirty` suffix. The GitHub Action normally |
| 51 | +checks out a clean commit, so dev deploys from Actions should not be dirty. |
| 52 | + |
| 53 | +## What The Workflow Does |
| 54 | + |
| 55 | +1. Checks out the selected branch. |
| 56 | +2. Confirms `confirm=dev`. |
| 57 | +3. Assumes the dev AWS deploy role. |
| 58 | +4. Runs `npx sst diff --stage dev`. |
| 59 | +5. Runs `npx sst deploy --stage dev` when `deploy_mode=deploy`. |
| 60 | +6. Applies the selected runner mode: |
| 61 | + - `skip`: no runner changes. |
| 62 | + - `existing-release`: checks the GitHub Release asset and installs it. |
| 63 | + - `temporary-build`: builds C SDK + daemon + computer-use + runner from the |
| 64 | + selected commit, uploads the tarball to S3, presigns it, and installs it. |
| 65 | + - `rollback`: reads the previous runner manifest and reinstalls that source. |
| 66 | +7. Verifies public API health. |
| 67 | +8. If `DEV_ADMIN_API_KEY` is configured, verifies the Admin runner overview. |
| 68 | + |
| 69 | +Runner rollout uses AWS SSM Run Command. It does not SSH into instances and does |
| 70 | +not replace EC2 instances. The runner service is stopped, the binary is replaced, |
| 71 | +and the service is started again. `/var/lib/boxlite` is untouched. |
| 72 | + |
| 73 | +## Required GitHub Configuration |
| 74 | + |
| 75 | +Create a GitHub Environment named `dev`. |
| 76 | + |
| 77 | +Required variables: |
| 78 | + |
| 79 | +| Name | Purpose | |
| 80 | +| ------------------------------- | ----------------------------------------- | |
| 81 | +| `BOXLITE_DEV_DEPLOY_ROLE_ARN` | AWS IAM role assumed by the workflow. | |
| 82 | +| `DEV_STACK_DOMAIN` | Dev domain, for example `dev.boxlite.ai`. | |
| 83 | +| `CLOUDFLARE_DEFAULT_ACCOUNT_ID` | Cloudflare account for SST DNS. | |
| 84 | +| `DEV_OIDC_ISSUER_BASE_URL` | OIDC issuer URL required by the API. | |
| 85 | + |
| 86 | +Required secrets: |
| 87 | + |
| 88 | +| Name | Purpose | |
| 89 | +| ---------------------- | --------------------------------------- | |
| 90 | +| `CLOUDFLARE_API_TOKEN` | Lets SST manage Cloudflare DNS records. | |
| 91 | + |
| 92 | +Optional variables/secrets: |
| 93 | + |
| 94 | +| Name | Purpose | |
| 95 | +| ----------------------------------- | ---------------------------------------------------- | |
| 96 | +| `DEV_RUNNER_ARTIFACT_BUCKET` | Override the default deploy-artifacts bucket name. | |
| 97 | +| `DEV_RUNNER_MANIFEST_PREFIX` | Override the manifest prefix, default `deployments`. | |
| 98 | +| `DEV_ADMIN_API_KEY` | Enables Admin runner overview verification. | |
| 99 | +| `GHCR_USERNAME`, `GHCR_TOKEN` | Runner image pull credentials when needed. | |
| 100 | +| `DEV_POSTHOG_*`, `DEV_CLICKHOUSE_*` | Optional runtime integrations. | |
| 101 | + |
| 102 | +The default artifact bucket name is: |
| 103 | + |
| 104 | +```text |
| 105 | +boxlite-dev-deploy-artifacts-<aws-account-id>-ap-southeast-1 |
| 106 | +``` |
| 107 | + |
| 108 | +SST creates this bucket as part of the dev stack. Temporary runner artifacts are |
| 109 | +stored under `runner-temp/`; rollout manifests are stored under |
| 110 | +`deployments/dev/runner/`. |
| 111 | + |
| 112 | +## Local Fallback |
| 113 | + |
| 114 | +The same flow can run from a Linux deploy host: |
| 115 | + |
| 116 | +```bash |
| 117 | +scripts/deploy/dev-full.sh \ |
| 118 | + --deploy-mode deploy \ |
| 119 | + --runner-mode skip \ |
| 120 | + --stage dev \ |
| 121 | + --confirm dev |
| 122 | +``` |
| 123 | + |
| 124 | +Use GitHub Actions for `temporary-build`. Local temporary builds require Linux |
| 125 | +amd64 because the runner uses CGO. |
| 126 | + |
| 127 | +## Safety Boundaries |
| 128 | + |
| 129 | +- This workflow only supports `stage=dev`. |
| 130 | +- Runner rollout requires `deploy_mode=deploy`. |
| 131 | +- Runner EC2 discovery requires SST-managed tags: |
| 132 | + `App=boxlite`, `Stage=dev`, `Role=runner`. |
| 133 | +- Production deploys need a separate workflow with approval and canary rules. |
0 commit comments