sintonia/docs/server-config/backing-up-the-server.md

69 lines
2.2 KiB
Markdown
Raw Normal View History

---
title: Backing up LibreTime
---
:::info
At the moment, there is no script to cleanly restore a LibreTime backup. To restore a LibreTime backup, install a fresh copy, go through the standard setup process, and reupload the backed-up media files.
:::
A backup script is supplied for your convenience in the `utils/` folder of the LibreTime repo.
2020-11-22 04:37:19 +01:00
Run it using:
2020-11-19 17:59:27 +01:00
```
sudo bash libretime-backup.sh # backs up to user's home folder
# or
sudo bash libretime-backup.sh /backupdir/
```
2020-11-22 04:37:19 +01:00
The backup process can be automated with Cron. Simply add the following to the root user's
2020-11-23 19:58:55 +01:00
crontab with `sudo crontab -e`:
2020-11-22 04:37:19 +01:00
```
2020-11-23 19:58:55 +01:00
0 0 1 * * /locationoflibretimerepo/libretime/backup.sh
2020-11-22 04:37:19 +01:00
```
> For more information on how Cron works, check out [this Redhat guide](https://www.redhat.com/sysadmin/automate-linux-tasks-cron).
2021-05-27 16:20:34 +02:00
If you wish to deploy your own backup solution, the following files and folders need to
2020-11-23 19:58:55 +01:00
be backed up.
2020-11-19 17:59:27 +01:00
2020-11-23 19:58:55 +01:00
```
/srv
/airtime
/stor
2021-05-27 15:59:00 +02:00
/imported - Successfully imported media
2020-11-23 19:58:55 +01:00
/organize - A temporary holding place for uploaded media as the importer works
/etc
/airtime
airtime.conf - The main LibreTime configuration
2020-11-23 19:58:55 +01:00
icecast_pass - Holds the password for the Icecast server
liquidsoap.cfg - The main configuration file for Liquidsoap
```
2021-05-27 16:20:34 +02:00
In addition, you should keep a copy of the database current to the backup. The below code
can be used to export the LibreTime database to a file.
2020-11-23 19:58:55 +01:00
```
2021-05-27 16:20:34 +02:00
sudo -u postgres pg_dumpall filename
2020-11-23 19:58:55 +01:00
# or to a zipped archive
sudo -u postgres pg_dumpall | gzip -c > archivename.gz
```
It is recommended to use an incremental backup technique to synchronize
the your LibreTime track library with a backup server regularly. (If
the backup server also contains an LibreTime installation, it should be possible
to switch playout to this second machine relatively quickly, in case of a
hardware failure or other emergency on the production server.)
2022-02-09 11:41:25 +01:00
Two notible backup tools are [rsync](https://rsync.samba.org/) (without version control) and
[rdiff-backup](https://rdiff-backup.net/) (with version control). _rsync_ comes
preinstalled with Ubuntu Server.
:::note
Standard rsync backups, which are used by the backup script, cannot restore files deleted in the backup itself
:::