I'm running a web app (Wordpress, actually, but I think it mostly does not matter for the question). It is running in two Docker containers, one containing an Apache web server (via the official wordpress
Docker image) and one containing a MariaDB. The containers are deployed using docker compose
and the data is mounted from a folder on the host machine. My backup is done by running mariabackup
in the MariaDB container and then backing up the web server files and database backup. I am using traefik as a reverse proxy.
From time to time, I want to perform major upgrades of the web app or do some development. For that, a develop copy of the site would be quite useful. The develop copy would not need to run the whole time. I think there would be two cases I would like to use it:
Copy the main instance ("production") to develop. Do some testing or development. Then drop the develop instance.
Make production read-only. Copy production to develop. Upgrade web app. Copy develop to production. Make production read-write.
What would be a good way to do this? I am leaning towards adding two more containers for my staging environment two my docker-compose.yml
and then creating a bit of scripts (I was thinking about using Ansible, though I've never used that) which would do the copying. I am also considering using something like OverlayFS to avoid copying a lot of data. But I've also stumbled over tools like Vagrant and Trellis, and wonder whether one of them would be a better way to address my issue.