Compare commits
179 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58ca13e838 | ||
|
|
7c2f21fd2a | ||
|
|
887637fb6b | ||
|
|
c706344a94 | ||
|
|
a1bbc1ec4d | ||
|
|
793f1b6058 | ||
|
|
20977fc2a2 | ||
|
|
6cad7ef8f4 | ||
|
|
407436b4cc | ||
|
|
04dbe31919 | ||
|
|
56185fc1c2 | ||
|
|
303bd77226 | ||
|
|
c6e39c08f0 | ||
|
|
12194e2cc8 | ||
|
|
a3b3a6a12a | ||
|
|
c6f80bcf55 | ||
|
|
4d8c7033a9 | ||
|
|
d2547c4233 | ||
|
|
4fa567dbe3 | ||
|
|
463f725872 | ||
|
|
aa1c7f6fa4 | ||
|
|
5f6f73ff22 | ||
|
|
ad497191df | ||
|
|
53c58ec8b9 | ||
|
|
9eab9ed1e1 | ||
|
|
3faa37b2e1 | ||
|
|
fd55e8d41b | ||
|
|
303bc18265 | ||
|
|
2141435ce1 | ||
|
|
03e5248256 | ||
|
|
d307a5b8ec | ||
|
|
1e5a904747 | ||
|
|
a46582225a | ||
|
|
8bc3d372ec | ||
|
|
14b1743c2a | ||
|
|
2d776292c3 | ||
|
|
f0fe32a9c6 | ||
|
|
c4f5b3e219 | ||
|
|
e7219c0346 | ||
|
|
842ae10b74 | ||
|
|
cfc7c41e47 | ||
|
|
c7af391c06 | ||
|
|
4754f241f2 | ||
|
|
fd1678b576 | ||
|
|
7f730d0697 | ||
|
|
69f360864f | ||
|
|
16fd7ebc6b | ||
|
|
19609f7078 | ||
|
|
a24c1bcc92 | ||
|
|
47811f60f4 | ||
|
|
ab01206351 | ||
|
|
fd0bafa7d9 | ||
|
|
ac84ef68cc | ||
|
|
5caf2ab6e3 | ||
|
|
11bff42180 | ||
|
|
bf4876107d | ||
|
|
2ec17a4033 | ||
|
|
d36249f51a | ||
|
|
b011e54dca | ||
|
|
b68a8da2ce | ||
|
|
a421dbf063 | ||
|
|
00a8370b7d | ||
|
|
647b215738 | ||
|
|
3e224cc723 | ||
|
|
26a9e2fbf2 | ||
|
|
580f89e63b | ||
|
|
614a310bbf | ||
|
|
99304ac3d9 | ||
|
|
403843832f | ||
|
|
7d9aa7c492 | ||
|
|
33eca3bf39 | ||
|
|
aefa11db8b | ||
|
|
52774536ca | ||
|
|
0f6ca81afd | ||
|
|
44201a66d9 | ||
|
|
7b361e564f | ||
|
|
f13c1031c7 | ||
|
|
bca8aa3923 | ||
|
|
4b9433052f | ||
|
|
d0ceee5b3b | ||
|
|
913af9b641 | ||
|
|
f03c0c5440 | ||
|
|
96b348e880 | ||
|
|
8a5b954bda | ||
|
|
b766654b4f | ||
|
|
af0005196a | ||
|
|
c3df79f369 | ||
|
|
0f31ff1f24 | ||
|
|
043a1a01c5 | ||
|
|
361011ec69 | ||
|
|
5dbc864060 | ||
|
|
ac5f9a707c | ||
|
|
d4235304ee | ||
|
|
a2d1d8c065 | ||
|
|
190c50b694 | ||
|
|
ad516d6bf5 | ||
|
|
a9ef99fe3d | ||
|
|
592c95eaeb | ||
|
|
179305eea1 | ||
|
|
a9010d8af0 | ||
|
|
a5aab1e637 | ||
|
|
1406a41448 | ||
|
|
9d49cd3f4f | ||
|
|
e771b94b3b | ||
|
|
977d00efb4 | ||
|
|
470755babe | ||
|
|
9f52d02c30 | ||
|
|
1cea737891 | ||
|
|
55e43cccc6 | ||
|
|
a9d5516e04 | ||
|
|
c05488b7c6 | ||
|
|
2b21fa3ed9 | ||
|
|
c092dd1719 | ||
|
|
16095d0d79 | ||
|
|
71a34f6ff1 | ||
|
|
4eecfcb825 | ||
|
|
92ec836341 | ||
|
|
8231926eaa | ||
|
|
c828612480 | ||
|
|
65c499e439 | ||
|
|
3def960bf0 | ||
|
|
b8b364fd91 | ||
|
|
d8d759aea9 | ||
|
|
1663a153a6 | ||
|
|
e94b46cb0c | ||
|
|
10b5ee0321 | ||
|
|
2d737dc554 | ||
|
|
9fb14d9f28 | ||
|
|
44cf7f09f9 | ||
|
|
2f818b81ee | ||
|
|
4cea884f16 | ||
|
|
0e590796c0 | ||
|
|
0ec9ecad08 | ||
|
|
5f5e05bba6 | ||
|
|
59e078440d | ||
|
|
83feec8398 | ||
|
|
2d0271547d | ||
|
|
09df79cd8b | ||
|
|
9c0667c51a | ||
|
|
b9eed22e35 | ||
|
|
42a999e7cd | ||
|
|
48efdb83e7 | ||
|
|
ab44c915a8 | ||
|
|
14145eebb1 | ||
|
|
a67c2c927d | ||
|
|
c5026cafa1 | ||
|
|
a748e123be | ||
|
|
2e5f88b285 | ||
|
|
b848accd56 | ||
|
|
002269a664 | ||
|
|
fae98dabd4 | ||
|
|
e1740cda18 | ||
|
|
ab3e00297c | ||
|
|
42df908c65 | ||
|
|
42c9d7aaa6 | ||
|
|
d9952bcae8 | ||
|
|
a69f63c98c | ||
|
|
db7e36e0ca | ||
|
|
5fcba7e288 | ||
|
|
22beb6c007 | ||
|
|
4e9d797d45 | ||
|
|
07cdab6187 | ||
|
|
939a876348 | ||
|
|
0cd1839ce8 | ||
|
|
22cdc11d57 | ||
|
|
8760c94143 | ||
|
|
1feaeecee3 | ||
|
|
d269782812 | ||
|
|
fde5054e0f | ||
|
|
4f5fc58629 | ||
|
|
00ec004871 | ||
|
|
42fee25f2f | ||
|
|
beca39a55a | ||
|
|
9ac94abcf0 | ||
|
|
969aed87c6 | ||
|
|
2953ed2486 | ||
|
|
2f12a371e0 | ||
|
|
4da4995a18 | ||
|
|
78591a618b |
6
.editorconfig
Normal file
6
.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
88
HISTORY.md
88
HISTORY.md
@@ -1,8 +1,92 @@
|
||||
# History
|
||||
|
||||
## 0.3.0 (in progress)
|
||||
## 0.3.6
|
||||
|
||||
- #782: @josegonzalez Simplified config checking
|
||||
- #785: @lsde fix missing semicolon in nginx config
|
||||
|
||||
## 0.3.5
|
||||
|
||||
- #784: @josegonzalez Fix NO_VHOST check
|
||||
|
||||
## 0.3.4
|
||||
|
||||
- #780: @josegonzalez Output error message when a command is not found. Closes #778
|
||||
- #781: @michaelhobbs use DOKKU_IMAGE (i.e. progrium/buildstep)
|
||||
|
||||
## 0.3.3
|
||||
|
||||
- #659: @Xe contrib: add dokku client shell script
|
||||
- #669 @ohardy Handle dokku plugins-update command
|
||||
- #722: @wrboyce Add `git pull` support with git-pre-pull and git-post-pull hooks
|
||||
- #751: @tboerger Partial openSUSE support
|
||||
- #776: @joliv Update man page for new commands
|
||||
- #777: @tboerger Use PLUGINS_PATH env var and persist environment when running dokku with sudo
|
||||
- #779: @josegonzalez Minor bash formatting changes
|
||||
|
||||
## 0.3.2
|
||||
|
||||
- #675: @michaelhobbs port wait-to-retire from broadly/dokku
|
||||
- #765: @josegonzalez Ignore tls directory when listing apps
|
||||
- #766: @josegonzalez Sort output of apps command
|
||||
- #771: @josegonzalez Doc updates
|
||||
- #518 #772: @nickl- Import ssl certificates
|
||||
- #773: @alex-sherwin Support a way to not create nginx vhost
|
||||
- #774: @josegonzalez Add the ability to customize an app's hostname using nginx-hostname pluginhook
|
||||
|
||||
## 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)
|
||||
|
||||
|
||||
53
Makefile
53
Makefile
@@ -5,18 +5,32 @@ PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_
|
||||
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
|
||||
PLUGINS_PATH ?= /var/lib/dokku/plugins
|
||||
|
||||
.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
|
||||
mkdir -p ${PLUGINS_PATH}
|
||||
find ${PLUGINS_PATH} -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 ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
||||
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
||||
done
|
||||
|
||||
addman:
|
||||
mkdir -p /usr/local/share/man/man1
|
||||
@@ -26,6 +40,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 +58,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 +89,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)'"
|
||||
|
||||
172
README.md
172
README.md
@@ -1,182 +1,28 @@
|
||||
# Dokku
|
||||
# Dokku [](https://travis-ci.org/progrium/dokku)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
|
||||
|
||||
[](https://travis-ci.org/progrium/dokku)
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
|
||||
|
||||
## Requirements
|
||||
|
||||
Assumes Ubuntu 13 or 12.04 x64 right now. 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: There are known issues with docker and Ubuntu 13.10 ([1](https://github.com/dotcloud/docker/issues/1300), [2](https://github.com/dotcloud/docker/issues/1906)) - use of 12.04 is recommended until these issues are resolved.**
|
||||
- A fresh VM running Ubuntu `14.04 x64`
|
||||
|
||||
## Installing
|
||||
|
||||
### Stable
|
||||
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.2/bootstrap.sh | sudo DOKKU_TAG=v0.2.2 bash
|
||||
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.6/bootstrap.sh | sudo DOKKU_TAG=v0.3.6 bash
|
||||
|
||||
**Note**: Users on 12.04 will need to run `apt-get install -y python-software-properties` before bootstrapping stable.
|
||||
## Documentation
|
||||
|
||||
### Development
|
||||
|
||||
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
|
||||
This may take around 5 minutes. Certainly better than the several hours it takes to bootstrap Cloud Foundry.
|
||||
|
||||
You may also wish to take a look at the [advanced installation](http://progrium.viewdocs.io/dokku/advanced-installation) document for additional installation options.
|
||||
|
||||
## Configuring
|
||||
|
||||
Set up a domain and a wildcard domain pointing to that host. Make sure `/home/dokku/VHOST` is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (`dig +short $(hostname -f)`). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, dokku will publish the app with a port number (i.e. `http://example.com:49154` - note the missing subdomain).
|
||||
|
||||
You'll have to add a public key associated with a username by doing something like this from your local machine:
|
||||
|
||||
$ cat ~/.ssh/id_rsa.pub | ssh progriumapp.com "sudo sshcommand acl-add dokku progrium"
|
||||
|
||||
That's it!
|
||||
|
||||
## Deploy an App
|
||||
|
||||
Now you can deploy apps on your Dokku. Let's deploy the [Heroku Node.js sample app](https://github.com/heroku/node-js-sample). All you have to do is add a remote to name the app. It's created on-the-fly.
|
||||
|
||||
$ cd node-js-sample
|
||||
$ git remote add progrium dokku@progriumapp.com:node-js-app
|
||||
$ git push progrium master
|
||||
Counting objects: 296, done.
|
||||
Delta compression using up to 4 threads.
|
||||
Compressing objects: 100% (254/254), done.
|
||||
Writing objects: 100% (296/296), 193.59 KiB, done.
|
||||
Total 296 (delta 25), reused 276 (delta 13)
|
||||
-----> Building node-js-app ...
|
||||
Node.js app detected
|
||||
-----> Resolving engine versions
|
||||
|
||||
... blah blah blah ...
|
||||
|
||||
-----> Application deployed:
|
||||
http://node-js-app.progriumapp.com
|
||||
|
||||
You're done!
|
||||
|
||||
Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push progrium <local branch>:master```
|
||||
|
||||
Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)!
|
||||
Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root.
|
||||
|
||||
## Remote commands
|
||||
|
||||
Dokku commands can be run over ssh. Anywhere you would run `dokku <command>`, just run `ssh -t dokku@progriumapp.com <command>`
|
||||
The `-t` is used to request a pty. It is highly recommended to do so.
|
||||
To avoid the need to type the `-t` option each time, simply create/modify a section in the `.ssh/config` on the client side, as follows :
|
||||
|
||||
Host progriumapp.com
|
||||
RequestTTY yes
|
||||
|
||||
## Run a command in the app environment
|
||||
|
||||
It's possible to run commands in the environment of the deployed application:
|
||||
|
||||
$ dokku run node-js-app ls -alh
|
||||
$ dokku run <app> <cmd>
|
||||
|
||||
## Plugins
|
||||
|
||||
Dokku itself is built out of plugins. Checkout the wiki for information about
|
||||
creating your own and a list of existing plugins:
|
||||
|
||||
https://github.com/progrium/dokku/wiki/Plugins
|
||||
|
||||
## Removing a deployed app
|
||||
|
||||
SSH onto the server, then execute:
|
||||
|
||||
$ dokku delete myapp
|
||||
|
||||
## Environment variable management
|
||||
|
||||
Typically an application will require some environment variables to run properly. Environment variables may contain private data, such as passwords or API keys, so it is not recommend to store them in your application's repository.
|
||||
|
||||
The `config` plugin provides the following commands to manage your variables:
|
||||
```
|
||||
config <app> - display the config vars 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:unset <app> KEY1 [KEY2 ...] - unset one or more config vars
|
||||
```
|
||||
|
||||
## TLS/SPDY support
|
||||
|
||||
Dokku provides easy TLS/SPDY support out of the box. This can be done app-by-app or for all subdomains at once. Note that whenever TLS support is enabled SPDY is also enabled.
|
||||
|
||||
### Per App
|
||||
|
||||
To enable TLS connection to to one of your applications, copy or symlink the `.crt`/`.pem` and `.key` files into the application's `/home/dokku/:app/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively.
|
||||
|
||||
Redeployment of the application will be needed to apply TLS configuration. Once it is redeployed, the application will be accessible by `https://` (redirection from `http://` is applied as well).
|
||||
|
||||
### All Subdomains
|
||||
|
||||
To enable TLS connections for all your applications at once you will need a wildcard TLS certificate.
|
||||
|
||||
To enable TLS across all apps, copy or symlink the `.crt`/`.pem` and `.key` files into the `/home/dokku/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively. Then, enable the certificates by editing `/etc/nginx/conf.d/dokku.conf` and uncommenting these two lines (remove the #):
|
||||
|
||||
ssl_certificate /home/dokku/tls/server.crt;
|
||||
ssl_certificate_key /home/dokku/tls/server.key;
|
||||
|
||||
The nginx configuration will need to be reloaded in order for the updated TLS configuration to be applied. This can be done either via the init system or by re-deploying the application. Once TLS is enabled, the application will be accessible by `https://` (redirection from `http://` is applied as well).
|
||||
|
||||
**Note**: TLS will not be enabled unless the application's VHOST matches the certificate's name. (i.e. if you have a cert for *.example.com TLS won't be enabled for something.example.org or example.net)
|
||||
|
||||
### HSTS Header
|
||||
|
||||
The [HSTS header](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) is an HTTP header that can inform browsers that all requests to a given site should be made via HTTPS. dokku does not, by default, enable this header. It is thus left up to you, the user, to enable it for your site.
|
||||
|
||||
Beware that if you enable the header and a subsequent deploy of your application results in an HTTP deploy (for whatever reason), the way the header works means that a browser will not attempt to request the HTTP version of your site if the HTTPS version fails.
|
||||
|
||||
## Upgrading
|
||||
|
||||
Dokku is in active development. You can update the deployment step and the build step separately.
|
||||
|
||||
**Note**: If you are upgrading from a revision prior to [27d4bc8c3c](https://github.com/progrium/dokku/commit/27d4bc8c3c19fe580ef3e65f2f85b85101cd83e4), follow the instructions in [this wiki entry](https://github.com/progrium/dokku/wiki/Migrating-to-Dokku-0.2.0).
|
||||
|
||||
To update the deploy step (this is updated less frequently):
|
||||
|
||||
$ cd ~/dokku
|
||||
$ git pull origin master
|
||||
$ sudo make install
|
||||
|
||||
Nothing needs to be restarted. Changes will take effect on the next push / deployment.
|
||||
|
||||
To update the build step:
|
||||
|
||||
$ git clone https://github.com/progrium/buildstep.git
|
||||
$ cd buildstep
|
||||
$ git pull origin master
|
||||
$ sudo make build
|
||||
|
||||
This will build a fresh Ubuntu Quantal image, install a number of packages, and
|
||||
eventually replace the Docker image for buildstep.
|
||||
Full documentation - including advanced installation docs - are available online at [docs](http://progrium.viewdocs.io/dokku/index)
|
||||
|
||||
## Support
|
||||
|
||||
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)
|
||||
|
||||
## Components
|
||||
## Sponsors
|
||||
|
||||
* [Docker](https://github.com/dotcloud/docker) - Container runtime and manager
|
||||
* [Buildstep](https://github.com/progrium/buildstep) - Buildpack builder
|
||||
* [pluginhook](https://github.com/progrium/pluginhook) - Shell based plugins and hooks
|
||||
* [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH
|
||||
|
||||
Looking to keep codebase as simple and hackable as possible, so try to keep your line count down.
|
||||
|
||||
## 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/).
|
||||
* **Multitenancy.** It's ready for it, but again, have a look at [Flynn](https://flynn.io/).
|
||||
* **Client app.** Given the constraints, running commands remotely via SSH is fine.
|
||||
Dokku is currently sponsored by the enterprise grade, multi-host PaaS project [Deis](http://deis.io/).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
7
Vagrantfile
vendored
7
Vagrantfile
vendored
@@ -1,8 +1,8 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
BOX_NAME = ENV["BOX_NAME"] || "raring"
|
||||
BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
BOX_NAME = ENV["BOX_NAME"] || "trusty"
|
||||
BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
BOX_MEMORY = ENV["BOX_MEMORY"] || "512"
|
||||
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
|
||||
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
|
||||
@@ -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
|
||||
|
||||
10
bootstrap.sh
Normal file → Executable file
10
bootstrap.sh
Normal file → Executable file
@@ -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
|
||||
|
||||
@@ -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.6"
|
||||
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__
|
||||
<html>
|
||||
<head>
|
||||
<title>Dokku Setup</title>
|
||||
<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>
|
||||
<title>Dokku Setup</title>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="width: 640px;">
|
||||
<form id="form" role="form">
|
||||
<h1>Dokku Setup <small><%= version %></small></h1>
|
||||
<div class="form-group">
|
||||
<h3><small style="text-transform: uppercase;">Admin Access</small></h3>
|
||||
<label for="key">Public Key</label><br />
|
||||
<textarea class="form-control" name="key" rows="7" id="key"><%= admin_key %></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<h3><small style="text-transform: uppercase;">Hostname Configuration</small></h3>
|
||||
<div class="form-group">
|
||||
<label for="hostname">Hostname</label>
|
||||
<input class="form-control" type="text" id="hostname" name="hostname" value="<%= hostname %>" />
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<p>Your app URLs will look like:</p>
|
||||
<pre id="example">http://hostname:port</pre>
|
||||
</div>
|
||||
<button type="button" onclick="setup()" class="btn btn-primary">Finish Setup</button> <span style="padding-left: 20px;" id="result"></span>
|
||||
</form>
|
||||
</div>
|
||||
<div id="error-output"></div>
|
||||
<script>
|
||||
function setup() {
|
||||
if ($.trim($("#key").val()) == "") {
|
||||
alert("Your admin public key cannot be blank.")
|
||||
return
|
||||
}
|
||||
if ($.trim($("#hostname").val()) == "") {
|
||||
alert("Your hostname cannot be blank.")
|
||||
return
|
||||
}
|
||||
data = $("#form").serialize()
|
||||
$("input,textarea,button").prop("disabled", true);
|
||||
$.post('/setup', data)
|
||||
.done(function() {
|
||||
$("#result").html("Success!")
|
||||
window.location.href = "https://github.com/progrium/dokku#deploy-an-app";
|
||||
})
|
||||
.fail(function(data) {
|
||||
$("#result").html("Something went wrong...")
|
||||
$("#error-output").html(data.responseText)
|
||||
});
|
||||
}
|
||||
function update() {
|
||||
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.")
|
||||
$("#vhost").prop('checked', false);
|
||||
}
|
||||
if ($("#vhost").is(':checked')) {
|
||||
$("#example").html("http://<app-name>."+$("#hostname").val())
|
||||
} else {
|
||||
$("#example").html("http://"+$("#hostname").val()+":<app-port>")
|
||||
}
|
||||
}
|
||||
$("#vhost").change(update);
|
||||
$("#hostname").change(update);
|
||||
update();
|
||||
</script>
|
||||
<div class="container" style="width: 640px;">
|
||||
<form id="form" role="form">
|
||||
<h1>Dokku Setup <small><%= version %></small></h1>
|
||||
<div class="form-group">
|
||||
<h3><small style="text-transform: uppercase;">Admin Access</small></h3>
|
||||
<label for="key">Public Key</label><br />
|
||||
<textarea class="form-control" name="key" rows="7" id="key"><%= admin_key %></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<h3><small style="text-transform: uppercase;">Hostname Configuration</small></h3>
|
||||
<div class="form-group">
|
||||
<label for="hostname">Hostname</label>
|
||||
<input class="form-control" type="text" id="hostname" name="hostname" value="<%= hostname %>" />
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<p>Your app URLs will look like:</p>
|
||||
<pre id="example">http://hostname:port</pre>
|
||||
</div>
|
||||
<button type="button" onclick="setup()" class="btn btn-primary">Finish Setup</button> <span style="padding-left: 20px;" id="result"></span>
|
||||
</form>
|
||||
</div>
|
||||
<div id="error-output"></div>
|
||||
<script>
|
||||
function setup() {
|
||||
if ($.trim($("#key").val()) == "") {
|
||||
alert("Your admin public key cannot be blank.")
|
||||
return
|
||||
}
|
||||
if ($.trim($("#hostname").val()) == "") {
|
||||
alert("Your hostname cannot be blank.")
|
||||
return
|
||||
}
|
||||
data = $("#form").serialize()
|
||||
$("input,textarea,button").prop("disabled", true);
|
||||
$.post('/setup', data)
|
||||
.done(function() {
|
||||
$("#result").html("Success!")
|
||||
window.location.href = "http://progrium.viewdocs.io/dokku/application-deployment";
|
||||
})
|
||||
.fail(function(data) {
|
||||
$("#result").html("Something went wrong...")
|
||||
$("#error-output").html(data.responseText)
|
||||
});
|
||||
}
|
||||
function update() {
|
||||
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.")
|
||||
$("#vhost").prop('checked', false);
|
||||
}
|
||||
if ($("#vhost").is(':checked')) {
|
||||
$("#example").html("http://<app-name>."+$("#hostname").val())
|
||||
} else {
|
||||
$("#example").html("http://"+$("#hostname").val()+":<app-port>")
|
||||
}
|
||||
}
|
||||
$("#vhost").change(update);
|
||||
$("#hostname").change(update);
|
||||
update();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
32
contrib/dokku_client.sh
Executable file
32
contrib/dokku_client.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
if [ -z "$DOKKU_HOST" ]
|
||||
then
|
||||
function dokku {
|
||||
appname=$(git remote -v 2>/dev/null | grep dokku | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
donotshift="YES"
|
||||
fi
|
||||
if [ "$1" = "create" ]
|
||||
then
|
||||
appname=$(echo "print(elfs.GenName())" | lua -l elfs)
|
||||
if git remote add dokku dokku@$DOKKU_HOST:$appname
|
||||
then
|
||||
echo "-----> Dokku remote added at $DOKKU_HOST"
|
||||
echo "-----> Application name is $appname"
|
||||
else
|
||||
echo "! Dokku remote not added! Do you already have a dokku remote?"
|
||||
return
|
||||
fi
|
||||
git push dokku master
|
||||
else
|
||||
if [ -z "$donotshift" ]
|
||||
then
|
||||
ssh dokku@$DOKKU_HOST $*
|
||||
exit
|
||||
fi
|
||||
verb=$1
|
||||
shift
|
||||
ssh dokku@$DOKKU_HOST "$verb" "$appname" $@
|
||||
fi
|
||||
}
|
||||
fi
|
||||
@@ -1,38 +0,0 @@
|
||||
#Advanced installation
|
||||
|
||||
## Development
|
||||
|
||||
If you plan on developing dokku, the easiest way to install from your own repository is cloning
|
||||
the repository and calling the install script. Example:
|
||||
|
||||
$ git clone https://github.com/yourusername/dokku.git
|
||||
$ cd dokku
|
||||
$ sudo make install
|
||||
|
||||
The `Makefile` allows source URLs to be overridden to include customizations from your own
|
||||
repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL`
|
||||
environment variables may be set to override the defaults (see the `Makefile` for how these
|
||||
apply). Example:
|
||||
|
||||
$ sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/gitreceive make install
|
||||
|
||||
## Bootstrap a server from your own repository
|
||||
|
||||
The bootstrap script allows the dokku repository URL to be overridden to bootstrap a host from
|
||||
your own clone of dokku using the `DOKKU_REPO` environment variable. Example:
|
||||
|
||||
$ wget https://raw.github.com/progrium/dokku/master/bootstrap.sh
|
||||
$ chmod +x bootstrap.sh
|
||||
$ sudo DOKKU_REPO=https://github.com/yourusername/dokku.git ./bootstrap.sh
|
||||
|
||||
## Custom buildstep build
|
||||
|
||||
Dokku ships with a pre-built version of version of the [buildstep] component by
|
||||
default. If you want to build your own version you can specify that with an env
|
||||
variable.
|
||||
|
||||
$ git clone https://github.com/progrium/dokku.git
|
||||
$ cd dokku
|
||||
$ sudo BUILD_STACK=true make install
|
||||
|
||||
[buildstep]: https://github.com/progrium/buildstep
|
||||
90
docs/application-deployment.md
Normal file
90
docs/application-deployment.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Deploy an App
|
||||
|
||||
Now you can deploy apps on your Dokku. Let's deploy the [Heroku Node.js sample app](https://github.com/heroku/node-js-sample). All you have to do is add a remote to name the app. It's created on-the-fly.
|
||||
|
||||
```
|
||||
$ cd node-js-sample
|
||||
$ git remote add progrium dokku@progriumapp.com:node-js-app
|
||||
$ git push progrium master
|
||||
Counting objects: 296, done.
|
||||
Delta compression using up to 4 threads.
|
||||
Compressing objects: 100% (254/254), done.
|
||||
Writing objects: 100% (296/296), 193.59 KiB, done.
|
||||
Total 296 (delta 25), reused 276 (delta 13)
|
||||
-----> Building node-js-app ...
|
||||
Node.js app detected
|
||||
-----> Resolving engine versions
|
||||
|
||||
... blah blah blah ...
|
||||
|
||||
-----> Application deployed:
|
||||
http://node-js-app.progriumapp.com
|
||||
```
|
||||
|
||||
You're done!
|
||||
|
||||
Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push progrium <local branch>:master```
|
||||
|
||||
Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)!
|
||||
Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root.
|
||||
|
||||
## Specifying a custom buildpack
|
||||
|
||||
If buildpack detection isn't working well for you or you want to specify a custom buildpack for one repository you can create & commit a file in the root of your git repository named `.env` containing `export BUILDPACK_URL=<repository>` before pushing. This will tell buildstep to fetch the specified buildpack and use it instead of relying on the built-in buildpacks & their detection methods.
|
||||
|
||||
## Default vhost
|
||||
|
||||
You might notice the default vhost for Nginx will be one of the apps. If an app doesn't exist, it will use this vhost and it may be confusing for it to go to another app. You can create a default vhost using a configuration under `sites-enabled`. You just have to change one thing in the main nginx.conf:
|
||||
|
||||
Swap both conf.d include line and the sites-enabled include line. From:
|
||||
```
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
```
|
||||
to
|
||||
```
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
```
|
||||
|
||||
Alternatively, you may push an app to your dokku host with a name like "00-default". As long as it lists first in `ls /home/dokku/*/nginx.conf | head`, it will be used as the default nginx vhost.
|
||||
|
||||
## Deploying to subdomains
|
||||
|
||||
The name of remote repository is used as the name of application to be deployed, as for example above:
|
||||
|
||||
$ git remote add progrium git@progriumapp.com:node-js-app
|
||||
$ git push progrium master
|
||||
|
||||
Is deployed to,
|
||||
|
||||
remote: -----> Application deployed:
|
||||
remote: http://node-js-app.progriumapp.com
|
||||
|
||||
You can also specify fully qualified names, say `app.progrium.com`, as
|
||||
|
||||
$ git remote add progrium git@progriumapp.com:app.progrium.com
|
||||
$ git push progrium master
|
||||
|
||||
So, after deployment the application will be available at,
|
||||
|
||||
remote: -----> Application deployed:
|
||||
remote: http://app.progrium.com
|
||||
|
||||
This is in particular useful, then you want to deploy to root domain, as
|
||||
|
||||
$ git remote add progrium git@progriumapp.com:progrium.com
|
||||
$ git push progrium master
|
||||
|
||||
... deployment ...
|
||||
|
||||
remote: -----> Application deployed:
|
||||
remote: http://progrium.com
|
||||
|
||||
# Removing a deployed app
|
||||
|
||||
SSH onto the server, then execute:
|
||||
|
||||
```bash
|
||||
dokku delete myapp
|
||||
```
|
||||
8
docs/components.md
Normal file
8
docs/components.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Components
|
||||
|
||||
* [Docker](https://github.com/dotcloud/docker) - Container runtime and manager
|
||||
* [Buildstep](https://github.com/progrium/buildstep) - Buildpack builder
|
||||
* [pluginhook](https://github.com/progrium/pluginhook) - Shell based plugins and hooks
|
||||
* [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH
|
||||
|
||||
Looking to keep codebase as simple and hackable as possible, so try to keep your line count down.
|
||||
14
docs/configuration-management.md
Normal file
14
docs/configuration-management.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Configuration management
|
||||
|
||||
Typically an application will require some configuration to run properly. Dokku supports application configuration via environment variables. Environment variables may contain private data, such as passwords or API keys, so it is not recommended to store them in your application's repository.
|
||||
|
||||
The `config` plugin provides the following commands to manage your variables:
|
||||
|
||||
```
|
||||
config <app> - display the config vars 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: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.
|
||||
88
docs/dns.md
Normal file
88
docs/dns.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# Overview
|
||||
|
||||
This is a work in progress.
|
||||
|
||||
## DNS Versions
|
||||
|
||||
There are many different DNS servers 'in the wild'. Some of the popular ones on Linux are BIND, dnsmasq, and pdns. Windows has its own built-in DNS server as well as Unbound, Posadis, and more. A full list of DNS packages can be found on Wikipedia under [Comparison of DNS Server Software](http://en.wikipedia.org/wiki/Comparison_of_DNS_server_software). In addition to the various DNS packages, there are tens of thousands of [Managed DNS Providers](http://en.wikipedia.org/wiki/List_of_managed_DNS_providers) out that all have different DNS interfaces.
|
||||
|
||||
## Focus
|
||||
|
||||
Because there are so many different DNS server packages out there as well as a tremendous number of Managed DNS Providers, we will focus on the concepts of DNS as well as providing examples in the 'BIND' format so you can adapt the information to your own server package or managed DNS provider.
|
||||
|
||||
## Assumptions
|
||||
|
||||
* We assume you have a passing familiarity with DNS. If not, you can read an [in-depth article](http://www.diaryofaninja.com/blog/2012/03/03/devops-dns-for-developers-ndash-now-therersquos-no-excuse-not-to-know) on DNS. But basically you need to know that DNS changes names (like example.tld) into addresses (like 127.0.0.1)
|
||||
* We assume you already have a domain name registered and pointed to your favorite Managed DNS Provider or have your own BIND DNS server running.
|
||||
* You have a server on the internet and are about to follow the instructions in the [README](https://github.com/progrium/dokku/blob/master/README.md) to get dokku installed. Don't do the install just yet though.
|
||||
|
||||
|
||||
## HELP!
|
||||
|
||||
Don't be afraid to ask if you need help. Create a [new issue](https://github.com/progrium/dokku/issues) and someone will be glad to assist you.
|
||||
|
||||
|
||||
# Getting started
|
||||
|
||||
For the examples, we will use the domain name 'example.tld' and the IP address '127.0.0.1'.
|
||||
|
||||
Dokku uses a DNS to differentiate between apps on your dokku-powered server. If you are using the domain 'example.tld', and you have two apps 'myapp1' and 'myapp2', dokku will make them available at 'myapp1.example.tld' and 'myapp2.example.tld'.
|
||||
|
||||
To get started, you need to know the IP address of your dokku server. Connect in to it and run 'ifconfig' or 'ip addr' to see the IP address.
|
||||
|
||||
# Caching
|
||||
|
||||
Please remember that DNS relies heavily on _caching_. Changes you make to DNS could take anywhere from a few seconds to a few *days* to 'propagate'. If you tried surfing to example.tld, then changed the IP address in DNS, it could be a while before your computer picks up on the changes.
|
||||
|
||||
## The two methods
|
||||
|
||||
Now you have to make a decision about your domain. Do you want everything and anything at example.tld to go to your dokku server, or would you rather use a 'sub domain' for your dokku server?
|
||||
|
||||
In other words, do you want your applications on your dokku server accessible via myapp.example.tld or via myapp.myserver.example.tld?
|
||||
|
||||
### Using a sub-domain (myapp.myserver.example.tld)
|
||||
|
||||
Using a sub-domain is easy. When you set up your server, you probably gave it a name like myserver.example.tld.
|
||||
|
||||
Go in to your Managed DNS provider and create an 'A' record named 'myserver' and put in the IP address you got from your server a few moments ago.
|
||||
|
||||
Hopefully your managed DNS provider also supports wildcards. Create a second 'A' record named '*.myserver' along with the IP address you got from your server a few moments ago.
|
||||
|
||||
If you are using BIND, your zone file will look similar to this:
|
||||
|
||||
```
|
||||
$ORIGIN example.tld
|
||||
$TTL 5m
|
||||
|
||||
myserver IN A 127.0.0.1
|
||||
*.myserver IN A 127.0.0.1
|
||||
```
|
||||
|
||||
You can verify your changes in Linux by trying one or more of the following commands:
|
||||
|
||||
* host myserver.example.tld
|
||||
|
||||
* dig -t A myserver.example.tld
|
||||
|
||||
* nslookup myserver.example.tld
|
||||
|
||||
Now is a good time to remind you that the answers you get MAY BE CACHED.
|
||||
|
||||
If everything is working correctly, you should also be able to query for any other name 'under' myserver.example.tld and get back the IP address of your server. Try:
|
||||
|
||||
* host test.myserver.example.tld
|
||||
|
||||
* host xyzzy.myserver.example.tld
|
||||
|
||||
If they all return your IP address, you have set DNS up properly for dokku. You should also be able to 'ssh root@myserver.example.tld' and access your server.
|
||||
|
||||
Proceed with the setup instructions in the [README](https://github.com/progrium/dokku/blob/master/README.md)
|
||||
|
||||
### Using the root of your domain (myapp.example.tld)
|
||||
|
||||
This section is a work in progress. It is incomplete.
|
||||
|
||||
Using the 'root' of your domain is nearly identical to the previous example.
|
||||
|
||||
* hostname is under example.tld, still needs A record
|
||||
* Need to modify /home/dokku/HOSTNAME and /home/dokku/VHOST
|
||||
@@ -1,3 +1,26 @@
|
||||
# Dokku Documentation
|
||||
|
||||
Docs go here.
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
|
||||
|
||||
## Table Of Contents
|
||||
|
||||
- [Installation](http://progrium.viewdocs.io/dokku/installation)
|
||||
- [Upgrading](http://progrium.viewdocs.io/dokku/upgrading)
|
||||
- [Troubleshooting](http://progrium.viewdocs.io/dokku/troubleshooting)
|
||||
- [Components](http://progrium.viewdocs.io/dokku/components)
|
||||
- [Application Deployment](http://progrium.viewdocs.io/dokku/application-deployment)
|
||||
- [Remote commands](http://progrium.viewdocs.io/dokku/remote-commands)
|
||||
- [Plugins](http://progrium.viewdocs.io/dokku/plugins)
|
||||
- [Configuration management](http://progrium.viewdocs.io/dokku/configuration-management)
|
||||
- [Nginx Configuration](http://progrium.viewdocs.io/dokku/nginx)
|
||||
- [DNS](http://progrium.viewdocs.io/dokku/dns)
|
||||
|
||||
## Things this project won't do
|
||||
|
||||
* **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 [Deis](http://deis.io/).
|
||||
* **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.
|
||||
|
||||
154
docs/installation.md
Normal file
154
docs/installation.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# Installation
|
||||
|
||||
## Requirements
|
||||
|
||||
- A fresh VM running Ubuntu `14.04 x64`
|
||||
|
||||
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.
|
||||
|
||||
## Installing the latest Stable version
|
||||
|
||||
To install the latest stable version of dokku, you can run the following bootstrapper command:
|
||||
|
||||
```bash
|
||||
wget -qO- https://raw.github.com/progrium/dokku/v0.3.6/bootstrap.sh | sudo DOKKU_TAG=v0.3.6 bash
|
||||
```
|
||||
|
||||
## Configuring
|
||||
|
||||
Set up a domain and a wildcard domain pointing to that host. Make sure `/home/dokku/VHOST` is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (`dig +short $(hostname -f)`). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, dokku will publish the app with a port number (i.e. `http://example.com:49154` - note the missing subdomain).
|
||||
|
||||
You'll have to add a public key associated with a username by doing something like this from your local machine:
|
||||
|
||||
$ cat ~/.ssh/id_rsa.pub | ssh progriumapp.com "sudo sshcommand acl-add dokku progrium"
|
||||
|
||||
That's it!
|
||||
|
||||
## Advanced installation
|
||||
|
||||
### Development via bash script
|
||||
|
||||
```bash
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
```
|
||||
|
||||
This may take around 5 minutes. Certainly better than the several hours it takes to bootstrap Cloud Foundry.
|
||||
|
||||
You may also wish to take a look at the [advanced installation](http://progrium.viewdocs.io/dokku/advanced-installation) document for additional installation options.
|
||||
|
||||
### Development From Source
|
||||
|
||||
If you plan on developing dokku, the easiest way to install from your own repository is cloning
|
||||
the repository and calling the install script. Example:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yourusername/dokku.git
|
||||
cd dokku
|
||||
sudo make install
|
||||
```
|
||||
|
||||
The `Makefile` allows source URLs to be overridden to include customizations from your own
|
||||
repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL`
|
||||
environment variables may be set to override the defaults (see the `Makefile` for how these
|
||||
apply). Example:
|
||||
|
||||
```bash
|
||||
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
|
||||
```
|
||||
|
||||
### Bootstrap a server from your own repository
|
||||
|
||||
The bootstrap script allows the dokku repository URL to be overridden to bootstrap a host from
|
||||
your own clone of dokku using the `DOKKU_REPO` environment variable. Example:
|
||||
|
||||
```bash
|
||||
wget https://raw.github.com/progrium/dokku/master/bootstrap.sh
|
||||
chmod +x bootstrap.sh
|
||||
sudo DOKKU_REPO=https://github.com/yourusername/dokku.git ./bootstrap.sh
|
||||
```
|
||||
|
||||
### Custom buildstep build
|
||||
|
||||
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
|
||||
variable.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
cd dokku
|
||||
sudo BUILD_STACK=true make install
|
||||
```
|
||||
|
||||
### Install Dokku using Vagrant
|
||||
|
||||
- Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
|
||||
- Download and install [Vagrant](http://www.vagrantup.com/downloads.html)
|
||||
- Clone Dokku
|
||||
|
||||
```
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
```
|
||||
|
||||
- Setup SSH hosts in your `/etc/hosts`
|
||||
|
||||
```
|
||||
10.0.0.2 dokku.me
|
||||
```
|
||||
|
||||
- Setup SSH Config in `~/.ssh/config`
|
||||
|
||||
```
|
||||
Host dokku.me
|
||||
Port 2222
|
||||
```
|
||||
|
||||
- Create VM
|
||||
```
|
||||
# Optional ENV arguments:
|
||||
# - `BOX_NAME`
|
||||
# - `BOX_URI`
|
||||
# - `BOX_MEMORY`
|
||||
# - `DOKKU_DOMAIN`
|
||||
# - `DOKKU_IP`.
|
||||
vagrant up
|
||||
```
|
||||
|
||||
- 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.
|
||||
|
||||
You are now ready to deploy an app or install plugins.
|
||||
|
||||
For a different, complete, example see https://github.com/RyanBalfanz/dokku-vagrant-example.
|
||||
|
||||
### Installing on Linode
|
||||
|
||||
#### Using StackScript
|
||||
|
||||
Deploy using the following StackScript:
|
||||
* https://www.linode.com/stackscripts/view/8552
|
||||
|
||||
#### Without StackScript
|
||||
|
||||
* Build a Ubuntu 13.04 instance
|
||||
|
||||
* Follow these instructions: https://www.linode.com/wiki/index.php/PV-GRUB#Ubuntu_12.04_Precise
|
||||
|
||||
* If `apt-get update` no longer works:
|
||||
|
||||
* Verify if apt-get is trying to use ipv6 instead of ipv4 (e.g. you read something like "[Connecting to us.archive.ubuntu.com (2001:67c:1562::14)]" and apt-get would not proceed). In that case, follow these instructions: http://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method (append "precedence ::ffff:0:0/96 100" to /etc/gai.conf)
|
||||
|
||||
* OR: change `/etc/apt/sources.list` to one mentioned in http://mirrors.ubuntu.com/mirrors.txt
|
||||
|
||||
* Run the following commands:
|
||||
|
||||
```bash
|
||||
apt-get update
|
||||
|
||||
apt-get install lxc wget bsdtar linux-image-extra-$(uname -r)
|
||||
|
||||
modprobe aufs
|
||||
```
|
||||
* After this, you can install dokku the default way:
|
||||
|
||||
```bash
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
```
|
||||
78
docs/nginx.md
Normal file
78
docs/nginx.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# Nginx
|
||||
|
||||
Dokku uses nginx as it's server for routing requests to specific applications.
|
||||
|
||||
## TLS/SPDY support
|
||||
|
||||
Dokku provides easy TLS/SPDY support out of the box. This can be done app-by-app or for all subdomains at once. Note that whenever TLS support is enabled SPDY is also enabled.
|
||||
|
||||
### Per App
|
||||
|
||||
To enable TLS connection to to one of your applications, copy or symlink the `.crt`/`.pem` and `.key` files into the application's `/home/dokku/:app/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively.
|
||||
|
||||
Redeployment of the application will be needed to apply TLS configuration. Once it is redeployed, the application will be accessible by `https://` (redirection from `http://` is applied as well).
|
||||
|
||||
### All Subdomains
|
||||
|
||||
To enable TLS connections for all your applications at once you will need a wildcard TLS certificate.
|
||||
|
||||
To enable TLS across all apps, copy or symlink the `.crt`/`.pem` and `.key` files into the `/home/dokku/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively. Then, enable the certificates by editing `/etc/nginx/conf.d/dokku.conf` and uncommenting these two lines (remove the #):
|
||||
|
||||
```
|
||||
ssl_certificate /home/dokku/tls/server.crt;
|
||||
ssl_certificate_key /home/dokku/tls/server.key;
|
||||
```
|
||||
|
||||
The nginx configuration will need to be reloaded in order for the updated TLS configuration to be applied. This can be done either via the init system or by re-deploying the application. Once TLS is enabled, the application will be accessible by `https://` (redirection from `http://` is applied as well).
|
||||
|
||||
**Note**: TLS will not be enabled unless the application's VHOST matches the certificate's name. (i.e. if you have a cert for *.example.com TLS won't be enabled for something.example.org or example.net)
|
||||
|
||||
### HSTS Header
|
||||
|
||||
The [HSTS header](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) is an HTTP header that can inform browsers that all requests to a given site should be made via HTTPS. dokku does not, by default, enable this header. It is thus left up to you, the user, to enable it for your site.
|
||||
|
||||
Beware that if you enable the header and a subsequent deploy of your application results in an HTTP deploy (for whatever reason), the way the header works means that a browser will not attempt to request the HTTP version of your site if the HTTPS version fails.
|
||||
|
||||
### Importing ssl certificates
|
||||
|
||||
You can import ssl certificates via tarball using the following command:
|
||||
|
||||
``` bash
|
||||
dokku nginx:import-ssl myapp < archive-of-certs.tar
|
||||
```
|
||||
|
||||
This archive should is expanded via `tar xvf`. It should contain `server.crt` and `server.key`.
|
||||
|
||||
## Disabling VHOSTS
|
||||
|
||||
If desired, it is possible to disable vhosts by setting the `NO_VHOST` environment variable:
|
||||
|
||||
```bash
|
||||
dokku config:set myapp NO_VHOST=1
|
||||
```
|
||||
|
||||
On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable.
|
||||
|
||||
## Customizing hostnames
|
||||
|
||||
Applications typically have the following structure for their hostname:
|
||||
|
||||
```
|
||||
scheme://subdomain.domain.tld
|
||||
```
|
||||
|
||||
The `subdomain` is inferred from the pushed application name, while the `domain` is set during initial configuration in the `$DOKKU_ROOT/VHOST` file.
|
||||
|
||||
You can optionally override this in a plugin by implementing the `nginx-hostname` pluginhook. For example, you can reverse the subdomain with the following sample `nginx-hostname` pluginhook:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; SUBDOMAIN="$2"; VHOST="$3"
|
||||
|
||||
NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
|
||||
echo "$NEW_SUBDOMAIN.$VHOST"
|
||||
```
|
||||
|
||||
If the `nginx-hostname` has no output, the normal hostname algorithm will be executed.
|
||||
250
docs/plugins.md
Normal file
250
docs/plugins.md
Normal file
@@ -0,0 +1,250 @@
|
||||
# Plugins
|
||||
|
||||
Dokku itself is built out of plugins and uses [pluginhook](https://github.com/progrium/pluginhook) for its plugin system. In essence a plugin is a collection of scripts that will be run based on naming convention.
|
||||
|
||||
Let's take a quick look at the current dokku nginx plugin that's shipped with dokku by default.
|
||||
|
||||
nginx-vhosts/
|
||||
├── commands # contains additional commands
|
||||
├── install # runs on dokku installation
|
||||
└── post-deploy # runs after an app is deployed
|
||||
|
||||
## Installing a plugin
|
||||
|
||||
```bash
|
||||
cd /var/lib/dokku/plugins
|
||||
git clone <git url>
|
||||
dokku plugins-install
|
||||
```
|
||||
|
||||
> todo: add a command to dokku to install a plugin, given a git repository `dokku plugin:install <git url>`?
|
||||
|
||||
## Creating your own plugin
|
||||
|
||||
If you create your own plugin:
|
||||
|
||||
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`)
|
||||
3. edit this page and add a link to it below!
|
||||
4. subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
|
||||
|
||||
### Sample plugin
|
||||
|
||||
The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
hello)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2";
|
||||
|
||||
echo "Hello $APP"
|
||||
;;
|
||||
|
||||
hello:world)
|
||||
echo "Hello world"
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
hello <app> Says "Hello <app>"
|
||||
hello:world Says "Hello world"
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
```
|
||||
|
||||
A few notes:
|
||||
|
||||
- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin.
|
||||
- If your command requires that an application exists, ensure you check for it's existence in the manner prescribed above.
|
||||
- A `help` command is required, though it is allowed to be empty.
|
||||
- Commands *should* be namespaced.
|
||||
- As of 0.3.3, a catch-all should be implemented which exits with a `DOKKU_NOT_IMPLEMENTED_EXIT` code. This allows dokku to output a `command not found` message.
|
||||
|
||||
## Community plugins
|
||||
|
||||
Note: The following plugins have been supplied by our community and may not have been tested by dokku maintainers.
|
||||
|
||||
[agco-adm]: https://github.com/agco-adm
|
||||
[ademuk]: https://github.com/ademuk
|
||||
[alex-sherwin]: https://github.com/alex-sherwin
|
||||
[alexanderbeletsky]: https://github.com/alexanderbeletsky
|
||||
[Aomitayo]: https://github.com/Aomitayo
|
||||
[apmorton]: https://github.com/apmorton
|
||||
[blag]: https://github.com/blag
|
||||
[cameron-martin]: https://github.com/cameron-martin
|
||||
[cedricziel]: https://github.com/cedricziel
|
||||
[cef]: https://github.com/cef
|
||||
[darkpixel]: https://github.com/darkpixel
|
||||
[dyson]: https://github.com/dyson
|
||||
[F4-Group]: https://github.com/F4-Group
|
||||
[fermuch]: https://github.com/fermuch
|
||||
[fgrehm]: https://github.com/fgrehm
|
||||
[gdi2290]: https://github.com/gdi2290
|
||||
[heichblatt]: https://github.com/heichblatt
|
||||
[hughfletcher]: https://github.com/hughfletcher
|
||||
[iskandar]: https://github.com/iskandar
|
||||
[jeffutter]: https://github.com/jeffutter
|
||||
[jezdez]: https://github.com/jezdez
|
||||
[jlachowski]: https://github.com/jlachowski
|
||||
[krisrang]: https://github.com/krisrang
|
||||
[Kloadut]: https://github.com/Kloadut
|
||||
[luxifer]: https://github.com/luxifer
|
||||
[mlebkowski]: https://github.com/mlebkowski
|
||||
[matto1990]: https://github.com/matto1990
|
||||
[michaelshobbs]: https://github.com/michaelshobbs
|
||||
[mikecsh]: https://github.com/mikecsh
|
||||
[mikexstudios]: https://github.com/mikexstudios
|
||||
[motin]: https://github.com/motin
|
||||
[musicglue]: https://github.com/musicglue
|
||||
[neam]: https://github.com/neam
|
||||
[nornagon]: https://github.com/nornagon
|
||||
[ohardy]: https://github.com/ohardy
|
||||
[pauldub]: https://github.com/pauldub
|
||||
[pnegahdar]: https://github.com/pnegahdar
|
||||
[RaceHub]: https://github.com/racehub
|
||||
[rlaneve]: https://github.com/rlaneve
|
||||
[robv]: https://github.com/robv
|
||||
[scottatron]: https://github.com/scottatron
|
||||
[sehrope]: https://github.com/sehrope
|
||||
[statianzo]: https://github.com/statianzo
|
||||
[stuartpb]: https://github.com/stuartpb
|
||||
[thrashr888]: https://github.com/thrashr888
|
||||
[wmluke]: https://github.com/wmluke
|
||||
[Zenedith]: https://github.com/Zenedith
|
||||
|
||||
### Datastores
|
||||
|
||||
#### Relational
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [MariaDB](https://github.com/Kloadut/dokku-md-plugin) | [Kloadut][] | Compatible with 0.2.0 |
|
||||
| [MariaDB (single container)](https://github.com/ohardy/dokku-mariadb) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [MySQL](https://github.com/hughfletcher/dokku-mysql-plugin) | [hughfletcher][] | |
|
||||
| [PostgreSQL](https://github.com/Kloadut/dokku-pg-plugin) | [Kloadut][] | Compatible with 0.2.0 |
|
||||
| [PostgreSQL](https://github.com/jezdez/dokku-postgres-plugin) | [jezdez][] | Compatible with 0.2.0 |
|
||||
| [PostgreSQL](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). |
|
||||
| [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | |
|
||||
|
||||
#### Caching
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Memcached](https://github.com/jezdez/dokku-memcached-plugin) | [jezdez][] | Compatible with 0.2.0 |
|
||||
| [Memcached](https://github.com/jlachowski/dokku-memcached-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [Redis](https://github.com/jezdez/dokku-redis-plugin) | [jezdez][] | Requires https://github.com/rlaneve/dokku-link; compatible with 0.2.0 |
|
||||
| [Redis](https://github.com/luxifer/dokku-redis-plugin) | [luxifer][] | |
|
||||
| [Redis (single container)](https://github.com/ohardy/dokku-redis) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [Varnish](https://github.com/Zenedith/dokku-varnish-plugin) | [Zenedith][] | Varnish cache between nginx and application with base configuration|
|
||||
|
||||
#### Queuing
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
|
||||
#### Other
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub][] | Compatible with 0.2.0 |
|
||||
| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | |
|
||||
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 2014-02-22: targeting dokku @ [latest][217d00a]; will fail with Dokku earlier than [28de3ec][]. |
|
||||
| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) |
|
||||
| [Neo4j](https://github.com/Aomitayo/dokku-neo4j-plugin) | [Aomitayo][] | |
|
||||
|
||||
[dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709
|
||||
|
||||
### Process Managers
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Circus](https://github.com/apmorton/dokku-circus) | [apmorton][] | |
|
||||
| [Shoreman ](https://github.com/statianzo/dokku-shoreman) | [statianzo][] | Compatible with 0.2.0 |
|
||||
| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | Compatible with 0.2.0 |
|
||||
| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | Works with dokku @ [c77cbf1][] - no 0.2.0 compatibility |
|
||||
| [Forego](https://github.com/iskandar/dokku-forego) | [iskandar][] | Compatible with 0.2.x |
|
||||
|
||||
[c77cbf1]: https://github.com/progrium/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147
|
||||
[28de3ec]: https://github.com/progrium/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40
|
||||
|
||||
### Dokku Features
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh][] | Works with 0.2.0 |
|
||||
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | Compatible with 0.2.* |
|
||||
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | |
|
||||
| [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | |
|
||||
| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | dokku >= [c77cbf1][] |
|
||||
| [Dokku Name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | dokku >= [c77cbf1][] |
|
||||
| [Dokku Registry](https://github.com/agco-adm/dokku-registry) | [agco-adm][] | |
|
||||
| [git rev-parse HEAD in env](https://github.com/nornagon/dokku-git-rev) | [nornagon][] | Compatible with 0.2.0 |
|
||||
| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 |
|
||||
| [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | dokku >= [c77cbf1][]. 2014-02-17: [a043e98][] targeting dokku @ [latest][217d00a] |
|
||||
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | |
|
||||
| [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | dokku >= [c77cbf1][] |
|
||||
| [Multi-Buildpack](https://github.com/pauldub/dokku-multi-buildpack) | [pauldub][] | |
|
||||
| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>4</sup> | [wmluke][] | Compatible with 0.2.0 |
|
||||
| [Nginx-Alt](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | Works with v0.2.3 |
|
||||
| [Persistent Storage](https://github.com/dyson/dokku-persistent-storage) | [dyson][] | Requires dokku >= [c77cbf1][] |
|
||||
| [Ports](https://github.com/heichblatt/dokku-ports) | [heichblatt][] | |
|
||||
| [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | |
|
||||
| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | Compatible with 0.2.x |
|
||||
| [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 |
|
||||
| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env) | [cameron-martin][] | Works with v0.2.3 |
|
||||
| [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 |
|
||||
| [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) | [motin][] | Compatible with 0.3.1 |
|
||||
| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | Compatible with 0.2.0 |
|
||||
|
||||
[8fca220]: https://github.com/progrium/dokku/commit/8fca2204edb0017796d6915ca9157c05b1238e28
|
||||
[217d00a]: https://github.com/progrium/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7
|
||||
[98332de]: https://github.com/dyson/dokku-persistent-storage/commit/98332de4b5b640610bee535f4d5260263074e18b
|
||||
[a043e98]: https://github.com/stuartpb/dokku-bind-port/commit/a043e9892f4815b6525c850131e09fd64db5c1fa
|
||||
|
||||
<sup>1</sup> Similar to the heroku-labs feature (see https://devcenter.heroku.com/articles/labs-user-env-compile)
|
||||
|
||||
<sup>2</sup> Adds the possibility to add SSH deployment keys to receive private hosted packages
|
||||
|
||||
<sup>3</sup> Adds the ability to add custom hosts to the containers known_hosts file to be able to ssh them easily (useful with deployment keys)
|
||||
|
||||
<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
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | |
|
||||
| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | |
|
||||
| [Chef cookbooks](https://github.com/fgrehm/chef-dokku) | [fgrehm][] | |
|
||||
| [Bower install](https://github.com/alexanderbeletsky/dokku-bower-install) | [alexanderbeletsky][] | |
|
||||
| [Bower/Grunt](https://github.com/thrashr888/dokku-bower-grunt-build-plugin) | [thrashr888][] | |
|
||||
| [Bower/Gulp](https://github.com/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290][] | |
|
||||
| [Elasticsearch](https://github.com/robv/dokku-elasticsearch) | [robv][] | |
|
||||
| [Elasticsearch](https://github.com/jezdez/dokku-elasticsearch-plugin) | [jezdez][] | Compatible with 0.2.0 |
|
||||
| [Elasticsearch](https://github.com/blag/dokku-elasticsearch-plugin)<sup>1</sup> | [blag][] | Compatible with 0.2.0 |
|
||||
| [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | |
|
||||
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | |
|
||||
| [APT](https://github.com/F4-Group/dokku-apt) | [F4-Group][] | |
|
||||
| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | |
|
||||
| [PrimeCache](https://github.com/darkpixel/dokku-prime-cache) | [darkpixel][] | |
|
||||
|
||||
<sup>1</sup> Forked from [jezdez/dokku-elasticsearch-plugin](https://github.com/jezdez/dokku-elasticsearch-plugin): uses Elasticsearch 1.2 (instead of 0.90), doesn't depend on dokku-link, runs as elasticsearch user instead of root, and turns off multicast autodiscovery for use in a VPS environment.
|
||||
19
docs/remote-commands.md
Normal file
19
docs/remote-commands.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Remote commands
|
||||
|
||||
Dokku commands can be run over ssh. Anywhere you would run `dokku <command>`, just run `ssh -t dokku@progriumapp.com <command>`
|
||||
The `-t` is used to request a pty. It is highly recommended to do so.
|
||||
To avoid the need to type the `-t` option each time, simply create/modify a section in the `.ssh/config` on the client side, as follows:
|
||||
|
||||
```
|
||||
Host progriumapp.com
|
||||
RequestTTY yes
|
||||
```
|
||||
|
||||
## Run a command in the app environment
|
||||
|
||||
It's possible to run commands in the environment of the deployed application:
|
||||
|
||||
```bash
|
||||
dokku run node-js-app ls -alh
|
||||
dokku run <app> <cmd>
|
||||
```
|
||||
105
docs/template.html
Normal file
105
docs/template.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<!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;
|
||||
}
|
||||
th:nth-of-type(1) {
|
||||
width: 230px;
|
||||
}
|
||||
th:nth-of-type(2) {
|
||||
width: 140px;
|
||||
}
|
||||
tr, td {
|
||||
line-height: 24px;
|
||||
text-align: left;
|
||||
}
|
||||
#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>
|
||||
102
docs/troubleshooting.md
Normal file
102
docs/troubleshooting.md
Normal file
@@ -0,0 +1,102 @@
|
||||
## Troubleshooting
|
||||
|
||||
__Symptom:__ I deployed my app but I am getting the default nginx page
|
||||
|
||||
__Solution:__
|
||||
|
||||
Most of the time it's caused by some defaults newer versions of nginx set. To make sure that's the issue you're having run the following:
|
||||
|
||||
```
|
||||
root@dockerapps:/home/git# nginx
|
||||
nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
|
||||
```
|
||||
|
||||
If you get a similar error just edit __/etc/nginx/nginx.conf__ and add the following line to your http section:
|
||||
|
||||
```
|
||||
http {
|
||||
(... existing content ...)
|
||||
server_names_hash_bucket_size 64;
|
||||
(...)
|
||||
}
|
||||
```
|
||||
|
||||
Note that the `server_names_hash_bucket_size` setting defines the maximum domain name length.
|
||||
A value of 64 would allow domains with up to 46 characters. Set it to 128 if you need longer ones.
|
||||
|
||||
Save the file and try stopping nginx and starting it again:
|
||||
|
||||
```
|
||||
root@dockerapps:~/dokku/buildstep# /etc/init.d/nginx stop
|
||||
* Stopping nginx nginx [ OK ]
|
||||
root@dockerapps:~/dokku/buildstep# /etc/init.d/nginx start
|
||||
* Starting nginx nginx [ OK ]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I want to deploy my app, but while pushing I get the following error
|
||||
|
||||
! [remote rejected] master -> master (pre-receive hook declined)
|
||||
|
||||
__Solution:__
|
||||
|
||||
The `remote rejected` error does not give enough information. Anything could have failed.
|
||||
|
||||
Create a `/home/dokku/dokkurc` file containing the following :
|
||||
|
||||
export DOKKU_TRACE=1
|
||||
|
||||
This will trace all of dokku's activity. If this does not help you create a pastebin or a gist containing the full log, and create an issue.
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I want to deploy my app but I am getting asked for the password of the git user and the error message
|
||||
|
||||
fatal: 'NAME' does not appear to be a git repository
|
||||
fatal: Could not read from remote repository.
|
||||
|
||||
__Solution:__
|
||||
|
||||
You get asked for a password because your ssh secret key can't be found. This may happen if the private key corresponding to the public key you added with `sshcommand acl-add` is not located in the default location `~/.ssh/id_rsa`.
|
||||
|
||||
You have to point ssh to the correct secret key for your domain name. Add the following to your `~/.ssh/config`:
|
||||
|
||||
Host DOKKU_HOSTNAME
|
||||
IdentityFile "~/.ssh/KEYNAME"
|
||||
|
||||
Also see [issue #116](https://github.com/progrium/dokku/issues/116)
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I want to deploy my nodejs app on dokku and use a postinstall script within the package.json but I keep getting this error:
|
||||
|
||||
npm WARN cannot run in wd app@1.0.0 echo blah (wd=/build/app)
|
||||
|
||||
__Solution:__
|
||||
|
||||
This is a permissions problem as dokku (buildstep) uses a root account for running the application. (This may change please see this thread: https://github.com/progrium/buildstep/pull/42).
|
||||
|
||||
To allow npm to work as root account one must set the configuration option of ```unsafe-perm``` to true. There are many ways to set this configuration option but the one I've found works most consistently with the heroku-nodejs-buildpack is as a .npmrc file. The file should contain
|
||||
|
||||
```
|
||||
unsafe-perm = true
|
||||
```
|
||||
|
||||
Note that this is NOT required on heroku as heroku does not use a root account for running the application.
|
||||
|
||||
Please see https://github.com/progrium/dokku/issues/420 and https://github.com/heroku/heroku-buildpack-nodejs/issues/92.
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I successfully deployed my application with no deployment errors and receiving Bad Gateway when attempting to access the application
|
||||
|
||||
__Solution:__
|
||||
|
||||
In many cases the application will require the a `process.env.PORT` port opposed to a specified port.
|
||||
|
||||
When specifying your port you may want to use something similar to:
|
||||
|
||||
var port = process.env.PORT || 3000
|
||||
|
||||
Please see https://github.com/progrium/dokku/issues/282
|
||||
73
docs/upgrading.md
Normal file
73
docs/upgrading.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# Upgrading
|
||||
|
||||
Dokku is in active development. You can update the deployment step and the build step separately.
|
||||
|
||||
**Note**: If you are upgrading from a revision prior to [27d4bc8c3c](https://github.com/progrium/dokku/commit/27d4bc8c3c19fe580ef3e65f2f85b85101cd83e4), follow the instructions in [this wiki entry](https://github.com/progrium/dokku/wiki/Migrating-to-Dokku-0.2.0).
|
||||
|
||||
To update the deploy step (this is updated less frequently):
|
||||
|
||||
```bash
|
||||
cd ~/dokku
|
||||
git pull origin master
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Nothing needs to be restarted. Changes will take effect on the next push / deployment.
|
||||
|
||||
To update the build step:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/progrium/buildstep.git
|
||||
cd buildstep
|
||||
git pull origin master
|
||||
sudo make build
|
||||
```
|
||||
|
||||
This will build a fresh Ubuntu Quantal image, install a number of packages, and
|
||||
eventually replace the Docker image for buildstep.
|
||||
|
||||
## Migrating from 0.1.0 to 0.2.0
|
||||
|
||||
This should be summary of breaking changes between 0.1 and 0.2 version with instructions to upgrade.
|
||||
|
||||
### software-properties-common
|
||||
|
||||
software-properties-common is now a dependency for plugins. Before running dokku install script, make sure it is installed.
|
||||
|
||||
```bash
|
||||
> sudo apt-get install software-properties-common
|
||||
```
|
||||
|
||||
### Gitreceive removed
|
||||
|
||||
PR [#270](https://github.com/progrium/dokku/pull/270).
|
||||
|
||||
Starting with Dokku 0.2.0, [Gitrecieve](https://github.com/progrium/gitreceive) is replaced by a `git` plugin.
|
||||
|
||||
Dokku no longer uses the `git` user. Everything is done with the `dokku` user account.
|
||||
|
||||
This causes the remote url to change. Instead of pushing to `git@hostname:app`, you should now push to `dokku@hostname:app`.
|
||||
The url must be modified using the `git remote set-url` command :
|
||||
|
||||
git remote set-url deploy dokku@hostname:app
|
||||
|
||||
Where `deploy` is the name of the remote.
|
||||
|
||||
Additionally, the repositiories on the server must be migrated to work with dokku 0.2.0
|
||||
|
||||
There is an upgrade [script](https://gist.github.com/plietar/7201430), which is meant to automate this migration. To use it:
|
||||
|
||||
1. run the script as root
|
||||
2. `git pull` to get the latest version of dokku
|
||||
3. make install
|
||||
4. `dokku deploy:all`
|
||||
|
||||
TDB.
|
||||
|
||||
### Cache directory
|
||||
|
||||
Commit [#6350f373](https://github.com/progrium/dokku/commit/6350f373be2cef4f3bb90912099e1be6196522d1)
|
||||
|
||||
Buildstep have to be re-installed in order to support cache directory.
|
||||
|
||||
TDB.
|
||||
104
dokku
104
dokku
@@ -1,17 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
|
||||
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
|
||||
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
|
||||
|
||||
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
||||
export DOKKU_NOT_IMPLEMENTED_EXIT=10
|
||||
export DOKKU_VALID_EXIT=0
|
||||
|
||||
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
|
||||
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ $(id -un) != "dokku" && $1 != "plugins-install" ]]; then
|
||||
sudo -u dokku -H $0 "$@"
|
||||
if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then
|
||||
sudo -u dokku -E -H $0 "$@"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
|
||||
export -n SSH_ORIGINAL_COMMAND
|
||||
$0 $SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
receive)
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
@@ -30,7 +42,7 @@ case "$1" in
|
||||
|
||||
build)
|
||||
APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
id=$(cat | docker run -i -a stdin progrium/buildstep /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
id=$(cat | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
||||
@@ -57,28 +69,59 @@ case "$1" in
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
pluginhook pre-deploy $APP
|
||||
|
||||
# kill the app when running
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
docker inspect $oldid &> /dev/null && docker kill $oldid > /dev/null
|
||||
fi
|
||||
|
||||
# start the app
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP)
|
||||
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-9.]*://')
|
||||
|
||||
# if we can't post-deploy successfully, kill new container
|
||||
function kill_new {
|
||||
docker inspect $id &> /dev/null && docker kill $id > /dev/null
|
||||
trap - INT TERM EXIT
|
||||
kill -9 $$
|
||||
}
|
||||
|
||||
# run checks first, then post-deploy hooks, which switches Nginx traffic
|
||||
trap kill_new INT TERM EXIT
|
||||
echo "-----> Running pre-flight checks"
|
||||
pluginhook check-deploy $id $APP $port
|
||||
|
||||
# now using the new container
|
||||
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
|
||||
port=$(docker port $id 5000 | sed 's/0.0.0.0://')
|
||||
echo $port > "$DOKKU_ROOT/$APP/PORT"
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
|
||||
|
||||
pluginhook post-deploy $APP $port
|
||||
echo "-----> Running post-deploy"
|
||||
pluginhook post-deploy $APP $port
|
||||
trap - INT TERM EXIT
|
||||
|
||||
# kill the old container
|
||||
if [[ -n "$oldid" ]]; then
|
||||
# Let the old container finish processing requests, before terminating it
|
||||
WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
|
||||
echo "-----> Shutting down old container in $WAIT seconds"
|
||||
(
|
||||
exec >/dev/null 2>/dev/null </dev/null
|
||||
trap '' INT HUP
|
||||
sleep $WAIT
|
||||
docker kill $oldid
|
||||
) & disown -a
|
||||
# Use trap since disown/nohup don't seem to keep child alive
|
||||
# Give child process just enough time to set the traps
|
||||
sleep 0.1
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
cleanup)
|
||||
# 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
|
||||
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)
|
||||
@@ -89,26 +132,53 @@ case "$1" in
|
||||
pluginhook install
|
||||
;;
|
||||
|
||||
plugins-install-dependencies)
|
||||
pluginhook dependencies
|
||||
;;
|
||||
|
||||
plugins-update)
|
||||
pluginhook update
|
||||
;;
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
deploy:all)
|
||||
for app in $(ls -d $DOKKU_ROOT/*/); do
|
||||
APP=$(basename $app);
|
||||
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
|
||||
APP=$(basename $(dirname $app));
|
||||
dokku deploy $APP
|
||||
done
|
||||
;;
|
||||
|
||||
help)
|
||||
help|'')
|
||||
echo "Usage: dokku COMMAND <app> [command-specific-options]"
|
||||
echo ""
|
||||
|
||||
cat<<EOF | pluginhook commands help | sort
|
||||
help Print the list of commands
|
||||
plugins Print active plugins
|
||||
plugins-install Install active plugins
|
||||
help Print the list of commands
|
||||
plugins Print active plugins
|
||||
plugins-install Install active plugins
|
||||
plugins-update Update active plugins
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
for script in $(ls -d /var/lib/dokku/plugins/*/commands); do
|
||||
$script "$@"
|
||||
implemented=0
|
||||
for script in $(ls -d $PLUGIN_PATH/*/commands); do
|
||||
set +e; $script "$@" ; exit_code=$? ; set -e
|
||||
if [ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
implemented=1
|
||||
if [ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]; then
|
||||
exit $exit_code
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$implemented" -eq 0 ]; then
|
||||
echo " ! \`$@\` is not a dokku command."
|
||||
echo " ! See \`dokku help\` for a list of available commands."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
27
dokku.1
27
dokku.1
@@ -1,4 +1,4 @@
|
||||
.TH DOKKU 1 2014-03-08
|
||||
.TH DOKKU 1 2014-11-22
|
||||
.\"Make sure to change that date when you commit a change!
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -15,6 +15,15 @@ work with plugins and inspect the current state of your server.
|
||||
.\"
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI apps:create " <app>"
|
||||
Create a new app.
|
||||
.TP
|
||||
.BI apps:destroy " <app>"
|
||||
Permanantly destroy an app.
|
||||
.TP
|
||||
.B apps
|
||||
List your apps.
|
||||
.TP
|
||||
.BI backup:import " file"
|
||||
Import dokku config files.
|
||||
.TP
|
||||
@@ -33,18 +42,22 @@ Set one or more config vars for an app.
|
||||
.BI config:unset " <app> KEY1" \fR\ (KEY2\ \.\.\.)
|
||||
Remove one or more config vars from an app.
|
||||
.TP
|
||||
.BI delete " <app>"
|
||||
Delete an application.
|
||||
.TP
|
||||
.B help
|
||||
Print the list of commands.
|
||||
.TP
|
||||
.B logs \ \fI<app> \fR[\fI-t\fR]
|
||||
Show the last logs for an application (-t follows)
|
||||
.TP
|
||||
.BI nginx:import-ssl " <app>"
|
||||
Imports a tarball from stdin which should contain
|
||||
server\.crt and server\.key
|
||||
.TP
|
||||
.B plugins-install
|
||||
Install active plugins.
|
||||
.TP
|
||||
.B plugins-update
|
||||
Update active plugins.
|
||||
.TP
|
||||
.B plugins
|
||||
Print active plugins.
|
||||
.TP
|
||||
@@ -56,3 +69,9 @@ Show the url for an app.
|
||||
.TP
|
||||
.B 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.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
@@ -15,4 +16,3 @@ for app in $APPS; do
|
||||
done
|
||||
|
||||
exit $ret
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
|
||||
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
||||
mkdir -p $TARGET_DIR/.ssh
|
||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
|
||||
chmod 0700 $TARGET_DIR/.ssh
|
||||
chmod 0600 $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
|
||||
chmod 0700 $TARGET_DIR/.ssh
|
||||
chmod 0600 $TARGET_DIR/.ssh/*
|
||||
fi
|
||||
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME
|
||||
[[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST
|
||||
|
||||
@@ -1,40 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
delete)
|
||||
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 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
|
||||
dokku apps:destroy $2
|
||||
;;
|
||||
|
||||
logs)
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Please specify an app to run the command on"
|
||||
exit 1
|
||||
fi
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2";
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
|
||||
@@ -49,15 +24,10 @@ case "$1" in
|
||||
;;
|
||||
|
||||
run)
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Please specify an app to run the command on"
|
||||
exit 1
|
||||
fi
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP)
|
||||
@@ -65,16 +35,14 @@ case "$1" in
|
||||
;;
|
||||
|
||||
url)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2";
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
||||
echo $(< "$DOKKU_ROOT/$APP/URL")
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
|
||||
version)
|
||||
cat "$DOKKU_ROOT/VERSION" || {
|
||||
@@ -85,7 +53,6 @@ case "$1" in
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
delete <app> Delete an application
|
||||
logs <app> [-t] Show the last logs for an application (-t follows)
|
||||
run <app> <cmd> Run a command in the environment of an application
|
||||
url <app> Show the URL for an application
|
||||
@@ -93,5 +60,8 @@ case "$1" in
|
||||
EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||
fi
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
# redeploys all apps after a reboot
|
||||
cat<<EOF > /etc/init/dokku-redeploy.conf
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
cat<<EOF > /etc/init/dokku-redeploy.conf
|
||||
description "Dokku app redeploy service"
|
||||
|
||||
start on (started docker)
|
||||
@@ -17,3 +19,21 @@ script
|
||||
sudo -i -u dokku /usr/local/bin/dokku deploy:all
|
||||
end script
|
||||
EOF
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
cat<<EOF > /etc/systemd/system/dokku-redeploy.service
|
||||
[Unit]
|
||||
Description=Dokku app redeploy service
|
||||
After=docker.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=dokku
|
||||
ExecStart=/usr/local/bin/dokku deploy:all
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -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 {} \;
|
||||
|
||||
|
||||
63
plugins/apps/commands
Executable file
63
plugins/apps/commands
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/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)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -d "$DOKKU_ROOT/$APP" ]] && echo " ! Name is already taken" && exit 1
|
||||
APP="$2"
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP"
|
||||
echo "Creating $APP... done"
|
||||
;;
|
||||
|
||||
apps:destroy)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
[[ "$2" == "tls" ]] && echo "Unable to destroy tls directory" && exit 1
|
||||
APP="$2"; IMAGE="dokku/$APP";
|
||||
|
||||
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 | apps:help)
|
||||
cat && cat<<EOF
|
||||
apps List your apps
|
||||
apps:create <app> Create a new app
|
||||
apps:destroy <app> Permanently destroy an app
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
[[ -n $1 ]] && rm -r "$DOKKU_ROOT/$1" > /dev/null
|
||||
7
plugins/apps/pre-delete
Executable file
7
plugins/apps/pre-delete
Executable 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
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
CURRENT_BACKUP_VERSION=1
|
||||
set -e; case "$1" in
|
||||
|
||||
case "$1" in
|
||||
backup:export)
|
||||
OUTPUT_FILE="$2"
|
||||
BACKUP_DIR="$DOKKU_ROOT"
|
||||
@@ -24,9 +26,9 @@ set -e; case "$1" in
|
||||
|
||||
# if no file specified, output to stdout
|
||||
if [[ -z $OUTPUT_FILE ]]; then
|
||||
cat $BACKUP_TMP_FILE
|
||||
cat $BACKUP_TMP_FILE
|
||||
else
|
||||
mv $BACKUP_TMP_FILE $OUTPUT_FILE
|
||||
mv $BACKUP_TMP_FILE $OUTPUT_FILE
|
||||
fi
|
||||
|
||||
rm -rf $BACKUP_TMP_DIR
|
||||
@@ -48,14 +50,14 @@ set -e; case "$1" in
|
||||
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
|
||||
|
||||
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
|
||||
echo "Unable to determine backup version"
|
||||
exit 1
|
||||
echo "Unable to determine backup version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
|
||||
if [[ $VERSION -ne 1 ]]; then
|
||||
echo "Unknown format version $VERSION"
|
||||
exit 1
|
||||
echo "Unknown format version $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Importing a version $VERSION backup..."
|
||||
@@ -83,12 +85,15 @@ set -e; case "$1" in
|
||||
echo "Import complete."
|
||||
;;
|
||||
|
||||
help)
|
||||
help | backup:help)
|
||||
cat && cat<<EOF
|
||||
backup:export [file] Export dokku configuration files
|
||||
backup:import [file] Import dokku configuration files
|
||||
EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
75
plugins/checks/check-deploy
Executable file
75
plugins/checks/check-deploy
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Hook to check server against list of checks specified in CHECKS file. Each
|
||||
# check is a relative path and, optionally, expected content.
|
||||
#
|
||||
# For example:
|
||||
# / My Amazing App
|
||||
# /stylesheets/index.css .body
|
||||
# /scripts/index.js $(function()
|
||||
# /images/logo.png
|
||||
#
|
||||
# Waits 5 seconds, giving server time to start, before running the checks. For
|
||||
# shorter/longer wait, change the DOKKU_CHECKS_WAIT environment variable (value
|
||||
# in seconds).
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
|
||||
|
||||
# source in app env to get DOKKU_CHECKS_WAIT and any other necessary vars
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
# echo "DOKKU_CHECKS_WAIT is $DOKKU_CHECKS_WAIT"
|
||||
FILENAME="$DOKKU_ROOT/$APP/CHECKS"
|
||||
WAIT="${DOKKU_CHECKS_WAIT:-5}"
|
||||
|
||||
# try to copy CHECKS from container if not in APP dir & quit gracefully if it doesn't exist
|
||||
# docker cp exits with status 1 when run as non-root user when it tries to chown the file
|
||||
# after successfully copying the file. Thus, we suppress stderr.
|
||||
# ref: https://github.com/dotcloud/docker/issues/3986
|
||||
if [[ ! -f "$FILENAME" ]] ; then
|
||||
echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..."
|
||||
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
|
||||
docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true
|
||||
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
||||
echo " CHECKS file not found in container. skipping checks."
|
||||
rm -rf $TMPDIR
|
||||
exit 0
|
||||
else
|
||||
echo " CHECKS file found in container"
|
||||
FILENAME=${TMPDIR}/CHECKS
|
||||
|
||||
function cleanup() {
|
||||
echo " removing CHECKS file copied from container"
|
||||
rm -rf $TMPDIR
|
||||
}
|
||||
trap cleanup EXIT
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Waiting $WAIT seconds ..."
|
||||
sleep $WAIT
|
||||
|
||||
# -q do not use .curlrc (must come first)
|
||||
# --compressed Test compression handled correctly
|
||||
# --fail Fail on server errors (4xx, 5xx)
|
||||
# --location Follow redirects
|
||||
CURL_OPTIONS="-q --compressed --fail --location --max-time 30"
|
||||
|
||||
cat "$FILENAME" | while read PATHNAME EXPECTED ; do
|
||||
# Ignore empty lines and lines starting with #
|
||||
[[ -z "$PATHNAME" || "$PATHNAME" =~ ^\# ]] && continue
|
||||
|
||||
URL="http://$HOSTNAME:$PORT$PATHNAME"
|
||||
|
||||
echo "checking with: curl $CURL_OPTIONS $URL"
|
||||
HTML=$(curl $CURL_OPTIONS $URL)
|
||||
if [[ -n "$EXPECTED" && ! "$HTML" =~ "$EXPECTED" ]] ; then
|
||||
echo -e "\033[31m\033[1m$URL: expected to but did not find: \"$EXPECTED\"\033[0m"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\033[32m\033[1m$URL => \"$EXPECTED\"\033[0m"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\033[32m\033[1mAll checks successful!\033[0m"
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
@@ -7,5 +8,5 @@ TARGET_DIR="$3"
|
||||
|
||||
cd $IMPORT_DIR
|
||||
for file in */ENV; do
|
||||
cp $file "$TARGET_DIR/$file"
|
||||
cp $file "$TARGET_DIR/$file"
|
||||
done
|
||||
|
||||
@@ -1,42 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# Check if name is specified
|
||||
if [[ $1 == config ]] || [[ $1 == config:* ]]; then
|
||||
if [[ -z $2 ]]; then
|
||||
echo "You must specify an app name"
|
||||
exit 1
|
||||
else
|
||||
APP="$2"
|
||||
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
|
||||
# Check if app exists with the same name
|
||||
if [ ! -d "$DOKKU_ROOT/$APP" ]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -f $ENV_FILE ] || {
|
||||
echo "-----> Creating $ENV_FILE"
|
||||
touch $ENV_FILE
|
||||
}
|
||||
fi
|
||||
fi
|
||||
ENV_FILE="$DOKKU_ROOT/$2/ENV"
|
||||
ENV_FILE_TEMP="$DOKKU_ROOT/$2/ENV.tmp"
|
||||
config_create () {
|
||||
[ -f $ENV_FILE ] || {
|
||||
echo "-----> Creating $ENV_FILE"
|
||||
touch $ENV_FILE
|
||||
}
|
||||
}
|
||||
|
||||
config_styled_hash () {
|
||||
vars=`echo -e "$1"`
|
||||
vars="$1"
|
||||
prefix="$2"
|
||||
|
||||
longest=""
|
||||
for word in $vars; do
|
||||
while read -r word; do
|
||||
KEY=`echo $word | cut -d"=" -f1`
|
||||
if [ ${#KEY} -gt ${#longest} ]; then
|
||||
longest=$KEY
|
||||
fi
|
||||
done
|
||||
done <<< "$vars"
|
||||
|
||||
for word in $vars; do
|
||||
while read -r word; do
|
||||
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}))
|
||||
zeros=" "
|
||||
@@ -44,32 +32,44 @@ config_styled_hash () {
|
||||
zeros="$zeros "
|
||||
num_zeros=$(($num_zeros - 1))
|
||||
done
|
||||
echo "$KEY:$zeros$VALUE"
|
||||
done
|
||||
echo "$prefix$KEY:$zeros$VALUE"
|
||||
done <<< "$vars"
|
||||
}
|
||||
|
||||
config_restart_app() {
|
||||
APP="$1";
|
||||
|
||||
echo "-----> Releasing $APP ..."
|
||||
dokku release $APP
|
||||
echo "-----> Release complete!"
|
||||
echo "-----> Deploying $APP ..."
|
||||
dokku deploy $APP
|
||||
echo "-----> Deploy complete!"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
echo "-----> Releasing $APP ..."
|
||||
dokku release $APP
|
||||
echo "-----> Release complete!"
|
||||
echo "-----> Deploying $APP ..."
|
||||
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
|
||||
|
||||
config)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2"
|
||||
|
||||
if [ ! -f $ENV_FILE ] || [ ! -s $ENV_FILE ] ; then
|
||||
echo "$APP has no config vars"
|
||||
exit 1
|
||||
fi
|
||||
config_create
|
||||
[[ ! -s $ENV_FILE ]] && echo "$APP has no config vars" && exit 1
|
||||
|
||||
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
|
||||
if [[ "$var" == "--shell" ]]; then
|
||||
@@ -80,38 +80,47 @@ case "$1" in
|
||||
|
||||
echo "=== $APP config vars ==="
|
||||
config_styled_hash "$VARS"
|
||||
;;
|
||||
;;
|
||||
|
||||
config:get)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:get APP KEY"
|
||||
echo "Must specify KEY."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $ENV_FILE ] || [ ! -s $ENV_FILE ] ; then
|
||||
exit 1
|
||||
config_create
|
||||
if [[ ! -s $ENV_FILE ]] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2"
|
||||
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
|
||||
config_create
|
||||
ENV_ADD=""
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
RESTART=false
|
||||
VARS="${*:3}"
|
||||
RESTART_APP=false
|
||||
shift 2
|
||||
|
||||
for var in $VARS; do
|
||||
for var; do
|
||||
if [[ $var != *"="* ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
@@ -119,36 +128,41 @@ case "$1" in
|
||||
fi
|
||||
done
|
||||
|
||||
for var in $VARS; do
|
||||
for var; do
|
||||
KEY=`echo ${var} | cut -d"=" -f1`
|
||||
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
|
||||
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="${ENV_ADD}\n${var}"
|
||||
ENV_ADD="${ENV_ADD}$
|
||||
${var}"
|
||||
fi
|
||||
done
|
||||
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
|
||||
|
||||
if [ $RESTART_APP ]; then
|
||||
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_restart_app $APP
|
||||
config_write "$ENV_TEMP"
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
|
||||
config:unset)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
|
||||
echo "Must specify KEY to unset."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
|
||||
config_create
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
VARS="${*:3}"
|
||||
|
||||
@@ -156,19 +170,21 @@ case "$1" in
|
||||
echo "-----> Unsetting $var and restarting $APP"
|
||||
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
|
||||
|
||||
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE
|
||||
config_restart_app $APP
|
||||
config_write "$ENV_TEMP"
|
||||
done
|
||||
;;
|
||||
;;
|
||||
|
||||
help)
|
||||
help | config:help)
|
||||
cat && cat<<EOF
|
||||
config <app> display the config vars 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:unset <app> KEY1 [KEY2 ...] unset one or more config vars
|
||||
config <app> Display the config vars 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:unset <app> KEY1 [KEY2 ...] Unset one or more config vars
|
||||
EOF
|
||||
;;
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
APPS="$4"
|
||||
|
||||
while read APP; do
|
||||
APP_PATH="$TARGET_DIR/$APP";
|
||||
git init --bare $APP_PATH > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > $PRERECEIVE_HOOK <<EOF
|
||||
while read APP; do
|
||||
APP_PATH="$TARGET_DIR/$APP";
|
||||
git init --bare $APP_PATH > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > $PRERECEIVE_HOOK <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e; set -o pipefail;
|
||||
|
||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||
EOF
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
done < $APPS > /dev/null
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
git_archive_all() {
|
||||
APP=$1; REV=$2
|
||||
TMP_WORK_DIR=$(mktemp -d)
|
||||
chmod 755 $TMP_WORK_DIR
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR > /dev/null
|
||||
pushd $TMP_WORK_DIR > /dev/null
|
||||
git config advice.detachedHead false
|
||||
git checkout $REV > /dev/null
|
||||
git submodule update --init --recursive > /dev/null
|
||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||
tar c .
|
||||
popd > /dev/null
|
||||
rm -rf $TMP_WORK_DIR > /dev/null
|
||||
APP=$1; REV=$2
|
||||
TMP_WORK_DIR=$(mktemp -d)
|
||||
chmod 755 $TMP_WORK_DIR
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
git clone -q $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
|
||||
pushd $TMP_WORK_DIR > /dev/null
|
||||
git config advice.detachedHead false
|
||||
git checkout $REV &> /dev/null
|
||||
git submodule update --init --recursive &> /dev/null
|
||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||
tar c .
|
||||
popd > /dev/null
|
||||
rm -rf $TMP_WORK_DIR > /dev/null
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -31,31 +31,42 @@ case "$1" in
|
||||
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'"
|
||||
fi
|
||||
|
||||
done
|
||||
;;
|
||||
|
||||
git-upload-pack)
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
pluginhook git-pre-pull $APP
|
||||
cat | git-upload-pack "$DOKKU_ROOT/$APP"
|
||||
pluginhook git-post-pull $APP
|
||||
;;
|
||||
|
||||
git-*)
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||
git init --bare $APP_PATH > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > $PRERECEIVE_HOOK <<EOF
|
||||
git init --bare $APP_PATH > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > $PRERECEIVE_HOOK <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e; set -o pipefail;
|
||||
|
||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||
EOF
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
fi
|
||||
|
||||
args=$@
|
||||
git-shell -c "$args"
|
||||
;;
|
||||
|
||||
help)
|
||||
help | git:help)
|
||||
cat
|
||||
;;
|
||||
esac
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
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
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
@@ -7,7 +8,7 @@ TARGET_DIR="$3"
|
||||
|
||||
cd $IMPORT_DIR
|
||||
|
||||
for file in */ssl/server.*; do
|
||||
mkdir -p $(dirname $TARGET_DIR$file)
|
||||
cp $file $TARGET_DIR$file
|
||||
for file in */tls/server.*; do
|
||||
mkdir -p $(dirname $TARGET_DIR$file)
|
||||
cp $file $TARGET_DIR$file
|
||||
done
|
||||
|
||||
@@ -2,8 +2,32 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help)
|
||||
cat
|
||||
;;
|
||||
esac
|
||||
nginx:import-ssl)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
[[ -t 0 ]] && echo "Tar archive containing server.crt and server.key expected on stdin" && exit 1
|
||||
APP="$2"
|
||||
|
||||
TEMP_DIR=`mktemp -d`
|
||||
cd $TEMP_DIR
|
||||
tar xvf - <&0
|
||||
[[ -f "$TEMP_DIR/server.crt" ]] && echo "Tar archive missing server.crt" && exit 1
|
||||
[[ -f "$TEMP_DIR/server.key" ]] && echo "Tar archive missing server.key" && exit 1
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP/tls"
|
||||
mv "$TEMP_DIR/server.crt" "$DOKKU_ROOT/$APP/tls/server.crt"
|
||||
mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key"
|
||||
rm -rf $TEMP_DIR
|
||||
;;
|
||||
|
||||
help | nginx:help)
|
||||
cat && cat<<EOF
|
||||
nginx:import-ssl <app> Imports a tarball from stdin; should contain server.crt and server.key
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
15
plugins/nginx-vhosts/dependencies
Executable file
15
plugins/nginx-vhosts/dependencies
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
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
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
zypper -q in -y nginx bind-utils
|
||||
;;
|
||||
esac
|
||||
@@ -1,36 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
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 [[ ! -f /etc/sudoers.d/dokku-nginx ]]; then
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
|
||||
if ! grep -q dokku-nginx-reload "/etc/sudoers"; then
|
||||
touch /etc/sudoers.tmp
|
||||
cp /etc/sudoers /tmp/sudoers.new
|
||||
echo "%dokku ALL=(ALL)NOPASSWD:/etc/init.d/nginx reload # dokku-nginx-reload" >> /tmp/sudoers.new
|
||||
EDITOR="cp /tmp/sudoers.new" visudo
|
||||
rm /tmp/sudoers.new
|
||||
opensuse)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
esac
|
||||
|
||||
chmod 0440 /etc/sudoers.d/dokku-nginx
|
||||
fi
|
||||
|
||||
cat<<EOF > /etc/nginx/conf.d/dokku.conf
|
||||
# if dokku.conf has not been created, create it
|
||||
if [[ ! -f /etc/nginx/conf.d/dokku.conf ]]; then
|
||||
cat<<EOF > /etc/nginx/conf.d/dokku.conf
|
||||
include $DOKKU_ROOT/*/nginx.conf;
|
||||
|
||||
ssl_session_cache shared:SSL:20m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!CAMELLIA;
|
||||
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
|
||||
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
#ssl_certificate $DOKKU_ROOT/tls/server.crt;
|
||||
#ssl_certificate_key $DOKKU_ROOT/tls/server.key;
|
||||
EOF
|
||||
sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf
|
||||
fi
|
||||
|
||||
echo 'server_names_hash_bucket_size 64;' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
fi
|
||||
|
||||
/etc/init.d/nginx start
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
/etc/init.d/nginx start
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
/sbin/service nginx start
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
sudo /sbin/service nginx reload > /dev/null
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; PORT="$2"
|
||||
WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||
SSL="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
set +e
|
||||
NO_VHOST=$(dokku config:get $APP NO_VHOST)
|
||||
set -e
|
||||
|
||||
if [[ -n "$NO_VHOST" ]]; then
|
||||
echo "-----> NO_VHOST config detected"
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" && ! -n "$NO_VHOST" ]]; then
|
||||
VHOST=$(< "$DOKKU_ROOT/VHOST")
|
||||
SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
else
|
||||
hostname="${APP/\//-}.$VHOST"
|
||||
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
|
||||
if [[ ! -n $hostname ]]; then
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
else
|
||||
hostname="${APP/\//-}.$VHOST"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
|
||||
@@ -25,9 +37,9 @@ EOF
|
||||
SSL_DIRECTIVES=""
|
||||
fi
|
||||
|
||||
# ssl based nginx.conf
|
||||
if [[ -n "$SSL_INUSE" ]]; then
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
|
||||
echo "-----> Creating ssl nginx.conf"
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
|
||||
upstream $APP { server 127.0.0.1:$PORT; }
|
||||
server {
|
||||
listen [::]:80;
|
||||
@@ -56,13 +68,14 @@ $SSL_DIRECTIVES
|
||||
proxy_set_header X-Forwarded-Port \$server_port;
|
||||
proxy_set_header X-Request-Start \$msec;
|
||||
}
|
||||
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL"
|
||||
else
|
||||
# default nginx.conf
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
|
||||
echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL"
|
||||
else
|
||||
echo "-----> Creating non-ssl nginx.conf"
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
|
||||
upstream $APP { server 127.0.0.1:$PORT; }
|
||||
server {
|
||||
listen [::]:80;
|
||||
@@ -79,11 +92,44 @@ server {
|
||||
proxy_set_header X-Forwarded-Port \$server_port;
|
||||
proxy_set_header X-Request-Start \$msec;
|
||||
}
|
||||
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "http://$hostname" > "$DOKKU_ROOT/$APP/URL"
|
||||
echo "http://$hostname" > "$DOKKU_ROOT/$APP/URL"
|
||||
fi
|
||||
|
||||
echo "-----> Running nginx-pre-reload"
|
||||
pluginhook nginx-pre-reload $APP $PORT
|
||||
|
||||
echo " Reloading nginx"
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
sudo /sbin/service nginx reload > /dev/null
|
||||
;;
|
||||
esac
|
||||
else
|
||||
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
||||
echo "------> NO_VHOST set, deleting $APP/URL"
|
||||
rm "$DOKKU_ROOT/$APP/URL"
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
echo "------> NO_VHOST set, deleting $APP/nginx.conf"
|
||||
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
echo "------> NO_VHOST set, reloading nginx after nginx.conf deletion"
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
sudo /sbin/service nginx reload > /dev/null
|
||||
;;
|
||||
esac
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
fi
|
||||
pluginhook nginx-pre-reload $APP
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
#!/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"
|
||||
}
|
||||
@@ -4,5 +4,5 @@ set -ex;
|
||||
REMOTE=$1
|
||||
REPO=$2
|
||||
|
||||
ssh $REMOTE config:set $REPO CONFTEST=config-test
|
||||
ssh $REMOTE config:set $REPO CONFTEST=config-test HELLO=\"Hello world\"
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ app.get('/', function(request, response) {
|
||||
response.send(process.env.CONFTEST);
|
||||
});
|
||||
|
||||
app.get('/hello', function(request, response) {
|
||||
response.send(process.env.HELLO);
|
||||
});
|
||||
|
||||
var port = process.env.PORT || 5000;
|
||||
app.listen(port, function() {
|
||||
console.log("Listening on " + port);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<<EOF > /etc/rc.local
|
||||
curl https://raw.github.com/progrium/dokku/master/tests/ci/receiver -s > /tmp/receiver
|
||||
chmod +x /tmp/receiver
|
||||
EOF
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user