backup-docker-to-local 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,230 @@
1
+ Metadata-Version: 2.4
2
+ Name: backup-docker-to-local
3
+ Version: 1.0.0
4
+ Summary: Backup Docker volumes to local with rsync and optional DB dumps.
5
+ Author: Kevin Veen-Birkenbach
6
+ License: AGPL-3.0-or-later
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: pandas
11
+ Requires-Dist: dirval
12
+ Dynamic: license-file
13
+
14
+ # baudolo โ€“ Deterministic Backup & Restore for Docker Volumes ๐Ÿ“ฆ๐Ÿ”„
15
+ [![GitHub Sponsors](https://img.shields.io/badge/Sponsor-GitHub%20Sponsors-blue?logo=github)](https://github.com/sponsors/kevinveenbirkenbach) [![Patreon](https://img.shields.io/badge/Support-Patreon-orange?logo=patreon)](https://www.patreon.com/c/kevinveenbirkenbach) [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20me%20a%20Coffee-Funding-yellow?logo=buymeacoffee)](https://buymeacoffee.com/kevinveenbirkenbach) [![PayPal](https://img.shields.io/badge/Donate-PayPal-blue?logo=paypal)](https://s.veen.world/paypaldonate) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) [![Docker Version](https://img.shields.io/badge/Docker-Yes-blue.svg)](https://www.docker.com) [![Python Version](https://img.shields.io/badge/Python-3.x-blue.svg)](https://www.python.org) [![GitHub stars](https://img.shields.io/github/stars/kevinveenbirkenbach/backup-docker-to-local.svg?style=social)](https://github.com/kevinveenbirkenbach/backup-docker-to-local/stargazers)
16
+
17
+
18
+ `baudolo` is a backup and restore system for Docker volumes with
19
+ **mandatory file backups** and **explicit, deterministic database dumps**.
20
+ It is designed for environments with many Docker services where:
21
+ - file-level backups must always exist
22
+ - database dumps must be intentional, predictable, and auditable
23
+
24
+ ## โœจ Key Features
25
+
26
+ - ๐Ÿ“ฆ Incremental Docker volume backups using `rsync --link-dest`
27
+ - ๐Ÿ—„ Optional SQL dumps for:
28
+ - PostgreSQL
29
+ - MariaDB / MySQL
30
+ - ๐ŸŒฑ Explicit database definition for SQL backups (no auto-discovery)
31
+ - ๐Ÿงพ Backup integrity stamping via `dirval` (Python API)
32
+ - โธ Automatic container stop/start when required for consistency
33
+ - ๐Ÿšซ Whitelisting of containers that do not require stopping
34
+ - โ™ป๏ธ Modular, maintainable Python architecture
35
+
36
+
37
+ ## ๐Ÿง  Core Concept (Important!)
38
+
39
+ `baudolo` **separates file backups from database dumps**.
40
+
41
+ - **Docker volumes are always backed up at file level**
42
+ - **SQL dumps are created only for explicitly defined databases**
43
+
44
+ This results in the following behavior:
45
+
46
+ | Database defined | File backup | SQL dump |
47
+ |------------------|-------------|----------|
48
+ | No | โœ” yes | โœ˜ no |
49
+ | Yes | โœ” yes | โœ” yes |
50
+
51
+ ## ๐Ÿ“ Backup Layout
52
+
53
+ Backups are stored in a deterministic, fully nested structure:
54
+
55
+ ```text
56
+ <backups-dir>/
57
+ โ””โ”€โ”€ <machine-hash>/
58
+ โ””โ”€โ”€ <repo-name>/
59
+ โ””โ”€โ”€ <timestamp>/
60
+ โ””โ”€โ”€ <volume-name>/
61
+ โ”œโ”€โ”€ files/
62
+ โ””โ”€โ”€ sql/
63
+ โ””โ”€โ”€ <database>.backup.sql
64
+ ```
65
+
66
+ ### Meaning of each level
67
+
68
+ * `<machine-hash>`
69
+ SHA256 hash of `/etc/machine-id` (host separation)
70
+
71
+ * `<repo-name>`
72
+ Logical backup namespace (project / stack)
73
+
74
+ * `<timestamp>`
75
+ Backup generation (`YYYYMMDDHHMMSS`)
76
+
77
+ * `<volume-name>`
78
+ Docker volume name
79
+
80
+ * `files/`
81
+ Incremental file backup (rsync)
82
+
83
+ * `sql/`
84
+ Optional SQL dumps (only for defined databases)
85
+
86
+ ## ๐Ÿš€ Installation
87
+
88
+ ### Local (editable install)
89
+
90
+ ```bash
91
+ python3 -m venv .venv
92
+ source .venv/bin/activate
93
+ pip install -e .
94
+ ```
95
+
96
+ ## ๐ŸŒฑ Database Definition (SQL Backup Scope)
97
+
98
+ ### How SQL backups are defined
99
+
100
+ `baudolo` creates SQL dumps **only** for databases that are **explicitly defined**
101
+ via configuration (e.g. a databases definition file or seeding step).
102
+
103
+ If a database is **not defined**:
104
+
105
+ * its Docker volume is still backed up (files)
106
+ * **no SQL dump is created**
107
+
108
+ > No database definition โ†’ file backup only
109
+ > Database definition present โ†’ file backup + SQL dump
110
+
111
+ ### Why explicit definition?
112
+
113
+ `baudolo` does **not** inspect running containers to guess databases.
114
+
115
+ Databases must be explicitly defined to guarantee:
116
+
117
+ * deterministic backups
118
+ * predictable restore behavior
119
+ * reproducible environments
120
+ * zero accidental production data exposure
121
+
122
+ ### Required database metadata
123
+
124
+ Each database definition provides:
125
+
126
+ * database instance (container or logical instance)
127
+ * database name
128
+ * database user
129
+ * database password
130
+
131
+ This information is used by `baudolo` to execute
132
+ `pg_dump`, `pg_dumpall`, or `mariadb-dump`.
133
+
134
+ ## ๐Ÿ’พ Running a Backup
135
+
136
+ ```bash
137
+ baudolo \
138
+ --compose-dir /srv/docker \
139
+ --databases-csv /etc/baudolo/databases.csv \
140
+ --database-containers central-postgres central-mariadb \
141
+ --images-no-stop-required alpine postgres mariadb mysql \
142
+ --images-no-backup-required redis busybox
143
+ ```
144
+
145
+ ### Common Backup Flags
146
+
147
+ | Flag | Description |
148
+ | --------------- | ------------------------------------------- |
149
+ | `--everything` | Always stop containers and re-run rsync |
150
+ | `--dump-only` | Only create SQL dumps, skip file backups |
151
+ | `--shutdown` | Do not restart containers after backup |
152
+ | `--backups-dir` | Backup root directory (default: `/Backups`) |
153
+ | `--repo-name` | Backup namespace under machine hash |
154
+
155
+ ## โ™ป๏ธ Restore Operations
156
+
157
+ ### Restore Volume Files
158
+
159
+ ```bash
160
+ baudolo-restore files \
161
+ my-volume \
162
+ <machine-hash> \
163
+ <version> \
164
+ --backups-dir /Backups \
165
+ --repo-name my-repo
166
+ ```
167
+
168
+ Restore into a **different target volume**:
169
+
170
+ ```bash
171
+ baudolo-restore files \
172
+ target-volume \
173
+ <machine-hash> \
174
+ <version> \
175
+ --source-volume source-volume
176
+ ```
177
+
178
+ ### Restore PostgreSQL
179
+
180
+ ```bash
181
+ baudolo-restore postgres \
182
+ my-volume \
183
+ <machine-hash> \
184
+ <version> \
185
+ --container postgres \
186
+ --db-name appdb \
187
+ --db-password secret \
188
+ --empty
189
+ ```
190
+
191
+ ### Restore MariaDB / MySQL
192
+
193
+ ```bash
194
+ baudolo-restore mariadb \
195
+ my-volume \
196
+ <machine-hash> \
197
+ <version> \
198
+ --container mariadb \
199
+ --db-name shopdb \
200
+ --db-password secret \
201
+ --empty
202
+ ```
203
+
204
+ > `baudolo` automatically detects whether `mariadb` or `mysql`
205
+ > is available inside the container
206
+
207
+ ## ๐Ÿ” Backup Scheme
208
+
209
+ The backup mechanism uses incremental backups with rsync and stamps directories with a unique hash. For more details on the backup scheme, check out [this blog post](https://blog.veen.world/blog/2020/12/26/how-i-backup-dedicated-root-servers/).
210
+ ![Backup Scheme](https://blog.veen.world/wp-content/uploads/2020/12/server-backup-1024x755.jpg)
211
+
212
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Author
213
+
214
+ **Kevin Veen-Birkenbach**
215
+ - ๐Ÿ“ง [kevin@veen.world](mailto:kevin@veen.world)
216
+ - ๐ŸŒ [https://www.veen.world/](https://www.veen.world/)
217
+
218
+ ## ๐Ÿ“œ License
219
+
220
+ This project is licensed under the **GNU Affero General Public License v3.0**. See the [LICENSE](./LICENSE) file for details.
221
+
222
+ ## ๐Ÿ”— More Information
223
+
224
+ - [Docker Volumes Documentation](https://docs.docker.com/storage/volumes/)
225
+ - [Docker Backup Volumes Blog](https://blog.ssdnodes.com/blog/docker-backup-volumes/)
226
+ - [Backup Strategies](https://en.wikipedia.org/wiki/Incremental_backup#Incremental)
227
+
228
+ ---
229
+
230
+ Happy Backing Up! ๐Ÿš€๐Ÿ”
@@ -0,0 +1,25 @@
1
+ backup_docker_to_local-1.0.0.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
2
+ baudolo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ baudolo/backup/__init__.py,sha256=5BfF8JBXB2j6sAptcmswtbjlajNWxOho6_CjwIamO7k,30
4
+ baudolo/backup/__main__.py,sha256=118gZ0wij9_PAtR-jlG7LizrhrxwhHlAcAPW1eFeJtU,140
5
+ baudolo/backup/app.py,sha256=eZJ0Y1LYZ_NiYw-nzb-h7-x-5AbZFsCjqsP127Mfy-I,5796
6
+ baudolo/backup/cli.py,sha256=u-lQyfbPPiZOnOQ8ugS5yeXHfRVLBOGOw40iOUsOd5s,2619
7
+ baudolo/backup/compose.py,sha256=LKwMzfroKML0miZqJzzhXN3SMm07Ry_85l3p4B0cqeo,1130
8
+ baudolo/backup/db.py,sha256=hNL08pV0osNrOBD3k_EhP8boawRWTc7QlpIPEKitD-E,2402
9
+ baudolo/backup/docker.py,sha256=QxP8C-O7glWrOvZnhELI4-8E2vz_xXEy0CM8QeW8u3k,1342
10
+ baudolo/backup/shell.py,sha256=guMHWcRb0Qlrz79gqFqmJLXVQK8cJEvNkhkMe5Tpgwc,738
11
+ baudolo/backup/volume.py,sha256=_bz-G0HLdDETnWuiAB-geb5xbEaLLsxs9uPFK0lsADc,1449
12
+ baudolo/restore/__init__.py,sha256=qGPo54bmX0D1TRuP22sTQXhpOOwTa8BheEq8aWKsWOk,18
13
+ baudolo/restore/__main__.py,sha256=c0u0YS7xqLRxn9gsvXvorlU8jbs4LlSDxU7JiBAtdIk,5083
14
+ baudolo/restore/files.py,sha256=vV2M60i3-9rwLFV1Kb1Fc_m1SXYYOFUEPQKCMnlOpo4,1031
15
+ baudolo/restore/paths.py,sha256=fcM-39loVXsi-0qgG2FxFmYh3R748Ss5CJqnZinKcNE,708
16
+ baudolo/restore/run.py,sha256=rai5F27D6F8RRnFMyjcEGiHBAlVXtMOJoazs6zkLSC0,2302
17
+ baudolo/restore/db/__init__.py,sha256=9NfiJvVx-sIJfLuZYnOHGjunpbFyqGZSqISFgLTcP5o,58
18
+ baudolo/restore/db/mariadb.py,sha256=0sk6eJiDDr-knIEQyqQIHNtRt7AQrqRlOlnOijVVLno,2516
19
+ baudolo/restore/db/postgres.py,sha256=_NIlcxdpcQIUZ8SNBWfWIaH1oGIkmZy9emFMgjGznhk,1446
20
+ baudolo/seed/__main__.py,sha256=yVWzODjWLBtRVNTOrZNZTV8pBNm6LGWGNKAe7lrJVa8,1874
21
+ backup_docker_to_local-1.0.0.dist-info/METADATA,sha256=XsXf4_FpX_PECc1oJKU4rKgkVsjWuzPuxjz_a5JVPLM,7116
22
+ backup_docker_to_local-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ backup_docker_to_local-1.0.0.dist-info/entry_points.txt,sha256=92f5jPSjW__9-u5gzwmWkdiHKt4ysEFCVmwMtorQCv4,147
24
+ backup_docker_to_local-1.0.0.dist-info/top_level.txt,sha256=y_5iNpF7EdLzqWWXIDfcTJpqijyy2hvrYgNiJXrN4r4,8
25
+ backup_docker_to_local-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ baudolo = baudolo.backup.__main__:main
3
+ baudolo-restore = baudolo.restore.__main__:main
4
+ baudolo-seed = baudolo.seed.__main__:main