diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..c80200c1d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*] +insert_final_newline = true +indent_style = space +indent_size = 2 diff --git a/HISTORY.md b/HISTORY.md index 085f7977f..bacb60464 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,8 +1,58 @@ # History -## 0.3.0 (in progress) +## 0.3.1 + +- 647b2157: @josegonzalez Update HISTORY.md for 0.3.0 +- #359: @plietar Remove plugins before copying them again +- #573: @eriknomitch Use command instead of which for apt-get existential check in bootstrap.sh +- #579: @motin Plugin nginx-vhosts includes files in folder nginx.conf.d +- #607: @fbochu Use PLUGIN_PATH in dokku default case +- #617: @markstos Document what bootstrap.sh is doing +- #758: @josegonzalez Make ENV file readable only from dokku user. Closes #621 +- #699: @tombell Actually suppress the output from `git_archive_all` +- #702: @jazzzz Allows config:set to set parameters values with spaces +- #754: @josegonzalez Remove all references to Ubuntu 12.04. Refs #238 +- #755: @josegonzalez Setup dokku-installer within Vagrant VM on first provision +- #759: @josegonzalez Create an `apps` core plugin +- #760: @josegonzalez Formatting +- #761: @josegonzalez Add dokku-registry to list. Closes #716 +- #762: @josegonzalez Update template for dokku docs + +## 0.3.0 + +- Added git submodules support +- 969aed87: @jfrazelle Fix double brackets issue in nginx-vhosts install +- 42fee25f: @rhy-jot Mention 14.04 & 12.10 sunset +- 4f5fc586: @rhy-jot Update cipher list +- #276: @joliv Add dependencies hook - wingrunr21- #476: Added man page entry +- #522: @wingrunr21 Improve SSL support and implement SPDY +- #544: @jfrazelle if dokku.conf has not been created, create it +- #555: @jakubholynet Readme fix, Env vars only set at run time +- #562: @assaf Zero down-time deploy and server checks +- #571: @joliv Added man page plugin command + #601: @jazzzz Restart app only if config changed +- #628: @voronianski Update Vagrant box to trusty because of raring server issues +- #632: @jazzzz Fixed port when docker is start with --ip with an IP other than 0.0.0.0 +- #654: @cameron-martin Fixed variable name for RESTART +- #664: @alexernst Don't overwrite $APP/URL modified by plugins in post-deploy hook +- #665: @protomouse Explicitly install man-db +- #698: @tombell Help output formatting +- #701: @jazzzz Fix issues with single-letter config:set usage +- #703: @jazzzz Display help when invoking dokku with no parameter +- #706: @josegonzalez Consolidate documentation on viewthedocs +- #709: @rinti Grammar and spelling fixes +- #708: @josegonzalez Simplify vagrant workflow +- #717: @kristofsajdak Add dokku-registry to plugin list +- #718: @Coaxial Use https for installation instructions +- #721: @wrboyce Fix issue in plugins-install-dependencies +- #723: @ghostbar Let users know they are starting buildstep during installation +- #735: @andrewsomething Redirect to the app deployment docs on success. +- #745: @rcarmo Typo +- #746: @vincentfretin replace gitreceive by sshcommand in example url +- #748: @vincentfretin Link to proper blog url +- #749: @vincentfretin Fix app certificate directory in backup-import/export +- #750: @th4t Remove unintended phrase repetition in installation.md -* Added git submodules support ## 0.2.0 (2013-11-24) diff --git a/Makefile b/Makefile index cfac50ca2..fc3eaf439 100644 --- a/Makefile +++ b/Makefile @@ -6,17 +6,30 @@ 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 +# 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 dokku-installer vagrant-acl-add vagrant-dokku all: # Type "make install" to install. -install: dependencies stack copyfiles plugins version +install: dependencies stack copyfiles plugin-dependencies plugins version copyfiles: addman cp dokku /usr/local/bin/dokku mkdir -p /var/lib/dokku/plugins - cp -r plugins/* /var/lib/dokku/plugins + find /var/lib/dokku/plugins -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf + find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \ + rm -Rf /var/lib/dokku/plugins/$$plugin && \ + cp -R plugins/$$plugin /var/lib/dokku/plugins && \ + touch /var/lib/dokku/plugins/$$plugin/.core; \ + done addman: mkdir -p /usr/local/share/man/man1 @@ -26,6 +39,9 @@ addman: version: git describe --tags > ${DOKKU_ROOT}/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ${DOKKU_ROOT}/VERSION +plugin-dependencies: pluginhook + dokku plugins-install-dependencies + plugins: pluginhook docker dokku plugins-install @@ -41,26 +57,28 @@ 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 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 - 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: + @echo "Start building buildstep" 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: @@ -70,3 +88,19 @@ count: @find plugins -type f | xargs cat | wc -l @echo "Test lines:" @find tests -type f | xargs cat | wc -l + +dokku-installer: + test -f /var/lib/dokku/.dokku-installer-created || gem install rack -v 1.5.2 --no-rdoc --no-ri + test -f /var/lib/dokku/.dokku-installer-created || gem install rack-protection -v 1.5.3 --no-rdoc --no-ri + test -f /var/lib/dokku/.dokku-installer-created || gem install sinatra -v 1.4.5 --no-rdoc --no-ri + test -f /var/lib/dokku/.dokku-installer-created || gem install tilt -v 1.4.1 --no-rdoc --no-ri + test -f /var/lib/dokku/.dokku-installer-created || ruby /root/dokku/contrib/dokku-installer.rb onboot + test -f /var/lib/dokku/.dokku-installer-created || service dokku-installer start + test -f /var/lib/dokku/.dokku-installer-created || service nginx reload + test -f /var/lib/dokku/.dokku-installer-created || touch /var/lib/dokku/.dokku-installer-created + +vagrant-acl-add: + vagrant ssh -- sudo sshcommand acl-add dokku $(USER) + +vagrant-dokku: + vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'" diff --git a/README.md b/README.md index 480ae1183..ce422d53d 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # Dokku [](https://travis-ci.org/progrium/dokku) -Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. +Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/). ## Requirements -- A fresh VM running either Ubuntu `14.04 x64` or `12.04 x64` +- A fresh VM running Ubuntu `14.04 x64` ## Installing To install the latest stable version of dokku, you can run the following bootstrapper command: - $ wget -qO- https://raw.github.com/progrium/dokku/v0.2.3/bootstrap.sh | sudo DOKKU_TAG=v0.2.3 bash + $ wget -qO- https://raw.github.com/progrium/dokku/v0.3.1/bootstrap.sh | sudo DOKKU_TAG=v0.3.1 bash ## Documentation @@ -20,6 +20,10 @@ Full documentation - including advanced installation docs - are available online You can use [Github Issues](https://github.com/progrium/dokku/issues), check [Troubleshooting](https://github.com/progrium/dokku/wiki/Troubleshooting) on the wiki, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku) +## Sponsors + +Dokku is currently sponsored by the enterprise grade, multi-host PaaS project [Deis](http://deis.io/). + ## License MIT diff --git a/SPONSORS b/SPONSORS new file mode 100644 index 000000000..b910636d2 --- /dev/null +++ b/SPONSORS @@ -0,0 +1 @@ +Deis http://deis.io \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile index 005f6c3b5..b47fde806 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -29,5 +29,6 @@ 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}" + config.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer" end diff --git a/bootstrap.sh b/bootstrap.sh old mode 100644 new mode 100755 index 0acc430a7..3950ef3fc --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,18 +1,22 @@ #!/usr/bin/env bash +# A script to bootstrap dokku. +# It expects to be run on Ubuntu 14.04 via 'sudo' +# It checks out the dokku source code from Github into ~/dokku and then runs 'make install' from dokku source. + set -eo pipefail export DEBIAN_FRONTEND=noninteractive export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"} -if ! which apt-get &>/dev/null +if ! command -v apt-get &>/dev/null then echo "This installation script requires apt-get. For manual installation instructions, consult https://github.com/progrium/dokku ." exit 1 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 man-db -[[ `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/contrib/dokku-installer.rb b/contrib/dokku-installer.rb index c8ce50227..6506fc176 100755 --- a/contrib/dokku-installer.rb +++ b/contrib/dokku-installer.rb @@ -3,120 +3,120 @@ require "sinatra" require "open3" if ARGV[0] == "onboot" - File.open("/etc/init/dokku-installer.conf", "w") do |f| - f.puts "start on runlevel [2345]" - f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct" - end - File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f| - f.puts "upstream dokku-installer { server 127.0.0.1:2000; }" - f.puts "server {" - f.puts " listen 80;" - f.puts " location / {" - f.puts " proxy_pass http://dokku-installer;" - f.puts " }" - f.puts "}" - end - `rm /etc/nginx/sites-enabled/*` - puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot." - exit + File.open("/etc/init/dokku-installer.conf", "w") do |f| + f.puts "start on runlevel [2345]" + f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct" + end + File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f| + f.puts "upstream dokku-installer { server 127.0.0.1:2000; }" + f.puts "server {" + f.puts " listen 80;" + f.puts " location / {" + f.puts " proxy_pass http://dokku-installer;" + f.puts " }" + f.puts "}" + end + `rm /etc/nginx/sites-enabled/*` + puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot." + exit end -version = "v0.2.1" -dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" -admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first -hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip -template = DATA.read +version = "v0.3.1" +dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" +admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first +hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip +template = DATA.read set :port, 2000 set :environment, :production disable :protection get "/" do - ERB.new(template).result binding + ERB.new(template).result binding end post "/setup" do - if params[:vhost] == "true" - File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] } - else - `rm #{dokku_root}/VHOST` - end - File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] } - Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key]) - Thread.new { - `rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start` - `rm /etc/init/dokku-installer.conf && stop dokku-installer` - }.run if ARGV[0] == "selfdestruct" + if params[:vhost] == "true" + File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] } + else + `rm #{dokku_root}/VHOST` + end + File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] } + Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key]) + Thread.new { + `rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start` + `rm /etc/init/dokku-installer.conf && stop dokku-installer` + }.run if ARGV[0] == "selfdestruct" end __END__
-