Working on Backing up the Server docs/scripts
This commit is contained in:
parent
3b27f2c01e
commit
e408dec828
|
@ -1 +1 @@
|
||||||
Airtime is down for maintenance. We'll be back soon!
|
Libretime is down for maintenance. We'll be back soon!
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
# Replace /backup with backup folder location!
|
||||||
|
# Used for backing up the media library
|
||||||
|
sudo rsync -aE --delete --info=progress2 /srv/airtime/stor/ /backup
|
||||||
|
|
||||||
|
# Used for backing up the database
|
||||||
|
sudo -u postgres pg_dumpall | gzip -c > libretime-db-backup.gz
|
||||||
|
sudo mv libretime-db-backup.gz /backup
|
||||||
|
|
||||||
|
# Used for backing up Libretime configs
|
||||||
|
sudo cp /etc/airtime/airtime.conf backup/airtime.conf.backup
|
||||||
|
|
||||||
|
# Write date/time of backup
|
||||||
|
date >> /backup/datelog.txt
|
|
@ -4,23 +4,45 @@ title: Backing Up Libretime
|
||||||
category: admin
|
category: admin
|
||||||
---
|
---
|
||||||
|
|
||||||
## Database Backup
|
## Backup
|
||||||
|
|
||||||
The following shell commands can be used for database backup and restore on a
|
You can dump the entire *PostgreSQL* database to a zipped file with the combination of the
|
||||||
running *PostgreSQL* server in an LibreTime system.
|
|
||||||
|
|
||||||
You can dump the entire database to a zipped file with the combination of the
|
|
||||||
**pg\_dumpall** command and **gzip**. The **pg\_dumpall** command is executed
|
**pg\_dumpall** command and **gzip**. The **pg\_dumpall** command is executed
|
||||||
as the user *postgres*, by using the **sudo** command and the **-u** switch. It
|
as the user *postgres*, by using the **sudo** command and the **-u** switch. It
|
||||||
is separated from the **gzip** command with the pipe symbol.
|
is separated from the **gzip** command with the pipe symbol.
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo -u postgres pg_dumpall | gzip -c > libretime-backup.gz
|
|
||||||
```
|
|
||||||
|
|
||||||
This command can be automated to run on a regular basis using the standard
|
This command can be automated to run on a regular basis using the standard
|
||||||
**cron** tool on your server.
|
**cron** tool on your server.
|
||||||
|
|
||||||
|
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.)
|
||||||
|
|
||||||
|
Two notible backup tools are [rsync](http://rsync.samba.org/) (without version control) and
|
||||||
|
[rdiff-backup](http://www.nongnu.org/rdiff-backup/) (with version control). *rsync* comes
|
||||||
|
preinstalled with Ubuntu Server.
|
||||||
|
|
||||||
|
> **Note:** Standard *rsync* backups cannot restore files deleted in the backup itself
|
||||||
|
|
||||||
|
```
|
||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
# Replace /backup with backup folder location!
|
||||||
|
# Used for backing up the media library
|
||||||
|
sudo rsync -aE --delete --info=progress2 /srv/airtime/stor/ /backup
|
||||||
|
|
||||||
|
# Used for backing up the database
|
||||||
|
sudo -u postgres pg_dumpall | gzip -c > libretime-db-backup.gz
|
||||||
|
sudo mv libretime-db-backup.gz /backup
|
||||||
|
|
||||||
|
# Write date/time of backup to file
|
||||||
|
date >> /backup/datelog.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Restore from a Backup
|
||||||
|
|
||||||
When restoring a production database on a cleanly installed LibreTime system, it
|
When restoring a production database on a cleanly installed LibreTime system, it
|
||||||
may be necessary to drop the empty database that was created during the new
|
may be necessary to drop the empty database that was created during the new
|
||||||
installation, by using the **dropdb** command. Again, this command is executed
|
installation, by using the **dropdb** command. Again, this command is executed
|
||||||
|
@ -39,8 +61,8 @@ To restore, first unzip the backup file with **gunzip**, then use the **psql**
|
||||||
command as the *postgres* user:
|
command as the *postgres* user:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gunzip libretime-backup.gz
|
gunzip libretime-db-backup.gz
|
||||||
sudo -u postgres psql -f libretime-backup
|
sudo -u postgres psql -f libretim-db-backup
|
||||||
```
|
```
|
||||||
|
|
||||||
You should now be able to log in to the LibreTime web interface in the usual way.
|
You should now be able to log in to the LibreTime web interface in the usual way.
|
||||||
|
@ -50,27 +72,3 @@ which is backed up by your storage backup tool of choice; for example, the
|
||||||
*/srv/airtime/database\_backups* directory. This should ensure that a storage
|
*/srv/airtime/database\_backups* directory. This should ensure that a storage
|
||||||
restore can be made along with a matching and complete version of the LibreTime
|
restore can be made along with a matching and complete version of the LibreTime
|
||||||
database from the day that the storage backup was made.
|
database from the day that the storage backup was made.
|
||||||
|
|
||||||
## Storage backup
|
|
||||||
|
|
||||||
Backing up the LibreTime database with **pg\_dumpall** will not back up the
|
|
||||||
LibreTime media storage server, which is likely to need a great deal more backup
|
|
||||||
space. Creating a compressed file from hundreds of gigabytes of storage server
|
|
||||||
contents is likely to take a very long time, and may have little benefit for the
|
|
||||||
amount of CPU power used, if the media files are already stored in a highly
|
|
||||||
compressed format. It is also impractical to copy very large backup files across
|
|
||||||
the network on a daily basis.
|
|
||||||
|
|
||||||
Instead, it is preferable to use an incremental backup technique to synchronize
|
|
||||||
the production LibreTime server storage with a backup server each day or night. 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.
|
|
||||||
|
|
||||||
A standard incremental backup tool on GNU/Linux servers is [rsync](http://rsync.samba.org/) which can be installed
|
|
||||||
using the package manager of your GNU/Linux distribution. However, incremental
|
|
||||||
backup alone cannot help in the scenario where a file which later proves to be
|
|
||||||
important has been deleted by an administrator. For backups that can be rolled
|
|
||||||
back to restore from an earlier date than the current backup, the tool
|
|
||||||
[rdiff-backup](http://www.nongnu.org/rdiff-backup/) can
|
|
||||||
be deployed.
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ title: Dashboard
|
||||||
category: interface
|
category: interface
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> Want to listen to Libretime's output stream? Click **Listen** below the **On Air** light.
|
||||||
|
|
||||||
The Dashboard is divided into two sections a Library section divided between
|
The Dashboard is divided into two sections a Library section divided between
|
||||||
Tracks, Playlists, Smart Blocks, Webstreams, and Podcasts, with the **Scheduled
|
Tracks, Playlists, Smart Blocks, Webstreams, and Podcasts, with the **Scheduled
|
||||||
Shows** dialog on the right. This page provides an overview of the right-hand
|
Shows** dialog on the right. This page provides an overview of the right-hand
|
||||||
|
|
|
@ -6,7 +6,7 @@ category: admin
|
||||||
|
|
||||||
The LibreTime administration interface can be localized using the standard GNU **gettext** method. Using GitHub for this task means you don't have to tackle the whole of a localization yourself; just as much as you can manage.
|
The LibreTime administration interface can be localized using the standard GNU **gettext** method. Using GitHub for this task means you don't have to tackle the whole of a localization yourself; just as much as you can manage.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
First, you should check if a localization is already under way for your locale of choice. The best way to do this is to take a look at the 'master' branch in the GitHub repository for LibreTime at <https://github.com/LibreTime/libretime>. You can also ask in the LibreTime development forum at <https://discourse.libretime.org/>, where you might find community members who can help you with the translation.
|
First, you should check if a localization is already under way for your locale of choice. The best way to do this is to take a look at the 'master' branch in the GitHub repository for LibreTime at <https://github.com/LibreTime/libretime>. You can also ask in the LibreTime development forum at <https://discourse.libretime.org/>, where you might find community members who can help you with the translation.
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,12 @@ category: dev
|
||||||
---
|
---
|
||||||
|
|
||||||
[Multipass](https://multipass.run) is a tool for easily setting up Ubuntu VMs on Windows, Mac, and Linux.
|
[Multipass](https://multipass.run) is a tool for easily setting up Ubuntu VMs on Windows, Mac, and Linux.
|
||||||
Similar to Docker, Multipass works through a CLI. To use, clone this repo and then open a Terminal (or Command Prompt) inside the created folder and run
|
Similar to Docker, Multipass works through a CLI. To use, clone this repo and then create a new Multipass VM.
|
||||||
|
|
||||||
```
|
```
|
||||||
multipass launch bionic -n ltTEST --cloud-init multipass.yaml
|
git clone https://github.com/libretime/libretime.git
|
||||||
|
cd libretime
|
||||||
|
multipass launch bionic -n ltTEST --cloud-init cloud-init.yaml
|
||||||
multipass shell ltTEST
|
multipass shell ltTEST
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -16,7 +18,8 @@ Multipass isn't currently able to do an automated install from the cloud-init sc
|
||||||
After you enter the shell for the first time, you will still need to run the install script for LibreTime.
|
After you enter the shell for the first time, you will still need to run the install script for LibreTime.
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo ./libretime/install -fiap
|
cd libretime
|
||||||
|
sudo bash install -fiap
|
||||||
```
|
```
|
||||||
|
|
||||||
The IP address of your new VM can be found by running `multipass list`. Copy and paste it into your web browser to access the LibreTime interface and complete the setup wizard.
|
The IP address of your new VM can be found by running `multipass list`. Copy and paste it into your web browser to access the LibreTime interface and complete the setup wizard.
|
||||||
|
|
|
@ -79,9 +79,8 @@ cd libretime
|
||||||
vagrant up ubuntu-xenial
|
vagrant up ubuntu-xenial
|
||||||
```
|
```
|
||||||
|
|
||||||
If everything works out, you will find LibreTime on [port 8080](http://localhost:8080),
|
If everything works out, you will find LibreTime on [port 8080](http://localhost:8080)
|
||||||
icecast on [port 8000](http://localhost:8000) and the docs on
|
and Icecast on [port 8000](http://localhost:8000).
|
||||||
[port 8888](http://localhost:8888).
|
|
||||||
|
|
||||||
Once you reach the web setup GUI you can click through it using the default values. To
|
Once you reach the web setup GUI you can click through it using the default values. To
|
||||||
connect to the vagrant machine you can run `vagrant ssh ubuntu-xenial` in the libretime
|
connect to the vagrant machine you can run `vagrant ssh ubuntu-xenial` in the libretime
|
||||||
|
|
|
@ -1,7 +1,27 @@
|
||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
|
title: Search
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<section class="bg-primary">
|
||||||
|
<div class="container">
|
||||||
|
<div class="d-flex mh-25rem pt-11 py-6">
|
||||||
|
<div class="align-self-center">
|
||||||
|
<h1 class="text-white font-weight-light mb-3">{{ page.title }}</h1>
|
||||||
|
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb breadcrumb-light">
|
||||||
|
<li class="breadcrumb-item"><a href="/">Home</a></li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">Search</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="pt-11 pb-6">
|
<section class="pt-11 pb-6">
|
||||||
<div class="container-lg">
|
<div class="container-lg">
|
||||||
{% include search-lunr.html %}
|
{% include search-lunr.html %}
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
#check if root
|
|
||||||
if os.geteuid() != 0:
|
|
||||||
print 'Must be a root user.'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
#ask if we should backup config files
|
|
||||||
backup_config = True
|
|
||||||
|
|
||||||
#ask if we should backup database
|
|
||||||
backup_database = True
|
|
||||||
|
|
||||||
#ask if we should backup stor directory
|
|
||||||
backup_stor = True
|
|
||||||
|
|
||||||
#ask if we should backup all watched directories
|
|
||||||
backup_watched = True
|
|
||||||
|
|
||||||
#create airtime-backup directory
|
|
||||||
os.mkdir("airtime_backup")
|
|
||||||
|
|
||||||
if backup_config:
|
|
||||||
backup_config_dir = "airtime_backup/config"
|
|
||||||
os.mkdir(backup_config_dir)
|
|
||||||
#TODO check if directory exists
|
|
||||||
config_dir = "/etc/airtime"
|
|
||||||
files = os.listdir()
|
|
||||||
for f in files:
|
|
||||||
shutil.copy(os.path.join(config_dir, f), \
|
|
||||||
os.path.join(backup_config_dir, f)
|
|
||||||
|
|
||||||
if backup_database:
|
|
||||||
os.mkdir("airtime_backup/database")
|
|
||||||
#TODO: get database name
|
|
||||||
#TODO use abs path
|
|
||||||
"pg_dump airtime > database.dump.sql"
|
|
||||||
|
|
||||||
#TODO this might not be necessary
|
|
||||||
os.mkdir("airtime_backup/files")
|
|
||||||
|
|
||||||
if backup_stor:
|
|
||||||
#TODO use abs path
|
|
||||||
backup_stor_dir = "airtime_backup/files/stor"
|
|
||||||
os.mkdir(backup_stor_dir)
|
|
||||||
shutil.copytree("/srv/airtime/stor", backup_stor_dir)
|
|
||||||
|
|
||||||
if backup_watched:
|
|
||||||
pass
|
|
||||||
|
|
Loading…
Reference in New Issue