Merge pull request #2 from progrium/master

merge from upstream
This commit is contained in:
Michael Hobbs
2014-11-22 10:25:33 -08:00
43 changed files with 605 additions and 297 deletions

6
.editorconfig Normal file
View File

@@ -0,0 +1,6 @@
root = true
[*]
insert_final_newline = true
indent_style = space
indent_size = 2

View File

@@ -1,8 +1,58 @@
# History # 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) ## 0.2.0 (2013-11-24)

View File

@@ -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 PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz
DOKKU_ROOT ?= /home/dokku 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: all:
# Type "make install" to install. # Type "make install" to install.
install: dependencies stack copyfiles plugins version install: dependencies stack copyfiles plugin-dependencies plugins version
copyfiles: addman copyfiles: addman
cp dokku /usr/local/bin/dokku cp dokku /usr/local/bin/dokku
mkdir -p /var/lib/dokku/plugins 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: addman:
mkdir -p /usr/local/share/man/man1 mkdir -p /usr/local/share/man/man1
@@ -26,6 +39,9 @@ addman:
version: version:
git describe --tags > ${DOKKU_ROOT}/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ${DOKKU_ROOT}/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 plugins: pluginhook docker
dokku plugins-install dokku plugins-install
@@ -41,26 +57,28 @@ pluginhook:
dpkg -i /tmp/pluginhook_0.1.0_amd64.deb dpkg -i /tmp/pluginhook_0.1.0_amd64.deb
docker: aufs docker: aufs
apt-get install -qq -y curl
egrep -i "^docker" /etc/group || groupadd docker egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku 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 echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-get update apt-get update
ifdef DOCKER_VERSION ifdef DOCKER_VERSION
apt-get install -y lxc-docker-${DOCKER_VERSION} apt-get install -qq -y lxc-docker-${DOCKER_VERSION}
else else
apt-get install -y lxc-docker apt-get install -qq -y lxc-docker
endif endif
sleep 2 # give docker a moment i guess sleep 2 # give docker a moment i guess
aufs: 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: stack:
@echo "Start building buildstep"
ifdef BUILD_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) @docker images | grep progrium/buildstep || (git clone ${STACK_URL} /tmp/buildstep && docker build -t progrium/buildstep /tmp/buildstep && rm -rf /tmp/buildstep)
else 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 endif
count: count:
@@ -70,3 +88,19 @@ count:
@find plugins -type f | xargs cat | wc -l @find plugins -type f | xargs cat | wc -l
@echo "Test lines:" @echo "Test lines:"
@find tests -type f | xargs cat | wc -l @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)'"

View File

@@ -1,16 +1,16 @@
# Dokku [![Build Status](https://travis-ci.org/progrium/dokku.png?branch=master)](https://travis-ci.org/progrium/dokku) # Dokku [![Build Status](https://travis-ci.org/progrium/dokku.png?branch=master)](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 ## Requirements
- A fresh VM running either Ubuntu `14.04 x64` or `12.04 x64` - A fresh VM running Ubuntu `14.04 x64`
## Installing ## Installing
To install the latest stable version of dokku, you can run the following bootstrapper command: 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 ## 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) 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 ## License
MIT MIT

1
SPONSORS Normal file
View File

@@ -0,0 +1 @@
Deis http://deis.io

3
Vagrantfile vendored
View File

@@ -29,5 +29,6 @@ Vagrant::configure("2") do |config|
vb.customize ["modifyvm", :id, "--memory", BOX_MEMORY] vb.customize ["modifyvm", :id, "--memory", BOX_MEMORY]
end 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 end

10
bootstrap.sh Normal file → Executable file
View File

@@ -1,18 +1,22 @@
#!/usr/bin/env bash #!/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 set -eo pipefail
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"} 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 then
echo "This installation script requires apt-get. For manual installation instructions, consult https://github.com/progrium/dokku ." echo "This installation script requires apt-get. For manual installation instructions, consult https://github.com/progrium/dokku ."
exit 1 exit 1
fi fi
apt-get update 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 ~ && test -d dokku || git clone $DOKKU_REPO
cd dokku cd dokku

View File

@@ -3,120 +3,120 @@ require "sinatra"
require "open3" require "open3"
if ARGV[0] == "onboot" if ARGV[0] == "onboot"
File.open("/etc/init/dokku-installer.conf", "w") do |f| File.open("/etc/init/dokku-installer.conf", "w") do |f|
f.puts "start on runlevel [2345]" f.puts "start on runlevel [2345]"
f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct" f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct"
end end
File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f| 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 "upstream dokku-installer { server 127.0.0.1:2000; }"
f.puts "server {" f.puts "server {"
f.puts " listen 80;" f.puts " listen 80;"
f.puts " location / {" f.puts " location / {"
f.puts " proxy_pass http://dokku-installer;" f.puts " proxy_pass http://dokku-installer;"
f.puts " }" f.puts " }"
f.puts "}" f.puts "}"
end end
`rm /etc/nginx/sites-enabled/*` `rm /etc/nginx/sites-enabled/*`
puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot." puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot."
exit exit
end end
version = "v0.2.1" version = "v0.3.1"
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip
template = DATA.read template = DATA.read
set :port, 2000 set :port, 2000
set :environment, :production set :environment, :production
disable :protection disable :protection
get "/" do get "/" do
ERB.new(template).result binding ERB.new(template).result binding
end end
post "/setup" do post "/setup" do
if params[:vhost] == "true" if params[:vhost] == "true"
File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] } File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] }
else else
`rm #{dokku_root}/VHOST` `rm #{dokku_root}/VHOST`
end end
File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] } File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] }
Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key]) Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key])
Thread.new { Thread.new {
`rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start` `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` `rm /etc/init/dokku-installer.conf && stop dokku-installer`
}.run if ARGV[0] == "selfdestruct" }.run if ARGV[0] == "selfdestruct"
end end
__END__ __END__
<html> <html>
<head> <head>
<title>Dokku Setup</title> <title>Dokku Setup</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" /> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head> </head>
<body> <body>
<div class="container" style="width: 640px;"> <div class="container" style="width: 640px;">
<form id="form" role="form"> <form id="form" role="form">
<h1>Dokku Setup <small><%= version %></small></h1> <h1>Dokku Setup <small><%= version %></small></h1>
<div class="form-group"> <div class="form-group">
<h3><small style="text-transform: uppercase;">Admin Access</small></h3> <h3><small style="text-transform: uppercase;">Admin Access</small></h3>
<label for="key">Public Key</label><br /> <label for="key">Public Key</label><br />
<textarea class="form-control" name="key" rows="7" id="key"><%= admin_key %></textarea> <textarea class="form-control" name="key" rows="7" id="key"><%= admin_key %></textarea>
</div> </div>
<div class="form-group"> <div class="form-group">
<h3><small style="text-transform: uppercase;">Hostname Configuration</small></h3> <h3><small style="text-transform: uppercase;">Hostname Configuration</small></h3>
<div class="form-group"> <div class="form-group">
<label for="hostname">Hostname</label> <label for="hostname">Hostname</label>
<input class="form-control" type="text" id="hostname" name="hostname" value="<%= hostname %>" /> <input class="form-control" type="text" id="hostname" name="hostname" value="<%= hostname %>" />
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label><input id="vhost" name="vhost" type="checkbox" value="true"> Use <abbr title="Nginx will be run on port 80 and backend to your apps based on hostname">virtualhost naming</abbr> for apps</label> <label><input id="vhost" name="vhost" type="checkbox" value="true"> Use <abbr title="Nginx will be run on port 80 and backend to your apps based on hostname">virtualhost naming</abbr> for apps</label>
</div> </div>
<p>Your app URLs will look like:</p> <p>Your app URLs will look like:</p>
<pre id="example">http://hostname:port</pre> <pre id="example">http://hostname:port</pre>
</div> </div>
<button type="button" onclick="setup()" class="btn btn-primary">Finish Setup</button> <span style="padding-left: 20px;" id="result"></span> <button type="button" onclick="setup()" class="btn btn-primary">Finish Setup</button> <span style="padding-left: 20px;" id="result"></span>
</form> </form>
</div> </div>
<div id="error-output"></div> <div id="error-output"></div>
<script> <script>
function setup() { function setup() {
if ($.trim($("#key").val()) == "") { if ($.trim($("#key").val()) == "") {
alert("Your admin public key cannot be blank.") alert("Your admin public key cannot be blank.")
return return
} }
if ($.trim($("#hostname").val()) == "") { if ($.trim($("#hostname").val()) == "") {
alert("Your hostname cannot be blank.") alert("Your hostname cannot be blank.")
return return
} }
data = $("#form").serialize() data = $("#form").serialize()
$("input,textarea,button").prop("disabled", true); $("input,textarea,button").prop("disabled", true);
$.post('/setup', data) $.post('/setup', data)
.done(function() { .done(function() {
$("#result").html("Success!") $("#result").html("Success!")
window.location.href = "https://github.com/progrium/dokku#deploy-an-app"; window.location.href = "http://progrium.viewdocs.io/dokku/application-deployment";
}) })
.fail(function(data) { .fail(function(data) {
$("#result").html("Something went wrong...") $("#result").html("Something went wrong...")
$("#error-output").html(data.responseText) $("#error-output").html(data.responseText)
}); });
} }
function update() { function update() {
if ($("#vhost").is(":checked") && $("#hostname").val().match(/^(\d{1,3}\.){3}\d{1,3}$/)) { if ($("#vhost").is(":checked") && $("#hostname").val().match(/^(\d{1,3}\.){3}\d{1,3}$/)) {
alert("In order to use virtualhost naming, the hostname must not be an IP but a valid domain name.") alert("In order to use virtualhost naming, the hostname must not be an IP but a valid domain name.")
$("#vhost").prop('checked', false); $("#vhost").prop('checked', false);
} }
if ($("#vhost").is(':checked')) { if ($("#vhost").is(':checked')) {
$("#example").html("http://&lt;app-name&gt;."+$("#hostname").val()) $("#example").html("http://&lt;app-name&gt;."+$("#hostname").val())
} else { } else {
$("#example").html("http://"+$("#hostname").val()+":&lt;app-port&gt;") $("#example").html("http://"+$("#hostname").val()+":&lt;app-port&gt;")
} }
} }
$("#vhost").change(update); $("#vhost").change(update);
$("#hostname").change(update); $("#hostname").change(update);
update(); update();
</script> </script>
</body> </body>
</html> </html>

View File

@@ -11,3 +11,4 @@ config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] - set one or more config vars
config:unset <app> KEY1 [KEY2 ...] - unset one or more config vars config:unset <app> KEY1 [KEY2 ...] - unset one or more config vars
``` ```
The variables are by default available only at run time, i.e. not when the application is being built/compiled. However there are [plugins](http://progrium.viewdocs.io/dokku/plugins) that can change that.

View File

@@ -17,6 +17,10 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
## Things this project won't do ## Things this project won't do
* **Multi-host.** Not a huge leap, but this isn't the project for it. Have a look at [Flynn](https://flynn.io/). * **Multi-host.** Not a huge leap, but this isn't the project for it. Have a look at [Deis](http://deis.io/).
* **Multitenancy.** It's ready for it, but again, have a look at [Flynn](https://flynn.io/). * **Multitenancy.** It's ready for it, but again, have a look at [Deis](http://deis.io/).
* **Client app.** Given the constraints, running commands remotely via SSH is fine. * **Client app.** Given the constraints, running commands remotely via SSH is fine.
## Sponsors
Though we love everybody doing open source, we especially love [Deis](http://deis.io/) for sponsoring Dokku.

View File

@@ -2,18 +2,16 @@
## Requirements ## Requirements
- A fresh VM running either Ubuntu `14.04 x64` or `12.04 x64` - A fresh VM running Ubuntu `14.04 x64`
Ubuntu 14.04 x64 or 12.04 x64. Ideally have a domain ready to point to your host. It's designed for and is probably best to use a fresh VM. The bootstrapper will install everything it needs. Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's designed for and is probably best to use a fresh VM. The bootstrapper will install everything it needs.
**Note: Support for 12.04 will be sunsetting in the near future after dokku & 14.04 have been more thoroughly tested.**
## Installing the latest Stable version ## Installing the latest Stable version
To install the latest stable version of dokku, you can run the following bootstrapper command: To install the latest stable version of dokku, you can run the following bootstrapper command:
```bash ```bash
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
``` ```
## Configuring ## Configuring
@@ -55,7 +53,7 @@ environment variables may be set to override the defaults (see the `Makefile` fo
apply). Example: apply). Example:
```bash ```bash
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/gitreceive make install sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
``` ```
### Bootstrap a server from your own repository ### Bootstrap a server from your own repository
@@ -71,7 +69,7 @@ sudo DOKKU_REPO=https://github.com/yourusername/dokku.git ./bootstrap.sh
### Custom buildstep build ### Custom buildstep build
Dokku ships with a pre-built version of version of the [buildstep](https://github.com/progrium/buildstep) component by Dokku ships with a pre-built 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 default. If you want to build your own version you can specify that with an env
variable. variable.
@@ -85,10 +83,10 @@ sudo BUILD_STACK=true make install
- Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) - Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
- Download and install [Vagrant](http://www.vagrantup.com/downloads.html) - 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 https://github.com/progrium/dokku.git
``` ```
- Setup SSH hosts in your `/etc/hosts` - Setup SSH hosts in your `/etc/hosts`
@@ -115,11 +113,7 @@ sudo BUILD_STACK=true make install
vagrant up vagrant up
``` ```
- Add SSH key to Dokku using `sshcommand acl-add <user> <ssh-key-name>`, e.g.: - Copy your SSH key via `cat ~/.ssh/id_rsa.pub | pbcopy` and paste it into the dokku-installer at http://dokku.me . Change the `Hostname` field on the Dokku Setup screen to your domain and then check the box that says `Use virtualhost naming`. Then click *Finish Setup* to install your key. You'll be directed to application deployment instructions from here.
```
cat ~/.ssh/id_rsa.pub | ssh -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo sshcommand acl-add dokku progrium"
```
You are now ready to deploy an app or install plugins. You are now ready to deploy an app or install plugins.

View File

@@ -26,7 +26,7 @@ If you create your own plugin:
1. take a look at the plugins shipped with dokku and hack away! 1. take a look at the plugins shipped with dokku and hack away!
2. upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`) 2. upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
3. edit this page and add a link to it below! 3. edit this page and add a link to it below!
4. subscribe to the [dokku development blog](http://progrium.com/dokku/) to be notified about API changes and releases 4. subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
## Community plugins ## Community plugins
@@ -71,6 +71,7 @@ Note: The following plugins have been supplied by our community and may not have
[cameron-martin]: https://github.com/cameron-martin [cameron-martin]: https://github.com/cameron-martin
[matto1990]: https://github.com/matto1990 [matto1990]: https://github.com/matto1990
[ohardy]: https://github.com/ohardy [ohardy]: https://github.com/ohardy
[agco-adm]: https://github.com/agco-adm
### Datastores ### Datastores
@@ -128,6 +129,7 @@ Note: The following plugins have been supplied by our community and may not have
| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | Compatible with 0.2.0 | | [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | Compatible with 0.2.0 |
| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>1</sup> | [musicglue][] | Compatible with dokku master branch | | [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>1</sup> | [musicglue][] | Compatible with dokku master branch |
| [user-env-compile](https://github.com/motin/dokku-user-env-compile)<sup>1</sup> | [motin][] | Compatible with 0.2.1 | | [user-env-compile](https://github.com/motin/dokku-user-env-compile)<sup>1</sup> | [motin][] | Compatible with 0.2.1 |
| [registry](https://github.com/agco-adm/dokku-registry)<sup>5</sup> | [agco-adm](https://github.com/agco-adm) | |
| [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)<sup>2</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master | | [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)<sup>2</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master |
| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)<sup>3</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master | | [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)<sup>3</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master |
| [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | Requires dokku >= [c77cbf1][] | | [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | Requires dokku >= [c77cbf1][] |
@@ -139,11 +141,12 @@ Note: The following plugins have been supplied by our community and may not have
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | | | [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | |
| [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | | | [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | |
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | | | [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | |
| [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) | [motin][] | Requires https://github.com/progrium/dokku/pull/579 | | [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) | [motin][] | Compatible with 0.3.1+ |
| [Multiple domains and per-app custom nginx.conf](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | Works with v0.2.3 | | [Multiple domains and per-app custom nginx.conf](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | Works with v0.2.3 |
| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)| [cameron-martin][] | Works with v0.2.3 | | [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)| [cameron-martin][] | Works with v0.2.3 |
| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 | | [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 |
| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh](https://github.com/mikecsh) | Works with 0.2.0 | | [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh](https://github.com/mikecsh) | Works with 0.2.0 |
| [dokku-registry](https://github.com/agco-adm/dokku-registry) | [agco-adm][] | |
[8fca220]: https://github.com/progrium/dokku/commit/8fca2204edb0017796d6915ca9157c05b1238e28 [8fca220]: https://github.com/progrium/dokku/commit/8fca2204edb0017796d6915ca9157c05b1238e28
[217d00a]: https://github.com/progrium/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7 [217d00a]: https://github.com/progrium/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7
@@ -158,6 +161,8 @@ Note: The following plugins have been supplied by our community and may not have
<sup>4</sup> Conflicts with [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) <sup>4</sup> Conflicts with [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration)
<sup>5</sup> On Heroku similar functionality is offered by the [heroku-labs pipeline feature](https://devcenter.heroku.com/articles/labs-pipelines), which allows you to promote builds across multiple environments (staging -> production)
### Other Add-ons ### Other Add-ons
| Plugin | Author | Compatibility | | Plugin | Author | Compatibility |

98
docs/template.html Normal file
View File

@@ -0,0 +1,98 @@
<!doctype html>
<head>
<meta charset="utf-8">
<title>{{NAME}} :: viewdocs.io</title>
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:300,600' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://static.gist.io/css/screen.css">
<style type="text/css">
body {
background: #f0f3f3;
font: 500 16px proxima-nova-1, proxima-nova-2, 'Proxima Nova', 'Montserrat', HelveticaNeue, Helvetica, Arial, sans-serif;
}
article pre {
background-color: #fff;
border-radius: 2px;
box-shadow: 0 0 10px rgba(0,0,0,.1);
color: #222;
font-family: 'Source Code Pro', Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
font-size: 14px;
overflow: auto;
padding: 10px;
width: 100%;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
}
article p code {
background-color: #fff;
border-radius: 2px;
box-shadow: 0 0 10px rgba(0,0,0,.1);
color: #333;
font-family: 'Source Code Pro', Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
font-size: 14px;
padding: 0 4px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
}
article .highlight {
padding: 0;
}
article h1 {
font-size: 2em;
font-weight: bold;
}
article h2 {
font-size: 1.5em;
font-weight: bold;
}
article h3 {
font-size: 1em;
text-transform: uppercase;
font-weight: bold;
}
article ul, article ol {
list-style-position: outside;
padding-left: 20px;
}
tr, td {
text-align: center;
}
#gistbody h1:first-child {
border-bottom: 1px solid #dadada;
display: block;
color: #000;
font-weight: 700;
font-size: 20px;
line-height: 1;
margin: 0 0 24px 0;
padding-bottom: 31px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.content {
font-size: 1em;
}
</style>
</head>
<body>
<section class="content">
<header>
<h1 id="gistid"><a href="http://github.com/{{USER}}/{{NAME}}">{{NAME}}</a> :: <a href="/{{NAME}}">index</a></h1>
</header>
<article id="gistbody" class="instapaper_body entry-content">
{{CONTENT}}
</article>
</section>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-6824126-17', 'viewdocs.io');
ga('send', 'pageview');
</script>
<script src="//static.getclicky.com/js" type="text/javascript"></script>
<script type="text/javascript">try{ clicky.init(100672863); }catch(e){}</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/100672863ns.gif" /></p></noscript>
</body>
</html>

37
dokku
View File

@@ -7,11 +7,17 @@ export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
[[ $DOKKU_TRACE ]] && set -x [[ $DOKKU_TRACE ]] && set -x
if [[ $(id -un) != "dokku" && $1 != "plugins-install" ]]; then if [[ $(id -un) != "dokku" && $1 != plugins-install* ]]; then
sudo -u dokku -H $0 "$@" sudo -u dokku -H $0 "$@"
exit exit
fi fi
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
export -n SSH_ORIGINAL_COMMAND
$0 $SSH_ORIGINAL_COMMAND
exit $?
fi
case "$1" in case "$1" in
receive) receive)
APP="$2"; IMAGE="dokku/$APP" APP="$2"; IMAGE="dokku/$APP"
@@ -64,7 +70,7 @@ case "$1" in
# start the app # start the app
DOCKER_ARGS=$(: | pluginhook docker-args $APP) DOCKER_ARGS=$(: | pluginhook docker-args $APP)
id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE /bin/bash -c "/start web") id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE /bin/bash -c "/start web")
port=$(docker port $id 5000 | sed 's/0.0.0.0://') port=$(docker port $id 5000 | sed 's/[0-9.]*://')
# if we can't post-deploy successfully, kill new container # if we can't post-deploy successfully, kill new container
function kill_new { function kill_new {
@@ -77,15 +83,16 @@ case "$1" in
trap kill_new INT TERM EXIT trap kill_new INT TERM EXIT
echo "-----> Running pre-flight checks" echo "-----> Running pre-flight checks"
pluginhook check-deploy $id $APP $port pluginhook check-deploy $id $APP $port
echo "-----> Running post-deploy"
pluginhook post-deploy $APP $port
trap - INT TERM EXIT
# now using the new container # now using the new container
echo $id > "$DOKKU_ROOT/$APP/CONTAINER" echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
echo $port > "$DOKKU_ROOT/$APP/PORT" echo $port > "$DOKKU_ROOT/$APP/PORT"
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL" echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
echo "-----> Running post-deploy"
pluginhook post-deploy $APP $port
trap - INT TERM EXIT
# kill the old container # kill the old container
if [[ -n "$oldid" ]]; then if [[ -n "$oldid" ]]; then
# Let the old container finish processing requests, before terminating it # Let the old container finish processing requests, before terminating it
@@ -106,9 +113,9 @@ case "$1" in
cleanup) cleanup)
# delete all non-running container # delete all non-running container
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm &> /dev/null & docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm &> /dev/null &
# delete unused images # delete unused images
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi &> /dev/null & docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi &> /dev/null &
;; ;;
plugins) plugins)
@@ -119,24 +126,28 @@ case "$1" in
pluginhook install pluginhook install
;; ;;
plugins-install-dependencies)
pluginhook dependencies
;;
# temporary hack for https://github.com/progrium/dokku/issues/82 # temporary hack for https://github.com/progrium/dokku/issues/82
deploy:all) deploy:all)
for app in $(ls -d $DOKKU_ROOT/*/); do for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
APP=$(basename $app); APP=$(basename $(dirname $app));
dokku deploy $APP dokku deploy $APP
done done
;; ;;
help|'') help|'')
cat<<EOF | pluginhook commands help | sort cat<<EOF | pluginhook commands help | sort
help Print the list of commands help Print the list of commands
plugins Print active plugins plugins Print active plugins
plugins-install Install active plugins plugins-install Install active plugins
EOF EOF
;; ;;
*) *)
for script in $(ls -d /var/lib/dokku/plugins/*/commands); do for script in $(ls -d $PLUGIN_PATH/*/commands); do
$script "$@" $script "$@"
done done
;; ;;

View File

@@ -1,4 +1,4 @@
.TH DOKKU 1 2014-03-08 .TH DOKKU 1 2014-05-10
.\"Make sure to change that date when you commit a change! .\"Make sure to change that date when you commit a change!
.\" .\"
.SH NAME .SH NAME
@@ -56,3 +56,9 @@ Show the url for an app.
.TP .TP
.B version .B version
Print dokku's version. Print dokku's version.
.\"
.SH NOTES
This man page does not include commands added
by non-default plugins. To see the full list
of commands available to your current dokku
installation, run \fBdokku help\fR.

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
VERSION="$1" VERSION="$1"
IMPORT_DIR="$2" IMPORT_DIR="$2"
TARGET_DIR="$3" TARGET_DIR="$3"
@@ -15,4 +16,3 @@ for app in $APPS; do
done done
exit $ret exit $ret

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
VERSION="$1" VERSION="$1"
BASE_DIR="$2" BASE_DIR="$2"

View File

@@ -1,15 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
VERSION="$1" VERSION="$1"
IMPORT_DIR="$2" IMPORT_DIR="$2"
TARGET_DIR="$3" TARGET_DIR="$3"
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand [[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
mkdir -p $TARGET_DIR/.ssh mkdir -p $TARGET_DIR/.ssh
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
chmod 0700 $TARGET_DIR/.ssh chmod 0700 $TARGET_DIR/.ssh
chmod 0600 $TARGET_DIR/.ssh/* chmod 0600 $TARGET_DIR/.ssh/*
fi fi
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME [[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME
[[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST [[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST

View File

@@ -1,28 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in case "$1" in
delete) delete)
if [[ -z $2 ]]; then dokku apps:destroy $2
echo "Please specify an app to delete"
exit 1
fi
APP="$2"; IMAGE="dokku/$APP";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App does not exist"
exit 1
fi
pluginhook pre-delete $APP
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker stop $ID > /dev/null || true
docker rm $ID > /dev/null || true
fi
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
pluginhook post-delete $APP
;; ;;
logs) logs)
@@ -50,13 +31,13 @@ case "$1" in
run) run)
if [[ -z $2 ]]; then if [[ -z $2 ]]; then
echo "Please specify an app to run the command on" echo "Please specify an app to run the command on"
exit 1 exit 1
fi fi
APP="$2"; IMAGE="dokku/$APP" APP="$2"; IMAGE="dokku/$APP"
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist" echo "App $APP does not exist"
exit 1 exit 1
fi fi
shift 2 shift 2
@@ -67,8 +48,8 @@ case "$1" in
url) url)
APP="$2"; APP="$2";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist" echo "App $APP does not exist"
exit 1 exit 1
fi fi
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
@@ -85,7 +66,6 @@ case "$1" in
help) help)
cat && cat<<EOF cat && cat<<EOF
delete <app> Delete an application
logs <app> [-t] Show the last logs for an application (-t follows) logs <app> [-t] Show the last logs for an application (-t follows)
run <app> <cmd> Run a command in the environment of an application run <app> <cmd> Run a command in the environment of an application
url <app> Show the URL for an application url <app> Show the URL for an application
@@ -94,4 +74,3 @@ EOF
;; ;;
esac esac

View File

@@ -2,7 +2,7 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
fi fi
# temporary hack for https://github.com/progrium/dokku/issues/82 # temporary hack for https://github.com/progrium/dokku/issues/82

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"
IMAGE=dokku/"$1"
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
docker run -v $CACHE_DIR:/cache $IMAGE find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \;

75
plugins/apps/commands Executable file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
apps)
echo "=== My Apps"
find $DOKKU_ROOT -maxdepth 1 -type d \( ! -iname ".*" \) -not -path $DOKKU_ROOT/tls | sed 's|^\./||g' | sed 's|'$DOKKU_ROOT'\/||' | tail -n +2 | sort
;;
apps:create)
if [[ -z $2 ]]; then
echo "Please specify an app to create"
exit 1
fi
APP="$2"
if [[ -d "$DOKKU_ROOT/$APP" ]]; then
echo " ! Name is already taken"
exit 1
fi
mkdir -p "$DOKKU_ROOT/$APP"
echo "Creating $APP... done"
;;
apps:destroy)
if [[ -z $2 ]]; then
echo "Please specify an app to delete"
exit 1
fi
APP="$2"; IMAGE="dokku/$APP";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
if [[ "$APP" == "tls" ]]; then
echo "Unable to destroy tls directory"
exit 1
fi
echo " ! WARNING: Potentially Destructive Action"
echo " ! This command will destroy $APP (including all add-ons)."
echo " ! To proceed, type \"$APP\""
echo ""
read -p "> " app_name
if [[ "$app_name" != "$APP" ]]; then
echo " ! Confirmation did not match $APP. Aborted."
exit 1
fi
echo "Destroying $APP (including all add-ons)"
pluginhook pre-delete $APP
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker stop $ID > /dev/null || true
docker rm $ID > /dev/null || true
fi
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
pluginhook post-delete $APP
;;
help)
cat && cat<<EOF
apps List your apps
apps:create <app> Create a new app
apps:destroy <app> Permanently destroy an app
EOF
;;
esac

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
[[ -n $1 ]] && rm -r "$DOKKU_ROOT/$1" > /dev/null [[ -n $1 ]] && rm -r "$DOKKU_ROOT/$1" > /dev/null

7
plugins/apps/pre-delete Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
if [[ -d $CACHE_DIR ]]; then
docker run -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \;
fi

View File

@@ -1,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
CURRENT_BACKUP_VERSION=1 CURRENT_BACKUP_VERSION=1
set -e; case "$1" in
case "$1" in
backup:export) backup:export)
OUTPUT_FILE="$2" OUTPUT_FILE="$2"
BACKUP_DIR="$DOKKU_ROOT" BACKUP_DIR="$DOKKU_ROOT"
@@ -24,9 +26,9 @@ set -e; case "$1" in
# if no file specified, output to stdout # if no file specified, output to stdout
if [[ -z $OUTPUT_FILE ]]; then if [[ -z $OUTPUT_FILE ]]; then
cat $BACKUP_TMP_FILE cat $BACKUP_TMP_FILE
else else
mv $BACKUP_TMP_FILE $OUTPUT_FILE mv $BACKUP_TMP_FILE $OUTPUT_FILE
fi fi
rm -rf $BACKUP_TMP_DIR rm -rf $BACKUP_TMP_DIR
@@ -48,14 +50,14 @@ set -e; case "$1" in
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
echo "Unable to determine backup version" echo "Unable to determine backup version"
exit 1 exit 1
fi fi
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version) VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
if [[ $VERSION -ne 1 ]]; then if [[ $VERSION -ne 1 ]]; then
echo "Unknown format version $VERSION" echo "Unknown format version $VERSION"
exit 1 exit 1
fi fi
echo "Importing a version $VERSION backup..." echo "Importing a version $VERSION backup..."
@@ -91,4 +93,3 @@ EOF
;; ;;
esac esac

View File

@@ -14,6 +14,7 @@
# in seconds). # in seconds).
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}" CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
# source in app env to get DOKKU_CHECKS_WAIT and any other necessary vars # source in app env to get DOKKU_CHECKS_WAIT and any other necessary vars
@@ -27,23 +28,23 @@ WAIT="${DOKKU_CHECKS_WAIT:-5}"
# after successfully copying the file. Thus, we suppress stderr. # after successfully copying the file. Thus, we suppress stderr.
# ref: https://github.com/dotcloud/docker/issues/3986 # ref: https://github.com/dotcloud/docker/issues/3986
if [[ ! -f "$FILENAME" ]] ; then if [[ ! -f "$FILENAME" ]] ; then
echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..." echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..."
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX) TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
echo " CHECKS file not found in container. skipping checks." echo " CHECKS file not found in container. skipping checks."
rm -rf $TMPDIR rm -rf $TMPDIR
exit 0 exit 0
else else
echo " CHECKS file found in container" echo " CHECKS file found in container"
FILENAME=${TMPDIR}/CHECKS FILENAME=${TMPDIR}/CHECKS
function cleanup() { function cleanup() {
echo " removing CHECKS file copied from container" echo " removing CHECKS file copied from container"
rm -rf $TMPDIR rm -rf $TMPDIR
} }
trap cleanup EXIT trap cleanup EXIT
fi fi
fi fi
echo "Waiting $WAIT seconds ..." echo "Waiting $WAIT seconds ..."

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob shopt -s nullglob
VERSION="$1" VERSION="$1"
BASE_DIR="$2" BASE_DIR="$2"

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob shopt -s nullglob
VERSION="$1" VERSION="$1"
IMPORT_DIR="$2" IMPORT_DIR="$2"
@@ -7,5 +8,5 @@ TARGET_DIR="$3"
cd $IMPORT_DIR cd $IMPORT_DIR
for file in */ENV; do for file in */ENV; do
cp $file "$TARGET_DIR/$file" cp $file "$TARGET_DIR/$file"
done done

View File

@@ -9,6 +9,7 @@ if [[ $1 == config ]] || [[ $1 == config:* ]]; then
else else
APP="$2" APP="$2"
ENV_FILE="$DOKKU_ROOT/$APP/ENV" ENV_FILE="$DOKKU_ROOT/$APP/ENV"
ENV_FILE_TEMP="$DOKKU_ROOT/$APP/ENV.tmp"
# Check if app exists with the same name # Check if app exists with the same name
if [ ! -d "$DOKKU_ROOT/$APP" ]; then if [ ! -d "$DOKKU_ROOT/$APP" ]; then
@@ -24,19 +25,20 @@ if [[ $1 == config ]] || [[ $1 == config:* ]]; then
fi fi
config_styled_hash () { config_styled_hash () {
vars=`echo -e "$1"` vars="$1"
prefix="$2"
longest="" longest=""
for word in $vars; do while read -r word; do
KEY=`echo $word | cut -d"=" -f1` KEY=`echo $word | cut -d"=" -f1`
if [ ${#KEY} -gt ${#longest} ]; then if [ ${#KEY} -gt ${#longest} ]; then
longest=$KEY longest=$KEY
fi fi
done done <<< "$vars"
for word in $vars; do while read -r word; do
KEY=`echo $word | cut -d"=" -f1` KEY=`echo $word | cut -d"=" -f1`
VALUE=`echo $word | cut -d"=" -f2-` VALUE=`echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"`
num_zeros=$((${#longest} - ${#KEY})) num_zeros=$((${#longest} - ${#KEY}))
zeros=" " zeros=" "
@@ -44,23 +46,35 @@ config_styled_hash () {
zeros="$zeros " zeros="$zeros "
num_zeros=$(($num_zeros - 1)) num_zeros=$(($num_zeros - 1))
done done
echo "$KEY:$zeros$VALUE" echo "$prefix$KEY:$zeros$VALUE"
done done <<< "$vars"
} }
config_restart_app() { config_restart_app() {
APP="$1"; APP="$1";
echo "-----> Releasing $APP ..." if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
dokku release $APP echo "-----> Releasing $APP ..."
echo "-----> Release complete!" dokku release $APP
echo "-----> Deploying $APP ..." echo "-----> Release complete!"
dokku deploy $APP echo "-----> Deploying $APP ..."
echo "-----> Deploy complete!" dokku deploy $APP
echo "-----> Deploy complete!"
fi
}
config_write() {
ENV_TEMP="$1"
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
cp -f $ENV_FILE_TEMP $ENV_FILE
chmod 600 $ENV_FILE
config_restart_app $APP
fi
rm -f $ENV_FILE_TEMP
} }
case "$1" in case "$1" in
config) config)
APP="$2" APP="$2"
@@ -69,7 +83,7 @@ case "$1" in
exit 1 exit 1
fi fi
VARS=`cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | cut -d" " -f2` VARS=`cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | cut -d" " -f2-`
for var in "$@"; do for var in "$@"; do
if [[ "$var" == "--shell" ]]; then if [[ "$var" == "--shell" ]]; then
@@ -95,7 +109,7 @@ case "$1" in
KEY="$3" KEY="$3"
cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | cut -d" " -f2 | grep "^$KEY=" | cut -d"=" -f2- cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
;; ;;
config:set) config:set)
@@ -108,10 +122,10 @@ case "$1" in
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP" APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
ENV_ADD="" ENV_ADD=""
ENV_TEMP=`cat "${ENV_FILE}"` ENV_TEMP=`cat "${ENV_FILE}"`
RESTART=false RESTART_APP=false
VARS="${*:3}" shift 2
for var in $VARS; do for var; do
if [[ $var != *"="* ]]; then if [[ $var != *"="* ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]" echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Must specify KEY and VALUE to set." echo "Must specify KEY and VALUE to set."
@@ -119,25 +133,26 @@ case "$1" in
fi fi
done done
for var in $VARS; do for var; do
KEY=`echo ${var} | cut -d"=" -f1` KEY=`echo ${var} | cut -d"=" -f1`
VALUE=`echo ${var} | cut -d"=" -f2-` VALUE=`echo ${var} | cut -d"=" -f2-`
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
RESTART_APP=true RESTART_APP=true
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $KEY=/ d") ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $KEY=/ d")
ENV_TEMP="${ENV_TEMP}\nexport ${var}" ENV_TEMP="${ENV_TEMP}\nexport $KEY='$VALUE'"
ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d") ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
ENV_ADD="${ENV_ADD}\n${var}" ENV_ADD="${ENV_ADD}$
${var}"
fi fi
done done
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
if [ $RESTART_APP ]; then if [ $RESTART_APP ]; then
echo "-----> Setting config vars and restarting $APP" echo "-----> Setting config vars and restarting $APP"
config_styled_hash "$ENV_ADD" config_styled_hash "$ENV_ADD" " "
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE config_write "$ENV_TEMP"
config_restart_app $APP
fi fi
;; ;;
@@ -156,19 +171,17 @@ case "$1" in
echo "-----> Unsetting $var and restarting $APP" echo "-----> Unsetting $var and restarting $APP"
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d") ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE config_write "$ENV_TEMP"
config_restart_app $APP
done done
;; ;;
help) help)
cat && cat<<EOF cat && cat<<EOF
config <app> display the config vars for an app config <app> Display the config vars for an app
config:get <app> KEY display a config value for an app config:get <app> KEY Display a config value for an app
config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] set one or more config vars config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars
config:unset <app> KEY1 [KEY2 ...] unset one or more config vars config:unset <app> KEY1 [KEY2 ...] Unset one or more config vars
EOF EOF
;; ;;
esac esac

View File

@@ -1,18 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
VERSION="$1" VERSION="$1"
IMPORT_DIR="$2" IMPORT_DIR="$2"
TARGET_DIR="$3" TARGET_DIR="$3"
APPS="$4" APPS="$4"
while read APP; do while read APP; do
APP_PATH="$TARGET_DIR/$APP"; APP_PATH="$TARGET_DIR/$APP";
git init --bare $APP_PATH > /dev/null git init --bare $APP_PATH > /dev/null
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive" PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
cat > $PRERECEIVE_HOOK <<EOF cat > $PRERECEIVE_HOOK <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash
set -e; set -o pipefail; set -e; set -o pipefail;
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
EOF EOF
chmod +x $PRERECEIVE_HOOK chmod +x $PRERECEIVE_HOOK
done < $APPS > /dev/null done < $APPS > /dev/null

View File

@@ -2,19 +2,19 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
git_archive_all() { git_archive_all() {
APP=$1; REV=$2 APP=$1; REV=$2
TMP_WORK_DIR=$(mktemp -d) TMP_WORK_DIR=$(mktemp -d)
chmod 755 $TMP_WORK_DIR chmod 755 $TMP_WORK_DIR
unset GIT_DIR GIT_WORK_TREE unset GIT_DIR GIT_WORK_TREE
git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR > /dev/null git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
pushd $TMP_WORK_DIR > /dev/null pushd $TMP_WORK_DIR > /dev/null
git config advice.detachedHead false git config advice.detachedHead false
git checkout $REV > /dev/null git checkout $REV &> /dev/null
git submodule update --init --recursive > /dev/null git submodule update --init --recursive &> /dev/null
find -name .git -prune -exec rm -rf {} \; > /dev/null find -name .git -prune -exec rm -rf {} \; > /dev/null
tar c . tar c .
popd > /dev/null popd > /dev/null
rm -rf $TMP_WORK_DIR > /dev/null rm -rf $TMP_WORK_DIR > /dev/null
} }
case "$1" in case "$1" in
@@ -31,7 +31,6 @@ case "$1" in
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master." echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'" echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
fi fi
done done
;; ;;
@@ -40,14 +39,15 @@ case "$1" in
APP_PATH=$DOKKU_ROOT/$APP APP_PATH=$DOKKU_ROOT/$APP
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
git init --bare $APP_PATH > /dev/null git init --bare $APP_PATH > /dev/null
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive" PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
cat > $PRERECEIVE_HOOK <<EOF cat > $PRERECEIVE_HOOK <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash
set -e; set -o pipefail; set -e; set -o pipefail;
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
EOF EOF
chmod +x $PRERECEIVE_HOOK chmod +x $PRERECEIVE_HOOK
fi fi
args=$@ args=$@
@@ -57,5 +57,5 @@ EOF
help) help)
cat cat
;; ;;
esac
esac

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob shopt -s nullglob
VERSION="$1" VERSION="$1"
BASE_DIR="$2" BASE_DIR="$2"
cat; for i in $BASE_DIR/*/ssl/server.*; do echo $i; done cat; for i in $BASE_DIR/*/tls/server.*; do echo $i; done

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob shopt -s nullglob
VERSION="$1" VERSION="$1"
IMPORT_DIR="$2" IMPORT_DIR="$2"
@@ -7,7 +8,7 @@ TARGET_DIR="$3"
cd $IMPORT_DIR cd $IMPORT_DIR
for file in */ssl/server.*; do for file in */tls/server.*; do
mkdir -p $(dirname $TARGET_DIR$file) mkdir -p $(dirname $TARGET_DIR$file)
cp $file $TARGET_DIR$file cp $file $TARGET_DIR$file
done done

View File

@@ -1,9 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help)
cat
;;
esac

View File

@@ -0,0 +1,8 @@
#!/bin/bash
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

View File

@@ -1,11 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x 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
if ! grep -q dokku-nginx-reload "/etc/sudoers"; then if ! grep -q dokku-nginx-reload "/etc/sudoers"; then
touch /etc/sudoers.tmp touch /etc/sudoers.tmp
cp /etc/sudoers /tmp/sudoers.new cp /etc/sudoers /tmp/sudoers.new

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
sudo /etc/init.d/nginx reload > /dev/null sudo /etc/init.d/nginx reload > /dev/null

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; PORT="$2" APP="$1"; PORT="$2"
WILDCARD_SSL="$DOKKU_ROOT/tls" WILDCARD_SSL="$DOKKU_ROOT/tls"
SSL="$DOKKU_ROOT/$APP/tls" SSL="$DOKKU_ROOT/$APP/tls"
@@ -56,6 +57,7 @@ $SSL_DIRECTIVES
proxy_set_header X-Forwarded-Port \$server_port; proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec; proxy_set_header X-Request-Start \$msec;
} }
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
} }
EOF EOF
@@ -79,6 +81,7 @@ server {
proxy_set_header X-Forwarded-Port \$server_port; proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec; proxy_set_header X-Request-Start \$msec;
} }
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
} }
EOF EOF

View File

@@ -1,3 +1,15 @@
#!/bin/bash #!/bin/bash
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "config-test" set -e;
base_url="$1"
test_url / "config-test"
test_url /hello "Hello world"
test_url () {
path="$1"
expected_output="$2"
url="$base_url$path"
output="$(curl -s $url)"
echo $output
test "$output" == "$expected_output"
}

View File

@@ -4,5 +4,5 @@ set -ex;
REMOTE=$1 REMOTE=$1
REPO=$2 REPO=$2
ssh $REMOTE config:set $REPO CONFTEST=config-test ssh $REMOTE config:set $REPO CONFTEST=config-test HELLO=\"Hello world\"

View File

@@ -6,6 +6,10 @@ app.get('/', function(request, response) {
response.send(process.env.CONFTEST); response.send(process.env.CONFTEST);
}); });
app.get('/hello', function(request, response) {
response.send(process.env.HELLO);
});
var port = process.env.PORT || 5000; var port = process.env.PORT || 5000;
app.listen(port, function() { app.listen(port, function() {
console.log("Listening on " + port); console.log("Listening on " + port);

View File

@@ -11,7 +11,7 @@ if [[ $2 == *dokku* ]]; then
cd /tmp/build cd /tmp/build
tar -xf - tar -xf -
echo "-----> Installing dependencies" 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" echo "-----> Set hostname to dokku.me"
hostname dokku.me hostname dokku.me
echo "-----> Enabling tracing" echo "-----> Enabling tracing"

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail set -eo pipefail
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
apt-get install -y git make curl apt-get install -qq -y git make curl
cd /tmp cd /tmp
@@ -24,4 +24,4 @@ EOF
cat<<EOF > /etc/rc.local cat<<EOF > /etc/rc.local
curl https://raw.github.com/progrium/dokku/master/tests/ci/receiver -s > /tmp/receiver curl https://raw.github.com/progrium/dokku/master/tests/ci/receiver -s > /tmp/receiver
chmod +x /tmp/receiver chmod +x /tmp/receiver
EOF EOF