1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Swiss Backup: Jelastic extension to back up folders and node data
This guide shows how to use the Swiss Backup extension to back up your Jelastic node data.
Swiss Backup is a backup solution that enables the automatic backup of your files, workstations, mobile devices and servers. Your data is stored in Infomaniak's data centers in Switzerland in at least three different physical locations. You are thus ensured that nothing will be lost.
1. Requirements
- Use Jelastic (discover Jelastic Cloud)
- Have a Swiss Backup account (create a free account)
- At least one environment must be enabled with the extension installed to ensure that your backups are visible
2. Configure Swiss Backup
- Open the Manager (manager.infomaniak.com)
- Go to Swiss Backup
- Click on Add a device
- Select a free storage space
- Give a name to this space and determine a quota
- Note the username (e.g., SXY-PM000000) and generate a password via the email received
3. Configure the Swiss Backup extension on Jelastic
- Log in to your server's Jelastic dashboard
- Go to the Marketplace
- Find and install the Backup / Restoration
extension
Two types of backup are then possible:
- Back up specific folders
- Create a snapshot of an entire node
We will now explain these two possibilities in detail.
3.1 Back up specific folders
- Enter the username and password for your free Swiss Backup location (cf. point 2, step 6)
- Tick Backup your data
- Tick Backup specific folders
- Enter the absolute path of the folders you want to save in the Folders to backup field. It is possible to specify several folders by separating each path with a comma, as in the image below. e.g.: /root/admin/, /home/user1/, /jelastic/containers/ (3 folders are specified in this example).
3.2 Back up an entire node
- Tick Backup your data
- Tick Backup all files to save the entire file system of a node. Note that certain files are automatically excluded:
- /dev, /proc, /sys, /run folders
- file systems that are not assembled as part of the root partition, including virtual file systems.
3.3 Define backup frequency and retention policy
Backup frequency
Two options are available:
- daily backups (at 8:00 p.m. UTC)
- hourly backups (at the beginning of each hour, e.g. at 1:00 p.m., 2:00 p.m., etc.)
Retention policy
You can configure the storage period in years, months, days and hours. If you wish to store your backups indefinitely, simply set the parameters to 0.
If, for example, you make hourly backups and define a retention policy of 1 year, 2 months, 4 days and 2 hours, this means that each backup will be available for a period of 1 year, 2 months, 4 days and 2 hours (=10,322 backups). Note that the deletion of backups takes place every Sunday at 10:30 p.m. (UTC).
NB: please do not set all settings to 0 because permanent backups can cause backup failures.
Recommended limits:
- Year: 1- Months: 12
- Days: 99
For an hourly backup, we recommend a maximum retention period of one month. Beyond that, some backups may fail.
4. Restore backups
4.1 Restore node data
- Log in to your server's Jelastic dashboard
- Go to the Marketplace
- Find and install the Swiss Backup extension
- Enter the username and password of your free Swiss Backup location (cf. point 2, step 6)
- Tick Restore your data
- Select the node that contains the backup to be restored (figure 1)
- Select the backup to be restored and the restoration folder (figure 2)
- Click on Restore
Figure 1.
Figure 2.
4.2 Restore specific folders of a snapshot (CLI)
Each backup corresponds to a unique ID. You can include and exclude folders in/from your snapshots when restoring. To view your snapshots:
- . /home/.config/swissbackup/openrc.sh
- restic snapshots
- use --exclude and --include to restrict restoring to a sub-set of files in the snapshot. For example, to restore a single file: restore 79766175 --target /tmp/restore-work --include /work/foo
There are some non-case-sensitive variations of --exclude and --include called --iexclude and --iinclude. These options behave in the same way but are insensitive to the case of the paths.
5. Modify the backup configuration
- Log in to your server's Jelastic dashboard
- Go to the Marketplace
- Find and install the Swiss Backup extension
- Modify the configuration as required
5.1 Manually modify the backup routine (CLI)
The backup calendar is defined by a cronjob and backups are performed using the restic tool.
To modify your backup routine:
As a root user, launch the crontab -l command to display current times:- The line containing retention-all.sh corresponds to the backup task
- The line containing purge.sh corresponds to the backup retention task
For example:
Modify the schedule using the crontab -e command
You can edit the line containing retention-all.sh or retention.sh; these scripts correspond to the launch of your backups. Please note: the crons have been designed to avoid causing problems between backups and multiple deletions. Please pay attention to the time required for backups and deletions- To find out more about cronjobs, visit the crontab.guru website
- To find out more about restic, consult the restic.net/ website
6. Manually delete backups (CLI)
- Open the configuration file:
. /home/.config/swissbackup/openrc.sh - Display the backups available:
restic snapshots - Delete the backup concerned:
restic forget IdBackup --prune - Delete all the backups of a file except one:
restic forget --tag folders --keep-last 1 --prune
7. Delete the backup routine
This button enables you to delete your backup routine:
8. Uninstall the Swiss Backup extension
It is necessary to delete the backup routine (see chapter 8) before you can uninstall the Swiss Backup extension.
Find out more
- Getting started with Swiss Backup
- Try out Jelastic Cloud free of charge
- Try out Swiss Backup free of charge