From b2347d3fda6178891e51ccd4d5a2cac9c939cd85 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 18 Apr 2023 23:54:41 +0200 Subject: [PATCH] solved docker volume backup renaming bug --- roles/server_docker-akaunting/README.md | 2 +- roles/server_docker-nextcloud/README.md | 6 +++--- .../files/docker-compose-restart-unhealthy.py | 2 +- roles/server_native-docker-volume-backup/vars/main.yml | 2 +- roles/server_native-user-backup/templates/ssh-wrapper.sh.j2 | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/server_docker-akaunting/README.md b/roles/server_docker-akaunting/README.md index 806b86fe..2d5acbc1 100644 --- a/roles/server_docker-akaunting/README.md +++ b/roles/server_docker-akaunting/README.md @@ -81,7 +81,7 @@ server_docker-compose build && server_docker-compose -p akaunting up -d --force-recreate # recover all volumes -cd /home/administrator/scripts/server_docker-volume-backup && +cd /home/administrator/scripts/docker-volume-backup && bash server_docker-volume-recover.sh akaunting_akaunting-modules ${machine_id:0:64} "$backup_version" && bash server_docker-volume-recover.sh akaunting_akaunting-data ${machine_id:0:64} "$backup_version" && bash server_docker-volume-recover.sh akaunting_akaunting-db ${machine_id:0:64} "$backup_version" akaunting-db "$akaunting_db_password" akaunting diff --git a/roles/server_docker-nextcloud/README.md b/roles/server_docker-nextcloud/README.md index 182b7e02..b14a044c 100644 --- a/roles/server_docker-nextcloud/README.md +++ b/roles/server_docker-nextcloud/README.md @@ -13,7 +13,7 @@ NEXTCLOUD_APPLICATION_DOCKER_CONTAINER=nextcloud-application-1 To update the nextcloud container execute the following commands on the server: ```bash docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --on - sudo python /home/administrator/scripts/server_docker-volume-backup/server_docker-volume-backup.py + sudo python /home/administrator/scripts/docker-volume-backup/docker-volume-backup.py export COMPOSE_HTTP_TIMEOUT=600 export DOCKER_CLIENT_TIMEOUT=600 cd /home/administrator/server_docker-compose/nextcloud && server_docker-compose down @@ -57,8 +57,8 @@ and disable the not functioning apps. ```bash cd /home/administrator/server_docker-compose/nextcloud && server_docker-compose down && -docker exec -i nextcloud_database_1 mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/server_docker-volume-backup/latest/nextcloud_database/sql/backup.sql" && -cd /home/administrator/scripts/server_docker-volume-backup && +docker exec -i nextcloud_database_1 mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/docker-volume-backup/latest/nextcloud_database/sql/backup.sql" && +cd /home/administrator/scripts/docker-volume-backup && bash ./server_docker-volume-recover.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)" ``` diff --git a/roles/server_native-docker-compose-restart-unhealthy/files/docker-compose-restart-unhealthy.py b/roles/server_native-docker-compose-restart-unhealthy/files/docker-compose-restart-unhealthy.py index b691dc53..190d6902 100644 --- a/roles/server_native-docker-compose-restart-unhealthy/files/docker-compose-restart-unhealthy.py +++ b/roles/server_native-docker-compose-restart-unhealthy/files/docker-compose-restart-unhealthy.py @@ -30,7 +30,7 @@ waiting_time=600 backup_running=True while backup_running: try: - bash("systemctl is-active --quiet server_docker-volume-backup.service") + bash("systemctl is-active --quiet docker-volume-backup.service") print("backup is running.") print("trying again in " + str(waiting_time) + " seconds.") time.sleep(waiting_time) diff --git a/roles/server_native-docker-volume-backup/vars/main.yml b/roles/server_native-docker-volume-backup/vars/main.yml index af091388..d73c2dea 100644 --- a/roles/server_native-docker-volume-backup/vars/main.yml +++ b/roles/server_native-docker-volume-backup/vars/main.yml @@ -1 +1 @@ -docker_volume_backup_folder: "/home/administrator/scripts/server_docker-volume-backup/" \ No newline at end of file +docker_volume_backup_folder: "/home/administrator/scripts/docker-volume-backup/" \ No newline at end of file diff --git a/roles/server_native-user-backup/templates/ssh-wrapper.sh.j2 b/roles/server_native-user-backup/templates/ssh-wrapper.sh.j2 index d20e2577..2eb92b9d 100644 --- a/roles/server_native-user-backup/templates/ssh-wrapper.sh.j2 +++ b/roles/server_native-user-backup/templates/ssh-wrapper.sh.j2 @@ -10,8 +10,8 @@ fi get_hashed_machine_id="sha256sum /etc/machine-id"; get_backup_types="find /Backups/{{hashed_machine_id.stdout}}/ -maxdepth 1 -type d -execdir basename {} ;"; -# @todo This configuration is not scalable yet. If other backup services then server_docker-volume-backup are integrated, this logic needs to be optimized -get_static_last_version_dir="readlink -f /Backups/{{hashed_machine_id.stdout}}/server_docker-volume-backup/latest" +# @todo This configuration is not scalable yet. If other backup services then docker-volume-backup are integrated, this logic needs to be optimized +get_static_last_version_dir="readlink -f /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/latest" rsync_command="sudo rsync --server --sender -blogDtpre.iLsfxCIvu . $($get_static_last_version_dir)/" # filter commands