Removed backup over kevinveenbirkenbach/alpine-rsync

This commit is contained in:
Kevin Veen-Birkenbach 2022-03-17 20:29:27 +01:00
parent 2776c35da6
commit 5bb95d61f4

View File

@ -43,13 +43,10 @@ for volume_name in volume_names:
print('skipped due to no running containers using this volume.');
else:
container=containers[0]
source_path_command="docker inspect --format \"{{ range .Mounts }}{{ if eq .Type \\\"volume\\\"}}{{ if eq .Name \\\"" + volume_name +"\\\"}}{{ println .Destination }}{{ end }}{{ end }}{{ end }}\" \""+ container +"\""
source_path_command_result_filtered=list(filter(None, bash(source_path_command)))
for source_path in source_path_command_result_filtered:
source_path="/var/lib/docker/volumes/" + volume_name + "/_data"
destination_path=backup_repository_folder+"latest/"+ volume_name
log_path=backup_repository_folder + "log.txt"
backup_dir_path=backup_repository_folder + "diffs/"+ backup_time + "/" + volume_name
databases_entries=databases.loc[databases['container'] == container];
if len(databases_entries) == 1:
print("Backup database...")
@ -70,7 +67,7 @@ for volume_name in volume_names:
pathlib.Path(files_destination_path).mkdir(parents=True, exist_ok=True)
print("stop containers...");
print_bash("docker stop " + list_to_string(containers))
print_bash("docker run --rm --volumes-from " + container + " -v "+backups_folder+":"+ backups_folder +" \"kevinveenbirkenbach/alpine-rsync\" sh -c \"rsync -abP --delete --delete-excluded --log-file=" + log_path +" --backup-dir=" + files_backup_dir_path +" '"+ source_path +"/' " + files_destination_path +"\"")
print_bash("rsync -abP --delete --delete-excluded --log-file=" + log_path +" --backup-dir=" + files_backup_dir_path +" '"+ source_path +"/' " + files_destination_path)
print("start containers...")
print_bash("docker start " + list_to_string(containers))
print("end backup routine for volume:" + volume_name)