forked from ramirojoaquin/vestacp-borg-incremental-backups
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.ini
86 lines (67 loc) · 3.46 KB
/
config.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin:/bin:/usr/local/vesta/bin:/usr/local/hestia/bin
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
# This config file set the global variables for all backup and restore scripts.
##### What to backup #####
HOME_DIR=/home # Where user directories are placed
SCRIPTS_DIR=/root/scripts # Where custom scripts are stored
ETC_DIR=/etc # Server level config files
if [ -d /usr/local/hestia ]; then PANELNAME=hestia; else PANELNAME=vesta; fi
VESTA_DIR=/usr/local/$PANELNAME # Where Vesta CP files are stored
##### What NOT to backup #####
# This scrupt treats all dirs under /home as "users"
# Put here the users or dirs under /home that you dont want to backup, separated by , Ex: "user,user2,otheruser"
EXCLUDED_USERS=backup
##### Where to backup #####
BACKUP_DIR=/backup/borg # Global backup directory, inside this dir the script creates the different repo dirs.
ARCHIVE_DIR=$BACKUP_DIR/offline # Is where offline users / archived users are stored. Incremental backups will not execute in archived users.
##### How many backups to keep (-1 for infinite) #####
BACKUP_DAYS=15
BACKUP_WEEKS=6
BACKUP_MONTHS=3
##### Dir names #####
PUBLIC_HTML_DIR_NAME=public_html
DB_DUMP_DIR_NAME=db_dumps
##### Encription settings #####
# Available modes BLAKE2b, SHA-256 or none
# BLAKE2b is faster on new CPUs
# SHA-256 is faster on old CPUs (whitout AES hardware encription features)
ENCRIPTION_MODE="none"
# Enter secret passprase to encription
BORG_PASSPHRASE="Enter secret passprase to encription"
##### BORG config #####
OPTIONS_INIT="--encryption=$ENCRIPTION_MODE"
OPTIONS_CREATE="-sv --compression lz4"
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes # Leave yes if when you run the script via cron to avoid missing borg cache files.
export HOME=/root # Sometimes when you run via cron, you need to export home directory, so borg can find cache files
# Its very useful to have a backup mirror in other location, just in case the main server goes down
##### Backup dir sync to remote server. Leave blank to skip #####
# !!!!!!!!! WARNING, THE DESTINATION DIR IN THE REMOTE SERVER WILL BE COMPLETELY OVERWRITTEN !!!!!!!!!!
# !!!!!!!!! Setup a passwordless ssh connection to remote server before using this feature
REMOTE_BACKUP_SERVER=
REMOTE_BACKUP_SERVER_PORT=22
REMOTE_BACKUP_SERVER_USER=root
REMOTE_BACKUP_SERVER_DIR=
# include local configuration
if [ -f "$CURRENT_DIR/config-local.ini" ]; then
source $CURRENT_DIR/config-local.ini
fi
# это чтоб можно было переназначить сколько копий хранить
OPTIONS_PRUNE="-v --keep-within=10d --keep-daily=$BACKUP_DAYS --keep-weekly=$BACKUP_WEEKS --keep-monthly=$BACKUP_MONTHS"
if [ ! -z "$REMOTE_BACKUP_SERVER" ];
then
if [ -z "$REMOTE_BACKUP_SERVER_DIR" ]; then
REMOTE_BACKUP_SERVER_DIR="/home/$REMOTE_BACKUP_SERVER_USER/borg"
fi
BACKUP_DIR_LOCAL=$BACKUP_DIR
BACKUP_DIR=ssh://$REMOTE_BACKUP_SERVER_USER@$REMOTE_BACKUP_SERVER:$REMOTE_BACKUP_SERVER_PORT$REMOTE_BACKUP_SERVER_DIR
ssh -p $REMOTE_BACKUP_SERVER_PORT $REMOTE_BACKUP_SERVER_USER@$REMOTE_BACKUP_SERVER mkdir -p $REMOTE_BACKUP_SERVER_DIR/home
else
mkdir -p $BACKUP_DIR/home
fi
# This is where individual users repositories will be created
REPO_USERS_DIR=$BACKUP_DIR/home
# Sever level repositories
REPO_SCRIPTS=$BACKUP_DIR/scripts
REPO_ETC=$BACKUP_DIR/etc
REPO_VESTA=$BACKUP_DIR/$PANELNAME