Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/staging.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Merging to `main` deploys to production, so staging is where a change is tested
2. Use the changed behavior on `app.staging.tin.computer` with a staging test project.
3. Write what you did and saw under **Tested on staging** in the pull request.

A change to the deploy scripts themselves (`infra/`) cannot be tried this way, because
deploy-staging always runs `main`'s scripts. Run the branch's `infra/deploy.sh` with
`TIN_LITE_DEPLOY_TARGET=staging` from a workstation, and a maintainer sets the `staging`
status by hand.

Deploying marks that exact commit with the `staging` status that `main` requires. A new
push resets it. Changes that cannot reach the running service (docs, tests, evals,
Markdown) pass without a deploy. Staging has one slot: whoever deployed last owns it until
Expand Down
11 changes: 9 additions & 2 deletions infra/activate_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,15 @@ rm -f "${upload_dir}/tin-lite-release.tar.gz" "${upload_dir}/tin-lite.env"
# startup line and the restart counter. A failure stops here and is reported; nothing is
# rolled back automatically, because a release may have changed the catalog for good.
deadline=$((SECONDS + ${TIN_LITE_STARTUP_TIMEOUT:-420}))
until journalctl -u tin-lite-switchboard --since "${restarted_at}" --no-pager -q |
grep -q "Application startup complete"; do
# grep -c reads the whole journal: grep -q would stop early, journalctl would get SIGPIPE,
# and pipefail would turn a found line into a failure.
started() {
local count
count="$(journalctl -u tin-lite-switchboard --since "${restarted_at}" --no-pager -q |
grep -c "Application startup complete" || true)"
(( count > 0 ))
}
until started; do
if [[ "$(systemctl show -p NRestarts --value tin-lite-switchboard)" != "${restarts_before}" ]]; then
echo "the new release is restarting; it did not start cleanly (previous: ${previous})" >&2
journalctl -u tin-lite-switchboard --since "${restarted_at}" --no-pager -q | tail -n 40 >&2
Expand Down
Loading