summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2018-12-16 00:22:37 -0500
committerAlec Warner <antarus@gentoo.org>2018-12-16 00:22:37 -0500
commit83a571e8c4d6f19e70e4dc28ef88a96caf647b99 (patch)
treef907b5e0ab5e81caccc1b55884dc3c91d824d71a
parentVarious rsync node improvements. (diff)
downloadantarus-83a571e8c4d6f19e70e4dc28ef88a96caf647b99.tar.gz
antarus-83a571e8c4d6f19e70e4dc28ef88a96caf647b99.tar.bz2
antarus-83a571e8c4d6f19e70e4dc28ef88a96caf647b99.zip
Attempt to fit a node on a 1.7GB g1-small on GCP.
rsync basically takes like no resources to run; we hope. Most of our real servers are doing this with like 1-2 CPUs and 2GB of memory. So align that with our vm sizing. The g1-small is a 1.7GB memory container with 1 shared vcpu. Allocate 1.3GB of memory to the tmpfs. This should house 2 rsync trees (clocking in at 590MB a piece). Further work with hardlinks can likely reduce the size even more. Signed-off-by: Alec Warner <antarus@gentoo.org>
-rwxr-xr-xsrc/infra.gentoo.org/rsync-node/wrap_rsync.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/infra.gentoo.org/rsync-node/wrap_rsync.sh b/src/infra.gentoo.org/rsync-node/wrap_rsync.sh
index a7f87ed..dd3e2df 100755
--- a/src/infra.gentoo.org/rsync-node/wrap_rsync.sh
+++ b/src/infra.gentoo.org/rsync-node/wrap_rsync.sh
@@ -42,8 +42,14 @@ function sync() {
# Function init does a first sync, to populate the serving partition and
# setup symlinks, and begin serving data.
+# Also, setup the tmpfs to be big enough.
# "${1}" is the serving partition. "${2}" is the update partition
function init() {
+ mount -o remount -o size=1.3g "${DEST_DIR}"
+ if [[ $? -ne 0 ]]; then
+ logger -t rsync "Init: Failed to resize tmpfs: ${DEST_DIR}"
+ return 1
+ fi
sync "${1}" "${SOURCE_MIRROR}" # this is synchronous.
# We serve out of ${DEST_DIR}/serving
@@ -53,6 +59,7 @@ function init() {
# Then launch rsyncd; it will detach into the background and serve from serving.
rsync --daemon --config="/opt/rsync/rsyncd.conf"
+ return 0
}
# Function update syncs the 'update' partition and, if successful, swaps the partitions.
@@ -82,5 +89,8 @@ function serve() {
# Partition1 starts as "serving", partition2 as "update"
init "${PARTITION1}" "${PARTITION2}"
+if [[ $? -ne 0 ]]; then
+ exit 1
+fi
# Serve forever
serve