From 495190f0b801ce64c785c5d012e66bf477d5c9a3 Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 9 Jun 2013 10:02:31 +0100 Subject: [PATCH 1/7] Pointing to personal repositories for hacking --- bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index db0cc7a63..b2fb08f93 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -14,14 +14,14 @@ gitreceive init # buildstep cd ~ -git clone https://github.com/progrium/buildstep.git +git clone https://github.com/rnorth/buildstep.git cd buildstep cp buildstep /home/git/buildstep make # dokku (this!) cd ~ -git clone https://github.com/progrium/dokku.git +git clone https://github.com/rnorth/dokku.git cd dokku cp receiver /home/git/receiver cp nginx-app-conf /home/git/nginx-app-conf From 1192c84e1356d225da08809ae77b516df660a281 Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 9 Jun 2013 10:07:28 +0100 Subject: [PATCH 2/7] Sourcing the profile files which Heroku buildpacks set up for us (in /app/.profile.d), so that dependencies downloaded by the buildpack are available on PATH. The docker run command which starts the app is now a little verbose so maybe should be refactored into a separate script; part of the verbosity is because of guarding against absence of the .profile.d directory. This is to support use of the Java buildpack but has also been tested working for a simple Ruby web app. --- receiver | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/receiver b/receiver index 2c3cc2a2e..221ddf3c1 100755 --- a/receiver +++ b/receiver @@ -12,10 +12,11 @@ if [[ -f "$HOME/$1/PORT" ]]; then OLDID=$(< "$HOME/$1/CONTAINER") docker kill $OLDID > /dev/null PORT=$(< "$HOME/$1/PORT") - ID=$(docker run -d -p ":$PORT" -e "PORT=$PORT" $APP /bin/bash -c "cd /app && ./start") echo $ID > "$HOME/$1/CONTAINER" + ID=$(docker run -d -p ":$PORT" -e "PORT=$PORT" $APP /bin/bash -c "if [ -d /app/.profile.d ]; then source /app/.profile.d/*; fi; cd /app && ./start") else - ID=$(docker run -d -p 5000 -e PORT=5000 $APP /bin/bash -c "cd /app && ./start") + + ID=$(docker run -d -p 5000 -e PORT=5000 $APP /bin/bash -c "if [ -d /app/.profile.d ]; then source /app/.profile.d/*; fi; cd /app && ./start") echo $ID > "$HOME/$1/CONTAINER" PORT=$(docker inspect $ID | ruby -e 'require"json";puts JSON.parse(STDIN.read)["NetworkSettings"]["PortMapping"]["5000"]') echo $PORT > "$HOME/$1/PORT" @@ -31,4 +32,4 @@ if [[ $DOMAIN ]]; then else echo " http://$(hostname -i | cut -d' ' -f3):$PORT" fi -echo +echo \ No newline at end of file From d8ee606ebcb347c461a1f60bd84be78070904d6c Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 9 Jun 2013 10:28:08 +0100 Subject: [PATCH 3/7] Fixed broken ordering of steps when PORT is specified. --- receiver | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/receiver b/receiver index 221ddf3c1..c142b036b 100755 --- a/receiver +++ b/receiver @@ -12,10 +12,9 @@ if [[ -f "$HOME/$1/PORT" ]]; then OLDID=$(< "$HOME/$1/CONTAINER") docker kill $OLDID > /dev/null PORT=$(< "$HOME/$1/PORT") - echo $ID > "$HOME/$1/CONTAINER" ID=$(docker run -d -p ":$PORT" -e "PORT=$PORT" $APP /bin/bash -c "if [ -d /app/.profile.d ]; then source /app/.profile.d/*; fi; cd /app && ./start") + echo $ID > "$HOME/$1/CONTAINER" else - ID=$(docker run -d -p 5000 -e PORT=5000 $APP /bin/bash -c "if [ -d /app/.profile.d ]; then source /app/.profile.d/*; fi; cd /app && ./start") echo $ID > "$HOME/$1/CONTAINER" PORT=$(docker inspect $ID | ruby -e 'require"json";puts JSON.parse(STDIN.read)["NetworkSettings"]["PortMapping"]["5000"]') From 4c7d2262e26d1c548ad3226a4c85806172546e2a Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 9 Jun 2013 11:09:26 +0100 Subject: [PATCH 4/7] Allowing repository locations to be overridden with environment variables for hacking; using progrium's locations as the default. --- bootstrap.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index b2fb08f93..c73c5ed50 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,3 +1,9 @@ +# Repository locations - set environment variables to override defaults +# e.g. OVERRIDE_DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh +GITRECEIVE_URL=${OVERRIDE_GITRECEIVE_URL:-"https://raw.github.com/progrium/gitreceive/master/gitreceive"} +BUILDSTEP_REPO=${OVERRIDE_BUILDSTEP_REPO:-"https://github.com/progrium/buildstep.git"} +DOKKU_REPO=${OVERRIDE_DOKKU_REPO:-"https://github.com/progrium/dokku.git"} + # Docker and base dependencies apt-get install -y linux-image-extra-`uname -r` apt-get install -y software-properties-common @@ -8,20 +14,20 @@ apt-get install -y git ruby nginx make # gitreceive cd /usr/local/bin -wget https://raw.github.com/progrium/gitreceive/master/gitreceive +wget ${GITRECEIVE_URL} chmod +x gitreceive gitreceive init # buildstep cd ~ -git clone https://github.com/rnorth/buildstep.git +git clone ${BUILDSTEP_REPO} cd buildstep cp buildstep /home/git/buildstep make # dokku (this!) cd ~ -git clone https://github.com/rnorth/dokku.git +git clone ${DOKKU_REPO} cd dokku cp receiver /home/git/receiver cp nginx-app-conf /home/git/nginx-app-conf From d585292bf85cc063133571e210f9842a93119e5b Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 9 Jun 2013 11:53:20 +0100 Subject: [PATCH 5/7] Updating README to reflect Java buildpack and customizable repo URLs in bootstrap script. --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fcd8388d..863503cfe 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,18 @@ best to use a fresh VM. The bootstrapper will install everything it needs. This may take around 5 minutes. Certainly better than the several hours it takes to bootstrap Cloud Foundry. +## Advanced installation (for development) + +The bootstrap script allows source git repository URLs to be overridden to include customizations from your own +repositories. The OVERRIDE_GITRECEIVE_URL, OVERRIDE_BUILDSTEP_REPO and OVERRIDE_DOKKU_REPO environment variables +may be set to override the defaults (see the bootstrap.sh script for how these apply): + +Example: + + $ wget j.mp/dokku-bootstrap + $ chmod +x bootstrap.sh + $ OVERRIDE_DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh + ## Configuring Set up a domain and a wildcard domain pointing to that host. Make sure `/home/git/DOMAIN` is set to this domain. @@ -27,7 +39,7 @@ That's it! ## Deploy an App -Right now Buildstep supports the Node.js and Ruby buildpacks. It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)! Let's deploy +Right now Buildstep supports the Node.js, Ruby and Java buildpacks. It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)! Let's deploy the Heroku Node.js sample app. All you have to do is add a remote to name the app. It's created on-the-fly. $ cd node-js-sample From 0033c3a8cda9bac4b586e1e5843168bb8b24d1ca Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 9 Jun 2013 18:26:59 +0100 Subject: [PATCH 6/7] Making repo location override variables shorter, simpler names for users. --- README.md | 4 ++-- bootstrap.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 863503cfe..17842b15d 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,14 @@ This may take around 5 minutes. Certainly better than the several hours it takes ## Advanced installation (for development) The bootstrap script allows source git repository URLs to be overridden to include customizations from your own -repositories. The OVERRIDE_GITRECEIVE_URL, OVERRIDE_BUILDSTEP_REPO and OVERRIDE_DOKKU_REPO environment variables +repositories. The GITRECEIVE_URL, BUILDSTEP_REPO and DOKKU_REPO environment variables may be set to override the defaults (see the bootstrap.sh script for how these apply): Example: $ wget j.mp/dokku-bootstrap $ chmod +x bootstrap.sh - $ OVERRIDE_DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh + $ DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh ## Configuring diff --git a/bootstrap.sh b/bootstrap.sh index c73c5ed50..6399016a4 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,8 +1,8 @@ # Repository locations - set environment variables to override defaults # e.g. OVERRIDE_DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh -GITRECEIVE_URL=${OVERRIDE_GITRECEIVE_URL:-"https://raw.github.com/progrium/gitreceive/master/gitreceive"} -BUILDSTEP_REPO=${OVERRIDE_BUILDSTEP_REPO:-"https://github.com/progrium/buildstep.git"} -DOKKU_REPO=${OVERRIDE_DOKKU_REPO:-"https://github.com/progrium/dokku.git"} +GITRECEIVE_URL=${GITRECEIVE_URL:-"https://raw.github.com/progrium/gitreceive/master/gitreceive"} +BUILDSTEP_REPO=${BUILDSTEP_REPO:-"https://github.com/progrium/buildstep.git"} +DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"} # Docker and base dependencies apt-get install -y linux-image-extra-`uname -r` From e6ad0d81aaafe75f085cba4c975ea4684bef81e5 Mon Sep 17 00:00:00 2001 From: Richard North Date: Sun, 9 Jun 2013 18:28:21 +0100 Subject: [PATCH 7/7] Moving advanced installation section of README downwards for ease of reading for regular users. --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 17842b15d..234c432c8 100644 --- a/README.md +++ b/README.md @@ -13,18 +13,6 @@ best to use a fresh VM. The bootstrapper will install everything it needs. This may take around 5 minutes. Certainly better than the several hours it takes to bootstrap Cloud Foundry. -## Advanced installation (for development) - -The bootstrap script allows source git repository URLs to be overridden to include customizations from your own -repositories. The GITRECEIVE_URL, BUILDSTEP_REPO and DOKKU_REPO environment variables -may be set to override the defaults (see the bootstrap.sh script for how these apply): - -Example: - - $ wget j.mp/dokku-bootstrap - $ chmod +x bootstrap.sh - $ DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh - ## Configuring Set up a domain and a wildcard domain pointing to that host. Make sure `/home/git/DOMAIN` is set to this domain. @@ -62,6 +50,18 @@ the Heroku Node.js sample app. All you have to do is add a remote to name the ap You're done! +## Advanced installation (for development) + +The bootstrap script allows source git repository URLs to be overridden to include customizations from your own +repositories. The GITRECEIVE_URL, BUILDSTEP_REPO and DOKKU_REPO environment variables +may be set to override the defaults (see the bootstrap.sh script for how these apply): + +Example: + + $ wget j.mp/dokku-bootstrap + $ chmod +x bootstrap.sh + $ DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh + ## Components * [Docker](https://github.com/dotcloud/docker) - Container runtime and manager