Use rclone for sync, add more instructions

This commit is contained in:
Tyler Hallada 2022-06-29 16:36:32 -04:00
parent 09c87fa93b
commit 4b7a52588c
3 changed files with 16 additions and 5 deletions

View File

@ -43,3 +43,14 @@ NEXUS_API_KEY=...
``` ```
7. Either run `cargo run` for development mode, or build the release binary with `cargo build --release`, which will get saved to `target/release/`. 7. Either run `cargo run` for development mode, or build the release binary with `cargo build --release`, which will get saved to `target/release/`.
## Sync and Backup Setup
`scripts/sync.sh` and `scripts/backup.sh` both utilize [`rclone`](https://rclone.org) to transfer files that are generated on the machine running modmapper to separate servers for file storage.
For these scripts to run successfully you will need to install rclone and setup a remote for `sync.sh` (the "static server") and a remote for `backup.sh` (the "backup server"). Remotes can be created with the `rclone config` command. Then, make sure these variables are defined in the `.env` file corresponding to the remote names and buckets (or folders) within that remote you created:
- `STATIC_SERVER_REMOTE`
- `STATIC_SERVER_BUCKET`
- `BACKUP_SERVER_REMOTE`
- `BACKUP_SERVER_BUCKET`

View File

@ -4,4 +4,4 @@ mkdir -p backups
zip -r -9 backups/plugins.zip plugins -DF --out backups/plugins-update.zip zip -r -9 backups/plugins.zip plugins -DF --out backups/plugins-update.zip
pg_dump -h localhost -U modmapper -Fc modmapper > backups/modmapper-$(date +'%Y-%m-%d').dump pg_dump -h localhost -U modmapper -Fc modmapper > backups/modmapper-$(date +'%Y-%m-%d').dump
find backups/modmapper-*.dump -mtime +30 -type f -delete find backups/modmapper-*.dump -mtime +30 -type f -delete
rclone sync backups dropbox:modmapper rclone sync backups ${BACKUP_SERVER_REMOTE}:${BACKUP_SERVER_BUCKET}

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
export $(grep -v '^#' .env | xargs -d '\n') export $(grep -v '^#' .env | xargs -d '\n')
rsync -raz -e "ssh -p ${STATIC_SERVER_PORT}" cells ${STATIC_SERVER_USER}@${STATIC_SERVER_HOST}:/srv/ rclone sync --fast-list --checksum cells ${STATIC_SERVER_REMOTE}:${STATIC_SERVER_BUCKET}/cells
rsync -raz -e "ssh -p ${STATIC_SERVER_PORT}" mods ${STATIC_SERVER_USER}@${STATIC_SERVER_HOST}:/srv/ rclone sync --fast-list --checksum mods ${STATIC_SERVER_REMOTE}:${STATIC_SERVER_BUCKET}/mods
rsync -raz -e "ssh -p ${STATIC_SERVER_PORT}" plugins_data ${STATIC_SERVER_USER}@${STATIC_SERVER_HOST}:/srv/ rclone sync --fast-list --checksum plugins_data ${STATIC_SERVER_REMOTE}:${STATIC_SERVER_BUCKET}/plugins_data
rsync -raz -e "ssh -p ${STATIC_SERVER_PORT}" files ${STATIC_SERVER_USER}@${STATIC_SERVER_HOST}:/srv/ rclone sync --fast-list --checksum files ${STATIC_SERVER_REMOTE}:${STATIC_SERVER_BUCKET}/files