Compare commits

...

134 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
af626069dd Release 0.3.16 2015-03-25 01:03:51 -04:00
Jose Diaz-Gonzalez
be533692fd Merge pull request #1057 from progrium/deb-packaging
Deb packaging
2015-03-25 00:38:24 -04:00
Michael Hobbs
2949b620d8 Merge pull request #1051 from Flink/dokku-airbrake-deploy-plugin
Add dokku-airbrake-deploy to plugins
2015-03-23 14:41:43 -07:00
Loïc Guitaut
3d7e7028fd Add dokku-airbrake-deploy to plugins 2015-03-23 22:26:45 +01:00
Jose Diaz-Gonzalez
9293572e41 Merge pull request #1049 from ebeigarts/dokku-slack
Change Slack Notifications link
2015-03-23 10:53:46 -04:00
Edgars Beigarts
cec2802df2 Change Slack Notifications link 2015-03-23 13:29:08 +02:00
Jose Diaz-Gonzalez
d6c5b648f2 Merge pull request #1047 from progrium/1044_mh-show-logs-on-deploy
show logs on deploy success and failure
2015-03-20 16:17:58 -04:00
Michael Hobbs
77257c484f show logs on deploy success and failure. closes #1044 2015-03-20 12:32:49 -07:00
Jose Diaz-Gonzalez
95ae41b2fd Switch all gpg key retrieval to use docker.com 2015-03-19 21:08:31 -04:00
Jose Diaz-Gonzalez
aee8ada6d0 Copy the public key into place instead of moving it
This gets around reprovisioning issues
2015-03-19 20:07:32 -04:00
Jose Diaz-Gonzalez
6f52853049 Ensure we always have apt-transport-https available
On certain distributions, this package is not automatically installed
2015-03-19 20:05:50 -04:00
Jose Diaz-Gonzalez
077b7cee6e Set dokku version during post installation 2015-03-19 20:04:48 -04:00
Jose Diaz-Gonzalez
23b35a03b4 Merge pull request #1043 from progrium/1015_mh-upstart-docker-per-docs
use upstart config from docker docs. closes #1015
2015-03-19 19:47:11 -04:00
Michael Hobbs
f9b0f3ad34 use upstart config from docker docs. closes #1015 2015-03-19 16:12:33 -07:00
Michael Hobbs
65af77e1bc Merge pull request #1042 from progrium/1005_mh-add-xip-test
Update to Support xip.io wildcard DNS as a VHOST
2015-03-19 13:16:59 -07:00
Michael Hobbs
c83fbad205 xip.io style vhosts with tests. closes #1005 2015-03-19 11:23:00 -07:00
Alex Vidal
3b1e0ceb51 Support xip.io wildcard DNS as a VHOST
http://xip.io

xip.io is a service by Basecamp that provides a wildcard DNS service on the public internet. Any <ip address>.xip.io will return a DNS response for the IP address, same with <subdomain>.<ip address>.xip.io.

The domains plugin in dokku uses a regex to match IP4 and IP6 addresses in the VHOST file, and disables VHOST support if found. This PR changes those patterns to require that the VHOST entry **ends with** the IP address.

This is a gist where my VHOST setting is "127.0.0.1.xip.io" that demonstrates the original output, linked directly to the line from `plugins/domains/commands`: https://gist.github.com/anonymous/c529177f20b36beda80d#file-debug-log-L1373
2015-03-19 11:23:00 -07:00
Jose Diaz-Gonzalez
3caec44eac Merge pull request #1009 from progrium/993_mh-inspect-port-always
extract first port from Dockerfile and set config variable for use in deploy phase. closes #993
2015-03-19 13:54:35 -04:00
Michael Hobbs
767b45ae56 use config:set-norestart 2015-03-19 08:09:11 -07:00
Michael Hobbs
1a7586cd03 don't use config:set 2015-03-19 07:54:45 -07:00
Michael Hobbs
2834ce1f1a extract first port from Dockerfile and set config variable for use in deploy phase. closes #993 2015-03-19 07:54:45 -07:00
Jose Diaz-Gonzalez
fafa33e40d Merge pull request #1036 from progrium/908_mh-configset-norestart
create config set/unset without restart. closes #908
2015-03-19 10:52:31 -04:00
Michael Hobbs
3ce5df90bf document config:set-norestart and config:unset-norestart 2015-03-19 07:48:27 -07:00
Jose Diaz-Gonzalez
f1406fd93d Merge pull request #1038 from progrium/1020_mh-simple-check-deploy
default container check. closes #1020
2015-03-19 10:18:31 -04:00
Michael Hobbs
fdec668646 Merge pull request #1040 from ebeigarts/dokku-slack
Add dokku-slack plugin information
2015-03-19 06:04:41 -07:00
Edgars Beigarts
48fef51f76 Add dokku-slack plugin information 2015-03-19 10:55:50 +02:00
Michael Hobbs
72c829e29b default container check. closes #1020 2015-03-17 12:17:33 -07:00
Michael Hobbs
6cb770bf1c create config set/unset without restart. closes #908 2015-03-17 09:49:19 -07:00
Jose Diaz-Gonzalez
bdce8f6f05 Merge pull request #1035 from Flink/dokku-http-auth-plugin
Add dokku-http-auth to plugins
2015-03-17 12:21:21 -04:00
Loïc Guitaut
c7ef040e8c Add dokku-http-auth to plugins 2015-03-16 23:57:06 +01:00
Michael Hobbs
ee039fe4f1 lintball. disable SC1001 2015-03-16 12:43:34 -07:00
Jose Diaz-Gonzalez
7a5942e1ac Merge pull request #1032 from cameron-martin/patch-2
Updated dokku-installer to use relative path.
2015-03-16 14:35:46 -04:00
Cameron Martin
be6a19c210 Updated dokku-installer to use relative path. 2015-03-16 18:29:38 +00:00
Michael Hobbs
986e8f7b25 Merge pull request #1029 from broadly/checks-enhancements
ADDED several enhancements for CHECKS file:
2015-03-14 22:05:20 -07:00
Michael Hobbs
fffa6a1bc5 Merge pull request #1031 from progrium/mh-fix-circleci
CI upgraded to 1.5.0. downgrading seems to break things?
2015-03-14 19:22:49 -07:00
Michael Hobbs
a375eb3ec3 CI upgraded to 1.5.0. downgrading seems to break things? 2015-03-14 18:41:18 -07:00
Assaf Arkin
052e3e88c8 ADDED several enhancements for CHECKS file:
- Specify how long to wait before running first check
- Specify timeout for each check
- Check specific hosts, e.g. http://signin.example.com
- Check both HTTP and HTTPS resources
2015-03-14 10:13:36 -07:00
Jose Diaz-Gonzalez
00e0187ad1 Merge pull request #1028 from Flink/dokku-rails-logs-plugin
Add rails-logs to plugins
2015-03-13 21:14:13 -04:00
Loïc Guitaut
fbc2e22dd6 Add rails-logs to plugins 2015-03-14 01:40:03 +01:00
Jose Diaz-Gonzalez
86c11f1068 Merge pull request #1010 from progrium/mh-client-test-fix
[client unit-test] don't run create/destroy twice. actually clean up from create
2015-03-11 04:24:09 -04:00
Jose Diaz-Gonzalez
110d8a4863 Merge pull request #1026 from progrium/1025_mh-newlines-and-such
ensure we have newlines around our config. closes #1025
2015-03-11 04:24:01 -04:00
Michael Hobbs
bc00b5bfa8 Merge pull request #1027 from nickstenning/add-webhooks-plugin
Add webhooks plugin to documentation
2015-03-10 07:33:33 -07:00
Nick Stenning
3ab828a362 Add webhooks plugin to documentation 2015-03-10 15:27:54 +01:00
Michael Hobbs
88cd81e390 ensure we have newlines around our config. closes #1025 2015-03-09 19:32:05 -07:00
Michael Hobbs
42ee978549 Merge pull request #1013 from lmars/fix-urls
Fix URL schemes in `dokku urls` output
2015-03-09 12:05:25 -07:00
Michael Hobbs
b468c2e09e Merge pull request #1008 from lmars/fix-nginx-multiple-ssl-vhosts
Support multiple domains using a wildcard TLS certificate
2015-03-09 12:05:20 -07:00
Jose Diaz-Gonzalez
2922a95ff6 Merge pull request #1022 from Flink/patch-1
Add dokku-maintenance to plugins
2015-03-08 20:34:47 -04:00
Lewis Marshall
9202f110ab Fix wildcard TLS domain detection
As per RFC 2818 [0], a CN of *.dokku.me will only match direct
subdomains of dokku.me, not sub-subdomains like www.test.dokku.me, but
Dokku currently enables TLS for subdomains of all levels.

I have changed the regex from .*\.dokku\.me to [^.]*\.dokku\.me so TLS
is only enabled for direct subdomains.

[0] - http://tools.ietf.org/html/rfc2818#section-3.1

Signed-off-by: Lewis Marshall <lewis@lmars.net>
2015-03-08 21:32:31 +00:00
Jose Diaz-Gonzalez
054ccfe3fd Merge pull request #1018 from progrium/1017_mh-more-robust-arg-parsing
confine arg shifting to between dokku and command. closes #1017
2015-03-06 20:10:29 -05:00
Michael Hobbs
2fb48c414b confine arg shifting to between dokku and command. closes #1017 2015-03-06 11:58:35 -08:00
Loïc Guitaut
c4125f9e47 Add dokku-maintenance to plugins 2015-03-06 18:53:35 +01:00
Michael Hobbs
dc36e6008c Merge pull request #1004 from progrium/1002_mh-dockerfile-envvar-quoting
remove quoting from dockerfile env. closes #1002
2015-03-06 08:06:51 -08:00
Lewis Marshall
3a7e1bfa16 Fix URL schemes in dokku urls output
Previously, the presence of TLS certificates would cause `dokku urls` to
output all https URLs, even for domains which were not configured to use
TLS.

This change introduces a URLS file in the app's directory which contains
the URLs with schemes based on whether they have been configured to use
TLS in the nginx config.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
2015-03-01 01:29:38 +00:00
Michael Hobbs
482b680e16 [client unit-test] don't run create/destroy twice. actually clean up from create 2015-02-25 19:47:45 -08:00
Lewis Marshall
a4d79e2de9 Support multiple domains using a wildcard TLS certificate
Previous to this change, each TLS domain would be written to nginx.conf
using the nginx.ssl.conf template (lines 69-73) but with an empty
"server_name" directive (because NOSSL_SERVER_NAME was not set).

This would then become irrelevant because nginx.conf would get truncated
on line 88, and a single parsing of the template would then be written to
nginx.conf on line 89, meaning only the last TLS domain would be set up to
actually use TLS.

This patch changes this behaviour so that all TLS domains get added to
nginx.conf using the nginx.ssl.conf template (which includes redirecting
HTTP -> HTTPS), and all non-TLS domains get added using the nginx.conf
template, so do not get redirected to a TLS domain.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
2015-02-26 01:58:17 +00:00
Lewis Marshall
6b973a9565 Refactor nginx tests
Signed-off-by: Lewis Marshall <lewis@lmars.net>
2015-02-26 01:24:39 +00:00
Jose Diaz-Gonzalez
53f9974f6f Merge pull request #1001 from sekjun9878/patch-1
Add sekjun9878/dokku-redis-plugin to plugins.md
2015-02-24 19:42:37 -05:00
Michael Hobbs
fb8f08d280 remove quoting from dockerfile env. closes #1002 2015-02-24 11:56:54 -08:00
Jose Diaz-Gonzalez
5dafee84ba Merge pull request #1003 from progrium/mh-fix-cleanup
remove quoting around cleanup and disable lint for those lines. also make cleanup test more robust
2015-02-24 14:33:41 -05:00
Michael Hobbs
f366a37cd1 remove quoting around cleanup and disable lint for those lines. also make cleanup test more robust 2015-02-24 10:41:02 -08:00
Michael Yoo
64d4af160b Add sekjun9878/dokku-redis-plugin to plugins.md 2015-02-22 18:50:46 +10:30
Jose Diaz-Gonzalez
70e1e5d14d Merge pull request #996 from pmvieira/minor-typo-fix
Minor typo fix in the pluginhooks documentation
2015-02-20 12:51:35 -05:00
Jose Diaz-Gonzalez
7cdc2a6e49 Merge pull request #994 from alessio/develop
Fix quoting.
2015-02-20 12:51:26 -05:00
Pedro Vieira
26ae97eea2 Minor typo fix in the pluginhooks documentation 2015-02-20 15:11:19 +00:00
Alessio Treglia
f90d298027 Fix quoting.
- Should prevent tests failure.
2015-02-20 11:26:33 +00:00
Jose Diaz-Gonzalez
8f9ccf9b0b Merge pull request #992 from progrium/josegonzalez-doc-link-fix
[ci skip] fix digital ocean docs
2015-02-19 18:20:57 -05:00
Jose Diaz-Gonzalez
f0f363da4c [ci skip] fix digital ocean docs
Closes #991
2015-02-19 18:20:48 -05:00
Jose Diaz-Gonzalez
0e6c978d62 Merge pull request #967 from alessio/develop
Really clean-up containers and images a-la-Docker
2015-02-19 14:54:00 -05:00
Jose Diaz-Gonzalez
07ae5190c3 Merge pull request #987 from techniq/patch-1
Improve Dockerfile example/test
2015-02-19 13:54:42 -05:00
Jose Diaz-Gonzalez
3cfadb9c9b Merge pull request #986 from progrium/josegonzalez-static-buildpack
Switch to yabawock's static nginx buildpack
2015-02-19 13:50:23 -05:00
Jose Diaz-Gonzalez
886acfaf39 Merge pull request #989 from progrium/more-clients
More clients
2015-02-19 01:19:07 -05:00
Jose Diaz-Gonzalez
59dc7c0deb [ci skip] note that the easiest client to use is the bash one (zero extra dependencies) 2015-02-19 01:18:31 -05:00
Jose Diaz-Gonzalez
4c53911993 [ci skip] add a few more clients 2015-02-19 01:18:16 -05:00
Jose Diaz-Gonzalez
909f86a393 Merge pull request #988 from progrium/docs-minor-changes
Docs minor changes
2015-02-19 00:54:20 -05:00
Jose Diaz-Gonzalez
c7bde60966 [ci skip] add "Where To Get Help" section 2015-02-19 00:53:52 -05:00
Jose Diaz-Gonzalez
1cba586e90 Add an entry for dokku-toolbelt 2015-02-19 00:44:36 -05:00
Jose Diaz-Gonzalez
51d704c123 [ci skip] fix link to advanced installation docs 2015-02-19 00:33:37 -05:00
Jose Diaz-Gonzalez
3837cb42cf [ci skip] add a section on deprecated plugins 2015-02-19 00:32:59 -05:00
Sean Lynch
6dfc90d388 Improve Dockerfile example/test
Placing `COPY` (or `ADD`) of the application directory after the `RUN apt-get install ...` statements will allow the layers created from those statements to be retrieved from docker's cache on subsequent runs.
2015-02-19 00:07:12 -05:00
Jose Diaz-Gonzalez
3a6f2eca82 Switch to yabawock's static nginx buildpack
The new herokuish branch of buildstep requires changes to the buildpack, but this buildpack should be compatible with the old buildstep.
2015-02-18 18:31:11 -05:00
Jose Diaz-Gonzalez
0ed0e8d458 Merge pull request #984 from progrium/docs-minor-changes
Docs minor changes
2015-02-18 02:37:49 -05:00
Jose Diaz-Gonzalez
19a10e3455 [ci skip] do not use deprecated dokku delete command 2015-02-18 02:35:34 -05:00
Jose Diaz-Gonzalez
c475bfdc24 [ci skip] add STACK_URL reference to make it clear how to customize the buildstep source 2015-02-18 02:35:14 -05:00
Jose Diaz-Gonzalez
6240aaa605 [ci skip] Clarify that the user needs sudo access to install dokku. Closes #961 2015-02-18 02:34:49 -05:00
Jose Diaz-Gonzalez
05b1421027 Merge pull request #983 from progrium/installation-changes
Installation changes
2015-02-18 02:27:58 -05:00
Jose Diaz-Gonzalez
0822f12226 [ci skip] Consolidate advanced-installation instructions and simplify the install guide
Also move vagrant instructions into their own file
2015-02-18 02:26:12 -05:00
Jose Diaz-Gonzalez
914757360b [ci skip] add digitalocean-specific installation instructions 2015-02-18 02:25:41 -05:00
Jose Diaz-Gonzalez
485068479c [ci skip] add experimental linode stackscript 2015-02-18 02:24:50 -05:00
Jose Diaz-Gonzalez
724ec8e0a4 Merge pull request #982 from progrium/client-docs
[ci skip] Add documentation for existing clients. Closes #977
2015-02-18 02:11:23 -05:00
Jose Diaz-Gonzalez
5c5039a533 [ci skip] Add documentation for existing clients. Closes #977 2015-02-18 02:10:42 -05:00
Jose Diaz-Gonzalez
230066fc98 Merge pull request #981 from progrium/remove-old-files
Remove old files
2015-02-18 01:53:02 -05:00
Jose Diaz-Gonzalez
9b409bf628 [ci skip] remove unused s3cfg
This is not necessary given our move away from travis
2015-02-18 01:52:38 -05:00
Jose Diaz-Gonzalez
826e08bea9 [ci skip] remove unused travis.yml file
We are now using CircleCI for testing dokku
2015-02-18 01:52:10 -05:00
Jose Diaz-Gonzalez
ff9e149465 Merge pull request #980 from progrium/pluginhook-docs
Pluginhook docs
2015-02-18 01:50:12 -05:00
Jose Diaz-Gonzalez
0bb8fd0b8e [ci skip] separate out plugin creation documentation 2015-02-18 01:49:42 -05:00
Jose Diaz-Gonzalez
77bea6e040 [ci skip] Add documentation for most pluginhooks
The rest can be added at a later date, or are duplicative of other pluginhooks
2015-02-18 01:49:25 -05:00
Jose Diaz-Gonzalez
f6ca187a5e [ci skip] reorder documentation index page 2015-02-18 01:46:03 -05:00
Jose Diaz-Gonzalez
afc492e23f Merge pull request #978 from progrium/jg-docker-deps
[ci skip] Add apparmor and cgroup-lite as pre-dependencies for dokku
2015-02-16 23:02:44 -05:00
Jose Diaz-Gonzalez
859e400587 [ci skip] Add apparmor and cgroup-lite as pre-dependencies for dokku
Certain operating systems do not have these packages by default and they are required by lxc-docker
2015-02-16 23:02:02 -05:00
Alessio Treglia
d79966af05 Cleanup unit test 2015-02-13 14:18:07 +00:00
Alessio Treglia
7d5813f0a7 Merge branch 'master' into develop 2015-02-13 11:39:50 +00:00
Jose Diaz-Gonzalez
9c15f89a35 Merge pull request #975 from progrium/971-mh-simplify-ssl-nginx
simplify SSL hostname handling and avoid overwriting variables. refs #971
2015-02-12 18:22:57 -05:00
Michael Hobbs
12777d9bf0 simplify SSL hostname handling and avoid overwriting variables. refs #971 2015-02-12 13:27:47 -08:00
Jose Diaz-Gonzalez
64fa098d2c Merge pull request #974 from progrium/mh-cleaner-pipefail-guard
don't use set to guard against pipefail
2015-02-11 21:52:53 -05:00
Michael Hobbs
043b055558 don't use set to guard against pipefail 2015-02-11 17:48:55 -08:00
Jose Diaz-Gonzalez
870ca86ba6 Release 0.3.15 2015-02-11 17:12:59 -05:00
Jose Diaz-Gonzalez
df936fb057 Merge pull request #962 from progrium/debian-building
Update debian package building due to manage generation changes
2015-02-10 14:40:05 -05:00
Jose Diaz-Gonzalez
3f0b3f8385 Merge pull request #966 from djelic/master
handle upgrade in debian/preinst script
2015-02-10 13:19:13 -05:00
Jose Diaz-Gonzalez
c90c6b3f45 Merge pull request #964 from progrium/963-mh-dont-allow-short-args-globally
only look for long args in global space. allows for short args in plugins. closes #963
2015-02-10 13:17:30 -05:00
Alessio Treglia
7e25e74779 Fix typo. 2015-02-10 14:16:39 +00:00
Alessio Treglia
0992719e3d Remove unnecessary call to sudo. 2015-02-10 12:52:29 +00:00
Alessio Treglia
97ef925243 Simplify images cleanup too. Reviewed containers cleanup.
- Images cleanup is a common practice taken from
  https://docs.docker.com/reference/commandline/cli/#filtering_1
2015-02-10 12:29:09 +00:00
Alessio Treglia
1842c19a03 Slightly improve "cleanup".
- Use docker ps to filter containers by status to avoid building
  such a long pipe.
2015-02-10 12:21:42 +00:00
David Jelic
d5ceda6da7 handle upgrade in debian/preinst script 2015-02-10 11:47:20 +01:00
Michael Hobbs
e5fb746a7f only look for long args in global space. allows for short args in plugins. closes #963 2015-02-09 16:59:07 -08:00
Jose Diaz-Gonzalez
7c7896029c Update debian package building due to manage generation changes 2015-02-09 13:24:38 -05:00
Jose Diaz-Gonzalez
8b7b2107f4 Merge pull request #960 from progrium/mh-style-refactor
use consistent bash shebang. closes #959
2015-02-09 02:37:28 -05:00
Michael Hobbs
ef583eef66 use consistent bash shebang. closes #959 2015-02-08 22:34:35 -08:00
Jose Diaz-Gonzalez
c2fa43384c Merge pull request #954 from progrium/mh-dockerfile-support
dockerfile support
2015-02-08 17:38:22 -05:00
Michael Hobbs
179a5e611b introduce pre/post-build-buildstep and pre/post-release-buildstep 2015-02-07 17:56:01 -08:00
Michael Hobbs
7357df7c9d first pass at dockerfile support 2015-02-07 17:56:01 -08:00
Jose Diaz-Gonzalez
122df4cdaf Merge pull request #957 from progrium/mh-dokku-shell
implement dokku shell and ls (by @plietar). refs #312
2015-02-07 19:49:52 -05:00
Michael Hobbs
1cfb1fc3fc implement dokku shell and ls (by @plietar). refs #312 2015-02-07 14:46:17 -08:00
Michael Hobbs
b10120af12 Merge pull request #955 from progrium/mh-small-style-refactor
quick style refactor
2015-02-07 14:40:04 -08:00
Michael Hobbs
7af7355441 Merge pull request #956 from progrium/mh-comment-out-skipped-unit-tests
comment out skipped tests as we pay the cost for setup() and teardown() anyway
2015-02-07 14:38:18 -08:00
Michael Hobbs
a9c1ed0c6d [ci skip] comment out skipped tests as we pay the cost for setup() and teardown() anyway 2015-02-07 14:37:30 -08:00
Michael Hobbs
e931930faa implement parallel_runner to make ci faster 2015-02-07 14:12:05 -08:00
Michael Hobbs
66f7fa3192 lintball 2015-02-07 11:49:35 -08:00
Michael Hobbs
959c51eb50 refactor function defs to be posix-like. remove usage of force positional argument in tests. support --force like arguments in client" 2015-02-07 11:35:04 -08:00
Jose Diaz-Gonzalez
c4ef29173c Merge pull request #952 from progrium/951-mh-document-args-over-ssh
[ci skip] document cli args over ssh. closes #951
2015-02-07 12:34:24 -05:00
Michael Hobbs
fe3e079a93 [ci skip] rename -rm to --rm for DOKKU_RM_CONTAINER 2015-02-07 09:28:09 -08:00
Michael Hobbs
57acf3b295 [ci skip] document cli args over ssh. closes #951 2015-02-06 21:59:34 -08:00
Jose Diaz-Gonzalez
6f92385608 Merge pull request #950 from progrium/mh-count-code-only
do not count blank lines
2015-02-06 17:42:26 -05:00
Michael Hobbs
f5bceb955c [ci skip] do not count blank lines 2015-02-06 14:37:55 -08:00
85 changed files with 2269 additions and 590 deletions

38
.s3cfg
View File

@@ -1,38 +0,0 @@
[default]
access_key
secret_key
bucket_location = US
cloudfront_host = cloudfront.amazonaws.com
cloudfront_resource = /2010-07-15/distribution
default_mime_type = binary/octet-stream
delete_removed = False
dry_run = False
encoding = UTF-8
encrypt = False
follow_symlinks = False
force = False
get_continue = False
gpg_command = None
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_passphrase =
guess_mime_type = True
host_base = s3.amazonaws.com
host_bucket = %(bucket)s.s3.amazonaws.com
human_readable_sizes = False
list_md5 = False
log_target_prefix =
preserve_attrs = True
progress_meter = True
proxy_host =
proxy_port = 0
recursive = False
recv_chunk = 4096
reduced_redundancy = False
send_chunk = 4096
simpledb_host = sdb.amazonaws.com
skip_existing = False
socket_timeout = 300
urlencoding_mode = normal
use_https = False
verbosity = WARNING

View File

@@ -1,16 +0,0 @@
---
branches:
only:
- master
script:
- echo "StrictHostKeyChecking=no" >> ~/.ssh/config
- export IP=$(curl -s http://dokku-ci.herokuapp.com/hosts | tail -1)
- git config --global user.email "travis-ci@exmaple.com"
- git config --global user.name "Travis CI"
- git checkout --orphan orphan HEAD
- git commit -am 'orphaned'
- git remote add runner ssh://test@$IP:2022/dokku
- sleep 8
- git push runner orphan:master
notifications:
irc: "chat.freenode.net#dokku"

View File

@@ -1,5 +1,66 @@
# History
## 0.3.16
- #974: @michaelhobbs Don't use set to guard against pipefail
- #975: @michaelhobbs Simplify SSL hostname handling and avoid overwriting variables. refs #971
- #978: @michaelhobbs Add apparmor and cgroup-lite as pre-dependencies for dokku debian package
- #980: @josegonzalez [docs] Add documentation for pluginhooks
- #981: @josegonzalez Remove old files
- #982: @josegonzalez [docs] Add documentation for existing clients. Closes #977
- #983: @josegonzalez [docs] Update installation documentation
- #984: @josegonzalez [docs] Clarify installation instructions
- #988: @josegonzalez [docs] Add deprecated plugins section and where to get help
- #989: @josegonzalez [docs] Add more clients
- #986: @josegonzalez Switch to yabawock's static nginx buildpack for tests
- #987: @techniq Improve Dockerfile example/test
- #967: @alessio Really clean-up containers and images a-la-Docker
- #992: @josegonzalez [docs] Fix digital ocean docs. Closes #991
- #994: @alessio Fix quoting in container termination. Closes #249
- #996: @pmvieira [docs] Minor typo fix in the pluginhooks documentation
- #1003: @michaelhobbs Remove quoting around cleanup and disable lint for those lines
- #1001: @sekjun9878 [docs] Add sekjun9878/dokku-redis-plugin to plugins.md
- #1004: @michaelhobbs Remove quoting from dockerfile env. closes #1002
- #1018: @michaelhobbs Confine arg shifting to between dokku and command. closes #1017
- #1022: @Flink [docs] Add dokku-maintenance to plugins
- #1008: @lmars Support multiple domains using a wildcard TLS certificate
- #1013: @lmars Fix URL schemes in `dokku urls` output
- #1027: @nickstenning [docs] Add webhooks plugin to documentation
- #1026: @michaelhobbs Ensure we have newlines around our config. closes #1025
- #1010: @michaelhobbs Don't run create/destroy twice in tests
- #1028: @Flink [docs] Add rails-logs to plugins
- #1031: @michaelhobbs Upgrade docker in CI to 1.5.0
- #1029: @assaf Added several enhancements for CHECKS file:
- Specify how long to wait before running first check
- Specify timeout for each check
- Check specific hosts, e.g. http://signin.example.com
- Check both HTTP and HTTPS resources
- #1032: @cameron-martin Updated dokku-installer to use relative path
- #1035: @Flink [docs] Add dokku-http-auth to plugins
- #1040: @ebeigarts [docs] Add dokku-slack plugin information
- #1038: @michaelhobbs Default container check. closes #1020
- #1036: @michaelhobbs Create config set/unset without restart. closes #908
- #1009: @michaelhobbs Extract first port from Dockerfile and set config variable for use in deploy phase. closes #993
- #1042: @michaelhobbs Update to Support xip.io wildcard DNS as a VHOST
- #1043: @michaelhobbs Use upstart config from docker docs. closes #1015
- #1047: @michaelhobbs Show logs on deploy success and failure
- #1049: @ebeigarts [docs] Change Slack Notifications link
- #1051: @Flink [docs] Add dokku-airbrake-deploy to plugins
- #1057: @josegonzalez Updated deb packaging
## 0.3.15
- #950: @michaelhobbs Do not count blank lines in `make count`
- #952: @michaelhobbs Document cli args over ssh. closes #951
- #954: @michaelhobbs Dockerfile support
- #955: @michaelhobbs Quick style refactor
- #956: @michaelhobbs Comment out skipped tests as we pay the cost for setup() and teardown() anyway
- #957: @michaelhobbs Implement dokku shell and ls (by @plietar). refs #312
- #960: @michaelhobbs Use consistent bash shebang. closes #959
- #962: @josegonzalez Update debian package building due to man page generation changes
- #964: @michaelhobbs Only look for long args in global space. allows for short args in plugins. closes #963
- #966: @djelic handle upgrade in debian/preinst script
## 0.3.14
- #891: @josegonzalez Keep existing configuration files when installing nginx. Refs #886

View File

@@ -79,7 +79,7 @@ docker: aufs
apt-get install -qq -y curl
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
curl --silent https://get.docker.io/gpg | apt-key add -
curl --silent https://get.docker.com/gpg | apt-key add -
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-get update
ifdef DOCKER_VERSION
@@ -106,11 +106,11 @@ endif
count:
@echo "Core lines:"
@cat dokku bootstrap.sh | wc -l
@cat dokku bootstrap.sh | egrep -v "^$$" | wc -l
@echo "Plugin lines:"
@find plugins -type f | xargs cat | wc -l
@find plugins -type f | xargs cat | egrep -v "^$$" | wc -l
@echo "Test lines:"
@find tests -type f | xargs cat | wc -l
@find tests -type f | xargs cat | egrep -v "^$$" |wc -l
dokku-installer:
apt-get install -qq -y ruby
@@ -118,7 +118,7 @@ dokku-installer:
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 || ruby 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

View File

@@ -8,9 +8,9 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
## Installing
To install the latest stable version of dokku, you can run the following bootstrapper command:
To install the latest stable release, you can run the following command as a user that has access to `sudo`:
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.14/bootstrap.sh | sudo DOKKU_TAG=v0.3.14 bash
wget -qO- https://raw.github.com/progrium/dokku/v0.3.16/bootstrap.sh | sudo DOKKU_TAG=v0.3.16 bash
### Upgrading

3
Vagrantfile vendored
View File

@@ -47,11 +47,12 @@ Vagrant::configure("2") do |config|
end
config.vm.define "build", autostart: false do |vm|
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 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"
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
end
end

View File

@@ -8,7 +8,7 @@ dependencies:
# 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 }
- sudo -E CI=true DOCKER_VERSION=1.5.0 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/
@@ -18,12 +18,6 @@ dependencies:
- 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 }
- ./tests/ci/parallel_runner.sh: { parallel: true, timeout: 1800 }

View File

@@ -21,7 +21,7 @@ if ARGV[0] == "onboot"
exit
end
version = "v0.3.14"
version = "v0.3.16"
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

View File

@@ -4,7 +4,7 @@ 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() {
random_number() {
[[ -n "$1" ]] && RANGE="$1"
if [[ -n "$RANGE" ]];then
number=$RANDOM
@@ -15,7 +15,7 @@ function random_number() {
echo $number
}
function random_name() {
random_name() {
NUM1=$(random_number ${#MOVES[@]})
NUM2=$(random_number ${#MOVES[@]})
NUM3=$(random_number ${#NAMES[@]})
@@ -27,7 +27,7 @@ function random_name() {
echo "$lower_appname"
}
function client_help_msg() {
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
@@ -42,7 +42,7 @@ if [[ -z $DOKKU_HOST ]]; then
fi
if [[ ! -z $DOKKU_HOST ]]; then
function _dokku {
_dokku() {
appname=""
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
set +e
@@ -98,9 +98,25 @@ if [[ ! -z $DOKKU_HOST ]]; then
exit $?
fi
[[ -z "$verb" ]] && verb=$1
shift
ssh "dokku@$DOKKU_HOST" "$verb" "$appname" "$@"
if [[ -z "$verb" ]]; then
if [[ ! "$1" =~ --* ]]; then
verb=$1
shift
args="$*"
else
long_args="--"
for arg in "$@";do
if [[ "$arg" =~ --* ]];then
long_args+=" $arg"
args=("${args[@]/$arg}")
else
verb="$arg"
fi
done
fi
fi
# shellcheck disable=SC2086
ssh "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}"
}
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]]; then

183
contrib/stackscript.sh Normal file
View File

@@ -0,0 +1,183 @@
#!/bin/bash
# <UDF name="hostname" default="" label="Hostname for dokku instance" example="example.com">
# <UDF name="ssh_key" default="" label="Public SSH Key for root user" example="Sets the root user's public ssh key, which is also automatically imported into the dokku installer">
# <UDF name="notify_email" default="" Label="Send Finish Notification To" example="Email address to send notification to when finished." />
function logit {
# Simple logging function that prepends an easy-to-find marker '=> ' and a timestamp to a message
TIMESTAMP=$(date -u +'%m/%d %H:%M:%S')
MSG="=> ${TIMESTAMP} $1"
echo ${MSG}
}
function set_ssh_key {
if [ -n "${SSH_KEY}" ]; then
logit "Setting root ssh key"
mkdir -p /root/.ssh
chmod 700 /root/.ssh
echo "$SSH_KEY" > /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
chown -R root:root /root/.ssh
fi
}
function set_passwordless_ssh {
logit "Turn off password authentication and root login for SSH"
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config
service ssh restart
}
function system_primary_ip {
# returns the primary IP assigned to eth0
ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }'
}
function set_hostname {
logit "Set up hostname"
if [ -n "${HOSTNAME}" ]; then
echo $HOSTNAME > /etc/hostname
echo $IPADDR $FQDN $HOSTNAME >> /etc/hosts
else
system_primary_ip > /etc/hostname
echo "$(system_primary_ip) localhost" >> /etc/hosts
fi
IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')
hostname -F /etc/hostname
}
function postfix_install_loopback_only {
logit "Installing and configuring Postfix"
# Installs postfix and configure to listen only on the local interface. Also
# allows for local mail delivery
echo "postfix postfix/destinations string localhost.localdomain, localhost" | debconf-set-selections
echo "postfix postfix/mailname string localhost" | debconf-set-selections
echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections
echo "postfix postfix/myhostname string localhost" | debconf-set-selections
sudo apt-get install -qq -y postfix > /dev/null 2>&1
/usr/sbin/postconf -e "inet_interfaces = loopback-only"
#/usr/sbin/postconf -e "local_transport = error:local delivery is disabled"
touch /tmp/restart-postfix
}
function notify_install_via_email {
if [ -n "${NOTIFY_EMAIL}" ]; then
logit "Sending notification email to ${NOTIFY_EMAIL}"
/usr/sbin/sendmail "${NOTIFY_EMAIL}" <<EOD
To: ${NOTIFY_EMAIL}
Subject: Dokku installation is complete
From: Dokku StackScript <no-reply@${HOSTNAME}>
Your Dokku installation is complete and now ready to be configured: http://$(system_primary_ip) . Please visit this url to complete the setup of your Dokku instance.
Enjoy using Dokku!
EOD
fi
}
function notify_restart_via_email {
if [ -n "${NOTIFY_EMAIL}" ]; then
logit "Sending notification email to ${NOTIFY_EMAIL} of required restart"
/usr/sbin/sendmail "${NOTIFY_EMAIL}" <<EOD
To: ${NOTIFY_EMAIL}
Subject: Dokku Linode instance must be restarted
From: Dokku StackScript <no-reply@${HOSTNAME}>
The following linode instance must be restarted:
${LINODE_LISHUSERNAME}
Before restarting, please go to this url:
https://manager.linode.com/linodes/dashboard/${LINODE_LISHUSERNAME}
Then click "Edit" next to the selected configuration profile and make the following changes:
- Change the "Kernel" option to the current "pv-grub" release
- Set the "Xenify Distro" option to "no"
Then save your changes. Next, reboot the instance from the Linode Dashboard. You'll receive an email once the instance is available to continue the dokku installation.
EOD
fi
}
function setup_linode {
logit "Installing via linode"
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y linux-virtual
DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y grub2 grub-pc
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y grub
mkdir -p /boot/grub
update-grub -y
sed -i 's/kopt=root=UUID=.* ro/kopt=root=\/dev\/xvda console=hvc0 ro quiet/g' /boot/grub/menu.lst
sed -i 's/# groot=(hd0,0)/# groot=(hd0)/g' /boot/grub/menu.lst
update-grub
cp /etc/rc.local /etc/rc.local-bak
cat << EOF > /etc/rc.local
#!/bin/sh -e
sudo apt-get update >> /root/setup_linode.txt 2>&1
sudo apt-get install -y linux-image-extra-"$(uname -r)" >> /root/setup_linode.txt 2>&1
modprobe aufs >> /root/setup_linode.txt 2>&1
sudo apt-get install -y apparmor cgroup-lite >> /root/setup_linode.txt 2>&1
sudo apt-get install -y dokku >> /root/setup_linode.txt 2>&1
# Clean up this script so it only runs once
rm -f /etc/rc.local
mv /etc/rc.local-bak /etc/rc.local
exit 0
EOF
chmod +x /etc/rc.local
}
function install_prerequisites {
sudo apt-get install -qq -y curl > /dev/null 2>&1
logit "Installing docker gpg key"
curl --silent https://get.docker.com/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
logit "Installing dokku gpg key"
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
logit "Running apt-get update"
sudo apt-get update > /dev/null
logit "Installing pre-requisites"
sudo apt-get install -qq -y apt-transport-https > /dev/null 2>&1
logit "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
logit "Running apt-get update"
sudo apt-get update > /dev/null
}
function install_dokku {
logit "Installing pre-requisites"
sudo apt-get install -qq -y linux-image-extra-"$(uname -r)" > /dev/null 2>&1
logit "Installing dokku"
sudo apt-get install -qq -y dokku > /dev/null 2>&1
logit "Done!"
}
exec &> /root/stackscript.log
set_ssh_key
set_passwordless_ssh
postfix_install_loopback_only
set_hostname
install_prerequisites
if [ -n "$LINODE_ID" ]; then
setup_linode
notify_restart_via_email
else
install_dokku
notify_install_via_email
fi

12
deb.mk
View File

@@ -29,8 +29,12 @@ 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 "--> Initial apt-get update"
sudo apt-get update > /dev/null
sudo apt-get install -y apt-transport-https
echo "--> Installing docker gpg key"
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
curl --silent https://get.docker.com/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
@@ -43,7 +47,7 @@ install-from-deb:
sudo apt-get update > /dev/null
echo "--> Installing pre-requisites"
sudo apt-get install -y linux-image-extra-`uname -r` apt-transport-https
sudo apt-get install -y linux-image-extra-`uname -r`
echo "--> Installing dokku"
sudo apt-get install -y dokku
@@ -101,7 +105,9 @@ deb-dokku: deb-setup
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
$(MAKE) help2man
$(MAKE) addman
cp /usr/local/share/man/man1/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

2
debian/control vendored
View File

@@ -4,7 +4,7 @@ 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
Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroup-lite
Provides: dokku
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
Description: Docker powered mini-Heroku in around 100 lines of Bash

2
debian/postinst vendored
View File

@@ -13,6 +13,8 @@ case "$1" in
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
dokku plugins-install
rm -f /home/dokku/VERSION
cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION
if [ -f /etc/init/dokku-installer.conf ] && service dokku-installer status 2> /dev/null | grep waiting; then
sudo service dokku-installer start

3
debian/preinst vendored
View File

@@ -25,6 +25,9 @@ case "$1" in
service nginx reload
;;
upgrade)
;;
abort-upgrade)
;;

View File

@@ -1,4 +1,10 @@
#Advanced installation
# Advanced installation
You can always install dokku straight from the latest - potentially unstable - master release via the following bash command:
```shell
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
```
## Development
@@ -33,5 +39,21 @@ Dokku ships with a pre-built version of version of the [buildstep](https://githu
```shell
git clone https://github.com/progrium/dokku.git
cd dokku
sudo BUILD_STACK=true make install
sudo BUILD_STACK=true STACK_URL=https://github.com/progrium/buildstep.git make install
```
## Configuring
Once dokku is installed, if you are not using the web-installer, you'll want to configure a the virtualhost setup as well as the push user. If you do not, your installation will be considered incomplete and you will not be able to deploy applications.
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"
If you are using the vagrant installation, you can use the following command to add your public key to dokku:
$ cat ~/.ssh/id_rsa.pub | make vagrant-acl-add
That's it!

View File

@@ -116,5 +116,5 @@ Dokku will wait `DOKKU_WAIT_TO_RETIRE` seconds (default: `60`) before stopping t
SSH onto the server, then execute:
```shell
dokku delete myapp
dokku apps:destroy myapp
```

81
docs/community/clients.md Normal file
View File

@@ -0,0 +1,81 @@
# Clients
Given the constraints, running dokku commands remotely via SSH is fine. For certain configurations, the extra complication of manually invoking ssh can be a burden.
While dokku does not yet have an official client, there are a multitude of ways in which you can interact with your dokku installation. The easiest is to use the **bash** client, though you may wish to use another.
## (bash) `dokku_client.sh`
Of all methods, this is the *most* official method of interacting with your dokku installation. It is a bash script that interacts with a remote dokku installation via ssh. It is available in `contrib/dokku_client.sh` in the root of the dokku repository.
To install, simply clone the dokku repository down and add the `dokku` alias pointing at the script:
```shell
git clone git@github.com:progrium/dokku.git ~/.dokku
# add the following to either your
# .bashrc, .bash_profile, or .profile file
alias dokku='$HOME/.dokku/contrib/dokku_client.sh'
```
Configure the `DOKKU_HOST` environment variable or run `dokku` from a repository with a git remote named dokku pointed at your dokku host in order to use the script as normal.
## (nodejs) dokku-toolbelt
Dokku-toolbelt is a node-based cli wrapper that proxies requests to the dokku command running on remote hosts. You can install it via the following shell command (assuming you have nodejs and npm installed):
```shell
npm install -g dokku-toolbelt
```
See [documentation here](https://www.npmjs.com/package/dokku-toolbelt) for more information.
## (python) dokku-client
dokku-client is an extensible python-based cli wrapper for remote dokku hosts. You can install it via the following shell command (assuming you have python and pip installed):
```shell
pip install dokku-client
```
See [documentation here](https://github.com/adamcharnock/dokku-client) for more information.
## (ruby) Dokku CLI
Dokku CLI is a rubygem that acts as a client for your dokku installation. You can install it via the following shell command (assuming you have ruby and rubygems installed):
```shell
gem install dokku-cli
```
See [documentation here](https://github.com/SebastianSzturo/dokku-cli) for more information.
## (ruby) DokkuClient
DokkuClient is another rubygem that acts as a client for your dokku installation with built-in support for certain external plugins. You can install it via the following shell command (assuming you have ruby and rubygems installed):
```shell
gem install dokku_client
```
See [documentation here](https://github.com/netguru/dokku_client) for more information.
## (ruby) Dokkufy
Dokkufy is a rubygem that handles automation of certain tasks, such as dokku setup, plugin installation, etc. You can install it via the following shell command (assuming you have ruby and rubygems installed):
```shell
gem install dokkufy
```
See [documentation here](https://github.com/cbetta/dokkufy) for more information.
## (ruby) Dockland
Dockland is a rubygem that acts as a client for your dokku installation. You can install it via the following shell command (assuming you have ruby and rubygems installed):
```shell
gem install dockland
```
See [documentation here](https://github.com/uetchy/dockland) for more information.

View File

@@ -0,0 +1,81 @@
# Plugin Creation
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](http://progrium.viewdocs.io/dokku/plugins) and add a link to it.
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
```
- As some plugins require access to set app config settings and do not want/require the default Heroku-style behavior of a restart, we have the following "internal" commands that provide this functionality :
```shell
dokku config:set-norestart APP KEY1=VALUE1 [KEY2=VALUE2 ...]
dokku config:unset-norestart APP KEY1 [KEY2 ...]
```

View File

@@ -0,0 +1,591 @@
# Pluginhooks
[Pluginhooks](https://github.com/progrium/pluginhook) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration.
Pluginhooks are simply scripts that are executed by the system. You can use any language you want, so long as the script:
- Is executable
- Has the proper language requirements installed
For instance, if you wanted to write a pluginhook in PHP, you would need to have `php` installed and available on the CLI prior to pluginhook invocation.
The following is an example for the `nginx-hostname` pluginhook. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin, it would be invoked by dokku during the normal app deployment process:
```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"
```
## Available Pluginhooks
There are a number of plugin-related pluginhooks. These can be optionally implemented by plugins and allow integration into the standard dokku plugin setup/backup/teardown process.
The following pluginhooks describe those available to a dokku installation. As well, there is an example for each pluginhook that you can use as templates for your own plugin development.
> The example pluginhook code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples.
### `install`
- Description: Used to setup any files/configuration for a plugin.
- Invoked by: `dokku plugins-install`.
- Arguments: None
- Example:
```shell
#!/usr/bin/env bash
# Sets the hostname of the dokku server
# based on the output of `hostname -f`
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
hostname -f > $DOKKU_ROOT/HOSTNAME
fi
```
### `dependencies`
- Description: Used to install system-level dependencies. Invoked by `plugins-install-dependencies`.
- Invoked by: `dokku plugins-install-dependencies`
- Arguments: None
- Example:
```shell
#!/usr/bin/env bash
# Installs nginx for the current plugin
# Supports both opensuse and ubuntu
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$DOKKU_DISTRO" in
ubuntu)
export DEBIAN_FRONTEND=noninteractive
apt-get install --force-yes -qq -y nginx
;;
opensuse)
zypper -q in -y nginx
;;
esac
```
### `update`
- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates.
- Invoked by: `dokku plugins-update`.
- Arguments: None
- Example:
```shell
#!/usr/bin/env bash
# Update the buildstep image from git source
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cd /root/dokku
sudo BUILD_STACK=true make install
```
### `commands help`
- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this pluginhook. This must be implemented inside the `commands` pluginhook file.
- Invoked by: `dokku help`
- Arguments: None
- Example:
```shell
#!/usr/bin/env bash
# Outputs help for the derp plugin
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | derp:help)
cat && cat<<EOF
derp:herp Herps the derp
derp:serp [file] Shows the file's serp
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac
```
### `backup-export`
- Description: Used to backup files for a given plugin. If your plugin writes files to disk, this pluginhook should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz.
- Invoked by: `dokku backup:export`
- Arguments: `$VERSION $DOKKU_ROOT`
- Example:
```shell
#!/usr/bin/env bash
# Echos out the location of every `REDIRECT` file
# that are used by the apps
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
DOKKU_ROOT="$2"
cat; for i in $DOKKU_ROOT/*/REDIRECT; do echo $i; done
```
### `backup-check`
- Description: Checks that a backup being imported passes sanity checks.
- Invoked by: `dokku backup:import`
- Arguments: `$VERSION $BACKUP_ROOT $DOKKU_ROOT $BACKUP_TMP_DIR/.dokku_backup_apps`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `backup-import`
- Description: Allows a plugin to import specific files from a `$BACKUP_ROOT` to the `DOKKU_ROOT` directory.
- Invoked by: `dokku backup:import`
- Arguments: `$VERSION $BACKUP_ROOT $DOKKU_ROOT $BACKUP_TMP_DIR/.dokku_backup_apps`
- Example:
```shell
#!/usr/bin/env bash
# Copies all redirect files from the backup
# into the correct app path.
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
BACKUP_ROOT="$2"
DOKKU_ROOT="$3"
cd $BACKUP_ROOT
for file in */REDIRECT; do
cp $file "$DOKKU_ROOT/$file"
done
```
### `pre-build-buildstep`
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildstep.
- Invoked by: `dokku build`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `post-build-buildstep`
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildstep.
- Invoked by: `dokku build`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `pre-build-dockerfile`
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using a dockerfile.
- Invoked by: `dokku build`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `post-build-dockerfile`
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using a dockerfile.
- Invoked by: `dokku build`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `pre-release-buildstep`
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildstep.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
# Installs the graphicsmagick package into the container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
dokku_log_info1" Installing GraphicsMagick..."
CMD="cat > gm && \
dpkg -s graphicsmagick > /dev/null 2>&1 || \
(apt-get update && apt-get install -y graphicsmagick && apt-get clean)"
ID=$(docker run -i -a stdin $IMAGE /bin/bash -c "$CMD")
test $(docker wait $ID) -eq 0
docker commit $ID $IMAGE > /dev/null
```
### `post-release-buildstep`
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildstep.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
# Installs a package specified by the `CONTAINER_PACKAGE` env var
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
dokku_log_info1" Installing $CONTAINER_PACKAGE..."
CMD="cat > gm && \
dpkg -s CONTAINER_PACKAGE > /dev/null 2>&1 || \
(apt-get update && apt-get install -y CONTAINER_PACKAGE && apt-get clean)"
ID=$(docker run -i -a stdin $IMAGE /bin/bash -c "$CMD")
test $(docker wait $ID) -eq 0
docker commit $ID $IMAGE > /dev/null
```
### `pre-release-dockerfile`
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `post-release-dockerfile`
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
- Invoked by: `dokku release`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `check-deploy`
- Description: Allows you to run checks on a deploy before dokku allows the container to handle requests.
- Invoked by: `dokku deploy`
- Arguments: `$CONTAINER_ID $APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
- Example:
```shell
#!/usr/bin/env bash
# Disables deploys of containers based on whether the
# `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
DOKKU_DISABLE_DEPLOY="${DOKKU_DISABLE_DEPLOY:-false}"
if [[ "$DOKKU_DISABLE_DEPLOY" = "true" ]]; then
echo -e "\033[31m\033[1mDeploys disabled, sorry.\033[0m"
exit 1
fi
```
### `pre-deploy`
- Description: Allows the running of code before the container's process is started.
- Invoked by: `dokku deploy`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
# Runs gulp in our container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"
IMAGE="dokku/$APP"
dokku_log_info1 "Running gulp"
id=$(docker run -d $IMAGE /bin/bash -c "cd /app && gulp default")
test $(docker wait $id) -eq 0
docker commit $id $IMAGE > /dev/null
dokku_log_info1 "Building UI Complete"
```
### `post-deploy`
- Description: Allows running of commands after a deploy has completed. Dokku core currently uses this to switch traffic on nginx.
- Invoked by: `dokku deploy`
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
- Example:
```shell
#!/usr/bin/env bash
# Notify an external service that a successful deploy has occurred.
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
curl "http://httpstat.us/200"
```
### `pre-delete`
- Description: Can be used to run commands before an app is deleted.
- Invoked by: `dokku apps:destroy`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
# Clears out the gulp asset build cache for applications
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE="dokku/$APP"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"
if [[ -d $GULP_CACHE_DIR ]]; then
docker run --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
fi
```
### `post-delete`
- Description: Can be used to run commands after an application is deleted.
- Invoked by: `dokku apps:destroy`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
# Runs a command to ensure that an app's
# postgres installation is removed
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1";
dokku postgres:destroy $APP
```
### `docker-args-build`
- Description:
- Invoked by: `dokku build`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `docker-args-deploy`
- Description:
- Invoked by: `dokku deploy`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `docker-args-run`
- Description:
- Invoked by: `dokku run`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `bind-external-ip`
- Description: Allows you to disable binding to the external box ip
- Invoked by: `dokku deploy`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
# Force always binding to the docker ip, no matter
# what the settings are for a given app.
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
echo false
```
### `post-domains-update`
- Description: Allows you to run commands once the domain for an application has been updated.
- Invoked by: `dokku domains:add`, `dokku domains:clear`, `dokku domains:remove`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
# Reloads haproxy for our imaginary haproxy plugin
# that replaces the nginx-vhosts plugin
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
sudo service haproxy reload
```
### `git-pre-pull`
- Description:
- Invoked by: `dokku git-upload-pack`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `git-post-pull`
- Description:
- Invoked by: `dokku git-upload-pack`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `nginx-hostname`
- Description: Allows you to customize the hostname for a given application.
- Invoked by: `dokku domains:setup`
- Arguments: `$APP $SUBDOMAIN $VHOST`
- Example:
```shell
#!/usr/bin/env bash
# Reverses the hostname for the application
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; SUBDOMAIN="$2"; VHOST="$3"
NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
echo "$NEW_SUBDOMAIN.$VHOST"
```
### `nginx-pre-reload`
- Description: Run before nginx reloads hosts
- Invoked by: `dokku nginx:build-config`
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
- Example:
```shell
#!/usr/bin/env bash
# Runs a check against all nginx conf files
# to ensure they are valid
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
nginx -t
```
### `receive-app`
- Description: Allows you to customize what occurs when an app is received. Normally just triggers an application build.
- Invoked by: `dokku git-hook`, `dokku ps:rebuild`
- Arguments: `$APP $REV`
- Example:
```shell
#!/usr/bin/env bash
# For our imaginary mercurial plugin, triggers a rebuild
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; REV="$2"
dokku hg-build $APP $REV
```

View File

@@ -0,0 +1,7 @@
# Digital Ocean
On Digital Ocean, there is a pre-made image that can be run for Dokku. You can choose to run this image on any sized droplet, though larger droplets will allow you to run larger applications.
When choosing your Droplet configuration, please disable IPv6 on the droplet. There are known issues with IPv6 on Digital Ocean and Docker, and many have been reported to the Dokku issue tracker.
If you would like to run Dokku on an IPv6 Digital Ocean Droplet, please consult [this guide](https://jeffloughridge.wordpress.com/2015/01/17/native-ipv6-functionality-in-docker/) for modifying Docker to run under the Digital Ocean IPv6 configuration.

View File

@@ -0,0 +1,36 @@
# Installing on Linode
Due to how Linode installs custom kernels, Linode instances *require* a reboot before they can fully work with Docker/Dokku. The Official Dokku StackScript should take care of this process for you, and will email notify you when the instance is running and you can proceed with installation.
## Using StackScript
Deploy using the following (experimental) Official StackScript:
- https://www.linode.com/stackscripts/view/11348
## Without StackScript
* Build a Ubuntu 13.04 instance
* Follow these instructions: https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distributionsupplied-kernel-with-pvgrub#ubuntu-1304-raring
* 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
```

View File

@@ -0,0 +1,39 @@
# 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 dokku`
```
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.

View File

@@ -0,0 +1,25 @@
# Where to Get Help
If you’re stuck, there are a number of places you can get help:
## The Official Dokku Website
[http://progrium.viewdocs.io/dokku](http://progrium.viewdocs.io/dokku)
The Official Dokku website is always a great place to visit. It features links to oft-used developer tools, community plugins, and guides on using dokku.
## The IRC Channel
IRC Channel on irc.freenode.net:
- #dokku – General Discussion
If you’re stumped, give us a holler in the Dokku IRC channel. Someone from the development team is usually there, especially during the daylight hours for North and South America users. We’d love to hear from you, whether you need some help, want to find users in your area, or would like to donate your brand new sports car.
If [here](http://webchat.freenode.net/?channels=dokku) for a web-based client IRC client.
## Stackoverflow
http://stackoverflow.com/
Tag your questions with `dokku` to enable existing users of stackoverflow to find your questions.

View File

@@ -2,24 +2,36 @@
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
## Table Of Contents
### Getting Started
- [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)
- [Getting Help](http://progrium.viewdocs.io/dokku/getting-started/where-to-get-help)
### Deployment
- [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)
- [Process management](http://progrium.viewdocs.io/dokku/process-management)
- [DNS Configuration](http://progrium.viewdocs.io/dokku/dns)
- [Nginx Configuration](http://progrium.viewdocs.io/dokku/nginx)
- [DNS](http://progrium.viewdocs.io/dokku/dns)
- [Running Remote commands](http://progrium.viewdocs.io/dokku/remote-commands)
### Community Contributions
- [Clients](http://progrium.viewdocs.io/dokku/community/clients)
- [Plugins](http://progrium.viewdocs.io/dokku/plugins)
### Development
- [Plugin Creation](http://progrium.viewdocs.io/dokku/development/plugin-creation)
- [Pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks)
## 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

View File

@@ -11,144 +11,23 @@ Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's de
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
# This may need to be run twice
wget -qO- https://raw.github.com/progrium/dokku/v0.3.16/bootstrap.sh | sudo DOKKU_TAG=v0.3.16 bash
# Install the web installer. See `Configuring` under
# `Advanced Install Customization` if you wish to perform the
# rest of the install via CLI
cd /root/dokku && make dokku-installer
# Go to your server's IP and follow the web installer
```
## Configuring
For various reasons, certain hosting providers may have other steps that should be preferred to the above. If hosted on any of the following popular hosts, please follow the linked to instructions:
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).
- [Digital Ocean Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/digitalocean)
- [Linode Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/linode)
You'll have to add a public key associated with a username by doing something like this from your local machine:
As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started:
$ 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
```
- [Vagrant Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/vagrant)
- [Advanced Install Customization](http://progrium.viewdocs.io/dokku/advanced-installation)

View File

@@ -21,79 +21,7 @@ dokku plugins-install
## 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
```
[See the full documentation](http://progrium.viewdocs.io/dokku/development/plugin-creation).
## Community plugins
@@ -132,6 +60,7 @@ Note: The following plugins have been supplied by our community and may not have
[motin]: https://github.com/motin
[musicglue]: https://github.com/musicglue
[neam]: https://github.com/neam
[nickstenning]: https://github.com/nickstenning
[nornagon]: https://github.com/nornagon
[ohardy]: https://github.com/ohardy
[pauldub]: https://github.com/pauldub
@@ -146,6 +75,9 @@ Note: The following plugins have been supplied by our community and may not have
[thrashr888]: https://github.com/thrashr888
[wmluke]: https://github.com/wmluke
[Zenedith]: https://github.com/Zenedith
[sekjun9878]: https://github.com/sekjun9878
[Flink]: https://github.com/Flink
[ribot]: https://github.com/ribot
### Datastores
@@ -171,6 +103,7 @@ Note: The following plugins have been supplied by our community and may not have
| [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](https://github.com/sekjun9878/dokku-redis-plugin) | [sekjun9878][] | A better Redis plugin with automatic instance creation and Dokku Link support
| [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|
@@ -186,6 +119,9 @@ Note: The following plugins have been supplied by our community and may not have
| Plugin | Author | Compatibility |
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub][] | Compatible with 0.2.0 |
| [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 |
| [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][]) |
@@ -211,61 +147,74 @@ Note: The following plugins have been supplied by our community and may not have
| 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][] | |
| [Dokku Registry](https://github.com/agco-adm/dokku-registry)<sup>1</sup> | [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 |
| [Maintenance mode](https://github.com/Flink/dokku-maintenance) | [Flink][] | |
| [HTTP Auth](https://github.com/Flink/dokku-http-auth) | [Flink][] | |
[8fca220]: https://github.com/progrium/dokku/commit/8fca2204edb0017796d6915ca9157c05b1238e28
[217d00a]: https://github.com/progrium/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7
[98332de]: https://github.com/dyson/dokku-persistent-storage/commit/98332de4b5b640610bee535f4d5260263074e18b
[a043e98]: https://github.com/stuartpb/dokku-bind-port/commit/a043e9892f4815b6525c850131e09fd64db5c1fa
<sup>1</sup> 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)
<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
### Other Plugins
| Plugin | Author | Compatibility |
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
| [Wordpress](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | Dokku dev, mariadb, volume, domains |
| [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][] | |
| [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | |
| [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][] | |
| [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | |
| [Rails logs](https://github.com/Flink/dokku-rails-logs) | [Flink][] | |
| [Airbrake deploy](https://github.com/Flink/dokku-airbrake-deploy) | [Flink][] | |
<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.
### Deprecated Plugins
The following plugins have been removed as their functionality is now in Dokku Core.
| Plugin | Author | In Dokku Since |
| ------------------------------------------------------------------------------------------------- | --------------------- | ------------------------- |
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | v0.3.10 (domains plugin) |
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | v0.3.9 (trace command) |
| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>1</sup> | [wmluke][] | v0.3.10 (domains plugin) |
| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) |
| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)<sup>2</sup> | [cameron-martin][] | v0.3.9 (build-env plugin) |
| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>2</sup> | [musicglue][] | v0.3.9 (build-env plugin) |
| [user-env-compile](https://github.com/motin/dokku-user-env-compile)<sup>2</sup> | [motin][] | v0.3.9 (build-env plugin) |
<sup>1</sup> Conflicts with [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration)
<sup>2</sup> Similar to the heroku-labs feature (see https://devcenter.heroku.com/articles/labs-user-env-compile)

View File

@@ -17,3 +17,15 @@ It's possible to run commands in the environment of the deployed application:
dokku run node-js-app ls -alh
dokku run <app> <cmd>
```
## Behavioral modifiers
Dokku also supports certain command-line arguments that augment it's behavior. If using these over ssh, you must use the form `ssh -t dokku@dokku.me -- <command>`
in order to avoid ssh interpretting dokku arguments for itself.
```shell
--quiet suppress output headers
--trace enable DOKKU_TRACE for current execution only
--rm|--rm-container remove docker container after successful dokku run <app> <command>
--force force flag. currently used in apps:destroy
```

93
dokku
View File

@@ -18,9 +18,16 @@ source "$PLUGIN_PATH/common/functions"
[[ $DOKKU_TRACE ]] && set -x
parse_args "$@"
for arg in "$@"; do
[[ "$arg" =~ ^-.* ]] && shift 1
done
args=("$@")
if [[ "${args[0]}" =~ ^--.* ]]; then
for arg in "$@"; do
if [[ "$arg" =~ ^--.* ]];then
shift 1
else
break
fi
done
fi
! has_tty && DOKKU_QUIET_OUTPUT=1
if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then
@@ -41,56 +48,20 @@ fi
case "$1" in
receive)
APP="$2"; IMAGE="dokku/$APP"
dokku_log_info1 "Cleaning up ..."
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
dokku_log_info1 "Cleaning up..."
dokku cleanup
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_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
dokku_log_info1 "Releasing $APP..."
dokku release "$APP" "$IMAGE_SOURCE_TYPE"
dokku_log_info1 "Deploying $APP..."
dokku deploy "$APP"
dokku_log_info2 "Application deployed:"
dokku urls $APP | sed "s/^/ /"
dokku urls "$APP" | sed "s/^/ /"
echo
;;
build)
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
# *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
docker commit $id $IMAGE > /dev/null
pluginhook post-build $APP
;;
release)
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
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="dokku/$APP"
pluginhook pre-deploy $APP
@@ -104,19 +75,22 @@ case "$1" in
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP)
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
is_image_buildstep_based "$IMAGE" && DOKKU_BUILDSTEP=true
[[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start web"
[[ -z "$DOKKU_BUILDSTEP" ]] && eval "$(grep DOKKU_DOCKERFILE_PORT $DOKKU_ROOT/$APP/ENV)"
if [[ "$BIND_EXTERNAL" = "false" ]];then
port=5000
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE /bin/bash -c "/start web")
port=${DOKKU_DOCKERFILE_PORT:=5000}
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
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")
id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE $START_CMD)
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 {
kill_new() {
docker inspect $id &> /dev/null && docker kill $id > /dev/null
trap - INT TERM EXIT
kill -9 $$
@@ -125,16 +99,17 @@ case "$1" in
# 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}
pluginhook check-deploy $APP $port $ipaddr $id
trap - INT TERM EXIT
# now using the new container
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
echo $ipaddr > "$DOKKU_ROOT/$APP/IP"
echo $port > "$DOKKU_ROOT/$APP/PORT"
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
dokku_log_info1 "Running post-deploy"
pluginhook post-deploy $APP $port $ipaddr
trap - INT TERM EXIT
# kill the old container
if [[ -n "$oldid" ]]; then
@@ -156,9 +131,11 @@ case "$1" in
cleanup)
# delete all non-running container
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm &> /dev/null &
# shellcheck disable=SC2046
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null &
# delete unused images
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi &> /dev/null &
# shellcheck disable=SC2046
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
;;
plugins)
@@ -184,7 +161,7 @@ case "$1" in
;;
help|'')
echo "Usage: dokku [-q|--quiet|-t|--trace|--rm-container|-rm] COMMAND <app> [command-specific-options]"
echo "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND <app> [command-specific-options]"
echo ""
echo "Options:"

View File

@@ -3,6 +3,88 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
case "$1" in
build)
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
pushd "$TMP_WORK_DIR" &> /dev/null
case "$IMAGE_SOURCE_TYPE" in
buildstep)
id=$(tar -c . | 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
# *DEPRECATED* in v0.4.0: `pluginhook pre-build` will be removed in future releases
pluginhook pre-build "$APP"
pluginhook pre-build-buildstep "$APP"
# *DEPRECATED* in v0.3.14: `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
docker commit $id $IMAGE > /dev/null
# *DEPRECATED* in v0.4.0: `pluginhook post-build` will be removed in future releases
pluginhook post-build "$APP"
pluginhook post-build-buildstep "$APP"
;;
dockerfile)
# extract first port from Dockerfile
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }')
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
# sticking with same pattern of building app image before pre-build for now.
docker build -t "$IMAGE" .
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
pluginhook pre-build-dockerfile "$APP"
pluginhook post-build-dockerfile "$APP"
;;
*)
dokku_log_fail "Building image source type $IMAGE_SOURCE_TYPE not supported!"
;;
esac
;;
release)
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"
case "$IMAGE_SOURCE_TYPE" in
buildstep)
# *DEPRECATED* in v0.4.0: `pluginhook pre-release` will be removed in future releases
pluginhook pre-release "$APP"
pluginhook pre-release-buildstep "$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
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
# *DEPRECATED* in v0.4.0: `pluginhook post-release` will be removed in future releases
pluginhook post-release "$APP"
pluginhook post-release-buildstep "$APP"
;;
dockerfile)
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
pluginhook pre-release-dockerfile "$APP"
pluginhook post-release-dockerfile "$APP"
;;
*)
dokku_log_fail "Releasing image source type $IMAGE_SOURCE_TYPE not supported!"
;;
esac
;;
trace)
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p $DOKKU_ROOT/.dokkurc
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
@@ -25,6 +107,20 @@ case "$1" in
dokku apps:destroy $2
;;
ls)
apps=$(ls -d $DOKKU_ROOT/*/ 2>/dev/null) || (echo "You haven't depoyed any applications yet" && exit 1)
dokku_col_log_info2_quiet "App Name" "Container id"
for app in $apps; do
if [[ -f $app/CONTAINER ]]; then
dokku_col_log_msg "$(basename $app)" "$(< $app/CONTAINER)"
else
dokku_col_log_msg "$(basename $app)"
fi
done
;;
logs)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
@@ -53,31 +149,35 @@ case "$1" in
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP)
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
has_tty && DOKKU_RUN_OPTS+=" -i -t"
is_image_buildstep_based "$IMAGE" && EXEC_CMD="/exec"
docker run $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE /exec "$@"
docker run $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
;;
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"
APP="$2";
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then
case "$1" in
url)
grep "^http" "$DOKKU_ROOT/$APP/URLS" | head -1
;;
urls)
grep "^http" "$DOKKU_ROOT/$APP/URLS"
;;
esac
exit 0
fi
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/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
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
else
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$DOKKU_ROOT/$APP/PORT")"
@@ -93,6 +193,7 @@ case "$1" in
help)
cat && cat<<EOF
ls Pretty listing of deployed applications and containers
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 first URL for an application (compatibility)

View File

@@ -16,7 +16,7 @@ case "$DOKKU_DISTRO" in
cat<<EOF > /etc/init/dokku-redeploy.conf
description "Dokku app redeploy service"
start on (started docker)
start on filesystem and started docker
script
sleep 2 # give docker some time

View File

@@ -11,22 +11,24 @@ APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
BUILD_ENV+=$'\n'
fi
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
BUILD_ENV+=" "
BUILD_ENV+=$'\n'
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
BUILD_ENV+=$'\n'
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")
id=$(echo $BUILD_ENV |sed -e 's@export @@g' -e 's@\\n@ @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")
id=$(echo -e "$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

View File

@@ -1,76 +1,167 @@
#!/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.
# Hook to check server against list of checks specified in CHECKS file.
#
# The CHECKS file may contain empty lines, comments (lines starting with #),
# settings (NAME=VALUE) and check instructions.
#
# The format of a check instruction is a path, optionally followed by the
# expected content. For example:
#
# 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).
# To check an application that supports multiple hostnames, use relative URLs
# that include the hostname, for example:
#
# //admin.example.com Admin Dashboard
# //static.example.com/logo.png
#
# You can also specify the protocol to explicitly check HTTPS requests.
#
# The default behavior is to wait for 5 seconds before running the first check,
# and timeout each check to 30 minutes.
#
# You can change these by setting WAIT and TIMEOUT to different values, for
# example:
#
# WAIT=30 # Wait 1/2 minute
# TIMEOUT=60 # Timeout after a minute
#
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; DOKKU_APP_LISTEN_PORT="$2"; DOKKU_APP_LISTEN_IP="$3"; DOKKU_APP_CONTAINER_ID="$4"
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
if [[ -z "$DOKKU_APP_CONTAINER_ID" ]] && [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
DOKKU_APP_CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
fi
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 this many seconds (default 5) for server to start before running checks.
WAIT="${DOKKU_CHECKS_WAIT:-5}"
# Wait this many seconds (default 30) for each response.
TIMEOUT="${DOKKU_CHECKS_TIMEOUT:-30}"
# 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
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
docker cp $DOKKU_APP_CONTAINER_ID:/app/CHECKS $TMPDIR 2> /dev/null || true
function cleanup() {
echo " removing CHECKS file copied from container"
rm -rf $TMPDIR
}
trap cleanup EXIT
fi
FILENAME=${TMPDIR}/CHECKS
cleanup() {
rm -rf $TMPDIR
dokku_log_info2_quiet "$APP container output:"
dokku_container_log_verbose_quiet $DOKKU_APP_CONTAINER_ID
dokku_log_info2_quiet "end $APP container output"
}
trap cleanup EXIT
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
dokku_log_verbose "CHECKS file not found in container: running simple container check..."
rm -rf $TMPDIR
# simple default check to see if the container stuck around
# for more thorough checks, create a CHECKS file
DOKKU_DEFAULT_WAIT=$((WAIT+TIMEOUT))
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_WAIT seconds ..."
sleep $DOKKU_DEFAULT_WAIT
docker ps -q --no-trunc | grep -q "$DOKKU_APP_CONTAINER_ID" || dokku_log_fail "App container failed to start!!"
dokku_log_info1 "Default container check successful!" && exit 0
fi
echo "Waiting $WAIT seconds ..."
# Reads name/value pairs, sets the WAIT and TIMEOUT variables
exec < "$FILENAME"
while read LINE ; do
# Name/value pair
if [[ "$LINE" =~ ^.+= ]] ; then
TRIM=${LINE%#*}
NAME=${TRIM%=*}
VALUE=${TRIM#*=}
[[ "$NAME" = "WAIT" ]] && WAIT=$VALUE
[[ "$NAME" = "TIMEOUT" ]] && TIMEOUT=$VALUE
fi
done
dokku_log_info1 "Waiting for $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"
CURL_OPTIONS="-q --compressed --fail --location --max-time $TIMEOUT"
while read PATHNAME EXPECTED; do
exec < "$FILENAME"
while read CHECK_URL EXPECTED ; do
# Ignore empty lines and lines starting with #
[[ -z "$PATHNAME" || "$PATHNAME" =~ ^# ]] && continue
# shellcheck disable=SC1001
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
# Ignore variables
[[ "$CHECK_URL" =~ ^.+= ]] && 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
if [[ "$CHECK_URL" =~ ^https?: ]] ; then
URL_PROTOCOL=${CHECK_URL%:*}
CHECK_URL=${CHECK_URL#*:}
else
echo -e "\033[32m\033[1m$URL => \"$EXPECTED\"\033[0m"
URL_PROTOCOL="http"
fi
done < "$FILENAME"
echo -e "\033[32m\033[1mAll checks successful!\033[0m"
if [[ "$CHECK_URL" =~ ^//.+ ]] ; then
# To test a URL with specific host name, we still make request to localhost,
# but we set Host header to $SEND_HOST.
#
# The pattern is
# //SEND_HOST/PATHNAME
UNPREFIXED=${CHECK_URL#//}
URL_HOSTNAME=${UNPREFIXED%%/*}
URL_PATHNAME=${UNPREFIXED#$URL_HOSTNAME}
HEADERS="-H Host:$URL_HOSTNAME"
else
URL_HOSTNAME=localhost
URL_PATHNAME=$CHECK_URL
fi
# This URL will show up in the messages
LOG_URL="$URL_PROTOCOL://$URL_HOSTNAME$URL_PATHNAME"
# And how we formulate the CURL request
CURL_ARGS="$CURL_OPTIONS $URL_PROTOCOL://$DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT$URL_PATHNAME $HEADERS"
dokku_log_verbose "CHECKS expected result:"
dokku_log_verbose "$LOG_URL => \"$EXPECTED\""
[[ $DOKKU_TRACE ]] && dokku_log_verbose "$ curl $CURL_ARGS"
# Capture HTTP response or CURL error message
if OUTPUT=$(curl -# $CURL_ARGS 2>&1) ; then
# OUTPUT contains the HTTP response
if [[ ! "$OUTPUT" =~ $EXPECTED ]] ; then
dokku_log_fail "$LOG_URL: expected to but did not find: \"$EXPECTED\""
exit 1
fi
else
# Failed to connect/no response, OUTPUT contains error message
dokku_log_fail "$OUTPUT"
exit 2
fi
done
dokku_log_info1 "All checks successful!"

91
plugins/common/functions Normal file → Executable file
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
function has_tty() {
has_tty() {
if [[ "$(/usr/bin/tty || true)" == "not a tty" ]]; then
return 1
else
@@ -9,15 +9,15 @@ function has_tty() {
fi
}
function dokku_log_info1() {
dokku_log_info1() {
echo "-----> $@"
}
function dokku_log_info2() {
dokku_log_info2() {
echo "=====> $@"
}
function dokku_log_info1_quiet() {
dokku_log_info1_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
echo "-----> $@"
else
@@ -25,7 +25,7 @@ function dokku_log_info1_quiet() {
fi
}
function dokku_log_info2_quiet() {
dokku_log_info2_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
echo "=====> $@"
else
@@ -33,38 +33,101 @@ function dokku_log_info2_quiet() {
fi
}
function dokku_log_verbose() {
dokku_col_log_info1() {
printf "%-40s %-40s\n" "-----> $@"
}
dokku_col_log_info1_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-40s %-40s\n" "-----> $@"
else
return 0
fi
}
dokku_col_log_info2() {
printf "%-40s %-40s\n" "=====> $@"
}
dokku_col_log_info2_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-40s %-40s\n" "=====> $@"
else
return 0
fi
}
dokku_col_log_msg() {
printf "%-40s %-40s\n" "$@"
}
dokku_col_log_msg_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-40s %-40s\n" "$@"
else
return 0
fi
}
dokku_log_verbose_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
echo " $@"
else
return 0
fi
}
dokku_log_verbose() {
echo " $@"
}
function dokku_log_warn() {
dokku_log_warn() {
echo " ! $@"
}
function dokku_log_fail() {
dokku_log_fail() {
echo "$@" 1>&2
exit 1
}
function verify_app_name() {
dokku_container_log_verbose_quiet() {
CID=$1;
shift
OIFS=$IFS
IFS=$'\n'
for line in $(docker logs $CID 2>&1); do
dokku_log_verbose_quiet "$line"
done
IFS=$OIFS
}
verify_app_name() {
local APP="$1"
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
IMAGE="dokku/$APP"
return 0
}
function parse_args() {
is_image_buildstep_based() {
# circleci can't support --rm as they run lxc in lxc
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
docker run --entrypoint="/bin/bash" $DOCKER_ARGS "$@" -c "[[ -f /exec ]]"
}
parse_args() {
for arg in "$@"; do
case "$arg" in
--quiet|-q)
--quiet)
export DOKKU_QUIET_OUTPUT=1
;;
--trace|-t)
--trace)
export DOKKU_TRACE=1
;;
--rm-container|-rm)
--rm-container|--rm)
export DOKKU_RM_CONTAINER=1
;;
--force|-f)
--force)
export DOKKU_APPS_FORCE_DELETE=1
;;
esac

View File

@@ -42,7 +42,6 @@ config_write() {
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
}
@@ -101,6 +100,23 @@ case "$1" in
exit 1
fi
shift 2
dokku config:set-norestart $APP "$@"
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
;;
config:set-norestart)
[[ -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
config_create
ENV_ADD=""
ENV_TEMP=$(cat "${ENV_FILE}")
@@ -131,7 +147,7 @@ ${var}"
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
if [ $RESTART_APP ]; then
dokku_log_info1 "Setting config vars and restarting $APP"
dokku_log_info1 "Setting config vars"
config_styled_hash "$ENV_ADD" " "
config_write "$ENV_TEMP"
@@ -149,12 +165,29 @@ ${var}"
exit 1
fi
shift 2
dokku config:unset-norestart $APP "$@"
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
;;
config:unset-norestart)
[[ -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
config_create
ENV_TEMP=$(cat "${ENV_FILE}")
VARS="${*:3}"
for var in $VARS; do
dokku_log_info1 "Unsetting $var and restarting $APP"
dokku_log_info1 "Unsetting $var"
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
config_write "$ENV_TEMP"

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
STDIN=$(cat); APP="$1"; IMAGE="dokku/$APP"
DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
if ! is_image_buildstep_based "$IMAGE"; then
> "$DOCKERFILE_ENV_FILE"
[[ -f "$DOKKU_ROOT/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/ENV" > "$DOCKERFILE_ENV_FILE"
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/$APP/ENV" >> "$DOCKERFILE_ENV_FILE"
echo "$STDIN --env-file=$DOCKERFILE_ENV_FILE"
else
echo "$STDIN"
fi

View File

@@ -0,0 +1 @@
docker-args-deploy

View File

@@ -17,6 +17,11 @@ RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: f
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
# Ensure the ip address continues to the end of the line
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
RE_IPV4="${RE_IPV4}\$"
RE_IPV6="${RE_IPV6}\$"
case "$1" in
domains)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1

View File

@@ -1,19 +1,30 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
git_archive_all() {
APP=$1; REV=$2
git_build_app_repo() {
verify_app_name "$1"
APP="$1"; REV="$2"
# clean up after ourselves
TMP_WORK_DIR=$(mktemp -d)
trap 'rm -rf "$TMP_WORK_DIR" > /dev/null' RETURN
# git clone
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 clone -q "$DOKKU_ROOT/$APP" "$TMP_WORK_DIR" &> /dev/null
git config advice.detachedHead false
git checkout $REV &> /dev/null
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
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then
dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
else
dokku receive "$APP" "buildstep" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
fi
}
case "$1" in
@@ -25,7 +36,8 @@ 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
dokku git-build $APP $newrev
# broken out into pluginhook so we might support other methods to receive an app
pluginhook receive-app $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'"
@@ -56,7 +68,7 @@ case "$1" in
else
REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
fi
git_archive_all $APP $REF | dokku receive $APP | sed -u "s/^/"$'\e[1G'"/"
git_build_app_repo $APP $REF
;;
git-*)

7
plugins/git/receive-app Executable file
View File

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

View File

@@ -2,7 +2,7 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
@@ -19,6 +19,12 @@ RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: f
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
# Ensure the ip address continues to the end of the line
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
RE_IPV4="${RE_IPV4}\$"
RE_IPV6="${RE_IPV6}\$"
[[ -f "$DOKKU_ROOT/VHOST" ]] && GLOBAL_VHOST=$(< "$DOKKU_ROOT/VHOST")
if [[ -n "$NO_VHOST" ]]; then

View File

@@ -18,6 +18,7 @@ case "$1" in
nginx:build-config)
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="${4}"
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
URLS_PATH="$DOKKU_ROOT/$APP/URLS"
WILDCARD_SSL="$DOKKU_ROOT/tls"
SSL="$DOKKU_ROOT/$APP/tls"
@@ -45,51 +46,64 @@ EOF
SSL_DIRECTIVES=""
fi
NGINX_CONF="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf"
NGINX_CONF=$(mktemp -t "nginx.conf.XXXXXX")
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
if [[ -n "$SSL_HOSTNAME" ]]; then
SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g')
[[ -z "$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME" >> $VHOST_PATH
fi
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
if [[ -n "$SSL_HOSTNAME_ALT" ]]; then
SSL_HOSTNAME_ALT_REGEX=$(echo "$SSL_HOSTNAME_ALT" | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g')
[[ -z "$(egrep "^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME_ALT" >> $VHOST_PATH
fi
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0)
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0)
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf"
while read line; do
dokku_log_info1 "Configuring SSL for $line..."
SSL_SERVER_NAME=$line
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
NOSSL_SERVER_NAME=$line
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
done <<< "$SSL_VHOSTS"
fi
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
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
eval "cat <<< \"$(< $APP_NGINX_TEMPLATE)\" > $NGINX_CONF"
elif [[ -n "$NONSSL_VHOSTS" ]]; then
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf"
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
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
echo "upstream $APP { server $DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT; }" >> $NGINX_CONF
fi
dokku_log_info1 "Creating $SCHEME nginx.conf"
mv $NGINX_CONF "$DOKKU_ROOT/$APP/nginx.conf"
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
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" > $URLS_PATH
xargs -i echo "https://{}" <<< "${SSL_VHOSTS}" >> $URLS_PATH
xargs -i echo "http://{}" <<< "${NONSSL_VHOSTS}" >> $URLS_PATH
else
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$DOKKU_DISTRO" in

View File

@@ -3,8 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; PORT="$2"; IP="$3"
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
if [[ -n "$NO_VHOST" ]]; then
dokku_log_info1 "NO_VHOST config detected"

View File

@@ -4,14 +4,19 @@ source "$(dirname $0)/../common/functions"
release_and_deploy() {
source "$(dirname $0)/../common/functions"
local APP="$1";
local APP="$1"; local IMAGE="dokku/$APP"
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
if is_image_buildstep_based "$IMAGE"; then
IMAGE_SOURCE_TYPE="buildstep"
else
IMAGE_SOURCE_TYPE="dockerfile"
fi
dokku_log_info1 "Releasing $APP ..."
dokku release $APP
dokku_log_info1 "Release complete!"
dokku release "$APP" "$IMAGE_SOURCE_TYPE"
dokku_log_info1 "Deploying $APP ..."
dokku deploy $APP
dokku deploy "$APP"
dokku_log_info2 "Application deployed:"
dokku urls $APP | sed "s/^/ /"
echo
@@ -63,7 +68,7 @@ case "$1" in
verify_app_name "$2"
APP="$2"
dokku git-build $APP
pluginhook receive-app $APP
;;
ps:rebuildall)

59
plugins/shell/commands Executable file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
shell)
INPUTRC="$PLUGIN_ROOT/inputrc"
HISTFILE=~/.dokku_history
history -r || true
trim()
{
sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g'
}
trap 'history -w' EXIT
while true; do
trap '' SIGINT
read -ep "dokku> " line || {
echo; true; break
}
trap - SIGINT
line=$(echo $line | trim)
CMD=$(echo $line | awk '{ print $1 }')
[ -z $CMD ] && continue
[[ "$line" != "$(fc -ln -1 | trim)" ]] && history -s "$line"
case $CMD in
# shell builtins
clear)
clear
;;
quit|exit)
break
;;
# Not a built-in, run as regular dokku command
*)
dokku $line || true
esac
done
;;
help | shell:help)
cat && cat<<EOF
shell Spawn dokku shell
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

1
plugins/shell/inputrc Normal file
View File

@@ -0,0 +1 @@
set disable-completion on

View File

@@ -57,7 +57,7 @@ lint:
# 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
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | grep -v directory | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001
unit-tests:
@echo running unit tests...
@@ -71,6 +71,10 @@ deploy-test-config:
@echo deploying config app...
cd tests && ./test_deploy ./apps/config dokku.me
deploy-test-dockerfile:
@echo deploying dockerfile app...
cd tests && ./test_deploy ./apps/dockerfile dokku.me
deploy-test-gitsubmodules:
@echo deploying gitsubmodules app...
cd tests && ./test_deploy ./apps/gitsubmodules dokku.me
@@ -103,6 +107,10 @@ deploy-test-python-flask:
@echo deploying python-flask app...
cd tests && ./test_deploy ./apps/python-flask dokku.me
deploy-test-ruby:
@echo deploying ruby app...
cd tests && ./test_deploy ./apps/ruby dokku.me
deploy-test-scala:
@echo deploying scala app...
cd tests && ./test_deploy ./apps/scala dokku.me
@@ -116,6 +124,7 @@ deploy-tests:
# @$(QUIET) bats tests/deploy
@$(QUIET) $(MAKE) deploy-test-config
@$(QUIET) $(MAKE) deploy-test-clojure
@$(QUIET) $(MAKE) deploy-test-dockerfile
@$(QUIET) $(MAKE) deploy-test-gitsubmodules
@$(QUIET) $(MAKE) deploy-test-go
@$(QUIET) $(MAKE) deploy-test-java

View File

@@ -1,2 +1,2 @@
#!/bin/bash
#!/usr/bin/env bash
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

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e;
test_url () {

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -ex;
REMOTE=$1

View File

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

View File

@@ -0,0 +1,14 @@
FROM ubuntu:trusty
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
EXPOSE 3000
RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update
RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git
COPY . /app
WORKDIR /app
RUN npm install
CMD npm start

View File

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

View File

@@ -0,0 +1,13 @@
var express = require('express')
var app = express();
app.set('port', (process.env.PORT || 5000))
app.use(express.static(__dirname + '/public'))
app.get('/', function(request, response) {
response.send('Hello World!')
})
app.listen(app.get('port'), function() {
console.log("Node app is running at localhost:" + app.get('port'))
})

View File

@@ -0,0 +1,29 @@
{
"name": "node-js-sample",
"version": "0.1.0",
"description": "A sample Node.js app using Express 4",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "^4.0.0"
},
"engines": {
"node": "0.10.x"
},
"repository": {
"type": "git",
"url": "https://github.com/heroku/node-js-sample"
},
"keywords": [
"node",
"heroku",
"express"
],
"author": "Mark Pundsack",
"contributors": [
"Zeke Sikelianos <zeke@sikelianos.com> (http://zeke.sikelianos.com)"
],
"license": "MIT"
}

View File

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

View File

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

View File

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

View File

@@ -1,2 +1,2 @@
#!/bin/bash
#!/usr/bin/env bash
set -e; curl -s -S "$1" | grep -q "Heroku Multi Buildpack on Dokku"

View File

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

View File

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

View File

@@ -1,2 +1,2 @@
#!/bin/bash
#!/usr/bin/env bash
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "<html><h3>php</h3></html>"

View File

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

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

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

5
tests/apps/ruby/Gemfile Normal file
View File

@@ -0,0 +1,5 @@
source 'https://rubygems.org'
ruby '2.1.5'
gem 'sinatra', '~>1.4.4'
gem 'thin'

View File

@@ -0,0 +1,24 @@
GEM
remote: https://rubygems.org/
specs:
daemons (1.1.9)
eventmachine (1.0.3)
rack (1.5.2)
rack-protection (1.5.2)
rack
sinatra (1.4.4)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
thin (1.6.1)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
rack (>= 1.0.0)
tilt (1.4.1)
PLATFORMS
ruby
DEPENDENCIES
sinatra (~> 1.4.4)
thin

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

@@ -0,0 +1 @@
web: bundle exec ruby web.rb -p $PORT

33
tests/apps/ruby/README.md Normal file
View File

@@ -0,0 +1,33 @@
# ruby-sample
This is a barebones Ruby app using the [Sinatra](http://www.sinatrarb.com) framework.
## Running Locally
Asumming you have [Ruby](https://www.ruby-lang.org), [Bundler](http://bundler.io) and [Heroku Toolbelt](https://toolbelt.heroku.com) installed on your machine:
```sh
git clone git@github.com:heroku/ruby-sample.git # or clone your own fork
cd ruby-sample
bundle
foreman start
```
Your app should now be running on [localhost:5000](http://localhost:5000/).
## Deploying to Heroku
```
heroku create
git push heroku master
heroku open
```
## Documentation
For more information about using Ruby on Heroku, see these Dev Center articles:
- [Ruby on Heroku](https://devcenter.heroku.com/categories/ruby)
- [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/getting-started-with-ruby)
- [Getting Started with Rails 4.x on Heroku](https://devcenter.heroku.com/articles/getting-started-with-rails4)
- [Heroku Ruby Support](https://devcenter.heroku.com/articles/ruby-support)

2
tests/apps/ruby/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, world"

5
tests/apps/ruby/web.rb Normal file
View File

@@ -0,0 +1,5 @@
require 'sinatra'
get '/' do
"Hello, world"
end

View File

@@ -1 +1 @@
export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx
export BUILDPACK_URL=https://github.com/yabawock/buildpack-nginx

View File

@@ -1,2 +1,2 @@
#!/bin/bash
#!/usr/bin/env bash
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "<html><h3>Static Page</h3></html>"

20
tests/ci/parallel_runner.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
case "$CIRCLE_NODE_INDEX" in
0)
echo "=====> make unit-tests"
sudo -E make -e unit-tests
;;
1)
echo "=====> make deploy-tests (buildstep release)"
sudo -E make -e deploy-tests
;;
2)
echo "=====> make deploy-tests (buildstep master)"
docker rmi -f progrium/buildstep && \
sudo -E BUILD_STACK=true make -e stack && \
sudo -E make -e deploy-tests
;;
esac

View File

@@ -11,7 +11,6 @@ destroy_app(){
failed(){
echo "************ $1 failed ************"
dokku logs $REPO
destroy_app
exit 1
}
@@ -47,5 +46,4 @@ else
fi
fi
dokku logs $REPO
destroy_app

View File

@@ -9,6 +9,21 @@ setup() {
teardown() {
rm -rf /home/dokku/$TEST_APP/tls /home/dokku/tls
destroy_app
disable_tls_wildcard
}
assert_urls() {
urls=$@
run dokku urls $TEST_APP
echo "output: "$output
echo "status: "$status
assert_output < <(tr ' ' '\n' <<< "${urls}")
}
build_nginx_config() {
# simulate nginx post-deploy
dokku domains:setup $TEST_APP
dokku nginx:build-config $TEST_APP
}
@test "run (with tty)" {
@@ -27,27 +42,38 @@ teardown() {
assert_success
}
@test "urls (non-ssl)" {
run bash -c "dokku urls $TEST_APP | grep dokku.me"
@test "run (with --options)" {
deploy_app
run /bin/bash -c "dokku --force --quiet run $TEST_APP node --version"
echo "output: "$output
echo "status: "$status
assert_output "http://dokku.me"
assert_success
}
@test "urls (non-ssl)" {
assert_urls "http://dokku.me"
build_nginx_config
assert_urls "http://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "http://${TEST_APP}.dokku.me" "http://test.dokku.me"
}
@test "urls (app ssl)" {
mkdir -p /home/dokku/$TEST_APP/tls
touch /home/dokku/$TEST_APP/tls/server.crt /home/dokku/$TEST_APP/tls/server.key
run bash -c "dokku urls $TEST_APP | grep dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "https://dokku.me"
setup_test_tls
assert_urls "https://dokku.me"
build_nginx_config
assert_urls "https://node-js-app.dokku.me" "http://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "https://node-js-app.dokku.me" "http://${TEST_APP}.dokku.me" "http://test.dokku.me"
}
@test "urls (wildcard ssl)" {
mkdir -p /home/dokku/tls
touch /home/dokku/tls/server.crt /home/dokku/tls/server.key
run bash -c "dokku urls $TEST_APP | grep dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "https://dokku.me"
setup_test_tls_wildcard
assert_urls "https://dokku.me"
build_nginx_config
assert_urls "https://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me"
add_domain "dokku.example.com"
assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://dokku.example.com"
}

View File

@@ -19,7 +19,7 @@ APP=lifecycle-app
}
@test "apps:destroy" {
run bash -c "echo $APP | dokku apps:destroy $APP"
run bash -c "dokku --force apps:destroy $APP"
echo "output: "$output
echo "status: "$status
assert_success

36
tests/unit/cleanup.bats Normal file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bats
load test_helper
setup() {
deploy_app
}
teardown() {
destroy_app
}
@test "remove exited containers" {
# make sure we have many exited containers of the same 'type'
run bash -c "for cnt in 1 2 3; do dokku run $TEST_APP hostname; done"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -a -f 'status=exited' --no-trunc=false | grep '/exec hostname'"
echo "output: "$output
echo "status: "$status
assert_success
run dokku cleanup
echo "output: "$output
echo "status: "$status
assert_success
sleep 5 # wait for dokku cleanup to happen in the background
run bash -c "docker ps -a -f 'status=exited' --no-trunc=false | grep '/exec hostname'"
echo "output: "$output
echo "status: "$status
assert_failure
run bash -c "docker ps -a -f 'status=exited' -q --no-trunc=false"
echo "output: "$output
echo "status: "$status
assert_output ""
}

View File

@@ -27,20 +27,16 @@ teardown() {
assert_success
}
@test "dokku client (apps:create)" {
destroy_app
run ./contrib/dokku_client.sh apps:create $TEST_APP
@test "dokku client (apps:create AND apps:destroy)" {
setup_client_repo
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "dokku client (apps:destroy)" {
run ./contrib/dokku_client.sh apps:destroy $TEST_APP force
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh --force apps:destroy"
echo "output: "$output
echo "status: "$status
assert_success
create_app # prevent teardown() failure
}
@test "dokku client (config:set)" {
@@ -113,17 +109,17 @@ teardown() {
assert_success
}
@test "dokku client (ps)" {
# CI support: 'Ah. I just spoke with our Docker expert --
# looks like docker exec is built to work with docker-under-libcontainer,
# but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
skip "circleci does not support docker exec at the moment."
deploy_app
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps $TEST_APP | grep -q 'node web.js'"
echo "output: "$output
echo "status: "$status
assert_success
}
# @test "dokku client (ps)" {
# # CI support: 'Ah. I just spoke with our Docker expert --
# # looks like docker exec is built to work with docker-under-libcontainer,
# # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
# skip "circleci does not support docker exec at the moment."
# deploy_app
# run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps $TEST_APP | grep -q 'node web.js'"
# echo "output: "$output
# echo "status: "$status
# assert_success
# }
@test "dokku client (ps:start)" {
deploy_app
@@ -164,15 +160,3 @@ teardown() {
echo "status: "$status
assert_success
}
@test "dokku client (apps:create AND apps:destroy)" {
setup_client_repo
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:destroy force"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -49,10 +49,18 @@ teardown() {
assert_output ""
}
@test "config (global)" {
@test "global config (buildstep)" {
deploy_app
run bash -c "dokku run $TEST_APP env | egrep '^global_test=true'"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "global config (dockerfile)" {
deploy_app dockerfile
run bash -c "dokku run $TEST_APP env | egrep '^global_test=true'"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -12,6 +12,45 @@ teardown() {
destroy_app
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST"
[[ -f "$DOKKU_ROOT/HOSTNAME.bak" ]] && mv "$DOKKU_ROOT/HOSTNAME.bak" "$DOKKU_ROOT/HOSTNAME"
disable_tls_wildcard
}
assert_ssl_domain() {
local domain=$1
assert_app_domain "${domain}"
assert_http_redirect "http://${domain}" "https://${domain}/"
assert_http_success "https://${domain}"
}
assert_nonssl_domain() {
local domain=$1
assert_app_domain "${domain}"
assert_http_success "http://${domain}"
}
assert_app_domain() {
local domain=$1
run /bin/bash -c "dokku domains $TEST_APP | grep -xF ${domain}"
echo "output: "$output
echo "status: "$status
assert_output "${domain}"
}
assert_http_redirect() {
local from=$1
local to=$2
run curl -kSso /dev/null -w "%{redirect_url}" "${from}"
echo "output: "$output
echo "status: "$status
assert_output "${to}"
}
assert_http_success() {
local url=$1
run curl -kSso /dev/null -w "%{http_code}" "${url}"
echo "output: "$output
echo "status: "$status
assert_output "200"
}
@test "nginx (no server tokens)" {
@@ -22,56 +61,36 @@ teardown() {
assert_failure
}
@test "nginx:build-config (wildcard SSL)" {
setup_test_tls_wildcard
add_domain "wildcard1.dokku.me"
add_domain "wildcard2.dokku.me"
add_domain "www.test.dokku.me"
deploy_app
assert_ssl_domain "wildcard1.dokku.me"
assert_ssl_domain "wildcard2.dokku.me"
assert_nonssl_domain "www.test.dokku.me"
}
@test "nginx:build-config (with SSL CN mismatch)" {
setup_test_tls
deploy_app
run /bin/bash -c "dokku domains $TEST_APP | egrep ^node-js-app\.dokku\.me$"
echo "output: "$output
echo "status: "$status
assert_output "node-js-app.dokku.me"
run bash -c "response=\"$(curl -LkSs node-js-app.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: "$output
echo "status: "$status
assert_success
assert_ssl_domain "node-js-app.dokku.me"
}
@test "nginx:build-config (with SSL and Multiple SANs)" {
setup_test_tls_with_sans
deploy_app
run /bin/bash -c "dokku domains $TEST_APP | egrep ^test\.dokku\.me$"
echo "output: "$output
echo "status: "$status
assert_output "test.dokku.me"
run /bin/bash -c "dokku domains $TEST_APP | grep ^www\.test\.dokku\.me$"
echo "output: "$output
echo "status: "$status
assert_output "www.test.dokku.me"
run bash -c "response=\"$(curl -LkSs test.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "response=\"$(curl -LkSs www.test.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "response=\"$(curl -LkSs www.test.app.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: "$output
echo "status: "$status
assert_success
assert_ssl_domain "test.dokku.me"
assert_ssl_domain "www.test.dokku.me"
assert_ssl_domain "www.test.app.dokku.me"
}
@test "nginx:build-config (no global VHOST and domains:add)" {
destroy_app
rm "$DOKKU_ROOT/VHOST"
create_app
run dokku domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
add_domain "www.test.app.dokku.me"
deploy_app
sleep 5 # wait for nginx to reload
run bash -c "response=\"$(curl -s -S www.test.app.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: "$output
echo "status: "$status
assert_success
assert_nonssl_domain "www.test.app.dokku.me"
}

View File

@@ -108,3 +108,21 @@ teardown() {
echo "status: "$status
assert_success
}
@test "dockerfile port exposure" {
deploy_app dockerfile
run bash -c "grep upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "port exposure (xip.io style hostnames)" {
echo "127.0.0.1.xip.io" > "$DOKKU_ROOT/VHOST"
deploy_app
run bash -c "response=\"$(curl -s -S my-cool-guy-test-app.127.0.0.1.xip.io)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -0,0 +1,70 @@
#!/usr/bin/env bats
load test_helper
setup() {
deploy_app
}
teardown() {
destroy_app
}
# @test "ps (buildstep)" {
# # CI support: 'Ah. I just spoke with our Docker expert --
# # looks like docker exec is built to work with docker-under-libcontainer,
# # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
# skip "circleci does not support docker exec at the moment."
# run bash -c "dokku ps $TEST_APP | grep -q \"node web.js\""
# echo "output: "$output
# echo "status: "$status
# assert_success
# }
@test "ps:start (buildstep)" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku ps:start $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "ps:stop (buildstep)" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_failure
}
@test "ps:restart (buildstep)" {
run bash -c "dokku ps:restart $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "ps:rebuild (buildstep)" {
run bash -c "dokku ps:rebuild $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -3,14 +3,14 @@
load test_helper
setup() {
deploy_app
deploy_app dockerfile
}
teardown() {
destroy_app
}
@test "ps" {
@test "ps (dockerfile)" {
# CI support: 'Ah. I just spoke with our Docker expert --
# looks like docker exec is built to work with docker-under-libcontainer,
# but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
@@ -21,7 +21,7 @@ teardown() {
assert_success
}
@test "ps:start" {
@test "ps:start (dockerfile)" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
@@ -36,7 +36,7 @@ teardown() {
assert_success
}
@test "ps:stop" {
@test "ps:stop (dockerfile)" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
@@ -47,7 +47,7 @@ teardown() {
assert_failure
}
@test "ps:restart" {
@test "ps:restart (dockerfile)" {
run bash -c "dokku ps:restart $TEST_APP"
echo "output: "$output
echo "status: "$status
@@ -58,7 +58,7 @@ teardown() {
assert_success
}
@test "ps:rebuild" {
@test "ps:rebuild (dockerfile)" {
run bash -c "dokku ps:rebuild $TEST_APP"
echo "output: "$output
echo "status: "$status

Binary file not shown.

View File

@@ -92,9 +92,14 @@ destroy_app() {
echo $TEST_APP | dokku apps:destroy $TEST_APP
}
add_domain() {
dokku domains:add $TEST_APP $1
}
deploy_app() {
APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"}
TMP=$(mktemp -d -t "$TARGET.XXXXX")
rmdir $TMP && cp -r ./tests/apps/nodejs-express $TMP
rmdir $TMP && cp -r ./tests/apps/$APP_TYPE $TMP
cd $TMP
git init
git config user.email "robot@example.com"
@@ -133,3 +138,21 @@ setup_test_tls_with_sans() {
tar xf $BATS_TEST_DIRNAME/server_ssl_sans.tar -C $TLS
sudo chown -R dokku:dokku $TLS
}
setup_test_tls_wildcard() {
TLS="/home/dokku/tls"
mkdir -p $TLS
tar xf $BATS_TEST_DIRNAME/server_ssl_wildcard.tar -C $TLS
sudo chown -R dokku:dokku $TLS
sed -i -e "s:^# ssl_certificate $DOKKU_ROOT/tls/server.crt;:ssl_certificate $DOKKU_ROOT/tls/server.crt;:g" \
-e "s:^# ssl_certificate_key $DOKKU_ROOT/tls/server.key;:ssl_certificate_key $DOKKU_ROOT/tls/server.key;:g" /etc/nginx/conf.d/dokku.conf
kill -HUP "$(< /var/run/nginx.pid)"; sleep 5
}
disable_tls_wildcard() {
TLS="/home/dokku/tls"
rm -rf $TLS
sed -i -e "s:^ssl_certificate $DOKKU_ROOT/tls/server.crt;:# ssl_certificate $DOKKU_ROOT/tls/server.crt;:g" \
-e "s:^ssl_certificate_key $DOKKU_ROOT/tls/server.key;:# ssl_certificate_key $DOKKU_ROOT/tls/server.key;:g" /etc/nginx/conf.d/dokku.conf
kill -HUP "$(< /var/run/nginx.pid)"; sleep 5
}