Compare commits

..

589 Commits
dev ... v0.3.14

Author SHA1 Message Date
Jose Diaz-Gonzalez
c35a024d39 Release 0.3.14 2015-02-06 14:06:29 -05:00
Michael Hobbs
a02f32e985 Merge pull request #949 from progrium/mh-common-functions
first stab at a common functions library. include argument parsing and a few definitions wired up. closes #932. closes #945
2015-02-06 10:48:03 -08:00
Michael Hobbs
9164740117 rename log functions with dokku_log_ prefix 2015-02-06 08:28:14 -08:00
Michael Hobbs
371ba99540 include echo functions that don't print when quiet arg is passed 2015-02-05 12:38:59 -08:00
Michael Hobbs
6ad65dd9b4 first stab at a common functions library. include argument parsing and a few definitions wired up. closes #932. closes #945 2015-02-05 11:32:46 -08:00
Jose Diaz-Gonzalez
72a58bbda3 Merge pull request #927 from progrium/906-mh-docker-args-phase-pluginhooks
support both docker-args PHASE and docker-args-PHASE for the time being. closes #906
2015-02-04 11:13:14 -05:00
Michael Hobbs
30d660335f Merge pull request #941 from progrium/931-mh-source-glabal-env-deploy-run
source global env prior to app env. closes #931
2015-02-04 07:32:12 -08:00
Jose Diaz-Gonzalez
d891e2214a Merge pull request #942 from progrium/mh-clojure-test-app
test clojure app
2015-02-03 20:43:07 -05:00
Michael Hobbs
1c02ef9674 test clojure app 2015-02-03 16:46:04 -08:00
Michael Hobbs
b48464a7e2 Merge pull request #925 from progrium/mh-ps-rebuild
implement rebuild command that reuses git_archive_all
2015-02-03 14:56:44 -08:00
Michael Hobbs
5fb30ab934 source global env prior to app env. closes #931 2015-02-03 13:47:20 -08:00
Jose Diaz-Gonzalez
89df6eeded Merge pull request #936 from progrium/929-mh-conditionally-run-buildstack
only execute build stack if we have access to /var/run/docker.sock. closes #929
2015-02-03 15:47:47 -05:00
Jose Diaz-Gonzalez
2a4caf95b4 Merge pull request #938 from vincentfretin/patch-6
enable ssl_prefer_server_ciphers
2015-02-03 15:46:43 -05:00
Jose Diaz-Gonzalez
edfb2ab990 Merge pull request #940 from progrium/mh-valid-composer-json
use valid composer json with specified php runtime
2015-02-03 15:46:34 -05:00
Michael Hobbs
bf7b44f215 use valid composer json with specified php runtime 2015-02-03 08:57:44 -08:00
Vincent Fretin
955f95e899 enable ssl_prefer_server_ciphers
Since we create /etc/nginx/nginx.conf we don't have "ssl_prefer_server_ciphers on" option enabled anymore, enable it in dokku.conf
2015-02-03 09:52:18 +01:00
Michael Hobbs
14bff0679f only execute build stack if we have access to /var/run/docker.sock. closes #929 2015-02-02 15:46:57 -08:00
Jose Diaz-Gonzalez
2dad1afa57 Merge pull request #933 from progrium/930-mh-nginx-sslcrt-docs
[ci skip] remove references to .pem. closes #930
2015-02-02 11:56:54 -05:00
Michael Hobbs
e8118d1af8 [ci skip] remove references to .pem. closes #930 2015-02-02 08:56:06 -08:00
Jeff Lindsay
9b6322e96b Update index.md
clarifying multitenancy
2015-02-01 14:08:49 -06:00
Michael Hobbs
1b22f69b9e support both docker-args PHASE and docker-args-PHASE for the time being. closes #906 2015-01-29 18:33:20 -08:00
Michael Hobbs
be8e4ab014 Merge pull request #926 from dyson/patch-1
Update Troubleshooting link in README.md.
2015-01-28 18:38:48 -08:00
Dyson Simmons
ce89c021ab Update Troubleshooting link in README.md. 2015-01-29 13:36:12 +11:00
Michael Hobbs
c96d139f54 use flock when (re)building/deploying 2015-01-28 16:18:57 -08:00
Michael Hobbs
ef369eb02f really make circle fail unit tests before trying deploy tests 2015-01-27 16:33:36 -08:00
Michael Hobbs
9f985077c7 implement rebuild command that reuses git_archive_all 2015-01-27 15:00:00 -08:00
Jose Diaz-Gonzalez
2a756ff3a4 Merge pull request #922 from progrium/921-mh-use-tty-to-detect-tty
use tty cmd to detect if we have one. closes #921
2015-01-25 21:45:13 -05:00
Michael Hobbs
4ad0c3022e use tty cmd to detect if we have one. closes #921 2015-01-24 20:00:11 -08:00
Jose Diaz-Gonzalez
013eafd8df Merge pull request #917 from progrium/649-mh-resolvconf-doc
[ci skip] document resolvconf troubleshooting step. closes #649
2015-01-23 16:15:38 -05:00
Michael Hobbs
d871d2f292 [ci skip] document resolvconf troubleshooting step. closes #649 2015-01-23 13:05:11 -08:00
Jose Diaz-Gonzalez
c5f0639267 Merge pull request #915 from progrium/650-mh-nginx-default-site-docs
[ci skip] document default sites in nginx. closes #650
2015-01-22 20:33:02 -05:00
Jose Diaz-Gonzalez
f99915b682 Merge pull request #916 from progrium/841-mh-troubleshooting-build-phase
[ci skip] document build phase troubleshooting suggestions. closes #841. closes #911.
2015-01-22 20:32:43 -05:00
Michael Hobbs
a1acc5e1fd [ci skip] document build phase troubleshooting suggestions. closes #841. closes #911. 2015-01-22 16:59:07 -08:00
Michael Hobbs
d8c564d926 [ci skip] document default sites in nginx. closes #650 2015-01-22 16:18:47 -08:00
Michael Hobbs
55892d7743 Merge pull request #914 from progrium/552-913-conditional-tty-on-run
conditionally set interactive and tty on dokku run
2015-01-21 18:22:44 -08:00
Michael Hobbs
3e100e3002 conditionally set interactive and tty on dokku run.
closes #552
closes #913
2015-01-21 13:49:46 -08:00
Jose Diaz-Gonzalez
40d1f22d74 Merge pull request #907 from vincentfretin/patch-5
Don't use -o pipefail for plugin
2015-01-20 14:48:19 -05:00
Vincent Fretin
b81a6c398d document issue with 'set -eo pipefail' option 2015-01-19 08:55:19 +01:00
Jose Diaz-Gonzalez
b8851a66cf Merge pull request #894 from progrium/dokku-client
Dokku client
2015-01-18 17:43:09 -05:00
Michael Hobbs
2ff2ca55c1 drop support for create/delete in favor of standard apps:create and apps:destroy 2015-01-17 16:24:50 -08:00
Jose Diaz-Gonzalez
fb3492c824 Merge pull request #905 from vincentfretin/patch-4
robv/dokku-elasticsearch not compatible with latest version
2015-01-17 13:53:23 -05:00
Vincent Fretin
32f47d31b2 robv/dokku-elasticsearch not compatible with latest version 2015-01-17 15:30:54 +01:00
Jose Diaz-Gonzalez
fbc96d92b5 Merge pull request #904 from progrium/mh-nullglob-in-ps-restartall
prevent error on restartall when no apps deployed
2015-01-17 04:11:45 -05:00
Michael Hobbs
666f2d7434 add random app generator in bash. support create and delete verbs. tested on bash 4.3.18 and 3.2.53 2015-01-16 18:46:55 -08:00
Michael Hobbs
d7830fa730 prevent error on restartall when no apps deployed 2015-01-16 17:41:32 -08:00
Jose Diaz-Gonzalez
00babb5ff5 Merge pull request #887 from progrium/debian-packaging
Debian packaging
2015-01-16 18:50:25 -05:00
Michael Hobbs
161111aab5 lintball client. add tests. add help message 2015-01-16 15:19:14 -08:00
Michael Hobbs
cb39110904 new assertion for a specific exit status 2015-01-16 15:18:24 -08:00
Michael Hobbs
c7bd7119b8 assert on intermediate steps 2015-01-16 14:59:01 -08:00
Michael Hobbs
fda3a08c83 shellcheck dokku_client with specific exclusion 2015-01-16 14:58:41 -08:00
Michael Hobbs
55c2b0fd62 allow force override 2015-01-16 14:57:49 -08:00
Jose Diaz-Gonzalez
e35493e248 unquote variables 2015-01-16 17:07:51 -05:00
Jose Diaz-Gonzalez
ca9443669f Separate package_cloud target from packer build 2015-01-16 17:05:35 -05:00
Jose Diaz-Gonzalez
dc64759a97 Use doublequotes to prevent whitespace problems 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
45120c5e43 Pull DOKKU_HOST from dokku remote host if not otherwise set 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
7f99fcb844 Use double-square brackets in if test 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
d8fa69c5f4 formatting 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
1eb01db8f9 Add ability to alias dokku_client.sh as dokku command locally 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
aec4543b61 Properly retrieve and parse the app name from git remote 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
3e05a8c8ac formatting 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
0af71abe12 Exit with exit code from ssh command 2015-01-16 16:57:26 -05:00
Jose Diaz-Gonzalez
34895630fd Add DOKKU_TRACE support to turn on command tracing 2015-01-16 16:57:25 -05:00
Jose Diaz-Gonzalez
cd65704c5e Force usage of bash to run command 2015-01-16 16:57:25 -05:00
Jose Diaz-Gonzalez
f293e9026d Better dokku-client bash formatting 2015-01-16 16:57:25 -05:00
Jose Diaz-Gonzalez
8f21a38160 Add a release target to make 2015-01-16 16:56:16 -05:00
Jose Diaz-Gonzalez
077c6a1b89 Add a packer.json file to automate building Digital Ocean Images from debian packages 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
3d49dbb1a7 Add debian package package to readme 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
4656e80ab8 Move dokku-installer start to postinst
Performing the start in preinst meant that the required dokku-installer.rb file was not yet in position.
2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
87b7a74cf0 Copy the id_rsa.pub key to the vm where possible
This allows dokku-installer to automatically list the public key in it's UI
2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
20bb7caef4 Change dokku-installer.rb path to the contrib directory
This should avoid issues when testing via vagrant where the /root/dokku directory is not yet mounted. This is also more correct for cloud-installs
2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
d9026a9974 Remove configuration files if they already exist 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
2b9a31f06d Add empty virtualmachine for testing purposes 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
3fdc1d20b6 Only start the dokku-installer if it's not already running
Upgrades from previous - fresh - dokku versions will fail if the dokku-installer is already running.
2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
0fcc541e4f Force remove sites-enabled directory, even when empty 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
8fba61e212 Fix go build command 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
9c68bda9b4 Fix temporary directory creation 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
9e396a1b42 Add a few items to the gitignore 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
92610f347f Add new Vagrant machines for both installation from deb (dokku-deb) and building debian packages (build) 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
b6767f8efc Add new make targets to build and install dokku debian packages 2015-01-16 16:52:50 -05:00
Jose Diaz-Gonzalez
8c8745ca4c Merge pull request #903 from progrium/mh-reorder-circle-tasks
move shorter running tests into pre test phase
2015-01-16 16:51:36 -05:00
Jose Diaz-Gonzalez
992ac973cc Merge pull request #902 from progrium/install-help2man
Install help2man
2015-01-16 16:47:57 -05:00
Michael Hobbs
7d9adaffc3 move shorter running tests into pre test phase 2015-01-16 13:04:27 -08:00
Michael Hobbs
78238785ba help2man needs dokku in place to get output 2015-01-16 13:03:48 -08:00
Jose Diaz-Gonzalez
6e7c887d5f Install help2man 2015-01-16 15:26:57 -05:00
Jose Diaz-Gonzalez
6b80d1e0f2 Merge pull request #899 from joliv/master
Use help2man to automatically generate man pages
2015-01-16 15:23:14 -05:00
Jose Diaz-Gonzalez
19871fe81d Merge pull request #900 from progrium/mh-nginx-ssl-san-hostname
support extracting SANs from SSL certificates and adding them to nginx config
2015-01-16 15:22:15 -05:00
Jose Diaz-Gonzalez
514d66f40d Merge pull request #891 from progrium/keep-old
Keep existing configuration files when installing nginx. Refs #886
2015-01-16 15:19:57 -05:00
Jose Diaz-Gonzalez
22088f5d82 Merge pull request #897 from progrium/mh-ps-plugin
initial pass at a ps plugin
2015-01-16 14:59:12 -05:00
Jose Diaz-Gonzalez
59baadef06 Merge pull request #901 from misto/patch-1
Pull new tags when upgrading to update VERSION
2015-01-16 12:27:29 -05:00
Mirko Stocker
cb6213adee Pull new tags when upgrading to update VERSION
During an upgrade, the output of `git describe --tags` is written to the VERSION file, so we need to pull the tags otherwise it looks like we're running an old version.
2015-01-16 11:25:20 +01:00
Michael Hobbs
40e628778b revive deploy:all with deprecation warning 2015-01-15 15:43:03 -08:00
Michael Hobbs
6cd89fa72a support extracting SANs from SSL certificates and adding them to nginx config 2015-01-15 12:08:27 -08:00
joliv
2d96bd2939 Add "Options:" header to help text
Makes it easier to be parsed by `help2man`
2015-01-15 12:13:55 -05:00
joliv
cbba084cb8 Use help2man to automatically generate man pages 2015-01-15 11:28:28 -05:00
Jose Diaz-Gonzalez
31c6444dae Merge pull request #898 from joliv/master
Update man page for 0.3.13
2015-01-15 11:04:23 -05:00
joliv
d6ad9f0e85 Update man page for 0.3.13
Some new commands, one deprecated, and a warning at the bottom that the page may not always be up-to-date.
2015-01-15 10:56:50 -05:00
Michael Hobbs
e760e1cc92 implement ps:restartall. closes #82 #218 2015-01-14 16:37:49 -08:00
Michael Hobbs
9490889411 allow ps to be used by plugins that support pre container actions 2015-01-14 16:25:13 -08:00
Michael Hobbs
17d78856e0 skip one ps test as circleci does not yet support docker exec 2015-01-14 16:24:09 -08:00
Michael Hobbs
376e1d3411 ps docs 2015-01-14 16:23:02 -08:00
Jose Diaz-Gonzalez
a0c5c4576e Merge pull request #896 from progrium/515-docker-args-in-build-phase
add docker-args pluginhook call to build phase
2015-01-14 19:10:24 -05:00
Michael Hobbs
61e154899b use ps:restart for config and domains plugins 2015-01-14 15:25:53 -08:00
Michael Hobbs
c0028f122b initial pass at a ps plugin 2015-01-14 15:19:58 -08:00
Jose Diaz-Gonzalez
22fd0aa7f0 Merge pull request #895 from progrium/644-mh-document-priv-submods
document deploying private git submodules. closes #644
2015-01-14 16:15:57 -05:00
Michael Hobbs
08bcebbd17 [ci skip] document deploying private git submodules. closes #644 2015-01-14 13:12:10 -08:00
Michael Hobbs
78967eedd7 add docker-args pluginhook call to build phase 2015-01-14 11:31:48 -08:00
Jose Diaz-Gonzalez
cc4fda235c Merge pull request #892 from progrium/vagrant-docs
Change where the ssh config PORT is setup
2015-01-14 03:52:03 -05:00
Jose Diaz-Gonzalez
d6c369cfdf Change where the ssh config PORT is setup and add a note about using vagrant ssh-config to verify it. Closes #795 2015-01-13 23:27:31 -05:00
Jose Diaz-Gonzalez
55129cb9f6 Keep existing configuration files when installing nginx. Refs #886 2015-01-13 22:42:33 -05:00
Jose Diaz-Gonzalez
2e220da491 Release 0.3.13 2015-01-11 22:30:52 -05:00
Michael Hobbs
e0c49ec724 [ci skip] fix missing strings in deploy tests output 2015-01-11 16:30:13 -08:00
Jose Diaz-Gonzalez
938a16de53 Merge pull request #880 from progrium/879-mh-port-based-fix
disable VHOST deployment if global VHOST file is missing and an app domain has not been added
2015-01-11 18:14:55 -05:00
Michael Hobbs
80d13c0005 allow users to add a domain to an app if there is no global vhost 2015-01-11 14:35:02 -08:00
Jose Diaz-Gonzalez
d1f358c6fb Merge pull request #885 from progrium/883-mh-node-packagejson-only-test
test deploy node app without procfile
2015-01-10 12:17:54 -05:00
Michael Hobbs
f5f7b8dd7e test deploy node app without procfile 2015-01-09 21:52:41 -08:00
Jose Diaz-Gonzalez
795da11d24 Merge pull request #884 from progrium/mh-rename-nginx-listen-vars
IP and PORT are likely to get clobbered. rename them
2015-01-09 17:17:47 -05:00
Michael Hobbs
c63be44989 IP and PORT are likely to get clobbered. rename them 2015-01-09 12:12:52 -08:00
Jose Diaz-Gonzalez
17271b6132 Merge pull request #881 from jomo/patch-1
troubleshooting typo: 64 != 46
2015-01-09 12:06:40 -05:00
jomo
82b700d635 troubleshooting typo: 64 != 46 2015-01-09 17:37:45 +01:00
Michael Hobbs
da465a61dd disable VHOST deployment if global VHOST file is missing 2015-01-08 15:58:08 -08:00
Michael Hobbs
875da5211f Merge pull request #876 from vincentfretin/patch-3
give CACHE_PATH env variable for forward compatibility with herokuish
2015-01-08 12:22:19 -08:00
Jose Diaz-Gonzalez
fc8e8484c6 Merge pull request #877 from progrium/mh-authors
add MH to AUTHORS
2015-01-07 16:38:27 -05:00
Michael Hobbs
7ebdcaa2e5 [ci skip] not sure if this is kept up-to-date anymore 2015-01-07 12:42:31 -08:00
Vincent Fretin
8e5c8c0832 give CACHE_PATH environment variable for forward compatibility with herokuish
herokuish defaults to /tmp/cache, so the build cache don't work without giving the CACHE_PATH environment variable. You can test it with buildstep herokuish branch. cc @progrium
2015-01-07 19:04:40 +01:00
Jose Diaz-Gonzalez
4abccf0119 Merge pull request #874 from progrium/869-add-missing-docs
Add advanced installation docs that were removed in #706. Closes #869
2015-01-07 01:45:26 -05:00
Jose Diaz-Gonzalez
dd9ef4866c Add advanced installation docs that were removed in #706. Closes #869 2015-01-07 00:43:08 -05:00
Jose Diaz-Gonzalez
8502881633 Merge pull request #868 from expa/mh-circle-ci
use circleci for automated testing
2015-01-06 23:44:15 -05:00
Michael Hobbs
43e9e6ddb6 disable wercker 2015-01-06 18:46:29 -08:00
Michael Hobbs
471a5fa087 badge readme 2015-01-06 18:38:39 -08:00
Jose Diaz-Gonzalez
f95ad79fc4 Merge pull request #873 from progrium/870-mh-bind-ip-on-domains-change
support pre deployment usage of domains plugin. fixes interface binding issue
2015-01-06 16:14:02 -05:00
Michael Hobbs
896ce50c93 support pre deployment usage of domains plugin. fixes interface binding issue 2015-01-06 12:42:21 -08:00
Jose Diaz-Gonzalez
cbbc63d0f8 Merge pull request #872 from progrium/832-mh-enable-multi-test
fix/enable multi buildpack test
2015-01-06 14:52:07 -05:00
Michael Hobbs
1f73b58340 enable multi buildpack test 2015-01-06 11:20:22 -08:00
Michael Hobbs
881a700e99 attempt to use make install 2015-01-05 17:39:33 -08:00
Michael Hobbs
9d81dda524 try circle again 2015-01-05 17:03:06 -08:00
Jose Diaz-Gonzalez
566cc15081 Merge pull request #864 from progrium/860-mh-bind-to-internal-ip
bind docker container to internal port if using vhosts
2015-01-05 19:58:18 -05:00
Michael Hobbs
f1827a86a4 add docs for network interface binding logic 2015-01-05 16:28:48 -08:00
Jose Diaz-Gonzalez
fc1762156d Merge pull request #867 from progrium/862-mh-test-make-output
silent grep stderr. closes #862
2015-01-05 17:33:29 -05:00
Michael Hobbs
343ee24c46 silent grep stderr. closes #862 2015-01-05 13:13:43 -08:00
Michael Hobbs
441d212ef2 add ipv6 detection for external port binding 2015-01-05 10:47:20 -08:00
Jose Diaz-Gonzalez
bc072e1db3 Merge pull request #858 from progrium/857-disable-server-tokens
Disable server tokens in nginx. Closes #857
2015-01-03 22:12:22 -05:00
Jose Diaz-Gonzalez
ab7f9f1161 Move server_tokens off to the global nginx conf 2015-01-03 21:41:18 -05:00
Michael Hobbs
e95d1e8602 add test to validate server_tokens is off 2015-01-02 17:21:57 -08:00
Michael Hobbs
948d7902f2 bind docker container to internal port if using vhosts 2015-01-02 16:27:19 -08:00
Jose Diaz-Gonzalez
8535900f9d Merge pull request #859 from progrium/829-docker-args-command
Pass command being executed when retrieving DOCKER_ARGS via pluginhook.
2015-01-01 21:16:44 -05:00
Jose Diaz-Gonzalez
152b060901 Merge pull request #861 from progrium/587-custom-dokku-root
Default DOKKU_ROOT to ~dokku if unspecified. Closes #587
2015-01-01 21:00:20 -05:00
Jose Diaz-Gonzalez
464ef4d879 Default DOKKU_ROOT to ~dokku if unspecified. Closes #587 2015-01-01 20:38:55 -05:00
Jose Diaz-Gonzalez
156e987300 Merge pull request #863 from progrium/fix-composer-app
Add missing properties to the php composer.json
2015-01-01 20:38:33 -05:00
Jose Diaz-Gonzalez
8abb9ec408 Add missing properties to the php composer.json
This avoids errors in deploying the test app. Composer recently updated to require this for all projects (which appears to be a bug).
2015-01-01 20:14:41 -05:00
Jose Diaz-Gonzalez
97734cc242 Merge pull request #815 from abossard/patch-1
I made a wordpress installation helper
2015-01-01 15:16:31 -05:00
Jose Diaz-Gonzalez
93a01fb763 Pass command being executed when retrieving DOCKER_ARGS via pluginhook. Closes #829 2015-01-01 15:14:47 -05:00
Jose Diaz-Gonzalez
2a51301a5d Disable server tokens in nginx. Closes #857 2015-01-01 15:03:43 -05:00
Jose Diaz-Gonzalez
1d6d5755d4 Release 0.3.12 2014-12-29 16:56:23 -05:00
Jose Diaz-Gonzalez
6fed503024 Merge pull request #846 from progrium/mh-default-ssl-vhost-from-cert
add certificate CN to app VHOST if it's not already
2014-12-25 00:57:39 -05:00
Jose Diaz-Gonzalez
95914d1c13 Merge pull request #850 from progrium/mh-test-deploy-scala
test scala deployment
2014-12-24 14:23:28 -05:00
Jose Diaz-Gonzalez
92c18fa664 Merge pull request #849 from cjoudrey/checks-docs
Add docs for CHECKS
2014-12-24 13:59:09 -05:00
Christian Joudrey
7bd5df0e25 Add docs for CHECKS 2014-12-24 12:33:47 -05:00
Michael Hobbs
9b5abeac4d test scala deployment 2014-12-23 23:54:52 -08:00
Michael Hobbs
de09260c33 add certificate CN to app VHOST if it's not already 2014-12-23 23:08:22 -08:00
Jose Diaz-Gonzalez
7cf28ee01f Merge pull request #847 from leonardodino/patch-1
Update bootstrap.sh: new docs url
2014-12-23 22:47:14 -05:00
Leonardo Dino
e04b90c416 missed the advanced installation link
it’s linked in the instalation page, but it’s broken.
2014-12-23 22:31:29 -03:00
Leonardo Dino
5e1b5b2900 Update bootstrap.sh: new docs url
move to viewdocs.io
2014-12-23 22:16:20 -03:00
Jose Diaz-Gonzalez
416dac6d2b Release 0.3.11 2014-12-23 17:17:36 -05:00
Jose Diaz-Gonzalez
9a04104bb9 Merge pull request #844 from progrium/mh-fix-ssl-urls
build app urls based on wildcard ssl or app ssl
2014-12-23 17:13:40 -05:00
Michael Hobbs
43fe6edb04 build app urls based on wildcard ssl or app ssl 2014-12-23 13:52:50 -08:00
Michael Hobbs
3a850fa05e fix typo in nickname. aka i cannot spell 2014-12-23 05:31:27 -08:00
Jose Diaz-Gonzalez
097bdecfac Merge pull request #839 from progrium/mh-irc-build-notifications
notify irc on builds
2014-12-23 01:30:56 -05:00
Michael Hobbs
1d4cc0b991 notify irc on builds 2014-12-22 22:07:43 -08:00
Jose Diaz-Gonzalez
3e62b1acce Merge pull request #838 from expa/mh-build-env-special-chars
quote build_env vars
2014-12-23 00:35:53 -05:00
Michael Hobbs
c2911c94a8 quote build_env vars 2014-12-22 15:52:54 -08:00
Jose Diaz-Gonzalez
f5a5f7702b Merge pull request #833 from expa/mh-fix-orphaned-app-image
auto remove the cache dir cleanup container
2014-12-22 10:22:47 -05:00
Jose Diaz-Gonzalez
5f2a5fe2bc Merge pull request #821 from expa/mh-unit-tests
use wercker for automated testing
2014-12-22 10:21:17 -05:00
Michael Hobbs
50208862b2 revert to florianheinemann's nginx buildpack for static sites 2014-12-21 14:51:42 -08:00
Michael Hobbs
283432f214 domains plugin unit tests and fix for errant substring match 2014-12-21 14:51:42 -08:00
Michael Hobbs
d1e94f6c91 use buildpack fork that preserves CHECKS file location 2014-12-21 14:51:42 -08:00
Michael Hobbs
dbb6560b1e fix static site test 2014-12-21 14:51:42 -08:00
Michael Hobbs
f3535292b3 reference issues for disabled deploy tests 2014-12-21 14:51:42 -08:00
Michael Hobbs
568902302b echo out deploy test type correctly 2014-12-21 14:51:42 -08:00
Michael Hobbs
cddcf997e1 make sure we test the check-deploy plugin 2014-12-21 14:51:42 -08:00
Michael Hobbs
f2bd2b8541 nullglob. closes: #822 2014-12-21 14:51:42 -08:00
Michael Hobbs
6bb01404ec poor lint fix choice. let's not do that. 2014-12-21 14:51:42 -08:00
Michael Hobbs
e8b4bd5a89 lintball 2014-12-21 14:51:42 -08:00
Michael Hobbs
2695d957ac add wercker status to readme 2014-12-21 14:51:41 -08:00
Michael Hobbs
051b286a62 disable multipack buildpack test for now 2014-12-21 14:51:41 -08:00
Michael Hobbs
67b7fa6263 handle config with spaces over ssh 2014-12-21 14:51:41 -08:00
Michael Hobbs
c697c65508 WIP 2014-12-21 14:51:41 -08:00
Michael Hobbs
85f9bb3aae disable SC2143 2014-12-21 14:51:41 -08:00
Michael Hobbs
c5c0ae00ba show logs in deploy tests 2014-12-21 14:51:41 -08:00
Michael Hobbs
0dec01c324 fix php test 2014-12-21 14:51:41 -08:00
Michael Hobbs
3827e38caa set nullglob 2014-12-21 14:51:41 -08:00
Michael Hobbs
14a7cac686 update php and static tests 2014-12-21 14:51:41 -08:00
Michael Hobbs
9322200eae lintball 2014-12-21 14:51:41 -08:00
Michael Hobbs
ee32b05a36 test against both buildstep release and master 2014-12-21 14:51:41 -08:00
Michael Hobbs
3b41d6d16f create build env for both dokku and new style buildpacks 2014-12-21 14:51:41 -08:00
Jose Diaz-Gonzalez
8aef43b3ae Release 0.3.8 2014-12-21 14:51:41 -08:00
Jose Diaz-Gonzalez
e45455b73f Ensure makefiles are properly formatted 2014-12-21 14:51:41 -08:00
Joel Van Horn
356acdd08d Point users to upgrade guides 2014-12-21 14:51:41 -08:00
Michael Hobbs
f9b7d5378d lintball in build-env 2014-12-21 14:51:41 -08:00
Michael Hobbs
58d0bc983a don't use bats for deploy tests 2014-12-21 14:51:41 -08:00
Michael Hobbs
81aefba305 fix multipack app deploy test 2014-12-21 14:51:41 -08:00
Michael Hobbs
8f5c5d5ae2 reference opened issue with buildstep 2014-12-21 14:51:40 -08:00
Michael Hobbs
8025657a38 save error in output if curl errors 2014-12-21 14:51:40 -08:00
Michael Hobbs
779808f832 make sure we set the default VHOST to match test env 2014-12-21 14:51:40 -08:00
Michael Hobbs
d3e18d3362 fix failure output 2014-12-21 14:51:40 -08:00
Michael Hobbs
606bbda66c make tests work 2014-12-21 14:51:40 -08:00
Michael Hobbs
3706392e65 test with wercker 2014-12-21 14:51:40 -08:00
Michael Hobbs
ab7c313411 Merge pull request #835 from expa/mh-fix-substring-match
[domains] make sure we match the specific string in VHOST
2014-12-21 14:51:25 -08:00
Michael Hobbs
f797ff77f4 make sure we match the specific string in VHOST 2014-12-21 13:57:45 -08:00
Michael Hobbs
c2736c7c7a auto remove the cache dir cleanup container 2014-12-20 17:20:32 -08:00
Jose Diaz-Gonzalez
af671b2aba Release 0.3.10 2014-12-19 15:17:17 -05:00
Jose Diaz-Gonzalez
45b2f87b15 Merge pull request #831 from progrium/nginx-docs
Nginx docs
2014-12-19 15:13:14 -05:00
Jose Diaz-Gonzalez
3d6727a1b8 Add documentation for configuring the nginx domains and vhosts 2014-12-19 15:10:10 -05:00
Jose Diaz-Gonzalez
bf4781a5d7 Use shell keyword for codeblock guard 2014-12-19 15:09:38 -05:00
Michael Hobbs
2d48d81d09 Merge pull request #828 from andrewsomething/port
Display the port for an app when falling back to the ip address.
2014-12-18 14:10:11 -08:00
Andrew Starr-Bochicchio
294b419da5 Display the port for an app when falling back to the ip address. 2014-12-17 21:20:18 -05:00
Jose Diaz-Gonzalez
f1bfb3ed3a Merge pull request #827 from expa/mh-mv-default-vhost-to-core
Handle IP only access
2014-12-17 19:53:59 -05:00
Michael Hobbs
56472bd08c VHOST fallback 2014-12-16 23:01:32 -08:00
Michael Hobbs
e99e2201cb mv default VHOST creation to core install 2014-12-16 20:25:44 -08:00
Jose Diaz-Gonzalez
5bf1ba7ed7 Merge pull request #783 from progrium/nginx-cleanup
New domains plugin and nginx extension
2014-12-16 17:15:30 -05:00
Jose Diaz-Gonzalez
5d014d0a8e Merge pull request #823 from expa/nginx-cleanup
show URLS with scheme. now with bug fixes!!!
2014-12-16 16:26:47 -05:00
Michael Hobbs
59f047bb45 include SSL_VHOSTS in NOSSL_SERVER_NAME so we can redirect from http to https on the secure hostname as well 2014-12-16 12:15:10 -08:00
Michael Hobbs
1b208778f3 bugfixes
- don't match substrings in VHOSTS
 - handle case where NOSSL_SERVER_NAME is \' \'
 - rebuild nginx config on ssl import
 - prevent cwd errors after we rm the temp dir
2014-12-15 18:10:14 -08:00
Michael Hobbs
a6cdae5abf reset VHOST to default upon domains:clear 2014-12-15 18:04:00 -08:00
Michael Hobbs
50115d3640 print out urls with scheme 2014-12-15 18:02:57 -08:00
Michael Hobbs
78d3921a6f don't break other nginx plugins like nginx-alt 2014-12-15 13:15:40 -08:00
Jose Diaz-Gonzalez
23d4224beb Merge pull request #818 from expa/nginx-cleanup
rebuild nginx config on domain change
2014-12-14 18:31:43 -05:00
Michael Hobbs
4e0670f1ac rebuild nginx config on domain change 2014-12-12 17:53:30 -08:00
Jose Diaz-Gonzalez
0bd8d71bb9 Release 0.3.9 2014-12-12 09:58:02 -05:00
Jose Diaz-Gonzalez
12ee9bc3e7 Merge pull request #816 from progrium/build-env-docs
Add documentation for user-env feature
2014-12-12 09:56:46 -05:00
Jose Diaz-Gonzalez
a991c450be Remove user-env-compile plugins from docs 2014-12-12 09:55:41 -05:00
Jose Diaz-Gonzalez
a900aa45d6 Add documentation for the recent build-env feature addition 2014-12-12 09:54:26 -05:00
Jose Diaz-Gonzalez
3c8b3cedea Merge pull request #814 from progrium/dokku-env-vars
Source files in $DOKKU_ROOT/.dokkurc directory and add `dokku trace` command
2014-12-12 09:25:51 -05:00
Andre Bossard
2464bc0458 I made a wordpress installation helper
It's not a plugin though
2014-12-12 15:22:05 +01:00
Jose Diaz-Gonzalez
dec8056ef5 Link to gist.github.com 2014-12-12 01:10:10 -05:00
Jose Diaz-Gonzalez
784e2cfd5e Add a note about enabling dokku trace via the cli 2014-12-12 01:09:59 -05:00
Jose Diaz-Gonzalez
b9b9d6303a Add a dokku trace command to allow easy toggling of the DOKKU_TRACE option 2014-12-12 01:07:43 -05:00
Jose Diaz-Gonzalez
39912ce5db Allow sourcing in any file in .dokkurc
This allows us to configure dokku env-vars individually. Such a feature is useful if a developer would like to enable or disable DOKKU_TRACE without parsing a dokkurc file.
2014-12-12 01:07:08 -05:00
Jose Diaz-Gonzalez
7d8ec62a86 Merge pull request #787 from progrium/build-env
Official user-env-compile plugin
2014-12-11 21:15:45 -05:00
Jose Diaz-Gonzalez
8cd4863126 Merge pull request #813 from expa/build-env
build-env todos
2014-12-11 18:18:26 -05:00
Michael Hobbs
7c8feb9e0d build-env todos 2014-12-11 14:56:25 -08:00
Jose Diaz-Gonzalez
d6ef5e3447 Merge pull request #812 from expa/build-env
create build env for both dokku and new style buildpacks
2014-12-11 16:33:28 -05:00
Michael Hobbs
498e250e2e link to commit id and line in comment 2014-12-11 12:52:04 -08:00
Michael Hobbs
7d5e0ba5aa create build env for both dokku and new style buildpacks 2014-12-11 12:05:55 -08:00
Jose Diaz-Gonzalez
a7b8eb5581 Merge pull request #811 from abossard/patch-1
Please increase the server_names_hash_bucket_size
2014-12-11 10:22:44 -05:00
Andre Bossard
79788e5690 Please increase the server_names_hash_bucket_size
I use Dokku in a private environment with very long hostname.... 64 was always a lot to short.
2014-12-11 09:59:13 +01:00
Jose Diaz-Gonzalez
ae61ef3f1e Add backup support to nginx.conf.template files 2014-12-11 02:40:20 -05:00
Jose Diaz-Gonzalez
1d45ca0cdd Add backup export/import hooks for associated VHOST files 2014-12-11 02:38:08 -05:00
Jose Diaz-Gonzalez
b4c864bea7 Use sed to indent output of dokku url command 2014-12-11 02:34:24 -05:00
Jose Diaz-Gonzalez
01e7f1cdb6 Output *all* hosts on multiple lines 2014-12-11 02:34:08 -05:00
Jose Diaz-Gonzalez
0865ff3f79 Use updated VHOST file instead of URL file when outputting the current URL to an app
Note that this may include more than one URL to an app
2014-12-11 02:16:52 -05:00
Jose Diaz-Gonzalez
11b126a845 Do not overwrite URL file 2014-12-11 02:14:52 -05:00
Jose Diaz-Gonzalez
605ba27eeb Use a one-liner for the "Configuring" echo statement 2014-12-11 02:12:46 -05:00
Jose Diaz-Gonzalez
8109c9c569 Delete the VHOST file, not the URL file, when NO_VHOST is set
The URL file is useful for understanding what port docker decided to host our app internally on.
2014-12-11 02:10:49 -05:00
Jose Diaz-Gonzalez
9111902542 Fix issue where VHOST was not properly being set
The URL file is being rewritten on every deploy by `dokku deploy` and thus that file was incorrect. Instead, we just reuse the old logic from the nginx-vhosts plugin to handle creation of the VHOST file
2014-12-11 02:09:54 -05:00
Jose Diaz-Gonzalez
4955f9c600 Fix test for file 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
976dc3009c Use a normal conditional 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
0b4b2b29a8 Add missing env var 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
e84526490e Move VHOST file creation to a single domains:setup command
This helps remove duplication and also ensures that all hosts have a proper setup after running `make copyfiles`

Note that this command is not exposed in help as it is not generally useful to developers
2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
66171551d8 Add domains plugin as written in https://github.com/jtangelder/dokku-nginx-alt
This plugin conforms to the heroku api for setting and removing domains. Note that it does not yet update the URL file for a given application.
2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
f23809e75f Implement the ability to set multiple server names for a given application
Adding a hostname to the $APP/VHOST file will enable it as a virtualhost for the application.

In addition, any hostname set that matches an associated ssl certificate will also be set as an ssl host. Note that if a hostname does not have a matching SSL host, then it will result in an erroring application.

For the moment, running `dokku url` on an app may not correctly display the current hostnames for said app.
2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
b967514c55 Allow overriding of the nginx.conf template via nginx.conf.template 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
a6c34ddd6f Use a template to create an application's nginx.conf 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
8f0e794893 Remove extra dash 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
68a1d1af38 one-liner 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
eeff3d52eb Combine calls to restart nginx into a single command 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
8aa196c660 Remove extra reload command 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
d9d66c58ab Fix reference to $APP 2014-12-08 22:16:05 -05:00
Jose Diaz-Gonzalez
155f4e9aba Release 0.3.8 2014-12-08 22:14:03 -05:00
Jose Diaz-Gonzalez
1bfbdb449b Merge pull request #808 from progrium/proper-editorconfig
Ensure makefiles are properly formatted
2014-12-08 22:12:21 -05:00
Jose Diaz-Gonzalez
b3ca3368e8 Ensure makefiles are properly formatted 2014-12-08 22:12:04 -05:00
Jose Diaz-Gonzalez
04921d6876 Merge pull request #807 from progrium/799-force-nginx-conf
#799: Force nginx conf
2014-12-08 22:05:17 -05:00
Jose Diaz-Gonzalez
a915b8888f Ensure ruby is installed when running the dokku-installer 2014-12-08 21:57:10 -05:00
Jose Diaz-Gonzalez
129a5fd33d Force install a default nginx.conf. Closes #799 2014-12-08 21:20:54 -05:00
Jose Diaz-Gonzalez
e567ce1a90 Merge pull request #806 from progrium/fix-remote-user
Dokku pushes now happen as the dokku user, not git. Refs #796
2014-12-08 20:59:22 -05:00
Jose Diaz-Gonzalez
489f131ffc Dokku pushes now happen as the dokku user, not git. Refs #796 2014-12-08 20:58:50 -05:00
Jose Diaz-Gonzalez
45ec8df7be Merge pull request #805 from ademuk/patch-1
Fixed import-ssl server.crt/key check
2014-12-08 20:36:18 -05:00
Adem Gaygusuz
469d1e3f49 Fix crt/key check 2014-12-09 00:37:47 +00:00
Jose Diaz-Gonzalez
7ca2f49d78 Merge pull request #801 from joelvh/patch-1
Point users to upgrade guides
2014-12-02 08:55:48 -05:00
Joel Van Horn
69176d2d9a Point users to upgrade guides 2014-12-02 00:33:44 -05:00
Jose Diaz-Gonzalez
ad030b21d4 Merge pull request #796 from progrium/795-better-docs
795 better docs
2014-11-27 15:13:31 -05:00
Jose Diaz-Gonzalez
8c8f5e17f1 Tell users to change directory to dokku before running vagrant up. Refs #795 2014-11-27 15:10:33 -05:00
Jose Diaz-Gonzalez
e0b994c415 Standardize on dokku.me as the test hostname. Refs #795 2014-11-27 15:09:46 -05:00
Jose Diaz-Gonzalez
a12b1e2b56 Release 0.3.7 2014-11-25 15:46:48 -05:00
Jose Diaz-Gonzalez
590c5fc017 Merge pull request #789 from mmerickel/fix.deploy-vhost 2014-11-25 15:44:19 -05:00
Michael Merickel
ee5c35dd9d do not output message when creating ENV file
This fixes a bug introduced when deploying apps where the
nginx-vhosts plugin runs ``dokku config:get $APP NO_VHOST``. The initial
run of this actually was creating the ``ENV`` file and dumping to
stdout the value "NO_VHOST=-----> Creating /home/dokku/foo/ENV". This
was obviously no good because nginx-vhosts was considering this to be a
value of true.

I've modified this to simply not return anything when the value does not
exist. A better update may be to output the messages to stderr instead
of stdout.
2014-11-25 15:43:36 -05:00
Jose Diaz-Gonzalez
42a1363996 Merge pull request #788 from mmerickel/fix.apps-plugin
fix apps plugin issues in 0.3.6
2014-11-25 13:28:17 -05:00
Michael Merickel
4ae8cf8180 fix search for apps if DOKKU_ROOT is a symlink 2014-11-25 11:56:05 -06:00
Michael Merickel
aef3a68d2b fix app plugin that was always searching for empty app name 2014-11-25 11:55:25 -06:00
Jose Diaz-Gonzalez
6ddc7275dd First pass at official user-env-compile plugin
- Uses ENV and APP/ENV files
- Supports old BUILD_ENV files (which are likely in wide-use)
- Allows user's to override globals with app-specific configuration

Closes #284
Closes #683
Closes #763

Refs #503
Refs #678
2014-11-25 11:24:58 -05:00
Jose Diaz-Gonzalez
58ca13e838 Release 0.3.6 2014-11-25 10:44:32 -05:00
Jose Diaz-Gonzalez
7c2f21fd2a Merge pull request #782 from progrium/simplified-config
Simplified config
2014-11-24 13:17:27 -05:00
Jose Diaz-Gonzalez
887637fb6b Merge pull request #785 from lsde/master
fix missing semicolon in nginx config
2014-11-24 10:33:26 -05:00
Jonas Svatos
c706344a94 fix missing semicolon in nginx config 2014-11-24 13:22:50 +01:00
Jose Diaz-Gonzalez
a1bbc1ec4d Release 0.3.5 2014-11-24 02:17:50 -05:00
Jose Diaz-Gonzalez
793f1b6058 Merge pull request #784 from progrium/no-vhost-hotfix
Fix NO_VHOST check
2014-11-24 02:16:39 -05:00
Jose Diaz-Gonzalez
20977fc2a2 Fix NO_VHOST check
It used to check if NO_VHOST is unset or set to the empty string
It now checks if NO_VHOST is set to a non-empty string
2014-11-24 02:16:21 -05:00
Jose Diaz-Gonzalez
6cad7ef8f4 Release 0.3.4 2014-11-23 23:37:18 -05:00
Jose Diaz-Gonzalez
407436b4cc Exit 0 if there is no configuration
heroku config:get exits 0 in this case
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
04dbe31919 Unify the way in which all error messages are specified
Other parts of dokku use one-liners where possible, so these parts should as well
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
56185fc1c2 Correct plugin example
$APP is not available until after the if guards
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
303bd77226 Simplify if statement 2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
c6e39c08f0 Simplify env var checking in config plugin
All checks are now done within the commands, and we only need to ensure the config file exists.
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
12194e2cc8 Add proper error handling to each config command 2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
a3b3a6a12a Unify missing app error messages 2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
c6f80bcf55 Merge pull request #781 from expa/master
use DOKKU_IMAGE (i.e. progrium/buildstep)
2014-11-23 23:27:34 -05:00
Michael Hobbs
4d8c7033a9 use DOKKU_IMAGE (i.e. progrium/buildstep) 2014-11-23 19:58:12 -08:00
Michael Hobbs
d2547c4233 Merge pull request #3 from progrium/master
merge from upstream v0.3.2
2014-11-23 19:56:41 -08:00
Jose Diaz-Gonzalez
4fa567dbe3 Merge pull request #780 from progrium/778-better-error-message
Output error message when a command is not found. Closes #778
2014-11-23 21:05:08 -05:00
Jose Diaz-Gonzalez
463f725872 Use git-* as a pluginhook prefix 2014-11-23 21:02:40 -05:00
Jose Diaz-Gonzalez
aa1c7f6fa4 Move git-upload-pack command to git plugin
Also use the same APP escaping as used for other git commands.
2014-11-23 20:47:15 -05:00
Jose Diaz-Gonzalez
5f6f73ff22 Merge pull request #722 from wrboyce-git-pull 2014-11-23 20:40:08 -05:00
Will Boyce
ad497191df Add git pull support 2014-11-23 20:39:57 -05:00
Jose Diaz-Gonzalez
53c58ec8b9 Merge pull request #777 from feature/improve-core 2014-11-23 20:32:21 -05:00
Thomas Boerger
9eab9ed1e1 Replaced hard coded plugins path
To be able to switch the plugin path i have removed the hard coded
plugin path from the catch all section of the switch within the main
dokku executable.
2014-11-23 20:32:13 -05:00
Thomas Boerger
3faa37b2e1 Keep environment for sudo
To be able to set some other environment variables even if dokku gets
called from a different user we have to keep the environment with sudo
intact, so i added the -E option.
2014-11-23 20:32:13 -05:00
Jose Diaz-Gonzalez
fd55e8d41b Merge pull request #669 from ohardy/master 2014-11-23 20:29:12 -05:00
Olivier Hardy
303bc18265 Handle dokku plugins-update command 2014-11-23 20:22:26 -05:00
Jose Diaz-Gonzalez
2141435ce1 Rename DOKKU_CONTROLLER to DOKKU_HOST 2014-11-23 19:54:10 -05:00
Jose Diaz-Gonzalez
03e5248256 Merge pull request #659 from Xe/client
contrib: add dokku client shell script
2014-11-23 19:53:26 -05:00
Jose Diaz-Gonzalez
d307a5b8ec Output error message when a command is not found. Closes #778
Plugins with commands will need to implement a catch-all command that exits with the `DOKKU_NOT_IMPLEMENTED_EXIT`` code (10). This signals to dokku that a given plugin has indeed not executed anything for a plugin (which may not always be the case).

Using plugins that do not implement this pattern will result in those plugins silencing the error message.
2014-11-23 18:09:11 -05:00
Jose Diaz-Gonzalez
1e5a904747 Merge pull request #779 from progrium/minor-formatting
Minor bash formatting changes
2014-11-23 16:49:21 -05:00
Jose Diaz-Gonzalez
a46582225a Merge pull request #751 from webhippie/feature/improvements
Partial openSUSE support
2014-11-23 16:47:36 -05:00
Jose Diaz-Gonzalez
8bc3d372ec Minor bash formatting changes 2014-11-23 16:42:21 -05:00
Thomas Boerger
14b1743c2a Added openSUSE support
I have done the first steps to get dokku running for other distros like
openSUSE. I have simply replaced the important places within the core
plugins with a check for DOKKU_DISTRO that gets exported by dokku
itself. It just replaces the apt-get and service start/restart/reload
functionality with the openSUSE counterparts.
2014-11-23 11:37:58 +01:00
Thomas Boerger
2d776292c3 Added environment variable for base container
In order to be able to use a different base image i have added another
environment variable where everybody can switch the used base container
for the applications directly through the environment variable
DOKKU_IMAGE or with the help of the dokkurc configuration.
2014-11-23 11:34:29 +01:00
Jose Diaz-Gonzalez
f0fe32a9c6 Merge pull request #776 from joliv/master
Update man page for new commands
2014-11-22 23:21:25 -05:00
joliv
c4f5b3e219 Update man page for new commands 2014-11-22 22:09:11 -05:00
Jose Diaz-Gonzalez
e7219c0346 Release 0.3.2 2014-11-22 18:02:06 -05:00
Jose Diaz-Gonzalez
842ae10b74 Merge pull request #775 from progrium/plugin-help
Add PLUGIN:help command to each plugin
2014-11-22 17:58:24 -05:00
Jose Diaz-Gonzalez
cfc7c41e47 Add PLUGIN:help command to each plugin 2014-11-22 17:52:46 -05:00
Jose Diaz-Gonzalez
c7af391c06 Merge pull request #774 from progrium/254-nginx-hostname-hook
Add the ability to customize an app's hostname using nginx-hostname pluginhook
2014-11-22 17:19:38 -05:00
Jose Diaz-Gonzalez
4754f241f2 Add the ability to customize an app's hostname using the nginx-hostname pluginhook
Closes #254
2014-11-22 17:18:33 -05:00
Jose Diaz-Gonzalez
fd1678b576 Remove reference to no-vhost plugin that is now in core 2014-11-22 16:50:06 -05:00
Jose Diaz-Gonzalez
7f730d0697 Merge pull request #773 from progrium/485-native-no-vhost
Disable nginx vhosts via `dokku config:set myapp NO_VHOST=1`. Closes #485
2014-11-22 16:44:05 -05:00
Jose Diaz-Gonzalez
69f360864f Disable nginx vhosts via dokku config:set myapp NO_VHOST=1. Closes #485 2014-11-22 16:42:55 -05:00
Jose Diaz-Gonzalez
16fd7ebc6b Merge pull request #772 from progrium/518-import-ssl
Import ssl certificates
2014-11-22 16:23:24 -05:00
Jose Diaz-Gonzalez
19609f7078 Import ssl certificates
Also ensures output is stored in proper tls directory

Closes #518
2014-11-22 16:19:06 -05:00
Jose Diaz-Gonzalez
a24c1bcc92 Merge pull request #771 from progrium/doc-changes
Doc changes
2014-11-22 15:38:43 -05:00
Jose Diaz-Gonzalez
47811f60f4 Ensure tables have proper width 2014-11-22 15:37:42 -05:00
Jose Diaz-Gonzalez
ab01206351 Better formatting of plugin tables 2014-11-22 15:37:29 -05:00
Michael Hobbs
fd0bafa7d9 Merge pull request #2 from progrium/master
merge from upstream
2014-11-22 10:25:33 -08:00
Jose Diaz-Gonzalez
ac84ef68cc Change tables to be left aligned 2014-11-17 17:11:00 -05:00
Jose Diaz-Gonzalez
5caf2ab6e3 Reorganized list of available datastore plugins 2014-11-17 17:03:22 -05:00
Jose Diaz-Gonzalez
11bff42180 Merge pull request #766 from progrium/sort-apps
Sort output of apps command
2014-11-16 19:20:39 -05:00
Jose Diaz-Gonzalez
bf4876107d Sort output of apps command 2014-11-16 19:14:51 -05:00
Jose Diaz-Gonzalez
2ec17a4033 Merge pull request #765 from progrium/ignore-tls-directory
Ignore tls directory
2014-11-16 13:10:17 -05:00
Jose Diaz-Gonzalez
d36249f51a Ignore tls directory when listing out apps 2014-11-16 13:08:00 -05:00
Jose Diaz-Gonzalez
b011e54dca Skip tls directory in deploy:all hack 2014-11-16 13:00:33 -05:00
Jose Diaz-Gonzalez
b68a8da2ce Do not allow users to delete the tls directory 2014-11-16 13:00:07 -05:00
Jose Diaz-Gonzalez
a421dbf063 Merge pull request #675 from expa/mh-broadly-wait-to-retire
port wait-to-retire from broadly/dokku
2014-11-16 12:56:51 -05:00
Jose Diaz-Gonzalez
00a8370b7d Release 0.3.1 2014-11-16 12:36:31 -05:00
Jose Diaz-Gonzalez
647b215738 Update HISTORY.md for 0.3.0 2014-11-16 12:19:29 -05:00
Jose Diaz-Gonzalez
3e224cc723 Merge pull request #579 from neam/include-nginx-conf.d
Plugin nginx-vhosts includes files in folder nginx.conf.d
2014-11-16 07:19:24 -05:00
Fredrik Wollsén
26a9e2fbf2 Update plugins list - VHOSTS Custom Configuration required core PR was made available in dokku core 0.3.1 2014-11-16 13:18:26 +02:00
Fredrik Wollsén
580f89e63b Plugin nginx-vhosts includes files in folder nginx.conf.d 2014-11-16 13:14:24 +02:00
Jose Diaz-Gonzalez
614a310bbf Merge pull request #762 from progrium/custom
Update template for dokku docs
2014-11-16 04:20:00 -05:00
Jose Diaz-Gonzalez
99304ac3d9 Update template for dokku docs 2014-11-16 04:18:34 -05:00
Jose Diaz-Gonzalez
403843832f Merge pull request #761 from progrium/add-registry-plugin
Add dokku-registry to list. Closes #716
2014-11-16 03:04:52 -05:00
Jose Diaz-Gonzalez
7d9aa7c492 Add dokku-registry to list. Closes #716 2014-11-16 03:04:26 -05:00
Jose Diaz-Gonzalez
33eca3bf39 Merge pull request #760 from progrium/formatting
Formatting
2014-11-16 03:01:04 -05:00
Jose Diaz-Gonzalez
aefa11db8b Add editorconfig to dokku
This should help dokku contributors force proper formatting on their contributions
2014-11-16 03:00:32 -05:00
Jose Diaz-Gonzalez
52774536ca Standardize installer on 2 spaces 2014-11-16 02:59:42 -05:00
Jose Diaz-Gonzalez
0f6ca81afd Update dokku-installer version to v0.3.0 2014-11-16 02:59:28 -05:00
Jose Diaz-Gonzalez
44201a66d9 Add set -eo statement to nginx-vhosts/dependencies 2014-11-16 02:59:07 -05:00
Jose Diaz-Gonzalez
7b361e564f Use 2 spaces for formatting bash
Also remove extra trailing newlines
2014-11-16 02:58:52 -05:00
Jose Diaz-Gonzalez
f13c1031c7 Ensure there is a newline after calling set -e 2014-11-16 02:54:54 -05:00
Jose Diaz-Gonzalez
bca8aa3923 Merge pull request #759 from progrium/apps-plugin
Create an `apps` core plugin.
2014-11-16 02:36:01 -05:00
Jose Diaz-Gonzalez
4b9433052f Create an apps core plugin.
This creates the following commands:

- apps
- apps:create <app>
- apps:destroy <app>

It also:

- makes `delete` an alias for `apps:destroy`
- adds confirmation to `apps:destroy`
- allows a developer to remove apps that have been created via apps:create but have not been deployed

Refs #87
Refs #543
Refs #586
Closes #599
Refs #655
Refs #656
Refs #685
Closes #757
2014-11-16 02:30:39 -05:00
Jose Diaz-Gonzalez
d0ceee5b3b Merge pull request #758 from progrium/621-permissions
Make ENV file readable only from dokku user. Closes #621
2014-11-16 00:27:07 -05:00
Jose Diaz-Gonzalez
913af9b641 Make ENV file readable only from dokku user. Closes #621 2014-11-16 00:26:12 -05:00
Jose Diaz-Gonzalez
f03c0c5440 Merge pull-request #617 from markstos/document-bootstrap 2014-11-16 00:16:51 -05:00
Mark Stosberg
96b348e880 Document what bootstrap.sh is doing. 2014-11-16 00:16:33 -05:00
Jose Diaz-Gonzalez
8a5b954bda Merge pull request #607 from fbochu/master
Use PLUGIN_PATH in dokku default case.
2014-11-16 00:13:48 -05:00
Jose Diaz-Gonzalez
b766654b4f Merge pull request #359 from plietar/rm-plugins
Remove plugins before copying them again.
2014-11-15 23:34:42 -05:00
Jose Diaz-Gonzalez
af0005196a Standardize the way in which we set variables 2014-11-15 23:32:30 -05:00
Jose Diaz-Gonzalez
c3df79f369 Merge pull-request #702 from jazzzz/config-spaces 2014-11-15 22:12:10 -05:00
Jose Diaz-Gonzalez
0f31ff1f24 Add a set of spaces to prefix config variables when setting them 2014-11-15 22:11:55 -05:00
Ludovic Perrine
043a1a01c5 Fixed setting config values with spaces over SSH 2014-11-15 22:03:54 -05:00
Ludovic Perrine
361011ec69 Added test for config with spaces 2014-11-15 22:03:54 -05:00
Ludovic Perrine
5dbc864060 Handle config values with spaces 2014-11-15 22:03:54 -05:00
Jose Diaz-Gonzalez
ac5f9a707c Merge pull request #755 from progrium/vagrant-dokku-installer
Setup dokku-installer within Vagrant VM on first provision
2014-11-15 20:25:13 -05:00
Jose Diaz-Gonzalez
d4235304ee Merge pull request #699 from tombell/suppress-git-archive-all-output
Actually suppress the output from `git_archive_all`
2014-11-15 20:23:57 -05:00
Jose Diaz-Gonzalez
a2d1d8c065 Setup dokku-installer within Vagrant VM on first provision 2014-11-15 20:14:01 -05:00
Jose Diaz-Gonzalez
190c50b694 Merge pull request #754 from progrium/remove-12-04 2014-11-15 16:59:01 -05:00
Jose Diaz-Gonzalez
ad516d6bf5 Remove all references to Ubuntu 12.04. Refs #238
We no longer test against 12.04 VMs
2014-11-15 16:57:59 -05:00
Jose Diaz-Gonzalez
a9ef99fe3d Merge pull request #573 from Prelang/command-instead-of-which 2014-11-15 16:40:42 -05:00
Erik Nomitch
592c95eaeb Use command instead of which for apt-get existential check in bootstrap.sh 2014-11-15 16:38:40 -05:00
Jose Diaz-Gonzalez
179305eea1 Release 0.3.0 2014-11-15 15:36:02 -05:00
Jose Diaz-Gonzalez
a9010d8af0 Merge pull request #718 from Coaxial/patch-1
Update vagrant installation instructions
2014-11-15 15:33:58 -05:00
Jose Diaz-Gonzalez
a5aab1e637 Merge pull request #749 from vincentfretin/master
Fix app certificate directory in backup-import/export
2014-11-12 12:29:43 -05:00
Jose Diaz-Gonzalez
1406a41448 Merge pull request #746 from vincentfretin/patch-1
replace gitreceive by sshcommand in example url
2014-11-12 12:29:23 -05:00
Jose Diaz-Gonzalez
9d49cd3f4f Merge pull request #750 from th4t/master
Remove unintended phrase repetition in installation.md
2014-11-12 12:29:11 -05:00
Vladislav Supalov
e771b94b3b Remove unintended phrase repetition in installation.md. 2014-11-12 11:00:34 +01:00
Vincent Fretin
977d00efb4 The app certificates directory was renamed to tls in e2135a2c5f 2014-11-11 16:13:35 +01:00
Jeff Lindsay
470755babe Merge pull request #748 from vincentfretin/patch-2
fix dokku development blog link
2014-11-11 09:04:02 -06:00
vincentfretin
9f52d02c30 fix dokku development blog link
http://progrium.com/dokku doesn't exist anymore. The blog is really at http://progrium.com/blog, but http://progrium.com is by default on the blog, so let's use this link.
2014-11-11 15:57:06 +01:00
vincentfretin
1cea737891 replace gitreceive by sshcommand in example url 2014-11-11 12:24:35 +01:00
Jose Diaz-Gonzalez
55e43cccc6 Merge pull request #745 from rcarmo/patch-1
Update README.md
2014-11-06 17:13:22 -05:00
Rui Carmo
a9d5516e04 Update README.md
Sorry, that typo was getting to me :)
2014-11-06 22:05:35 +00:00
Jose Diaz-Gonzalez
c05488b7c6 Merge pull request #735 from andrewsomething/master
Redirect to the app deployment docs on success.
2014-11-01 12:51:33 -04:00
Andrew Starr-Bochicchio
2b21fa3ed9 Redirect to the app deployment docs on success. 2014-10-31 17:52:58 -04:00
Jeff Lindsay
c092dd1719 deis sponsorship 2014-10-28 11:25:45 -05:00
Jose Diaz-Gonzalez
16095d0d79 Merge pull request #664 from alexernst/fix/hostname-url
Don't overwrite $APP/URL modified by plugins in post-deploy hook
2014-10-21 10:34:17 -04:00
Jose Diaz-Gonzalez
71a34f6ff1 Merge pull request #724 from ghostbar/patch-2
Fixing tabs issue
2014-10-20 11:34:57 -04:00
Jose-Luis Rivas
4eecfcb825 Fixing tabs issue
Sorry
2014-10-20 10:34:34 -05:00
Jose Diaz-Gonzalez
92ec836341 Merge pull request #723 from ghostbar/patch-1
Let the user know it's on the `stack` target
2014-10-20 08:02:16 -04:00
Jose-Luis Rivas
8231926eaa Let the user know it's on the stack target
Since curl is running quietly it may give the impression that the installation hanged with the last message on the terminal being: "sleep 2 # give docker a moment i guess". In my case I thought it gave it a huge moment and not 2 seconds. It wasn't until the third time that I actually checked the processes on the machine and saw there it was curl downloading stuff quietly.
2014-10-20 01:35:59 -05:00
Jose Diaz-Gonzalez
c828612480 Merge pull request #721 from wrboyce/master
Fix `plugins-install-dependencies` [fixes #720]
2014-10-19 23:45:28 -04:00
Will Boyce
65c499e439 Fix plugins-install-dependencies [fixes #720] 2014-10-18 02:23:33 +01:00
Pierre
3def960bf0 Update vagrant installation instructions
Avoids 
```
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
```
that can occur on certain Vagrant images. Since we need readonly anyway, might as well use HTTPS instead of SSH.
2014-10-16 18:59:32 -04:00
Jose Diaz-Gonzalez
b8b364fd91 Merge pull request #717 from kristofsajdak/patch-1
Update plugins.md
2014-10-16 10:24:51 -04:00
kristofsajdak
d8d759aea9 Update plugins.md 2014-10-16 09:21:38 +02:00
Jose Diaz-Gonzalez
1663a153a6 Merge branch 'dependencies_hook' 2014-10-16 01:21:21 -04:00
Stafford Brunk
e94b46cb0c Add a dependencies hook for plugin dependency management 2014-10-16 01:19:38 -04:00
Jose Diaz-Gonzalez
10b5ee0321 Merge branch 'patch-1' 2014-10-16 00:50:06 -04:00
Jose Diaz-Gonzalez
2d737dc554 Env vars only set at run time. Closes #555 2014-10-16 00:45:55 -04:00
Jose Diaz-Gonzalez
9fb14d9f28 Merge branch 'fix-variable-name' 2014-10-16 00:42:01 -04:00
Cameron Martin
44cf7f09f9 Fixed variable name.
RESTART_APP was initialized as RESTART.
2014-10-16 00:41:55 -04:00
Jose Diaz-Gonzalez
2f818b81ee Merge branch 'fix-port-ip' 2014-10-16 00:37:24 -04:00
Ludovic Perrine
4cea884f16 Fixed port removal when docker is start with --ip with an IP other than 0.0.0.0 2014-10-16 00:37:11 -04:00
Jose Diaz-Gonzalez
0e590796c0 Merge branch 'check-config-changes' 2014-10-16 00:33:10 -04:00
Ludovic Perrine
0ec9ecad08 Restart app only if config changed 2014-10-16 00:30:07 -04:00
Jose Diaz-Gonzalez
5f5e05bba6 Merge branch 'install_man-db' 2014-10-16 00:08:13 -04:00
protomouse
59e078440d Explicitly install man-db
Dokku requires mandb, but the man-db package is not part of the
minimal Ubuntu base - so install it.
2014-10-16 00:07:51 -04:00
Jose Diaz-Gonzalez
83feec8398 Merge pull request #698 from tombell/clean-up-help
Make `help` command output more consistent
2014-10-15 23:33:34 -04:00
Jose Diaz-Gonzalez
2d0271547d Merge pull request #708 from progrium/576-fix-vagrant
576 fix vagrant
2014-10-15 23:31:13 -04:00
Michael Hobbs
09df79cd8b Merge pull request #1 from expa/mh-merge-upstream
merge from upstream
2014-10-09 11:32:18 -07:00
Michael Hobbs
9c0667c51a Merge remote-tracking branch 'upstream/master' into mh-merge-upstream 2014-10-09 11:29:48 -07:00
Jose Diaz-Gonzalez
b9eed22e35 Change targets to vagrant-* 2014-10-06 18:33:03 -04:00
Jose Diaz-Gonzalez
42a999e7cd Merge pull request #709 from rinti/documentation-fixes
various grammar fixes, spell fixes and added missing words
2014-10-06 11:12:28 -04:00
Andreas Bernacca
48efdb83e7 various grammar fixes, spell fixes and added missing words 2014-10-05 22:36:01 +02:00
Jose Diaz-Gonzalez
ab44c915a8 Add a passthru make target for running dokku commands within the vagrant vm 2014-10-04 18:39:31 -04:00
Jose Diaz-Gonzalez
14145eebb1 Simplify the vagrant workflow
- Moved from wget to cloning the repository
- Add acl-add command to Make
- Modify the docs to use the new methodology
2014-10-04 18:39:31 -04:00
Jose Diaz-Gonzalez
a67c2c927d Fix issue where certain hosts will not have add-apt-repository installed due to missing packages 2014-10-04 18:39:31 -04:00
Jose Diaz-Gonzalez
c5026cafa1 Ensure curl is installed before using command 2014-10-04 18:39:31 -04:00
Jose Diaz-Gonzalez
a748e123be Silence curl stderr progress output 2014-10-04 18:39:31 -04:00
Jose Diaz-Gonzalez
2e5f88b285 Use -qq flag on apt-get to quiet installations of packages 2014-10-04 18:39:28 -04:00
Jose Diaz-Gonzalez
b848accd56 Merge pull request #706 from progrium/docs
Consolidate documentation for viewthedocs
2014-10-04 05:03:59 -04:00
Jose Diaz-Gonzalez
002269a664 Consolidate readme/wiki docs into organized docs folder 2014-10-04 05:01:34 -04:00
Jose Diaz-Gonzalez
fae98dabd4 Merge pull request #703 from jazzzz/help-with-no-parameter
Display help when invoking dokku with no parameter
2014-10-04 03:12:21 -04:00
Jose Diaz-Gonzalez
e1740cda18 Merge pull request #701 from jazzzz/fix-key-format
Fixed key format check
2014-10-02 18:34:15 -04:00
Ludovic Perrine
ab3e00297c Display help when invoking dokku with no parameter 2014-10-02 17:36:29 +02:00
Ludovic Perrine
42df908c65 Fixed key format check 2014-10-02 12:13:09 +02:00
Tom Bell
42c9d7aaa6 Actually suppress the output from the git commands 2014-09-30 21:08:23 +01:00
Tom Bell
d9952bcae8 Make help output more consistent 2014-09-30 19:48:06 +01:00
Jose Diaz-Gonzalez
a69f63c98c Merge pull request #696 from progrium/revert-657-CNAME_option
Revert "Add CNAME option"
2014-09-29 23:46:51 -04:00
Jose Diaz-Gonzalez
db7e36e0ca Revert "Add CNAME option" 2014-09-29 23:44:23 -04:00
Michael Hobbs
5fcba7e288 port 'wait_to_retire' from broadly/dokku 2014-09-02 18:18:14 -07:00
Alex Ernst
22beb6c007 move post-deploy hook
Write $DOKKU_ROOT/$APP/URL before post-deploy hook.
2014-08-22 12:36:20 +02:00
Jeff Lindsay
4e9d797d45 Merge pull request #657 from arthurnn/CNAME_option
Add CNAME option
2014-08-19 16:28:43 -05:00
Jeff Lindsay
07cdab6187 Merge pull request #562 from assaf/zero-downtime
Zero down-time deploy and server checks
2014-08-18 21:08:09 -05:00
Sam Dodrill
939a876348 contrib: add dokku client shell script
This is adapted from the one I use in my shell profile scripts. This
kinda-sorta-maybe acts like the `heroku` or `deis` commands and does
some clever reorganization of data before sending it to the server.

To use the app name generator, install the `elfs` rock from Moonrocks.
2014-08-16 19:05:20 -07:00
Arthur Neves
0cd1839ce8 Add CNAME option
When a repo have a CNAME file, it will use the URL on it to map the server_name on ngnix
2014-08-14 14:43:35 -04:00
Fabien Bochu
22cdc11d57 Use PLUGIN_PATH in dokku default case. 2014-08-13 21:27:47 +02:00
Jeff Lindsay
8760c94143 Merge pull request #628 from voronianski/master
Update Vagrant box to trusty because of raring server issues
2014-08-08 12:49:30 -05:00
Dmitri Voronianski
1feaeecee3 update box to trusty 2014-07-16 15:14:33 +03:00
joliv
d269782812 Updated man page date
I forgot to change it. I even left myself a reminder!
2014-05-10 16:43:21 -04:00
joliv
fde5054e0f Added man page plugin command warning
As of now, the man page does not update when plugins are installed.
2014-05-10 16:32:27 -04:00
rhy-jot
4f5fc58629 Update cipher list
http://blog.cloudflare.com/killing-rc4-the-long-goodbye
2014-05-07 15:10:12 -07:00
Assaf Arkin
00ec004871 Zero down-time deploy and server checks
This change makes Dokku start up the new container, run a set of checks
against it, and only switch traffic over to the new containers if all
checks complete successfully. No requests are dropped during the switch
over.

To specify checks, add a CHECKS file to the root of your project
directory. This is a text file with one line per check. Empty lines and
lines starting with # are ignored.

A check is a relative URL and may be followed by expected content from
the page, for example:

  /about     Our Amazing Team

Even if you don’t use any checks, this change will prevent downtime
during switching from old to new container.

See: https://labnotes.org/zero-downtime-deploy-with-dokku/
2014-04-28 21:28:50 -07:00
rhy-jot
42fee25f2f 13.10 is EOL in ~2 months & there's a successor 2014-04-18 17:36:13 -07:00
rhy-jot
beca39a55a Mention 14.04 & 12.10 sunset 2014-04-18 17:35:43 -07:00
rhy-jot
9ac94abcf0 Merge pull request #544 from jfrazelle/master
dokku.conf
2014-04-15 15:04:55 -07:00
Jessica Frazelle
969aed87c6 double brackets 2014-04-15 09:31:08 -04:00
Jessica Frazelle
2953ed2486 if dokku.conf has not been created, create it 2014-04-14 20:24:18 -04:00
rhy-jot
2f12a371e0 Update stable's version 2014-04-13 10:23:31 -07:00
rhy-jot
63f45e37ff Merge pull request #521 from ElliotChong/patch-1
Adding note re: pushing to master for deployments.
2014-04-09 16:00:53 -07:00
rhy-jot
1f4c1b5871 Merge pull request #522 from wingrunr21/improve_ssl_support
Improve SSL support and implement SPDY
2014-04-09 15:59:52 -07:00
rhy-jot
9432a380d0 Merge pull request #535 from assaf/docker-0.10
CHANGED use namespace dokku for docker 0.10 compatibility
2014-04-09 14:09:52 -07:00
Assaf Arkin
2474844856 CHANGED use namespace dokku for docker 0.10 compatibility 2014-04-09 13:06:52 -07:00
Stafford Brunk
1d7422efb9 Add note about HSTS header to README 2014-04-08 06:53:30 -06:00
Stafford Brunk
e2135a2c5f Change cert folder name from ssl to tls 2014-04-08 06:48:50 -06:00
Stafford Brunk
1d16541362 Update the TLS documentation for how to enable and for SPDY support 2014-04-03 10:44:28 -06:00
Stafford Brunk
22c25dc40a Implement nginx spdy support 2014-04-03 07:20:18 -06:00
Stafford Brunk
dfac47cbe2 Allow symlinks for SSL cert detection in nginx-vhosts post-deploy 2014-04-03 07:15:21 -06:00
Stafford Brunk
bd5b2b210c Factor common SSL settings out to the http block 2014-04-03 07:05:30 -06:00
Stafford Brunk
e33f5c94a5 Use listen 443 ssl instead of ssl on in vhost conf file 2014-04-03 07:04:35 -06:00
Elliot Chong
80d6188032 Adding note re: pushing to master for deployments. 2014-04-02 17:57:38 -07:00
rhy-jot
6d82792508 Merge pull request #516 from eitland/patch-1
Add details on how to use wildcard ssls
2014-03-31 21:29:09 -04:00
eitland
e2a5e92cf7 s/ssl/TLS/g + domain name must match for wildcards
* Updated ssl to TLS as requested.
* Added information that names must match
2014-03-31 22:53:01 +02:00
eitland
9e49bc12ed Add details on how to use wildcard ssls
After reading the source code for hints on how to deploy wildcard ssls I found it was already supported.

The proposed change should make this feature easier to find.
2014-03-31 21:27:19 +02:00
rhy-jot
4907c3c684 Merge pull request #488 from lucaswilric/ip-regex
Validate vhosts names more strictly
2014-03-12 15:13:32 -04:00
Lucas Wilson-Richter
69c13f1bd3 Improve IP detection regex so it isn't fooled by domains that
look like IP addresses.
2014-03-12 07:47:21 +11:00
Lucas Wilson-Richter
3fcc49ff00 Validate vhosts names more strictly
There was a bug in the setup page where valid domains that start with a number
would be captured by the validation check designed to detect IP
addresses. This check detects IPs by comparing the host name to a regex,
instead of simply detecting whether the first character is a number.
2014-03-10 17:05:37 +11:00
rhy-jot
0c49481282 Merge pull request #481 from elia/master
Ensure the app is really running before killing it
2014-03-08 17:45:20 -05:00
rhy-jot
900fe6fe8c Delete test application when finished with it 2014-03-08 17:33:04 -05:00
rhy-jot
2368f2d65d Add test for the multi buildpack, courtesy of https://github.com/AlJohri 2014-03-08 13:28:02 -08:00
rhy-jot
f6b7b62b15 Update PREBUILT_STACK_URL 2014-03-08 13:25:09 -08:00
rhy-jot
a9af04db81 Merge pull request #476 from joliv/master
Man page
2014-03-08 18:27:41 +00:00
joliv
c5665e1e83 Moved addman in Makefile as to not break everything 2014-03-08 12:23:22 -05:00
joliv
09610c1e4e Added manpage installation 2014-03-08 11:46:46 -05:00
joliv
dd4c390168 Added man page 2014-03-08 11:29:25 -05:00
Elia Schito
b1267ebf56 Ensure the app is really running before killing it 2014-03-07 00:54:54 +01:00
rhy-jot
7fc7a46ed3 Merge pull request #475 from alimony/patch-1
Fix typo.
2014-03-03 21:12:40 +00:00
Markus Amalthea Magnuson
0e46eba05b Fix typo.
prefered -> preferred
2014-03-03 21:37:36 +01:00
rhy-jot
c2ae9fabe0 No need for bin/. (see also: acf2dfa73a) 2014-02-28 16:41:21 -08:00
rhy-jot
ee7d3295c9 Follow redirects 2014-02-28 16:40:12 -08:00
rhy-jot
082ba1dc96 Update PREBUILT_STACK_URL 2014-02-28 16:39:51 -08:00
rhy-jot
ceeff6d09f Update stable's version 2014-02-28 23:52:19 +00:00
rhy-jot
25f4a81b71 Merge pull request #467 from silasb/fixing-log-tail
Using logs --follow instead of attaching to instance
2014-02-27 15:16:56 -08:00
silasb
37f977a68d If passing -t for tail, use logs --follow else just get last 100 lines 2014-02-25 21:23:01 -05:00
silasb
75286cdfa1 Using logs --follow instead of attaching to instance 2014-02-24 18:48:46 -05:00
rhy-jot
217d00a1bc Merge pull request #440 from imchairmanm/patch-1
Bump version number in dokku-installer.rb
2014-02-17 10:00:09 -08:00
rhy-jot
12c907b148 Merge pull request #443 from gdi2290/patch-1
update copyright year
2014-02-17 09:59:54 -08:00
rhy-jot
8c237153d2 Merge pull request #454 from dmyers/vagrant-memory
Added option to set memory size for vagrant
2014-02-17 09:59:19 -08:00
Derek Myers
4ec4354b0a Added option to set memory size for vagrant 2014-02-15 17:06:39 -06:00
PatrickJS
59dfe6b529 update copyright year 2014-02-03 22:53:56 -08:00
rhy-jot
f4d3d80075 SSL -> TLS 2014-02-03 10:13:09 -08:00
rhy-jot
af8e103bb3 Recommend 12.04 due to 13.04's EOL 2014-02-03 10:05:41 -08:00
imchairmanm
0272e87433 Bump version number in dokku-installer.rb
Just bumping the version number to bring it up-to-date with the rest of the project.
2014-02-02 13:00:53 -05:00
Paul Lietar
c5b7a63c8d Merge pull request #415 from JasonPunyon/patch-1
Fix typo in README.md
2014-01-12 09:43:06 -08:00
Jason Punyon
88433433dc Fix typo in README.md
aditional -> additional
2014-01-11 19:36:29 -05:00
rhy-jot
8fca2204ed Merge pull request #407 from banyan/specify-docker-version
Add $DOCKER_VERSION to specify docker version
2014-01-08 13:27:30 -08:00
Paul Lietar
acb226cb86 Merge pull request #400 from aegypius/suppress-git-output-unless-dokku-trace-is-enabled
Suppress git "detached HEAD" notice output
2014-01-07 05:32:34 -08:00
aegypius
d208e53649 Suppress git advice related to detached HEAD 2014-01-07 14:30:29 +01:00
Kohei Hasegawa
57906fa562 Add $DOCKER_VERSION to specify docker version 2014-01-07 00:21:58 +09:00
Paul Lietar
3a3b56c7ab Merge pull request #405 from AlJohri/master
Fix docker build for docker v0.7.3
2014-01-06 04:04:12 -08:00
Al Johri
a892a920a8 Docker build no longer works with github url
Change default URL for progrium/buildstep to include full git clone url
2014-01-06 06:00:42 -06:00
rhy-jot
f0c41e3a81 Merge pull request #370 from jazzzz/submodules
Submodule support
2013-12-28 19:50:23 -08:00
Jazz
7b28307306 Added submodules test 2013-12-28 16:10:50 +01:00
Jazz
7f0591fa1e Submodules support 2013-12-28 16:10:13 +01:00
rhy-jot
419efc2cf1 Merge pull request #391 from mikexstudios/receive-predir-fix
Fix edge case: app directory is created before first app push
2013-12-23 19:13:32 -08:00
Michael Huynh
d9ed1e07eb Fix edge case: app directory is created before first app push
When an app directory (i.e. `/home/dokku/myapp`) is created before the
app is pushed for the first time (which may occur if config files such
as `ENV` are added before the initial push), then the app directory will
not be initialized to a bare git repo nor will the pre-receive hook be
installed because `plugins/git/commands` assumes that if `$APP_PATH`
exists, then the directory must also be git initialized too. This fix
checks for `$APP_PATH/refs` instead.
2013-12-23 21:50:49 -05:00
rhy-jot
3ee694d3ea Merge pull request #383 from colnpanic/features/notify-non-master-push
notify user when pushing to non-master branch
2013-12-22 14:09:08 -08:00
jay becker
7eae3b063c notify user when pushing to non-master branch 2013-12-22 14:30:51 -06:00
rhy-jot
c16afaa338 Merge pull request #390 from rhy-jot/2013-12-20/java-test
Add Java test
2013-12-20 11:45:09 -08:00
rhy-jot
921bdc48a6 Add Java test 2013-12-20 11:35:00 -08:00
rhy-jot
b602cd3127 Update dig command
Was changed in da11349e81
2013-12-19 20:22:07 -08:00
rhy-jot
d72b79a18d Update stable’s bootstrap command 2013-12-19 18:07:20 -08:00
rhy-jot
723cf1d43d Merge pull request #382 from joliv/patch-1
README grammar
2013-12-18 17:23:15 -08:00
rhy-jot
693800d709 Merge pull request #321 from mikexstudios/remove-image-var
For #313: Do not specify both `$APP` and `$IMAGE` for base commands.
2013-12-18 14:18:51 -08:00
Michael Huynh
28de3ecaa3 For #313: Do not specify both $APP and $IMAGE for base commands.
As discussed in #313, dokku base commands such as build, release, and
deploy require specifying both `$APP` and `$IMAGE` as arguments where
`IMAGE="app/$APP"`. Thus, the `$IMAGE` parameter is currently redudant.

This patch removes the need to specify `$IMAGE` for these base commands
and is backwards compatible. If, in the future, the base commands expect
and `$IMAGE` different than `app/$APP`, then the `$IMAGE` parameter will
be re-added for those specific commands.
2013-12-18 17:01:56 -05:00
Paul Lietar
bd21149e8d Merge pull request #381 from alexanderbeletsky/post-build
Add a post-build hook
2013-12-17 00:40:50 -08:00
Paul Lietar
c2aaa94523 Merge pull request #384 from colnpanic/features/notify-kill-failed
Ignore failures when trying to stop containers.
2013-12-17 00:26:32 -08:00
jay becker
1050f350c0 do not exit when docker fails 2013-12-16 16:55:16 -06:00
joliv
ec9e61d2bc README grammar
Some confused me as I was scrolling through the docs (missing pronouns) and others were more nit-picky.
2013-12-14 20:13:04 -05:00
rhy-jot
74dfb605d7 Print datestamp before doing anything
This lets easily see if Travis' "restart build" feature is working properly
2013-12-14 11:28:46 -08:00
alexanderbeletsky
b206c2b4f5 added post-build hook 2013-12-14 18:26:39 +02:00
rhy-jot
8210323ece Mention LTS support & additional instruction 2013-12-12 22:01:43 -08:00
Paul Lietar
fff066b120 Merge pull request #373 from plietar/tests-hooks
Allow tests to have a setup phase.
2013-12-11 20:17:53 -08:00
Paul Lietar
48b4e330a3 Add a config test. 2013-12-12 03:54:39 +00:00
Paul Lietar
baefdabdfc Allow tests to have a setup phase. 2013-12-12 03:54:39 +00:00
Paul Lietar
acf2dfa73a Use the node binary from the PATH.
The new nodejs buildpack has changed the location of the node binary.
Using the PATH make the test pass on both buildpacks.
refs #371
2013-12-12 03:51:39 +00:00
Paul Lietar
9876561fa9 Merge pull request #355 from plietar/static-test
Add a static website test.
2013-12-03 11:21:45 -08:00
Paul Lietar
2f97afb3f0 Add a static website test. 2013-12-03 19:13:14 +00:00
rhy-jot
776c7c38af Merge pull request #363 from progrium/2013-12-03/reenable-go
Reenable go test
2013-12-03 10:01:29 -08:00
rhy-jot
f64e27f32e Reenable go test 2013-12-03 09:51:47 -08:00
rhy-jot
6718094237 Merge pull request #361 from plietar/backup-check
Backup check
2013-12-02 15:34:55 -08:00
rhy-jot
c77cbf1d3a Merge pull request #358 from dyson/DOCKER_ARGS
For #304: Add $DOCKER_ARGS and docker-args pluginhook to dokku deploy and command run.
2013-12-02 12:59:52 -08:00
Dyson Simmons
1e76aba0af Pipe no op into docker-args plugin-hooks to avoid problems when running over ssh w/o a pty. 2013-12-01 00:14:01 +11:00
Paul Lietar
5c58a5e8e7 Add a backup-check to avoid reimporting apps. 2013-11-30 02:46:42 +00:00
Paul Lietar
a4451e82ac Merge ssh keys rather than overwriting them. 2013-11-30 02:45:58 +00:00
Paul Lietar
4e737e739f Add a backup-check used to validate the archive.
This allows plugins to refuse a backup, before the import process starts.
Users can force the import using -f.
2013-11-30 02:45:32 +00:00
Paul Lietar
4da4995a18 Only delete core plugins. 2013-11-29 20:57:53 +00:00
Paul Lietar
78591a618b Remove plugins before copying them again.
This way plugins can rename/delete files w/o having old files lying around.
2013-11-29 20:57:53 +00:00
Dyson Simmons
aaa4f0fade Add $DOCKER_ARGS and docker-args pluginhook to dokku deploy and command run. 2013-11-29 15:52:26 +11:00
Lukas Schauer
56de22a3c8 conditional installation of python-software-properties 2013-11-28 16:09:47 -08:00
rhy-jot
1705307081 Link to freenode's webchat 2013-11-28 12:57:22 -08:00
rhy-jot
dd356d02ee Clean up first. This allows users to get logs from failed runs before they're wiped out. Ref: #354 2013-11-28 11:20:09 -08:00
rhy-jot
c317dca558 Merge pull request #342 from plietar/no-container
Don't fail if CONTAINER is inexistant.
2013-11-27 13:18:31 -08:00
rhy-jot
9eff936676 Remove outdated sed. Fixes #346
Starting apps on daemon start has been handed by the upstart 'dokku-redeploy' script for a while. (Also, the format of /etc/init/docker.conf changed and rendered the sed useless.)
2013-11-27 12:50:22 -08:00
rhy-jot
882e7ac5fe Merge pull request #348 from progrium/no-root
Drop root privileges if necessary.
2013-11-27 12:39:33 -08:00
Lukas Schauer
95c9656fc8 nginx vhost ipv6 compatibility
IPv6 Compatibility (Nginx Default Site is IPv6 compatible, resulting in not-working vhosts when AAAA DNS entry is set)
2013-11-27 12:03:38 -08:00
Paul Lietar
432aec67d5 Update HISTORY.md to reflect the v0.2 release. 2013-11-27 03:36:50 +00:00
Paul Lietar
2ed527bedc Drop root privileges if necessary.
This makes it possible to call dokku commands as root.
2013-11-25 23:04:35 +00:00
rhy-jot
698e5e5d0e Add stable installation instructions 2013-11-23 17:22:51 -08:00
Paul Lietar
10a8c75224 Add an empty help message to the nginx-vhosts plugin.
Not doing anything just destroys the help message coming from previous
plugins. Run cat to forward stdin into stdout.
2013-11-23 00:10:30 +00:00
Paul Lietar
8a9182c859 Don't fail if CONTAINER is inexistant. 2013-11-22 22:58:02 +00:00
rhy-jot
e42c028d18 Merge pull request #344 from plietar/commandfix
Fix commands, the easy way.
2013-11-22 14:54:07 -08:00
Paul Lietar
7ed57b285c Close stdin before running the backup-export hooks.
This avoids hanging when we're not in a pty.
2013-11-22 22:46:54 +00:00
Paul Lietar
99e0a43f81 Remove known issues and add note about ForceTTY
These issues are fixed by this PR.
2013-11-22 22:22:20 +00:00
Paul Lietar
e126da0db2 Don't explicitly specify streams to docker run.
Now that "docker run" always has an stdin, we don't need to explicitly
specify stdout and stderr.
2013-11-22 21:42:48 +00:00
Paul Lietar
455be29249 Fix commands, the easy way.
Don't use pluginhook to run the commands hook, just run all the scripts
in a loop.
2013-11-22 21:42:39 +00:00
rhy-jot
3f487b2291 Merge pull request #341 from plietar/known-issues
Add a list of known issues.
2013-11-21 15:31:12 -08:00
Paul Lietar
9ec7501940 Add a list of known issues. 2013-11-21 21:01:08 +00:00
Jeff Lindsay
a9e0a7b57e remove any default enabled sites for nginx 2013-11-21 13:03:55 -06:00
rhy-jot
f4018db310 Use $DOKKU_ROOT instead of $HOME 2013-11-21 10:48:55 -08:00
rhy-jot
cb781f9ce1 Merge pull request #337 from ryanseys/patch-1
Fix capitalization for consistency
2013-11-20 18:05:19 -08:00
Ryan Seys
ad9fe82bc7 Fix capitalization for consistency 2013-11-20 20:59:00 -05:00
rhy-jot
dfcc46b1d2 Merge pull request #334 from plietar/version
Add a version command.
2013-11-20 16:46:45 -08:00
Paul Lietar
4bc45256ff Add the date and time of installation if version is hardcoded. 2013-11-21 00:41:03 +00:00
Paul Lietar
725a2e02da Use a hardcoded version if git revision is not available. 2013-11-21 00:27:56 +00:00
Paul Lietar
252b1ed8b6 Add a version command.
The git tag/revision is saved when running "make install", and can be
displayed using "dokku version".
2013-11-21 00:02:02 +00:00
rhy-jot
9953030478 Merge pull request #333 from rhy-jot/2013-11-20/backup-find-to-glob
backup:export: find -> glob
2013-11-20 15:48:35 -08:00
rhy-jot
e8037da726 Use globs, set nullglob, and remove stdout redirection for import 2013-11-20 15:40:50 -08:00
Paul Lietar
e85ab7bab4 Add support for DOKKU_TAG in bootstrap.sh
Fixes #330
Refs #329
2013-11-20 23:40:42 +00:00
Alexander
d11f732595 Merge branch 'history'
* history:
  Update HISTORY.md
2013-11-20 23:53:21 +01:00
Alexander
f9db09fb21 Update HISTORY.md 2013-11-20 23:51:27 +01:00
Paul Lietar
557d555858 Delete the /cache directory's contents from inside the container.
Fixes #322.
Buildpacks write into /cache as root, which made the delete command unable
to delete it.
Its contents are now deleted using "docker run", and thus as root.
2013-11-20 20:42:15 +00:00
168 changed files with 5715 additions and 618 deletions

16
.editorconfig Normal file
View File

@@ -0,0 +1,16 @@
root = true
[*]
insert_final_newline = true
indent_style = space
indent_size = 2
[Makefile]
insert_final_newline = true
indent_style = tab
indent_size = 4
[*.mk]
insert_final_newline = true
indent_style = tab
indent_size = 4

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
.vagrant
.DS_Store
stack.tgz
build
tmp
*.deb

View File

@@ -4,12 +4,15 @@
Alexander <iam.asm89@gmail.com>
Alexander Beletsky <alexander.beletsky@gmail.com>
Alexis Gavoty <kload@kload.fr>
Christian Joudrey <cmallette@gmail.com>
Felipe Coury <felipe.coury@gmail.com>
Jeff Lindsay <progrium@gmail.com>
Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
Leo Unbekandt <leo@unbekandt.eu>
Ludovic Perrine <jazzzz@gmail.com>
Luigi Maselli <grigio.org@gmail.com>
Martin Weiss <kornnflake@gmail.com>
Michael Hobbs <github@psudo.net>
Paul Lietar <paul@lietar.net>
Rajiv Makhijani <rajiv@blue-tech.org>
rhy-jot <rhy-jot@myeml.net>

View File

@@ -1,11 +1,205 @@
# History
## 0.2.0 (in progress)
## 0.3.14
* Cache dir is preserved across builds
- #891: @josegonzalez Keep existing configuration files when installing nginx. Refs #886
- #892: @josegonzalez Change documentation on where the ssh config PORT is setup
- #894: @josegonzalez Dokku client improvements
- #895: @michaelhobbs Document deploying private git submodules. Closes #644
- #896: @michaelhobbs Add docker-args pluginhook call to build phase. Closes #515
- #897: @michaelhobbs Official PS plugin
- #898: @joliv Update man page for 0.3.13
- #899: @joliv Use help2man to automatically generate man pages
- #900: @michaelhobbs Support extracting SANs from SSL certificates and adding them to nginx config
- #901: @misto Pull new tags when upgrading to update VERSION
- #904: @michaelhobbs Prevent error on restartall when no apps deployed
- #905: @vincentfretin robv/dokku-elasticsearch not compatible with latest version
- #907: @vincentfretin Don't use -o pipefail for plugin
- #914: @michaelhobbs Conditionally set interactive and tty on dokku run. Closes #552. Closes #913
- #915: @michaelhobbs Document default sites in nginx. Closes #650
- #916: @michaelhobbs Document build phase troubleshooting suggestions. Closes #841. Closes #911.
- #917: @michaelhobbs Document resolvconf troubleshooting step. Closes #649
- #922: @michaelhobbs Use tty cmd to detect if we have one. Closes #921
- #925: @michaelhobbs Implement rebuild command that reuses git_archive_all
- #926: @dyson Update Troubleshooting link in README.md.
- #927: @michaelhobbs Support both docker-args PHASE and docker-args-PHASE. Closes #906
- #933: @michaelhobbs Remove references to .pem. Closes #930
- #936: @michaelhobbs Only execute build stack if we have access to /var/run/docker.sock. Closes #929
- #938: @vincentfretin Enable ssl_prefer_server_ciphers
- #940: @michaelhobbs Use valid composer json with specified php runtime
- #941: @michaelhobbs Source global env prior to app env. Closes #931
- #942: @michaelhobbs Test clojure app
- #949: @michaelhobbs Common functions library with simple argument parsing. Closes #932. Closes #945
## 0.3.13
- #815: @abossard Added wordpress installation helper to plugin index
- #858: @josegonzalez Disable server tokens in nginx. Closes #857
- #859: @josegonzalez Pass command being executed when retrieving DOCKER_ARGS via pluginhook.
- #861: @josegonzalez Default DOKKU_ROOT to ~dokku if unspecified. Closes #587
- #863: @josegonzalez Add missing properties to the php composer.json
- #864: @michaelhobbs bind docker container to internal port if using vhosts
- #867: @michaelhobbs silent grep stderr. closes #862
- #868: @michaelhobbs use circleci for automated testing
- #872: @michaelhobbs fix/enable multi buildpack test
- #873: @michaelhobbs support pre deployment usage of domains plugin. fixes interface binding issue
- #874: @josegonzalez Add advanced installation docs that were removed in #706. Closes #869
- #876: @vincentfretin give CACHE_PATH env variable for forward compatibility with herokuish
- #877: @michaelhobbs add MH to AUTHORS
- #880: @michaelhobbs disable VHOST deployment if global VHOST file is missing and an app domain has not been added
- #881: @jomo troubleshooting typo: 64 != 46
- #884: @michaelhobbs IP and PORT are likely to get clobbered. rename them
- #885: @michaelhobbs test deploy node app without procfile
## 0.3.12
- #846: @michaelhobbs add certificate CN to app VHOST if it's not already
- #847: @leonardodino Update bootstrap.sh: new docs url
- #849: @cjoudrey Add docs for CHECKS
- #850: @michaelhobbs test scala deployment
## 0.3.11
- #821: @michaelhobbs use wercker for automated testing
- #833: @michaelhobbs auto remove the cache dir cleanup container
- #835: @michaelhobbs make sure we match the specific string in VHOST
- #838: @michaelhobbs quote build_env vars to allow for spaces in config
- #839: @michaelhobbs notify irc on builds
- #844: @michaelhobbs build app urls based on wildcard ssl or app ssl
## 0.3.10
- #783: @josegonzalez New domains plugin and nginx extension
- #818: @michaelhobbs rebuild nginx config on domain change
- #827: @michaelhobbs Handle IP only access
- #828: @michaelhobbs Display the port for an app when falling back to the ip address
## 0.3.9
- #787: @josegonzalez/@michaelhobbs Official user-env-compile plugin
- Uses ENV and APP/ENV files
- Supports old `BUILD_ENV` files (which are likely in wide-use)
- Allows user's to override globals with app-specific configuration
- Migrate `$DOKKU_ROOT/BUILD_ENV` to `$DOKKU_ROOT/ENV` if the former exists and the latter does not
- Drop `BUILD_ENV` support in favor of just `ENV` via a `mv` command
- Add default ENV with `CURL_TIMEOUT` and `CURL_CONNECT_TIMEOUT`
- #811: @abossard Increased `server_names_hash_bucket_size` in nginx.conf to 512
- #814: @josegonzalez Source files in $DOKKU_ROOT/.dokkurc directory and add `dokku trace` command
- #816: @josegonzalez Add documentation for user-env feature
## 0.3.8
- #796: @josegonzalez Better vagrant documentation
- #801: @joelvh Point users to upgrade guides
- #805: @ademuk Fixed import-ssl server.crt/key check
- #806: @josegonzalez Dokku pushes now happen as the dokku user, not git. Refs #796
- #807: @josegonzalez Write proper nginx conf upon installation. Closes #799
- #808: @josegonzalez Ensure makefiles are properly formatted
## 0.3.7
- #788: @mmerickel fix apps plugin issues in 0.3.6
- #789: @mmerickel do not output message when creating ENV file
## 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
## 0.2.0 (2013-11-24)
* Added DOKKU_TRACE variable for verbose trace information
* Added an installer (for pre-built images)
* Application config (environment variable management)
* Backup/import plugin
* Basic hooks/plugin system
* Cache dir is preserved across builds
* Command to delete an application
* Exposed commands over SSH using sshcommand
* Git handling is moved to a plugin
* Integration test coverage
* Pulled nginx vhosts out into plugin
* Run command

View File

@@ -1,7 +1,7 @@
Copyright (C) 2013 Jeff Lindsay
Copyright (C) 2014 Jeff Lindsay
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,24 +1,70 @@
DOKKU_VERSION = master
SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand
PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb
STACK_URL ?= github.com/progrium/buildstep
PREBUILT_STACK_URL ?= https://s3.amazonaws.com/progrium-dokku/progrium_buildstep_79cf6805cf.tgz
STACK_URL ?= https://github.com/progrium/buildstep.git
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-12-16/2014-12-16_42bd9f4aab.tar.gz
PLUGINS_PATH ?= /var/lib/dokku/plugins
.PHONY: all install copyfiles 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
include tests.mk
include deb.mk
all:
# Type "make install" to install.
install: dependencies stack copyfiles plugins
install: dependencies stack copyfiles plugin-dependencies plugins version
release: deb-all package_cloud packer
package_cloud:
package_cloud push dokku/dokku/ubuntu/trusty buildstep*.deb
package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb
package_cloud push dokku/dokku/ubuntu/trusty pluginhook*.deb
package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb
package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb
packer:
packer build contrib/packer.json
copyfiles:
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
$(MAKE) addman
addman:
mkdir -p /usr/local/share/man/man1
help2man -Nh help -v version -n "configure and get information from your dokku installation" -o /usr/local/share/man/man1/dokku.1 dokku
mandb
version:
git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION
plugin-dependencies: pluginhook
dokku plugins-install-dependencies
plugins: pluginhook docker
dokku plugins-install
dependencies: sshcommand pluginhook docker stack
dependencies: sshcommand pluginhook docker stack help2man
help2man:
apt-get install -qq -y help2man
sshcommand:
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
@@ -30,22 +76,32 @@ 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
apt-get install -y lxc-docker
ifdef DOCKER_VERSION
apt-get install -qq -y lxc-docker-${DOCKER_VERSION}
else
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`
ifndef CI
lsmod | grep aufs || modprobe aufs || apt-get install -qq -y linux-image-extra-`uname -r` > /dev/null
endif
stack:
ifeq ($(shell test -e /var/run/docker.sock && touch -a -c /var/run/docker.sock && echo $$?),0)
@echo "Start building buildstep"
ifdef BUILD_STACK
@docker images | grep progrium/buildstep || docker build -t progrium/buildstep ${STACK_URL}
@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 ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep
@docker images | grep progrium/buildstep || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep
endif
endif
count:
@@ -55,3 +111,21 @@ count:
@find plugins -type f | xargs cat | wc -l
@echo "Test lines:"
@find tests -type f | xargs cat | wc -l
dokku-installer:
apt-get install -qq -y ruby
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)'"

130
README.md
View File

@@ -1,138 +1,32 @@
# Dokku
# Dokku [![Build Status](https://circleci.com/gh/progrium/dokku/tree/master.svg?style=svg&circle-token=eec5b442dda53a4d229911dd97d4214853acc262 "Build Status")](https://circleci.com/gh/progrium/dokku/tree/master) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku)
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
[![Build Status](https://travis-ci.org/progrium/dokku.png?branch=master)](https://travis-ci.org/progrium/dokku)
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
## Requirements
Assumes Ubuntu 13 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 13.04 is recommended until these issues are resolved.**
- A fresh VM running Ubuntu `14.04 x64`
## Installing
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
To install the latest stable version of dokku, you can run the following bootstrapper command:
This may take around 5 minutes. Certainly better than the several hours it takes to bootstrap Cloud Foundry.
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.14/bootstrap.sh | sudo DOKKU_TAG=v0.3.14 bash
You may also wish to take a look at the [advanced installation](http://progrium.viewdocs.io/dokku/advanced-installation) document for aditional installation options.
### Upgrading
## Configuring
[View the docs for upgrading](http://progrium.viewdocs.io/dokku/upgrading) from an older version of Dokku.
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 the hostname the host has. This file only created if the hostname can be resolved by dig (`dig +short $HOSTNAME`). Otherwise you have to create the file manually and set it to your prefered domain. If this file still 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).
## Documentation
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!
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.
## 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
```
## SSL support
Dokku provides easy SSL support from the box. To enable SSL connection to your application, copy `.crt` and `.key` file into `/home/dokku/:app/ssl` folder (notice, file names should be `server.crt` and `server.key`, respectively). Redeployment of application will be needed to apply SSL configuration. Once it redeployed, application will be accessible by `https://` (redirection from `http://` is applied as well).
## 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
You can use [Github Issues](https://github.com/progrium/dokku/issues), check [Troubleshooting](http://progrium.viewdocs.io/dokku/troubleshooting) in the documentation, 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

1
SPONSORS Normal file
View File

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

38
Vagrantfile vendored
View File

@@ -1,11 +1,13 @@
# -*- 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"] || "1024"
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
PREBUILT_STACK_URL = File.exist?("#{File.dirname(__FILE__)}/stack.tgz") ? 'file:///root/dokku/stack.tgz' : nil
PUBLIC_KEY_PATH = "#{Dir.home}/.ssh/id_rsa.pub"
make_cmd = "make install"
if PREBUILT_STACK_URL
@@ -13,19 +15,43 @@ if PREBUILT_STACK_URL
end
Vagrant::configure("2") do |config|
config.ssh.forward_agent = true
config.vm.box = BOX_NAME
config.vm.box_url = BOX_URI
config.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.hostname = "#{DOKKU_DOMAIN}"
config.vm.network :private_network, ip: DOKKU_IP
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
# Ubuntu's Raring 64-bit cloud image is set to a 32-bit Ubuntu OS type by
# default in Virtualbox and thus will not boot. Manually override that.
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
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.define "empty", autostart: false
config.vm.define "dokku", primary: true do |vm|
vm.vm.network :forwarded_port, guest: 80, host: 8080
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
end
config.vm.define "dokku-deb", autostart: false do |vm|
vm.vm.network :forwarded_port, guest: 80, host: 8080
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
end
config.vm.define "build", autostart: false do |vm|
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
end
if Pathname.new(PUBLIC_KEY_PATH).exist?
config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub'
config.vm.provision :shell, :inline => "rm /root/.ssh/authorized_keys && mv /tmp/id_rsa.pub /root/.ssh/authorized_keys"
end
end

29
bootstrap.sh Normal file → Executable file
View File

@@ -1,21 +1,36 @@
#!/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
echo "This installation script requires apt-get. For manual installation instructions, consult http://progrium.viewdocs.io/dokku/advanced-installation ."
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 help2man
[[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties
cd ~
test -d dokku || git clone $DOKKU_REPO
cd dokku
git fetch origin
if [[ -n $DOKKU_BRANCH ]]; then
git checkout origin/$DOKKU_BRANCH
elif [[ -n $DOKKU_TAG ]]; then
git checkout $DOKKU_TAG
fi
cd ~ && test -d dokku || git clone $DOKKU_REPO
cd dokku && test $DOKKU_BRANCH && git checkout origin/$DOKKU_BRANCH || true
make install
echo
echo "Almost done! For next steps on configuration:"
echo " https://github.com/progrium/dokku#configuring"
echo " http://progrium.viewdocs.io/dokku/installation#user-content-configuring"

29
circle.yml Normal file
View File

@@ -0,0 +1,29 @@
machine:
services:
- docker
dependencies:
cache_directories:
- "~/docker"
override:
# need to add the dokku user to the docker group
- sudo -E CI=true make -e sshcommand
- sudo usermod -G docker dokku
- sudo -E CI=true DOCKER_VERSION=1.4.1 make -e install: { timeout: 300 }
- make -e ci-dependencies
#### circle does some weird *expletive* with regards to root and gh auth (needed for gitsubmodules test)
- sudo rsync -a ~ubuntu/.ssh/ ~root/.ssh/
- sudo chown -R root:root ~root/.ssh/
- sudo sed -e 's:/home/ubuntu:/root:g' ~root/.ssh/config
####
- sudo -E make -e setup-deploy-tests
post:
- sudo -E make -e lint
- sudo -E make -e unit-tests
test:
override:
### deploy tests (against buildstep release) ####
- sudo -E make -e deploy-tests: { timeout: 1800 }
### deploy tests (against buildstep master) ####
- sudo docker rmi -f progrium/buildstep
- sudo -E BUILD_STACK=true make -e stack
- sudo -E make -e deploy-tests: { timeout: 1800 }

View File

@@ -3,119 +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
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 -f /etc/nginx/sites-enabled/*`
puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot."
exit
end
version = "v0.2.0"
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.14"
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") && !isNaN($("#hostname").val()[0])) {
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://&lt;app-name&gt;."+$("#hostname").val())
} else {
$("#example").html("http://"+$("#hostname").val()+":&lt;app-port&gt;")
}
}
$("#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://&lt;app-name&gt;."+$("#hostname").val())
} else {
$("#example").html("http://"+$("#hostname").val()+":&lt;app-port&gt;")
}
}
$("#vhost").change(update);
$("#hostname").change(update);
update();
</script>
</body>
</html>
</html>

112
contrib/dokku_client.sh Executable file
View File

@@ -0,0 +1,112 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
MOVES=(ABLE ABNORMA AGAIN AIREXPL ANG ANGER ASAIL ATTACK AURORA AWL BAN BAND BARE BEAT BEATED BELLY BIND BITE BLOC BLOOD BODY BOOK BREATH BUMP CAST CHAM CLAMP CLAP CLAW CLEAR CLI CLIP CLOUD CONTRO CONVY COOLHIT CRASH CRY CUT DESCRI D-FIGHT DIG DITCH DIV DOZ DRE DUL DU-PIN DYE EARTH EDU EG-BOMB EGG ELEGY ELE-HIT EMBODY EMPLI ENGL ERUPT EVENS EXPLOR EYES FALL FAST F-CAR F-DANCE FEARS F-FIGHT FIGHT FIR FIRE FIREHIT FLAME FLAP FLASH FLEW FORCE FRA FREEZE FROG G-BIRD GENKISS GIFT G-KISS G-MOUSE GRADE GROW HAMMER HARD HAT HATE H-BOMB HELL-R HEMP HINT HIT HU HUNT HYPNOSI INHA IRO IRONBAR IR-WING J-GUN KEE KICK KNIF KNIFE KNOCK LEVEL LIGH LIGHHIT LIGHT LIVE L-WALL MAD MAJUS MEL MELO MESS MILK MIMI MISS MIXING MOVE MUD NI-BED NOISY NOONLI NULL N-WAVE PAT PEACE PIN PLAN PLANE POIS POL POWDE POWE POWER PRIZE PROTECT PROUD RAGE RECOR REFLAC REFREC REGR RELIV RENEW R-FIGHT RING RKICK ROCK ROUND RUS RUSH SAND SAW SCISSOR SCRA SCRIPT SEEN SERVER SHADOW SHELL SHINE SHO SIGHT SIN SMALL SMELT SMOK SNAKE SNO SNOW SOU SO-WAVE SPAR SPEC SPID S-PIN SPRA STAM STARE STEA STONE STORM STRU STRUG STUDEN SUBS SUCID SUN-LIG SUNRIS SUPLY S-WAVE TAILS TANGL TASTE TELLI THANK TONKICK TOOTH TORL TRAIN TRIKICK TUNGE VOLT WA-GUN WATCH WAVE W-BOMB WFALL WFING WHIP WHIRL WIND WOLF WOOD WOR YUJA)
NAMES=(SEED GRASS FLOWE SHAD CABR SNAKE GOLD COW GUIKI PEDAL DELAN B-FLY BIDE KEYU FORK LAP PIGE PIJIA CAML LAT BIRD BABOO VIV ABOKE PIKAQ RYE SAN BREAD LIDEL LIDE PIP PIKEX ROK JUGEN PUD BUDE ZHIB GELU GRAS FLOW LAFUL ATH BALA CORN MOLUF DESP DAKED MIMI BOLUX KODA GELUD MONK SUMOY GEDI WENDI NILEM NILE NILEC KEZI YONGL HUDE WANLI GELI GUAIL MADAQ WUCI WUCI MUJEF JELLY SICIB GELU NELUO BOLI JIALE YED YEDE CLO SCARE AOCO DEDE DEDEI BAWU JIUG BADEB BADEB HOLE BALUX GES FANT QUAR YIHE SWAB SLIPP CLU DEPOS BILIY YUANO SOME NO YELA EMPT ZECUN XIAHE BOLEL DEJI MACID XIHON XITO LUCK MENJI GELU DECI XIDE DASAJ DONGN RICUL MINXI BALIY ZENDA LUZEL HELE5 0FENB KAIL JIAND CARP JINDE LAPU MUDE YIFU LINLI SANDI HUSI JINC OUMU OUMUX CAP KUIZA PUD TIAO FRMAN CLAU SPARK DRAGO BOLIU GUAIL MIYOU MIY QIAOK BEIL MUKEI RIDED MADAM BAGEP CROC ALIGE OUDAL OUD DADA HEHE YEDEA NUXI NUXIN ROUY ALIAD STICK QIANG LAAND PIQI PI PUPI DEKE DEKEJ NADI NADIO MALI PEA ELECT FLOWE MAL MALI HUSHU NILEE YUZI POPOZ DUZI HEBA XIAN SHAN YEYEA WUY LUO KEFE HULA CROW YADEH MOW ANNAN SUONI KYLI HULU HUDEL YEHE GULAE YEHE BLU GELAN BOAT NIP POIT HELAK XINL BEAR LINB MAGEH MAGEJ WULI YIDE RIVE FISH AOGU DELIE MANTE KONMU DELU HELU HUAN HUMA DONGF JINCA HEDE DEFU LIBY JIAPA MEJI HELE BUHU MILK HABI THUN GARD DON YANGQ SANAQ BANQ LUJ PHIX SIEI EGG)
function random_number() {
[[ -n "$1" ]] && RANGE="$1"
if [[ -n "$RANGE" ]];then
number=$RANDOM
let "number %= $RANGE"
else
number=$RANDOM
fi
echo $number
}
function random_name() {
NUM1=$(random_number ${#MOVES[@]})
NUM2=$(random_number ${#MOVES[@]})
NUM3=$(random_number ${#NAMES[@]})
UPPER_APPNAME="${MOVES[${NUM1}]}-${MOVES[${NUM2}]}-${NAMES[${NUM3}]}"
[[ "$BASH_VERSION" =~ 4.* ]] && lower_appname=${UPPER_APPNAME,,}
[[ -z "$lower_appname" ]] && lower_appname=$(echo $UPPER_APPNAME | tr '[:upper:]' '[:lower:]')
echo "$lower_appname"
}
function client_help_msg() {
echo "==> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku"
echo "--> i.e. git remote add dokku dokku@<dokku-host>:<app-name>"
exit 20 # exit with specific status. only used in units tests for now
}
if [[ -z $DOKKU_HOST ]]; then
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
else
client_help_msg
fi
fi
if [[ ! -z $DOKKU_HOST ]]; then
function _dokku {
appname=""
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
set +e
appname=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
set -e
else
echo "This is not a git repository"
fi
if [[ "$appname" != "" ]] && [[ -n "$*" ]]; then
case "$1" in
apps|backup*|help|plugins*|ps:restartall|trace|version)
true
;;
apps:destroy)
if [[ -z "$2" ]] || [[ "$2" == "force" ]];then
donotshift="YES"
fi
;;
*)
donotshift="YES"
;;
esac
fi
if [[ "$1" = "apps:create" ]] && [[ -z "$2" ]]; then
appname=$(random_name)
counter=0
while ssh "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do
if [[ $counter -ge 100 ]];then
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
ssh "dokku@$DOKKU_HOST" apps
exit 1
else
appname=$(random_name)
counter=$((counter+1))
fi
done
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
return $?
fi
if [[ -z "$donotshift" ]]; then
ssh "dokku@$DOKKU_HOST" "$@"
exit $?
fi
[[ -z "$verb" ]] && verb=$1
shift
ssh "dokku@$DOKKU_HOST" "$verb" "$appname" "$@"
}
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]]; then
_dokku "$@"
exit $?
fi
else
client_help_msg
fi

32
contrib/packer.json Normal file
View File

@@ -0,0 +1,32 @@
{
"builders": [
{
"type": "digitalocean",
"region": "nyc3",
"image": "ubuntu-14-04-x64"
}
],
"provisioners": [
{
"type": "file",
"source": "deb.mk",
"destination": "/tmp/Makefile"
},
{
"type": "shell",
"inline": [
"echo '--> Waiting 30 seconds for core services to be available'",
"sleep 30",
"echo '--> Updating apt repositories'",
"sudo apt-get update > /dev/null",
"echo '--> Installing make requirement'",
"sudo apt-get -qq -y install build-essential",
"cd /tmp && make install-from-deb",
"rm /root/.ssh/authorized_keys"
]
}
]
}

159
deb.mk Normal file
View File

@@ -0,0 +1,159 @@
BUILDSTEP_DESCRIPTION = 'Buildstep uses Docker and Buildpacks to build applications like Heroku'
BUILDSTEP_REPO_NAME ?= progrium/buildstep
BUILDSTEP_VERSION ?= 0.0.1
BUILDSTEP_ARCHITECTURE = amd64
BUILDSTEP_PACKAGE_NAME = buildstep_$(BUILDSTEP_VERSION)_$(BUILDSTEP_ARCHITECTURE).deb
DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash'
DOKKU_REPO_NAME ?= progrium/dokku
DOKKU_ARCHITECTURE = amd64
PLUGINHOOK_DESCRIPTION = 'Simple dispatcher and protocol for shell-based plugins, an improvement to hook scripts'
PLUGINHOOK_REPO_NAME ?= progrium/pluginhook
PLUGINHOOK_VERSION ?= 0.0.1
PLUGINHOOK_ARCHITECTURE = amd64
PLUGINHOOK_PACKAGE_NAME = pluginhook_$(PLUGINHOOK_VERSION)_$(PLUGINHOOK_ARCHITECTURE).deb
SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app'
SSHCOMMAND_REPO_NAME ?= progrium/sshcommand
SSHCOMMAND_VERSION ?= 0.0.1
SSHCOMMAND_ARCHITECTURE = amd64
SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb
GEM_ARCHITECTURE = amd64
GOROOT = /usr/lib/go
GOBIN = /usr/bin/go
GOPATH = /home/vagrant/gocode
.PHONY: install-from-deb deb-all deb-buildstep deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand
install-from-deb:
echo "--> Installing docker gpg key"
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
echo "--> Installing dokku gpg key"
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
echo "--> Setting up apt repositories"
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
echo "--> Running apt-get update"
sudo apt-get update > /dev/null
echo "--> Installing pre-requisites"
sudo apt-get install -y linux-image-extra-`uname -r` apt-transport-https
echo "--> Installing dokku"
sudo apt-get install -y dokku
echo "--> Done!"
deb-all: deb-buildstep deb-dokku deb-gems deb-pluginhook deb-sshcommand
mv /tmp/*.deb .
echo "Done"
deb-setup:
echo "-> Updating deb repository and installing build requirements"
sudo apt-get update > /dev/null
sudo apt-get install -qq -y git ruby1.9.1-dev 2>&1 > /dev/null
command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
ssh -o StrictHostKeyChecking=no git@github.com || true
deb-buildstep: deb-setup
rm -rf /tmp/tmp /tmp/build $(BUILDSTEP_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
echo "-> Creating deb files"
echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install
echo "sleep 5" >> /tmp/tmp/post-install
echo "count=\`sudo docker images | grep progrium/buildstep | wc -l\`" >> /tmp/tmp/post-install
echo 'if [ "$$count" -ne 0 ]; then' >> /tmp/tmp/post-install
echo " echo 'Removing old buildstep image'" >> /tmp/tmp/post-install
echo " sudo docker rmi progrium/buildstep" >> /tmp/tmp/post-install
echo "fi" >> /tmp/tmp/post-install
echo "echo 'Importing buildstep into docker (around 5 minutes)'" >> /tmp/tmp/post-install
echo "sudo docker build -t progrium/buildstep /var/lib/buildstep 1> /dev/null" >> /tmp/tmp/post-install
echo "-> Cloning repository"
git clone -q "git@github.com:$(BUILDSTEP_REPO_NAME).git" /tmp/tmp/buildstep > /dev/null
rm -rf /tmp/tmp/buildstep/.git /tmp/tmp/buildstep/.gitignore
echo "-> Copying files into place"
mkdir -p "/tmp/build/var/lib"
cp -rf /tmp/tmp/buildstep /tmp/build/var/lib/buildstep
echo "-> Creating $(BUILDSTEP_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n buildstep -v $(BUILDSTEP_VERSION) -a $(BUILDSTEP_ARCHITECTURE) -p $(BUILDSTEP_PACKAGE_NAME) --deb-pre-depends 'lxc-docker >= 1.4.0' --after-install /tmp/tmp/post-install --url "https://github.com/$(BUILDSTEP_REPO_NAME)" --description $(BUILDSTEP_DESCRIPTION) --license 'MIT License' .
mv *.deb /tmp
deb-dokku: deb-setup
rm -rf /tmp/tmp /tmp/build dokku_*_$(DOKKU_ARCHITECTURE).deb
mkdir -p /tmp/tmp /tmp/build
cp -r debian /tmp/build/DEBIAN
mkdir -p /tmp/build/usr/local/bin
mkdir -p /tmp/build/var/lib/dokku
mkdir -p /tmp/build/usr/local/share/man/man1
mkdir -p /tmp/build/usr/local/share/dokku/contrib
cp dokku /tmp/build/usr/local/bin
cp -r plugins /tmp/build/var/lib/dokku
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/plugins/$$plugin/.core; done
cp dokku.1 /tmp/build/usr/local/share/man/man1/dokku.1
cp contrib/dokku-installer.rb /tmp/build/usr/local/share/dokku/contrib
git describe --tags > /tmp/build/var/lib/dokku/VERSION
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
sed -i "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control
dpkg-deb --build /tmp/build "/vagrant/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
mv *.deb /tmp
deb-gems: deb-setup
rm -rf /tmp/tmp /tmp/build rubygem-*.deb
mkdir -p /tmp/tmp /tmp/build
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp rack -v 1.5.2 > /dev/null
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp rack-protection -v 1.5.3 > /dev/null
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp sinatra -v 1.4.5 > /dev/null
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp tilt -v 1.4.1 > /dev/null
find /tmp/tmp/cache -name '*.gem' | xargs -rn1 fpm -d ruby -d ruby --prefix /var/lib/gems/1.9.1 -s gem -t deb -a $(GEM_ARCHITECTURE)
mv *.deb /tmp
deb-pluginhook: deb-setup
rm -rf /tmp/tmp /tmp/build $(PLUGINHOOK_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
echo "-> Cloning repository"
git clone -q "git@github.com:$(PLUGINHOOK_REPO_NAME).git" /tmp/tmp/pluginhook > /dev/null
rm -rf /tmp/tmp/pluginhook/.git /tmp/tmp/pluginhook/.gitignore
echo "-> Copying files into place"
mkdir -p /tmp/build/usr/local/bin $(GOPATH)
sudo apt-get install -qq -y git golang mercurial 2>&1 > /dev/null
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && go get "code.google.com/p/go.crypto/ssh/terminal"
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/pluginhook && go build -o pluginhook
mv /tmp/tmp/pluginhook/pluginhook /tmp/build/usr/local/bin/pluginhook
echo "-> Creating $(PLUGINHOOK_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n pluginhook -v $(PLUGINHOOK_VERSION) -a $(PLUGINHOOK_ARCHITECTURE) -p $(PLUGINHOOK_PACKAGE_NAME) --url "https://github.com/$(PLUGINHOOK_REPO_NAME)" --description $(PLUGINHOOK_DESCRIPTION) --license 'MIT License' .
mv *.deb /tmp
deb-sshcommand: deb-setup
rm -rf /tmp/tmp /tmp/build $(SSHCOMMAND_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
echo "-> Cloning repository"
git clone -q "git@github.com:$(SSHCOMMAND_REPO_NAME).git" /tmp/tmp/sshcommand > /dev/null
rm -rf /tmp/tmp/sshcommand/.git /tmp/tmp/sshcommand/.gitignore
echo "-> Copying files into place"
mkdir -p "/tmp/build/usr/local/bin"
cp /tmp/tmp/sshcommand/sshcommand /tmp/build/usr/local/bin/sshcommand
chmod +x /tmp/build/usr/local/bin/sshcommand
echo "-> Creating $(SSHCOMMAND_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n sshcommand -v $(SSHCOMMAND_VERSION) -a $(SSHCOMMAND_ARCHITECTURE) -p $(SSHCOMMAND_PACKAGE_NAME) --url "https://github.com/$(SSHCOMMAND_REPO_NAME)" --description $(SSHCOMMAND_DESCRIPTION) --license 'MIT License' .
mv *.deb /tmp

0
debian/conffiles vendored Normal file
View File

10
debian/control vendored Normal file
View File

@@ -0,0 +1,10 @@
Package: dokku
Version: 0.3.12
Section: base
Priority: optional
Architecture: amd64
Depends: locales, git, make, curl, software-properties-common, lxc-docker (>= 1.4.0), gcc, python-software-properties, man-db, buildstep, sshcommand, pluginhook
Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt
Provides: dokku
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
Description: Docker powered mini-Heroku in around 100 lines of Bash

28
debian/postinst vendored Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
set -e
case "$1" in
abort-upgrade|abort-remove|abort-deconfigure)
;;
configure)
mandb
[ ! -x /usr/bin/docker.io ] || ln -sf /usr/bin/docker.io /usr/local/bin/docker
modprobe aufs || echo "WARNING: Restart server to finish installing dokku!"
sshcommand create dokku /usr/local/bin/dokku
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
dokku plugins-install
if [ -f /etc/init/dokku-installer.conf ] && service dokku-installer status 2> /dev/null | grep waiting; then
sudo service dokku-installer start
fi
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

37
debian/preinst vendored Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
set -e
case "$1" in
install)
INIT_CONF="/etc/init/dokku-installer.conf"
NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf"
rm -f $INIT_CONF
touch $INIT_CONF
echo 'start on runlevel [2345]' >> $INIT_CONF
echo 'exec /usr/local/share/dokku/contrib/dokku-installer.rb selfdestruct' >> $INIT_CONF
rm -f $NGINX_CONF
touch $NGINX_CONF
echo 'upstream dokku-installer { server 127.0.0.1:2000; }' >> $NGINX_CONF
echo 'server {' >> $NGINX_CONF
echo ' listen 80;' >> $NGINX_CONF
echo ' location / {' >> $NGINX_CONF
echo ' proxy_pass http://dokku-installer;' >> $NGINX_CONF
echo ' }' >> $NGINX_CONF
echo '}' >> $NGINX_CONF
rm -f /etc/nginx/sites-enabled/*
service nginx reload
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

View File

@@ -2,37 +2,36 @@
## 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:
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
```shell
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:
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
```shell
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:
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
```shell
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.
Dokku ships with a pre-built version of 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.
$ git clone https://github.com/progrium/dokku.git
$ cd dokku
$ sudo BUILD_STACK=true make install
[buildstep]: https://github.com/progrium/buildstep
```shell
git clone https://github.com/progrium/dokku.git
cd dokku
sudo BUILD_STACK=true make install
```

View File

@@ -0,0 +1,120 @@
# 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 dokku dokku@dokku.me:node-js-app
$ git push dokku 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.dokku.me
```
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 dokku <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.
## Deploying with private git submodules
Dokku uses git locally (i.e. not a docker image) to build its own copy of your app repo, including submodules. This is done as the `dokku` user. Therefore, in order to deploy private git submodules, you'll need to drop your deploy key in `~dokku/.ssh` and potentially add github.com (or your VCS host key) into `~dokku/.ssh/known_hosts`. A decent test like this should help confirm you've done it correctly.
```
su - dokku
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
ssh -T git@github.com
```
## 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 dokku dokku@dokku.me:node-js-app
$ git push dokku master
Is deployed to,
remote: -----> Application deployed:
remote: http://node-js-app.dokku.me
You can also specify fully qualified names, say `app.dokku.me`, as
$ git remote add dokku dokku@dokku.me:app.dokku.me
$ git push dokku master
So, after deployment the application will be available at,
remote: -----> Application deployed:
remote: http://app.dokku.me
This is in particular useful, then you want to deploy to root domain, as
$ git remote add dokku dokku@dokku.me:dokku.me
$ git push dokku master
... deployment ...
remote: -----> Application deployed:
remote: http://dokku.me
# Zero downtime deploy
Following a deploy Dokku's default behaviour is to switch new traffic over to the new container immediately.
This can be problematic for applications that take some time to boot up and can lead to `502 Bad Gateway` errors.
Dokku provides a way to run a set of checks against the new container, and only switch traffic over if all checks complete successfully.
To specify checks, add a `CHECKS` file to the root of your project directory. This is a text file with one line per check. Empty lines and lines starting with `#` are ignored.
A check is a relative URL and may be followed by expected content from the page, for example:
```
/about Our Amazing Team
```
Dokku will wait `DOKKU_CHECKS_WAIT` seconds (default: `5`) before running the checks to give server time to start. For shorter/longer wait, change the `DOKKU_CHECKS_WAIT` environment variable.
Dokku will wait `DOKKU_WAIT_TO_RETIRE` seconds (default: `60`) before stopping the old container such that no existing connections to it are dropped.
# Removing a deployed app
SSH onto the server, then execute:
```shell
dokku delete myapp
```

8
docs/components.md Normal file
View 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.

View File

@@ -0,0 +1,16 @@
# 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 available both at at run time and during the application build/compilation step. You no longer need a `user-env` plugin as Dokku handles this functionality in a way equivalent to how Heroku handles it.
> Note: Global `BUILD_ENV` files are currently migrated into a global `ENV` file and sourced before app-specific variables. This means that app-specific variables will take precedence over global variables. Configuring your global `ENV` file is manual, and should be considered potentially dangerous as configuration applies to all applications.

88
docs/dns.md Normal file
View 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

View File

@@ -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.** It runs on one host. If you need more, have a look at [Deis](http://deis.io/).
* **Multitenancy.** Multi-app, and loosely multi-user based on SSH keys, but that's it.
* **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
View 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:
```shell
wget -qO- https://raw.github.com/progrium/dokku/v0.3.14/bootstrap.sh | sudo DOKKU_TAG=v0.3.14 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 dokku.me "sudo sshcommand acl-add dokku $USER"
That's it!
## Advanced installation
### Development via bash script
```shell
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:
```shell
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:
```shell
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:
```shell
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.
```shell
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
```
- Create VM
```
# Optional ENV arguments:
# - `BOX_NAME`
# - `BOX_URI`
# - `BOX_MEMORY`
# - `DOKKU_DOMAIN`
# - `DOKKU_IP`.
cd path/to/dokku
vagrant up
```
- Setup SSH Config in `~/.ssh/config`. The port listed here is usually correct, though you may want to verify that it is the same as the one listed in the output of `vagrant ssh-config`
```
Host dokku.me
Port 2222
```
- 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:
```shell
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:
```shell
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
```

175
docs/nginx.md Normal file
View File

@@ -0,0 +1,175 @@
# 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` 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` 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`.
## Customizing the nginx configuration
> New as of 0.3.10
Dokku currently templates out an nginx configuration that is included in the `nginx-vhosts` plugin. If you'd like to provide a custom template for your application, you should copy the existing template - ssl or non-ssl - into your `$DOKKU_ROOT/$APP` directory at the file `nginx.conf.template`.
For instance - assuming defaults - to customize the nginx template in use for the `myapp` application, create a file at `/home/dokku/myapp/nginx.conf.template` with the following contents:
```
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
# set a custom header for requests
add_header X-Served-By www-ec2-01;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}
```
The above is a sample, http configuration that adds an `X-Served-By` header to requests. The template is manually uploaded this template file and **must** it owned by `dokku:dokku`.
## 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:
```shell
#!/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.
You can also use the built-in `domains` plugin to handle:
### Disabling VHOSTS
If desired, it is possible to disable vhosts by setting the `NO_VHOST` environment variable:
```shell
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.
### Domains plugin
> New as of 0.3.10
The domains plugin allows you to specify custom domains for applications. This plugin is aware of any ssl certificates that are imported via `nginx:import-ssl`. Be aware that setting `NO_VHOST` will override any custom domains.
Custom domains are also backed up via the built-in `backup` plugin
```shell
# where `myapp` is the name of your app
# add a domain to an app
dokku domains:add myapp example.com
# list custom domains for app
dokku domains myapp
# clear all custom domains for app
dokku domains:clear myapp
# remove a custom domain from app
dokku domains:remove myapp example.com
```
### Container network interface binding
> New as of 0.3.13
The deployed docker container running your app's web process will bind to either the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`) or an external interface (i.e. 0.0.0.0) depending on dokku's VHOST configuration. Dokku will attempt to bind to the internal docker network interface unless you specifically set NO_VHOST for the given app or your dokku installation is not setup to use VHOSTS (i.e. $DOKKU_ROOT/VHOST is missing or $DOKKU_ROOT/HOSTNAME is set to an IPv4 or IPv6 address)
```shell
# container bound to docker interface
root@dokku:~/dokku# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute goofy_albattani
root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' goofy_albattani
172.17.0.6
# container bound to all interfaces (previous default)
root@dokku:/home/dokku# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp nostalgic_tesla
```
# Default site
By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to nginx. This will catch all unknown HOST header values and return a `410 Gone` response.
```
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 410;
log_not_found off;
}
```

271
docs/plugins.md Normal file
View File

@@ -0,0 +1,271 @@
# 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
```shell
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:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
case "$1" in
hello)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
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.
- Be sure you want the "set -eo pipefail" option. Look at the following example :
```shell
IMAGE=$(docker images | grep "user/repo" | awk '{print $3}')
if [[ -z $IMAGE ]]; then
echo "user/repo image not found... Did you run 'dokku plugins-install'?"
exit 1
fi
```
In the case where the "user/repo" is not installed, dokku exits just before the awk command,
you will never see the message printed with echo. You just want "set -e" in this case.
Here is the documentation of the 'set -eo pipefail' option:
```
help set
Options:
-e Exit immediately if a command exits with a non-zero status.
-o option-name
pipefail the return value of a pipeline is the status of
the last command to exit with a non-zero status,
or zero if no command exited with a non-zero status
```
## 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 |
| [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>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 |
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
| [Wordpress](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | Dokku dev, mariadb, volume, domains |
| [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][] | Not compatible with >= 0.3.0 (still uses /home/git) |
| [Elasticsearch](https://github.com/jezdez/dokku-elasticsearch-plugin) | [jezdez][] | Compatible with 0.2.0 to 0.3.13 |
| [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.

View File

@@ -0,0 +1,13 @@
# Process/Container management
Dokku supports rudimentary process (really container) management via the `ps` plugin.
```
ps <app> List processes running in app container(s)
ps:start <app> Start app container(s)
ps:stop <app> Stop app container(s)
ps:restart <app> Restart app container(s)
ps:restartall Restart all deployed app containers
```
*NOTE*: As of v0.3.14, `dokku deploy:all` in now deprecated by `ps:restartall` and will be removed in a future version.

19
docs/remote-commands.md Normal file
View 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@dokku.me <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 dokku.me
RequestTTY yes
```
## Run a command in the app environment
It's possible to run commands in the environment of the deployed application:
```shell
dokku run node-js-app ls -alh
dokku run <app> <cmd>
```

105
docs/template.html Normal file
View 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>

143
docs/troubleshooting.md Normal file
View File

@@ -0,0 +1,143 @@
## 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 64 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.
To enable dokku tracing, simply run the following command:
# Since 0.3.9
dokku trace
In versions older than 0.3.9, you can 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 [gist](https://gist.github.com) containing the full log, and create an issue.
***
__Symptom:__ I get the aforementioned error in the build phase (after turning on dokku tracing)
Most errors that happen in this phase are due to transient network issues (either locally or remotely) buildpack bugs.
__Solution (Less solution, more helpful troubleshooting steps):__
Find the failed phase's container image (*077581956a92* in this example)
```
root@dokku:~# docker ps -a | grep builder
94d9515e6d93 077581956a92 "/build/builder" 29 minutes ago Exited (0) 25 minutes ago cocky_bell
```
Start a new container with the failed image and poke around (i.e. ensure you can access the internet from within the container or attempt the failed command, if known)
```
root@dokku:~# docker run -ti 077581956a92 /bin/bash
root@9763ab86e1b4:/# curl -s -S icanhazip.com
192.168.0.1
curl http://s3pository.heroku.com/node/v0.10.30/node-v0.10.30-linux-x64.tar.gz -o node-v0.10.30-linux-x64.tar.gz
tar tzf node-v0.10.30-linux-x64.tar.gz
...
```
Sometimes (especially on DO) deploying again seems to get past these seemingly transient issues
Additionally we've seen issues if changing networks that have different DNS resolvers. In this case, you can run the following to update your resolv.conf
```
root@dokku:~# resolvconf -u
```
Please see https://github.com/progrium/dokku/issues/841 and https://github.com/progrium/dokku/issues/649
***
__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
View 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):
```shell
cd ~/dokku
git pull --tags origin master
sudo make install
```
Nothing needs to be restarted. Changes will take effect on the next push / deployment.
To update the build step:
```shell
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.
```shell
> 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 ps:restartall`
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.

204
dokku
View File

@@ -1,77 +1,164 @@
#!/usr/bin/env bash
set -eo pipefail
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
shopt -s nullglob
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
export DOKKU_NOT_IMPLEMENTED_EXIT=10
export DOKKU_VALID_EXIT=0
source "$PLUGIN_PATH/common/functions"
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done
[[ $DOKKU_TRACE ]] && set -x
parse_args "$@"
for arg in "$@"; do
[[ "$arg" =~ ^-.* ]] && shift 1
done
! has_tty && DOKKU_QUIET_OUTPUT=1
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
if [[ $1 =~ config-* ]];then
xargs $0 <<<$SSH_ORIGINAL_COMMAND
exit $?
else
$0 $SSH_ORIGINAL_COMMAND
exit $?
fi
fi
case "$1" in
receive)
APP="$2"; IMAGE="app/$APP"
echo "-----> Building $APP ..."
cat | dokku build $APP $IMAGE
echo "-----> Releasing $APP ..."
dokku release $APP $IMAGE
echo "-----> Deploying $APP ..."
dokku deploy $APP $IMAGE
echo "-----> Cleaning up ..."
APP="$2"; IMAGE="dokku/$APP"
dokku_log_info1 "Cleaning up ..."
dokku cleanup
echo "=====> Application deployed:"
echo " $(dokku url $APP)"
dokku_log_info1 "Building $APP ..."
cat | dokku build $APP
dokku_log_info1 "Releasing $APP ..."
dokku release $APP
dokku_log_info1 "Deploying $APP ..."
dokku deploy $APP
dokku_log_info2 "Application deployed:"
dokku urls $APP | sed "s/^/ /"
echo
;;
build)
APP="$2"; IMAGE="$3"; CACHE_DIR="$HOME/$APP/cache"
id=$(cat | docker run -i -a stdin progrium/buildstep /bin/bash -c "mkdir -p /app && tar -xC /app")
test $(docker wait $id) -eq 0
APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
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
pluginhook pre-build $APP $IMAGE
id=$(docker run -d -v $CACHE_DIR:/cache $IMAGE /build/builder)
pluginhook pre-build $APP
# *DEPRECATED* in v0.4.0: `pluginhook docker-args` will be removed in future releases
# https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906
DOCKER_ARGS=$(: | pluginhook docker-args $APP build)
DOCKER_ARGS+=$(: | pluginhook docker-args-build $APP)
id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build/builder)
docker attach $id
test $(docker wait $id) -eq 0
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
pluginhook post-build $APP
;;
release)
APP="$2"; IMAGE="$3"
pluginhook pre-release $APP $IMAGE
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
id=$(cat "$DOKKU_ROOT/$APP/ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/app-env.sh")
test $(docker wait $id) -eq 0
APP="$2"; IMAGE="dokku/$APP"
pluginhook pre-release $APP
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
fi
pluginhook post-release $APP $IMAGE
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh" < "$DOKKU_ROOT/$APP/ENV")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
fi
pluginhook post-release $APP
;;
deploy)
APP="$2"; IMAGE="$3"
pluginhook pre-deploy $APP $IMAGE
APP="$2"; IMAGE="dokku/$APP"
pluginhook pre-deploy $APP
# kill the app when running
if [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker kill $oldid > /dev/null
fi
# start the app
id=$(docker run -d -p 5000 -e PORT=5000 $IMAGE /bin/bash -c "/start web")
DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy)
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP)
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
if [[ "$BIND_EXTERNAL" = "false" ]];then
port=5000
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE /bin/bash -c "/start web")
ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id)
else
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.]*://')
ipaddr=127.0.0.1
fi
echo $ipaddr > "$DOKKU_ROOT/$APP/IP"
# 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
dokku_log_info1 "Running pre-flight checks"
pluginhook check-deploy $id $APP $port ${ipaddr:-localhost}
# 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
dokku_log_info1 "Running post-deploy"
pluginhook post-deploy $APP $port $ipaddr
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}"
dokku_log_info1 "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)
@@ -82,25 +169,52 @@ case "$1" in
pluginhook install
;;
# temporary hack for https://github.com/progrium/dokku/issues/82
deploy:all)
for app in $(ls -d $DOKKU_ROOT/*/); do
APP=$(basename $app);
IMAGE="app/$APP"
dokku deploy $APP $IMAGE
done
plugins-install-dependencies)
pluginhook dependencies
;;
help)
plugins-update)
pluginhook update
;;
# DEPRECATED as of v0.3.14
deploy:all)
echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions"
dokku ps:restartall
;;
help|'')
echo "Usage: dokku [-q|--quiet|-t|--trace|--rm-container|-rm] COMMAND <app> [command-specific-options]"
echo ""
echo "Options:"
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
;;
*)
pluginhook commands "$@"
implemented=0
for script in $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
dokku_log_warn "\`$*\` is not a dokku command."
dokku_log_warn "See \`dokku help\` for a list of available commands."
exit 1
fi
;;
esac

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
VERSION="$1"
IMPORT_DIR="$2"
TARGET_DIR="$3"
APPS="$(< $4 )"
ret=0
for app in $APPS; do
if [[ -d $TARGET_DIR/$app ]]; then
ret=1
echo "Trying to import application $app which already exists." 2>&1
fi
done
exit $ret

View File

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

View File

@@ -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 $TARGET_DIR/.ssh
mv $IMPORT_DIR/.ssh/authorized_keys $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 > tmpfile && mv tmpfile $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

View File

@@ -1,79 +1,108 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
case "$1" in
trace)
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p $DOKKU_ROOT/.dokkurc
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
echo "Valid trace options are [on/off]"
exit 1
}
if [[ "$2" == "on" ]]; then
echo "Enabling dokku trace"
echo "export DOKKU_TRACE=1" > $DOKKU_ROOT/.dokkurc/DOKKU_TRACE
fi
if [[ "$2" == "off" ]]; then
echo "Disabling dokku trace"
rm -f $DOKKU_ROOT/.dokkurc/DOKKU_TRACE
fi
;;
delete)
if [[ -z $2 ]]; then
echo "Please specify an app to delete"
exit 1
fi
APP="$2"; IMAGE="app/$APP";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App does not exist"
exit 1
fi
pluginhook pre-delete $APP
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker stop $ID > /dev/null
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
docker rm $ID > /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
verify_app_name "$2"
APP="$2";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
docker logs $CONTAINER | tail -n 100
if [[ $3 == "-t" ]]; then
docker attach $CONTAINER
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
if [[ $3 == "-t" ]]; then
docker logs --follow $CONTAINER
else
docker logs $CONTAINER | tail -n 100
fi
else
echo "Application's container not found"
fi
;;
run)
if [[ -z $2 ]]; then
echo "Please specify an app to run the command on"
exit 1
fi
APP="$2"; IMAGE="app/$APP"
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; IMAGE="dokku/$APP"
shift 2
docker run -i -t -a stdout -a stderr $IMAGE /exec "$@"
DOCKER_ARGS=$(: | pluginhook docker-args $APP run)
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP)
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
has_tty && DOKKU_RUN_OPTS+=" -i -t"
docker run $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE /exec "$@"
;;
url)
APP="$2";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
url | urls)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; SCHEME="http"; SSL="$DOKKU_ROOT/$APP/tls"; WILDCARD_SSL="$DOKKU_ROOT/tls"
if [[ -e "$SSL/server.crt" && -e "$SSL/server.key" ]] || [[ -e "$WILDCARD_SSL/server.crt" && -e "$WILDCARD_SSL/server.key" ]]; then
SCHEME="https"
fi
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
echo $(< "$DOKKU_ROOT/$APP/URL")
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
case "$1" in
url)
echo "$SCHEME://$(head -n1 "$DOKKU_ROOT/$APP/VHOST")"
;;
urls)
for vhost in $(< "$DOKKU_ROOT/$APP/VHOST"); do
echo "$SCHEME://$vhost"
done
;;
esac
elif [[ -f "$DOKKU_ROOT/VHOST" ]]; then
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
else
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$DOKKU_ROOT/$APP/PORT")"
fi
;;
version)
cat "$DOKKU_ROOT/VERSION" || {
echo "Unable to determine dokku's version" 2>&1
exit 1
}
;;
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
url <app> Show the first URL for an application (compatibility)
urls <app> Show all URLs for an application
version Print dokku's version
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac
cat

View File

@@ -1,21 +1,43 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
sed -i 's/docker -d$/docker -d -r=true/' /etc/init/docker.conf
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
hostname -f > $DOKKU_ROOT/HOSTNAME
fi
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
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)
script
sleep 2 # give docker some time
sudo -i -u dokku /usr/local/bin/dokku deploy:all
sudo -i -u dokku /usr/local/bin/dokku ps:restartall
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 ps:restartall
[Install]
WantedBy=multi-user.target
EOF
;;
esac

67
plugins/apps/commands Executable file
View File

@@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
case "$1" in
apps)
dokku_log_info2_quiet "My Apps"
find $DOKKU_ROOT -follow -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/$2" ]] && dokku_log_warn "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
verify_app_name "$2"
[[ "$2" == "tls" ]] && echo "Unable to destroy tls directory" && exit 1
APP="$2"; IMAGE="dokku/$APP"
[[ "$3" == "force" ]] && DOKKU_APPS_FORCE_DELETE=1
if [[ -z "$DOKKU_APPS_FORCE_DELETE" ]]; then
dokku_log_warn "WARNING: Potentially Destructive Action"
dokku_log_warn "This command will destroy $APP (including all add-ons)."
dokku_log_warn "To proceed, type \"$APP\""
echo ""
read -p "> " app_name
if [[ "$app_name" != "$APP" ]]; then
dokku_log_warn "Confirmation did not match $APP. Aborted."
exit 1
fi
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

View File

@@ -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
View File

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

View File

@@ -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"
@@ -9,10 +11,10 @@ set -e; case "$1" in
BACKUP_TMP_DIR=$(mktemp -d)
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
: | pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
pushd $BACKUP_DIR > /dev/null
ls -d */ | grep -oE '[^/]+' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
popd > /dev/null
# we want to insert the files in the root of the tar
@@ -24,15 +26,22 @@ 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
;;
backup:import)
if [[ $2 == "-f" ]]; then
force=true
shift
else
force=false
fi
INPUT_FILE="$2"
[[ -z $INPUT_FILE ]] && INPUT_FILE="-"
@@ -41,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..."
@@ -56,8 +65,17 @@ set -e; case "$1" in
BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
TARGET_DIR="$DOKKU_ROOT"
if ! pluginhook backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then
if $force; then
echo "-f used. Ignoring warnings."
else
echo "Archive did not pass sanity checks. Use -f to import anyway" >&2
exit 1
fi
fi
# create all the app directories
while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps > /dev/null
while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps
# have the plugins import their stuff
pluginhook backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
@@ -67,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
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac
cat

32
plugins/build-env/pre-build Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && rm "$DOKKU_ROOT/BUILD_ENV"
! (grep -q CURL_CONNECT_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_CONNECT_TIMEOUT=5" >> "$DOKKU_ROOT/ENV"
! (grep -q CURL_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_TIMEOUT=30" >> "$DOKKU_ROOT/ENV"
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
fi
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
BUILD_ENV+=" "
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
fi
if [[ ! -z "$BUILD_ENV" ]]; then
dokku_log_info1 "Adding BUILD_ENV to build environment..."
# create build env files for use in buildpacks like this:
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
id=$(echo $BUILD_ENV |sed 's@export @@g'| docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
# create build env for 'old style' buildpacks and dokku plugins
id=$(echo "$BUILD_ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
fi

76
plugins/checks/check-deploy Executable file
View File

@@ -0,0 +1,76 @@
#!/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/ENV" ]] && source $DOKKU_ROOT/ENV
[[ -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"
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 < "$FILENAME"
echo -e "\033[32m\033[1mAll checks successful!\033[0m"

73
plugins/common/functions Normal file
View File

@@ -0,0 +1,73 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
function has_tty() {
if [[ "$(/usr/bin/tty || true)" == "not a tty" ]]; then
return 1
else
return 0
fi
}
function dokku_log_info1() {
echo "-----> $@"
}
function dokku_log_info2() {
echo "=====> $@"
}
function dokku_log_info1_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
echo "-----> $@"
else
return 0
fi
}
function dokku_log_info2_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
echo "=====> $@"
else
return 0
fi
}
function dokku_log_verbose() {
echo " $@"
}
function dokku_log_warn() {
echo " ! $@"
}
function dokku_log_fail() {
echo "$@" 1>&2
exit 1
}
function verify_app_name() {
local APP="$1"
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
return 0
}
function parse_args() {
for arg in "$@"; do
case "$arg" in
--quiet|-q)
export DOKKU_QUIET_OUTPUT=1
;;
--trace|-t)
export DOKKU_TRACE=1
;;
--rm-container|-rm)
export DOKKU_RM_CONTAINER=1
;;
--force|-f)
export DOKKU_APPS_FORCE_DELETE=1
;;
esac
done
return 0
}

View File

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

View File

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

View File

@@ -1,75 +1,62 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
# 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 ] || {
touch $ENV_FILE
}
}
config_styled_hash () {
vars=`echo -e "$1"`
vars="$1"
prefix="$2"
longest=""
for word in $vars; do
KEY=`echo $word | cut -d"=" -f1`
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
KEY=`echo $word | cut -d"=" -f1`
VALUE=`echo $word | cut -d"=" -f2-`
while read -r word; do
KEY=$(echo $word | cut -d"=" -f1)
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//")
num_zeros=$((${#longest} - ${#KEY}))
zeros=" "
while [ $num_zeros -gt 0 ]; do
zeros="$zeros "
num_zeros=$(($num_zeros - 1))
num_zeros=$((num_zeros - 1))
done
echo "$KEY:$zeros$VALUE"
done
echo "$prefix$KEY:$zeros$VALUE"
done <<< "$vars"
}
config_restart_app() {
APP="$1"; IMAGE="app/$APP"
echo "-----> Releasing $APP ..."
dokku release $APP $IMAGE
echo "-----> Release complete!"
echo "-----> Deploying $APP ..."
dokku deploy $APP $IMAGE
echo "-----> Deploy complete!"
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
dokku ps:restart $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
verify_app_name "$2"
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=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
for var in "$@"; do
if [[ "$var" == "--shell" ]]; then
@@ -78,41 +65,49 @@ case "$1" in
fi
done
echo "=== $APP Config Vars"
dokku_log_info2_quiet "$APP config vars"
config_styled_hash "$VARS"
;;
;;
config:get)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
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-
;;
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | 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
verify_app_name "$2"
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}"`
ID=$(< "$APP_DIR/CONTAINER")
RESTART=false
VARS="${*:3}"
ENV_TEMP=$(cat "${ENV_FILE}")
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."
@@ -120,57 +115,63 @@ case "$1" in
fi
done
for var in $VARS; do
KEY=`echo ${var} | cut -d"=" -f1`
VALUE=`echo ${var} | cut -d"=" -f2-`
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"
dokku_log_info1 "Setting config vars and restarting $APP"
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
verify_app_name "$2"
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"
ENV_TEMP=`cat "${ENV_FILE}"`
ID=$(< "$APP_DIR/CONTAINER")
config_create
ENV_TEMP=$(cat "${ENV_FILE}")
VARS="${*:3}"
for var in $VARS; do
echo "-----> Unsetting $var and restarting $APP"
dokku_log_info1 "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
cat

9
plugins/domains/backup-export Executable file
View File

@@ -0,0 +1,9 @@
#!/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/*/VHOST; do echo $i; done
cat; for i in $BASE_DIR/*/nginx.conf.template; do echo $i; done

15
plugins/domains/backup-import Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
IMPORT_DIR="$2"
TARGET_DIR="$3"
cd $IMPORT_DIR
for file in */VHOST; do
cp $file "$TARGET_DIR/$file"
done
for file in */nginx.conf.template; do
cp $file "$TARGET_DIR/$file"
done

132
plugins/domains/commands Executable file
View File

@@ -0,0 +1,132 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
case "$1" in
domains)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"
dokku domains:setup $APP
dokku_log_info2_quiet "$APP Domain Names"
cat "$DOKKU_ROOT/$APP/VHOST"
;;
domains:setup)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
if [[ ! -f $VHOST_PATH ]]; then
if [[ -f "$DOKKU_ROOT/VHOST" ]];then
VHOST=$(< "$DOKKU_ROOT/VHOST")
else
VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
fi
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
echo "unsupported vhost config found. disabling vhost support"
[[ ! $(grep -q NO_VHOST "$DOKKU_ROOT/$APP/ENV") ]] && echo "export NO_VHOST='1'" >> "$DOKKU_ROOT/$APP/ENV"
else
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
dokku_log_info1 "Creating new $VHOST_PATH..."
SUBDOMAIN=${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
echo "$hostname" > $VHOST_PATH
fi
fi
fi
;;
domains:add)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"
if [[ -z $3 ]]; then
echo "Usage: dokku $1 $APP DOMAIN"
echo "Must specify DOMAIN."
exit 1
fi
if [[ $(egrep ^"$3"$ "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
echo "$3 is already defined for $APP"
exit 1
fi
dokku domains:setup $APP
echo "$3" >> "$DOKKU_ROOT/$APP/VHOST"
# we need to restart the app to make sure we're binding to the appropriate network interface
dokku ps:restart $APP
pluginhook post-domains-update $APP
dokku_log_info1 "Added $3 to $APP"
;;
domains:clear)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"
rm -f "$DOKKU_ROOT/$APP/VHOST"
dokku domains:setup $APP
pluginhook post-domains-update $APP
dokku_log_info1 "Cleared domains in $APP"
;;
domains:remove)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"
if [[ -z $3 ]]; then
echo "Usage: dokku $1 $2 DOMAIN"
echo "Must specify DOMAIN."
exit 1
fi
dokku domains:setup $APP
sed -i "/^$3$/d" "$DOKKU_ROOT/$APP/VHOST"
pluginhook post-domains-update $APP
dokku_log_info1 "Removed $3 from $APP"
;;
help | domains:help)
cat && cat<<EOF
domains <app> List custom domains for app
domains:add <app> DOMAIN Add a custom domain to app
domains:clear <app> Clear all custom domains for app
domains:remove <app> DOMAIN Remove a custom domain from app
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

8
plugins/domains/install Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
for app in $DOKKU_ROOT/*/CONTAINER; do
APP=$(basename "$(dirname $app)");
dokku domains:setup $APP
done

View File

@@ -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

View File

@@ -1,6 +1,21 @@
#!/usr/bin/env bash
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
pushd $TMP_WORK_DIR > /dev/null
git clone -q $DOKKU_ROOT/$APP $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 .
rm -rf $TMP_WORK_DIR > /dev/null
}
case "$1" in
git-hook)
APP=$2
@@ -10,31 +25,66 @@ case "$1" in
# Only run this script for the master branch. You can remove this
# if block if you wish to run it for others as well.
if [[ $refname = "refs/heads/master" ]] ; then
git archive $newrev | dokku receive $APP | sed -u "s/^/"$'\e[1G'"/"
dokku git-build $APP $newrev
else
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-build)
APP="$2"; APP_BUILD_LOCK="$DOKKU_ROOT/$APP/.build.lock"
APP_BUILD_LOCK_MSG="$APP is currently being deployed or locked. Waiting..."
[[ $(flock -n "$APP_BUILD_LOCK" true &>/dev/null ; echo $?) -ne 0 ]] && echo "$APP_BUILD_LOCK_MSG"
shift 1
flock -o "$APP_BUILD_LOCK" dokku git-build-locked "$@"
;;
git-build-locked)
APP="$2"
if [[ $# -ge 3 ]];then
REF="$3"
else
REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
fi
git_archive_all $APP $REF | dokku receive $APP | sed -u "s/^/"$'\e[1G'"/"
;;
git-*)
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
APP_PATH=$DOKKU_ROOT/$APP
if [[ $1 == "git-receive-pack" && ! -d $APP_PATH ]]; then
git init --bare $APP_PATH > /dev/null
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
cat > $PRERECEIVE_HOOK <<EOF
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
#!/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=$@
args=$*
git-shell -c "$args"
;;
esac
cat
help | git:help)
cat
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

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

View File

@@ -1,12 +1,14 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
IMPORT_DIR="$2"
TARGET_DIR="$3"
cd $IMPORT_DIR
for file in `find . -regex ".*ssl/server\(.crt\|.key\)"`; 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

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
[[ -f "$DOKKU_ROOT/VHOST" ]] && GLOBAL_VHOST=$(< "$DOKKU_ROOT/VHOST")
if [[ -n "$NO_VHOST" ]]; then
echo true # bind to external ip. VHOST is disabled
elif [[ "$GLOBAL_VHOST" =~ $RE_IPV4 ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV6 ]]; then
echo true # bind to external ip. GLOBAL_VHOST is somehow an IPv4 or IPv6 address
elif [[ -z "$GLOBAL_VHOST" ]] && [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
echo true # bind to external ip. no GLOBAL_VHOST and no app vhost
elif [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
echo false # bind to docker ip. this app has a vhost defined
else
echo false
fi

View File

@@ -1,3 +1,139 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cat
source "$(dirname $0)/../common/functions"
restart_nginx () {
case "$DOKKU_DISTRO" in
ubuntu)
sudo /etc/init.d/nginx reload > /dev/null
;;
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;
esac
}
case "$1" in
nginx:build-config)
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="${4}"
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
WILDCARD_SSL="$DOKKU_ROOT/tls"
SSL="$DOKKU_ROOT/$APP/tls"
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
DOKKU_APP_LISTEN_PORT=$(< "$DOKKU_ROOT/$APP/PORT")
fi
if [[ -z "$DOKKU_APP_LISTEN_IP" ]] && [[ -f "$DOKKU_ROOT/$APP/IP" ]]; then
DOKKU_APP_LISTEN_IP=$(< "$DOKKU_ROOT/$APP/IP")
fi
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
NONSSL_VHOSTS=$(cat $VHOST_PATH)
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
SSL_INUSE="$SSL"
SSL_DIRECTIVES=$(cat <<EOF
ssl_certificate $SSL_INUSE/server.crt;
ssl_certificate_key $SSL_INUSE/server.key;
EOF
)
elif [[ -e "$WILDCARD_SSL/server.crt" ]] && [[ -e "$WILDCARD_SSL/server.key" ]]; then
SSL_INUSE="$WILDCARD_SSL"
SSL_DIRECTIVES=""
fi
NGINX_CONF="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf"
SCHEME="http"
if [[ -n "$SSL_INUSE" ]]; then
NGINX_CONF="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf"
SCHEME="https"
SSL_HOSTNAME=$(openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
SSL_HOSTNAME=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g')
[[ -z "$(egrep ^"$SSL_HOSTNAME"$ $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME" | sed 's/\\./\./g' >> $VHOST_PATH
SSL_HOSTNAME_ALT=$(openssl x509 -in $SSL_INUSE/server.crt -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
SSL_HOSTNAME_ALT=$(echo "$SSL_HOSTNAME_ALT" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g')
[[ -z "$(egrep ^"$SSL_HOSTNAME_ALT"$ $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME_ALT" | sed 's/\\./\./g' >> $VHOST_PATH
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0)
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0)
while read line; do
dokku_log_info1 "Configuring SSL for $line..."
SSL_SERVER_NAME=$line
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
done <<< "$SSL_VHOSTS"
fi
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
if [[ -f $APP_NGINX_TEMPLATE ]]; then
dokku_log_info1 "Overriding default nginx.conf with detected nginx.conf.template"
NGINX_CONF=$APP_NGINX_TEMPLATE
fi
xargs -i echo "-----> Configuring {}..." < $VHOST_PATH
# Include SSL_VHOSTS so we can redirect http to https on that hostname as well
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS $SSL_VHOSTS| tr '\n' ' ')
if [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
dokku_log_info1 "Creating $SCHEME nginx.conf"
echo "upstream $APP { server $DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT; }" > $DOKKU_ROOT/$APP/nginx.conf
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
dokku_log_info1 "Running nginx-pre-reload"
pluginhook nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
echo " Reloading nginx"
restart_nginx
fi
else
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
rm "$DOKKU_ROOT/$APP/VHOST"
fi
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
dokku_log_info1 "VHOST support disabled, deleting nginx.conf"
rm "$DOKKU_ROOT/$APP/nginx.conf"
dokku_log_info1 "VHOST support disabled, reloading nginx after nginx.conf deletion"
restart_nginx
fi
fi
;;
nginx:import-ssl)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
[[ -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"
cd $DOKKU_ROOT
rm -rf $TEMP_DIR
dokku nginx:build-config $APP
;;
help | nginx:help)
cat && cat<<EOF
nginx:import-ssl <app> Imports a tarball from stdin; should contain server.crt and server.key
nginx:build-config <app> (Re)builds nginx config for given app
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$DOKKU_DISTRO" in
ubuntu)
export DEBIAN_FRONTEND=noninteractive
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
add-apt-repository -y ppa:nginx/stable
apt-get update
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
;;
opensuse)
zypper -q in -y nginx bind-utils
;;
esac

View File

@@ -1,25 +1,76 @@
#!/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
echo "include $DOKKU_ROOT/*/nginx.conf;" > /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;
sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
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
fi
/etc/init.d/nginx start
cat<<EOF > /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
EOF
echo 'server_names_hash_bucket_size 512;' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
case "$DOKKU_DISTRO" in
ubuntu)
/etc/init.d/nginx start
;;
opensuse)
/sbin/service nginx start
;;
esac

View File

@@ -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

View File

@@ -1,83 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; PORT="$2"
WILDCARD_SSL="$DOKKU_ROOT/ssl"
SSL="$DOKKU_ROOT/$APP/ssl"
source "$(dirname $0)/../common/functions"
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
VHOST=$(< "$DOKKU_ROOT/VHOST")
SUBDOMAIN=${APP/%\.${VHOST}/}
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
hostname="${APP/\//-}"
else
hostname="${APP/\//-}.$VHOST"
fi
APP="$1"; PORT="$2"; IP="$3"
if [[ -f "$SSL/server.crt" ]] && [[ -f "$SSL/server.key" ]]; then
SSL_INUSE="$SSL"
elif [[ -f "$WILDCARD_SSL/server.crt" ]] && [[ -f "$WILDCARD_SSL/server.key" ]] && [[ $hostname = `openssl x509 -in $WILDCARD_SSL/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-` ]]; then
SSL_INUSE="$WILDCARD_SSL"
fi
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
# ssl based nginx.conf
if [[ -n "$SSL_INUSE" ]]; then
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
upstream $APP { server 127.0.0.1:$PORT; }
server {
listen 80;
server_name $hostname;
return 301 https://\$host\$request_uri;
}
server {
listen 443;
server_name $hostname;
ssl on;
ssl_certificate $SSL_INUSE/server.crt;
ssl_certificate_key $SSL_INUSE/server.key;
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_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec;
}
}
EOF
echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL"
else
# default nginx.conf
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
upstream $APP { server 127.0.0.1:$PORT; }
server {
listen 80;
server_name $hostname;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec;
}
}
EOF
echo "http://$hostname" > "$DOKKU_ROOT/$APP/URL"
fi
pluginhook nginx-pre-reload $APP
sudo /etc/init.d/nginx reload > /dev/null
if [[ -n "$NO_VHOST" ]]; then
dokku_log_info1 "NO_VHOST config detected"
elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
dokku domains:setup $APP
fi
dokku nginx:build-config $APP $PORT $IP

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"
dokku nginx:build-config $APP

View File

@@ -0,0 +1,17 @@
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}

View File

@@ -0,0 +1,28 @@
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
return 301 https://$SSL_SERVER_NAME\$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name $SSL_SERVER_NAME;
$SSL_DIRECTIVES
keepalive_timeout 70;
add_header Alternate-Protocol 443:npn-spdy/2;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$remote_addr;
proxy_set_header X-Forwarded-Port \$server_port;
proxy_set_header X-Request-Start \$msec;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}

111
plugins/ps/commands Executable file
View File

@@ -0,0 +1,111 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
release_and_deploy() {
source "$(dirname $0)/../common/functions"
local APP="$1";
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
dokku_log_info1 "Releasing $APP ..."
dokku release $APP
dokku_log_info1 "Release complete!"
dokku_log_info1 "Deploying $APP ..."
dokku deploy $APP
dokku_log_info2 "Application deployed:"
dokku urls $APP | sed "s/^/ /"
echo
fi
}
case "$1" in
ps)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
docker exec -ti "$CONTAINER_ID" /bin/bash -c "ps auxwww"
;;
ps:start)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
if [[ "$(docker ps -q --no-trunc| grep -q $CONTAINER_ID; echo $?)" != "0" ]]; then
release_and_deploy $APP
else
echo "App $APP already running"
fi
;;
ps:stop)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
if [[ "$(docker ps -q --no-trunc| grep -q $CONTAINER_ID; echo $?)" = "0" ]]; then
echo "Stopping $APP ..."
docker stop $CONTAINER_ID > /dev/null
else
echo "App $APP already stopped"
fi
;;
ps:rebuild)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"
dokku git-build $APP
;;
ps:rebuildall)
shopt -s nullglob
for app in $DOKKU_ROOT/*/CONTAINER; do
APP=$(basename "$(dirname $app)");
dokku ps:rebuild $APP
done
;;
ps:restart)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
release_and_deploy $APP
;;
ps:restartall)
shopt -s nullglob
for app in $DOKKU_ROOT/*/CONTAINER; do
APP=$(basename "$(dirname $app)");
dokku ps:restart $APP
done
;;
help | ps:help)
cat && cat<<EOF
ps <app> List processes running in app container(s)
ps:start <app> Start app container(s)
ps:stop <app> Stop app container(s)
ps:rebuild <app> Rebuild an app
ps:rebuildall Rebuild all apps
ps:restart <app> Restart app container(s)
ps:restartall Restart all deployed app containers
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

130
tests.mk Normal file
View File

@@ -0,0 +1,130 @@
shellcheck:
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127)
ifeq ($(shell uname),Darwin)
brew install shellcheck
else
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
sudo apt-get update && sudo apt-get install -y shellcheck
endif
endif
ci-dependencies: shellcheck bats
setup-deploy-tests:
mkdir -p /home/dokku
ifdef ENABLE_DOKKU_TRACE
echo "-----> Enabling tracing"
echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc
endif
@echo "Setting dokku.me in /etc/hosts"
sudo /bin/bash -c "[[ `ping -c1 dokku.me > /dev/null 2>&1; echo $$?` -eq 0 ]] || echo \"127.0.0.1 dokku.me *.dokku.me www.test.app.dokku.me\" >> /etc/hosts"
@echo "-----> Generating keypair..."
mkdir -p /root/.ssh
rm -f /root/.ssh/dokku_test_rsa*
echo -e "y\n" | ssh-keygen -f /root/.ssh/dokku_test_rsa -t rsa -N ''
chmod 600 /root/.ssh/dokku_test_rsa*
@echo "-----> Setting up ssh config..."
ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0)
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
else ifeq ($(shell grep dokku.me /root/.ssh/config),)
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
endif
@echo "-----> Installing SSH public key..."
sudo sshcommand acl-remove dokku test
cat /root/.ssh/dokku_test_rsa.pub | sudo sshcommand acl-add dokku test
@echo "-----> Intitial SSH connection to populate known_hosts..."
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
@echo "-----> Setting default VHOST to dokku.me..."
echo "dokku.me" > /home/dokku/VHOST
endif
bats:
git clone https://github.com/sstephenson/bats.git /tmp/bats
cd /tmp/bats && sudo ./install.sh /usr/local
rm -rf /tmp/bats
lint:
# these are disabled due to their expansive existence in the codebase. we should clean it up though
# SC2034: VAR appears unused - https://github.com/koalaman/shellcheck/wiki/SC2034
# SC2086: Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086
# SC2143: Instead of [ -n $(foo | grep bar) ], use foo | grep -q bar - https://github.com/koalaman/shellcheck/wiki/SC2143
# SC2001: See if you can use ${variable//search/replace} instead. - https://github.com/koalaman/shellcheck/wiki/SC2001
@echo linting...
@$(QUIET) shellcheck -e SC2029 ./contrib/dokku_client.sh
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001
unit-tests:
@echo running unit tests...
@$(QUIET) bats tests/unit
deploy-test-clojure:
@echo deploying config app...
cd tests && ./test_deploy ./apps/clojure dokku.me
deploy-test-config:
@echo deploying config app...
cd tests && ./test_deploy ./apps/config dokku.me
deploy-test-gitsubmodules:
@echo deploying gitsubmodules app...
cd tests && ./test_deploy ./apps/gitsubmodules dokku.me
deploy-test-go:
@echo deploying go app...
cd tests && ./test_deploy ./apps/go dokku.me
deploy-test-java:
@echo deploying java app...
cd tests && ./test_deploy ./apps/java dokku.me
deploy-test-multi:
@echo deploying multi app...
cd tests && ./test_deploy ./apps/multi dokku.me
deploy-test-nodejs-express:
@echo deploying nodejs-express app...
cd tests && ./test_deploy ./apps/nodejs-express dokku.me
deploy-test-nodejs-express-noprocfile:
@echo deploying nodejs-express app with no Procfile...
cd tests && ./test_deploy ./apps/nodejs-express-noprocfile dokku.me
deploy-test-php:
@echo deploying php app...
cd tests && ./test_deploy ./apps/php dokku.me
deploy-test-python-flask:
@echo deploying python-flask app...
cd tests && ./test_deploy ./apps/python-flask dokku.me
deploy-test-scala:
@echo deploying scala app...
cd tests && ./test_deploy ./apps/scala dokku.me
deploy-test-static:
@echo deploying static app...
cd tests && ./test_deploy ./apps/static dokku.me
deploy-tests:
@echo running deploy tests...
# @$(QUIET) bats tests/deploy
@$(QUIET) $(MAKE) deploy-test-config
@$(QUIET) $(MAKE) deploy-test-clojure
@$(QUIET) $(MAKE) deploy-test-gitsubmodules
@$(QUIET) $(MAKE) deploy-test-go
@$(QUIET) $(MAKE) deploy-test-java
@$(QUIET) $(MAKE) deploy-test-multi
@$(QUIET) $(MAKE) deploy-test-nodejs-express
@$(QUIET) $(MAKE) deploy-test-nodejs-express-noprocfile
@$(QUIET) $(MAKE) deploy-test-php
@$(QUIET) $(MAKE) deploy-test-python-flask
@$(QUIET) $(MAKE) deploy-test-scala
@$(QUIET) $(MAKE) deploy-test-static
test: setup-deploy-tests lint unit-tests deploy-tests

View File

@@ -1,2 +0,0 @@
#!/bin/bash
set -e; test "$(curl -s $1)" == "go"

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; output="$(curl -s -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: $1\" -H \"Origin: $1\" $1 -m 2)"; echo $output; test "$output" == "bazingaa"
set -e; output="$(curl -s -S -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: $1\" -H \"Origin: $1\" $1 -m 2)"; echo $output; test "$output" == "bazingaa"

View File

@@ -0,0 +1 @@
web: lein run

View File

@@ -0,0 +1,4 @@
Hello Clojure/Compojure
=======================
A minimal Hello World web app in [Clojure](http://clojure.org/), using the [Compojure](https://github.com/weavejester/compojure) web framework.

View File

@@ -0,0 +1 @@
set -e; sleep 5; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!"

View File

@@ -0,0 +1,7 @@
(defproject clojure-sample "1.0.1"
:description "Hello World Clojure Web App"
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.3.1"]
[ring/ring-jetty-adapter "1.3.2"]]
:main ^:skip-aot sample.app
:min-lein-version "2.0.0")

View File

@@ -0,0 +1,13 @@
(ns sample.app
(:require [ring.adapter.jetty :as jetty]
[compojure.core :refer [defroutes GET]]))
(defroutes handler
(GET "/" []
{:headers {"Content-type" "text/plain; charset=UTF-8"}
:body "Hello World!"}))
(defn -main []
(jetty/run-jetty handler
{:port (Integer. (or (System/getenv "PORT") "5000"))
:join? false}))

View File

@@ -0,0 +1 @@
web: node web.js

15
tests/apps/config/check_deploy Executable file
View File

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

View File

@@ -0,0 +1,11 @@
{
"name": "node-example",
"version": "0.0.1",
"dependencies": {
"express": "2.5.x"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
}
}

9
tests/apps/config/post-deploy Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -ex;
REMOTE=$1
REPO=$2
# setting config variables with spaces is broken at the moment. ref: 820
# ssh "$REMOTE" config:set "$REPO" CONFTEST=config-test HELLO=\"Hello world\"
dokku config:set "$REPO" CONFTEST=config-test HELLO="Hello world"

16
tests/apps/config/web.js Normal file
View File

@@ -0,0 +1,16 @@
var express = require('express');
var app = express.createServer(express.logger());
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);
});

View File

@@ -0,0 +1 @@
/ Hello

View File

@@ -0,0 +1 @@
web: node node-js-sample/index.js

View File

@@ -0,0 +1,2 @@
#!/bin/bash
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!"

View File

@@ -0,0 +1,11 @@
{
"name": "node-example",
"version": "0.0.1",
"dependencies": {
"express": "~3.3.4"
},
"engines": {
"node": "0.10.x",
"npm": "1.3.x"
}
}

View File

@@ -0,0 +1,2 @@
#!/bin/bash
git submodule add https://github.com/heroku/node-js-sample.git node-js-sample

1
tests/apps/go/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ go

2
tests/apps/go/check_deploy Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
set -e; test "$(curl -s -S "$1")" == "go"

1
tests/apps/java/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ Hello from Java

1
tests/apps/java/Procfile Normal file
View File

@@ -0,0 +1 @@
web: java -cp target/classes:target/dependency/* HelloWorld

2
tests/apps/java/check_deploy Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello from Java!"

37
tests/apps/java/pom.xml Normal file
View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>helloworld</artifactId>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>7.6.0.v20120127</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,22 @@
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.*;
public class HelloWorld extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.getWriter().print("Hello from Java!\n");
}
public static void main(String[] args) throws Exception{
Server server = new Server(Integer.valueOf(System.getenv("PORT")));
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
context.addServlet(new ServletHolder(new HelloWorld()),"/*");
server.start();
server.join();
}
}

View File

@@ -0,0 +1,3 @@
{
"directory": "static/components"
}

View File

@@ -0,0 +1,3 @@
https://github.com/heroku/heroku-buildpack-ruby
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-python.git

6
tests/apps/multi/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
node_modules
static/components
static/.tmp
.sass-cache
.bundle
.DS_Store

1
tests/apps/multi/.npmrc Normal file
View File

@@ -0,0 +1 @@
unsafe-perm = true

1
tests/apps/multi/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ Heroku Multi Buildpack on Dokku

Some files were not shown because too many files have changed in this diff Show More