Renamed to backup-docker

This commit is contained in:
Kevin Veen-Birkenbach 2023-11-16 16:55:16 +01:00
parent 83c93be87f
commit 0d4eb75afe
26 changed files with 67 additions and 67 deletions

View File

@ -34,7 +34,7 @@ This software shipts the following tools which are natively setup on the server:
- [Btrfs Health Check](./roles/health-btrfs/README.md) - Checks the health of Btrfs file systems - [Btrfs Health Check](./roles/health-btrfs/README.md) - Checks the health of Btrfs file systems
- [Docker Health Check](./roles/health-docker/) - Checks the health of docker containers - [Docker Health Check](./roles/health-docker/) - Checks the health of docker containers
- [Docker Reverse Proxy](./roles/docker-reverse-proxy/README.md) - Docker Reverse Proxy Solution - [Docker Reverse Proxy](./roles/docker-reverse-proxy/README.md) - Docker Reverse Proxy Solution
- [Docker Volume Backup](./roles/docker-volume-backup/) - Backup Solution for Docker Volumes - [Docker Volume Backup](./roles/backup-docker/) - Backup Solution for Docker Volumes
- [Pull Primary Backups](./roles/backups-consumer/README.md) - Pulls the backups from another server and stores them - [Pull Primary Backups](./roles/backups-consumer/README.md) - Pulls the backups from another server and stores them
- [Wireguard](./roles/wireguard/README.md) - Integrates the server in an wireguard vpn - [Wireguard](./roles/wireguard/README.md) - Integrates the server in an wireguard vpn

View File

@ -0,0 +1,3 @@
# Docker Volume Backup Cleanup
This script cleans up failed docker backups.
It uses https://github.com/kevinveenbirkenbach/backup-docker-cleanup as base.

View File

@ -0,0 +1,5 @@
- name: "reload backup-docker-cleanup.service daemon"
systemd:
name: backup-docker-cleanup.service
enabled: yes
daemon_reload: yes

View File

@ -0,0 +1,18 @@
- name: pull backup-docker-cleanup.git
git:
repo: "https://github.com/kevinveenbirkenbach/backup-docker-cleanup.git"
dest: "{{docker_volume_backup_cleanup_folder}}"
update: yes
register: git_result
ignore_errors: true
- name: Warn if repo is not reachable
debug:
msg: "Warning: Repository is not reachable."
when: git_result.failed
- name: configure backup-docker-cleanup.service
template:
src: backup-docker-cleanup.service.j2
dest: /etc/systemd/system/backup-docker-cleanup.service
notify: reload backup-docker-cleanup.service daemon

View File

@ -1 +1 @@
docker_volume_backup_cleanup_folder: "{{path_administrator_scripts}}docker-volume-backup-cleanup/" docker_volume_backup_cleanup_folder: "{{path_administrator_scripts}}backup-docker-cleanup/"

View File

@ -0,0 +1,12 @@
- name: "reload backup-docker.service"
systemd:
name: backup-docker.service
enabled: yes
daemon_reload: yes
- name: "restart backup-docker.timer"
systemd:
name: backup-docker.timer
state: started
enabled: yes
daemon_reload: yes

View File

@ -2,4 +2,4 @@ dependencies:
- git - git
- backups-provider - backups-provider
- systemd_notifier - systemd_notifier
- docker-volume-backup-cleanup - backup-docker-cleanup

View File

@ -5,9 +5,9 @@
- python-pandas - python-pandas
state: present state: present
- name: pull docker-volume-backup.git - name: pull backup-docker.git
git: git:
repo: "https://github.com/kevinveenbirkenbach/docker-volume-backup.git" repo: "https://github.com/kevinveenbirkenbach/backup-docker.git"
dest: "{{docker_volume_backup_folder}}" dest: "{{docker_volume_backup_folder}}"
update: yes update: yes
register: git_result register: git_result
@ -18,15 +18,15 @@
msg: "Warning: Repository is not reachable." msg: "Warning: Repository is not reachable."
when: git_result.failed when: git_result.failed
- name: configure docker-volume-backup.service - name: configure backup-docker.service
template: template:
src: docker-volume-backup.service.j2 src: backup-docker.service.j2
dest: /etc/systemd/system/docker-volume-backup.service dest: /etc/systemd/system/backup-docker.service
notify: reload docker-volume-backup.service notify: reload backup-docker.service
- name: configure docker-volume-backup.timer.tpl - name: configure backup-docker.timer.tpl
template: src=docker-volume-backup.timer.j2 dest=/etc/systemd/system/docker-volume-backup.timer template: src=backup-docker.timer.j2 dest=/etc/systemd/system/backup-docker.timer
notify: restart docker-volume-backup.timer notify: restart backup-docker.timer
- name: create {{docker_volume_backup_folder}}databases.csv - name: create {{docker_volume_backup_folder}}databases.csv
copy: copy:

View File

@ -0,0 +1,7 @@
[Unit]
Description=docker volume backup
OnFailure=systemd-notifier@%n.service backup-docker-cleanup.service
[Service]
Type=oneshot
ExecStart=/usr/bin/python {{docker_volume_backup_folder}}backup-docker.py

View File

@ -0,0 +1 @@
docker_volume_backup_folder: "{{path_administrator_scripts}}backup-docker/"

View File

@ -2,4 +2,4 @@ dependencies:
- git - git
- systemd_notifier - systemd_notifier
- backups-cleanup-timer - backups-cleanup-timer
- docker-volume-backup-cleanup - backup-docker-cleanup

View File

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=pull remote backups Description=pull remote backups
OnFailure=systemd-notifier@%n.service docker-volume-backup-cleanup.service OnFailure=systemd-notifier@%n.service backup-docker-cleanup.service
[Service] [Service]
Type=oneshot Type=oneshot

View File

@ -12,8 +12,8 @@ hashed_machine_id="$($get_hashed_machine_id | head -c 64)"
get_backup_types="find /Backups/$hashed_machine_id/ -maxdepth 1 -type d -execdir basename {} ;"; get_backup_types="find /Backups/$hashed_machine_id/ -maxdepth 1 -type d -execdir basename {} ;";
# @todo This configuration is not scalable yet. If other backup services then docker-volume-backup are integrated, this logic needs to be optimized # @todo This configuration is not scalable yet. If other backup services then backup-docker are integrated, this logic needs to be optimized
get_version_directories="ls -d /Backups/$hashed_machine_id/docker-volume-backup/*" get_version_directories="ls -d /Backups/$hashed_machine_id/backup-docker/*"
last_version_directory="$($get_version_directories | tail -1)" last_version_directory="$($get_version_directories | tail -1)"
rsync_command="sudo rsync --server --sender -blogDtpre.iLsfxCIvu . $last_version_directory/" rsync_command="sudo rsync --server --sender -blogDtpre.iLsfxCIvu . $last_version_directory/"

View File

@ -81,7 +81,7 @@ docker-compose build &&
docker-compose -p akaunting up -d --force-recreate docker-compose -p akaunting up -d --force-recreate
# recover all volumes # recover all volumes
cd {{path_administrator_scripts}}docker-volume-backup && cd {{path_administrator_scripts}}backup-docker &&
bash docker-volume-recover.sh akaunting_akaunting-modules ${machine_id:0:64} "$backup_version" && bash docker-volume-recover.sh akaunting_akaunting-modules ${machine_id:0:64} "$backup_version" &&
bash docker-volume-recover.sh akaunting_akaunting-data ${machine_id:0:64} "$backup_version" && bash docker-volume-recover.sh akaunting_akaunting-data ${machine_id:0:64} "$backup_version" &&
bash docker-volume-recover.sh akaunting_akaunting-db ${machine_id:0:64} "$backup_version" akaunting-db "$akaunting_db_password" akaunting bash docker-volume-recover.sh akaunting_akaunting-db ${machine_id:0:64} "$backup_version" akaunting-db "$akaunting_db_password" akaunting

View File

@ -30,7 +30,7 @@ waiting_time=600
blocker_running=True blocker_running=True
while blocker_running: while blocker_running:
try: try:
bash("systemctl is-active --quiet docker-volume-backup.service") bash("systemctl is-active --quiet backup-docker.service")
bash("systemctl is-active --quiet update-docker.service") bash("systemctl is-active --quiet update-docker.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.")

View File

@ -59,8 +59,8 @@ and disable the not functioning apps.
```bash ```bash
cd {{path_docker_compose_files}}nextcloud && cd {{path_docker_compose_files}}nextcloud &&
docker-compose down && docker-compose down &&
docker-compose exec -i database mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/docker-volume-backup/latest/nextcloud_database/sql/backup.sql" && docker-compose exec -i database mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/backup-docker/latest/nextcloud_database/sql/backup.sql" &&
cd {{path_administrator_scripts}}docker-volume-backup && cd {{path_administrator_scripts}}backup-docker &&
bash ./docker-volume-recover.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)" bash ./docker-volume-recover.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)"
``` ```

View File

@ -1,3 +0,0 @@
# Docker Volume Backup Cleanup
This script cleans up failed docker backups.
It uses https://github.com/kevinveenbirkenbach/docker-volume-backup-cleanup as base.

View File

@ -1,5 +0,0 @@
- name: "reload docker-volume-backup-cleanup.service daemon"
systemd:
name: docker-volume-backup-cleanup.service
enabled: yes
daemon_reload: yes

View File

@ -1,18 +0,0 @@
- name: pull docker-volume-backup-cleanup.git
git:
repo: "https://github.com/kevinveenbirkenbach/docker-volume-backup-cleanup.git"
dest: "{{docker_volume_backup_cleanup_folder}}"
update: yes
register: git_result
ignore_errors: true
- name: Warn if repo is not reachable
debug:
msg: "Warning: Repository is not reachable."
when: git_result.failed
- name: configure docker-volume-backup-cleanup.service
template:
src: docker-volume-backup-cleanup.service.j2
dest: /etc/systemd/system/docker-volume-backup-cleanup.service
notify: reload docker-volume-backup-cleanup.service daemon

View File

@ -1,12 +0,0 @@
- name: "reload docker-volume-backup.service"
systemd:
name: docker-volume-backup.service
enabled: yes
daemon_reload: yes
- name: "restart docker-volume-backup.timer"
systemd:
name: docker-volume-backup.timer
state: started
enabled: yes
daemon_reload: yes

View File

@ -1,7 +0,0 @@
[Unit]
Description=docker volume backup
OnFailure=systemd-notifier@%n.service docker-volume-backup-cleanup.service
[Service]
Type=oneshot
ExecStart=/usr/bin/python {{docker_volume_backup_folder}}docker-volume-backup.py

View File

@ -1 +0,0 @@
docker_volume_backup_folder: "{{path_administrator_scripts}}docker-volume-backup/"

View File

@ -1,5 +1,5 @@
dependencies: dependencies:
- docker-volume-backup - backup-docker
- user-administrator - user-administrator
- health-docker - health-docker
- docker-compose-restart-unhealthy - docker-compose-restart-unhealthy