mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-18 06:24:25 +02:00
Shorted backup- to bkp-
This commit is contained in:
parent
d0bd33fee3
commit
9668e74139
@ -15,7 +15,7 @@ Every business is unique, and so is CyMaIS! With a modular architecture, it adap
|
|||||||
With automated updates, system health checks, and security audits, CyMaIS ensures your infrastructure is always up-to-date and running smoothly. Roles such as `mon-bot-docker-container`, `mon-bot-btrfs`, and `mon-bot-webserver` help monitor system integrity.
|
With automated updates, system health checks, and security audits, CyMaIS ensures your infrastructure is always up-to-date and running smoothly. Roles such as `mon-bot-docker-container`, `mon-bot-btrfs`, and `mon-bot-webserver` help monitor system integrity.
|
||||||
|
|
||||||
## Uncompromised Security 🔒
|
## Uncompromised Security 🔒
|
||||||
Security is a top priority! CyMaIS includes robust security features like full-disk encryption recommendations, 2FA enforcement, encrypted server deployments (`web-app-keycloak`, `service-openldap`), and secure backup solutions (`backup-remote-to-local`, `backup-data-to-usb`).
|
Security is a top priority! CyMaIS includes robust security features like full-disk encryption recommendations, 2FA enforcement, encrypted server deployments (`web-app-keycloak`, `service-openldap`), and secure backup solutions (`bkp-remote-to-local`, `bkp-data-to-usb`).
|
||||||
|
|
||||||
## User-Friendly with Expert Support 👩💻
|
## User-Friendly with Expert Support 👩💻
|
||||||
No need to be a Linux or Docker expert! CyMaIS simplifies deployment with intuitive role-based automation. Documentation and community support make IT administration accessible to all experience levels.
|
No need to be a Linux or Docker expert! CyMaIS simplifies deployment with intuitive role-based automation. Documentation and community support make IT administration accessible to all experience levels.
|
||||||
|
@ -10,7 +10,7 @@ Follow these guides to install and configure CyMaIS:
|
|||||||
|
|
||||||
## Key Responsibilities 🔧
|
## Key Responsibilities 🔧
|
||||||
- **User Management** - Configure LDAP, Keycloak, and user permissions.
|
- **User Management** - Configure LDAP, Keycloak, and user permissions.
|
||||||
- **Security & Backups** - Set up `backup-remote-to-local`, `backup-data-to-usb`, and `core-security` roles.
|
- **Security & Backups** - Set up `bkp-remote-to-local`, `bkp-data-to-usb`, and `core-security` roles.
|
||||||
- **Application Hosting** - Deploy services like `Nextcloud`, `Matrix`, `Gitea`, and more.
|
- **Application Hosting** - Deploy services like `Nextcloud`, `Matrix`, `Gitea`, and more.
|
||||||
- **Networking & VPN** - Configure `WireGuard`, `OpenVPN`, and `Nginx Reverse Proxy`.
|
- **Networking & VPN** - Configure `WireGuard`, `OpenVPN`, and `Nginx Reverse Proxy`.
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ system_maintenance_lock_timeout_restart_docker: "{{system_maintenance_lock_ti
|
|||||||
|
|
||||||
### Defined Services for Backup Tasks
|
### Defined Services for Backup Tasks
|
||||||
system_maintenance_backup_services:
|
system_maintenance_backup_services:
|
||||||
- "backup-docker-to-local"
|
- "bkp-docker-to-local"
|
||||||
- "backup-remote-to-local"
|
- "bkp-remote-to-local"
|
||||||
- "backup-data-to-usb"
|
- "bkp-data-to-usb"
|
||||||
- "backup-docker-to-local-everything"
|
- "bkp-docker-to-local-everything"
|
||||||
|
|
||||||
### Defined Services for System Cleanup
|
### Defined Services for System Cleanup
|
||||||
system_maintenance_cleanup_services:
|
system_maintenance_cleanup_services:
|
||||||
|
@ -85,7 +85,7 @@ For a complete list of role categories and detailed definitions, see:
|
|||||||
|
|
||||||
## Backup & Restore
|
## Backup & Restore
|
||||||
|
|
||||||
- **backup-***
|
- **bkp-***
|
||||||
Local and remote backup strategies for files, Docker volumes, databases.
|
Local and remote backup strategies for files, Docker volumes, databases.
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -113,7 +113,7 @@ For a complete list of role categories and detailed definitions, see:
|
|||||||
> **Tip:** To find a role quickly, search for its prefix:
|
> **Tip:** To find a role quickly, search for its prefix:
|
||||||
> `core-`, `generic-`, `desk-`, `webserver-`, `web-service-`, `web-app-`,
|
> `core-`, `generic-`, `desk-`, `webserver-`, `web-service-`, `web-app-`,
|
||||||
> `network-`, `service-`, `monitor-`, `alert-`, `maint-`, `cleanup-`,
|
> `network-`, `service-`, `monitor-`, `alert-`, `maint-`, `cleanup-`,
|
||||||
> `backup-`, `update-`, `pkgmgr-`, `user-`.
|
> `bkp-`, `update-`, `pkgmgr-`, `user-`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
- name: "reload backup-data-to-usb.cymais.service"
|
|
||||||
systemd:
|
|
||||||
name: backup-data-to-usb.cymais.service
|
|
||||||
state: reloaded
|
|
||||||
daemon_reload: yes
|
|
@ -1,9 +0,0 @@
|
|||||||
- name: "reload backup-docker-to-local-everything.cymais.service"
|
|
||||||
systemd:
|
|
||||||
name: backup-docker-to-local-everything.cymais.service
|
|
||||||
daemon_reload: yes
|
|
||||||
|
|
||||||
- name: "reload backup-docker-to-local.cymais.service"
|
|
||||||
systemd:
|
|
||||||
name: backup-docker-to-local.cymais.service
|
|
||||||
daemon_reload: yes
|
|
@ -1,4 +0,0 @@
|
|||||||
- name: "reload backup-remote-to-local service"
|
|
||||||
systemd:
|
|
||||||
name: backup-remote-to-local.cymais.service
|
|
||||||
daemon_reload: yes
|
|
@ -21,7 +21,7 @@ def main():
|
|||||||
machine_id = subprocess.run(["sha256sum", "/etc/machine-id"], capture_output=True, text=True).stdout.strip()[:64]
|
machine_id = subprocess.run(["sha256sum", "/etc/machine-id"], capture_output=True, text=True).stdout.strip()[:64]
|
||||||
print(f"machine id: {machine_id}")
|
print(f"machine id: {machine_id}")
|
||||||
|
|
||||||
versions_path = os.path.join(backup_to_usb_destination_path, f"{machine_id}/backup-data-to-usb/")
|
versions_path = os.path.join(backup_to_usb_destination_path, f"{machine_id}/bkp-data-to-usb/")
|
||||||
print(f"versions path: {versions_path}")
|
print(f"versions path: {versions_path}")
|
||||||
|
|
||||||
if not os.path.isdir(versions_path):
|
if not os.path.isdir(versions_path):
|
5
roles/bkp-data-to-usb/handlers/main.yml
Normal file
5
roles/bkp-data-to-usb/handlers/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
- name: "reload bkp-data-to-usb.cymais.service"
|
||||||
|
systemd:
|
||||||
|
name: bkp-data-to-usb.cymais.service
|
||||||
|
state: reloaded
|
||||||
|
daemon_reload: yes
|
@ -1,6 +1,6 @@
|
|||||||
- name: Copy backup script to the scripts directory
|
- name: Copy backup script to the scripts directory
|
||||||
copy:
|
copy:
|
||||||
src: backup-data-to-usb.python
|
src: bkp-data-to-usb.python
|
||||||
dest: "{{ backup_to_usb_script_path }}"
|
dest: "{{ backup_to_usb_script_path }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
- name: Copy systemd service to systemd directory
|
- name: Copy systemd service to systemd directory
|
||||||
template:
|
template:
|
||||||
src: backup-data-to-usb.service.j2
|
src: bkp-data-to-usb.service.j2
|
||||||
dest: /etc/systemd/system/backup-data-to-usb.cymais.service
|
dest: /etc/systemd/system/bkp-data-to-usb.cymais.service
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
notify: reload backup-data-to-usb.cymais.service
|
notify: reload bkp-data-to-usb.cymais.service
|
@ -1,4 +1,4 @@
|
|||||||
backup_to_usb_script_path: "/usr/local/sbin/backup-data-to-usb.python"
|
backup_to_usb_script_path: "/usr/local/sbin/bkp-data-to-usb.python"
|
||||||
backup_to_usb_destination: "{{backup_to_usb_mount}}{{backup_to_usb_destination_subdirectory}}"
|
backup_to_usb_destination: "{{backup_to_usb_mount}}{{backup_to_usb_destination_subdirectory}}"
|
||||||
backups_folder_path: "{{backup_to_usb_destination}}"
|
backups_folder_path: "{{backup_to_usb_destination}}"
|
||||||
systemctl_mount_service_name: "{{ backup_to_usb_mount | trim('/') | replace('/', '-') }}.mount"
|
systemctl_mount_service_name: "{{ backup_to_usb_mount | trim('/') | replace('/', '-') }}.mount"
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
This Ansible role installs the [directory-validator](https://github.com/kevinveenbirkenbach/directory-validator.git). It is used by the backup-docker-to-local and cleanup-failed-docker-backups roles to verify whether backups have been successfully created.
|
This Ansible role installs the [directory-validator](https://github.com/kevinveenbirkenbach/directory-validator.git). It is used by the bkp-docker-to-local and cleanup-failed-docker-backups roles to verify whether backups have been successfully created.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
@ -16,5 +16,5 @@ The primary purpose of this role is to validate backup directories. By fetching
|
|||||||
|
|
||||||
- **Git Repository Pull:** Automatically pulls the latest version of the directory-validator from Git.
|
- **Git Repository Pull:** Automatically pulls the latest version of the directory-validator from Git.
|
||||||
- **Idempotent Execution:** Ensures that the repository is fetched only once per playbook run.
|
- **Idempotent Execution:** Ensures that the repository is fetched only once per playbook run.
|
||||||
- **Backup Verification:** Serves as a validation step for other backup-related roles.
|
- **Backup Verification:** Serves as a validation step for other bkp-related roles.
|
||||||
- **Configurable Destination:** The target folder is customizable via the `backup_directory_validator_folder` variable.
|
- **Configurable Destination:** The target folder is customizable via the `backup_directory_validator_folder` variable.
|
@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
This Ansible role automates the process of backing up Docker volumes to a local folder. It pulls the [backup-docker-to-local repository](https://github.com/kevinveenbirkenbach/backup-docker-to-local.git), installs required software, configures systemd services for both standard and "everything" backup modes, and seeds backup database entries as needed.
|
This Ansible role automates the process of backing up Docker volumes to a local folder. It pulls the [bkp-docker-to-local repository](https://github.com/kevinveenbirkenbach/bkp-docker-to-local.git), installs required software, configures systemd services for both standard and "everything" backup modes, and seeds backup database entries as needed.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Optimized for Archlinux, this role ensures that Docker volume backups are performed reliably with minimal manual intervention. It integrates with several dependent roles to verify backup success and manage related tasks, including:
|
Optimized for Archlinux, this role ensures that Docker volume backups are performed reliably with minimal manual intervention. It integrates with several dependent roles to verify backup success and manage related tasks, including:
|
||||||
- [backup-directory-validator](../backup-directory-validator/) – Validates backup directories.
|
- [bkp-directory-validator](../bkp-directory-validator/) – Validates backup directories.
|
||||||
- [cleanup-failed-docker-backups](../cleanup-failed-docker-backups/) – Cleans up unsuccessful backup attempts.
|
- [cleanup-failed-docker-backups](../cleanup-failed-docker-backups/) – Cleans up unsuccessful backup attempts.
|
||||||
- [generic-timer](../generic-timer/) – Schedules recurring backup tasks.
|
- [generic-timer](../generic-timer/) – Schedules recurring backup tasks.
|
||||||
- [backup-provider](../backup-provider/) – Manages backup sources.
|
- [bkp-provider](../bkp-provider/) – Manages backup sources.
|
||||||
- [maint-lock](../maint-lock/) – Ensures coordinated maintenance operations.
|
- [maint-lock](../maint-lock/) – Ensures coordinated maintenance operations.
|
||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
@ -20,7 +20,7 @@ Backup Docker Volumes to Local is a comprehensive solution that leverages rsync
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Required Software Installation:** Installs necessary packages (e.g., lsof, python-pandas) via pacman.
|
- **Required Software Installation:** Installs necessary packages (e.g., lsof, python-pandas) via pacman.
|
||||||
- **Git Repository Pull:** Automatically pulls the latest version of the [backup-docker-to-local repository](https://github.com/kevinveenbirkenbach/backup-docker-to-local.git).
|
- **Git Repository Pull:** Automatically pulls the latest version of the [bkp-docker-to-local repository](https://github.com/kevinveenbirkenbach/bkp-docker-to-local.git).
|
||||||
- **Systemd Service Configuration:** Deploys and reloads two systemd service templates to manage backup tasks.
|
- **Systemd Service Configuration:** Deploys and reloads two systemd service templates to manage backup tasks.
|
||||||
- **Database Seeding:** Includes tasks to seed and manage a backup database (`databases.csv`) for tracking backup details.
|
- **Database Seeding:** Includes tasks to seed and manage a backup database (`databases.csv`) for tracking backup details.
|
||||||
- **Dependency Integration:** Works in conjunction with the dependent roles listed above to verify and manage backups.
|
- **Dependency Integration:** Works in conjunction with the dependent roles listed above to verify and manage backups.
|
9
roles/bkp-docker-to-local/handlers/main.yml
Normal file
9
roles/bkp-docker-to-local/handlers/main.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
- name: "reload bkp-docker-to-local-everything.cymais.service"
|
||||||
|
systemd:
|
||||||
|
name: bkp-docker-to-local-everything.cymais.service
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
|
- name: "reload bkp-docker-to-local.cymais.service"
|
||||||
|
systemd:
|
||||||
|
name: bkp-docker-to-local.cymais.service
|
||||||
|
daemon_reload: yes
|
@ -23,8 +23,8 @@ galaxy_info:
|
|||||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||||
documentation: "https://s.veen.world/cymais"
|
documentation: "https://s.veen.world/cymais"
|
||||||
dependencies:
|
dependencies:
|
||||||
- backup-provider
|
- bkp-provider
|
||||||
- alert-compose
|
- alert-compose
|
||||||
- cleanup-failed-docker-backups
|
- cleanup-failed-docker-backups
|
||||||
- maint-lock
|
- maint-lock
|
||||||
- backup-directory-validator
|
- bkp-directory-validator
|
@ -2,11 +2,11 @@
|
|||||||
include_role:
|
include_role:
|
||||||
name: pkgmgr-install
|
name: pkgmgr-install
|
||||||
vars:
|
vars:
|
||||||
package_name: backup-docker-to-local
|
package_name: bkp-docker-to-local
|
||||||
when: run_once_backup_docker_to_local is not defined
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: Retrieve backup-docker-to-local path from pkgmgr
|
- name: Retrieve bkp-docker-to-local path from pkgmgr
|
||||||
command: pkgmgr path backup-docker-to-local
|
command: pkgmgr path bkp-docker-to-local
|
||||||
register: pkgmgr_output
|
register: pkgmgr_output
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: run_once_backup_docker_to_local is not defined
|
when: run_once_backup_docker_to_local is not defined
|
||||||
@ -17,18 +17,18 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
when: run_once_backup_docker_to_local is not defined
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: configure backup-docker-to-local-everything.cymais.service
|
- name: configure bkp-docker-to-local-everything.cymais.service
|
||||||
template:
|
template:
|
||||||
src: backup-docker-to-local-everything.service.j2
|
src: bkp-docker-to-local-everything.service.j2
|
||||||
dest: /etc/systemd/system/backup-docker-to-local-everything.cymais.service
|
dest: /etc/systemd/system/bkp-docker-to-local-everything.cymais.service
|
||||||
notify: reload backup-docker-to-local-everything.cymais.service
|
notify: reload bkp-docker-to-local-everything.cymais.service
|
||||||
when: run_once_backup_docker_to_local is not defined
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: configure backup-docker-to-local.cymais.service
|
- name: configure bkp-docker-to-local.cymais.service
|
||||||
template:
|
template:
|
||||||
src: backup-docker-to-local.service.j2
|
src: bkp-docker-to-local.service.j2
|
||||||
dest: /etc/systemd/system/backup-docker-to-local.cymais.service
|
dest: /etc/systemd/system/bkp-docker-to-local.cymais.service
|
||||||
notify: reload backup-docker-to-local.cymais.service
|
notify: reload bkp-docker-to-local.cymais.service
|
||||||
when: run_once_backup_docker_to_local is not defined
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: set service_name to the name of the current role
|
- name: set service_name to the name of the current role
|
@ -4,6 +4,6 @@ OnFailure=alert-compose.cymais@%n.service cleanup-failed-docker-backups.cymais.s
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'backup-docker-to-local') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'bkp-docker-to-local') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
||||||
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py --compose-dir {{path_docker_compose_instances}} --everything'
|
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py --compose-dir {{path_docker_compose_instances}} --everything'
|
||||||
ExecStartPost=/bin/sh -c '/bin/systemctl start maint-docker-heal.cymais.service &'
|
ExecStartPost=/bin/sh -c '/bin/systemctl start maint-docker-heal.cymais.service &'
|
@ -4,6 +4,6 @@ OnFailure=alert-compose.cymais@%n.service cleanup-failed-docker-backups.cymais.s
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'backup-docker-to-local-everything') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{ system_maintenance_backup_services | reject('equalto', 'bkp-docker-to-local-everything') | join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
|
||||||
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py --compose-dir {{path_docker_compose_instances}}'
|
ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py --compose-dir {{path_docker_compose_instances}}'
|
||||||
ExecStartPost=/bin/sh -c '/bin/systemctl start maint-docker-heal.cymais.service &'
|
ExecStartPost=/bin/sh -c '/bin/systemctl start maint-docker-heal.cymais.service &'
|
@ -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 backup-docker-to-local are integrated, this logic needs to be optimized
|
# @todo This configuration is not scalable yet. If other backup services then bkp-docker-to-local are integrated, this logic needs to be optimized
|
||||||
get_version_directories="ls -d /Backups/$hashed_machine_id/backup-docker-to-local/*"
|
get_version_directories="ls -d /Backups/$hashed_machine_id/bkp-docker-to-local/*"
|
||||||
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/"
|
||||||
|
|
@ -8,7 +8,7 @@ This role sets up and manages the host as a backup provider. It establishes the
|
|||||||
|
|
||||||
Optimized for automated backup processes, this role:
|
Optimized for automated backup processes, this role:
|
||||||
- Configures the host to provide backup services.
|
- Configures the host to provide backup services.
|
||||||
- Integrates seamlessly with the [backup-provider-user](../backup-provider-user/README.md) and [cleanup-backups-timer](../cleanup-backups-timer/README.md) roles.
|
- Integrates seamlessly with the [bkp-provider-user](../bkp-provider-user/README.md) and [cleanup-backups-timer](../cleanup-backups-timer/README.md) roles.
|
||||||
- Lays the foundation for secure and extensible backup operations.
|
- Lays the foundation for secure and extensible backup operations.
|
||||||
|
|
||||||
## Purpose
|
## Purpose
|
@ -23,5 +23,5 @@ galaxy_info:
|
|||||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||||
documentation: "https://s.veen.world/cymais"
|
documentation: "https://s.veen.world/cymais"
|
||||||
dependencies:
|
dependencies:
|
||||||
- backup-provider-user
|
- bkp-provider-user
|
||||||
- cleanup-backups-timer
|
- cleanup-backups-timer
|
@ -9,17 +9,17 @@ To track what the service is doing, execute one of the following commands:
|
|||||||
#### Using systemctl
|
#### Using systemctl
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
watch -n2 "systemctl status backup-remote-to-local.cymais.service"
|
watch -n2 "systemctl status bkp-remote-to-local.cymais.service"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Using journalctl
|
#### Using journalctl
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
journalctl -fu backup-remote-to-local.cymais.service
|
journalctl -fu bkp-remote-to-local.cymais.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### Viewing History
|
### Viewing History
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo journalctl -u backup-remote-to-local.cymais.service
|
sudo journalctl -u bkp-remote-to-local.cymais.service
|
||||||
```
|
```
|
@ -17,14 +17,14 @@ Backup Remote to Local is a robust solution for retrieving backup data from remo
|
|||||||
- **Remote Backup Retrieval:** Pulls backups from a remote server using secure SSH connections.
|
- **Remote Backup Retrieval:** Pulls backups from a remote server using secure SSH connections.
|
||||||
- **Incremental Backup with rsync:** Uses rsync with options for archive, backup, and hard linking to efficiently manage changes.
|
- **Incremental Backup with rsync:** Uses rsync with options for archive, backup, and hard linking to efficiently manage changes.
|
||||||
- **Retry Logic:** Implements a retry mechanism to handle transient network issues or remote errors.
|
- **Retry Logic:** Implements a retry mechanism to handle transient network issues or remote errors.
|
||||||
- **Integration with Other Roles:** Works alongside roles like backup-directory-validator, cleanup-failed-docker-backups, generic-timer, backup-provider, and maint-lock.
|
- **Integration with Other Roles:** Works alongside roles like bkp-directory-validator, cleanup-failed-docker-backups, generic-timer, bkp-provider, and maint-lock.
|
||||||
- **Administrative Debugging:** Detailed debug instructions and administrative tasks are provided in a separate file.
|
- **Administrative Debugging:** Detailed debug instructions and administrative tasks are provided in a separate file.
|
||||||
|
|
||||||
## Other Resources
|
## Other Resources
|
||||||
|
|
||||||
- **Backup Scheme:**
|
- **Backup Scheme:**
|
||||||

|

|
||||||
More details can be found in [this blog post](https://www.veen.world/2020/12/26/how-i-backup-dedicated-root-servers/).
|
More details can be found in [this blog post](https://blog.veen.world/2020/12/26/how-i-backup-dedicated-root-servers/).
|
||||||
|
|
||||||
## Administration & Debugging
|
## Administration & Debugging
|
||||||
|
|
4
roles/bkp-remote-to-local/handlers/main.yml
Normal file
4
roles/bkp-remote-to-local/handlers/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- name: "reload bkp-remote-to-local service"
|
||||||
|
systemd:
|
||||||
|
name: bkp-remote-to-local.cymais.service
|
||||||
|
daemon_reload: yes
|
@ -4,17 +4,17 @@
|
|||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create backup-remote-to-local.sh
|
- name: create bkp-remote-to-local.sh
|
||||||
copy:
|
copy:
|
||||||
src: backup-remote-to-local.sh
|
src: bkp-remote-to-local.sh
|
||||||
dest: "{{docker_backup_remote_to_local_folder}}backup-remote-to-local.sh"
|
dest: "{{docker_backup_remote_to_local_folder}}bkp-remote-to-local.sh"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create backup-remote-to-local.cymais.service
|
- name: create bkp-remote-to-local.cymais.service
|
||||||
template:
|
template:
|
||||||
src: backup-remote-to-local.service.j2
|
src: bkp-remote-to-local.service.j2
|
||||||
dest: /etc/systemd/system/backup-remote-to-local.cymais.service
|
dest: /etc/systemd/system/bkp-remote-to-local.cymais.service
|
||||||
notify: reload backup-remote-to-local service
|
notify: reload bkp-remote-to-local service
|
||||||
|
|
||||||
- name: create backups-remote-to-local.sh
|
- name: create backups-remote-to-local.sh
|
||||||
template:
|
template:
|
@ -3,6 +3,6 @@
|
|||||||
hosts="{{ pull_remote_backups | join(' ') }}";
|
hosts="{{ pull_remote_backups | join(' ') }}";
|
||||||
errors=0
|
errors=0
|
||||||
for host in $hosts; do
|
for host in $hosts; do
|
||||||
bash {{ docker_backup_remote_to_local_folder }}backup-remote-to-local.sh $host || ((errors+=1));
|
bash {{ docker_backup_remote_to_local_folder }}bkp-remote-to-local.sh $host || ((errors+=1));
|
||||||
done;
|
done;
|
||||||
exit $errors;
|
exit $errors;
|
@ -1 +1 @@
|
|||||||
docker_backup_remote_to_local_folder: "{{path_administrator_scripts}}backup-remote-to-local/"
|
docker_backup_remote_to_local_folder: "{{path_administrator_scripts}}bkp-remote-to-local/"
|
@ -10,7 +10,7 @@ Optimized for backup maintenance, this role:
|
|||||||
- Clones the cleanup-failed-docker-backups repository.
|
- Clones the cleanup-failed-docker-backups repository.
|
||||||
- Configures a systemd service to run the cleanup script.
|
- Configures a systemd service to run the cleanup script.
|
||||||
- Integrates with the [generic-timer](../generic-timer/README.md) role to schedule periodic cleanup.
|
- Integrates with the [generic-timer](../generic-timer/README.md) role to schedule periodic cleanup.
|
||||||
- Works in conjunction with the backup-directory-validator role for additional verification.
|
- Works in conjunction with the bkp-directory-validator role for additional verification.
|
||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
|
|
||||||
@ -21,4 +21,4 @@ The primary purpose of this role is to remove failed Docker backups automaticall
|
|||||||
- **Repository Cloning:** Retrieves the latest cleanup scripts from a Git repository.
|
- **Repository Cloning:** Retrieves the latest cleanup scripts from a Git repository.
|
||||||
- **Service Configuration:** Sets up a systemd service to run the cleanup tasks.
|
- **Service Configuration:** Sets up a systemd service to run the cleanup tasks.
|
||||||
- **Timer Integration:** Schedules periodic cleanup through a systemd timer.
|
- **Timer Integration:** Schedules periodic cleanup through a systemd timer.
|
||||||
- **Dependency Integration:** Works with backup-directory-validator to enhance backup integrity.
|
- **Dependency Integration:** Works with bkp-directory-validator to enhance backup integrity.
|
@ -24,4 +24,4 @@ galaxy_info:
|
|||||||
dependencies:
|
dependencies:
|
||||||
- alert-compose
|
- alert-compose
|
||||||
- maint-lock
|
- maint-lock
|
||||||
- backup-directory-validator
|
- bkp-directory-validator
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
package_name: cleanup-failed-docker-backups
|
package_name: cleanup-failed-docker-backups
|
||||||
when: run_once_cleanup_failed_docker_backups is not defined
|
when: run_once_cleanup_failed_docker_backups is not defined
|
||||||
|
|
||||||
- name: Retrieve backup-docker-to-local path from pkgmgr
|
- name: Retrieve bkp-docker-to-local path from pkgmgr
|
||||||
command: pkgmgr path cleanup-failed-docker-backups
|
command: pkgmgr path cleanup-failed-docker-backups
|
||||||
register: pkgmgr_output
|
register: pkgmgr_output
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
@ -10,7 +10,7 @@ Targeting user environments on Arch Linux (e.g., Manjaro), this role sets up the
|
|||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
|
|
||||||
The purpose of this role is to automate the configuration of cloud-integrated user directories by ensuring that common folders like `Downloads`, `Music`, and `Workspaces` are transparently redirected into a centralized cloud structure. This makes it easier to maintain backup-friendly, cloud-ready setups for homelab and professional workflows.
|
The purpose of this role is to automate the configuration of cloud-integrated user directories by ensuring that common folders like `Downloads`, `Music`, and `Workspaces` are transparently redirected into a centralized cloud structure. This makes it easier to maintain bkp-friendly, cloud-ready setups for homelab and professional workflows.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ galaxy_info:
|
|||||||
documentation: "https://s.veen.world/cymais/docker"
|
documentation: "https://s.veen.world/cymais/docker"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- backup-docker-to-local
|
- bkp-docker-to-local
|
||||||
- user-administrator
|
- user-administrator
|
||||||
- mon-bot-docker-container
|
- mon-bot-docker-container
|
||||||
- mon-bot-docker-volumes
|
- mon-bot-docker-volumes
|
||||||
|
@ -40,7 +40,7 @@ def main(base_directory):
|
|||||||
|
|
||||||
while blocker_running:
|
while blocker_running:
|
||||||
try:
|
try:
|
||||||
bash("systemctl is-active --quiet backup-docker-to-local.cymais.service")
|
bash("systemctl is-active --quiet bkp-docker-to-local.cymais.service")
|
||||||
bash("systemctl is-active --quiet update-docker.cymais.service")
|
bash("systemctl is-active --quiet update-docker.cymais.service")
|
||||||
print("Backup is running.")
|
print("Backup is running.")
|
||||||
print(f"Trying again in {waiting_time} seconds.")
|
print(f"Trying again in {waiting_time} seconds.")
|
||||||
|
@ -4,5 +4,5 @@ OnFailure=alert-compose.cymais@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore maint-docker-storage-optimizer backup-remote-to-local --timeout "{{system_maintenance_lock_timeout_storage_optimizer}}"'
|
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore maint-docker-storage-optimizer bkp-remote-to-local --timeout "{{system_maintenance_lock_timeout_storage_optimizer}}"'
|
||||||
ExecStart=/bin/sh -c '/usr/bin/python {{storage_optimizer_script}} --rapid-storage-path {{path_rapid_storage}} --mass-storage-path {{path_mass_storage}}'
|
ExecStart=/bin/sh -c '/usr/bin/python {{storage_optimizer_script}} --rapid-storage-path {{path_rapid_storage}} --mass-storage-path {{path_mass_storage}}'
|
@ -28,4 +28,4 @@
|
|||||||
when: applications | is_feature_enabled('central_database',application_id)
|
when: applications | is_feature_enabled('central_database',application_id)
|
||||||
|
|
||||||
- name: "Add database to backup"
|
- name: "Add database to backup"
|
||||||
include_tasks: "{{ playbook_dir }}/roles/backup-docker-to-local/tasks/seed-database-to-backup.yml"
|
include_tasks: "{{ playbook_dir }}/roles/bkp-docker-to-local/tasks/seed-database-to-backup.yml"
|
@ -1,6 +1,6 @@
|
|||||||
- name: "start backup-docker-to-local-everything.cymais.service"
|
- name: "start bkp-docker-to-local-everything.cymais.service"
|
||||||
systemd:
|
systemd:
|
||||||
name: backup-docker-to-local-everything.cymais.service
|
name: bkp-docker-to-local-everything.cymais.service
|
||||||
state: started
|
state: started
|
||||||
when: mode_backup | bool
|
when: mode_backup | bool
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
database_name: "" # Multiple databases
|
database_name: "" # Multiple databases
|
||||||
|
|
||||||
- name: "Seed BigBlueButton Database for Backup"
|
- name: "Seed BigBlueButton Database for Backup"
|
||||||
include_tasks: "{{ playbook_dir }}/roles/backup-docker-to-local/tasks/seed-database-to-backup.yml"
|
include_tasks: "{{ playbook_dir }}/roles/bkp-docker-to-local/tasks/seed-database-to-backup.yml"
|
||||||
vars:
|
vars:
|
||||||
database_instance: "{{ application_id }}"
|
database_instance: "{{ application_id }}"
|
||||||
database_password: "{{ applications[application_id].credentials.postgresql_secret }}"
|
database_password: "{{ applications[application_id].credentials.postgresql_secret }}"
|
||||||
|
@ -10,4 +10,4 @@
|
|||||||
when: applications | is_feature_enabled('central_database',application_id)
|
when: applications | is_feature_enabled('central_database',application_id)
|
||||||
|
|
||||||
- name: "include seed-database-to-backup.yml"
|
- name: "include seed-database-to-backup.yml"
|
||||||
include_tasks: "{{ playbook_dir }}/roles/backup-docker-to-local/tasks/seed-database-to-backup.yml"
|
include_tasks: "{{ playbook_dir }}/roles/bkp-docker-to-local/tasks/seed-database-to-backup.yml"
|
@ -43,8 +43,8 @@ and disable any non-functioning apps.
|
|||||||
```bash
|
```bash
|
||||||
cd {{path_docker_compose_instances}}nextcloud &&
|
cd {{path_docker_compose_instances}}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)/backup-docker-to-local/latest/nextcloud_database/sql/backup.sql" &&
|
docker-compose exec -i database mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/bkp-docker-to-local/latest/nextcloud_database/sql/backup.sql" &&
|
||||||
cd {{path_administrator_scripts}}backup-docker-to-local &&
|
cd {{path_administrator_scripts}}bkp-docker-to-local &&
|
||||||
bash ./recover-web-app-from-local.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)"
|
bash ./recover-web-app-from-local.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -120,12 +120,12 @@
|
|||||||
## backup setup
|
## backup setup
|
||||||
- name: setup replica backup hosts
|
- name: setup replica backup hosts
|
||||||
when: ('backup_remote_to_local' | application_allowed(group_names, allowed_applications))
|
when: ('backup_remote_to_local' | application_allowed(group_names, allowed_applications))
|
||||||
include_role: backup-remote-to-local
|
include_role: bkp-remote-to-local
|
||||||
|
|
||||||
- name: setup backup to swappable
|
- name: setup backup to swappable
|
||||||
when: ('backup_to_usb' | application_allowed(group_names, allowed_applications))
|
when: ('backup_to_usb' | application_allowed(group_names, allowed_applications))
|
||||||
include_role:
|
include_role:
|
||||||
name: backup-data-to-usb
|
name: bkp-data-to-usb
|
||||||
|
|
||||||
## driver setup
|
## driver setup
|
||||||
- name: driver-intel
|
- name: driver-intel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user