Skip to content

Commit d1a6af0

Browse files
authored
update borgmatic
1 parent f3d2f55 commit d1a6af0

File tree

3 files changed

+39
-50
lines changed

3 files changed

+39
-50
lines changed

borgmatic/.env

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
TZ=Asia/Ho_Chi_Minh
2-
BORG_PASSPHRASE="YOUR-BORG-PASSPHRASE"
1+
BORGBASE_REPO_PATH=YOUR-REPO_URL # URL for your BorgBase repository
2+
BORG_PASSPHRASE="YOUR-BORG-PASSPHRASE" # Passphrase for the Borg repository
33

4-
VOLUME_EE_SOURCE=/opt/easyengine
5-
VOLUME_DOCKER_VOLUMES=/var/lib/docker/volumes
6-
VOLUME_BORGMATIC_CONFIG_SOURCE=./borgmatic
7-
VOLUME_FAIL2BAN_CONFIG_SOURCE=./fail2ban
8-
VOLUME_CRONTAB_SOURCE=/var/spool/cron
4+
# sudo docker compose -f /opt/easyengine/services/docker-compose.yml exec global-db bash -c 'echo $MYSQL_ROOT_PASSWORD'
5+
MYSQL_ROOT_PASSWORD=YOUR-MYSQL-ROOT-PASSWORD # Root password for MySQL/MariaDB database backups
96

10-
VOLUME_RESTORE_DESTINATION=./restore
7+
VOLUME_EE_SOURCE=/opt/easyengine # Source path for EasyEngine data
8+
VOLUME_DOCKER_VOLUMES=/var/lib/docker/volumes # Source path for Docker volumes
9+
VOLUME_BORGMATIC_CONFIG_SOURCE=./borgmatic # Source path for Borgmatic configuration files
10+
VOLUME_FAIL2BAN_CONFIG_SOURCE=./fail2ban # Source path for Fail2Ban configuration files
11+
VOLUME_CRONTAB_SOURCE=/var/spool/cron # Source path for crontab files
1112

12-
VOLUME_EE_SOURCE=/opt/easyengine
13-
VOLUME_DOCKER_VOLUMES=/var/lib/docker/volumes
14-
VOLUME_BORGMATIC_CONFIG_SOURCE=/YOUR-PATH/borgmatic
15-
VOLUME_FAIL2BAN_CONFIG_SOURCE=/YOUR-PATH/fail2ban
16-
VOLUME_CRONTAB_SOURCE=/var/spool/cron
13+
VOLUME_RESTORE_DESTINATION=./restore # Destination path for restoring backups
1714

18-
BORGBASE_REPO_PATH=YOUR-REPO_URL
19-
HOST_NAME=YOUR-HOST-NAME
20-
21-
# cd /opt/easyengine/services && sudo docker compose exec global-db bash -c 'echo $MYSQL_ROOT_PASSWORD'
22-
MYSQL_ROOT_PASSWORD=YOUR-MYSQL-ROOT-PASSWORD
15+
TZ=Asia/Ho_Chi_Minh # Timezone for the container

borgmatic/data/borgmatic.d/config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Config for ${HOST_NAME}
1+
## Config for ${HOSTNAME}
22

33
source_directories:
44
- /mnt/source/easyengine
@@ -9,14 +9,14 @@ source_directories:
99

1010
repositories:
1111
- path: ${BORGBASE_REPO_PATH}
12-
label: "${HOST_NAME} on BorgBase"
12+
label: "${HOSTNAME} on BorgBase"
1313

1414
exclude_patterns:
1515
- '*.pyc'
1616
- ~/*/.cache
1717

1818
compression: auto,zstd
19-
archive_name_format: '${HOST_NAME}-{now:%Y-%m-%d-%H%M%S}'
19+
archive_name_format: '${HOSTNAME}-{now:%Y-%m-%d-%H%M%S}'
2020

2121
retries: 5
2222
retry_wait: 5
@@ -40,26 +40,26 @@ commands:
4040
- before: action
4141
when: [create]
4242
run:
43-
- 'echo "Borgmatic: Starting backup for ${HOST_NAME}..."'
43+
- 'echo "Borgmatic: Starting backup for ${HOSTNAME}..."'
4444
- after: action
4545
when: [create]
4646
states: [finish]
4747
run:
48-
- 'echo "Borgmatic: Backup for ${HOST_NAME} completed successfully!"'
48+
- 'echo "Borgmatic: Backup for ${HOSTNAME} completed successfully!"'
4949

5050
- before: action
5151
when: [check]
5252
run:
53-
- 'echo "Borgmatic: Starting consistency checks for ${HOST_NAME}..."'
53+
- 'echo "Borgmatic: Starting consistency checks for ${HOSTNAME}..."'
5454
- after: action
5555
when: [check]
5656
states: [finish]
5757
run:
58-
- 'echo "Borgmatic: Consistency checks for ${HOST_NAME} completed successfully!"'
58+
- 'echo "Borgmatic: Consistency checks for ${HOSTNAME} completed successfully!"'
5959

6060
- after: error
6161
run:
62-
- 'echo "Borgmatic: An error occurred during an operation for ${HOST_NAME}. Please check logs."'
62+
- 'echo "Borgmatic: An error occurred during an operation for ${HOSTNAME}. Please check logs."'
6363

6464
mariadb_databases:
6565
- name: all

borgmatic/docker-compose.yml

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,29 @@ services:
33
image: ghcr.io/borgmatic-collective/borgmatic
44
container_name: borgmatic
55
volumes:
6-
# Sao lưu các thư mục EasyEngine và Docker
7-
- ${VOLUME_EE_SOURCE}:/mnt/source/easyengine:ro
8-
- ${VOLUME_DOCKER_VOLUMES}:/mnt/source/volumes:ro
9-
- ${VOLUME_BORGMATIC_CONFIG_SOURCE}:/mnt/source/borgmatic:ro
10-
- ${VOLUME_FAIL2BAN_CONFIG_SOURCE}:/mnt/source/fail2ban:ro
11-
- ${VOLUME_CRONTAB_SOURCE}:/mnt/source/crontab:ro
12-
# Thư mục khôi phục
13-
- ${VOLUME_RESTORE_DESTINATION}:/restore
14-
# Các thư mục quản lý Borg
15-
- ${VOLUME_BORG_REPOSITORY}:/mnt/borg-repository
16-
- ${VOLUME_ETC_BORGMATIC}:/etc/borgmatic.d/
17-
- ${VOLUME_BORG_CONFIG}:/root/.config/borg
18-
- ${VOLUME_SSH}:/root/.ssh
19-
- ${VOLUME_BORG_CACHE}:/root/.cache/borg
20-
# Đồng bộ múi giờ
21-
- /etc/localtime:/etc/localtime:ro
22-
- /etc/timezone:/etc/timezone:ro
6+
- ${VOLUME_EE_SOURCE}:/mnt/source/easyengine:ro # Backup EasyEngine directories
7+
- ${VOLUME_DOCKER_VOLUMES}:/mnt/source/volumes:ro # Backup Docker volumes
8+
- ${VOLUME_BORGMATIC_CONFIG_SOURCE}:/mnt/source/borgmatic:ro # Backup Borgmatic config
9+
- ${VOLUME_FAIL2BAN_CONFIG_SOURCE}:/mnt/source/fail2ban:ro # Backup Fail2Ban config
10+
- ${VOLUME_CRONTAB_SOURCE}:/mnt/source/crontab:ro # Backup Crontab files
11+
- ${VOLUME_RESTORE_DESTINATION}:/restore # Restore destination directory
12+
- ${VOLUME_BORG_REPOSITORY}:/mnt/borg-repository # Borg repository management
13+
- ${VOLUME_ETC_BORGMATIC}:/etc/borgmatic.d/ # Borgmatic configuration directory
14+
- ${VOLUME_BORG_CONFIG}:/root/.config/borg # Borg client configuration
15+
- ${VOLUME_SSH}:/root/.ssh # SSH keys for remote access
16+
- ${VOLUME_BORG_CACHE}:/root/.cache/borg # Borg cache directory
17+
- /etc/localtime:/etc/localtime:ro # Sync timezone
18+
- /etc/timezone:/etc/timezone:ro # Sync timezone
2319
environment:
24-
- TZ=${TZ}
25-
- BORG_PASSPHRASE=${BORG_PASSPHRASE}
26-
- HOST_NAME=${HOST_NAME}
27-
- BORGBASE_REPO_PATH=${BORGBASE_REPO_PATH}
28-
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
20+
- TZ=${TZ} # Set timezone
21+
- BORG_PASSPHRASE=${BORG_PASSPHRASE} # Borg repository passphrase
22+
- HOSTNAME=${HOSTNAME} # Get Hostname of host
23+
- BORGBASE_REPO_PATH=${BORGBASE_REPO_PATH} # Path to BorgBase repository
24+
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} # MariaDB root password for backups
2925
networks:
3026
global-backend-network:
3127

3228
networks:
3329
global-backend-network:
34-
external: true
35-
name: ee-global-backend-network
30+
external: true # Connects to EasyEngine's backend network
31+
name: ee-global-backend-network # Name of the external network for EasyEngine services

0 commit comments

Comments
 (0)