Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3540189
D4484.id14359.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4484.id14359.diff
View Options
diff --git a/keyserver/bash/deploy.sh b/keyserver/bash/deploy.sh
deleted file mode 100755
--- a/keyserver/bash/deploy.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env bash
-
-# run as: ssh user on root wheel
-# run from: wherever
-# param: path to link to
-
-# The maximum amount of space to spend on checkouts. By default we leave around
-# old deployments in case we want to roll back. The limit includes the current
-# prod checkout, but will never delete prod.
-MAX_DISK_USAGE_KB=3145728 # 3 GiB
-
-# The user that spawns the Node server
-DAEMON_USER="comm"
-
-# Input to git clone
-GIT_CLONE_PARAMS=https://github.com/CommE2E/comm.git
-
-set -e
-[[ $(whoami) = root ]] || exec sudo su -c "$0 $1"
-
-# STEP 1: clone source into new directory
-CHECKOUT_PATH=$1.$(date +%F-%H-%M)
-rm -rf "$CHECKOUT_PATH" # badass. risky
-mkdir -p "$CHECKOUT_PATH"
-chown $DAEMON_USER:$DAEMON_USER "$CHECKOUT_PATH"
-su $DAEMON_USER -c "git clone $GIT_CLONE_PARAMS '$CHECKOUT_PATH'"
-su $DAEMON_USER -c "cp -r '$1'/keyserver/secrets '$CHECKOUT_PATH'/keyserver/secrets"
-su $DAEMON_USER -c "cp -r '$1'/keyserver/facts '$CHECKOUT_PATH'/keyserver/facts"
-cd "$CHECKOUT_PATH"
-su $DAEMON_USER -c "keyserver/bash/setup.sh"
-
-# STEP 2: test if the binary crashes within 60 seconds
-set +e
-su $DAEMON_USER -c "cd keyserver && PORT=3001 timeout 60 bash/run-prod.sh"
-[[ $? -eq 124 ]] || exit 1
-set -e
-
-# STEP 3: flip it over
-systemctl stop comm || true
-rm "$1"
-ln -s "$CHECKOUT_PATH" "$1"
-chown -h $DAEMON_USER:$DAEMON_USER "$1"
-systemctl restart comm
-
-# STEP 4: clean out old checkouts
-checkouts=($(ls -dtr "$1".*))
-for checkout in "${checkouts[@]}"; do
- if [[ "$checkout" = "$CHECKOUT_PATH" ]]; then
- break
- fi
- TOTAL_USAGE=$(sudo du -cs "$1"* | awk '/total/ { print $1 }')
- if [[ $TOTAL_USAGE -le $MAX_DISK_USAGE_KB ]]; then
- break
- fi
- rm -rf "$checkout"
-done
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 4:36 AM (6 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2710488
Default Alt Text
D4484.id14359.diff (1 KB)
Attached To
Mode
D4484: [keyserver] Delete `deploy.sh`
Attached
Detach File
Event Timeline
Log In to Comment