• Feedback
  • USEnglish
  • Backup strategy and other questions before switching

After testing mailcow for two months and learning a little about docker I’m ready to switch my primary email domain to mailcow. I have a few questions:
I plan to run centos8 for the host as I’m most familiar with it. I plan to mount a sufficient volume on /var/lib/docker

Should I go with ext4 or xfs? Centos 8 supports d_type

What is a good update strategy?
I assume I can enable automatic security updates on centos and update mailcow every few weeks or so before I automate it.

What about backup strategy?
I need /opt/mailcow-dockerized and /var/lib/docker/volumes

I can script a local backup. What would be a good strategy to pull backup from mailcow server and store it on backup server?

Hey otarhryn,

there is a script included in Mailcow.
Redirecting...

It will provide you with a .zip file which you could easily backup to any location.

Personally, I use curl and a Nextcloud-instance to backup my whole Mailcow-instance to another server. Additionally, I use the build-in tool cron to schedule everything. There are other really good services like scp to send you backups to a secure location.

Since my backups are usually really small, so I chose to run the backup-script daily.

For updates I always go with a manual backup every few weeks. I had never any issues with the upgrade process so I guess you could automate it.

    Have something to say?

    Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

    sivn Do you have nextcloud curl / scp files from mailcow? I have a freenas and I could script scp there

    • sivn replied to this.

      otaehryn
      That’s my curl script:

      #!/bin/bash
      date=$(eval "date +'%Y-%m-%d-%H-%m-%S'")
      backup=$(ls -td /opt/backup/*/ | head -1)
      zip -r -P <Password for .zip Archive> /opt/cloud_backup/uploaded/srvbu-mail-$date.zip $backup
      /opt/cloud_backup/cloudsend.sh /opt/cloud_backup/uploaded/srvbu-mail-$date.zip <https link to file drop url nextcloud>
      rm /opt/cloud_backup/uploaded/srvbu-mail-$date.zip
      echo "Done!"

      The cloudsend.sh is from this repository GitHub Icon GitHub - tavinus/cloudsend.sh: Bash script that uses curl to send files to a nextcloud/owncloud shared folder.

      Cron:
      59 23 * * * BACKUP_LOCATION=/opt/backup /opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup all --delete-days 7

      15 00 * * * /opt/cloud_backup/zipandupload.sh

      It’s incredible dirty but it works. If you or the others have any other ideas or improvements I’d happy to read them!

      4 days later

      sivn, thank you for reply. I created a script to run on Linux or FreeBSD (Freenas) which copies last backup

      #!/bin/sh
      # a simple script to run on Linux or FreeBSD to  ssh in mailcow and grab last backup. i
      
      # This script assumes you have mailcow backup run by mailcow locally on remote mailcow servers
      # You could do that by adding a line
      # 0 1 * * * root MAILCOW_BACKUP_LOCATION=/opt/backup /opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup all --delete-days 60
      # to /etc/crontab or cron.daily
      
      
      # Location to store backups on local server where script is running. i
      # Directory must exist, if not create it.
      backuplocation=/var/mailcowbackup/
      
      #IP or FQDN of mailcow server
      mailcowserver=mail.mydomain.com
      
      #User on remote mailcow server to ssh. User must have generated ssh key which must be installed on mailcow server. User must have read permissions on mailcow backup dir. 
      remoteuser=root
      
      #Absolute location of backupdir on remote mailcow server
      mailcowbackupdir=/opt/backup
      
      # Get last backup on remote server
      lastbackup=$(ssh $remoteuser@$mailcowserver ls -tr $mailcowbackupdir | tail -1 2> /dev/null)
      
      
      # Test if last backup is not empty string
      [ -z "$lastbackup"  ] &&  { echo "Cannot find Last backup, check variables and backup and check if user can log in."; exit 1; } ||
      # scp remote backup to local backup
              scp -r "$remoteuser"@"$mailcowserver":"$mailcowbackupdir"/"$lastbackup" "$backuplocation"

      GitHub Icon GitHub - poshleon/mailcow-remote-backup-script

      No one is typing