From dcfb45475afa5bc370952cf6d09a1871973f689c Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 8 Aug 2022 11:20:35 -0500 Subject: [PATCH] add option to limit rsync bandwidth --- README.md | 2 ++ client/build/sync.sh | 2 +- client/docker-compose.yaml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d2d6828..7b5da14 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ Some decisions need to be made on the client side, and most of those will be exp | `SYNC_SCHEDULE` | (`0 21 * * 5`) | `cron`-formatted schedule for when the client should initiate a sync (example syncs at 9PM on Friday night) | | `SYNC_DELAY` | `true` (`false`) | if true, sleeps a random number of seconds before begining the sync | | `SYNC_DELAY_MAX_SECONDS` | (`21600`) | maximum seconds to sleep (example will be delayed up to 6 hours) | +| `SYNC_MAX_BW` | `1.5m` (`0`) | `rsync` bandwidth limit; `1.5m` caps at 1.5MB/s, `0` is unlimited | | `TLS_NAME` | `library.bowdre.net` | if set, the FQDN used for the client's web server; if not set, the library will be served strictly over HTTP | | `TLS_CUSTOM_CERT` | `true` (`false`) | if `true`, the web server will expect to find a custom certificate *and private key* in the `./data/certs` volume | | `LIBRARY_NAME` | (`Library`) | this name will show up in the generated Content Library JSON, but not anywhere else | @@ -183,6 +184,7 @@ services: - SYNC_SCHEDULE=0 21 * * 5 - SYNC_DELAY=true - SYNC_DELAY_MAX_SECONDS=21600 + - SYNC_MAX_KBPS=0 - TLS_NAME=library.lab.bowdre.net - TLS_CUSTOM_CERT=true - LIBRARY_NAME=Library diff --git a/client/build/sync.sh b/client/build/sync.sh index 4e93e9c..3fecd9b 100644 --- a/client/build/sync.sh +++ b/client/build/sync.sh @@ -10,7 +10,7 @@ fi echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync sync starts NOW!" # sync -/usr/bin/rsync -e "ssh -l syncer -p ${SYNC_PORT:-2222} -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -av --exclude '*.json' $SYNC_PEER:/ /syncer/library +/usr/bin/rsync --bwlimit=${SYNC_MAX_BW:-0} -e "ssh -l syncer -p ${SYNC_PORT:-2222} -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -av --exclude '*.json' $SYNC_PEER:/ /syncer/library # generate content library manifest echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Generating content library manifest..." diff --git a/client/docker-compose.yaml b/client/docker-compose.yaml index 621f323..da159d1 100644 --- a/client/docker-compose.yaml +++ b/client/docker-compose.yaml @@ -11,6 +11,7 @@ services: - SYNC_SCHEDULE=0 21 * * 5 - SYNC_DELAY=true - SYNC_DELAY_MAX_SECONDS=21600 + - SYNC_MAX_KBPS=0 - TLS_NAME=library.lab.bowdre.net - TLS_CUSTOM_CERT=true - LIBRARY_NAME=Library