In case you have some Tiki instances on Virtualmin and you want automatic backups of different Tiki instances to various local computers for safekeeping.
These are high level operation when it about to combine Virtualmin , Tiki Manager and Syncthing to do so.
For a hosting company and its customer, this is the optimal solution: This permits a customer to delegate the hosting / management of an application while obtain automatic backups of their application and data.
At a high level:
- Virtualmin will make incremental and automated backups of each virtual server to a local destination.
- Tiki Manager (installed on the same server) will make incremental and automated backups of each site to a distinct folder
- Syncthing will securely copy each folder to one or many devices.
Benefits / Features
https://wikisuite.org/Tiki-Manager-and-Syncthing-for-automated-offsite-backups#Benefits_Features
Install Virtualmin as web server
How to install WikiSuite
This installation of WikiSuite install all the require module in order to ready to install a Tiki instance, such as: Tiki-Manager GUI and CLI and Syncthing installation script
Each Tiki instance can be installed as a distinct website using Tiki-Manager on a virtual server or sub-virtual server.
As we are planning to backup each Tiki instance, we can backup each virtualserver or sub-virtualserver with all configuration need.
- From virtualmin, go to menu Backup and Restore -> scheduled Backups . In case you do not have existing scheduler, it will open the scheduler pages.
- From the virtual servers list, you select all or select the one you want to backup, there is an option to select one, then click on the right arrow to select the virtaul server
- Then select feature you want to backup, by default backup all features will be selected
- Now you have to select the destination of your backup, as we are going to use Syncthing to backup data to external server, we are going to select Local file or directory and provide the path where we want our backup to be store. for my example we use the /home/backuos/lab3-%Y-%m-%d directory, is going to generate a backup with a different name for versioning(very important). For the compression format, by default virtualmin as a standard format that work without any issue, you can select the one you prefer. tar can be fine to have only one file instead of multiple folders.
- For this step you can setup a email for reporting notification in case the backup failed, and then select the schedule time for the backup. on this example it will be everyday at 11h PM.
then click on create to validate the scheduler.
Note that you can setup up multiple backup scheduler based on the need, it can be day, month, year, ....
Use Tiki Manager to make instances, or adopt them
Tiki-Manager can be access via GUI or CLI
The configuration can be done via cli, for more detail about tiki-manager command https://doc.tiki.org/Manager#instance:backup
The Tiki Manager archive folders have the following pattern:
- /opt/tiki-manager/app/backup/archive/1-example.org/
- /opt/tiki-manager/app/backup/archive/2-example.com/
- etc.
Check that your backup is OK, and move on to the next step
Set up automatic backups with Tiki Manager
Tiki Manager will make the backups and also has a retention cycle (keep last 7 days, last 4 weeks and once per month forever)
Of all the instances
Virtualmin provide as module to schedule backup of all
https://doc.tiki.org/Manager#manager:setup-backups
For just one of the instances
In case you want to backup one instance, you can proceed as shown above. make sure you are on Tiki-manager folder
php tiki-manager instance:backup --instances=3 --no-interaction
You may want to install this in a cronjob. To do it every day at midnight, do the following.
echo '0 0 * * * cd /opt/tiki-manager/app/ ; php tiki-manager instance:backup --instances=3 --no-interaction' > /etc/cron.d/tm-instance.wikisuite.org-backup
Install Syncthing
On the server
Foreach virtualserver you can install an instance of Syncthing, and each one can work without interfering with other.
On your laptop
Setup Syncthing
Make sure Syncthing automatically restarts when you reboot so that you have unattended automatic backups. Just reboot to see if it's OK. If not, you need to look up the documentation for your Operating System.
Configuring Syncthing for
- Virtualmin : Your backup will be in something like /home/backups/lab3-2024-07-25 the date date will vary based on the configuration we did when you were setting the scheduler backup with virtualmin, sync that with your local computer.
- Tiki archive folder: Your archives will be in something like /opt/tiki-manager/app/backup/archive/1-example.org/: so, sync that folder with your local computer.
Setting up Syncthing for backups
Syncthing by default is set to sync multiple folders so they get to the exact same set of files and folders. So, if you delete a file in one folder, the deletion is propagated. In the contexts of backups, this could cause issues. Examples:
- Ransomware on any device: Then, all the devices would receive the corrupted data which replaces the valid data.
- One of the devices runs out of space, and its user decides to clear out old backups.
The solution is:
- On the device sending the backups: set Folder Type to "Send Only"
- On the device(s) receiving the backups: set File Versioning. Recommended setting is "Staggered"
Because the master server is set to "Send Only", there is no point in setting to "Staggered" (It doesn't receive any data, and thus doesn't need versioning).
Troubleshooting
- If sync is not working as expect, check the Syncthing folder interface for errors.