solved docker volume backup renaming bug

This commit is contained in:
Kevin Veen-Birkenbach 2023-04-18 23:54:41 +02:00
parent c20158e400
commit 0aacd81f6e
5 changed files with 8 additions and 8 deletions

View File

@ -81,7 +81,7 @@ server_docker-compose build &&
server_docker-compose -p akaunting up -d --force-recreate server_docker-compose -p akaunting up -d --force-recreate
# recover all volumes # 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-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-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 bash server_docker-volume-recover.sh akaunting_akaunting-db ${machine_id:0:64} "$backup_version" akaunting-db "$akaunting_db_password" akaunting

View File

@ -13,7 +13,7 @@ NEXTCLOUD_APPLICATION_DOCKER_CONTAINER=nextcloud-application-1
To update the nextcloud container execute the following commands on the server: To update the nextcloud container execute the following commands on the server:
```bash ```bash
docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --on 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 COMPOSE_HTTP_TIMEOUT=600
export DOCKER_CLIENT_TIMEOUT=600 export DOCKER_CLIENT_TIMEOUT=600
cd /home/administrator/server_docker-compose/nextcloud && server_docker-compose down cd /home/administrator/server_docker-compose/nextcloud && server_docker-compose down
@ -57,8 +57,8 @@ and disable the not functioning apps.
```bash ```bash
cd /home/administrator/server_docker-compose/nextcloud && cd /home/administrator/server_docker-compose/nextcloud &&
server_docker-compose down && 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" && 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/server_docker-volume-backup && cd /home/administrator/scripts/docker-volume-backup &&
bash ./server_docker-volume-recover.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)" bash ./server_docker-volume-recover.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)"
``` ```

View File

@ -30,7 +30,7 @@ waiting_time=600
backup_running=True backup_running=True
while backup_running: while backup_running:
try: 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("backup is running.")
print("trying again in " + str(waiting_time) + " seconds.") print("trying again in " + str(waiting_time) + " seconds.")
time.sleep(waiting_time) time.sleep(waiting_time)

View File

@ -1 +1 @@
docker_volume_backup_folder: "/home/administrator/scripts/server_docker-volume-backup/" docker_volume_backup_folder: "/home/administrator/scripts/docker-volume-backup/"

View File

@ -10,8 +10,8 @@ fi
get_hashed_machine_id="sha256sum /etc/machine-id"; get_hashed_machine_id="sha256sum /etc/machine-id";
get_backup_types="find /Backups/{{hashed_machine_id.stdout}}/ -maxdepth 1 -type d -execdir basename {} ;"; 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 # @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}}/server_docker-volume-backup/latest" 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)/" rsync_command="sudo rsync --server --sender -blogDtpre.iLsfxCIvu . $($get_static_last_version_dir)/"
# filter commands # filter commands