Overview
This article describes how to back up UISP application data.
Table of Contents
Introduction
Backing up data is always a good idea, but it is especially important in certain scenarios. For example, before performing an upgrade to a new version, or when testing different features or configurations on UISP. Performing a backup first is a best practice that allows experimentation without the danger of losing carefully polished settings.
How to Backup UISP Application Data
Automatic/manual backup
For most users, it may be most convenient to use the automatic backup feature available since version 1.0.0. The list of automatic backups is available under Settings > Backups. At the same place, a fresh manual backup can be initialized in case the automatic one is too old. It is also possible to apply older backup here. These backups are automatically stored at /home/unms/data/unms-backups
in this format:
2020101502000000-auto-1.2.7.unms
Date - auto/manual - unms version.unms
Full backup (Archive)
In order to keep the size of automatic backups manageable, only the essential data is stored. For example, automatic backup doesn't contain stored firmware files. It is possible to create a full backup with absolutely everything on the UISP system, by making an archive from the /data
folder. The folder is located on this path /home/unms/data
on the Docker host and includes settings, logs, statistics, images, backups, and SSL certificates. In order to back up this data, it is necessary to pause the running containers. Then go to the directory, where docker-compose.yml is located (probably /home/unms
). Then archive the data and save it somewhere safe. As the final step, unpause the containers.
# go to your UISP home directory
cd /home/unms
#stop docker containers
sudo /home/unms/app/unms-cli stop
# pack the data directory
sudo tar -cvjSf uisp-data.tar.bz2 data
# start docker containers
sudo /home/unms/app/unms-cli start
This set of commands will create an archive for all UISP settings and data. Then it can be moved to another machine or archive.
How to Restore UISP
For large instances, it can take dozens of minutes to apply the backup. Please, be patient and do not interrupt the process.
Restore Automatic/manual backup
In the UISP user interface, just go to the section Settings > Backups and click on the Restore from file
button.
If the UISP GUI is not available here is a process on how to restore from CLI.
# stop docker containers
sudo /home/unms/app/unms-cli stop
# rename the current data folder
sudo mv /home/unms/data /home/unms/data_old
# run the installation script (make sure to include any optional tag that was used in previous installation)
sudo curl -fsSL https://unms.com/v1/install > /tmp/unms_inst.sh && sudo bash /tmp/unms_inst.sh
# show a list of all older automatic/manual backups
sudo ls -l /home/unms/data_old/unms-backups/backups/
# select the desired backup's name and restore it
sudo /home/unms/app/unms-cli restore-backup --file /home/unms/data_old/unms-backups/backups/<selected filename>
Have a backup
line at the bottom of the first screen.Restore Full backup (Archive)
Only the automatic/manual backup can be applied through GUI. Each full backup (archive) has to be applied through the command line. Please note that the archive 'uisp-data.tar.bz2' from the section above will be needed.
# go to your UISP home directory
cd /home/unms
#stop docker containers
sudo /home/unms/app/unms-cli stop
#rename the current data folder
sudo mv data data_old
#create the empty data folder
sudo mkdir data
# extraxt the data directory
sudo tar -xvjSf uisp-data.tar.bz2 data
# run the installation script (make sure to include any optional tag that was used in previous installation)
sudo curl -fsSL https://unms.com/v1/install > /tmp/unms_inst.sh && sudo bash /tmp/unms_inst.sh