repositorypackage
0.0.0-20241226054315-e8b0db77b575
Repository: https://github.com/rjoleary/backup.git
Documentation: pkg.go.dev
# README
Backup
This repo contains tools for my personal backups. Use at your own risk.
Download Dependendencies
On MacOSX:
$ brew install git go rsync vim
Running
To start the backup:
$ go run .
You will be prompted for a password. The config file is encrypted and saved at
~/backuprc.json.enc
.
The available subcommands are:
backup
(default subcommand): Will perform the backup.edit
: Will open Vim to edit the backuprc config file.change-password
: Will change the password on the backuprc config file.
Architecture
Here is a brief overview of the components in the architecture:
- The backup config is encrypted and stored at
~/.backuprc.json.enc
. The config contains settings for one or more Listers and Fetchers. - Listers query services to determine what should be backed up. It outputs one or more Fetchers.
- Fetchers download content into the Staging Area.
- The Staging Area is a mounted encrypted filesystem. Once all the downloads are complete, it is unmounted and uploaded to an Archiver.
- Archivers copy the backup image to one or more remote machines.
+------------------------------------+
| 1. Backup Config |
+------------------------------------+
| |
| v
| +------------------------------------+
| | 2. Listers |
| | +-----------+ +--------+ +-------+ |
| | | BitBucket | | GitHub | | etc.. | |
| | +-----------+ +--------+ +-------+ |
| +------------------------------------+
| |
v v
+-----------------------------------+
| 3. Fetchers |
| +-------+ +-----------+ +-------+ |
| | Local | | git clone | | etc.. | |
| +-------+ +-----------+ +-------+ |
+-----------------------------------+
|
v
+-----------------+
| 4. Staging Area |
+-----------------+
|
v
+----------------------------------------+
| 5. Upload to archive |
| +-----+ +------------------+ +-------+ |
| | GCS | | USB Mass Storage | | etc.. | |
| +-----+ +------------------+ +-------+ |
+----------------------------------------+
Updating Access Token
Github
To update the GitHub Access Token.
- Visit https://github.com/settings/tokens?type=beta and press "Generate new token".
- Use these settings:
a) Token name
backup
b) Expiration30 days
c) Resource ownerrjoleary
d) Repository accessAll Repositories
e) ContentsAccess: Read-only
f) MetadataAccess: Read-only
- Press "Generate Token" and copy the token.
- Paste the token into
go run . edit
.
Git
Run ssh-add ~/.ssh/<your git key>
before running the backup.
GCS
$ brew install google-cloud-sdk
$ gcloud auth login
$ gcloud auth application-default
TODO
Top priority:
- Remote backups
- Cron
- Image file must end in "sparseimage"
- Need directory for .ssh
High priority:
- Backup firefox profile
- Sleep until firefox is closed
- Wait for dropbox to be synced before starting backup
- Per-machine repo for .ssh files
Low priority:
- gitlab repos
- github/bitbucket metadata (stars, ...)
- Make sure times are in UTC