Repository navigation
Expand file tree
/
Copy pathcompose.example.yaml
More file actions
127 lines (123 loc) · 6.21 KB
/
Copy pathcompose.example.yaml
File metadata and controls
127 lines (123 loc) · 6.21 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
# Example Pullbackup deployment.
#
# No image is published yet, so this file builds one from the repository root
# (`build.context: ..`). Adjust the volumes and destination roots for your
# host, supply the environment values from a .env beside it (see
# ../.env.example), and run `docker compose up -d --build` from this directory.
# If you copy the file elsewhere, either fix `build.context` to point at your
# checkout or build the image first (`docker build -t pullbackup:local .` at
# the repository root) and delete the `build` block.
#
# Nothing here is required — Pullbackup is a single container plus one data
# volume. The extras below (ZFS device access, Traefik labels) are only needed
# for the features noted against them.
services:
pullbackup:
build:
context: ..
image: pullbackup:local
container_name: pullbackup
restart: unless-stopped
# Modest limits: the container orchestrates rsync/syncoid, it does not do
# the data movement in-process.
mem_limit: 512m
cpus: 1.0
pids_limit: 256
ports:
- "8000:8000"
environment:
TZ: ${TZ:-UTC}
PULLBACKUP_DATA_DIR: /data
# Comma-separated allowlist. rsync destinations must live beneath one of
# these paths; anything else is rejected before a run starts.
PULLBACKUP_DEST_ROOTS: /mnt/dest/backups
# Only needed for syncoid (ZFS) tasks. Leave blank to disable them.
PULLBACKUP_ZFS_DEST_ROOTS: ""
# Bounded parallelism. Two runs writing the same destination still
# serialize regardless of this value; set it to "1" for strictly one
# transfer at a time. Below 1 is refused at startup.
PULLBACKUP_MAX_CONCURRENT_RUNS: "3"
# Hard ceiling on one run's execution, covering the transfer AND any
# post-transfer ZFS pruning under a single deadline. A hung
# rsync/syncoid/zfs otherwise holds its slot forever and blocks every
# later run for that source. On expiry the process group is killed and
# the run is marked failed. "0" waits forever; negative is refused.
PULLBACKUP_RUN_TIMEOUT_SECONDS: "86400"
# How often to reconcile active run rows against live executions and
# fail any this process is provably not running. Below 1 is refused.
PULLBACKUP_WATCHDOG_INTERVAL_SECONDS: "60"
# Required. The password must be at least 32 characters.
# The UI signs in with these at /login and then uses a session cookie;
# the same values keep working as HTTP Basic for scripted access and for
# the healthcheck below.
PULLBACKUP_HTTP_BASIC_USERNAME: ${PULLBACKUP_HTTP_BASIC_USERNAME:?required}
PULLBACKUP_HTTP_BASIC_PASSWORD: ${PULLBACKUP_HTTP_BASIC_PASSWORD:?required}
# Optional. Signs session cookies. Unset means the key is derived from
# the password above, so changing the password signs everyone out.
PULLBACKUP_SESSION_SECRET: ${PULLBACKUP_SESSION_SECRET:-}
# Optional. Reverse proxies whose X-Forwarded-For may be believed,
# comma-separated IPs or CIDRs. Set this whenever the container sits
# behind the Traefik block at the bottom of this file: without it the
# failed-login throttle sees the proxy's address for every caller and all
# clients share one failure bucket, so five wrong guesses by anybody lock
# the login form for everybody. Empty = no forwarding header is trusted.
PULLBACKUP_TRUSTED_PROXIES: ${PULLBACKUP_TRUSTED_PROXIES:-}
# Optional integrations. Blank disables the feature in the UI.
MATRIX_HOMESERVER: ${MATRIX_HOMESERVER:-}
MATRIX_TOKEN: ${MATRIX_TOKEN:-}
MATRIX_ROOM_ID: ${MATRIX_ROOM_ID:-}
UPTIME_KUMA_URL: ${UPTIME_KUMA_URL:-}
UPTIME_KUMA_USERNAME: ${UPTIME_KUMA_USERNAME:-}
UPTIME_KUMA_PASSWORD: ${UPTIME_KUMA_PASSWORD:-}
volumes:
# Holds the SQLite database, run logs and the generated SSH key.
# Back this up; do not point it at a fresh directory once in use.
- ./data:/data
# Mount each destination root you listed in PULLBACKUP_DEST_ROOTS.
- /srv/backups:/mnt/dest/backups
# /api/system/health is exempt from authentication, so this probe does not
# actually need the Authorization header. It is kept because the exemption
# is a deliberate, narrow carve-out: if it were ever removed, a probe that
# already authenticates keeps the container healthy instead of restart-
# looping. Adding the login session changed nothing here.
healthcheck:
test:
- CMD
- python
- -c
- >-
import base64,os,urllib.request,sys;
credentials=(os.environ["PULLBACKUP_HTTP_BASIC_USERNAME"]+":"+os.environ["PULLBACKUP_HTTP_BASIC_PASSWORD"]).encode();
request=urllib.request.Request("http://localhost:8000/api/system/health",headers={"Authorization":"Basic "+base64.b64encode(credentials).decode()});
sys.exit(0 if urllib.request.urlopen(request,timeout=3).status==200 else 1)
interval: 30s
timeout: 5s
retries: 3
# --- ZFS replication (syncoid tasks) -----------------------------------------
# Only if you want task_type=syncoid. rsync tasks need none of this.
# Add to the service above:
#
# privileged: true
# devices:
# - /dev/zfs:/dev/zfs
# volumes:
# - /mnt/pool:/mnt/pool:rshared # rshared so zfs mounts propagate
# - /root/.ssh/id_syncoid:/keys/id_syncoid:ro
#
# and set PULLBACKUP_ZFS_DEST_ROOTS to the dataset roots you allow, e.g.
# "tank/replicas".
# --- Reverse proxy ------------------------------------------------------------
# Example Traefik labels, if you terminate TLS in front of the container:
#
# labels:
# - traefik.enable=true
# - traefik.http.routers.pullbackup.rule=Host(`pullbackup.example.com`)
# - traefik.http.routers.pullbackup.tls=true
# - traefik.http.services.pullbackup.loadbalancer.server.port=8000
#
# If you enable this, ALSO set PULLBACKUP_TRUSTED_PROXIES above to the network
# Traefik reaches the container from (e.g. the docker network's subnet,
# 172.18.0.0/16). Otherwise the app sees Traefik's address as the client for
# every request and the failed-login throttle becomes shared: five wrong
# guesses by anyone lock the login form for everyone for 60 seconds. HTTP Basic
# keeps working throughout, so scripted access is never lost.