Mailcow-dockerized: A docker newbie ask a docker question (backup)

Created on 3 Jan 2018  路  8Comments  路  Source: mailcow/mailcow-dockerized

Hi,

is it possible just compress (tar) the mailcow_dockerized complete folder and good is.
When I have a problem then I do it uncompress the tar archive and the job goes on

Is this wrong?

Most helpful comment

I wrote something for all important data, will push soon.

All 8 comments

That鈥榮 not the only place that contains Mailcow data. /var/lib/docker/aufs or /var/lib/docker/overlayfs contains the Docker images, but they can usually be retrieved again with docker-compose pull, so most people don鈥榯 back them up. /var/lib/docker/volumes contains all the user mailboxes, databases, etc., so you need to back that up too.

@jm3west For backup strategie, replace the tar-archive with an emashing tool like borg
https://borgbackup.readthedocs.io

You need to backup the mounted volumes + your mailcow folder. If you will restore the entry same system, you should also backup the used images of mailcow-service.

Example script file to backup an docker-compose service volumes with (optinal) images.
https://github.com/Siassei/docker-volume-backup/blob/master/docker_full_backup.sh

Usage: (note, it is dev-status. but a good entry point for your env)

MODE=backup # or restore

path=/opt/mydocker/project1/docker-compose.yml
project=project1
BACKUP_DIR=/tmp/mybackups
DATE=xxxx-xx-xx # with borg, that feature is not needed and currently sticked with x's

#export EXCLUDE_CONTAINER=1
#export EXCLUDE_VOLUMES=1

./docker_full_backup.sh $path $project $BACKUP_DIR $MODE $DATE

@Siassei would you be willing to create a backup and restore script for mailcow?
It would be amazing to have such a script similar to the update script.

@mkuron what are all the things to backup? We have the mailboxes and databases already referenced in the documentation. What else is missing?

seems like these things add to the mailboxes and database:

  • Redis Database
  • Postfix鈥榮 queue
  • Rspamd鈥榮 training state

but there is probably more.
found this information in a pull request about a backup script

812 and #639 were attempts at backup scripts that were never finished. All the necessary information is in my comments there.

@mkuron thank you
so these are the things mentioned in the pull requests:

  • Mailboxes
  • MySQL Database
  • Redis Database
  • Postfix鈥榮 queue
  • Rspamd鈥榮 training state

I see two more docker volumes on my system:

  • mailcowdockerized_dkim-vol-1
  • mailcowdockerized_crypt-vol-1

Are these volumes holding anything important?

I could also imagine that a backup of the mailcow-dockerized directory would be worth to be backed up.

--

general idea: would it be enough to just stop mailcow, make a copy of all volumes in /var/lib/docker/volumes/, make a copy of the mailcow-dockerized directory and then restart mailcow?

I wrote something for all important data, will push soon.

The backup script is now available in master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

damdinsharav picture damdinsharav  路  3Comments

mritzmann picture mritzmann  路  3Comments

GalacticLion7 picture GalacticLion7  路  3Comments

poldixd picture poldixd  路  3Comments

schoebelh picture schoebelh  路  3Comments