Compare commits

...

2 Commits

Author SHA1 Message Date
337ccd9d71 Documentation 2023-02-10 21:18:09 +01:00
7dae7cb970 Docker data backup 2023-02-10 20:53:40 +01:00
3 changed files with 68 additions and 5 deletions

View File

@ -1 +1,55 @@
### TODO
# Backify 🗃️
I don't know why are You here, but I wouldn't be in Your skin.
## What's this ? 👾
Backify is a shell script that helps You automate backup of all kind of data from Linux systems.
What makes it different ? Most of backup scripts are specialised for one kind of data backup, while here You get to pick what do You want saved, reaching from system logs all the way to containers.
It was tailored to personal needs since there was no complete solution for the specific use case.
## How do I configure it ? 🧙‍♂️
All of the options are included in the backup.cfg file.
The script has an integrity check for the configuration, so no external command can be embedded into it by any kind of malware.
See the table below for configuration options
## Configuration options 🪄
|Name |Value |Specifics |
|----------------|-------------------------------|-----------------------------|
|Enabled|true/false |Disable the main function |
|www_backup|true/false |Backup of webroot directory |
|www_dir|------> |Path to webroot |
|vhost_backup|true/false |Backup of vhost configuration |
|vhost_dir |------> | Path to vhost files |
|log_backup |true/false |Backup log files |
|log_backup_web |true/false |Backup web app logs |
|apache |true/false |Enable Apache logs |
|nginx |true/false |Enable nginx logs |
|fail2ban_log |true/false |Enable fail2ban logs |
|log_purge |true/false |Truncate logs after backup |
|rsync_push |true/false |Push the backup file to remote server |
|push_clean |true/false |Delete the backup file after push |
|target_host |------> |Backup push target host |
|target_user |------> |Backup push target username |
|target_key |------> | Backup target ssh key |
|docker_enable |true/false |Enable Docker backups |
|docker_images |true/false |Backup Docker images |
|docker_volumes |true/false |Backup Docker volumes |
|docker_data |true/false |Backup container information |
## ToooooooDoooooooo
- [ ] Rsync implementation via shell
- [ ] Rsync implementation via Docker
- [ ] Cron scheduler
- [ ] RHEL/Ubuntu parser
- [ ] Automatic adjustments per system
- [ ] MySQL backups
- [ ] PostgreSQL backups

View File

@ -24,10 +24,8 @@ push_clean=false # clean backup file after push
target_host="127.0.0.1" # rsync target host
target_user="backup" # rsync target user
target_key='/home/xyz/.ssh/rsync' # rsync key
docker_enabled=false # will you use docker backup
docker_images=false # backup docker images
docker_volumes=false #backup docker volumes
#Rsync
#Daily cron
#Mysql dbs
docker_data=false #backup container information

11
main.sh
View File

@ -131,6 +131,17 @@ function dockerbackup {
echo "Finished" >&2
done
fi
if [ "docker_data" = true ] then
echo "Backing up container information..." >&2
for i in `docker inspect --format='{{.Name}}' $(docker ps -q) | cut -f2 -d\/`
do container_name=$i
echo -n "$container_name - "
container_data=`docker inspect $container_name`
mkdir -p $tmpdir/containers/$container_name
echo $container_data > $tmpdir/containers/$container_name/$container_name-data.txt
echo "Finished" >&2
done
fi
fi
}