bup 0.13.3__tar.gz → 0.15.0__tar.gz
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.
- {bup-0.13.3 → bup-0.15.0}/LICENSE +15 -15
- bup-0.15.0/PKG-INFO +209 -0
- bup-0.15.0/README.md +163 -0
- {bup-0.13.3 → bup-0.15.0}/bup/LICENSE +15 -15
- {bup-0.13.3 → bup-0.15.0}/bup/__init__.py +10 -10
- {bup-0.13.3 → bup-0.15.0}/bup/__main__.py +18 -18
- {bup-0.13.3 → bup-0.15.0}/bup/__version__.py +9 -9
- {bup-0.13.3 → bup-0.15.0}/bup/arguments.py +54 -54
- {bup-0.13.3 → bup-0.15.0}/bup/aws_cli.py +128 -124
- bup-0.15.0/bup/aws_prices.py +180 -0
- {bup-0.13.3 → bup-0.15.0}/bup/backup_types.py +7 -7
- {bup-0.13.3 → bup-0.15.0}/bup/bup_base.py +124 -99
- {bup-0.13.3 → bup-0.15.0}/bup/cli/__init__.py +1 -1
- {bup-0.13.3 → bup-0.15.0}/bup/cli/cli_main.py +78 -78
- {bup-0.13.3 → bup-0.15.0}/bup/dynamodb_backup.py +121 -84
- {bup-0.13.3 → bup-0.15.0}/bup/github_backup.py +251 -192
- {bup-0.13.3 → bup-0.15.0}/bup/gpl-3.0.md +675 -675
- {bup-0.13.3 → bup-0.15.0}/bup/gui/__init__.py +8 -7
- {bup-0.13.3 → bup-0.15.0}/bup/gui/about.py +70 -68
- {bup-0.13.3 → bup-0.15.0}/bup/gui/bup_dialog.py +113 -111
- {bup-0.13.3 → bup-0.15.0}/bup/gui/gui_icon.py +24 -24
- {bup-0.13.3 → bup-0.15.0}/bup/gui/gui_main.py +35 -35
- {bup-0.13.3 → bup-0.15.0}/bup/gui/log_widget.py +118 -118
- {bup-0.13.3 → bup-0.15.0}/bup/gui/preferences_widget.py +254 -254
- {bup-0.13.3 → bup-0.15.0}/bup/gui/run_backup_widget.py +232 -232
- bup-0.15.0/bup/gui/transfer_widget.py +127 -0
- {bup-0.13.3 → bup-0.15.0}/bup/log_routing.py +124 -124
- {bup-0.13.3 → bup-0.15.0}/bup/preferences.py +84 -84
- {bup-0.13.3 → bup-0.15.0}/bup/robust_os_calls.py +63 -63
- bup-0.15.0/bup/s3_backup.py +453 -0
- bup-0.15.0/bup/transfer.py +109 -0
- {bup-0.13.3 → bup-0.15.0}/bup/ui_types.py +6 -6
- bup-0.15.0/bup.egg-info/PKG-INFO +209 -0
- {bup-0.13.3 → bup-0.15.0}/bup.egg-info/SOURCES.txt +4 -2
- {bup-0.13.3 → bup-0.15.0}/pyproject.toml +90 -76
- {bup-0.13.3 → bup-0.15.0}/setup.cfg +4 -4
- bup-0.13.3/LICENSE.txt +0 -15
- bup-0.13.3/PKG-INFO +0 -79
- bup-0.13.3/README.md +0 -36
- bup-0.13.3/bup/s3_backup.py +0 -213
- bup-0.13.3/bup.egg-info/PKG-INFO +0 -79
- {bup-0.13.3 → bup-0.15.0}/bup/bup.ico +0 -0
- {bup-0.13.3 → bup-0.15.0}/bup/bup.png +0 -0
- {bup-0.13.3 → bup-0.15.0}/bup.egg-info/dependency_links.txt +0 -0
- {bup-0.13.3 → bup-0.15.0}/bup.egg-info/entry_points.txt +0 -0
- {bup-0.13.3 → bup-0.15.0}/bup.egg-info/requires.txt +0 -0
- {bup-0.13.3 → bup-0.15.0}/bup.egg-info/top_level.txt +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
bup - AWS and github local backup
|
|
2
|
-
Copyright (C) 2020-2026 James Abel
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU General Public License as published by
|
|
6
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
(at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU General Public License
|
|
15
|
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
1
|
+
bup - AWS and github local backup
|
|
2
|
+
Copyright (C) 2020-2026 James Abel
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
bup-0.15.0/PKG-INFO
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bup
|
|
3
|
+
Version: 0.15.0
|
|
4
|
+
Summary: backup all your AWS S3 buckets and DynamoDB tables, and github repos to a backup directory/folder
|
|
5
|
+
Author-email: abel <j@abel.co>
|
|
6
|
+
License-Expression: GPL-3.0-only
|
|
7
|
+
Project-URL: Homepage, https://github.com/jamesabel/bup
|
|
8
|
+
Project-URL: Download, https://github.com/jamesabel/bup
|
|
9
|
+
Keywords: aws,dynamodb,s3,github,backup
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
14
|
+
Requires-Python: >=3.13
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: ismain
|
|
18
|
+
Requires-Dist: balsa
|
|
19
|
+
Requires-Dist: boto3
|
|
20
|
+
Requires-Dist: typeguard
|
|
21
|
+
Requires-Dist: awsimple
|
|
22
|
+
Requires-Dist: awscli
|
|
23
|
+
Requires-Dist: GitPython
|
|
24
|
+
Requires-Dist: github3.py
|
|
25
|
+
Requires-Dist: sqlitedict
|
|
26
|
+
Requires-Dist: tobool
|
|
27
|
+
Requires-Dist: attrs
|
|
28
|
+
Requires-Dist: appdirs
|
|
29
|
+
Requires-Dist: pref
|
|
30
|
+
Requires-Dist: pyqt5
|
|
31
|
+
Requires-Dist: python-dotenv
|
|
32
|
+
Requires-Dist: sentry-sdk
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: wheel; extra == "dev"
|
|
35
|
+
Requires-Dist: black; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest; extra == "dev"
|
|
37
|
+
Requires-Dist: moto[server]; extra == "dev"
|
|
38
|
+
Requires-Dist: coverage; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
40
|
+
Requires-Dist: pyship; extra == "dev"
|
|
41
|
+
Requires-Dist: flake8; extra == "dev"
|
|
42
|
+
Requires-Dist: PyQt5-stubs; extra == "dev"
|
|
43
|
+
Requires-Dist: build; extra == "dev"
|
|
44
|
+
Requires-Dist: twine; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<a href="https://github.com/jamesabel/bup/actions/workflows/ci.yml">
|
|
49
|
+
<img src="https://img.shields.io/github/actions/workflow/status/jamesabel/bup/ci.yml?branch=main&label=tests" alt="tests" />
|
|
50
|
+
</a>
|
|
51
|
+
<a href="https://codecov.io/gh/jamesabel/bup">
|
|
52
|
+
<img src="https://img.shields.io/codecov/c/github/jamesabel/bup/main" alt="coverage" />
|
|
53
|
+
</a>
|
|
54
|
+
<a href="https://pypi.org/project/bup/">
|
|
55
|
+
<img src="https://img.shields.io/pypi/v/bup" alt="PyPI version" />
|
|
56
|
+
</a>
|
|
57
|
+
<a href="https://pypi.org/project/bup/">
|
|
58
|
+
<img src="https://img.shields.io/pypi/pyversions/bup" alt="Python versions" />
|
|
59
|
+
</a>
|
|
60
|
+
<a href="https://pypi.org/project/bup/">
|
|
61
|
+
<img src="https://img.shields.io/pypi/dm/bup" alt="downloads per month" />
|
|
62
|
+
</a>
|
|
63
|
+
<a href="https://github.com/jamesabel/bup/blob/main/LICENSE">
|
|
64
|
+
<img src="https://img.shields.io/pypi/l/bup" alt="license" />
|
|
65
|
+
</a>
|
|
66
|
+
<a href="https://github.com/psf/black">
|
|
67
|
+
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="code style: black" />
|
|
68
|
+
</a>
|
|
69
|
+
</p>
|
|
70
|
+
|
|
71
|
+
# bup
|
|
72
|
+
|
|
73
|
+
backup for github repos and AWS S3 and DynamoDB
|
|
74
|
+
|
|
75
|
+
# Exclusions
|
|
76
|
+
|
|
77
|
+
Each backup type (S3, DynamoDB, GitHub) has an exclusion list: names to skip, one per line. S3 entries are bucket
|
|
78
|
+
names, DynamoDB entries are table names, and GitHub entries are either a repo name (`my-repo`) or `owner/my-repo`.
|
|
79
|
+
Exclusion lists are edited in the GUI's "Exclusions" box for each backup type.
|
|
80
|
+
|
|
81
|
+
The same syntax applies to all three lists (S3 buckets, DynamoDB tables, and GitHub repos):
|
|
82
|
+
|
|
83
|
+
- `#` starts a comment that runs to the end of the line. This works for whole-line comments and for inline
|
|
84
|
+
trailing comments, e.g. `my-bucket # too big, backed up elsewhere`.
|
|
85
|
+
- Blank and whitespace-only lines are ignored.
|
|
86
|
+
- Leading and trailing whitespace around a name is ignored, so ` my-bucket ` matches `my-bucket`.
|
|
87
|
+
- Names are matched exactly (no wildcards).
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
# S3 buckets to skip
|
|
91
|
+
logs-archive # 2 TB, backed up by a lifecycle rule instead
|
|
92
|
+
scratch-bucket
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
# S3 backup verification
|
|
96
|
+
|
|
97
|
+
After each bucket is synced (`aws s3 sync`, deliberately without `--delete` so that objects deleted from S3 are
|
|
98
|
+
kept in the local backup), bup lists the bucket with boto3 and compares its total size in bytes to the total size
|
|
99
|
+
of the local backup directory. The comparison is by bytes, not by object count, because `aws s3 sync` does not
|
|
100
|
+
copy zero-length objects. The S3 object count and the local file count are included in the result line for
|
|
101
|
+
reference only.
|
|
102
|
+
|
|
103
|
+
There are three outcomes:
|
|
104
|
+
|
|
105
|
+
- **S3 is larger than the local backup** - something was not backed up. This is reported as an **error** in the
|
|
106
|
+
backup output (the GUI's "Backup" tab, or the CLI's console output, where it also makes the CLI exit with a
|
|
107
|
+
non-zero status).
|
|
108
|
+
- **Local backup is larger than S3** - expected over time, since deletions in S3 are retained locally. Logged as
|
|
109
|
+
info only.
|
|
110
|
+
- **Match** - logged as info only.
|
|
111
|
+
|
|
112
|
+
The info-level result lines are not shown in the backup output. They go to the application log: in the GUI this is
|
|
113
|
+
the "Log" tab (the "AWS S3" pane), and in the CLI it is the console with `-v`/`--verbose`. If a detailed log
|
|
114
|
+
directory is configured in Preferences, each backup type's log also goes to its own file there (`s3.log`,
|
|
115
|
+
`dynamodb.log`, `github.log`, `application.log`). A result line looks like:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
my-bucket : local backup is larger than S3 (files deleted from S3 are retained locally) (synced=3, s3_count=120, local_count=125; s3_total_size=10485760, local_size=10520000)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## A lower local file count, and files that download every run
|
|
122
|
+
|
|
123
|
+
`aws s3 sync` matches each S3 key against the local relative path as an exact string. Two consequences show up
|
|
124
|
+
in the result lines, and bup explains both - and fixes the second:
|
|
125
|
+
|
|
126
|
+
- **Fewer local files than S3 objects** (`local_count` below `s3_count`). When this happens, bup lists the bucket
|
|
127
|
+
again and compares the keys to the local files. Zero-byte objects whose key ends in `/` (the S3 console's
|
|
128
|
+
"Create folder") are *folder markers* - `aws s3 sync` never downloads them, so they are expected to be absent and
|
|
129
|
+
are listed in the application log as info. Any other object with no local file at exactly its path is a
|
|
130
|
+
**warning** in the backup output, naming the object and, when a similarly named local file or directory exists,
|
|
131
|
+
how the names differ.
|
|
132
|
+
- **A file that is downloaded on every run** even though it is already backed up. On Windows, file names are
|
|
133
|
+
case-insensitive and trailing spaces and dots are stripped, so a download can land in an existing file or
|
|
134
|
+
directory whose on-disk name differs from the S3 key. Sync then never sees an exact match and downloads the
|
|
135
|
+
file again each run. After each sync, bup checks the local name of every downloaded file against its key and,
|
|
136
|
+
since the download just made is the current version, **renames the local file or directory to the key's exact
|
|
137
|
+
name** (outermost component first - renaming a directory fixes everything under it at once). Each rename is
|
|
138
|
+
reported as info in the backup output, and the next sync finds the file already backed up. A name the file
|
|
139
|
+
system cannot store (e.g. a key ending in a space, on Windows) or a rename that fails is a **warning** naming
|
|
140
|
+
the file and the reason. A dry run renames nothing and reports the mismatch as a warning instead.
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
my-bucket : renamed "D:\b\s3\my-bucket\static\Vendor" to "vendor" to match the S3 key "static/vendor/select2.js" so the next sync finds it already backed up
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### How S3 key case is handled
|
|
147
|
+
|
|
148
|
+
S3 keys are case-sensitive: `Photos/IMG_1.jpg` and `photos/img_1.jpg` are two different objects. bup never changes
|
|
149
|
+
or folds the case of a key - the local path of every object is made to match its key exactly, character for
|
|
150
|
+
character, on every platform.
|
|
151
|
+
|
|
152
|
+
- **Case-sensitive file systems** (Linux, and macOS or Windows volumes formatted case-sensitive): the local path is
|
|
153
|
+
always the key as-is, so case needs no special handling and keys that differ only in case are stored as separate
|
|
154
|
+
files.
|
|
155
|
+
- **Case-insensitive file systems** (the Windows default, and macOS by default): a download can land in an existing
|
|
156
|
+
file or directory whose name differs from the key only in case, e.g. a key `static/vendor/select2.js` landing
|
|
157
|
+
under an existing `static\Vendor` directory. `aws s3 sync` compares names as exact strings, so it would never
|
|
158
|
+
see a match and would download that object again on every run. After each sync, bup compares the local name of
|
|
159
|
+
every downloaded file to its key, component by component, and renames any that differ only in case (or only in
|
|
160
|
+
Unicode normalization, or by a trailing space or dot) to the key's exact spelling, reporting each rename as
|
|
161
|
+
info. A dry run reports the mismatch as a warning instead of renaming.
|
|
162
|
+
- **Keys that differ only in case** (`Readme.md` and `readme.md` in the same prefix) cannot both exist on a
|
|
163
|
+
case-insensitive file system: they share one local file, so bup reports a case mismatch and re-downloads them on
|
|
164
|
+
every run. Back up such a bucket to a case-sensitive file system to keep both objects.
|
|
165
|
+
|
|
166
|
+
# Transfer and approximate AWS cost
|
|
167
|
+
|
|
168
|
+
AWS charges for data sent out to the internet, which is what a backup is. bup reports what each backup received and
|
|
169
|
+
approximately what AWS charges for it. In the GUI this is in the "Transfer" tab (and the application log), with one row
|
|
170
|
+
per S3 bucket, DynamoDB table or GitHub repo that received anything and a total per backup type. The CLI prints the
|
|
171
|
+
same lines in its regular output.
|
|
172
|
+
|
|
173
|
+
- **S3:** the total size of the files `aws s3 sync` downloaded, priced as data transfer out.
|
|
174
|
+
- **DynamoDB:** the size of the table scan responses, priced as data transfer out, plus the read units the scan
|
|
175
|
+
consumed, priced as on-demand reads. Tables are only scanned when they have changed or about once a day, so many
|
|
176
|
+
runs receive nothing.
|
|
177
|
+
- **GitHub:** how much the local repository grew from a clone or fetch. GitHub does not charge for this, so it is
|
|
178
|
+
informational only (e.g. to notice a repo that suddenly transfers a lot).
|
|
179
|
+
|
|
180
|
+
The costs are estimates:
|
|
181
|
+
|
|
182
|
+
- bup gets the prices itself, so there is nothing to enter. AWS prices differ by region, so each S3 bucket is priced
|
|
183
|
+
at the rates of the region it is in and each DynamoDB table at the rates of the region it is read from. The prices
|
|
184
|
+
come from the public AWS Price List files at `pricing.us-east-1.amazonaws.com` (no AWS credentials or permissions
|
|
185
|
+
are needed), are cached in a local SQLite database (`aws_prices.db` in
|
|
186
|
+
bup's user cache directory), and are fetched again when they are more than a week old. The Transfer tab shows the
|
|
187
|
+
prices in use and when they were fetched.
|
|
188
|
+
- If the prices can not be fetched (e.g. the price list is unreachable) the previously fetched prices are used. If
|
|
189
|
+
there are none yet, the transfer is reported without a cost.
|
|
190
|
+
- Volume discounts are not applied (the price used is that of the first 10 TB a month).
|
|
191
|
+
- AWS does not charge for the first 100 GB of data transfer out a month, shared by the whole AWS account. bup does
|
|
192
|
+
not know how much of that allowance is left, so the cost shown is before the allowance - the most the transfer could
|
|
193
|
+
cost, not necessarily what you are billed.
|
|
194
|
+
- Request charges (e.g. S3 GET and LIST) are not included.
|
|
195
|
+
- DynamoDB reads are priced as on-demand. A table with provisioned capacity has already paid for its reads.
|
|
196
|
+
- A dry run reports nothing, since nothing is transferred.
|
|
197
|
+
|
|
198
|
+
# Security Notes
|
|
199
|
+
|
|
200
|
+
- Credentials you enter (AWS secret access key, GitHub token) are stored **unencrypted** in a local
|
|
201
|
+
SQLite preferences database in your user profile. Prefer AWS profiles (`~/.aws/credentials`) over
|
|
202
|
+
raw keys where possible, and treat the preferences database with the same care as a credentials file.
|
|
203
|
+
- GitHub authentication for clone/pull is passed to git via the process environment, so the token is
|
|
204
|
+
not written into each backup's `.git/config`. Backups made by older versions of bup may still have
|
|
205
|
+
a token embedded in their remote URL; bup scrubs these the next time each repo is pulled.
|
|
206
|
+
|
|
207
|
+
# Acknowledgements
|
|
208
|
+
|
|
209
|
+
<div>Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
|
bup-0.15.0/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/jamesabel/bup/actions/workflows/ci.yml">
|
|
3
|
+
<img src="https://img.shields.io/github/actions/workflow/status/jamesabel/bup/ci.yml?branch=main&label=tests" alt="tests" />
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://codecov.io/gh/jamesabel/bup">
|
|
6
|
+
<img src="https://img.shields.io/codecov/c/github/jamesabel/bup/main" alt="coverage" />
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://pypi.org/project/bup/">
|
|
9
|
+
<img src="https://img.shields.io/pypi/v/bup" alt="PyPI version" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://pypi.org/project/bup/">
|
|
12
|
+
<img src="https://img.shields.io/pypi/pyversions/bup" alt="Python versions" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://pypi.org/project/bup/">
|
|
15
|
+
<img src="https://img.shields.io/pypi/dm/bup" alt="downloads per month" />
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/jamesabel/bup/blob/main/LICENSE">
|
|
18
|
+
<img src="https://img.shields.io/pypi/l/bup" alt="license" />
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/psf/black">
|
|
21
|
+
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="code style: black" />
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
# bup
|
|
26
|
+
|
|
27
|
+
backup for github repos and AWS S3 and DynamoDB
|
|
28
|
+
|
|
29
|
+
# Exclusions
|
|
30
|
+
|
|
31
|
+
Each backup type (S3, DynamoDB, GitHub) has an exclusion list: names to skip, one per line. S3 entries are bucket
|
|
32
|
+
names, DynamoDB entries are table names, and GitHub entries are either a repo name (`my-repo`) or `owner/my-repo`.
|
|
33
|
+
Exclusion lists are edited in the GUI's "Exclusions" box for each backup type.
|
|
34
|
+
|
|
35
|
+
The same syntax applies to all three lists (S3 buckets, DynamoDB tables, and GitHub repos):
|
|
36
|
+
|
|
37
|
+
- `#` starts a comment that runs to the end of the line. This works for whole-line comments and for inline
|
|
38
|
+
trailing comments, e.g. `my-bucket # too big, backed up elsewhere`.
|
|
39
|
+
- Blank and whitespace-only lines are ignored.
|
|
40
|
+
- Leading and trailing whitespace around a name is ignored, so ` my-bucket ` matches `my-bucket`.
|
|
41
|
+
- Names are matched exactly (no wildcards).
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
# S3 buckets to skip
|
|
45
|
+
logs-archive # 2 TB, backed up by a lifecycle rule instead
|
|
46
|
+
scratch-bucket
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
# S3 backup verification
|
|
50
|
+
|
|
51
|
+
After each bucket is synced (`aws s3 sync`, deliberately without `--delete` so that objects deleted from S3 are
|
|
52
|
+
kept in the local backup), bup lists the bucket with boto3 and compares its total size in bytes to the total size
|
|
53
|
+
of the local backup directory. The comparison is by bytes, not by object count, because `aws s3 sync` does not
|
|
54
|
+
copy zero-length objects. The S3 object count and the local file count are included in the result line for
|
|
55
|
+
reference only.
|
|
56
|
+
|
|
57
|
+
There are three outcomes:
|
|
58
|
+
|
|
59
|
+
- **S3 is larger than the local backup** - something was not backed up. This is reported as an **error** in the
|
|
60
|
+
backup output (the GUI's "Backup" tab, or the CLI's console output, where it also makes the CLI exit with a
|
|
61
|
+
non-zero status).
|
|
62
|
+
- **Local backup is larger than S3** - expected over time, since deletions in S3 are retained locally. Logged as
|
|
63
|
+
info only.
|
|
64
|
+
- **Match** - logged as info only.
|
|
65
|
+
|
|
66
|
+
The info-level result lines are not shown in the backup output. They go to the application log: in the GUI this is
|
|
67
|
+
the "Log" tab (the "AWS S3" pane), and in the CLI it is the console with `-v`/`--verbose`. If a detailed log
|
|
68
|
+
directory is configured in Preferences, each backup type's log also goes to its own file there (`s3.log`,
|
|
69
|
+
`dynamodb.log`, `github.log`, `application.log`). A result line looks like:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
my-bucket : local backup is larger than S3 (files deleted from S3 are retained locally) (synced=3, s3_count=120, local_count=125; s3_total_size=10485760, local_size=10520000)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## A lower local file count, and files that download every run
|
|
76
|
+
|
|
77
|
+
`aws s3 sync` matches each S3 key against the local relative path as an exact string. Two consequences show up
|
|
78
|
+
in the result lines, and bup explains both - and fixes the second:
|
|
79
|
+
|
|
80
|
+
- **Fewer local files than S3 objects** (`local_count` below `s3_count`). When this happens, bup lists the bucket
|
|
81
|
+
again and compares the keys to the local files. Zero-byte objects whose key ends in `/` (the S3 console's
|
|
82
|
+
"Create folder") are *folder markers* - `aws s3 sync` never downloads them, so they are expected to be absent and
|
|
83
|
+
are listed in the application log as info. Any other object with no local file at exactly its path is a
|
|
84
|
+
**warning** in the backup output, naming the object and, when a similarly named local file or directory exists,
|
|
85
|
+
how the names differ.
|
|
86
|
+
- **A file that is downloaded on every run** even though it is already backed up. On Windows, file names are
|
|
87
|
+
case-insensitive and trailing spaces and dots are stripped, so a download can land in an existing file or
|
|
88
|
+
directory whose on-disk name differs from the S3 key. Sync then never sees an exact match and downloads the
|
|
89
|
+
file again each run. After each sync, bup checks the local name of every downloaded file against its key and,
|
|
90
|
+
since the download just made is the current version, **renames the local file or directory to the key's exact
|
|
91
|
+
name** (outermost component first - renaming a directory fixes everything under it at once). Each rename is
|
|
92
|
+
reported as info in the backup output, and the next sync finds the file already backed up. A name the file
|
|
93
|
+
system cannot store (e.g. a key ending in a space, on Windows) or a rename that fails is a **warning** naming
|
|
94
|
+
the file and the reason. A dry run renames nothing and reports the mismatch as a warning instead.
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
my-bucket : renamed "D:\b\s3\my-bucket\static\Vendor" to "vendor" to match the S3 key "static/vendor/select2.js" so the next sync finds it already backed up
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### How S3 key case is handled
|
|
101
|
+
|
|
102
|
+
S3 keys are case-sensitive: `Photos/IMG_1.jpg` and `photos/img_1.jpg` are two different objects. bup never changes
|
|
103
|
+
or folds the case of a key - the local path of every object is made to match its key exactly, character for
|
|
104
|
+
character, on every platform.
|
|
105
|
+
|
|
106
|
+
- **Case-sensitive file systems** (Linux, and macOS or Windows volumes formatted case-sensitive): the local path is
|
|
107
|
+
always the key as-is, so case needs no special handling and keys that differ only in case are stored as separate
|
|
108
|
+
files.
|
|
109
|
+
- **Case-insensitive file systems** (the Windows default, and macOS by default): a download can land in an existing
|
|
110
|
+
file or directory whose name differs from the key only in case, e.g. a key `static/vendor/select2.js` landing
|
|
111
|
+
under an existing `static\Vendor` directory. `aws s3 sync` compares names as exact strings, so it would never
|
|
112
|
+
see a match and would download that object again on every run. After each sync, bup compares the local name of
|
|
113
|
+
every downloaded file to its key, component by component, and renames any that differ only in case (or only in
|
|
114
|
+
Unicode normalization, or by a trailing space or dot) to the key's exact spelling, reporting each rename as
|
|
115
|
+
info. A dry run reports the mismatch as a warning instead of renaming.
|
|
116
|
+
- **Keys that differ only in case** (`Readme.md` and `readme.md` in the same prefix) cannot both exist on a
|
|
117
|
+
case-insensitive file system: they share one local file, so bup reports a case mismatch and re-downloads them on
|
|
118
|
+
every run. Back up such a bucket to a case-sensitive file system to keep both objects.
|
|
119
|
+
|
|
120
|
+
# Transfer and approximate AWS cost
|
|
121
|
+
|
|
122
|
+
AWS charges for data sent out to the internet, which is what a backup is. bup reports what each backup received and
|
|
123
|
+
approximately what AWS charges for it. In the GUI this is in the "Transfer" tab (and the application log), with one row
|
|
124
|
+
per S3 bucket, DynamoDB table or GitHub repo that received anything and a total per backup type. The CLI prints the
|
|
125
|
+
same lines in its regular output.
|
|
126
|
+
|
|
127
|
+
- **S3:** the total size of the files `aws s3 sync` downloaded, priced as data transfer out.
|
|
128
|
+
- **DynamoDB:** the size of the table scan responses, priced as data transfer out, plus the read units the scan
|
|
129
|
+
consumed, priced as on-demand reads. Tables are only scanned when they have changed or about once a day, so many
|
|
130
|
+
runs receive nothing.
|
|
131
|
+
- **GitHub:** how much the local repository grew from a clone or fetch. GitHub does not charge for this, so it is
|
|
132
|
+
informational only (e.g. to notice a repo that suddenly transfers a lot).
|
|
133
|
+
|
|
134
|
+
The costs are estimates:
|
|
135
|
+
|
|
136
|
+
- bup gets the prices itself, so there is nothing to enter. AWS prices differ by region, so each S3 bucket is priced
|
|
137
|
+
at the rates of the region it is in and each DynamoDB table at the rates of the region it is read from. The prices
|
|
138
|
+
come from the public AWS Price List files at `pricing.us-east-1.amazonaws.com` (no AWS credentials or permissions
|
|
139
|
+
are needed), are cached in a local SQLite database (`aws_prices.db` in
|
|
140
|
+
bup's user cache directory), and are fetched again when they are more than a week old. The Transfer tab shows the
|
|
141
|
+
prices in use and when they were fetched.
|
|
142
|
+
- If the prices can not be fetched (e.g. the price list is unreachable) the previously fetched prices are used. If
|
|
143
|
+
there are none yet, the transfer is reported without a cost.
|
|
144
|
+
- Volume discounts are not applied (the price used is that of the first 10 TB a month).
|
|
145
|
+
- AWS does not charge for the first 100 GB of data transfer out a month, shared by the whole AWS account. bup does
|
|
146
|
+
not know how much of that allowance is left, so the cost shown is before the allowance - the most the transfer could
|
|
147
|
+
cost, not necessarily what you are billed.
|
|
148
|
+
- Request charges (e.g. S3 GET and LIST) are not included.
|
|
149
|
+
- DynamoDB reads are priced as on-demand. A table with provisioned capacity has already paid for its reads.
|
|
150
|
+
- A dry run reports nothing, since nothing is transferred.
|
|
151
|
+
|
|
152
|
+
# Security Notes
|
|
153
|
+
|
|
154
|
+
- Credentials you enter (AWS secret access key, GitHub token) are stored **unencrypted** in a local
|
|
155
|
+
SQLite preferences database in your user profile. Prefer AWS profiles (`~/.aws/credentials`) over
|
|
156
|
+
raw keys where possible, and treat the preferences database with the same care as a credentials file.
|
|
157
|
+
- GitHub authentication for clone/pull is passed to git via the process environment, so the token is
|
|
158
|
+
not written into each backup's `.git/config`. Backups made by older versions of bup may still have
|
|
159
|
+
a token embedded in their remote URL; bup scrubs these the next time each repo is pulled.
|
|
160
|
+
|
|
161
|
+
# Acknowledgements
|
|
162
|
+
|
|
163
|
+
<div>Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
bup - AWS and github local backup
|
|
2
|
-
Copyright (C) 2020-2026 James Abel
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU General Public License as published by
|
|
6
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
(at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU General Public License
|
|
15
|
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
1
|
+
bup - AWS and github local backup
|
|
2
|
+
Copyright (C) 2020-2026 James Abel
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from .__version__ import __application_name__, __version__, __description__, __author__, __url__, __download_url__, __author_url__
|
|
2
|
-
from .robust_os_calls import rmdir
|
|
3
|
-
from .ui_types import UITypes
|
|
4
|
-
from .arguments import arguments
|
|
5
|
-
from .preferences import BupPreferences, get_preferences, ExclusionPreferences
|
|
6
|
-
from .backup_types import BackupTypes
|
|
7
|
-
from .bup_base import BupBase
|
|
8
|
-
from .s3_backup import S3Backup
|
|
9
|
-
from .dynamodb_backup import DynamoDBBackup
|
|
10
|
-
from .github_backup import GithubBackup
|
|
1
|
+
from .__version__ import __application_name__, __version__, __description__, __author__, __url__, __download_url__, __author_url__
|
|
2
|
+
from .robust_os_calls import rmdir
|
|
3
|
+
from .ui_types import UITypes
|
|
4
|
+
from .arguments import arguments
|
|
5
|
+
from .preferences import BupPreferences, get_preferences, ExclusionPreferences
|
|
6
|
+
from .backup_types import BackupTypes
|
|
7
|
+
from .bup_base import BupBase
|
|
8
|
+
from .s3_backup import S3Backup
|
|
9
|
+
from .dynamodb_backup import DynamoDBBackup
|
|
10
|
+
from .github_backup import GithubBackup
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
from ismain import is_main
|
|
2
|
-
|
|
3
|
-
from bup import arguments
|
|
4
|
-
from bup.cli import cli_main
|
|
5
|
-
from bup.gui import gui_main
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def main():
|
|
9
|
-
args = arguments()
|
|
10
|
-
if args is None:
|
|
11
|
-
gui_main()
|
|
12
|
-
else:
|
|
13
|
-
# if we've not been given anything to do on the command line, then it must be CLI
|
|
14
|
-
cli_main(args)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if is_main():
|
|
18
|
-
main()
|
|
1
|
+
from ismain import is_main
|
|
2
|
+
|
|
3
|
+
from bup import arguments
|
|
4
|
+
from bup.cli import cli_main
|
|
5
|
+
from bup.gui import gui_main
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
args = arguments()
|
|
10
|
+
if args is None:
|
|
11
|
+
gui_main()
|
|
12
|
+
else:
|
|
13
|
+
# if we've not been given anything to do on the command line, then it must be CLI
|
|
14
|
+
cli_main(args)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
if is_main():
|
|
18
|
+
main()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
__version__ = "0.
|
|
2
|
-
__application_name__ = "bup"
|
|
3
|
-
__title__ = __application_name__
|
|
4
|
-
__author__ = "abel"
|
|
5
|
-
__author_email__ = "j@abel.co"
|
|
6
|
-
__author_url__ = "https://www.abel.co"
|
|
7
|
-
__url__ = "https://github.com/jamesabel/bup"
|
|
8
|
-
__download_url__ = __url__
|
|
9
|
-
__description__ = "backup all your AWS S3 buckets and DynamoDB tables, and github repos to a backup directory/folder"
|
|
1
|
+
__version__ = "0.15.0"
|
|
2
|
+
__application_name__ = "bup"
|
|
3
|
+
__title__ = __application_name__
|
|
4
|
+
__author__ = "abel"
|
|
5
|
+
__author_email__ = "j@abel.co"
|
|
6
|
+
__author_url__ = "https://www.abel.co"
|
|
7
|
+
__url__ = "https://github.com/jamesabel/bup"
|
|
8
|
+
__download_url__ = __url__
|
|
9
|
+
__description__ = "backup all your AWS S3 buckets and DynamoDB tables, and github repos to a backup directory/folder"
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
import sys
|
|
4
|
-
|
|
5
|
-
from balsa import verbose_arg_string, log_dir_arg_string, delete_existing_arg_string
|
|
6
|
-
|
|
7
|
-
from bup import __application_name__, __version__, __description__
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def arguments():
|
|
11
|
-
|
|
12
|
-
version_string = "version"
|
|
13
|
-
|
|
14
|
-
if f"--{version_string}" in [a.lower() for a in sys.argv[1:]]:
|
|
15
|
-
print(__version__)
|
|
16
|
-
sys.exit()
|
|
17
|
-
|
|
18
|
-
if len(sys.argv) > 1:
|
|
19
|
-
|
|
20
|
-
parser = argparse.ArgumentParser(
|
|
21
|
-
prog=__application_name__,
|
|
22
|
-
description=__description__,
|
|
23
|
-
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
24
|
-
epilog=f"{__application_name__} V{__version__}, see github.com/jamesabel/bup for LICENSE",
|
|
25
|
-
)
|
|
26
|
-
parser.add_argument("path", help="directory to back up to")
|
|
27
|
-
parser.add_argument("-s", "--s3", action="store_true", default=False, help="backup AWS S3")
|
|
28
|
-
parser.add_argument("-d", "--dynamodb", action="store_true", default=False, help="backup AWS DynamoDB")
|
|
29
|
-
parser.add_argument("-a", "--aws", action="store_true", default=False, help="backup both AWS S3 and DynamoDB")
|
|
30
|
-
parser.add_argument("-g", "--github", action="store_true", default=False, help="backup github")
|
|
31
|
-
parser.add_argument(
|
|
32
|
-
"-e",
|
|
33
|
-
"--exclude",
|
|
34
|
-
nargs="*",
|
|
35
|
-
help="exclude these AWS S3 buckets and/or tables (only do one backup type at a time when setting exclusions - these values are saved and used on subsequent runs)",
|
|
36
|
-
)
|
|
37
|
-
parser.add_argument("-p", "--profile", help="AWS profile (uses the default AWS profile if not given)")
|
|
38
|
-
parser.add_argument("-r", "--region", help="AWS region (uses the default AWS region if not given)")
|
|
39
|
-
parser.add_argument("-t", "--token", help="github token (saved and used on subsequent runs)")
|
|
40
|
-
parser.add_argument("--dry_run", action="store_true", default=False, help="displays operations that would be performed using the specified command without actually running them")
|
|
41
|
-
parser.add_argument("--size_only", action="store_true", default=False, help="AWS S3 sync compares file size only, not timestamps (aws s3 sync --size-only)")
|
|
42
|
-
parser.add_argument(f"--{version_string}", action="store_true", default=False, help="display version and exit")
|
|
43
|
-
parser.add_argument("-v", f"--{verbose_arg_string}", dest=verbose_arg_string, action="store_true", default=False, help="set verbose")
|
|
44
|
-
parser.add_argument("-l", f"--{log_dir_arg_string}", dest=log_dir_arg_string, help="log dir")
|
|
45
|
-
parser.add_argument(f"--{delete_existing_arg_string}", dest=delete_existing_arg_string, action="store_true", default=False, help="delete existing logs")
|
|
46
|
-
args = parser.parse_args()
|
|
47
|
-
|
|
48
|
-
if args.logdir is None and args.path is not None:
|
|
49
|
-
# put the logs in the backup dir unless explicitly given
|
|
50
|
-
args.logdir = Path(args.path, "log")
|
|
51
|
-
else:
|
|
52
|
-
args = None
|
|
53
|
-
|
|
54
|
-
return args
|
|
1
|
+
import argparse
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from balsa import verbose_arg_string, log_dir_arg_string, delete_existing_arg_string
|
|
6
|
+
|
|
7
|
+
from bup import __application_name__, __version__, __description__
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def arguments():
|
|
11
|
+
|
|
12
|
+
version_string = "version"
|
|
13
|
+
|
|
14
|
+
if f"--{version_string}" in [a.lower() for a in sys.argv[1:]]:
|
|
15
|
+
print(__version__)
|
|
16
|
+
sys.exit()
|
|
17
|
+
|
|
18
|
+
if len(sys.argv) > 1:
|
|
19
|
+
|
|
20
|
+
parser = argparse.ArgumentParser(
|
|
21
|
+
prog=__application_name__,
|
|
22
|
+
description=__description__,
|
|
23
|
+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
24
|
+
epilog=f"{__application_name__} V{__version__}, see github.com/jamesabel/bup for LICENSE",
|
|
25
|
+
)
|
|
26
|
+
parser.add_argument("path", help="directory to back up to")
|
|
27
|
+
parser.add_argument("-s", "--s3", action="store_true", default=False, help="backup AWS S3")
|
|
28
|
+
parser.add_argument("-d", "--dynamodb", action="store_true", default=False, help="backup AWS DynamoDB")
|
|
29
|
+
parser.add_argument("-a", "--aws", action="store_true", default=False, help="backup both AWS S3 and DynamoDB")
|
|
30
|
+
parser.add_argument("-g", "--github", action="store_true", default=False, help="backup github")
|
|
31
|
+
parser.add_argument(
|
|
32
|
+
"-e",
|
|
33
|
+
"--exclude",
|
|
34
|
+
nargs="*",
|
|
35
|
+
help="exclude these AWS S3 buckets and/or tables (only do one backup type at a time when setting exclusions - these values are saved and used on subsequent runs)",
|
|
36
|
+
)
|
|
37
|
+
parser.add_argument("-p", "--profile", help="AWS profile (uses the default AWS profile if not given)")
|
|
38
|
+
parser.add_argument("-r", "--region", help="AWS region (uses the default AWS region if not given)")
|
|
39
|
+
parser.add_argument("-t", "--token", help="github token (saved and used on subsequent runs)")
|
|
40
|
+
parser.add_argument("--dry_run", action="store_true", default=False, help="displays operations that would be performed using the specified command without actually running them")
|
|
41
|
+
parser.add_argument("--size_only", action="store_true", default=False, help="AWS S3 sync compares file size only, not timestamps (aws s3 sync --size-only)")
|
|
42
|
+
parser.add_argument(f"--{version_string}", action="store_true", default=False, help="display version and exit")
|
|
43
|
+
parser.add_argument("-v", f"--{verbose_arg_string}", dest=verbose_arg_string, action="store_true", default=False, help="set verbose")
|
|
44
|
+
parser.add_argument("-l", f"--{log_dir_arg_string}", dest=log_dir_arg_string, help="log dir")
|
|
45
|
+
parser.add_argument(f"--{delete_existing_arg_string}", dest=delete_existing_arg_string, action="store_true", default=False, help="delete existing logs")
|
|
46
|
+
args = parser.parse_args()
|
|
47
|
+
|
|
48
|
+
if args.logdir is None and args.path is not None:
|
|
49
|
+
# put the logs in the backup dir unless explicitly given
|
|
50
|
+
args.logdir = Path(args.path, "log")
|
|
51
|
+
else:
|
|
52
|
+
args = None
|
|
53
|
+
|
|
54
|
+
return args
|