Created
August 29, 2017 22:23
-
-
Save dmfenton/6771949ae214ff24e20ad792deded93a to your computer and use it in GitHub Desktop.
Bash S3 Deploy Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DIR=$(dirname"$0") | |
STAMP=$(date +%s) | |
TEMPDIR="/srv/hub/$STAMP" | |
APPLICATIONDIR="/arcgis/portal/apps/hub" | |
OLDDIR=$(cat ./.old-directory) | |
echo "downloading files to $DIR" | |
/usr/local/bin/aws s3 cp s3://REDACTED/build.tar.gz "$DIR" | |
echo "writing application files to $TEMPDIR" | |
mkdir -p "$TEMPDIR" | |
tar -xzvf build.tar.gz -C "$TEMPDIR" --strip-components=1 > build-files.log | |
echo "linking to $APPLICATIONDIR" | |
ln -sfvn "$TEMPDIR" "$APPLICATIONDIR" | |
echo "removing previous deploy from $OLDDIR" | |
rm -rf $OLDDIR | |
echo "$TEMPDIR" > ".old-directory" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment