From 2e5f88b285ee8b73b59c1a74d599bee230b4079e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 4 Oct 2014 07:48:08 -0400 Subject: [PATCH 1/7] Use -qq flag on apt-get to quiet installations of packages --- Makefile | 6 +++--- Vagrantfile | 2 +- bootstrap.sh | 4 ++-- plugins/nginx-vhosts/install | 2 +- tests/ci/receiver | 2 +- tests/ci/setup.sh | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index cfac50ca2..d4e58fea6 100644 --- a/Makefile +++ b/Makefile @@ -47,14 +47,14 @@ docker: aufs echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list apt-get update ifdef DOCKER_VERSION - apt-get install -y lxc-docker-${DOCKER_VERSION} + apt-get install -qq -y lxc-docker-${DOCKER_VERSION} else - apt-get install -y lxc-docker + apt-get install -qq -y lxc-docker endif sleep 2 # give docker a moment i guess aufs: - lsmod | grep aufs || modprobe aufs || apt-get install -y linux-image-extra-`uname -r` + lsmod | grep aufs || modprobe aufs || apt-get install -qq -y linux-image-extra-`uname -r` > /dev/null stack: ifdef BUILD_STACK diff --git a/Vagrantfile b/Vagrantfile index 005f6c3b5..8f4d8e700 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -29,5 +29,5 @@ Vagrant::configure("2") do |config| vb.customize ["modifyvm", :id, "--memory", BOX_MEMORY] end - config.vm.provision :shell, :inline => "apt-get -y install git && cd /root/dokku && #{make_cmd}" + config.vm.provision :shell, :inline => "apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}" end diff --git a/bootstrap.sh b/bootstrap.sh index 0acc430a7..7cf58ceab 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -10,9 +10,9 @@ then fi apt-get update -apt-get install -y git make curl software-properties-common +apt-get install -qq -y git make curl software-properties-common -[[ `lsb_release -sr` == "12.04" ]] && apt-get install -y python-software-properties +[[ `lsb_release -sr` == "12.04" ]] && apt-get install -qq -y python-software-properties cd ~ && test -d dokku || git clone $DOKKU_REPO cd dokku diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index bcbc1f063..7a28d958c 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -4,7 +4,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # latest stable NGINX 1.4.x with websocket support add-apt-repository -y ppa:nginx/stable apt-get update -apt-get install -y nginx dnsutils +apt-get install -qq -y nginx dnsutils if ! grep -q dokku-nginx-reload "/etc/sudoers"; then touch /etc/sudoers.tmp diff --git a/tests/ci/receiver b/tests/ci/receiver index 710a01df0..2d3db4aac 100755 --- a/tests/ci/receiver +++ b/tests/ci/receiver @@ -11,7 +11,7 @@ if [[ $2 == *dokku* ]]; then cd /tmp/build tar -xf - echo "-----> Installing dependencies" - DEBIAN_FRONTEND=noninteractive apt-get install -y git make curl software-properties-common + DEBIAN_FRONTEND=noninteractive apt-get install -qq -y git make curl software-properties-common echo "-----> Set hostname to dokku.me" hostname dokku.me echo "-----> Enabling tracing" diff --git a/tests/ci/setup.sh b/tests/ci/setup.sh index d020280af..d22fafefa 100755 --- a/tests/ci/setup.sh +++ b/tests/ci/setup.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail -export DEBIAN_FRONTEND=noninteractive -apt-get install -y git make curl +export DEBIAN_FRONTEND=noninteractive +apt-get install -qq -y git make curl cd /tmp @@ -24,4 +24,4 @@ EOF cat< /etc/rc.local curl https://raw.github.com/progrium/dokku/master/tests/ci/receiver -s > /tmp/receiver chmod +x /tmp/receiver -EOF \ No newline at end of file +EOF From a748e123be67844de732525b806811f60d8606ee Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 4 Oct 2014 07:48:26 -0400 Subject: [PATCH 2/7] Silence curl stderr progress output --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d4e58fea6..1584e63d4 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ pluginhook: docker: aufs egrep -i "^docker" /etc/group || groupadd docker usermod -aG docker dokku - curl https://get.docker.io/gpg | apt-key add - + curl --silent https://get.docker.io/gpg | apt-key add - echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list apt-get update ifdef DOCKER_VERSION @@ -60,7 +60,7 @@ stack: 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) else - @docker images | grep progrium/buildstep || curl -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep + @docker images | grep progrium/buildstep || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep endif count: From c5026cafa1e8a71b5a11789b7434e118342d7cfa Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 4 Oct 2014 07:49:32 -0400 Subject: [PATCH 3/7] Ensure curl is installed before using command --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 1584e63d4..8ca2b4bb7 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ pluginhook: dpkg -i /tmp/pluginhook_0.1.0_amd64.deb docker: aufs + apt-get install -qq -y curl egrep -i "^docker" /etc/group || groupadd docker usermod -aG docker dokku curl --silent https://get.docker.io/gpg | apt-key add - From a67c2c927da5c3d5d2a06ab492ba4b2866c77aa3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 4 Oct 2014 07:49:56 -0400 Subject: [PATCH 4/7] Fix issue where certain hosts will not have add-apt-repository installed due to missing packages --- plugins/nginx-vhosts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index 7a28d958c..52d35e1f8 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -2,6 +2,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # latest stable NGINX 1.4.x with websocket support +apt-get install -qq -y software-properties-common python-software-properties add-apt-repository -y ppa:nginx/stable apt-get update apt-get install -qq -y nginx dnsutils From 14145eebb1a640efab7d77624bd1fe3ae0ed8690 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 4 Oct 2014 18:37:23 -0400 Subject: [PATCH 5/7] Simplify the vagrant workflow - Moved from wget to cloning the repository - Add acl-add command to Make - Modify the docs to use the new methodology --- Makefile | 6 +++++- docs/installation.md | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8ca2b4bb7..869e56f0d 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ STACK_URL ?= https://github.com/progrium/buildstep.git PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz DOKKU_ROOT ?= /home/dokku -.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count +.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count acl-add all: # Type "make install" to install. @@ -71,3 +71,7 @@ count: @find plugins -type f | xargs cat | wc -l @echo "Test lines:" @find tests -type f | xargs cat | wc -l + +acl-add: + vagrant ssh -- sudo sshcommand acl-add dokku $(USER) + diff --git a/docs/installation.md b/docs/installation.md index 62c5f9771..79b6e5815 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -85,10 +85,10 @@ sudo BUILD_STACK=true make install - Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) - Download and install [Vagrant](http://www.vagrantup.com/downloads.html) -- Download Dokku (latest stable) +- Clone Dokku ``` - wget https://github.com/progrium/dokku/archive/master.zip + git clone git@github.com:progrium/dokku.git ``` - Setup SSH hosts in your `/etc/hosts` @@ -115,10 +115,10 @@ sudo BUILD_STACK=true make install vagrant up ``` -- Add SSH key to Dokku using `sshcommand acl-add `, e.g.: +- Add SSH key to Dokku using `sshcommand`: - ``` - cat ~/.ssh/id_rsa.pub | ssh -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo sshcommand acl-add dokku progrium" + ```bash + cat ~/.ssh/id_rsa.pub | make acl-add ``` You are now ready to deploy an app or install plugins. From ab44c915a8c8fb36592ec18855ab289ef0dd28fc Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 4 Oct 2014 18:38:37 -0400 Subject: [PATCH 6/7] Add a passthru make target for running dokku commands within the vagrant vm --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 869e56f0d..b42156fd5 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,15 @@ STACK_URL ?= https://github.com/progrium/buildstep.git PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz DOKKU_ROOT ?= /home/dokku -.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count acl-add +# If the first argument is "dokku"... +ifeq (dokku,$(firstword $(MAKECMDGOALS))) + # use the rest as arguments for "dokku" + RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) + # ...and turn them into do-nothing targets + $(eval $(RUN_ARGS):;@:) +endif + +.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count acl-add dokku all: # Type "make install" to install. @@ -75,3 +83,5 @@ count: acl-add: vagrant ssh -- sudo sshcommand acl-add dokku $(USER) +dokku: + vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'" From b9eed22e35d26a79dd2c7b9a9148af5d9659878b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 6 Oct 2014 18:31:17 -0400 Subject: [PATCH 7/7] Change targets to vagrant-* --- Makefile | 12 ++++++------ docs/installation.md | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b42156fd5..a29f02c2a 100644 --- a/Makefile +++ b/Makefile @@ -6,15 +6,15 @@ STACK_URL ?= https://github.com/progrium/buildstep.git PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz DOKKU_ROOT ?= /home/dokku -# If the first argument is "dokku"... -ifeq (dokku,$(firstword $(MAKECMDGOALS))) - # use the rest as arguments for "dokku" +# If the first argument is "vagrant-dokku"... +ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS))) + # use the rest as arguments for "vagrant-dokku" RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) # ...and turn them into do-nothing targets $(eval $(RUN_ARGS):;@:) endif -.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count acl-add dokku +.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count vagrant-acl-add vagrant-dokku all: # Type "make install" to install. @@ -80,8 +80,8 @@ count: @echo "Test lines:" @find tests -type f | xargs cat | wc -l -acl-add: +vagrant-acl-add: vagrant ssh -- sudo sshcommand acl-add dokku $(USER) -dokku: +vagrant-dokku: vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'" diff --git a/docs/installation.md b/docs/installation.md index 79b6e5815..5855e7275 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -118,7 +118,7 @@ sudo BUILD_STACK=true make install - Add SSH key to Dokku using `sshcommand`: ```bash - cat ~/.ssh/id_rsa.pub | make acl-add + cat ~/.ssh/id_rsa.pub | make vagrant-acl-add ``` You are now ready to deploy an app or install plugins.