|
1 year ago | |
---|---|---|
backup | 1 year ago | |
scripts | 1 year ago | |
.gitignore | 1 year ago | |
LICENSE | 2 years ago | |
MANIFEST.in | 1 year ago | |
README.md | 2 years ago | |
central-backup.yaml | 1 year ago | |
check_mount | 1 year ago | |
host.yml | 2 years ago | |
script_template.py | 1 year ago | |
setup.py | 1 year ago |
- make and activate a virtualenv
- pip install git+https://git.tng-concepts.com/TNG/central-backup
Sudo password will be ask to
- copy central_backup utility in /usr/local/bin.
- create /etc/central-backup directories
- create a default config files
- create your hosts to backup under /etc/central-backup/conf.d (see below)
- fill /etc/central-backup/config.yml
- Run central_backup fix (fix permissions) and central_backup schedule (crontab creation)
You got it !
Python utility to manage centralized backups with ssh.
Usage:
central_backup (backup | restore | fix | schedule) [options]
central_backup (backup | restore) (--databases=<STR> --hosts=<STR>) [--features=<STR>]
central_backup (backup | restore) [--hosts=<STR>] [--features=<STR>]
Commands:
backup Launch backup action.
restore Launch restore action
schedule Crontab creation regarding schedule information in host files.
fix Fix 600 permissions on /etc/central-backup/*
Options:
-h --help Show this screen.
-n --hosts HOSTS Host(,) to backup. Comma for multiple hosts
-d --databases DB Database to backup. Comma for multiple DBs
-f --features FEATURES Features to execute on backup (eg: databases, files)
BACKUP_DIRECTORY: /my/backup/directory/
NOTIFICATIONS:
from: user@domain.com
to: user@domain.com
level: error # ERROR or INFO
server: mail.domain.com # SSL support mandatory
pogin: user
password: password
RETENTION:
months: 120
weeks: 4
days: 7
SCHEDULE:
default_hour: 01:00
default_day: monday
Per host configuration take places in :
/etc/central-backups/conf.d
--- my_host.yml ---
hostname: my_host_name
# hostname with dns resolution (local or remote)
working_dir: /home/user/backup
# place on host for dump data (automatic creation)
user: user
# ssh user for connection. Make sudo ssh-copy-id for it.
sudo_password: my_sudo (optional)
# if need for some file access.
schedule: daily
# scheduling, see below for possible options.
databases:
#databases section to list db to backup
- db: my_db_name
dbtype: my_db_type (psql|mysql)
user: my_db_user
password: my_db_password
exclude: [] # table to exclude, not working now
files:
#files section to list directories to backup
- /etc/supervisor
- /etc/nginx/sites-enabled
- /etc/nginx/sites-available
- /etc/nginx/cert
every|at|option:option_value::other_option:other_option_value
# special format
schedule: (daily|weekly|monthly|hourly)
# cron format
schedule: "15 10 * * *"
# multiple schedule, custom format
# every|at|option:option_value::other_option:other_option_value
schedule:
- 6.hour|minute.15|databases:mydatabases::features:databases
- 1.day|minute.15|features:files