Mautic Community Forums

Backup and restoration of Mautic

Hello!

I am a beginner in IT and Web Development.
I would like to create a backup of the Mautic installed on a hosting server “A” and restore it in another server “B”. How do I do that?
If it’s possible to automate the backup and the restoration, please tell me how to proceed.

Hello Ahmed!
Mautic backup is no different than any other software backup, that is installed on a web server.
Zip the folder + backup DB and move it. (make sure domain settings are okay.)
If you want to do it on a larger scale, look into:

Good luck
Joey

1 Like

I would add to bring over the crontab jobs, too.
crontab -l
copy and paste it to a text file and reimport it on new server.

1 Like

Hello @joeyk and thank you for your reply!

The problem is that I have never performed a backup of a web software.
How do I zip the mautic folder (home/public_html/mautic)?
For the database backup, I suppose that I only need to use the backup wizard of my control panel. Is there a way to automate it?

Hi @jimkey and thanks for replying!

What should I copy and paste?
If you know any cron jobs to automate the backup of Mautic, please inform me what they are.
If there is a way to automate the restoration to another server periodically, that would be even better!

ahmed,

We can only give you examples. You need to learn Linux System Administrations especially command line tools cp, tar, rsync, ssh, crontab, mysql, and mysqldump.

Here are some snippets from my backup bash script below. A keep a week or 2 of backups on the server. I’m on AWS so copy my /backups contents to a S3 bucket and a 2nd server.
If you not on AWS, you can use rsync to sync your backup folder to another server.

For restoration, you would restore the apache/nginx config files, restore the mautic folder, and restore the mysql database, and change the DNS to point to your new server.

purge old daily and weekly backups after mtime days.

find $backuppath -type f -mtime +5 -name ‘daily*’ -execdir rm – ‘{}’ ;

backup the mautic folder, assets, and dump mysql database.

tar -zcvf “${backuppath}daily-mautic-datename.tar.gz" /opt/mautic-3.0.2-0/apps/mautic/ tar -zcvf "{backuppath}daily-mautic-assets-datename.tar.gz" /opt/mautic-3.0.2-0/apps/mautic/assets /opt/mautic-3.0.2-0/mysql/bin/mysqldump --no-tablespaces -u bn_mautic -pxx bitnami_mautic | gzip -c > "{backuppath}daily-$sitename1.sql-$datename.gz”

sync or you can rsysnc to offline

aws s3 sync /backup/ji-email s3://s3bucket.xx.com/30days/ji-email

1 Like