summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2018-12-16 15:15:27 -0500
committerAlec Warner <antarus@gentoo.org>2018-12-16 15:15:27 -0500
commit70c07b07e642813352564cc65185cf0243aa8918 (patch)
tree2b8ee1350212c09d5bb8b72769f82ce973fc3400
parentGCP wants "1300m" not "1.3g" for tmpfs size. (diff)
downloadantarus-70c07b07e642813352564cc65185cf0243aa8918.tar.gz
antarus-70c07b07e642813352564cc65185cf0243aa8918.tar.bz2
antarus-70c07b07e642813352564cc65185cf0243aa8918.zip
Don't shadow the tree with our tmpfs mount.
The previous instance would mount the tmpfs over our two created tmpdirs causing our tmpdirs to be unavailable and causing a failure. Signed-off-by: Alec Warner <antarus@gentoo.org>
-rwxr-xr-xsrc/infra.gentoo.org/rsync-node/wrap_rsync.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/infra.gentoo.org/rsync-node/wrap_rsync.sh b/src/infra.gentoo.org/rsync-node/wrap_rsync.sh
index 5a16036..9505a8d 100755
--- a/src/infra.gentoo.org/rsync-node/wrap_rsync.sh
+++ b/src/infra.gentoo.org/rsync-node/wrap_rsync.sh
@@ -4,10 +4,18 @@
# Then execute rsyncd; we will start serving once the sync completes.
# Then keep syncing in the background every 30m.
+# We keep the trees in a TMPFS.
+mount -t tmpfs -o size=1300m tmpfs "${DEST_DIR}"
+if [[ $? -ne 0 ]]; then
+ logger -t rsync "Init: Failed to create tmpfs: ${DEST_DIR}"
+ return 1
+fi
+
# Maintain 2 'partitions' of the tree.
# "serving" - This copy is served to users and is not mutated.
# "updating" - This copy is a shadow copy used for updates.
# Create the two partitions on startup.
+
PARTITION1=$(mktemp -d -p "${DEST_DIR}" XXXXXX)
PARTITION2=$(mktemp -d -p "${DEST_DIR}" XXXXXX)
@@ -42,14 +50,8 @@ 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 -t tmpfs -o size=1300m tmpfs "${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