Capstone: An Automated Operations Toolkit
Bring the whole track together in one repository, ops-toolkit, that you could hand to a client or a new teammate.
Requirements
- Backups โ a Python script that dumps the database, compresses and encrypts it, uploads it off-site and prunes old copies. It supports
--dry-run, logs every step and exits non-zero on failure. - Health checks โ a script that checks disk, memory, a list of URLs and certificate expiry dates (
ssl.get_server_certificateoropenssl s_client), and posts a summary to Slack or Discord only when something needs attention. - Scheduling โ systemd timers (or cron with
flock) for both, with heartbeat pings. - Server setup โ an Ansible playbook that installs the toolkit, its timers and its config on any server.
- CI โ GitHub Actions running ShellCheck, pyflakes and pytest on every push.
- Docs โ a README covering install, configuration (every env var), how to restore a backup and how to add a new check.
Suggested layout
ops-toolkit/
โโโ README.md
โโโ .env.example
โโโ scripts/
โ โโโ backup.py
โ โโโ healthcheck.py
โโโ tests/
โ โโโ test_backup.py
โ โโโ test_healthcheck.py
โโโ systemd/
โ โโโ ops-backup.service
โ โโโ ops-backup.timer
โโโ ansible/
โ โโโ inventory.example.ini
โ โโโ site.yml
โโโ .github/workflows/ci.yml
Testing automation code
Automation fails in production when it was never tested. Make functions small and pure where possible, then test them:
from scripts.healthcheck import over_threshold
def test_over_threshold():
assert over_threshold(used=85, total=100, limit=80)
assert not over_threshold(used=50, total=100, limit=80)
For steps that touch the outside world, test the --dry-run path and mock network calls.
Review checklist
- [ ] Every script is idempotent and safe to re-run
- [ ] No secrets in the repository;
.env.exampledocuments them all - [ ] Failures alert a human; silence is detected with heartbeats
- [ ] Restores have been tested, with the time it took written down
- [ ] A new teammate can install it from the README alone
Finish this and you have a real portfolio piece. It is also exactly the kind of maintenance package businesses pay for every month.
Your progress is saved in this browser only.
Submit for review (10 points)