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.
Tu progreso se guarda solo en este navegador.
Enviar para revisión (10 puntos)