Tyler Smith

Setting up back-ups with an Ansible container in Jenkins

I want database backups for SacMusic. A cron job could work while it's a single server. But it wouldn't notify me when it fails. And what about when I have multiple servers and I use a managed database? Which server do I put the cron on? How do I configure my pipelines to ensure that only one instance of it is running? What system dependencies do I need to install to interact with S3 buckets? An application server is a less-than-ideal fit.

I already have a Jenkins instance that can handle recurring jobs and notifications, so I decided I'd build my backup system there. As an added bonus, Jenkins handles containers alright too. I've been looking to play with Ansible as well. This project may not be the best fit for Ansible since its supposed to be completely idempotent and backups aren't reall that, but having a small project to start getting my hands around how Ansible works is more important to me right now than scoring points with the Hacker News crowd.

Here's what I learned today while digging into this:

I also added venv to the Python back-end of SacMusic today. It's not actually used in the container though: it's just on the host machine for better autocomplete. It's a massive quality-of-life improvement compared to using the Microsoft Remote - Containers extension: my whole app is in a single editor.

Hopefully tomorrow I can dig further into Ansible for the backups. I saw that there's an S3 collection, so that will hopefully get me most of the way there.