Created a borgbackup script for deployments with nginx & uwsgi

master
b3yond 2019-07-07 19:20:05 +02:00
parent 87c263cb3f
commit 2ca213d88a
2 changed files with 32 additions and 0 deletions

View File

@ -178,6 +178,17 @@ sudo systemctl daemon-reload
sudo systemctl start ticketfrei-backend.service
```
### Backup
For automated backups, you need to backup these files:
* `/var/ticketfrei/db.sqlite`
* `/srv/ticketfrei/config.toml`
* `/etc/aliases`
You can find an example how to do this with borgbackup in the deployment
folder. Adjust it to your needs.
### Logs
There are several logfiles which you can look at:

21
deployment/backup.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# This is a script to backup the necessary components for a deployment with
# nginx and uwsgi with borgbackup.
# stop the services
service ticketfrei-web stop
service ticketfrei-backend stop
# export repository passphrase
export BORG_PASSPHRASE='password'
# create backup
borg create --stats --progress backup:repositories-borg/ticketfrei::'backup{now:%Y%m%d}' /etc/aliases /var/ticketfrei/db.sqlite /srv/ticketfrei/config.toml
# restart the service
service ticketfrei-backend start
service ticketfrei-web start
# prune outdated backups to save storage
borg prune --keep-daily=7 --keep-weekly=4 backup:repositories-borg/ticketfrei