Deployment
Deploying this site is five steps, and make deploy is all five:
- Build the Hugo site into
public/with the sandbox base URL. terraform init.terraform apply— idempotently provisions the Bunny.net storage zone, pull zone, DNS record, and TLS hostname.- Wipe the storage zone root and upload
public/. - Purge the pull zone cache.
That is the whole deployment model. It lives in scripts/deploy.sh, which is short enough to read before you run it, and runs the same steps CI runs.
The deployment target#
The site deploys to the estate’s Bunny.net sandbox,
specifications.sandbox002.dev.prosyon.ca, provisioned by the estate’s
static-website/bunnynet module (patterned-designs/hcl-bunny-static-website)
from the Terraform registry. One thin root, env/www/main.tf,
holds the backend, the domain, and the provider; the pattern itself lives in
the module.
The production domain (specifications.aureliasrs.ca) and its former AWS
deployment are out of scope here: moving the production domain onto Bunny.net
is a separate decision for the site’s owner. The AWS stack’s live resources
were left in place, but this repository no longer defines or publishes to
them.
make deploy # build, provision, publish, purge
make deploy.plan # preview, changes nothing
make deploy.destroy # tear the sandbox down
Prerequisites#
The vault. BUNNYNET_API_KEY is a generic secret, available to every run;
deploy through the vault rather than setting it by hand:
secrets exec -- make deploy
The Terraform state bucket. The root commits its backend — the estate’s
encrypted S3 bucket under the patterneddesigns profile — and needs no
credentials beyond the ambient AWS chain in the dev container or the runner’s
setup-aws-credentials step.
The parent DNS zone. The module creates the DNS record and TLS hostname
for the site’s name; the zone sandbox002.dev.prosyon.ca already exists in
Bunny DNS.
Continuous integration#
Pull requests touching the site, env/www, scripts/, docs/, or the
workflow only build the site with the sandbox base URL — they get no AWS
credentials, no vault identity, and never touch the sandbox. A push to main
additionally provisions the stack, publishes public/ to the storage zone
with ayeressian/bunnycdn-storage-deploy, purges the pull zone, and verifies
from the runner that the address answers 200 with the home page. A run where
any of those steps fails is red.
Publishing and caching#
The publish step wipes the storage zone root and uploads the fresh build, so a page removed from the site is gone rather than lingering until a manual clean. The pull zone is purged after every publish; propagation is asynchronous, so the workflow’s verify step retries the address for up to a minute before it fails the run.
Recovery#
A deploy red on publish. The workflow’s steps are the same commands
scripts/deploy.sh runs; rerun secrets exec -- make deploy locally to see
the failure directly. Provisioning is idempotent, so repeating it is safe.
A stale site after a deploy. Confirm the purge completed and re-run the publish; the verify step in the workflow reports the exact status it saw.
Rolling back. Check out the previous commit and run make deploy again;
the site is a static build, so the previous bytes are reproduced exactly.