From 0840d8fd1f9648936a7db6470a0690ef63115646 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 20 Apr 2015 16:32:18 -0700 Subject: [PATCH 01/11] initial pass at switching to herokuish. closes #1091 --- Makefile | 16 +++++--- deb.mk | 38 +++++++++---------- debian/control | 2 +- docs/advanced-installation.md | 6 +-- docs/application-deployment.md | 2 +- docs/checks-examples.md | 30 +++++++-------- docs/components.md | 2 +- docs/development/pluginhooks.md | 18 ++++----- docs/troubleshooting.md | 4 +- docs/upgrading.md | 14 +++---- dokku | 8 ++-- plugins/00_dokku-standard/commands | 18 ++++----- plugins/common/functions | 2 +- plugins/config/docker-args-deploy | 2 +- plugins/git/commands | 2 +- plugins/ps/functions | 6 +-- tests/ci/parallel_runner.sh | 4 +- tests/unit/config.bats | 2 +- .../{ps-buildstep.bats => ps-herokuish.bats} | 6 +-- 19 files changed, 93 insertions(+), 89 deletions(-) rename tests/unit/{ps-buildstep.bats => ps-herokuish.bats} (97%) diff --git a/Makefile b/Makefile index c69d5bda4..042dc0266 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ DOKKU_VERSION = master SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb -STACK_URL ?= https://github.com/progrium/buildstep.git -PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-12-16/2014-12-16_42bd9f4aab.tar.gz +STACK_URL ?= https://github.com/gliderlabs/herokuish.git +PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest PLUGINS_PATH ?= /var/lib/dokku/plugins # If the first argument is "vagrant-dokku"... @@ -27,7 +27,7 @@ install: dependencies copyfiles plugin-dependencies plugins version release: deb-all package_cloud packer package_cloud: - package_cloud push dokku/dokku/ubuntu/trusty buildstep*.deb + package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb package_cloud push dokku/dokku/ubuntu/trusty pluginhook*.deb package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb @@ -105,11 +105,15 @@ endif stack: ifeq ($(shell test -e /var/run/docker.sock && touch -a -c /var/run/docker.sock && echo $$?),0) - @echo "Start building buildstep" + @echo "Start building herokuish" ifdef BUILD_STACK - @docker images | grep progrium/buildstep || (git clone ${STACK_URL} /tmp/buildstep && docker build -t progrium/buildstep /tmp/buildstep && rm -rf /tmp/buildstep) + @docker images | grep gliderlabs/herokuish || (git clone ${STACK_URL} /tmp/herokuish && docker build -t gliderlabs/herokuish /tmp/herokuish && rm -rf /tmp/herokuish) else - @docker images | grep progrium/buildstep || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep +ifeq ($(shell echo ${PREBUILT_STACK_URL} | egrep -q 'http.*://' && echo $$?),0) + @docker images | grep gliderlabs/herokuish || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - gliderlabs/herokuish +else + @docker pull ${PREBUILT_STACK_URL} +endif endif endif diff --git a/deb.mk b/deb.mk index b4e20398a..9f25b4d44 100644 --- a/deb.mk +++ b/deb.mk @@ -1,8 +1,8 @@ -BUILDSTEP_DESCRIPTION = 'Buildstep uses Docker and Buildpacks to build applications like Heroku' -BUILDSTEP_REPO_NAME ?= progrium/buildstep -BUILDSTEP_VERSION ?= 0.0.2 -BUILDSTEP_ARCHITECTURE = amd64 -BUILDSTEP_PACKAGE_NAME = buildstep_$(BUILDSTEP_VERSION)_$(BUILDSTEP_ARCHITECTURE).deb +HEROKUISH_DESCRIPTION = 'Herokish uses Docker and Buildpacks to build applications like Heroku' +HEROKUISH_REPO_NAME ?= gliderlabs/herokuish +HEROKUISH_VERSION ?= 0.0.1 +HEROKUISH_ARCHITECTURE = amd64 +HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash' DOKKU_REPO_NAME ?= progrium/dokku @@ -26,7 +26,7 @@ GOROOT = /usr/lib/go GOBIN = /usr/bin/go GOPATH = /home/vagrant/gocode -.PHONY: install-from-deb deb-all deb-buildstep deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand +.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand install-from-deb: echo "--> Initial apt-get update" @@ -54,7 +54,7 @@ install-from-deb: echo "--> Done!" -deb-all: deb-buildstep deb-dokku deb-gems deb-pluginhook deb-sshcommand +deb-all: deb-herokuish deb-dokku deb-gems deb-pluginhook deb-sshcommand mv /tmp/*.deb . echo "Done" @@ -65,31 +65,31 @@ deb-setup: command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc ssh -o StrictHostKeyChecking=no git@github.com || true -deb-buildstep: deb-setup - rm -rf /tmp/tmp /tmp/build $(BUILDSTEP_PACKAGE_NAME) +deb-herokuish: deb-setup + rm -rf /tmp/tmp /tmp/build $(HEROKUISH_PACKAGE_NAME) mkdir -p /tmp/tmp /tmp/build echo "-> Creating deb files" echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install echo "sleep 5" >> /tmp/tmp/post-install - echo "count=\`sudo docker images | grep progrium/buildstep | wc -l\`" >> /tmp/tmp/post-install + echo "count=\`sudo docker images | grep gliderlabs/herokuish | wc -l\`" >> /tmp/tmp/post-install echo 'if [ "$$count" -ne 0 ]; then' >> /tmp/tmp/post-install - echo " echo 'Removing old buildstep image'" >> /tmp/tmp/post-install - echo " sudo docker rmi progrium/buildstep" >> /tmp/tmp/post-install + echo " echo 'Removing old herokuish image'" >> /tmp/tmp/post-install + echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install echo "fi" >> /tmp/tmp/post-install - echo "echo 'Importing buildstep into docker (around 5 minutes)'" >> /tmp/tmp/post-install - echo "sudo docker build -t progrium/buildstep /var/lib/buildstep 1> /dev/null" >> /tmp/tmp/post-install + echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install + echo "sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install echo "-> Cloning repository" - git clone -q "git@github.com:$(BUILDSTEP_REPO_NAME).git" /tmp/tmp/buildstep > /dev/null - rm -rf /tmp/tmp/buildstep/.git /tmp/tmp/buildstep/.gitignore + git clone -q "git@github.com:$(HEROKUISH_REPO_NAME).git" /tmp/tmp/herokuish > /dev/null + rm -rf /tmp/tmp/herokuish/.git /tmp/tmp/herokuish/.gitignore echo "-> Copying files into place" mkdir -p "/tmp/build/var/lib" - cp -rf /tmp/tmp/buildstep /tmp/build/var/lib/buildstep + cp -rf /tmp/tmp/herokuish /tmp/build/var/lib/herokuish - echo "-> Creating $(BUILDSTEP_PACKAGE_NAME)" - sudo fpm -t deb -s dir -C /tmp/build -n buildstep -v $(BUILDSTEP_VERSION) -a $(BUILDSTEP_ARCHITECTURE) -p $(BUILDSTEP_PACKAGE_NAME) --deb-pre-depends 'lxc-docker-1.6.2' --after-install /tmp/tmp/post-install --url "https://github.com/$(BUILDSTEP_REPO_NAME)" --description $(BUILDSTEP_DESCRIPTION) --license 'MIT License' . + echo "-> Creating $(HEROKUISH_PACKAGE_NAME)" + sudo fpm -t deb -s dir -C /tmp/build -n HEROKUISH -v $(HEROKUISH_VERSION) -a $(HEROKUISH_ARCHITECTURE) -p $(HEROKUISH_PACKAGE_NAME) --deb-pre-depends 'lxc-docker-1.6.2' --after-install /tmp/tmp/post-install --url "https://github.com/$(HEROKUISH_REPO_NAME)" --description $(HEROKUISH_DESCRIPTION) --license 'MIT License' . mv *.deb /tmp deb-dokku: deb-setup diff --git a/debian/control b/debian/control index 4aaa8d13c..95bcc83cd 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Version: 0.3.12 Section: base Priority: optional Architecture: amd64 -Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, gcc, python-software-properties, man-db, buildstep, sshcommand, pluginhook +Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, gcc, python-software-properties, man-db, herokuish, sshcommand, pluginhook Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroup-lite Provides: dokku Maintainer: Jose Diaz-Gonzalez diff --git a/docs/advanced-installation.md b/docs/advanced-installation.md index f9ec9c36a..d06fcbc56 100644 --- a/docs/advanced-installation.md +++ b/docs/advanced-installation.md @@ -32,14 +32,14 @@ chmod +x bootstrap.sh sudo DOKKU_REPO=https://github.com/yourusername/dokku.git DOKKU_BRANCH=master ./bootstrap.sh ``` -## Custom buildstep build +## Custom herokuish build -Dokku ships with a pre-built version of version of the [buildstep](https://github.com/progrium/buildstep) component by default. If you want to build your own version you can specify that with an env variable. +Dokku ships with a pre-built version of version of the [herokuish](https://github.com/gliderlabs/herokuish) component by default. If you want to build your own version you can specify that with an env variable. ```shell git clone https://github.com/progrium/dokku.git cd dokku -sudo BUILD_STACK=true STACK_URL=https://github.com/progrium/buildstep.git make install +sudo BUILD_STACK=true STACK_URL=https://github.com/gliderlabs/herokuish.git make install ``` ## Configuring diff --git a/docs/application-deployment.md b/docs/application-deployment.md index 7cb332b20..9ca0663ab 100644 --- a/docs/application-deployment.md +++ b/docs/application-deployment.md @@ -25,7 +25,7 @@ You're done! Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku :master``` -Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)! +Right now Herokuish supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/gliderlabs/herokuish#buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)! Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root. ## Deploying to server over SSH diff --git a/docs/checks-examples.md b/docs/checks-examples.md index 733674bc8..70aca9be2 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -53,7 +53,7 @@ ATTEMPTS=6 git push dokku master -----> Cleaning up... ------> Building myapp from buildstep... +-----> Building myapp from herokuish... -----> Adding BUILD_ENV to build environment... -----> Ruby app detected -----> Compiling Ruby/Rails @@ -71,13 +71,13 @@ git push dokku master http://localhost/check.txt => "simple_check" ! curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused - ! Check attempt 1/6 failed. + ! Check attempt 1/6 failed. -----> Attempt 2/6 Waiting for 5 seconds ... CHECKS expected result: http://localhost/check.txt => "simple_check" ! curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused - ! Check attempt 2/6 failed. + ! Check attempt 2/6 failed. -----> Attempt 3/6 Waiting for 5 seconds ... CHECKS expected result: http://localhost/check.txt => "simple_check" @@ -124,7 +124,7 @@ ATTEMPTS=6 git push dokku master -----> Cleaning up... ------> Building myapp from buildstep... +-----> Building myapp from herokuish... -----> Adding BUILD_ENV to build environment... -----> Ruby app detected -----> Compiling Ruby/Rails @@ -142,38 +142,38 @@ Running pre-flight checks http://localhost/ => "" ! curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused - ! Check attempt 1/6 failed. + ! Check attempt 1/6 failed. -----> Attempt 2/6 Waiting for 5 seconds ... CHECKS expected result: http://localhost/ => "" - ! + ! curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused - ! Check attempt 2/6 failed. + ! Check attempt 2/6 failed. -----> Attempt 3/6 Waiting for 5 seconds ... CHECKS expected result: http://localhost/ => "" - ! + ! curl: (22) The requested URL returned error: 500 Internal Server Error - ! Check attempt 3/6 failed. + ! Check attempt 3/6 failed. -----> Attempt 4/6 Waiting for 5 seconds ... CHECKS expected result: http://localhost/ => "" - ! + ! curl: (22) The requested URL returned error: 500 Internal Server Error - ! Check attempt 4/6 failed. + ! Check attempt 4/6 failed. -----> Attempt 5/6 Waiting for 5 seconds ... CHECKS expected result: http://localhost/ => "" - ! + ! curl: (22) The requested URL returned error: 500 Internal Server Error - ! Check attempt 5/6 failed. + ! Check attempt 5/6 failed. -----> Attempt 6/6 Waiting for 5 seconds ... CHECKS expected result: http://localhost/ => "" - ! + ! curl: (22) The requested URL returned error: 500 Internal Server Error Could not start due to 1 failed checks. - ! Check attempt 6/6 failed. + ! Check attempt 6/6 failed. =====> myapp container output: => Booting Thin => Rails 4.2.0 application starting in production on http://0.0.0.0:5000 diff --git a/docs/components.md b/docs/components.md index 200a538c1..a6bfa453f 100644 --- a/docs/components.md +++ b/docs/components.md @@ -1,7 +1,7 @@ # Components * [Docker](https://github.com/dotcloud/docker) - Container runtime and manager - * [Buildstep](https://github.com/progrium/buildstep) - Buildpack builder + * [Herokuish](https://github.com/gliderlabs/herokuish) - Buildpack builder * [pluginhook](https://github.com/progrium/pluginhook) - Shell based plugins and hooks * [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH diff --git a/docs/development/pluginhooks.md b/docs/development/pluginhooks.md index 78e464d4d..036359442 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/pluginhooks.md @@ -83,7 +83,7 @@ esac ```shell #!/usr/bin/env bash -# Update the buildstep image from git source +# Update the herokuish image from git source set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x @@ -180,9 +180,9 @@ for file in */REDIRECT; do done ``` -### `pre-build-buildstep` +### `pre-build-herokuish` -- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildstep. +- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using herokuish. - Invoked by: `dokku build` - Arguments: `$APP` - Example: @@ -195,9 +195,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `post-build-buildstep` +### `post-build-herokuish` -- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildstep. +- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using herokuish. - Invoked by: `dokku build` - Arguments: `$APP` - Example: @@ -240,9 +240,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `pre-release-buildstep` +### `pre-release-herokuish` -- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildstep. +- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using herokuish. - Invoked by: `dokku release` - Arguments: `$APP` - Example: @@ -266,9 +266,9 @@ test $(docker wait $ID) -eq 0 docker commit $ID $IMAGE > /dev/null ``` -### `post-release-buildstep` +### `post-release-herokuish` -- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildstep. +- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using herokuish. - Invoked by: `dokku release` - Arguments: `$APP` - Example: diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index d46f464f4..5b31486d5 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -27,9 +27,9 @@ A value of 64 would allow domains with up to 64 characters. Set it to 128 if you Save the file and try stopping nginx and starting it again: ``` -root@dockerapps:~/dokku/buildstep# /etc/init.d/nginx stop +root@dockerapps:~/dokku# /etc/init.d/nginx stop * Stopping nginx nginx [ OK ] -root@dockerapps:~/dokku/buildstep# /etc/init.d/nginx start +root@dockerapps:~/dokku# /etc/init.d/nginx start * Starting nginx nginx [ OK ] ``` diff --git a/docs/upgrading.md b/docs/upgrading.md index a2a02e4e6..0cda846d5 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -37,26 +37,26 @@ All changes will take effect upon next application deployment. To trigger a rebu dokku ps:rebuildall ``` -## Buildstep image +## Herokuish image -If dokku was installed via a debian package, you can upgrade buildstep via the following command: +If dokku was installed via a debian package, you can upgrade herokuish via the following command: ```shell -sudo apt-get install buildstep +sudo apt-get install Herokush ``` For unattended upgrades, you may run the following command: ```shell -sudo apt-get install -qq -y buildstep +sudo apt-get install -qq -y herokuish ``` -In some cases, it may be desirable to run a specific version of buildstep. To install/upgrade buildstep from source, run the following commands: +In some cases, it may be desirable to run a specific version of herokuish. To install/upgrade herokuish from source, run the following commands: ```shell cd /tmp -git clone https://github.com/progrium/buildstep.git -cd buildstep +git clone https://github.com/gliderlabs/herokuish.git +cd herokuish git pull origin master sudo make build ``` diff --git a/dokku b/dokku index 56e06f169..1fdb9fdea 100755 --- a/dokku +++ b/dokku @@ -3,7 +3,7 @@ set -eo pipefail shopt -s nullglob export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"} -export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"} +export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"} export DOKKU_ROOT=${DOKKU_ROOT:=~dokku} export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} @@ -69,7 +69,7 @@ case "$1" in APP="$2"; IMAGE="dokku/$APP" pluginhook pre-deploy $APP - is_image_buildstep_based "$IMAGE" && DOKKU_BUILDSTEP=true + is_image_herokuish_based "$IMAGE" && DOKKU_HEROKUISH=true DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" oldids=$(get_container_ids $APP) @@ -91,9 +91,9 @@ case "$1" in DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP) BIND_EXTERNAL=$(pluginhook bind-external-ip $APP) - [[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start $PROC_TYPE" + [[ -n "$DOKKU_HEROKUISH" ]] && START_CMD="/start $PROC_TYPE" - if [[ -z "$DOKKU_BUILDSTEP" ]];then + if [[ -z "$DOKKU_HEROKUISH" ]];then DOKKU_DOCKERFILE_PORT=$(dokku config:get $APP DOKKU_DOCKERFILE_PORT || true) START_CMD=$(dokku config:get $APP DOKKU_DOCKERFILE_START_CMD || $START_CMD) fi diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index e6c6d5751..10a74e392 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -11,14 +11,14 @@ case "$1" in pushd "$TMP_WORK_DIR" &> /dev/null case "$IMAGE_SOURCE_TYPE" in - buildstep) + herokuish) id=$(tar -c . | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app") test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null [[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR # *DEPRECATED* in v0.4.0: `pluginhook pre-build` will be removed in future releases pluginhook pre-build "$APP" - pluginhook pre-build-buildstep "$APP" + pluginhook pre-build-herokuish "$APP" # *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases # https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906 @@ -31,7 +31,7 @@ case "$1" in # *DEPRECATED* in v0.4.0: `pluginhook post-build` will be removed in future releases pluginhook post-build "$APP" - pluginhook post-build-buildstep "$APP" + pluginhook post-build-herokuish "$APP" ;; dockerfile) @@ -39,7 +39,7 @@ case "$1" in DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true) [[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT - # buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!! + # herokuish pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!! pluginhook pre-build-dockerfile "$APP" [[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache" @@ -57,10 +57,10 @@ case "$1" in release) APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3" case "$IMAGE_SOURCE_TYPE" in - buildstep) + herokuish) # *DEPRECATED* in v0.4.0: `pluginhook pre-release` will be removed in future releases pluginhook pre-release "$APP" - pluginhook pre-release-buildstep "$APP" + pluginhook pre-release-herokuish "$APP" if [[ -f "$DOKKU_ROOT/ENV" ]]; then id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV") test "$(docker wait $id)" -eq 0 @@ -73,11 +73,11 @@ case "$1" in fi # *DEPRECATED* in v0.4.0: `pluginhook post-release` will be removed in future releases pluginhook post-release "$APP" - pluginhook post-release-buildstep "$APP" + pluginhook post-release-herokuish "$APP" ;; dockerfile) - # buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!! + # herokuish pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!! pluginhook pre-release-dockerfile "$APP" pluginhook post-release-dockerfile "$APP" ;; @@ -170,7 +170,7 @@ case "$1" in DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP) [[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm" has_tty && DOKKU_RUN_OPTS+=" -i -t" - is_image_buildstep_based "$IMAGE" && EXEC_CMD="/exec" + is_image_herokuish_based "$IMAGE" && EXEC_CMD="/exec" docker run $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@" ;; diff --git a/plugins/common/functions b/plugins/common/functions index c7afd2bc1..f76935f08 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -131,7 +131,7 @@ verify_image() { fi } -is_image_buildstep_based() { +is_image_herokuish_based() { # circleci can't support --rm as they run lxc in lxc [[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm" docker run --entrypoint="/bin/bash" $DOCKER_ARGS "$@" -c "[[ -f /exec ]]" diff --git a/plugins/config/docker-args-deploy b/plugins/config/docker-args-deploy index 53bda2383..8d1f1ef24 100755 --- a/plugins/config/docker-args-deploy +++ b/plugins/config/docker-args-deploy @@ -5,7 +5,7 @@ source "$(dirname $0)/../common/functions" STDIN=$(cat); APP="$1"; IMAGE="dokku/$APP" DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE" -if ! is_image_buildstep_based "$IMAGE"; then +if ! is_image_herokuish_based "$IMAGE"; then > "$DOCKERFILE_ENV_FILE" [[ -f "$DOKKU_ROOT/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/ENV" > "$DOCKERFILE_ENV_FILE" [[ -f "$DOKKU_ROOT/$APP/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/$APP/ENV" >> "$DOCKERFILE_ENV_FILE" diff --git a/plugins/git/commands b/plugins/git/commands index 174ba12ab..a2b9e3cd6 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -23,7 +23,7 @@ git_build_app_repo() { if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" else - dokku receive "$APP" "buildstep" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" + dokku receive "$APP" "herokuish" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" fi } diff --git a/plugins/ps/functions b/plugins/ps/functions index e92632564..b41d46d8a 100755 --- a/plugins/ps/functions +++ b/plugins/ps/functions @@ -6,9 +6,9 @@ release_and_deploy() { source "$(dirname $0)/../common/functions" local APP="$1"; local IMAGE="dokku/$APP" - if verify_image "$IMAGE"; then - if is_image_buildstep_based "$IMAGE"; then - IMAGE_SOURCE_TYPE="buildstep" + if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then + if is_image_herokuish_based "$IMAGE"; then + IMAGE_SOURCE_TYPE="herokuish" else IMAGE_SOURCE_TYPE="dockerfile" fi diff --git a/tests/ci/parallel_runner.sh b/tests/ci/parallel_runner.sh index 2bec642e8..b1bb958c7 100755 --- a/tests/ci/parallel_runner.sh +++ b/tests/ci/parallel_runner.sh @@ -33,13 +33,13 @@ case "$CIRCLE_NODE_INDEX" in ;; 2) - echo "=====> make deploy-tests (buildstep release) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" + echo "=====> make deploy-tests (herokuish release) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" [[ "$MODE" == "setup" ]] && setup_circle && exit 0 sudo -E make -e deploy-tests ;; 3) - echo "=====> make deploy-tests (buildstep master) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" + echo "=====> make deploy-tests (herokuish master) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" [[ "$MODE" == "setup" ]] && setup_circle buildstack && exit 0 sudo -E make -e deploy-tests ;; diff --git a/tests/unit/config.bats b/tests/unit/config.bats index 187f90946..380db45fa 100644 --- a/tests/unit/config.bats +++ b/tests/unit/config.bats @@ -53,7 +53,7 @@ teardown() { assert_output "" } -@test "(config) global config (buildstep)" { +@test "(config) global config (herokuish)" { deploy_app run bash -c "dokku run $TEST_APP env | egrep '^global_test=true'" echo "output: "$output diff --git a/tests/unit/ps-buildstep.bats b/tests/unit/ps-herokuish.bats similarity index 97% rename from tests/unit/ps-buildstep.bats rename to tests/unit/ps-herokuish.bats index e10534239..c55a3468a 100644 --- a/tests/unit/ps-buildstep.bats +++ b/tests/unit/ps-herokuish.bats @@ -10,7 +10,7 @@ teardown() { destroy_app } -# @test "(ps) buildstep" { +# @test "(ps) herokuish" { # # CI support: 'Ah. I just spoke with our Docker expert -- # # looks like docker exec is built to work with docker-under-libcontainer, # # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry @@ -21,7 +21,7 @@ teardown() { # assert_success # } -@test "(ps) buildstep" { +@test "(ps) herokuish" { deploy_app run bash -c "dokku ps:stop $TEST_APP" echo "output: "$output @@ -68,7 +68,7 @@ teardown() { done } -@test "(ps:scale) buildstep" { +@test "(ps:scale) herokuish" { run bash -c "dokku ps:scale $TEST_APP web=2 worker=2" echo "output: "$output echo "status: "$status From a801592b56aec9e2f031155ab1a8567750420f4d Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 20 Apr 2015 16:41:23 -0700 Subject: [PATCH 02/11] [ci skip] update missed doc refs to buildstep --- docs/application-deployment.md | 4 ++-- docs/troubleshooting.md | 20 -------------------- tests/apps/multi/README.md | 2 +- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/docs/application-deployment.md b/docs/application-deployment.md index 9ca0663ab..c463cb98a 100644 --- a/docs/application-deployment.md +++ b/docs/application-deployment.md @@ -25,7 +25,7 @@ You're done! Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku :master``` -Right now Herokuish supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/gliderlabs/herokuish#buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)! +Right now Herokuish supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/gliderlabs/herokuish#buildpacks). Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root. ## Deploying to server over SSH @@ -48,7 +48,7 @@ ssh -T git@github.com ## Specifying a custom buildpack -If buildpack detection isn't working well for you or you want to specify a custom buildpack for one repository you can create & commit a file in the root of your git repository named `.env` containing `export BUILDPACK_URL=` before pushing. This will tell buildstep to fetch the specified buildpack and use it instead of relying on the built-in buildpacks & their detection methods. +If buildpack detection isn't working well for you or you want to specify a custom buildpack for one repository you can create & commit a file in the root of your git repository named `.env` containing `export BUILDPACK_URL=` before pushing. This will tell herokuish to fetch the specified buildpack and use it instead of relying on the built-in buildpacks & their detection methods. ## Dockerfile deployment diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 5b31486d5..80e05ff22 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -109,26 +109,6 @@ Also see [issue #116](https://github.com/progrium/dokku/issues/116) *** -__Symptom:__ I want to deploy my nodejs app on dokku and use a postinstall script within the package.json but I keep getting this error: - - npm WARN cannot run in wd app@1.0.0 echo blah (wd=/build/app) - -__Solution:__ - -This is a permissions problem as dokku (buildstep) uses a root account for running the application. (This may change please see this thread: https://github.com/progrium/buildstep/pull/42). - -To allow npm to work as root account one must set the configuration option of ```unsafe-perm``` to true. There are many ways to set this configuration option but the one I've found works most consistently with the heroku-nodejs-buildpack is as a .npmrc file. The file should contain - -``` -unsafe-perm = true -``` - -Note that this is NOT required on heroku as heroku does not use a root account for running the application. - -Please see https://github.com/progrium/dokku/issues/420 and https://github.com/heroku/heroku-buildpack-nodejs/issues/92. - -*** - __Symptom:__ I successfully deployed my application with no deployment errors and receiving Bad Gateway when attempting to access the application __Solution:__ diff --git a/tests/apps/multi/README.md b/tests/apps/multi/README.md index dfe69e6e0..cba503104 100644 --- a/tests/apps/multi/README.md +++ b/tests/apps/multi/README.md @@ -1,3 +1,3 @@ -This is a sample application to test heroku buildpack multi for integrating with buildstep: https://github.com/progrium/buildstep/pull/75 +This is a sample application to test heroku buildpack multi for integrating with herokuish: https://github.com/gliderlabs/herokuish I am choosing to use the python, nodejs, and ruby buildpacks to create a very simple flask app that performs a bower install and a simple grunt task using compass. From 2e9bb4eed12367ba91616917aa30c1a3bdbda48d Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 20 Apr 2015 16:52:44 -0700 Subject: [PATCH 03/11] need to call /build for herokuish --- docs/troubleshooting.md | 4 ++-- plugins/00_dokku-standard/commands | 2 +- plugins/ps/functions | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 80e05ff22..138269f1a 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -65,8 +65,8 @@ __Solution (Less solution, more helpful troubleshooting steps):__ Find the failed phase's container image (*077581956a92* in this example) ``` - root@dokku:~# docker ps -a | grep builder - 94d9515e6d93 077581956a92 "/build/builder" 29 minutes ago Exited (0) 25 minutes ago cocky_bell + root@dokku:~# docker ps -a | grep build + 94d9515e6d93 077581956a92 "/build" 29 minutes ago Exited (0) 25 minutes ago cocky_bell ``` Start a new container with the failed image and poke around (i.e. ensure you can access the internet from within the container or attempt the failed command, if known) diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 10a74e392..860f13f71 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -24,7 +24,7 @@ case "$1" in # https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906 DOCKER_ARGS=$(: | pluginhook docker-args $APP build) DOCKER_ARGS+=$(: | pluginhook docker-args-build $APP) - id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build/builder) + id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build) docker attach $id test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null diff --git a/plugins/ps/functions b/plugins/ps/functions index b41d46d8a..23cba6f07 100755 --- a/plugins/ps/functions +++ b/plugins/ps/functions @@ -6,7 +6,7 @@ release_and_deploy() { source "$(dirname $0)/../common/functions" local APP="$1"; local IMAGE="dokku/$APP" - if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then + if verify_image "$IMAGE"; then if is_image_herokuish_based "$IMAGE"; then IMAGE_SOURCE_TYPE="herokuish" else From f99f9cd5d7f654a478da93913dcd574e19f673ba Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 6 Jul 2015 12:42:44 -0700 Subject: [PATCH 04/11] fix typo --- deb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb.mk b/deb.mk index 9f25b4d44..3690aceb2 100644 --- a/deb.mk +++ b/deb.mk @@ -1,4 +1,4 @@ -HEROKUISH_DESCRIPTION = 'Herokish uses Docker and Buildpacks to build applications like Heroku' +HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku' HEROKUISH_REPO_NAME ?= gliderlabs/herokuish HEROKUISH_VERSION ?= 0.0.1 HEROKUISH_ARCHITECTURE = amd64 From 1668f3bbc689c15aaed026d7de45df9dc4fcc915 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 6 Jul 2015 12:45:37 -0700 Subject: [PATCH 05/11] rename *-herokuish pluginhooks to *-buildpack --- docs/development/pluginhooks.md | 16 ++++++++-------- plugins/00_dokku-standard/commands | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/development/pluginhooks.md b/docs/development/pluginhooks.md index 036359442..c3ae76929 100644 --- a/docs/development/pluginhooks.md +++ b/docs/development/pluginhooks.md @@ -180,9 +180,9 @@ for file in */REDIRECT; do done ``` -### `pre-build-herokuish` +### `pre-build-buildpack` -- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using herokuish. +- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildpacks. - Invoked by: `dokku build` - Arguments: `$APP` - Example: @@ -195,9 +195,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `post-build-herokuish` +### `post-build-buildpack` -- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using herokuish. +- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildpacks. - Invoked by: `dokku build` - Arguments: `$APP` - Example: @@ -240,9 +240,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` -### `pre-release-herokuish` +### `pre-release-buildpack` -- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using herokuish. +- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildpacks. - Invoked by: `dokku release` - Arguments: `$APP` - Example: @@ -266,9 +266,9 @@ test $(docker wait $ID) -eq 0 docker commit $ID $IMAGE > /dev/null ``` -### `post-release-herokuish` +### `post-release-buildpack` -- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using herokuish. +- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildpacks. - Invoked by: `dokku release` - Arguments: `$APP` - Example: diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 860f13f71..954702fdf 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -18,7 +18,7 @@ case "$1" in [[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR # *DEPRECATED* in v0.4.0: `pluginhook pre-build` will be removed in future releases pluginhook pre-build "$APP" - pluginhook pre-build-herokuish "$APP" + pluginhook pre-build-buildpack "$APP" # *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases # https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906 @@ -31,7 +31,7 @@ case "$1" in # *DEPRECATED* in v0.4.0: `pluginhook post-build` will be removed in future releases pluginhook post-build "$APP" - pluginhook post-build-herokuish "$APP" + pluginhook post-build-buildpack "$APP" ;; dockerfile) @@ -60,7 +60,7 @@ case "$1" in herokuish) # *DEPRECATED* in v0.4.0: `pluginhook pre-release` will be removed in future releases pluginhook pre-release "$APP" - pluginhook pre-release-herokuish "$APP" + pluginhook pre-release-buildpack "$APP" if [[ -f "$DOKKU_ROOT/ENV" ]]; then id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV") test "$(docker wait $id)" -eq 0 @@ -73,7 +73,7 @@ case "$1" in fi # *DEPRECATED* in v0.4.0: `pluginhook post-release` will be removed in future releases pluginhook post-release "$APP" - pluginhook post-release-herokuish "$APP" + pluginhook post-release-buildpack "$APP" ;; dockerfile) From 059ebcd9fc5dec928644accd5aa53aff31dd24db Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Mon, 6 Jul 2015 17:15:07 -0700 Subject: [PATCH 06/11] build stack from master --- Makefile | 18 +++++++++++++----- tests/ci/parallel_runner.sh | 16 ++++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 042dc0266..c471cbe1b 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,12 @@ ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS))) $(eval $(RUN_ARGS):;@:) endif +ifeq ($(CIRCLECI),true) + BUILD_STACK_TARGETS = circleci deps build +else + BUILD_STACK_TARGETS = build-in-docker +endif + .PHONY: all apt-update install copyfiles man-db version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku include tests.mk @@ -104,15 +110,17 @@ ifndef CI endif stack: -ifeq ($(shell test -e /var/run/docker.sock && touch -a -c /var/run/docker.sock && echo $$?),0) - @echo "Start building herokuish" +ifeq ($(shell test -e /var/run/docker.sock && touch -c /var/run/docker.sock && echo $$?),0) ifdef BUILD_STACK - @docker images | grep gliderlabs/herokuish || (git clone ${STACK_URL} /tmp/herokuish && docker build -t gliderlabs/herokuish /tmp/herokuish && rm -rf /tmp/herokuish) + @echo "Start building herokuish from source" + docker images | grep gliderlabs/herokuish || (git clone ${STACK_URL} /tmp/herokuish && cd /tmp/herokuish && IMAGE_NAME=gliderlabs/herokuish BUILD_TAG=latest VERSION=master make -e ${BUILD_STACK_TARGETS} && rm -rf /tmp/herokuish) else ifeq ($(shell echo ${PREBUILT_STACK_URL} | egrep -q 'http.*://' && echo $$?),0) - @docker images | grep gliderlabs/herokuish || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - gliderlabs/herokuish + @echo "Start importing herokuish from ${PREBUILT_STACK_URL}" + docker images | grep gliderlabs/herokuish || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - gliderlabs/herokuish else - @docker pull ${PREBUILT_STACK_URL} + @echo "Start pulling herokuish from ${PREBUILT_STACK_URL}" + docker images | grep gliderlabs/herokuish || docker pull ${PREBUILT_STACK_URL} endif endif endif diff --git a/tests/ci/parallel_runner.sh b/tests/ci/parallel_runner.sh index b1bb958c7..d63e784fd 100755 --- a/tests/ci/parallel_runner.sh +++ b/tests/ci/parallel_runner.sh @@ -1,11 +1,10 @@ #!/usr/bin/env bash +set -eo pipefail; set -x + MODE="$1"; MODE=${MODE:="testing"} setup_circle() { - MAKE_ENV="CI=true" - [[ "$1" == "buildstack" ]] && MAKE_ENV+=" BUILD_STACK=true " - echo "setting up with MAKE_ENV: $MAKE_ENV" sudo -E CI=true make -e sshcommand # need to add the dokku user to the docker group sudo usermod -G docker dokku @@ -14,7 +13,8 @@ setup_circle() { sudo chown -R root:root ~root/.ssh/ sudo sed --in-place 's:/home/ubuntu:/root:g' ~root/.ssh/config #### - sudo -E $MAKE_ENV make -e install + [[ "$1" == "buildstack" ]] && BUILD_STACK=true make -e stack + sudo -E CI=true make -e install sudo -E make -e setup-deploy-tests make -e ci-dependencies } @@ -22,25 +22,25 @@ setup_circle() { case "$CIRCLE_NODE_INDEX" in 0) echo "=====> make unit-tests (1/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && setup_circle && exit 0 + [[ "$MODE" == "setup" ]] && (setup_circle ; exit $?) sudo -E UNIT_TEST_BATCH=1 make -e unit-tests ;; 1) echo "=====> make unit-tests (2/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && setup_circle && exit 0 + [[ "$MODE" == "setup" ]] && (setup_circle ; exit $?) sudo -E UNIT_TEST_BATCH=2 make -e unit-tests ;; 2) echo "=====> make deploy-tests (herokuish release) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && setup_circle && exit 0 + [[ "$MODE" == "setup" ]] && (setup_circle ; exit $?) sudo -E make -e deploy-tests ;; 3) echo "=====> make deploy-tests (herokuish master) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && setup_circle buildstack && exit 0 + [[ "$MODE" == "setup" ]] && (setup_circle buildstack ; exit $?) sudo -E make -e deploy-tests ;; esac From 27b79222c146daf32d7e8ab43a54f91a23717f13 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Wed, 8 Jul 2015 09:29:50 -0700 Subject: [PATCH 07/11] catch test setup errors --- tests/ci/parallel_runner.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/ci/parallel_runner.sh b/tests/ci/parallel_runner.sh index d63e784fd..9e641708d 100755 --- a/tests/ci/parallel_runner.sh +++ b/tests/ci/parallel_runner.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash -set -eo pipefail; set -x +set -eo pipefail MODE="$1"; MODE=${MODE:="testing"} setup_circle() { + echo "=====> setup_circle on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" sudo -E CI=true make -e sshcommand # need to add the dokku user to the docker group sudo usermod -G docker dokku @@ -19,28 +20,37 @@ setup_circle() { make -e ci-dependencies } +if [[ -n "$CIRCLE_NODE_INDEX" ]] && [[ "$MODE" == "setup" ]]; then + case "$CIRCLE_NODE_INDEX" in + 3) + setup_circle buildstack + exit $? + ;; + *) + setup_circle + exit $? + ;; + esac +fi + case "$CIRCLE_NODE_INDEX" in 0) echo "=====> make unit-tests (1/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && (setup_circle ; exit $?) sudo -E UNIT_TEST_BATCH=1 make -e unit-tests ;; 1) echo "=====> make unit-tests (2/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && (setup_circle ; exit $?) sudo -E UNIT_TEST_BATCH=2 make -e unit-tests ;; 2) echo "=====> make deploy-tests (herokuish release) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && (setup_circle ; exit $?) sudo -E make -e deploy-tests ;; 3) echo "=====> make deploy-tests (herokuish master) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX" - [[ "$MODE" == "setup" ]] && (setup_circle buildstack ; exit $?) sudo -E make -e deploy-tests ;; esac From 039cfdc7bacf401d860cd76a00af26ee0d10c72c Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Wed, 8 Jul 2015 11:18:41 -0700 Subject: [PATCH 08/11] make ports tests more stable --- tests/unit/core_ports.bats | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/unit/core_ports.bats b/tests/unit/core_ports.bats index 437732b79..8a01a240f 100644 --- a/tests/unit/core_ports.bats +++ b/tests/unit/core_ports.bats @@ -16,8 +16,8 @@ teardown() { @test "(core) port exposure (with global VHOST)" { echo "dokku.me" > "$DOKKU_ROOT/VHOST" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_failure @@ -27,8 +27,8 @@ teardown() { rm "$DOKKU_ROOT/VHOST" echo "dokku.me" > "$DOKKU_ROOT/HOSTNAME" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success @@ -37,8 +37,8 @@ teardown() { @test "(core) port exposure (with NO_VHOST set)" { deploy_app dokku config:set $TEST_APP NO_VHOST=1 - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1) - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success @@ -48,8 +48,8 @@ teardown() { rm "$DOKKU_ROOT/VHOST" echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success @@ -59,8 +59,8 @@ teardown() { rm "$DOKKU_ROOT/VHOST" echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" > "$DOKKU_ROOT/HOSTNAME" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success @@ -76,8 +76,8 @@ teardown() { deploy_app sleep 5 # wait for nginx to reload - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_failure @@ -102,8 +102,8 @@ teardown() { echo "status: "$status assert_success - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1) - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_failure @@ -116,7 +116,7 @@ teardown() { @test "(core) dockerfile port exposure" { deploy_app dockerfile - run bash -c "grep -A1 upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000" + run bash -c "grep -A1 upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep -q 3000" echo "output: "$output echo "status: "$status assert_success From eebcfd85ab307fc5c82d662416b0e60a3cc6c7ab Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 9 Jul 2015 13:15:57 -0700 Subject: [PATCH 09/11] fix deprecated comments and include *-buildstep pluginhooks for point release --- plugins/00_dokku-standard/commands | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index f0ba52e28..96724c8d2 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -16,8 +16,10 @@ case "$1" in test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null [[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR - # *DEPRECATED* in v0.4.0: `pluginhook pre-build` will be removed in future releases + # *DEPRECATED* in v0.3.15: `pluginhook pre-build` will be removed in future releases pluginhook pre-build "$APP" + # *DEPRECATED* in v0.3.22: `pluginhook pre-build-buildstep` will be removed in future releases + pluginhook pre-build-buildstep "$APP" pluginhook pre-build-buildpack "$APP" # *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases @@ -29,8 +31,10 @@ case "$1" in test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null - # *DEPRECATED* in v0.4.0: `pluginhook post-build` will be removed in future releases + # *DEPRECATED* in v0.3.15: `pluginhook post-build` will be removed in future releases pluginhook post-build "$APP" + # *DEPRECATED* in v0.3.22: `pluginhook post-build-buildstep` will be removed in future releases + pluginhook post-build-buildstep "$APP" pluginhook post-build-buildpack "$APP" ;; @@ -58,8 +62,10 @@ case "$1" in APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3" case "$IMAGE_SOURCE_TYPE" in herokuish) - # *DEPRECATED* in v0.4.0: `pluginhook pre-release` will be removed in future releases + # *DEPRECATED* in v0.3.15: `pluginhook pre-release` will be removed in future releases pluginhook pre-release "$APP" + # *DEPRECATED* in v0.3.22: `pluginhook pre-release-buildstep` will be removed in future releases + pluginhook pre-release-buildstep "$APP" pluginhook pre-release-buildpack "$APP" if [[ -f "$DOKKU_ROOT/ENV" ]]; then id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV") @@ -71,8 +77,10 @@ case "$1" in test "$(docker wait $id)" -eq 0 docker commit $id $IMAGE > /dev/null fi - # *DEPRECATED* in v0.4.0: `pluginhook post-release` will be removed in future releases + # *DEPRECATED* in v0.3.15: `pluginhook post-release` will be removed in future releases pluginhook post-release "$APP" + # *DEPRECATED* in v0.3.22: `pluginhook post-release-buildstep` will be removed in future releases + pluginhook post-release-buildstep "$APP" pluginhook post-release-buildpack "$APP" ;; From fd187ec837d931d1d6396f8f23d7345ad0c74496 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 9 Jul 2015 13:22:12 -0700 Subject: [PATCH 10/11] [ci skip] remove unnecessary comments and update docs --- docs/upgrading.md | 2 +- plugins/00_dokku-standard/commands | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/upgrading.md b/docs/upgrading.md index 0cda846d5..f1b234eac 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -58,5 +58,5 @@ cd /tmp git clone https://github.com/gliderlabs/herokuish.git cd herokuish git pull origin master -sudo make build +IMAGE_NAME=gliderlabs/herokuish BUILD_TAG=latest VERSION=master make -e build-in-docker ``` diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 96724c8d2..35423ad33 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -42,8 +42,6 @@ case "$1" in # extract first port from Dockerfile DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true) [[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT - - # herokuish pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!! pluginhook pre-build-dockerfile "$APP" [[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache" @@ -85,7 +83,6 @@ case "$1" in ;; dockerfile) - # herokuish pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!! pluginhook pre-release-dockerfile "$APP" pluginhook post-release-dockerfile "$APP" ;; From c6e4f95550cb3d655db8809b93580dce1b577cfd Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 19 Aug 2015 20:45:58 -0400 Subject: [PATCH 11/11] fix name of herokuish debian package --- deb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb.mk b/deb.mk index 201582b39..75b98ae27 100644 --- a/deb.mk +++ b/deb.mk @@ -89,7 +89,7 @@ deb-herokuish: deb-setup cp -rf /tmp/tmp/herokuish /tmp/build/var/lib/herokuish echo "-> Creating $(HEROKUISH_PACKAGE_NAME)" - sudo fpm -t deb -s dir -C /tmp/build -n HEROKUISH -v $(HEROKUISH_VERSION) -a $(HEROKUISH_ARCHITECTURE) -p $(HEROKUISH_PACKAGE_NAME) --deb-pre-depends 'lxc-docker-1.6.2' --after-install /tmp/tmp/post-install --url "https://github.com/$(HEROKUISH_REPO_NAME)" --description $(HEROKUISH_DESCRIPTION) --license 'MIT License' . + sudo fpm -t deb -s dir -C /tmp/build -n herokuish -v $(HEROKUISH_VERSION) -a $(HEROKUISH_ARCHITECTURE) -p $(HEROKUISH_PACKAGE_NAME) --deb-pre-depends 'lxc-docker-1.6.2' --after-install /tmp/tmp/post-install --url "https://github.com/$(HEROKUISH_REPO_NAME)" --description $(HEROKUISH_DESCRIPTION) --license 'MIT License' . mv *.deb /tmp deb-dokku: deb-setup