Loading...
 

History: Virtualmin Tiki Manager and Syncthing for automated offsite backups

Preview of version: 12

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 is 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:

  1. Virtualmin will make incremental and automated backups of each virtual server to a local destination.
  2. Tiki Manager (installed on the same server) will make incremental and automated backups of each site to a distinct folder
  3. 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 installs all the required modules in order to prepare for the installation of 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.

Configure Virtualmin to backup your 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 then click on the Add a new backup schedule button. In case you already have an existing scheduler backup, click on it and it will open the page to edit if needed.

Schedule Backup Menu

  • In the list of virtual servers, select all or select only the one(s) you want to backup, there is an option to select only a few. Then click on the right arrow to validate the choice of the selected virtual servers.

Schedule Backup Select Virtual Server

  • Then select feature you want to backup, by default backup all features will be selected

Schedule Backup Feature

  • Now you have to select the destination of your backup; as we are going to use Syncthing to sync backup data to external server(s), we are going to select Local file or directory and provide the path where we want our backup to be stored. It is recommended to put backup outside the website folder, so For my example we use the /home/backups/lab3-%Y-%m-%d directory. This 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.

Schedule Backup Destination File

  • For this step you can setup an email for reporting notification in case the backup fails, 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.
Scheduling And Reporting

Schedule Backup List
Note that you can setup multiple backup schedulers depending on your needs, this can be based on day, month, year, etc.

Use Tiki Manager to make instances, or adopt them

Tiki Manager can be access via GUI or CLI

Configure Tiki Manager to backup your Tiki instances

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

Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it’s transmitted over the internet. Please read more here https://syncthing.net/

On the server

Foreach Virtual server 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 the file name will vary based on the configuration you made when you set 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:

  1. On the device sending the backups: set Folder Type to "Send Only"
  2. 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).
Syncthing Backups Send Only Setting
Syncthing Backup Receiving Staggered

Troubleshooting

  • If sync is not working as expected, check the Syncthing folder interface for errors.

History

Advanced
Information Version
Emmanuel Masikilizano 16
View
Emmanuel Masikilizano 15
View
Emmanuel Masikilizano 14
View
Emmanuel Masikilizano 13
View
Emmanuel Masikilizano 12
View
Emmanuel Masikilizano 11
View
Emmanuel Masikilizano 10
View
Emmanuel Masikilizano 9
View
Emmanuel Masikilizano 8
View
Boss Ibrahim Mussa 7
View
Boss Ibrahim Mussa 6
View
Boss Ibrahim Mussa 5
View
Boss Ibrahim Mussa 4
View
Boss Ibrahim Mussa 3
View
Boss Ibrahim Mussa 2
View
Boss Ibrahim Mussa 1
View