Implement back-ups for wordpress #7

Closed
opened 2020-09-17 18:49:48 +00:00 by decentral1se · 5 comments
Owner

We use this thing called swarm-cronjob which "creates jobs on a time-based schedule on Swarm". An example of that being used is our renovate-bot. So, let's use that 🎉 There is a ready baked example for using MariaDB over here which we can work from. It is also looking like we are gonna go with https://docs.borgbase.com for our remote storage/web ui enabled/alert hooks/allow us to sleep at night backup solution.

That's all I know so far, more to come...

We use this thing called [swarm-cronjob](https://github.com/crazy-max/swarm-cronjob) which "creates jobs on a time-based schedule on Swarm". An example of that being used is our [renovate-bot](https://git.autonomic.zone/autonomic-cooperative/renovate-bot/src/branch/master/compose.yml#L19-L21). So, let's use that :tada: There is a ready baked example for using MariaDB [over here](https://github.com/crazy-max/swarm-cronjob/blob/master/.res/example/mariadb_dump.yml) which we can work from. It is also looking like we are gonna go with https://docs.borgbase.com for our remote storage/web ui enabled/alert hooks/allow us to sleep at night backup solution. That's all I know so far, more to come...
Author
Owner

One thought is to make a really thin alpine container with mysqldump, borg and borgmatic installed on it. Then mount in the borgmatic config.yml that has the borgbase details in it and then pipe the output of mysqldump into borgmatic so it is shipped off right away. We could install other backup utilities onto that thin image so that it could be a more general solution. This sounds simple enough that it might work 🙏

One thought is to make a really thin alpine container with mysqldump, borg and borgmatic installed on it. Then mount in the borgmatic config.yml that has the borgbase details in it and then pipe the output of mysqldump into borgmatic so it is shipped off right away. We could install other backup utilities onto that thin image so that it could be a more general solution. This sounds simple enough that it might work :pray:
decentral1se self-assigned this 2020-09-17 19:00:25 +00:00
Author
Owner

Ok, I went through the borgbase and borgmatic setup instructions and tried to bake in my ideas above. It seems to be looking workable so far. I've got a new service that is in the compose.yml of this repo: https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/compose.yml#L47. That relies on really simple image which I've baked over at autonomic-cooperative/backup-bot. The image runs borgmatic which is configured by the borgmatic.yml in this repo.

The only downside I can see right now is that each compose-stack would have to have its own backup service there and it is already some 20 lines and another configuration. We can probably extract this to a separate compose.yml and run it separately like the renovate-bot at some point when we prove to ourselves this is a good way to go. That would just need some wrangling to get the remote connection strings of the database since the service would not be in the same compose.yml definition anymore.

Ok, I went through the borgbase and borgmatic setup instructions and tried to bake in my ideas above. It seems to be looking workable so far. I've got a new service that is in the compose.yml of this repo: https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/compose.yml#L47. That relies on really simple image which I've baked over at [autonomic-cooperative/backup-bot](https://git.autonomic.zone/autonomic-cooperative/backup-bot/). The image runs borgmatic which is configured by the [borgmatic.yml in this repo](https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/borgmatic.yml). The only downside I can see right now is that each compose-stack would have to have its own backup service there and it is already some 20 lines and another configuration. We can probably extract this to a separate compose.yml and run it separately like the renovate-bot at some point when we prove to ourselves this is a good way to go. That would just need some wrangling to get the remote connection strings of the database since the service would not be in the same compose.yml definition anymore.
Author
Owner

So, backing up the mysql database on crontab is sorted! Using this config: https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/compose.yml#L47-L71 and this borgmatic config: https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/borgmatic.yml. Next is to identify which source directories need to be backed up as well.

So, backing up the mysql database on crontab is sorted! Using this config: https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/compose.yml#L47-L71 and this borgmatic config: https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/borgmatic.yml. Next is to identify which source directories need to be backed up as well.
Author
Owner

/var/www/html/wp-content

Which is also a volume. Soooo, perhaps I need to mount the volume from that wp container as a shared volume and then backup directly from the volume in the borgmatic config. Writing this at full speed...something for tomorrow!

> /var/www/html/wp-content Which is also a volume. Soooo, perhaps I need to mount the volume from that wp container as a shared volume and then backup directly from the volume in the borgmatic config. Writing this at full speed...something for tomorrow!
Author
Owner

OK, mounting the volume in and backing it up over in https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/borgmatic.yml#L3. I've validated the backups are indeed in there using Vorta to connect to borgbase. I haven't done a restore yet. I'm gonna close this off for now.

OK, mounting the volume in and backing it up over in https://git.autonomic.zone/compose-stacks/wordpress/src/branch/master/borgmatic.yml#L3. I've validated the backups are indeed in there using Vorta to connect to borgbase. I haven't done a restore yet. I'm gonna close this off for now.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coop-cloud/wordpress#7
No description provided.