-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-rclone.yaml
More file actions
135 lines (125 loc) · 5.09 KB
/
Copy pathdocker-compose-rclone.yaml
File metadata and controls
135 lines (125 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
services:
# PostgreSQL Database for storing backup metadata and statistics
backrest-reporter-db:
image: postgres:17
container_name: backrest-reporter-db
environment:
POSTGRES_USER: ${DB_USERNAME} # Username from .env
POSTGRES_PASSWORD: ${DB_PASSWORD} # Password from .env
POSTGRES_DB: backrest-reporter-db # Database name
volumes:
- ./db:/var/lib/postgresql/data # Host ./db directory
- ./backups:/backups # Mount host's ./backups dir
ports:
- "57432:5432" # Expose PostgreSQL for local development/debug
restart: unless-stopped
# Rclone container that handles mounting Google Drive via FUSE
rclone-mounter:
image: rclone/rclone:1.70.3
container_name: rclone-mounter
restart: unless-stopped
cap_add:
- SYS_ADMIN # Required for FUSE
devices:
- /dev/fuse # Expose FUSE device
security_opt:
- apparmor:unconfined # Unconfine AppArmor to allow FUSE mount
environment:
RCLONE_REMOTE: "${RCLONE_REMOTE}" # e.g. "google_drive:"
RCLONE_TARGET: "${RCLONE_TARGET}" # e.g. "/mnt-rclone/google_drive"
volumes:
# Config volume for rclone.conf
- type: bind
source: ./rclone/config
target: /config/rclone
# Config volume for entrypoint.sh
- type: bind
source: ./rclone/entrypoint.sh
target: /entrypoint.sh
read_only: true
# Optional: cache directory for VFS (improves stability/performance)
- type: bind
source: ./rclone/vfs-cache
target: /config/rclone/vfs-cache
# Mountpoint shared with host and other containers (Google Drive)
# Ensure the folder exists on the host machine before running
# e.g. sudo mkdir -p /mnt-rclone/google_drive
- type: bind
source: /mnt-rclone/google_drive
target: /mnt-rclone/google_drive
bind:
propagation: shared # Allow mount propagation between containers
entrypoint: ["sh", "/entrypoint.sh"]
healthcheck:
test: ["CMD-SHELL", "grep -q ' /mnt-rclone/google_drive ' /proc/mounts"]
interval: 5s
timeout: 2s
retries: 5
start_period: 5s
# Main Rust API service that checks mount status, manages backups, and sends emails
backrest-reporter:
image: estessj/backrest-summary-reporter:latest
container_name: backrest-reporter
depends_on:
backrest-reporter-db:
condition: service_started # Wait for database to be available
rclone-mounter:
condition: service_healthy # Wait for rclone FUSE mounts to be available
environment:
DATABASE_URL: postgres://${DB_USERNAME}:${DB_PASSWORD}@backrest-reporter-db/backrest-reporter-db
TZ: ${TZ} # Set container timezone
AUTH_KEY: ${AUTH_KEY} # API authentication key
RUST_LOG: info # Logging verbosity
# Email settings for report sending
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
SMTP_USERNAME: ${SMTP_USERNAME}
SMTP_PASSWORD: ${SMTP_PASSWORD}
EMAIL_FROM: ${EMAIL_FROM}
EMAIL_TO: ${EMAIL_TO}
SEND_STARTUP_EMAIL: "${SEND_STARTUP_EMAIL}"
# Email scheduling and report configuration
EMAIL_FREQUENCY: "${EMAIL_FREQUENCY}"
STATS_INTERVAL: "${STATS_INTERVAL}"
NUM_RETAINED_REPORTS: "${NUM_RETAINED_REPORTS}"
# Healthchecks ping url for API status
HEALTHCHECK_PING_URL: ${HEALTHCHECK_PING_URL}
# Storage mount paths and nicknames (these paths must exist in the container)
# Can supply as many as desired using the naming convention, starting at 1
# Paths are the path inside the container, which is the right side of the :
# NICK refers to the optional nickname used in the email reports.
STORAGE_PATH_1: ${STORAGE_PATH_1}
STORAGE_NICK_1: ${STORAGE_NICK_1}
STORAGE_PATH_2: ${STORAGE_PATH_2}
STORAGE_NICK_2: ${STORAGE_NICK_2}
STORAGE_PATH_3: ${STORAGE_PATH_3}
STORAGE_NICK_3: ${STORAGE_NICK_3}
STORAGE_PATH_4: ${STORAGE_PATH_4}
STORAGE_NICK_4: ${STORAGE_NICK_4}
STORAGE_PATH_5: ${STORAGE_PATH_5}
STORAGE_NICK_5: ${STORAGE_NICK_5}
STORAGE_PATH_6: ${STORAGE_PATH_6}
STORAGE_NICK_6: ${STORAGE_NICK_6}
# Additional misc. settings used in the email reports
SERVER_NAME: ${SERVER_NAME}
BACKREST_URL: ${BACKREST_URL}
PGADMIN_URL: ${PGADMIN_URL}
ports:
- "2682:2682" # Expose API endpoint
volumes:
# Store generated email reports
- ./reports:/reports
# Host bind-mounts for local or remote mount points (read-only since we are only pulling stats)
- /opt:/mnt/opt:ro
- /mnt:/mnt/mnt:ro
# Google Drive mountpoint from rclone container
# Ensure the folder exists on the host machine before running
# e.g. sudo mkdir -p /mnt-rclone/google_drive
- type: bind
source: /mnt-rclone/google_drive
target: /mnt-rclone/google_drive
bind:
propagation: shared # Required to see FUSE mounts
cap_add:
- SYS_ADMIN # For FUSE mounts
restart: unless-stopped