Removes the now-obsolete deploy.sh
authordsc <dsc@less.ly>
Wed, 9 May 2012 09:03:05 +0000 (02:03 -0700)
committerdsc <dsc@less.ly>
Wed, 9 May 2012 09:03:05 +0000 (02:03 -0700)
deploy.sh [deleted file]

diff --git a/deploy.sh b/deploy.sh
deleted file mode 100755 (executable)
index 4620bd2..0000000
--- a/deploy.sh
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/bin/bash
-
-#/ deploy.sh
-#/ 
-#/ Usage:     deploy.sh [options] [DEPLOY_HOST] [DEPLOY_PATH]
-#/ 
-#/ Deploys the GraphKit framework to a reportcard instance.
-#/ 
-#/ Arguments:
-#/      DEPLOY_HOST     Target host for deploy. [Default: reportcard2.pmtpa.wmflabs]
-#/                      Also checks env for KRAKEN_DEPLOY_HOST.
-#/      DEPLOY_PATH     Path on target host. [Default: /srv/reportcard/kraken-ui/]
-#/                      Also checks env for KRAKEN_DEPLOY_PATH.
-#/ 
-#/ Options:
-#/      -h --help       Displays this help.
-#/      -v              Verbose logging.
-#/      -n              Dry-run: run through all local steps, but don't do anything on the server.
-#/      -P              Do not fix remote file permissions.
-#/      -r              Restart server post-deploy.
-#/      -d              Host of the development server to query for some info.
-#/                      [Default: localhost:8081]
-#/      -u              Deploy user. [Default: www-data]
-#/      -g              Deploy group. [Default: www]
-#/ 
-
-
-# The most important line in any shell program. (Terminate on subcommand errors)
-set -e
-
-VERBOSE=''
-DRY_RUN=''
-FIX_PERMISSIONS=1
-RESTART_SERVER=''
-DEV_HOST="${KRAKEN_DEV_HOST:-localhost:8081}"
-DEPLOY_HOST="${KRAKEN_DEPLOY_HOST:-reportcard2.pmtpa.wmflabs}"
-DEPLOY_PATH="${KRAKEN_DEPLOY_PATH:-/srv/reportcard/kraken-ui/}"
-DEPLOY_USER="www-data"
-DEPLOY_GROUP="www"
-
-
-
-# Utilities
-log   () { [ "$VERBOSE" ] && echo -e "$*" >&2; :; }
-logs  () { [ "$VERBOSE" ] && printf "%s" "$*"; :; }
-fail  () { echo >&2; echo "[ERROR] $*" >&2; exit 1; }
-count () { echo $#; }
-nth   () { local n="$1"; shift; [ -z "$n" ] && return 1; [[ "$n" < 0 ]] && n=$(( 1 + $# + $n )); echo "${!n}"; }
-# join  () { local sep="$1" old="$IFS"; export IFS=\n; read -t1 out; while read -t1 line; do out="$out$sep$line"; done; echo "$out"; export IFS=$old; }
-# join  () { local sep="$1"; shift; [ -z "$*" ] && return 1; printf "$1"; shift; for a in $*; do printf "$sep$a"; done; echo; }
-
-# Print Help
-SELF="$0"
-halp () { grep '^#/' <"$SELF" | cut -c4-; :; }
-for opt in $*; do echo $opt | grep -Exq -e '--?h(e(lp?)?)?' && { halp; exit 0; }; done
-
-# Parse Args
-SHIFT=0
-incshift () { SHIFT=$(( $SHIFT + ${1:-1} )); }
-while getopts "vd:u:g:nPr" opt; do
-    case $opt in
-        v ) VERBOSE="-v";           incshift ;;
-        d ) DEV_HOST="$OPTARG";     incshift 2 ;;
-        u ) DEPLOY_USER="$OPTARG";  incshift 2 ;;
-        g ) DEPLOY_GROUP="$OPTARG"; incshift 2 ;;
-        n ) DRY_RUN='-n';           incshift ;;
-        P ) FIX_PERMISSIONS='';     incshift ;;
-        r ) RESTART_SERVER=1;       incshift ;;
-        * ) fail "Unknown option: -$opt=$OPTARG" ;;
-    esac
-done
-shift $SHIFT
-
-if [ "$1" ]; then
-    DEPLOY_HOST="$1"
-fi
-if [ "$2" ]; then
-    DEPLOY_PATH="$2"
-fi
-
-
-# makes sure everything is owned by www-data
-fix_permissions () {
-    [ -z "$FIX_PERMISSIONS" ] && return 0
-    log "Fixing permissions on $DEPLOY_HOST:$DEPLOY_PATH ..."
-    log "ssh -t $DEPLOY_HOST '/usr/bin/sudo /bin/chmod --changes -R g+w $DEPLOY_PATH && /usr/bin/sudo /bin/chown --changes -R $DEPLOY_USER:$DEPLOY_GROUP $DEPLOY_PATH'"
-    [ -z "$DRY_RUN" ] && ssh -t $DEPLOY_HOST "/usr/bin/sudo /bin/chmod --changes -R g+w $DEPLOY_PATH && /usr/bin/sudo /bin/chown --changes -R $DEPLOY_USER:$DEPLOY_GROUP $DEPLOY_PATH"
-}
-
-# Ensure gitrev is up to date
-coke update_version
-
-# Ensure clean dist directory
-[ -e "tmp/dist" ] && rm -rf tmp/dist
-mkdir -p tmp/dist
-
-### Collapse the serve trees into one directory
-log "Collapsing serve trees..."
-
-# Copy the static files, derived files, and the whole data directory (bc lack of trailing /)
-# into dist. Note that you will need to load all the site pages in your browser to populate var
-# with the derived files.
-rsync -Ca static/ var/ data tmp/dist/
-
-# We copy lib (which contains .co source files) to src to make it easy to link source content
-# to each other. Finding it in gitweb is a pain. Finding it in gerrit is almost impossible. 
-# But this could go away when we move to github.
-rsync -Ca lib/ tmp/dist/src/
-
-# For some reason, the shell tool does not generate a file identical to the middleware. So whatever.
-# We curl here because we know that version works.
-curl --silent --fail --url http://$DEV_HOST/vendor/browserify.js > tmp/dist/vendor/browserify.js
-# browserify -o tmp/dist/vendor/browserify.js -r events -r seq
-
-log "ok!"
-
-### Bundle Vendor JS Bundle
-target=tmp/dist/vendor/vendor-bundle.min.js
-log "Building Vendor Bundle ($target) ..."
-for js in $(coke source_list | grep vendor); do
-    log "  file: $js"
-    for d in static var tmp/dist; do
-        f="$d/$js"
-        log "    checking '$f' ..."
-        [ -f $f ] && break
-    done
-    [ -z "$f" -o ! -f $f ] && fail "Unable to locate '$js'!"
-    
-    log "    found '$f' !"
-    printf '\n;\n' >> $target
-    cat $f >> $target
-    printf '\n' >> $target
-done
-log "ok!"
-
-
-### Build App JS Bundle
-
-target=tmp/dist/js/kraken/app-bundle
-uglifyjs=$(which uglifyjs || echo "node_modules/uglify-js/bin/uglifyjs")
-log "Building App JS Bundle (${target}.js) ..."
-log "cat \n$(coke source_list | grep -v vendor | sed 's/^/    var/')"
-cat $(coke source_list | grep -v vendor | sed 's/^/var\//') > ${target}.js
-$uglifyjs < ${target}.js > ${target}.min.js
-log "ok!"
-
-# TODO: bundle CSS
-
-
-### Finally, deploy the files
-log "Deploying files..."
-
-# Fix ownership and permissions before and after rsync.
-fix_permissions
-log "rsync -Caz $VERBOSE $DRY_RUN tmp/dist $DEPLOY_HOST:$DEPLOY_PATH"
-rsync -Crz $VERBOSE $DRY_RUN tmp/dist $DEPLOY_HOST:$DEPLOY_PATH
-fix_permissions
-log "ok!"
-
-### Inform Supervisor to restart Node
-if [ "$RESTART_SERVER" ]; then
-    log "Restarting Reportcard Server post-deploy..."
-    log "ssh -t $DEPLOY_HOST 'sudo supervisorctl restart reportcard'"
-    [ -n "$DRY_RUN" ] && ssh -t $DEPLOY_HOST "sudo supervisorctl restart reportcard"
-fi
-
-log "Done!"
-
-