From df7507d1be94c4dba09c70395b7428a613d94717 Mon Sep 17 00:00:00 2001 From: Jeff Lindsay Date: Tue, 29 Oct 2013 17:13:02 -0500 Subject: [PATCH 1/2] normalizing shebang and bash options. also added long-term fix for bootstrap instructions --- bootstrap.sh | 9 ++++----- dokku | 7 +------ plugins/00_dokku-standard/commands | 5 +++-- plugins/00_dokku-standard/install | 3 ++- plugins/00_dokku-standard/post-delete | 4 ++-- plugins/config/commands | 4 ++-- plugins/git/commands | 4 ++-- plugins/nginx-vhosts/commands | 3 ++- plugins/nginx-vhosts/install | 3 ++- plugins/nginx-vhosts/post-delete | 4 ++-- plugins/nginx-vhosts/post-deploy | 4 ++-- tests/run_ec2 | 4 ++-- tests/run_vagrant | 3 ++- tests/setup_travis | 3 ++- tests/test_deploy | 4 ++-- 15 files changed, 32 insertions(+), 32 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5f145ec9517..8ceefe06019 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,6 +1,5 @@ -#!/usr/bin/env sh - -set -e +#!/usr/bin/env bash +set -eo pipefail export DEBIAN_FRONTEND=noninteractive export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"} @@ -18,5 +17,5 @@ cd dokku && test $DOKKU_BRANCH && git checkout origin/$DOKKU_BRANCH || true make install echo -echo "Be sure to upload a public key for your user:" -echo " cat ~/.ssh/id_rsa.pub | ssh root@$HOSTNAME \"gitreceive upload-key progrium\"" +echo "Almost done! For next steps on configuration:" +echo " https://github.com/progrium/dokku#configuring" diff --git a/dokku b/dokku index 65db0ea52d2..fba452e756f 100755 --- a/dokku +++ b/dokku @@ -1,6 +1,5 @@ #!/usr/bin/env bash -set -e -set -o pipefail +set -eo pipefail export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"} @@ -9,16 +8,12 @@ case "$1" in APP="$2"; IMAGE="app/$APP" echo "-----> Building $APP ..." cat | dokku build $APP $IMAGE - echo "-----> Build complete!" echo "-----> Releasing $APP ..." dokku release $APP $IMAGE - echo "-----> Release complete!" echo "-----> Deploying $APP ..." dokku deploy $APP $IMAGE - echo "-----> Deploy complete!" echo "-----> Cleaning up ..." dokku cleanup - echo "-----> Cleanup complete!" echo "=====> Application deployed:" echo " $(dokku url $APP)" echo diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 7493a57fe74..92e73305d32 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -1,5 +1,6 @@ -#!/bin/bash -set -e; case "$1" in +#!/usr/bin/env bash +set -eo pipefail +case "$1" in delete) if [[ -z $2 ]]; then echo "Please specify an app to delete" diff --git a/plugins/00_dokku-standard/install b/plugins/00_dokku-standard/install index 8e9da8bc043..f1b46c43640 100755 --- a/plugins/00_dokku-standard/install +++ b/plugins/00_dokku-standard/install @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash +set -eo pipefail sed -i 's/docker -d$/docker -d -r=true/' /etc/init/docker.conf diff --git a/plugins/00_dokku-standard/post-delete b/plugins/00_dokku-standard/post-delete index 4dfa7327729..10c573421c3 100755 --- a/plugins/00_dokku-standard/post-delete +++ b/plugins/00_dokku-standard/post-delete @@ -1,3 +1,3 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -eo pipefail [[ -n $1 ]] && rm -r "$DOKKU_ROOT/$1" > /dev/null diff --git a/plugins/config/commands b/plugins/config/commands index 4da9d0c821a..6061698b869 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -1,5 +1,5 @@ -#!/bin/bash -set -e; +#!/usr/bin/env bash +set -eo pipefail # Check if name is specified if [[ $1 == config ]] || [[ $1 == config:* ]]; then diff --git a/plugins/git/commands b/plugins/git/commands index d9ab50e8f74..14121d5c1a2 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -1,5 +1,5 @@ -#!/bin/bash -set -e; +#!/usr/bin/env bash +set -eo pipefail case "$1" in git-hook) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 2cebdbd599b..143aedbc2ed 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,2 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash +set -eo pipefail cat diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index a2492aa68ac..447f398943f 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash +set -eo pipefail # latest stable NGINX 1.4.x with websocket support add-apt-repository -y ppa:nginx/stable diff --git a/plugins/nginx-vhosts/post-delete b/plugins/nginx-vhosts/post-delete index 092bade0641..2f3d05b39df 100755 --- a/plugins/nginx-vhosts/post-delete +++ b/plugins/nginx-vhosts/post-delete @@ -1,3 +1,3 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -eo pipefail sudo /etc/init.d/nginx reload > /dev/null \ No newline at end of file diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/post-deploy index 5ea99867694..0d876ca815a 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/post-deploy @@ -1,5 +1,5 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -eo pipefail APP="$1"; PORT="$2" WILDCARD_SSL="$DOKKU_ROOT/ssl" SSL="$DOKKU_ROOT/$APP/ssl" diff --git a/tests/run_ec2 b/tests/run_ec2 index 64ca1430475..e54df7a07e4 100755 --- a/tests/run_ec2 +++ b/tests/run_ec2 @@ -1,5 +1,5 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -eo pipefail KEYNAME="$1" indent() { sed "s/^/ /"; } echo "-----> Booting EC2 instance..." diff --git a/tests/run_vagrant b/tests/run_vagrant index 382f5521403..0a505692da7 100755 --- a/tests/run_vagrant +++ b/tests/run_vagrant @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash +set -eo pipefail SELF=`which $0` VAGRANT_SSH_PORT=${VAGRANT_SSH_PORT:-"2222"} PUBLIC_KEY=${PUBLIC_KEY:-"$HOME/.ssh/id_rsa.pub"} diff --git a/tests/setup_travis b/tests/setup_travis index d69489f9cc2..ba7cf191c6b 100755 --- a/tests/setup_travis +++ b/tests/setup_travis @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash +set -eo pipefail sed --in-place "s|access_key|access_key = $AWS_ACCESS_KEY|" .s3cfg sed --in-place "s|secret_key|secret_key = $AWS_SECRET_KEY|" .s3cfg s3cmd -c .s3cfg get s3://progrium-private/ec2_cert.pem /tmp/cert diff --git a/tests/test_deploy b/tests/test_deploy index d1855c4c37c..48626e035da 100755 --- a/tests/test_deploy +++ b/tests/test_deploy @@ -1,5 +1,5 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -eo pipefail SELF=`which $0`; APP="$1"; TARGET="$2"; FORWARDED_PORT="$3" TMP=$(mktemp -d -t "$TARGET.XXXXX") trap "rm -rf $TMP" EXIT From b64fe76ec009f9f8214d4613ee3dab9eec23d97f Mon Sep 17 00:00:00 2001 From: Jeff Lindsay Date: Tue, 29 Oct 2013 17:44:36 -0500 Subject: [PATCH 2/2] adding a DOKKU_TRACE env var to enable "set -x" --- dokku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dokku b/dokku index fba452e756f..bdd47906383 100755 --- a/dokku +++ b/dokku @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -eo pipefail +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}