Case study 03 · Institute challenges 1 and 2 · Apr – Jun 2026
aform is a web app for building forms, written by the program’s facilitators. It ran only on laptops. I put it on two AWS servers with my own scripts, then built the team’s pipeline that tests every change and releases it to dev, staging and production.
- When
- Apr – Jun 2026, two challenges
- Team
- Three people each time, with different teammates
- My part
- The server setup scripts, the pipeline, and the deploy, promote and rollback scripts. I ran staging.
- Stack
- AWS EC2, Bash, Nginx, systemd, PostgreSQL, Redis, RabbitMQ, Secrets Manager, S3, Bitbucket Pipelines, SonarQube, k6
The problem
An app that ran only on laptops
The first brief was to run the app on a Linux cloud server on a small budget. It had to be reachable, secure, monitored and documented.
The second brief was to automate its releases across three environments, so that nobody deploys by hand.
One thing about the app shaped the setup. A form submission doesn’t wait for the database. The server puts it on a queue and answers at once, and a separate worker saves it.
01 · Two servers
Two servers, set up by one script
The group of three shared one design, and each of us deployed it with our own scripts. Mine used two small servers in AWS Jakarta. The web server and the app sit on a public one. The database, cache and queue sit on a private one with no public address.
One script launches both servers. Another builds the app on my laptop and copies it over. Then I log in to the public server and run server.sh, which sets up everything, the private server included, and leaves no secrets file behind.
- ec2Setup.shLaunches both servers and gives the public one a fixed address.
- deploy.shBuilds the app for the servers’ ARM chips and copies it over.
- server.shReads three secrets through the server’s own role, locks down SSH, then sets up the private server.
- db.sh, ssl_setup.shInstall the database, cache and queue, create a private certificate authority and turn on TLS for all three.
- server.sh, continuedDatabase migrations, services, Nginx, an HTTPS certificate, the firewall and monitoring.
What the scripts guarantee
- Secrets live in AWS Secrets Manager. Nothing secret is written to disk.
- Only the public server has an AWS role. A reviewer asked for that, and I changed the script the same day.
- Everything between the two servers is encrypted, with certificates from my own certificate authority.
- Nginx serves HTTPS and limits each address to 10 requests a second.
- The restore script checks a backup’s checksum before restoring it. I tested a restore.
(opens full size in a new tab)
(opens full size in a new tab)02 · The pipeline
One build, three environments
In the next challenge a new team of three ran one environment each. I ran staging. A teammate committed a template pipeline file. I replaced it that afternoon and wrote 56 of the commits to it that followed, along with the deploy, promote and rollback scripts every environment used.
- CheckLint and unit tests on every push.
- GateFails below 90% test coverage, then a SonarQube scan.
- BuildOne build for each version tag.
- StoreSaved in S3 by environment and version.
- DeployEach server pulls its build with its own role. Production waits for a click.
The app is built once. Promoting it copies that same build from one environment’s folder to the next, so what was tested in dev is exactly what reaches production.
The deploy script runs on the server. It installs the new version, restarts the app and checks it up to five times. If the check fails it puts the previous version back and fails the pipeline. Rolling back by hand is one pipeline for each environment.
(opens full size in a new tab)
(opens full size in a new tab)
(opens full size in a new tab)Test coverage · the gate raised in four steps
94.4% of the app’s code covered by 182 tests, up from 16.7%
16.7% · gate 15
Models, settings, CSV export and image storage.
37.1% · gate 35
Services, tested against a stand-in database.
49.4% · gate 45
Code that talks to real services split from code that can be tested.
94.4% · gate 90
Request handlers and middleware.
Result
Releases that check themselves
- A change that drops test coverage below 90% fails the pipeline.
- A release that fails its health check is rolled back automatically.
- The team timed a fresh server going live over HTTPS at about 9 minutes with my setup script.
Problems on the way
- Our own build machine was ARM and the SonarQube scanner only ran on Intel, so that step crashed. It ran on Bitbucket’s machines until 28 May.
- The scanner rejected SonarQube’s certificate. I first skipped the check, then replaced that with a proper trust store.
- The first promote script copied dev builds into production under their dev names. I added a rename.
The tests
Claude Code wrote the tests. My part was the plan. I split the code that talks to real services from the code that can be tested, put small interfaces in front of it, and raised the gate step by step. The four steps took about 17 hours.
The team’s work, not mine
A teammate built the monitoring side, with tracing, dashboards and the pipelines that stop and start servers. Another owned the write-ups, including a cost audit I co-authored. It found a shared NAT gateway missing from our proposal, at about $52.54 a month, and four savings projected at about 18%. Whether they were applied isn’t recorded.
What it doesn’t do
- The network was created by hand in the AWS console, not by a script.
- Backups ran by hand. I never scheduled them.
- The pipeline’s AWS credentials are stored repository variables, and deploys go over SSH.
- A release restarts the app in place. There is no second copy to switch over to.
- The app’s cache and queue connections are encrypted but don’t verify the server’s certificate.
- My first deploy script matched a teammate’s from the same afternoon. The health check, the automatic rollback and promotion are what I added.