Upgrading
Upgrades replace the code and keep your data and configuration. Database migrations are applied automatically when the new version starts, so there is no separate migration step.
How migrations work#
- Migrations are append-only and ship inside the kit. On start, ATS records which ones have run in a
_migrationstable and applies only the missing ones, in order. - Each migration and its bookkeeping row are applied in one batch, so a failure leaves no half-applied schema. If two instances race, the second sees the work already done.
- Node.js / Docker: they run at process start, before the port opens. If one fails, the process exits with the error.
- Cloudflare: they run on the first request of each Worker isolate.
- There are no down-migrations. To go back to an older version after a newer one has started, restore your backup.
Before every upgrade#
- Back up
Self-hosted: snapshot
ats.dbwith SQLite's.backupand copyfiles/(see Docker or Node.js). Cloudflare: export D1 (npx wrangler d1 export ats --remote --output ats-backup.sql). - Download and verify the new kit
curl -LO https://ats.goosenotes.dev/downloads/0.1.0/ats-0.1.0.tar.gz curl -LO https://ats.goosenotes.dev/downloads/0.1.0/SHA256SUMS grep ' ats-0.1.0.tar.gz$' SHA256SUMS | shasum -a 256 -c tar -xzf ats-0.1.0.tar.gz - Read the new kit's
.env.exampleorwrangler.tomlCompare them with what you run, in case a release adds a setting you want.
Docker#
- Build the new image from the new kit
cd ats-0.1.0 docker build -f apps/node/Dockerfile -t ats:0.1.0 -t ats:latest . - Recreate the container
cd ~/ats-deploy docker compose up -d docker compose logs -f ats # watch it start and apply migrationsThe
ats-datavolume, your.envandCaddyfileare untouched. To roll back, retag the previous image asats:latestand restore the backup taken before the upgrade.
Node.js#
- Unpack next to the current version and install
sudo tar -xzf ats-0.1.0.tar.gz -C /opt/ats cd /opt/ats/ats-0.1.0 sudo npm ci --omit=dev - Switch over and restart
sudo ln -sfn /opt/ats/ats-0.1.0 /opt/ats/current sudo systemctl restart ats journalctl -u ats -f/etc/ats/ats.envand/var/lib/atsstay where they are. The old folder remains in/opt/ats; to roll back, pointcurrentat it again and restore your backup.
Kept your .env inside the app folder? Copy apps/node/.env from the old folder to the new one before restarting, and make sure DATA_DIR is an absolute path, or the new folder starts with an empty ./data.
Cloudflare#
- Carry over your Wrangler configuration
Copy your
database_id,routesand[vars]from the oldapps/cloudflare/wrangler.tomlinto the new one (or copy the old file over, then re-check it against the new one). Secrets live in Cloudflare and carry over. - Install and deploy
cd ats-0.1.0 npm ci npm run deploy -w @ats/cloudflareMigrations run on the first request to each new isolate. Keep the D1 export from before the upgrade until you are happy with the new version.
After upgrading#
- Check
/ats/api/healthand sign in. - Send a test submission with the curl recipe if the release touched intake.