Compare commits

...

185 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
d211223f58 Release 0.3.20 2015-07-01 14:43:20 -04:00
Jose Diaz-Gonzalez
c4540701fd Merge pull request #1264 from progrium/josegonzalez-lxc-docker
Require lxc-docker-1.6.2
2015-07-01 12:05:14 -04:00
Jose Diaz-Gonzalez
74fa016bc1 Pin to 1.6.2
Refs #1263

[ci skip]
2015-06-30 16:59:37 -04:00
Jose Diaz-Gonzalez
5668f76cdd Install specific version of docker [ci skip] 2015-06-30 15:52:21 -04:00
Jose Diaz-Gonzalez
7e1e0ebb80 Require lxc-docker <= 1.6.2
1.7.0 Has issues with `docker ps` output, breaking all plugins

[ci-skip]
2015-06-30 14:06:01 -04:00
Jose Diaz-Gonzalez
976c0be189 Merge pull request #1257 from progrium/josegonzalez-ssl-logs
Split nginx ssl logs by $APP
2015-06-27 12:55:44 -04:00
Jose Diaz-Gonzalez
e2e36a5045 Add logging to :80 stanza 2015-06-27 12:24:27 -04:00
Jose Diaz-Gonzalez
6bb513f12c Split nginx ssl logs by $APP
Refs #1158
2015-06-26 11:03:29 -04:00
Jose Diaz-Gonzalez
48eca101f1 Merge pull request #1252 from progrium/1139-vagrant-docs-fix
Fix ssh port for vagrant installation. Closes #1139. [ci skip]
2015-06-25 11:22:36 -04:00
Jose Diaz-Gonzalez
0e63b4e069 Fix ssh port for vagrant installation. Closes #1139. [ci skip] 2015-06-25 11:22:17 -04:00
Jose Diaz-Gonzalez
cd8292f7fa Merge pull request #1251 from progrium/nginx-restarts
Fallback to using /etc/init.d/nginx reload directly to restart nginx
2015-06-25 11:15:39 -04:00
Jose Diaz-Gonzalez
626cd958a5 Fallback to using /etc/init.d/nginx reload directly to restart nginx. Closes #1165. Refs #1247 2015-06-25 10:38:47 -04:00
Jose Diaz-Gonzalez
15bd9db79c Merge pull request #1250 from progrium/1201-sglebs
SSL documentation is misleading
2015-06-25 10:08:25 -04:00
Marcio Marchini
114cecc911 SSL documentation is misleading
fixes #1194
[ci skip]
2015-06-25 10:07:25 -04:00
Jose Diaz-Gonzalez
2a469df5e4 Merge pull request #1207 from rockymadden/client-appname-as-arg-bug
Fixed bug with client commands taking verb, appname, and also arguments.
2015-06-25 10:06:02 -04:00
Michael Hobbs
4d162aa209 Merge pull request #1245 from arthurschreiber/patch-1
Support config variables containing `\n`
2015-06-24 12:32:47 -07:00
Arthur Schreiber
b40a86a2fc Add a testcase 2015-06-24 11:22:48 +02:00
Jose Diaz-Gonzalez
cc8b1fccc1 Release 0.3.19 2015-06-23 21:40:45 -04:00
Jose Diaz-Gonzalez
e674591567 Merge pull request #1246 from progrium/call-apt-get
Ensure we call apt-get before installing packages
2015-06-23 21:37:57 -04:00
Jose Diaz-Gonzalez
b39b0d4c78 Ensure we call apt-get before installing packages 2015-06-23 20:59:34 -04:00
Arthur Schreiber
0da389e8af Further fixes for config values containing newlines. 2015-06-23 23:53:10 +02:00
Arthur Schreiber
182ae4a50a Support config variables containing \n 2015-06-23 23:41:34 +02:00
Michael Hobbs
1aee972a82 Merge pull request #1237 from zyegfryed/patch-1
Typo (at at -> at)
2015-06-19 07:44:33 -07:00
Sébastien Fievet
b3269e3c95 Typo (at at -> at) 2015-06-19 10:23:44 +02:00
Michael Hobbs
c0f8764292 [ci skip] clarify phases in docker-options plugin 2015-06-17 08:12:46 -07:00
Michael Hobbs
6ebb897150 Merge pull request #1232 from progrium/1231_mh-dockerfile-build-cache-control
allow passing of docker build options and document dockerfile deployment. closes #1231
2015-06-15 16:22:31 -07:00
Michael Hobbs
ba4e87cb8b [ci skip] clean up documentation language 2015-06-15 09:09:49 -07:00
Michael Hobbs
ea66619f3c allow passing of docker build options and document dockerfile deployment. closes #1231 2015-06-15 09:00:33 -07:00
Michael Hobbs
62906cd542 Merge pull request #1227 from Flink/dockerfile-build-without-cache
Use --no-cache when building Dockerfile
2015-06-11 13:37:45 -07:00
Loïc Guitaut
9a71fff3f1 Use --no-cache when building Dockerfile
Since `docker build` is only invoked when actually building a new image
from a Dockerfile, using `--no-cache` allows to have an updated image
even if the Dockerfile hasn't changed.
This works well with Dockerfiles using `git` or packages referencing
latest versions instead of "static" ones.
2015-06-11 12:05:07 +02:00
Jose Diaz-Gonzalez
8880a9ce84 Merge pull request #1224 from lmars/docs-update
Update plugin-creation.md
2015-06-10 12:46:19 -04:00
Lewis Marshall
e61e6e94af Update plugin-creation.md
Signed-off-by: Lewis Marshall <lewis@lmars.net>
2015-06-09 23:34:54 +01:00
Jose Diaz-Gonzalez
d08cec5913 Merge pull request #1218 from progrium/mh-add-logspout-plugin
add dokku-logspout plugin
2015-06-06 14:37:54 -04:00
Michael Hobbs
473f28b0c3 [ci skip] add dokku-logspout plugin 2015-06-05 15:58:07 -07:00
Michael Hobbs
dda2ac03ee Merge pull request #1217 from kirushanth-sakthivetpillai/fix_broken_ssl_wildcard_redirect
Fix broken ssl wildcard redirect
2015-06-05 13:33:36 -07:00
Kirushanth Sakthivetpillai
db6e71b7d6 Update nginx.ssl.conf.template
use nginx $host variable intead of $ssl_server_nam (which may be *.example.com) which does bogus redirects
2015-06-05 15:01:22 -04:00
Michael Hobbs
daeea6ba13 Merge pull request #1206 from rockymadden/patch-1
Handle for installs in /usr/local/bin and the like.
2015-06-02 10:45:41 -07:00
Jose Diaz-Gonzalez
0bfa25f73e Merge pull request #1212 from progrium/mh-dont-install-docker-in-ci
let circleci dictate docker install (fixes master)
2015-05-27 18:03:29 -04:00
Michael Hobbs
b35190101c let circleci dictate docker install 2015-05-27 13:19:28 -07:00
Jose Diaz-Gonzalez
2ceed0cbdf Merge pull request #1210 from cddr/split-nginx-logs
[Fixes #1158] Split nginx logs by $APP
2015-05-25 23:23:52 -04:00
Andy Chambers
eedb05d656 [Fixes #1158] Split nginx logs by $APP
* nginx access logs to /var/log/nginx/${APP}-access.log
 * nginx error logs to /var/log/nginx/${APP}-error.log
2015-05-24 23:59:17 -07:00
Rocky Madden
587de65441 When parsing args when handling verbs, appname can be included as an argument causing bugs with commands that accept a verb, appname, and also arguments. 2015-05-22 18:21:54 -06:00
Rocky Madden
7a6450f0f0 Fixed lint issue. 2015-05-22 17:07:54 -06:00
Rocky Madden
a90090bacd Handle for installs in /usr/local/bin and the like. 2015-05-22 16:58:26 -06:00
Jose Diaz-Gonzalez
3bf68616ad Merge pull request #1204 from 3onyc/bootstrap-fix
Fix bootstrap.sh, install curl when it's missing, make curl follow redirects, don't suppress stderr
2015-05-22 04:04:23 -04:00
3onyc
450f9f19b2 Make curl follow redirects, and don't suppress its output in bootstrap.sh 2015-05-22 08:50:37 +02:00
3onyc
f17b799638 Ensure curl is installed by bootstrap.sh if it's missing 2015-05-22 08:50:23 +02:00
Michael Hobbs
6e0eb5938a Merge pull request #1202 from progrium/1185_mh-filter-wildcard-server-name
filter out literal wildcard when deploying an unrelated domain. closes #1185
2015-05-20 06:43:14 -07:00
Michael Hobbs
af38e4f25a filter out literal wildcard when deploying an unrelated domain. closes #1185 2015-05-19 17:58:02 -07:00
Michael Hobbs
b6b8f4ddc1 Merge pull request #1200 from progrium/mh-fix-lint-1198
fix lintball from #1198
2015-05-19 09:47:18 -07:00
Michael Hobbs
140f5a4939 fix lintball from #1198 2015-05-19 09:39:27 -07:00
Michael Hobbs
f86a6704bd Merge pull request #1198 from 3onyc/fix-preinst
Check web_config before key_file (Fixes #1196)
2015-05-19 09:37:27 -07:00
3onyc
c2c18af425 Check web_config before key_file (Fixes #1196) 2015-05-19 15:11:06 +02:00
Michael Hobbs
c5a74fac90 Merge pull request #1193 from progrium/1187_mh-docker-opts-over-ssh
handle docker opts over ssh without escaping quotes. closes #1187
2015-05-18 12:16:08 -07:00
Michael Hobbs
43869dd48d Merge pull request #1118 from progrium/mh-ps-scale
container-level scaling
2015-05-18 11:27:28 -07:00
Michael Hobbs
bd0b14692a lintball 2015-05-18 10:27:16 -07:00
Michael Hobbs
a785bf82e6 handle docker opts over ssh without escaping quotes. closes #1187 2015-05-18 09:01:12 -07:00
Michael Hobbs
1f6badc6a1 lintball fix 2015-05-18 08:46:42 -07:00
Jose Diaz-Gonzalez
0816ee7575 Merge pull request #1180 from sherbondy/patch-1
Update docker-options.md
2015-05-18 10:50:38 -04:00
Michael Hobbs
0d2e5f1a14 Merge branch 'master' into mh-ps-scale 2015-05-17 17:45:01 -07:00
Jose Diaz-Gonzalez
7dd52ef1fc Merge pull request #1192 from alessio/alessio-dokku-events
Add reference to dokku-events plugin
2015-05-17 19:39:41 -04:00
Alessio Treglia
347366b6e4 Add reference to dokku-events plugin 2015-05-17 22:20:46 +01:00
Jose Diaz-Gonzalez
3639f16137 Merge pull request #1168 from cjblomqvist/pr/1155
Better, actually working, git-rev plugin
2015-05-16 14:32:22 -04:00
Jose Diaz-Gonzalez
eac3eba50e Merge pull request #1179 from trsc/prevent_dismissal_of_urls_in_checks_file
prevent dismissal of URLs in CHECKS file that contain query params
2015-05-16 14:30:21 -04:00
Jose Diaz-Gonzalez
5606a308b6 Release 0.3.18 2015-05-16 14:10:59 -04:00
Jose Diaz-Gonzalez
9980b74688 Merge pull request #1190 from progrium/minor-vagrant-fixes
Fix docker gpg key installation
2015-05-16 13:43:07 -04:00
Jose Diaz-Gonzalez
414b1fd744 Merge pull request #1171 from 3onyc/debconf
[RFC] Use debconf for package configuration
2015-05-16 13:41:47 -04:00
Jose Diaz-Gonzalez
b99e26811b Merge pull request #1189 from vincentfretin/patch-7
wait 30 seconds and not 30 minutes
2015-05-16 13:41:17 -04:00
Vincent Fretin
2e69ff6041 wait 30 seconds and not 30 minutes 2015-05-16 18:20:50 +02:00
3onyc
d9a989d6b0 Use debconf to allow for command-line or unattended installation 2015-05-15 17:43:40 +02:00
Jose Diaz-Gonzalez
75180f7f9b [ci skip] ensure we follow redirects and use ssl when grabbing the docker gpg key
Also install curl when running `vagrant up dokku-deb`
2015-05-12 15:47:12 -04:00
Jose Diaz-Gonzalez
fc466e2c05 [ci skip] Fix FORWARDED_PORT 2015-05-12 14:27:49 -04:00
Jose Diaz-Gonzalez
a54f9ebc7c Merge pull request #1172 from progrium/1169_mh-fix-empty-nonssl-vhosts
unify default and custom nginx template processing
2015-05-12 10:33:01 -04:00
Ethan Sherbondy
1da6cd6b3c Update docker-options.md
My changes may not be quite correct, but as far as I can tell, DOCKER_OPTIONS now requires specifying a phase explicitly.
Also updated references to `--link` since `-link` has been deprecated in Docker.
2015-05-11 20:59:37 -04:00
Michael Hobbs
c5337cf6a2 include output when overriding nginx template 2015-05-11 12:00:44 -07:00
Jose Diaz-Gonzalez
b0189049b7 Merge pull request #1178 from jagandecapri/patch-1
Update plugins.md
2015-05-11 11:16:46 -04:00
Jagatheesan Jack
fc4699dee9 Update plugins.md
Update plugins.md with another Bower/Gulp plugin.
2015-05-11 21:31:33 +08:00
Andreas Follmann
6eefcbb87c prevent dismissal of URLs in CHECKS file that contain query params 2015-05-11 15:31:28 +02:00
Jose Diaz-Gonzalez
d9334900fb Merge pull request #1173 from progrium/josegonzalez-badges
[ci skip] standardize readme badges
2015-05-07 01:30:29 -04:00
Jose Diaz-Gonzalez
f92d8d9a6a [ci skip] standardize readme badges 2015-05-07 01:30:00 -04:00
Michael Hobbs
b836c1f65a use regex when filtering nonssl vhosts. process custom templates in the same manner as default templates. closes #1169 2015-05-06 16:49:37 -07:00
cjblomqvist
cb1aac75fb Better, actually working, git-rev plugin
The previous one broke deployment on first deployment and was always one (relative deploys) REV behind when "working".
2015-05-04 11:34:13 +02:00
Michael Hobbs
4aedb6507a Merge branch 'master' into mh-ps-scale 2015-04-30 10:32:29 -07:00
Jose Diaz-Gonzalez
02277cc411 Merge pull request #1150 from cjblomqvist/patch-1
Add monit plugin
2015-04-30 07:35:29 -04:00
Jose Diaz-Gonzalez
495994daf0 Merge pull request #1153 from econya/readme-how-to-contribute
Add README-section: how to contribute
2015-04-30 07:35:09 -04:00
cjblomqvist
56d0af02c4 Update plugins.md 2015-04-30 09:51:30 +02:00
cjblomqvist
1a70dd1707 Update plugins.md 2015-04-30 09:51:14 +02:00
Jose Diaz-Gonzalez
e9ddde8a82 improve contribution section in README as proposed by josegonzalez. 2015-04-30 08:39:08 +02:00
Michael Hobbs
da92419023 Merge pull request #1151 from LTe/docker-stop
Do not kill docker container with SIGKILL
2015-04-29 13:57:40 -07:00
Piotr Niełacny
4aa970ace8 Do not kill docker container with SIGKILL
When we will use `kill` command on `docker` main process will receive
`SIGKILL` signal. This will result in immediate termination of
processes. We need to send a signal `SIGTERM` to main process and give
the opportunity to close application in correct way.
2015-04-29 16:00:16 +02:00
Felix Wolfsteller
a36aaab686 add section about contribution to README 2015-04-29 10:52:38 +02:00
Felix Wolfsteller
c1d901723d add section about curl timeout issues when pulling buildpack stuff while deploying. 2015-04-29 10:40:41 +02:00
cjblomqvist
952ff31189 Add monit plugin 2015-04-28 15:53:32 +02:00
Jose Diaz-Gonzalez
713a8d4f31 Merge pull request #1146 from progrium/1142_mh-domains-no-redeploy
don't re-deploy on domains:add. allow multple domains on command line. closes #1142
2015-04-27 22:11:01 -04:00
Jose Diaz-Gonzalez
42712f8896 Merge pull request #1148 from TheEmpty/patch-1
Add information about 444 for nginx in default_sever.
2015-04-27 21:35:39 -04:00
Mohammad El-Abid
e0adfd035f Add information about 444 for nginx in default_sever. 2015-04-27 10:00:48 -04:00
Michael Hobbs
379ee525a8 Merge pull request #1144 from protonet/master
Allow git-remote with different port
2015-04-26 11:00:50 -07:00
Andreas Litt
b9e7a09f4c Merge pull request #1 from progrium/1144_mh-test-git-remote-offport
add test for off-port git remote
2015-04-26 19:12:56 +02:00
Michael Hobbs
a6c7cc50ce test off port git remote 2015-04-25 10:01:01 -07:00
Michael Hobbs
981e857ab1 add sshd config for off-port testing 2015-04-25 10:01:01 -07:00
Michael Hobbs
c8c4a6a0c6 pass through return code when calling destroy_app. allow custom git remote 2015-04-25 10:01:01 -07:00
Andreas Litt
383deb2b1b exec git-receive-pack with correct path 2015-04-25 10:01:01 -07:00
Andreas Litt
9fdff11687 remove leading '/' from APP-Name. 2015-04-25 10:01:01 -07:00
Michael Hobbs
2f0f2889db need to restart now 2015-04-24 15:41:32 -07:00
Michael Hobbs
dce031d38d don't re-deploy on domains:add. allow multple domains on command line. closes #1142 2015-04-24 15:41:32 -07:00
Michael Hobbs
31fafe55d3 Merge pull request #1145 from progrium/1135_mh-docker-options-over-ssh
allow docker-options over ssh. plus test. closes #1135
2015-04-24 15:40:45 -07:00
Michael Hobbs
833f308d2f Merge pull request #1147 from progrium/mh-parallelize-tests-plus-1-container
Utilize all 4 free CircleCI containers
2015-04-24 15:36:53 -07:00
Michael Hobbs
0c715d4b39 more test efficiencies and cleanup 2015-04-24 15:05:21 -07:00
Michael Hobbs
a529f6fce8 lintball 2015-04-24 14:02:44 -07:00
Michael Hobbs
0d838d1248 split up unit-tests and use 4 containers (they're free) 2015-04-24 13:52:14 -07:00
Michael Hobbs
3d2af158ff allow docker-options over ssh. plus test. closes #1135 2015-04-24 12:10:02 -07:00
Michael Hobbs
673d43b532 output containers to be stopped and killed. attempt a kill on old containers after we attempt to stop them 2015-04-24 11:32:14 -07:00
Michael Hobbs
290745d324 only validate and restart nginx if we're deployed. use REGEX when handling SSL and NON-SSL hosts 2015-04-24 11:31:27 -07:00
Michael Hobbs
a18fa7afbe we only need the first container here 2015-04-24 11:30:20 -07:00
Michael Hobbs
e9663caf5c updated dokku ls output with container status 2015-04-24 10:49:18 -07:00
Andreas Litt
5968e81b17 exec git-receive-pack with correct path 2015-04-23 15:17:25 +02:00
Andreas Litt
3aa5231f7e remove leading '/' from APP-Name. 2015-04-23 15:04:42 +02:00
Jose Diaz-Gonzalez
3c056527e8 Merge pull request #1140 from NigelThorne/patch-1
Replaced reference to gitreceive with sshcommand as per #746
2015-04-22 19:42:32 -04:00
Nigel Thorne
0fe3d92fd7 Replaced gitreceive with sshcommand as per #746 2015-04-23 09:37:50 +10:00
Jose Diaz-Gonzalez
2b8ea890ad Merge pull request #1138 from chrisbutcher/patch-1
Include tip about using sshcommand acl-add
2015-04-22 18:59:23 -04:00
christopher butcher
9242a5dd31 Include tip about using sshcommand acl-add 2015-04-22 18:05:09 -04:00
Jose Diaz-Gonzalez
d960b9c246 Merge pull request #1137 from YellowApple/patch-1
Safer installation method
2015-04-22 14:48:45 -04:00
Ryan S. Northrup
9f7a33ca3e Safer installation method
Piping the output of `curl` or `wget -O-` to a shell is a very bad idea for multiple reasons; security concerns aside, doing so provides no opportunity for the script's download to finish before execution starts, so if the download is interrupted for some reason (perhaps because of an intermittent network failure), the incompletely-downloaded script will still run with potentially disastrous results.  See [here](http://www.seancassidy.me/dont-pipe-to-your-shell.html) for a more in-depth description.
2015-04-22 11:40:27 -07:00
Michael Hobbs
39dd4fc700 fix typo in output 2015-04-21 23:22:08 -07:00
Michael Hobbs
1fa19591bf sort correctly 2015-04-21 23:14:22 -07:00
Michael Hobbs
7c1ef003b7 set DYNO env var based on proc type 2015-04-21 23:13:47 -07:00
Michael Hobbs
e1f8654a74 attempt to stop containers instead of just killing 2015-04-21 22:21:47 -07:00
Michael Hobbs
c2fa8d14c9 scale web to 1 by default and ignore all others 2015-04-21 22:13:45 -07:00
Michael Hobbs
eb0935a691 make dokku ls pretty 2015-04-21 22:02:21 -07:00
Michael Hobbs
9d504fe93a make sure we cleanup tmp. logging when we hit edge cases 2015-04-21 21:36:03 -07:00
Michael Hobbs
e74c6460fb make semantic sense of _image functions 2015-04-21 20:27:16 -07:00
Michael Hobbs
2cb957d1dd move release_and_deploy to plugin functions. only attempt Procfile copy if we're buildstep based 2015-04-21 20:21:25 -07:00
Michael Hobbs
807e1b97b4 [ci skip] scaling docs 2015-04-21 14:33:28 -07:00
Michael Hobbs
33258663f4 uncomment my accidental comment out 2015-04-21 14:33:28 -07:00
Michael Hobbs
3361a20a30 only check containers running proc named web for now 2015-04-21 14:33:28 -07:00
Michael Hobbs
979c1155c2 add process with no listener 2015-04-21 14:33:28 -07:00
Michael Hobbs
4ae7af091a don't clobber oids when multiple proc types exist 2015-04-21 14:33:28 -07:00
Michael Hobbs
7348d7790c test scaling different proc types 2015-04-21 14:33:28 -07:00
Michael Hobbs
715921c60e comment out skipped test to save time 2015-04-21 14:33:28 -07:00
Michael Hobbs
636e139e4a only balance web containers 2015-04-21 14:33:28 -07:00
Michael Hobbs
ddf893bc8a fix rebuildall and restartall 2015-04-21 14:33:28 -07:00
Michael Hobbs
9a704bc656 use test in both cases 2015-04-21 14:33:28 -07:00
Michael Hobbs
d44788721f format multiple scale lines 2015-04-21 14:32:31 -07:00
Michael Hobbs
d88efd5cc4 no need to find beyond a depth of 1. also bombs when the app cache dir is owned by the container user 2015-04-21 14:32:31 -07:00
Michael Hobbs
930987ad02 container/ip/port file cleanup when scaling down. more tests 2015-04-21 14:32:31 -07:00
Michael Hobbs
14cc01dd5b use helper functions 2015-04-21 14:32:31 -07:00
Michael Hobbs
bbc03dbfdd helper functions 2015-04-21 14:32:30 -07:00
Michael Hobbs
d5cc7595fd default web proc. avoid unclear file not found error when procfile is missing 2015-04-21 14:32:30 -07:00
Michael Hobbs
435f7e69eb only attempt copy if image exists 2015-04-21 14:32:30 -07:00
Michael Hobbs
0f8be7c946 fix missing tmpdir prefix 2015-04-21 14:32:30 -07:00
Michael Hobbs
d42bb79d38 handle non-herokuish deploys that don't create Procfiles. i.e. buildpack-nginx 2015-04-21 14:32:30 -07:00
Michael Hobbs
389b5efa06 only release and deploy if we're modifying scale settings 2015-04-21 14:32:30 -07:00
Michael Hobbs
5c85e8bf65 app repo SCALE file takes precedence over local settings 2015-04-21 14:32:30 -07:00
Michael Hobbs
99d2601f2f fix tests 2015-04-21 14:32:30 -07:00
Michael Hobbs
e27d0e6fa5 wrap container id checks and reading into common function that attempts new and old style container id files
aggregate log streams
2015-04-21 14:32:30 -07:00
Michael Hobbs
33f872183e initial pass at container-level scaling 2015-04-21 14:27:23 -07:00
Jose Diaz-Gonzalez
4d7671dee3 Merge pull request #1129 from progrium/validate-nginx
Validate nginx configuration before restarting nginx
2015-04-21 15:49:35 -04:00
Michael Hobbs
f55e047619 negative test for validate_nginx 2015-04-21 11:53:00 -07:00
Michael Hobbs
661b6706de fix verify_app_name to bomb on null app. use it in nginx:build-config 2015-04-21 10:58:11 -07:00
Jose Diaz-Gonzalez
a8f08bd5a8 [ci skip] Add documentation for custom nginx.conf files
Closes #998
Closes #1000
2015-04-21 02:39:05 -04:00
Jose Diaz-Gonzalez
b299f66c28 Validate nginx configuration before reloading nginx. Closes #999 2015-04-21 02:07:27 -04:00
Jose Diaz-Gonzalez
b5495ed0c3 use helper functions instead of echo command 2015-04-21 01:14:10 -04:00
Jose Diaz-Gonzalez
99c9bb2863 Merge pull request #1121 from progrium/josegonzalez-motd
Prompt users to run the web installer via MOTD. Closes #943
2015-04-19 16:55:22 -04:00
Jose Diaz-Gonzalez
d6aa8d59f1 [ci skip] ensure users run dokku-installer as sudo user 2015-04-19 16:55:08 -04:00
Jose Diaz-Gonzalez
d9d3a16e5c Prompt users to run the web installer via MOTD. Closes #943 2015-04-18 03:56:19 -04:00
Jose Diaz-Gonzalez
5105c4f71d Merge pull request #1058 from progrium/packaging
Packaging
2015-04-18 03:30:51 -04:00
Jose Diaz-Gonzalez
23a6656566 [ci skip] ensure we run apt-get update at least once before installing git 2015-04-18 03:23:30 -04:00
Jose Diaz-Gonzalez
a2ed0ef2b6 [ci skip] fix listing issues in bootstrap.sh 2015-04-18 03:23:12 -04:00
Jose Diaz-Gonzalez
e2d3107e8a [ci skip] add raw debian package installation notes 2015-04-18 02:58:34 -04:00
Jose Diaz-Gonzalez
0e5bc10ae7 [ci skip] update advanced installation docs for development 2015-04-18 02:54:32 -04:00
Jose Diaz-Gonzalez
b3053fe392 [ci skip] update upgrade documentation for 0.3.18 2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
12ee6953bb [ci skip] modify bootstrap script to handle installing from a deb package
For branch-based installs, or anything specifying tags below 0.3.13, we install from source.
2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
9dfa7ccee6 [ci skip] Ensure the /root/.ssh directory exists before copying the user's public key into the vm 2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
45e53d3d9d [ci skip] Remove extra install calls 2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
ea7e3dc61d [ci skip] Switch vagrant box to chef/ubuntu-14.04
The current ubuntu cloud image has a bug where networking appears to stall intermittently, making it difficult to interact with the vm
2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
50fe9e39ad [ci skip] Ensure we run apt-get update when installing docker
On certain operating systems, this may not be called if invoking `make install` directly
2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
9312a99664 [ci skip] Install gcc when running make deb-setup 2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
d8f69746bb [ci skip] Ensure man-db is installed as a dependency 2015-04-18 02:48:52 -04:00
Jose Diaz-Gonzalez
e45db108d8 Merge pull request #1120 from progrium/josegonzalez-irc-shield
Add freenode shield to readme
2015-04-18 02:24:52 -04:00
Jose Diaz-Gonzalez
845c7e7dea Merge pull request #1119 from joshco/feature/zerodt-docs
Logging info suggesting tuned CHECKS
2015-04-18 01:40:10 -04:00
Josh Cohen
e33d17b7dd updated text from @savant 2015-04-18 05:38:23 +00:00
Jose Diaz-Gonzalez
96c6d46dd1 Add freenode shield to readme 2015-04-18 01:03:25 -04:00
Josh Cohen
30f9ab740d Logging info suggesting tuned CHECKS 2015-04-17 23:25:43 +00:00
Jose Diaz-Gonzalez
5224a6c678 Merge pull request #1111 from 3onyc/bug-pre-build-dockerfile-hook
Call pre-build-dockerfile before docker build
2015-04-14 16:01:06 -04:00
3onyc
bc8750ebe3 Call pre-build-dockerfile before docker build 2015-04-14 20:46:19 +02:00
73 changed files with 1347 additions and 484 deletions

View File

@@ -1,6 +1,7 @@
# If you're submitting a patch, please add your name here in alphabetical order as part of the patch.
# This file lists all individuals having contributed content to the repository.
#
3onyc <3onyc@x3tech.com>
Alexander <iam.asm89@gmail.com>
Alexander Beletsky <alexander.beletsky@gmail.com>
Alexis Gavoty <kload@kload.fr>

View File

@@ -1,5 +1,82 @@
# History
## 0.3.20
This release pegs Dokku to Docker 1.6.2. Docker 1.7.0 introduced changes in `docker ps` which cause incompatibilities with many popular dokku plugins.
### New Features
- #1245: @arthurschreiber Support config variables containing `\n`
- #1257: @josegonzalez Split nginx ssl logs by $APP
### Bug Fixes
- #1207: @rockymadden Fixed bug with client commands taking verb, appname, and also arguments.
- #1251: @josegonzalez Fallback to using /etc/init.d/nginx reload directly to restart nginx
- #1264: @josegonzalez Require lxc-docker-1.6.2
### Docs Changes
- #1252: @josegonzalez Fix ssh port for vagrant installation. Closes #1139. [ci skip]
- #1250: @josegonzalez SSL documentation is misleading
## 0.3.19
### New Features
- #1118: @michaelhobbs Heroku-style Container-Level scaling
- #1210: @cddr Split nginx logs out by $APP
- #1232: @michaelhobbs Allow passing of docker build options and document dockerfile deployment. Closes #1231
### Bug Fixes
- #1179: @follmann Prevent dismissal of URLs in CHECKS file that contain query params
- #1193: @michaelhobbs Handle docker opts over ssh without escaping quotes. closes #1187
- #1198: @3onyc Check web_config before key_file (Fixes #1196)
- #1200: @josegonzalez Fix lintball from #1198
- #1202: @michaelhobbs Filter out literal wildcard when deploying an unrelated domain. Closes #1185
- #1204: @3onyc Fix bootstrap.sh, install curl when it's missing, make curl follow redirects, don't suppress stderr
- #1206: @rockymadden Handle for installs in /usr/local/bin and the like.
- #1212: @michaelhobbs Let circleci dictate docker install (fixes master)
- #1217: @kirushanth-sakthivetpillai Fix broken ssl wildcard redirect
- #1227: @Flink Use --no-cache when building Dockerfile
- #1246: @josegonzalez Ensure we call apt-get before installing packages
### Docs Changes
- #1168: @cjblomqvist [docs] Update git-rev plugin to point to maintained version
- #1180: @sherbondy [docs] Clarify usage around official dokku `docker-options` plugin
- #1192: @alessio [docs] Add reference to dokku-events plugin
- #1218: @michaelhobbs [docs] add dokku-logspout plugin
- #1224: @lmars [docs] Add link from plugin-creation to pluginhooks
- #1237: @zyegfryed [docs] Typo (at at -> at)
## 0.3.18
- #1111: @michaelhobbs Call pre-build-dockerfile before docker build
- #1119: @joshco Logging info suggesting tuned CHECKS
- #1120: @josegonzalez [docs] Add freenode shield to readme
- #1121: @josegonzalez Prompt users to run the web installer via MOTD. Closes #943
- #1129: @josegonzalez Validate nginx configuration before restarting nginx
- #1137: @YellowApple [docs] Safer installation method
- #1138: @chrisbutcher [docs] Include tip about using sshcommand acl-add
- #1140: @NigelThorne [docs] Replaced reference to gitreceive with sshcommand as per #746
- #1144: @protonet Allow git-remote with different port
- #1145: @michaelhobbs allow docker-options over ssh. plus test. closes #1135
- #1146: @michaelhobbs Don't re-deploy on domains:add. allow multple domains on command line. Closes #1142
- #1147: @michaelhobbs Utilize all 4 free CircleCI containers
- #1148: @TheEmpty [docs] Add information about 444 for nginx in default_sever.
- #1150: @cjblomqvist [docs] Add monit plugin
- #1151: @LTe Do not kill docker container with SIGKILL
- #1153: @econya [docs] Add README-section: how to contribute
- #1058: @josegonzalez Move bootstrap script to use debian package where possible
- #1171: @josegonzalez Use debconf for package configuration
- #1172: @michaelhobbs unify default and custom nginx template processing
- #1173: @josegonzalez [docs] standardize readme badges
- #1178: @jagandecapri [docs] Update plugins.md
- #1189: @vincentfretin wait 30 seconds and not 30 minutes
- #1190: @josegonzalez Fix docker gpg key installation
## 0.3.17
- #1056: @joshco New check retries feature

View File

@@ -14,7 +14,7 @@ ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
$(eval $(RUN_ARGS):;@:)
endif
.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
.PHONY: all apt-update install copyfiles man-db version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
include tests.mk
include deb.mk
@@ -61,12 +61,18 @@ plugin-dependencies: pluginhook
plugins: pluginhook docker
dokku plugins-install
dependencies: sshcommand pluginhook docker help2man
dependencies: apt-update sshcommand pluginhook docker help2man man-db
$(MAKE) -e stack
apt-update:
apt-get update
help2man:
apt-get install -qq -y help2man
man-db:
apt-get install -qq -y man-db
sshcommand:
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
chmod +x /usr/local/bin/sshcommand
@@ -80,15 +86,17 @@ docker: aufs
apt-get install -qq -y curl
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
curl --silent https://get.docker.com/gpg | apt-key add -
ifndef CI
curl -sSL 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
apt-get install -qq -y lxc-docker-${DOCKER_VERSION}
else
apt-get install -qq -y lxc-docker
apt-get install -qq -y lxc-docker-1.6.2
endif
sleep 2 # give docker a moment i guess
endif
aufs:
ifndef CI

View File

@@ -1,4 +1,4 @@
# Dokku [![Build Status](https://circleci.com/gh/progrium/dokku/tree/master.svg?style=svg&circle-token=eec5b442dda53a4d229911dd97d4214853acc262 "Build Status")](https://circleci.com/gh/progrium/dokku/tree/master) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku)
# Dokku [![Build Status](https://img.shields.io/circleci/project/progrium/dokku.svg "Build Status")](https://circleci.com/gh/progrium/dokku/tree/master) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) [![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) [![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg "Viewdocs")](http://progrium.viewdocs.io/dokku/index)
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
@@ -8,9 +8,10 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
## Installing
To install the latest stable release, you can run the following command as a user that has access to `sudo`:
To install the latest stable release, you can run the following commands as a user that has access to `sudo`:
wget -qO- https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh | sudo DOKKU_TAG=v0.3.17 bash
wget https://raw.github.com/progrium/dokku/v0.3.20/bootstrap.sh
sudo DOKKU_TAG=v0.3.20 bash bootstrap.sh
### Upgrading
@@ -24,6 +25,12 @@ Full documentation - including advanced installation docs - are available online
You can use [Github Issues](https://github.com/progrium/dokku/issues), check [Troubleshooting](http://progrium.viewdocs.io/dokku/troubleshooting) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku)
## Contribution
After checking [Github Issues](https://github.com/progrium/dokku/issues), the [Troubleshooting Guide](http://progrium.viewdocs.io/dokku/troubleshooting) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request.
While we may not merge your PR as is, they serve to start conversations and improve the general dokku experience for all users.
## Sponsors
Dokku is currently sponsored by the enterprise grade, multi-host PaaS project [Deis](http://deis.io/).

12
Vagrantfile vendored
View File

@@ -1,8 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX_NAME = ENV["BOX_NAME"] || "trusty"
BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
BOX_NAME = ENV["BOX_NAME"] || "chef/ubuntu-14.04"
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
@@ -19,7 +18,6 @@ Vagrant::configure("2") do |config|
config.ssh.forward_agent = true
config.vm.box = BOX_NAME
config.vm.box_url = BOX_URI
config.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
config.vm.provider :virtualbox do |vb|
@@ -36,24 +34,24 @@ Vagrant::configure("2") do |config|
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
end
config.vm.define "dokku-deb", autostart: false do |vm|
vm.vm.network :forwarded_port, guest: 80, host: ENV['FORWARDED_PORT']
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
end
config.vm.define "build", autostart: false do |vm|
vm.vm.provision :shell, :inline => "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "apt-get update > /dev/null && DEBIAN_FRONTEND=noninteractive 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 -f /root/.ssh/authorized_keys && cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && mkdir -p /root/.ssh && sudo cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
end
end

View File

@@ -1,37 +1,70 @@
#!/usr/bin/env bash
#!/bin/bash
#
# A script to bootstrap dokku.
# It expects to be run on Ubuntu 14.04 via 'sudo'
# If installing a tag higher than 0.3.13, it may install dokku via a package (so long as the package is higher than 0.3.13)
# It checks out the dokku source code from Github into ~/dokku and then runs 'make install' from dokku source.
set -eo pipefail
export DEBIAN_FRONTEND=noninteractive
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"}
if ! command -v apt-get &>/dev/null
then
if ! command -v apt-get &>/dev/null; then
echo "This installation script requires apt-get. For manual installation instructions, consult http://progrium.viewdocs.io/dokku/advanced-installation ."
exit 1
fi
apt-get update
apt-get install -qq -y git make curl software-properties-common man-db help2man
which curl > /dev/null || apt-get install -qq -y curl
[[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties
cd ~
test -d dokku || git clone $DOKKU_REPO
cd dokku
git fetch origin
dokku_install_source() {
apt-get install -qq -y git make software-properties-common
cd /root
if [ ! -d /root/dokku ]; then
git clone $DOKKU_REPO /root/dokku
fi
cd /root/dokku
git fetch origin
git checkout $DOKKU_CHECKOUT
make install
}
dokku_install_package() {
curl -sSL https://get.docker.io/gpg | apt-key add -
curl -sSL https://packagecloud.io/gpg.key | apt-key add -
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
sudo apt-get update > /dev/null
sudo apt-get install -qq -y "linux-image-extra-$(uname -r)" apt-transport-https
if [[ -n $DOKKU_CHECKOUT ]]; then
sudo apt-get install -qq -y dokku=$DOKKU_CHECKOUT
else
sudo apt-get install -qq -y dokku
fi
}
if [[ -n $DOKKU_BRANCH ]]; then
git checkout origin/$DOKKU_BRANCH
export DOKKU_CHECKOUT="origin/$DOKKU_BRANCH"
dokku_install_source
elif [[ -n $DOKKU_TAG ]]; then
git checkout $DOKKU_TAG
export DOKKU_SEMVER="${DOKKU_TAG//v}"
major=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[1]}')
minor=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[2]}')
patch=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[3]}')
# 0.3.13 was the first version with a debian package
if [[ "$major" -eq "0" ]] && [[ "$minor" -lt "4" ]] && [[ "$patch" -lt "13" ]]; then
export DOKKU_CHECKOUT="$DOKKU_TAG"
dokku_install_source
else
export DOKKU_CHECKOUT="$DOKKU_SEMVER"
dokku_install_package
fi
else
dokku_install_package
fi
make install
echo
echo "Almost done! For next steps on configuration:"
echo " http://progrium.viewdocs.io/dokku/advanced-installation#user-content-configuring"

View File

@@ -5,19 +5,9 @@ dependencies:
cache_directories:
- "~/docker"
override:
# need to add the dokku user to the docker group
- sudo -E CI=true make -e sshcommand
- sudo usermod -G docker dokku
- sudo -E CI=true DOCKER_VERSION=1.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/
- sudo chown -R root:root ~root/.ssh/
- sudo sed -e 's:/home/ubuntu:/root:g' ~root/.ssh/config
####
- sudo -E make -e setup-deploy-tests
- ./tests/ci/parallel_runner.sh setup: { timeout: 300 }
post:
- sudo -E make -e lint
test:
override:
- ./tests/ci/parallel_runner.sh: { parallel: true, timeout: 1800 }
- ./tests/ci/parallel_runner.sh testing: { parallel: true, timeout: 1800 }

View File

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

@@ -102,6 +102,11 @@ if [[ ! -z $DOKKU_HOST ]]; then
if [[ ! "$1" =~ --* ]]; then
verb=$1
shift
if [[ "$1" == "$appname" ]]; then
shift
fi
args="$*"
else
long_args="--"
@@ -119,7 +124,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
ssh -t "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}"
}
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]]; then
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then
_dokku "$@"
exit $?
fi

View File

@@ -137,10 +137,10 @@ 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
curl -sSL 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
curl -sSL 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

7
deb.mk
View File

@@ -31,10 +31,10 @@ GOPATH = /home/vagrant/gocode
install-from-deb:
echo "--> Initial apt-get update"
sudo apt-get update > /dev/null
sudo apt-get install -y apt-transport-https
sudo apt-get install -y apt-transport-https curl
echo "--> Installing docker gpg key"
curl --silent https://get.docker.com/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
curl -sSL https://get.docker.com/gpg | apt-key add -
echo "--> Installing dokku gpg key"
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
@@ -61,7 +61,7 @@ deb-all: deb-buildstep deb-dokku deb-gems deb-pluginhook deb-sshcommand
deb-setup:
echo "-> Updating deb repository and installing build requirements"
sudo apt-get update > /dev/null
sudo apt-get install -qq -y git ruby1.9.1-dev 2>&1 > /dev/null
sudo apt-get install -qq -y gcc git ruby1.9.1-dev 2>&1 > /dev/null
command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
ssh -o StrictHostKeyChecking=no git@github.com || true
@@ -138,6 +138,7 @@ deb-pluginhook: deb-setup
echo "-> Copying files into place"
mkdir -p /tmp/build/usr/local/bin $(GOPATH)
sudo apt-get update > /dev/null
sudo apt-get install -qq -y git golang mercurial 2>&1 > /dev/null
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && go get "code.google.com/p/go.crypto/ssh/terminal"
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/pluginhook && go build -o pluginhook

21
debian/config vendored Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh -e
. /usr/share/debconf/confmodule
readonly ACTION="${1:-configure}"
readonly VERSION="${2:-dev}"
db_input "high" "dokku/web_config" || true
db_go || true
db_get "dokku/web_config"
if [ $RET = "true" ]; then
exit 0
fi
db_input "high" "dokku/hostname" || true
db_input "high" "dokku/vhost_enable" || true
if [ "$ACTION" != "reconfigure" ]; then
db_input "high" "dokku/key_file" || true
fi
db_go || true

2
debian/control vendored
View File

@@ -3,7 +3,7 @@ Version: 0.3.12
Section: base
Priority: optional
Architecture: amd64
Depends: locales, git, make, curl, software-properties-common, lxc-docker (>= 1.4.0), gcc, python-software-properties, man-db, buildstep, sshcommand, pluginhook
Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, 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, apparmor, cgroup-lite
Provides: dokku
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>

25
debian/postinst vendored
View File

@@ -1,6 +1,10 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
case "$1" in
abort-upgrade|abort-remove|abort-deconfigure)
;;
@@ -19,6 +23,27 @@ case "$1" in
if [ -f /etc/init/dokku-installer.conf ] && service dokku-installer status 2> /dev/null | grep waiting; then
sudo service dokku-installer start
fi
db_get "dokku/web_config"
if [ "$RET" = "true" ]; then
exit 0
fi
db_get "dokku/vhost_enable"
if [ "$RET" = "true" ]; then
db_get "dokku/hostname"
echo "$RET" > "${DOKKU_ROOT}/VHOST"
else
rm -f "${DOKKU_ROOT}/VHOST"
fi
db_get "dokku/hostname"
echo "$RET" > "${DOKKU_ROOT}/HOSTNAME"
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
db_get "dokku/key_file"
sshcommand acl-add dokku default < "$RET"
fi
;;
*)

53
debian/preinst vendored
View File

@@ -1,28 +1,47 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
case "$1" in
install)
INIT_CONF="/etc/init/dokku-installer.conf"
NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf"
db_get "dokku/web_config"
if [ "$RET" = "true" ]; then
INIT_CONF="/etc/init/dokku-installer.conf"
NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf"
rm -f $INIT_CONF
touch $INIT_CONF
echo 'start on runlevel [2345]' >> $INIT_CONF
echo 'exec /usr/local/share/dokku/contrib/dokku-installer.rb selfdestruct' >> $INIT_CONF
rm -f $INIT_CONF
touch $INIT_CONF
echo 'start on runlevel [2345]' >> $INIT_CONF
echo 'exec /usr/local/share/dokku/contrib/dokku-installer.rb selfdestruct' >> $INIT_CONF
rm -f $NGINX_CONF
touch $NGINX_CONF
echo 'upstream dokku-installer { server 127.0.0.1:2000; }' >> $NGINX_CONF
echo 'server {' >> $NGINX_CONF
echo ' listen 80;' >> $NGINX_CONF
echo ' location / {' >> $NGINX_CONF
echo ' proxy_pass http://dokku-installer;' >> $NGINX_CONF
echo ' }' >> $NGINX_CONF
echo '}' >> $NGINX_CONF
rm -f $NGINX_CONF
touch $NGINX_CONF
rm -f /etc/nginx/sites-enabled/*
service nginx reload
{
echo 'upstream dokku-installer { server 127.0.0.1:2000; }'
echo 'server {'
echo ' listen 80;'
echo ' location / {'
echo ' proxy_pass http://dokku-installer;'
echo ' }'
echo '}'
} >> $NGINX_CONF
rm -f /etc/nginx/sites-enabled/*
service nginx reload || /etc/init.d/nginx reload
exit 0
fi
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
db_get "dokku/key_file"
if [ ! -f "$RET" ]; then
echo "Error: keyfile '$RET' not found."
echo " you can enter a new keyfile path when you restart the installation."
db_reset "dokku/key_file"
exit 1
fi
fi
;;
upgrade)

19
debian/templates vendored Normal file
View File

@@ -0,0 +1,19 @@
Template: dokku/web_config
Description: Use the web-based config page?
Type: boolean
Default: true
Template: dokku/vhost_enable
Description: Use vhost based deployments?
Type: boolean
Default: false
Template: dokku/hostname
Description: Machine's hostname or IP
Type: string
Default: dokku.me
Template: dokku/key_file
Description: Keyfile for initial user
Type: string
Default: /root/.ssh/id_rsa.pub

View File

@@ -3,7 +3,7 @@
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
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash
```
## Development
@@ -19,7 +19,7 @@ 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/gitreceive make install
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
```
## Bootstrap a server from your own repository
@@ -29,7 +29,7 @@ The bootstrap script allows the dokku repository URL to be overridden to bootstr
```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
sudo DOKKU_REPO=https://github.com/yourusername/dokku.git DOKKU_BRANCH=master ./bootstrap.sh
```
## Custom buildstep build

View File

@@ -28,6 +28,14 @@ Dokku only supports deploying from its master branch, so if you'd like to deploy
Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)!
Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root.
## Deploying to server over SSH
Pushing to the dokku remote may prompt you to input a password for the dokku user. It's preferable, however, to use key-based authentication, and you can add your public key to the dokku user's authorized_keys file with:
```
cat ~/.ssh/id_rsa.pub | ssh [sudouser]@[yourdomain].com "sudo sshcommand acl-add dokku [description]"
```
## Deploying with private git submodules
Dokku uses git locally (i.e. not a docker image) to build its own copy of your app repo, including submodules. This is done as the `dokku` user. Therefore, in order to deploy private git submodules, you'll need to drop your deploy key in `~dokku/.ssh` and potentially add github.com (or your VCS host key) into `~dokku/.ssh/known_hosts`. A decent test like this should help confirm you've done it correctly.
@@ -42,6 +50,14 @@ ssh -T git@github.com
If buildpack detection isn't working well for you or you want to specify a custom buildpack for one repository you can create & commit a file in the root of your git repository named `.env` containing `export BUILDPACK_URL=<repository>` before pushing. This will tell buildstep to fetch the specified buildpack and use it instead of relying on the built-in buildpacks & their detection methods.
## Dockerfile deployment
Deployment of `Dockerfile` repos is supported as of v0.3.15. Simply place a Dockerfile in the root of your repo and push to dokku. If you are converting from a heroku/dokku buildpack deployment, ensure you are not setting `$BUILDPACK_URL` or including a `.buildpacks` file in the root of your repo.
By default, we will extract the first `EXPOSE` port and tell nginx to proxy your app to that port. Alternatively, you can set `$DOCKERFILE_PORT` in your app's dokku configuration.
Setting `$DOKKU_DOCKERFILE_CACHE_BUILD` to `true` or `false` will enable or disable docker's image layer cache. Lastly, for more granular build control, you may also pass any `docker build` option to `docker`, by setting `$DOKKU_DOCKER_BUILD_OPTS`.
## Default vhost
You might notice the default vhost for Nginx will be one of the apps. If an app doesn't exist, it will use this vhost and it may be confusing for it to go to another app. You can create a default vhost using a configuration under `sites-enabled`. You just have to change one thing in the main nginx.conf:

View File

@@ -20,7 +20,7 @@ that include the hostname, for example:
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.
and timeout each check to 30 seconds.
By default, checks will be attempted 5 times. (Retried 4 times)

View File

@@ -11,6 +11,6 @@ config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] - set one or more config vars
config:unset <app> KEY1 [KEY2 ...] - unset one or more config vars
```
The variables are available both at at run time and during the application build/compilation step. You no longer need a `user-env` plugin as Dokku handles this functionality in a way equivalent to how Heroku handles it.
The variables are available both at run time and during the application build/compilation step. You no longer need a `user-env` plugin as Dokku handles this functionality in a way equivalent to how Heroku handles it.
> Note: Global `BUILD_ENV` files are currently migrated into a global `ENV` file and sourced before app-specific variables. This means that app-specific variables will take precedence over global variables. Configuring your global `ENV` file is manual, and should be considered potentially dangerous as configuration applies to all applications.

View File

@@ -3,9 +3,10 @@
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
2. Check out the [list of hooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) your plugin can implement.
3. Upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it.
5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
### Sample plugin

View File

@@ -14,45 +14,53 @@ $ dokku help
...
````
Add some options
Add some options (first, for the deployed/running app and second when executing `dokku run`)
```bash
$ dokku docker-options:add myapp deploy "-v /host/path:/container/path"
$ dokku docker-options:add myapp run "-v /another/container/path"
$ dokku docker-options:add myapp "-link container_name:alias"
```
Check what we added
```bash
$ dokku docker-options myapp
-link container_name:alias
-v /host/path:/container/path
-v /another/container/path
Deploy options:
-v /host/path:/container/path
Run options:
-v /another/container/path
```
Remove an option
```bash
$ dokku docker-options:remove myapp "-link container_name:alias"
$ dokku docker-options:remove myapp run "--link container_name:alias"
```
Note about `dokku` phases and `docker-options`
------------
`dokku` deploys your application in multiple "phases" and the `docker-options` plugin allows you to pass arguments to the underlying docker container in the following 3 phases/containers
- `build`: the container that executes the appropriate buildpack
- `deploy`: the container that executes your running/deployed application
- `run`: the container that executes any arbitrary command via `dokku run myapp`
Advanced Usage (avoid if possible)
------------
In your applications folder (/home/dokku/app_name) create a file called DOCKER_OPTIONS.
In your applications folder (`/home/dokku/app_name`) create a file called `DOCKER_OPTIONS_RUN` (or `DOCKER_OPTIONS_BUILD` or `DOCKER_OPTIONS_DEPLOY`).
Inside this file list one docker option per line. For example:
```bash
-link container_name:alias
--link container_name:alias
-v /host/path:/container/path
-v /another/container/path
```
The above example will result in the following options being passed to docker during deploy and docker run:
The above example will result in the following options being passed to docker during `dokku run`:
```bash
-link container_name:alias -v /host/path:/container/path -v /another/container/path
--link container_name:alias -v /host/path:/container/path -v /another/container/path
```
You may also include comments (lines beginning with a #) and blank lines in the DOCKER_OPTIONS file.

View File

@@ -0,0 +1,36 @@
# Debian Package Installation Notes
As of 0.3.18, dokku defaults to being installed via debian package. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script:
```shell
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
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
sudo apt-get update > /dev/null
sudo apt-get install -qq -y linux-image-extra-`uname -r` apt-transport-https
sudo apt-get install -qq -y dokku
```
## Unattended installation
In case you want to perform an unattended installation of dokku, this is made possible through [debconf](https://en.wikipedia.org/wiki/Debconf_%28software_package%29), which allows you to configure a package before installing it.
You can set any of the below options through the `debconf-set-selections` command, for example to enable vhost-based deployments:
```bash
echo "dokku dokku/vhost_enable boolean true" | debconf-set-selections
```
After setting the desired options, proceed with the installation as described above.
### debconf options
| Name | Type | Default | Description |
| ------------------ | ------- | --------------------- | ------------------------------------------------------------------------ |
| dokku/web_config | boolean | true | Use web-based config for below options |
| dokku/vhost_enable | boolean | false | Use vhost-based deployments (e.g. <app>.dokku.me) |
| dokku/hostname | string | dokku.me | Hostname, used as vhost domain and for showing app URL after deploy |
| dokku/key_file | string | /root/.ssh/id_rsa.pub | SSH key to add to the Dokku user (Will be ignored on `dpkg-reconfigure`) |

View File

@@ -30,7 +30,7 @@
```
Host dokku.me
Port 2222
Port 22
```
- 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.

View File

@@ -11,13 +11,9 @@ 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
# This may need to be run twice
wget -qO- https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh | sudo DOKKU_TAG=v0.3.17 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
# installs dokku via apt-get
wget https://raw.github.com/progrium/dokku/v0.3.20/bootstrap.sh
sudo DOKKU_TAG=v0.3.20 bash bootstrap.sh
# Go to your server's IP and follow the web installer
```
@@ -29,5 +25,6 @@ For various reasons, certain hosting providers may have other steps that should
As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started:
- [Debian Package Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/debian)
- [Vagrant Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/vagrant)
- [Advanced Install Customization](http://progrium.viewdocs.io/dokku/advanced-installation)

View File

@@ -1,6 +1,6 @@
# Nginx
Dokku uses nginx as it's server for routing requests to specific applications.
Dokku uses nginx as it's server for routing requests to specific applications. By default, access and error logs are written for each app to `/var/log/nginx/${APP}-access.log` and `/var/log/nginx/${APP}-error.log` respectively
## TLS/SPDY support
@@ -8,9 +8,18 @@ Dokku provides easy TLS/SPDY support out of the box. This can be done app-by-app
### Per App
To enable TLS connection to to one of your applications, copy or symlink the `.crt` and `.key` files into the application's `/home/dokku/:app/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively.
To enable TLS connections to to one of your applications, do the following:
* Create a key file and a cert file.
* You can find detailed steps for generating a self-signed certificate at https://devcenter.heroku.com/articles/ssl-certificate-self
* If you are not paranoid and need it just for a DEV or STAGING app, you can use http://www.selfsignedcertificate.com/ to generate your 2 files more easily.
* Rename your files to server.key and server.crt
* tar these 2 files together, *without* subdirectories. Example: tar cvf cert-key.tar server.crt server.key
* Install the pair for your app, like this: ssh dokku@ip-of-your-dokku-server nginx:import-ssl < cert-key.tar
You will need to repeat the steps above for each domain used to serve your app. You can't simply create
a single tar with all key/cert files in it (see https://github.com/progrium/dokku/issues/1195).
Redeployment of the application will be needed to apply TLS configuration. Once it is redeployed, the application will be accessible by `https://` (redirection from `http://` is applied as well).
### All Subdomains
@@ -56,6 +65,8 @@ server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
access_log /var/log/nginx/${APP}-access.log;
error_log /var/log/nginx/${APP}-error.log;
# set a custom header for requests
add_header X-Served-By www-ec2-01;
@@ -77,6 +88,12 @@ server {
The above is a sample http configuration that adds an `X-Served-By` header to requests. The template file **must** be owned by the user `dokku:dokku`.
A few tips for custom nginx templates:
- Special characters - dollar signs, spaces inside of quotes, etc. - should be escaped with a single backslash or can cause deploy failures.
- Templated files will be validated via `nginx -t`.
- Application environment variables can be used within your nginx configuration.
## Customizing hostnames
Applications typically have the following structure for their hostname:
@@ -161,7 +178,7 @@ d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a mi
# Default site
By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to nginx. This will catch all unknown HOST header values and return a `410 Gone` response.
By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to nginx. This will catch all unknown HOST header values and return a `410 Gone` response. You can replace the `return 410;` with `return 444;` which will cause nginx to not respond to requests that do not match known domains (connection refused).
```
server {

View File

@@ -29,6 +29,7 @@ Note: The following plugins have been supplied by our community and may not have
[agco-adm]: https://github.com/agco-adm
[ademuk]: https://github.com/ademuk
[alessio]: https://github.com/alessio
[alex-sherwin]: https://github.com/alex-sherwin
[alexanderbeletsky]: https://github.com/alexanderbeletsky
[Aomitayo]: https://github.com/Aomitayo
@@ -37,6 +38,7 @@ Note: The following plugins have been supplied by our community and may not have
[cameron-martin]: https://github.com/cameron-martin
[cedricziel]: https://github.com/cedricziel
[cef]: https://github.com/cef
[cjblomqvist]: https://github.com/cjblomqvist
[darkpixel]: https://github.com/darkpixel
[dyson]: https://github.com/dyson
[F4-Group]: https://github.com/F4-Group
@@ -79,6 +81,7 @@ Note: The following plugins have been supplied by our community and may not have
[Flink]: https://github.com/Flink
[ribot]: https://github.com/ribot
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell
[jagandecapri]: https://github.com/jagandecapri
### Datastores
@@ -140,6 +143,7 @@ Note: The following plugins have been supplied by our community and may not have
| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | Compatible with 0.2.0 |
| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | Works with dokku @ [c77cbf1][] - no 0.2.0 compatibility |
| [Forego](https://github.com/iskandar/dokku-forego) | [iskandar][] | Compatible with 0.2.x |
| [Monit](https://github.com/cjblomqvist/dokku-monit) | [cjblomqvist][] | |
[c77cbf1]: https://github.com/progrium/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147
[28de3ec]: https://github.com/progrium/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40
@@ -152,7 +156,8 @@ Note: The following plugins have been supplied by our community and may not have
| [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | |
| [Dokku Name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | dokku >= [c77cbf1][] |
| [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 |
| [Events Logger](https://github.com/alessio/dokku-events) | [alessio][] | dokku >= v0.3.13 |
| [git rev-parse HEAD in env](https://github.com/cjblomqvist/dokku-git-rev) | [cjblomqvist][] | Compatible with 0.3.0 |
| [Graduate (Environment Management)](https://github.com/glassechidna/dokku-graduate) | [Benjamin-Dobell][] | dokku >= v0.3.14 |
| [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] |
@@ -192,6 +197,7 @@ Note: The following plugins have been supplied by our community and may not have
| [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][] | |
| [Bower/Gulp](https://github.com/jagandecapri/dokku-bower-gulp-build-plugin) | [jagandecapri][] | |
| [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][] | |
@@ -201,6 +207,7 @@ Note: The following plugins have been supplied by our community and may not have
| [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][] | |
| [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | |
<sup>1</sup> Forked from [jezdez/dokku-elasticsearch-plugin](https://github.com/jezdez/dokku-elasticsearch-plugin): uses Elasticsearch 1.2 (instead of 0.90), doesn't depend on dokku-link, runs as elasticsearch user instead of root, and turns off multicast autodiscovery for use in a VPS environment.

View File

@@ -4,10 +4,38 @@ Dokku supports rudimentary process (really container) management via the `ps` pl
```
ps <app> List processes running in app container(s)
ps:rebuildall Rebuild all apps
ps:rebuild <app> Rebuild an app
ps:restartall Restart all deployed app containers
ps:restart <app> Restart app container(s)
ps:scale <app> <proc>=<count> [<proc>=<count>] Set how many processes of a given process to run
ps:start <app> Start app container(s)
ps:stop <app> Stop app container(s)
ps:restart <app> Restart app container(s)
ps:restartall Restart all deployed app containers
```
*NOTE*: As of v0.3.14, `dokku deploy:all` in now deprecated by `ps:restartall` and will be removed in a future version.
## Scaling
Dokku allows you to run multiple process types at different container counts. For example, if you had an app that contained 1 web app listener and 1 background job processor, dokku can, spin up 1 container for each process type defined in the Procfile. By default we will only start the web process. However, if you wanted 2 job processors running simultaneously, you can modify this behavior in a few ways.
## Include a DOKKU_SCALE file in your repo
Dokku expects this file to contain one line for every process defined in your Procfile. Example:
```
web=1
worker=2
```
## Use the ps:scale command. Example:
```
dokku ps:scale app_name web=1 worker=2
```
*NOTE*: Dokku will always use the DOKKU_SCALE file that ships with the repo to override any local settings.
## The web proctype
Like Heroku, we handle the `web` proctype differently from others. The `web` proctype is the only proctype that will invoke custom checks as defined by a CHECKS file. It is also the only proctype that will be launched in a container that is either proxied via nginx or bound to an external port.

View File

@@ -141,3 +141,31 @@ When specifying your port you may want to use something similar to:
Please see https://github.com/progrium/dokku/issues/282
***
__Symptom:__ Deployment fails because of slow internet connection, messages shows `gzip: stdin: unexpected end of file`
__Solution:__
If you see output similar this when deploying:
```
Command: 'set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/ruby-2.0.0-p451-default-cache.tgz -s -o - | tar zxf -' failed unexpectedly:
!
! gzip: stdin: unexpected end of file
! tar: Unexpected EOF in archive
! tar: Unexpected EOF in archive
! tar: Error is not recoverable: exiting now
```
it might that the curl command that is supposed to fetch the buildpack (anything in the low megabyte file size range) takes too long to finish, due to slowish connection. To overwrite the default values (connection timeout: 3 seconds, total maximum time for operation: 30 seconds), edit `/home/dokku/ENV` like the following:
```
#/home/dokku/ENV
export CURL_TIMEOUT=600
export CURL_CONNECT_TIMEOUT=30
```
References
* https://github.com/progrium/dokku/issues/509
* https://github.com/dokku-alt/dokku-alt/issues/169

View File

@@ -1,73 +1,62 @@
# Upgrading
Dokku is in active development. You can update the deployment step and the build step separately.
This document covers upgrades for the 0.3.0 series and up. If upgrading from previous versions, we recommend [a fresh install](http://progrium.viewdocs.io/dokku/installation) on a new server.
**Note**: If you are upgrading from a revision prior to [27d4bc8c3c](https://github.com/progrium/dokku/commit/27d4bc8c3c19fe580ef3e65f2f85b85101cd83e4), follow the instructions in [this wiki entry](https://github.com/progrium/dokku/wiki/Migrating-to-Dokku-0.2.0).
> As of 0.3.18, dokku is installed by default via a debian package. Source-based installations are still available, though not recommended.
To update the deploy step (this is updated less frequently):
## Dokku
If dokku was installed via a debian package, you can upgrade dokku via the following command:
```shell
sudo apt-get install dokku
```
For unattended upgrades, you may run the following command:
```shell
sudo apt-get install -qq -y dokku
```
If you have installed dokku from source, you may run the following commands to upgrade:
```shell
cd ~/dokku
git pull --tags origin master
# continue to install from source
sudo DOKKU_BRANCH=master make install
# upgrade to debian package-based installation
sudo make install
```
Nothing needs to be restarted. Changes will take effect on the next push / deployment.
To update the build step:
All changes will take effect upon next application deployment. To trigger a rebuild of every application, simply run the following command:
```shell
dokku ps:rebuildall
```
## Buildstep image
If dokku was installed via a debian package, you can upgrade buildstep via the following command:
```shell
sudo apt-get install buildstep
```
For unattended upgrades, you may run the following command:
```shell
sudo apt-get install -qq -y buildstep
```
In some cases, it may be desirable to run a specific version of buildstep. To install/upgrade buildstep from source, run the following commands:
```shell
cd /tmp
git clone https://github.com/progrium/buildstep.git
cd buildstep
git pull origin master
sudo make build
```
This will build a fresh Ubuntu Quantal image, install a number of packages, and
eventually replace the Docker image for buildstep.
## Migrating from 0.1.0 to 0.2.0
This should be summary of breaking changes between 0.1 and 0.2 version with instructions to upgrade.
### software-properties-common
software-properties-common is now a dependency for plugins. Before running dokku install script, make sure it is installed.
```shell
> sudo apt-get install software-properties-common
```
### Gitreceive removed
PR [#270](https://github.com/progrium/dokku/pull/270).
Starting with Dokku 0.2.0, [Gitrecieve](https://github.com/progrium/gitreceive) is replaced by a `git` plugin.
Dokku no longer uses the `git` user. Everything is done with the `dokku` user account.
This causes the remote url to change. Instead of pushing to `git@hostname:app`, you should now push to `dokku@hostname:app`.
The url must be modified using the `git remote set-url` command :
git remote set-url deploy dokku@hostname:app
Where `deploy` is the name of the remote.
Additionally, the repositiories on the server must be migrated to work with dokku 0.2.0
There is an upgrade [script](https://gist.github.com/plietar/7201430), which is meant to automate this migration. To use it:
1. run the script as root
2. `git pull` to get the latest version of dokku
3. make install
4. `dokku ps:restartall`
TDB.
### Cache directory
Commit [#6350f373](https://github.com/progrium/dokku/commit/6350f373be2cef4f3bb90912099e1be6196522d1)
Buildstep have to be re-installed in order to support cache directory.
TDB.

119
dokku
View File

@@ -37,7 +37,7 @@ fi
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
export -n SSH_ORIGINAL_COMMAND
if [[ $1 =~ config-* ]];then
if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]];then
xargs $0 <<<$SSH_ORIGINAL_COMMAND
exit $?
else
@@ -66,67 +66,102 @@ case "$1" in
APP="$2"; IMAGE="dokku/$APP"
pluginhook pre-deploy $APP
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
fi
# start the app
DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy)
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" ]] && DOKKU_DOCKERFILE_PORT=$(dokku config:get $APP DOKKU_DOCKERFILE_PORT || true)
DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
oldids=$(get_container_ids $APP)
if [[ "$BIND_EXTERNAL" = "false" ]];then
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 $START_CMD)
port=$(docker port $id 5000 | sed 's/[0-9.]*://')
ipaddr=127.0.0.1
fi
while read line || [ -n "$line" ]
do
PROC_TYPE=${line%%=*}
PROC_COUNT=${line#*=}
CONTAINER_INDEX=1
# if we can't post-deploy successfully, kill new container
kill_new() {
docker inspect $id &> /dev/null && docker kill $id > /dev/null
trap - INT TERM EXIT
kill -9 $$
}
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]];do
id=""; port=""; ipaddr=""
DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
# 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 $APP $port $ipaddr $id
trap - INT TERM EXIT
# start the app
DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy)
DOCKER_ARGS+=" -e DYNO=$PROC_TYPE "
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP)
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
# 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"
[[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start $PROC_TYPE"
[[ -z "$DOKKU_BUILDSTEP" ]] && DOKKU_DOCKERFILE_PORT=$(dokku config:get $APP DOKKU_DOCKERFILE_PORT || true)
if [[ "$BIND_EXTERNAL" = "false" ]] && [[ "$PROC_TYPE" == "web" ]];then
port=${DOKKU_DOCKERFILE_PORT:=5000}
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id)
elif [[ "$BIND_EXTERNAL" = "true" ]] && [[ "$PROC_TYPE" == "web" ]];then
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
elif [[ "$PROC_TYPE" != "web" ]];then
id=$(docker run -d $DOCKER_ARGS $IMAGE $START_CMD)
fi
# if we can't post-deploy successfully, kill new container
kill_new() {
docker inspect $id &> /dev/null && docker stop $id > /dev/null && docker kill $id > /dev/null
trap - INT TERM EXIT
kill -9 $$
}
# run checks first, then post-deploy hooks, which switches Nginx traffic
trap kill_new INT TERM EXIT
dokku_log_info1 "Running pre-flight checks"
pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr
trap - INT TERM EXIT
# now using the new container
[[ -n "$id" ]] && echo $id > "$DOKKU_CONTAINER_ID_FILE"
[[ -n "$ipaddr" ]] && echo $ipaddr > "$DOKKU_IP_FILE"
[[ -n "$port" ]] && echo $port > "$DOKKU_PORT_FILE"
[[ -n "$port" ]] && echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
# cleanup pre-migration files
rm -f $DOKKU_ROOT/$APP/CONTAINER $DOKKU_ROOT/$APP/IP $DOKKU_ROOT/$APP/PORT
CONTAINER_INDEX=$(( CONTAINER_INDEX + 1 ))
done
# cleanup when we scale down
if [[ "$PROC_COUNT" == 0 ]]; then
CONTAINER_IDX_OFFSET=0
else
CONTAINER_IDX_OFFSET=$((PROC_COUNT + 1))
fi
find $DOKKU_ROOT/$APP -maxdepth 1 -name "CONTAINER.$PROC_TYPE.*" | sort -t . -k 4 -n | tail -n +$CONTAINER_IDX_OFFSET | xargs rm -f
find $DOKKU_ROOT/$APP -maxdepth 1 -name "IP.$PROC_TYPE.*" | sort -t . -k 4 -n | tail -n +$CONTAINER_IDX_OFFSET | xargs rm -f
find $DOKKU_ROOT/$APP -maxdepth 1 -name "PORT.$PROC_TYPE.*" | sort -t . -k 4 -n | tail -n +$CONTAINER_IDX_OFFSET | xargs rm -f
done < "$DOKKU_SCALE_FILE"
dokku_log_info1 "Running post-deploy"
pluginhook post-deploy $APP $port $ipaddr
pluginhook post-deploy $APP $port $ipaddr
# kill the old container
if [[ -n "$oldid" ]]; then
if [[ -n "$oldids" ]]; then
# Let the old container finish processing requests, before terminating it
WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
dokku_log_info1 "Shutting down old container in $WAIT seconds"
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
for oldid in $oldids; do
dokku_log_info2 "$oldid"
done
(
exec >/dev/null 2>/dev/null </dev/null
trap '' INT HUP
sleep $WAIT
docker kill $oldid
for oldid in $oldids; do
docker stop $oldid &> /dev/null
docker kill $oldid &> /dev/null # force a kill as docker seems to not send SIGKILL as the docs would indicate
done
) & disown -a
# Use trap since disown/nohup don't seem to keep child alive
# Give child process just enough time to set the traps
sleep 0.1
fi
;;
cleanup)

View File

@@ -7,6 +7,7 @@ case "$1" in
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source "$DOKKU_ROOT/$APP/ENV"
pushd "$TMP_WORK_DIR" &> /dev/null
case "$IMAGE_SOURCE_TYPE" in
@@ -38,10 +39,12 @@ case "$1" in
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true)
[[ -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"
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
docker build $DOKKU_DOCKER_BUILD_OPTS -t "$IMAGE" .
pluginhook post-build-dockerfile "$APP"
;;
@@ -108,15 +111,23 @@ case "$1" in
;;
ls)
apps=$(ls -d $DOKKU_ROOT/*/ 2>/dev/null) || (echo "You haven't depoyed any applications yet" && exit 1)
dokku_apps=$(ls -d $DOKKU_ROOT/*/ 2>/dev/null) || (echo "You haven't deployed any applications yet" && exit 1)
dokku_col_log_info2_quiet "App Name" "Container id"
dokku_col_log_info1_quiet "App Name" "Container Type" "Container Id" "Status"
for app in $apps; do
if [[ -f $app/CONTAINER ]]; then
dokku_col_log_msg "$(basename $app)" "$(< $app/CONTAINER)"
for dokku_app in $dokku_apps; do
APP=$(basename $dokku_app)
DOKKU_APP_CIDS=$(get_container_ids $APP)
DOCKER_RUNNING_CONTAINERS=$(docker ps -q --no-trunc)
if [[ -n $DOKKU_APP_CIDS ]]; then
for DOKKU_APP_CID in $DOKKU_APP_CIDS; do
DOKKU_APP_CONTAINER_STATUS="stopped"
[[ $DOCKER_RUNNING_CONTAINERS =~ $DOKKU_APP_CID ]] && DOKKU_APP_CONTAINER_STATUS="running"
DOKKU_APP_CONTAINER_TYPE=$(grep -l $DOKKU_APP_CID $DOKKU_ROOT/$APP/CONTAINER.* | awk -F. '{ print $2 }')
dokku_col_log_msg "$APP" "$DOKKU_APP_CONTAINER_TYPE" "${DOKKU_APP_CID:0:12}" "$DOKKU_APP_CONTAINER_STATUS"
done
else
dokku_col_log_msg "$(basename $app)"
dokku_col_log_msg "$APP" "NOT_DEPLOYED" "NOT_DEPLOYED" "NOT_DEPLOYED"
fi
done
;;
@@ -126,13 +137,23 @@ case "$1" in
verify_app_name "$2"
APP="$2";
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
if (is_deployed $APP); then
CONTAINER_IDS=( $(get_container_ids $APP) )
LAST_CONTAINER_ID=${CONTAINER_IDS[${#CONTAINER_IDS[@]} - 1]}
if [[ $3 == "-t" ]]; then
docker logs --follow $CONTAINER
DOKKU_LOGS_ARGS="--follow"
else
docker logs $CONTAINER | tail -n 100
DOKKU_LOGS_ARGS="--tail 100"
fi
for CID in "${CONTAINER_IDS[@]}";do
if [[ "$CID" != "$LAST_CONTAINER_ID" ]];then
DOKKU_LOGS_CMD+="docker logs $DOKKU_LOGS_ARGS $CID& "
else
DOKKU_LOGS_CMD+="docker logs $DOKKU_LOGS_ARGS $CID; "
fi
done
bash -c "($DOKKU_LOGS_CMD)"
else
echo "Application's container not found"
fi
@@ -180,7 +201,9 @@ case "$1" in
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
else
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$DOKKU_ROOT/$APP/PORT")"
for PORT_FILE in $DOKKU_ROOT/$APP/PORT.*; do
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$PORT_FILE")"
done
fi
;;

View File

@@ -41,3 +41,18 @@ WantedBy=multi-user.target
EOF
;;
esac
cat<<EOF > /etc/update-motd.d/99-dokku
#!/bin/sh
if [ ! -f "/home/dokku/HOSTNAME" ]; then
echo "\nTo avoid cli-based dokku configuration, use the web installer"
echo "Debian-based installs should have this running and available"
echo "on port 80. You can also install it via the following commands:"
echo ""
echo " cd /root/dokku"
echo " sudo make dokku-installer\n"
fi
EOF
chmod +x /etc/update-motd.d/99-dokku

View File

@@ -40,11 +40,12 @@ case "$1" in
echo "Destroying $APP (including all add-ons)"
pluginhook pre-delete $APP
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker stop $ID > /dev/null || true
docker rm $ID > /dev/null || true
DOKKU_APP_CIDS=$(get_container_ids $APP)
if [[ -n $DOKKU_APP_CIDS ]]; then
for ID in $DOKKU_APP_CIDS;do
docker stop $ID > /dev/null || true
docker rm $ID > /dev/null || true
done
fi
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &

View File

@@ -22,9 +22,9 @@
# 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.
# and timeout each check to 30 seconds.
#
# By default, checks will be retried 5 times.
# By default, checks will be retried 5 times.
# You can change these by setting WAIT, TIMEOUT and ATTEMPTS to different values, for
# example:
@@ -37,15 +37,16 @@
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"
APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5"
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")
if [[ -z "$DOKKU_APP_CONTAINER_ID" ]]; then
DOKKU_APP_CIDS=( $(get_container_ids $APP) )
DOKKU_APP_CONTAINER_ID=${DOKKU_APP_CIDS[0]}
fi
@@ -77,13 +78,16 @@ cleanup() {
}
trap cleanup EXIT
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
dokku_log_verbose "CHECKS file not found in container: running simple container check..."
if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]]; then
dokku_log_verbose "For more efficient zero downtime deployments, create a file CHECKS."
dokku_log_verbose "See http://progrium.viewdocs.io/dokku/checks-examples.md for examples"
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_DEFAULT_WAIT=10
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_WAIT seconds ..."
sleep $DOKKU_DEFAULT_WAIT
@@ -113,30 +117,31 @@ do
ATTEMPT=$(( ATTEMPT + 1 ))
dokku_log_info1 "Attempt $ATTEMPT/$ATTEMPTS 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 $TIMEOUT"
exec < "$FILENAME"
while read CHECK_URL EXPECTED ; do
# Ignore empty lines and lines starting with #
# shellcheck disable=SC1001
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
# Ignore variables
[[ "$CHECK_URL" =~ ^.+= ]] && continue
# Ignore if it's not a URL in a supported format
# shellcheck disable=SC1001
! [[ "$CHECK_URL" =~ ^(http(s)?:)?\/.+ ]] && continue
if [[ "$CHECK_URL" =~ ^https?: ]] ; then
URL_PROTOCOL=${CHECK_URL%:*}
CHECK_URL=${CHECK_URL#*:}
else
URL_PROTOCOL="http"
fi
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.
@@ -146,22 +151,22 @@ do
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
@@ -175,7 +180,7 @@ do
FAILEDCHECKS=$(( FAILEDCHECKS + 1 ))
fi
done
if [ $FAILEDCHECKS -gt 0 ]; then
dokku_log_warn "Check attempt $ATTEMPT/$ATTEMPTS failed."
SUCCESS=0

View File

@@ -34,36 +34,36 @@ dokku_log_info2_quiet() {
}
dokku_col_log_info1() {
printf "%-40s %-40s\n" "-----> $@"
printf "%-25s %-25s %-25s %-25s\n" "-----> $@"
}
dokku_col_log_info1_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-40s %-40s\n" "-----> $@"
printf "%-25s %-25s %-25s %-25s\n" "-----> $@"
else
return 0
fi
}
dokku_col_log_info2() {
printf "%-40s %-40s\n" "=====> $@"
printf "%-25s %-25s %-25s %-25s\n" "=====> $@"
}
dokku_col_log_info2_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-40s %-40s\n" "=====> $@"
printf "%-25s %-25s %-25s %-25s\n" "=====> $@"
else
return 0
fi
}
dokku_col_log_msg() {
printf "%-40s %-40s\n" "$@"
printf "%-25s %-25s %-25s %-25s\n" "$@"
}
dokku_col_log_msg_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-40s %-40s\n" "$@"
printf "%-25s %-25s %-25s %-25s\n" "$@"
else
return 0
fi
@@ -104,17 +104,37 @@ dokku_container_log_verbose_quiet() {
verify_app_name() {
local APP="$1"
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
IMAGE="dokku/$APP"
return 0
}
verify_image() {
local IMAGE="$1"
DOKKU_APP_IMAGES=$(docker images -q $IMAGE)
if [[ -n "$DOKKU_APP_IMAGES" ]]; then
return 0
else
return 1
fi
}
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 ]]"
}
is_number() {
local NUMBER=$1; local NUM_RE='^[0-9]+$'
if [[ $NUMBER =~ $NUM_RE ]];then
return 0
else
return 1
fi
}
parse_args() {
for arg in "$@"; do
case "$arg" in
@@ -134,3 +154,39 @@ parse_args() {
done
return 0
}
copy_from_image() {
local IMAGE="$1"; local SRC_FILE="$2"; local DST_DIR="$3"; verify_app_name $APP
if verify_image "$IMAGE"; then
CID=$(docker run -d $IMAGE bash)
docker cp "$CID:$SRC_FILE" "$DST_DIR"
docker rm -f "$CID" &> /dev/null
else
return 1
fi
}
is_deployed() {
APP="$1"
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(ls $DOKKU_ROOT/$APP/CONTAINER.* &> /dev/null; echo $?) -eq 0 ]];then
return 0
else
return 1
fi
}
get_container_ids() {
APP="$1"
verify_app_name $APP
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(< $DOKKU_ROOT/$APP/CONTAINER)
shopt -s nullglob
for DOKKU_CID_FILE in $DOKKU_ROOT/$APP/CONTAINER.*; do
DOKKU_CIDS+=" "
DOKKU_CIDS+=$(< $DOKKU_CID_FILE)
DOKKU_CIDS+=" "
done
shopt -u nullglob
echo $DOKKU_CIDS
}

View File

@@ -38,7 +38,7 @@ config_styled_hash () {
config_write() {
ENV_TEMP="$1"
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
echo "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
cp -f $ENV_FILE_TEMP $ENV_FILE
chmod 600 $ENV_FILE
@@ -137,8 +137,9 @@ case "$1" in
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
RESTART_APP=true
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $KEY=/ d")
ENV_TEMP="${ENV_TEMP}\nexport $KEY='$VALUE'"
ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $KEY=/ d")
ENV_TEMP="${ENV_TEMP}
export $KEY='$VALUE'"
ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
ENV_ADD="${ENV_ADD}$
${var}"

View File

@@ -81,7 +81,8 @@ get_passed_docker_option() {
add_passed_docker_option() {
local passed_phases=("${!1}")
local passed_option_string=$2
shift
local passed_option_string="$*"
local phase
for phase in "${passed_phases[@]}"; do
get_phase_file_path $phase
@@ -94,7 +95,8 @@ add_passed_docker_option() {
remove_passed_docker_option() {
local passed_phases=("${!1}")
local passed_option_string=$2
shift
local passed_option_string="$*"
local phase
for phase in "${passed_phases[@]}"; do
get_phase_file_path $phase

View File

@@ -45,7 +45,7 @@ case "$1" in
VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
fi
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
echo "unsupported vhost config found. disabling vhost support"
dokku_log_info2 "unsupported vhost config found. disabling vhost support"
dokku config:set-norestart $APP NO_VHOST=1
else
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
@@ -71,8 +71,8 @@ case "$1" in
verify_app_name "$2"
APP="$2"
if [[ -z $3 ]]; then
echo "Usage: dokku $1 $APP DOMAIN"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
echo "Must specify DOMAIN."
exit 1
fi
@@ -82,12 +82,17 @@ case "$1" in
exit 1
fi
shift 2
dokku domains:setup $APP
echo "$3" >> "$DOKKU_ROOT/$APP/VHOST"
for DOMAIN in "$@";do
echo "$DOMAIN" >> "$DOKKU_ROOT/$APP/VHOST"
done
# we need to restart the app to make sure we're binding to the appropriate network interface
dokku ps:restart $APP
dokku nginx:build-config $APP
pluginhook post-domains-update $APP
dokku_log_info1 "Added $3 to $APP"
for DOMAIN in "$@";do
dokku_log_info1 "Added $DOMAIN to $APP"
done
;;
@@ -108,16 +113,21 @@ case "$1" in
verify_app_name "$2"
APP="$2"
if [[ -z $3 ]]; then
echo "Usage: dokku $1 $2 DOMAIN"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
echo "Must specify DOMAIN."
exit 1
fi
shift 2
dokku domains:setup $APP
sed -i "/^$3$/d" "$DOKKU_ROOT/$APP/VHOST"
for DOMAIN in "$@";do
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
done
pluginhook post-domains-update $APP
dokku_log_info1 "Removed $3 from $APP"
for DOMAIN in "$@";do
dokku_log_info1 "Removed $DOMAIN from $APP"
done
;;

View File

@@ -72,7 +72,7 @@ case "$1" in
;;
git-*)
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
APP_PATH=$DOKKU_ROOT/$APP
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
@@ -87,7 +87,11 @@ EOF
chmod +x $PRERECEIVE_HOOK
fi
args=$*
if [[ $1 == "git-receive-pack" ]]; then
args="$1 '$APP_PATH'"
else
args=$*
fi
git-shell -c "$args"
;;

View File

@@ -2,6 +2,17 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
validate_nginx () {
set +e
sudo /usr/sbin/nginx -t > /dev/null 2>&1
exit_code=$?
set -e
if [[ "$exit_code" -ne "0" ]]; then
sudo /usr/sbin/nginx -t
exit "$exit_code"
fi
}
restart_nginx () {
case "$DOKKU_DISTRO" in
ubuntu)
@@ -17,20 +28,30 @@ restart_nginx () {
case "$1" in
nginx:build-config)
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="${4}"
verify_app_name "$APP"
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
URLS_PATH="$DOKKU_ROOT/$APP/URLS"
WILDCARD_SSL="$DOKKU_ROOT/tls"
SSL="$DOKKU_ROOT/$APP/tls"
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
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")
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -z "$DOKKU_APP_LISTEN_IP" ]]; then
shopt -s nullglob
for DOKKU_APP_IP_FILE in $DOKKU_ROOT/$APP/IP.web.*;do
DOKKU_APP_PORT_FILE=$(echo $DOKKU_APP_IP_FILE | sed -e "s:IP:PORT:g")
DOKKU_APP_LISTENER_IP=$(< $DOKKU_APP_IP_FILE)
DOKKU_APP_LISTENER_PORT=$(< $DOKKU_APP_PORT_FILE)
DOKKU_APP_LISTENERS+=" "
DOKKU_APP_LISTENERS+="$DOKKU_APP_LISTENER_IP:$DOKKU_APP_LISTENER_PORT"
DOKKU_APP_LISTENERS+=" "
done
shopt -u nullglob
fi
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
[[ -f "$APP_NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$APP_NGINX_TEMPLATE" && NGINX_CUSTOM_TEMPLATE="true" && dokku_log_info1 'Overriding default nginx.conf with detected nginx.conf.template'
if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
NONSSL_VHOSTS=$(cat $VHOST_PATH)
@@ -51,23 +72,24 @@ EOF
if [[ -n "$SSL_INUSE" ]]; then
SCHEME="https"
[[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
SSL_HOSTNAME=$(openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
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
[[ -z "$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH)" ]] && [[ ! "$SSL_HOSTNAME" =~ ^\*.* ]] && 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)
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
[[ -z "$(egrep "^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH)" ]] && [[ ! "$SSL_HOSTNAME_ALT" =~ ^\*.* ]] && echo "$SSL_HOSTNAME_ALT" >> $VHOST_PATH
fi
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)
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
while read line; do
[[ -z "$line" ]] && continue
dokku_log_info1 "Configuring SSL for $line..."
SSL_SERVER_NAME=$line
NOSSL_SERVER_NAME=$line
@@ -75,30 +97,32 @@ EOF
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"
eval "cat <<< \"$(< $APP_NGINX_TEMPLATE)\" > $NGINX_CONF"
elif [[ -n "$NONSSL_VHOSTS" ]]; then
if [[ -n "$NONSSL_VHOSTS" ]]; then
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template"
[[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template"
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
fi
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
elif [[ -n "$DOKKU_APP_LISTENERS" ]]; then
echo "upstream $APP { " >> $NGINX_CONF
for listener in $DOKKU_APP_LISTENERS;do
echo " server $listener;" >> $NGINX_CONF
done
echo "}" >> $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
if is_deployed "$APP"; then
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
dokku_log_verbose "Reloading nginx"
validate_nginx && restart_nginx
fi
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" > $URLS_PATH
@@ -113,8 +137,10 @@ EOF
dokku_log_info1 "VHOST support disabled, deleting nginx.conf"
rm "$DOKKU_ROOT/$APP/nginx.conf"
dokku_log_info1 "VHOST support disabled, reloading nginx after nginx.conf deletion"
restart_nginx
if is_deployed "$APP"; then
dokku_log_info1 "VHOST support disabled, reloading nginx after nginx.conf deletion"
validate_nginx && restart_nginx
fi
fi
fi
;;

View File

@@ -1,19 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
if [[ ! -f /etc/sudoers.d/dokku-nginx ]]; then
case "$DOKKU_DISTRO" in
ubuntu)
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload" >> /etc/sudoers.d/dokku-nginx
;;
case "$DOKKU_DISTRO" in
ubuntu)
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
;;
opensuse)
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload" >> /etc/sudoers.d/dokku-nginx
;;
esac
opensuse)
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
;;
esac
chmod 0440 /etc/sudoers.d/dokku-nginx
fi
chmod 0440 /etc/sudoers.d/dokku-nginx
# if dokku.conf has not been created, create it
if [[ ! -f /etc/nginx/conf.d/dokku.conf ]]; then

View File

@@ -2,7 +2,7 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
APP="$1"; PORT="$2"; IP="$3"
APP="$1"
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
if [[ -n "$NO_VHOST" ]]; then
@@ -11,4 +11,4 @@ elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
dokku domains:setup $APP
fi
dokku nginx:build-config $APP $PORT $IP
dokku nginx:build-config $APP

View File

@@ -2,6 +2,9 @@ server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
access_log /var/log/nginx/${APP}-access.log;
error_log /var/log/nginx/${APP}-error.log;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;

View File

@@ -2,13 +2,17 @@ server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
return 301 https://$SSL_SERVER_NAME\$request_uri;
access_log /var/log/nginx/${APP}-access.log;
error_log /var/log/nginx/${APP}-error.log;
return 301 https://\$host\$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name $SSL_SERVER_NAME;
access_log /var/log/nginx/${APP}-access.log;
error_log /var/log/nginx/${APP}-error.log;
$SSL_DIRECTIVES
keepalive_timeout 70;

View File

@@ -1,47 +1,29 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
release_and_deploy() {
source "$(dirname $0)/../common/functions"
local APP="$1"; 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" "$IMAGE_SOURCE_TYPE"
dokku_log_info1 "Deploying $APP ..."
dokku deploy "$APP"
dokku_log_info2 "Application deployed:"
dokku urls $APP | sed "s/^/ /"
echo
fi
}
source "$(dirname $0)/functions"
case "$1" in
ps)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
APP="$2"; CONTAINER_IDS=$(get_container_ids $APP)
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
docker exec -ti "$CONTAINER_ID" /bin/bash -c "ps auxwww"
for CID in $CONTAINER_IDS; do
docker exec -ti "$CID" /bin/bash -c "ps auxwww"
done
;;
ps:start)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
APP="$2"; CONTAINER_IDS=( $(get_container_ids $APP) )
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
if [[ "$(docker ps -q --no-trunc| grep -q $CONTAINER_ID; echo $?)" != "0" ]]; then
if [[ "$(docker ps -q --no-trunc| grep -q ${CONTAINER_IDS[0]}; echo $?)" != "0" ]]; then
release_and_deploy $APP
else
echo "App $APP already running"
@@ -52,12 +34,15 @@ case "$1" in
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
APP="$2"; CONTAINER_IDS=$(get_container_ids $APP)
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
if [[ "$(docker ps -q --no-trunc| grep -q $CONTAINER_ID; echo $?)" = "0" ]]; then
CONTAINER_IDS_EGREP_PATTERN=$(echo $CONTAINER_IDS | xargs | sed -e "s: :|:g")
if [[ "$(docker ps -q --no-trunc| egrep -q $CONTAINER_IDS_EGREP_PATTERN; echo $?)" = "0" ]]; then
echo "Stopping $APP ..."
docker stop $CONTAINER_ID > /dev/null
for CID in $CONTAINER_IDS;do
docker stop $CID > /dev/null
done
else
echo "App $APP already stopped"
fi
@@ -73,33 +58,55 @@ case "$1" in
ps:rebuildall)
shopt -s nullglob
for app in $DOKKU_ROOT/*/CONTAINER; do
APP=$(basename "$(dirname $app)");
dokku ps:rebuild $APP
for app in $DOKKU_ROOT/*; do
[[ ! -d $app ]] && continue
APP=$(basename $app)
is_deployed $APP && dokku ps:rebuild $APP
done
shopt -u nullglob
;;
ps:restart)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
APP="$2"
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
release_and_deploy $APP
;;
ps:restartall)
shopt -s nullglob
for app in $DOKKU_ROOT/*/CONTAINER; do
APP=$(basename "$(dirname $app)");
for app in $DOKKU_ROOT/*; do
[[ ! -d $app ]] && continue
APP=$(basename $app)
dokku ps:restart $APP
done
shopt -u nullglob
;;
ps:scale)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
shift 2
generate_scale_file "$APP"
if [[ -z "$@" ]];then
dokku_log_info1 "Scaling for $APP"
dokku_log_info2 "$(< $DOKKU_SCALE_FILE)"
else
set_scale "$APP" "$@"
release_and_deploy "$APP"
fi
;;
help | ps:help)
cat && cat<<EOF
ps <app> List processes running in app container(s)
ps:scale <app> <proc>=<count> [<proc>=<count>] Set how many processes of a given process to run
ps:start <app> Start app container(s)
ps:stop <app> Stop app container(s)
ps:rebuild <app> Rebuild an app

57
plugins/ps/functions Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
release_and_deploy() {
source "$(dirname $0)/../common/functions"
local APP="$1"; local IMAGE="dokku/$APP"
if verify_image "$IMAGE"; 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" "$IMAGE_SOURCE_TYPE"
dokku_log_info1 "Deploying $APP ..."
dokku deploy "$APP"
dokku_log_info2 "Application deployed:"
dokku urls $APP | sed "s/^/ /"
echo
fi
}
generate_scale_file() {
local APP="$1"; local IMAGE="dokku/$APP"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
copy_from_image "$IMAGE" "/app/DOKKU_SCALE" "$DOKKU_ROOT/$APP" 2>/dev/null || true
if [[ ! -f $DOKKU_SCALE_FILE ]]; then
dokku_log_info1_quiet "DOKKU_SCALE not found in app image. Defaulting to a single web process"
echo "web=1" >> $DOKKU_SCALE_FILE
dokku_log_info1_quiet "New DOKKU_SCALE file generated"
while read line || [ -n "$line" ]
do
dokku_log_info2_quiet "$line"
done < "$DOKKU_SCALE_FILE"
fi
}
set_scale() {
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
shift 1
local SCALE_SETTINGS=("$@")
for procscale in "${SCALE_SETTINGS[@]}"; do
PROC_NAME=${procscale%%=*}
PROC_COUNT=${procscale#*=}
is_number $PROC_COUNT || dokku_log_fail "ps:scale $PROC_COUNT is not a number"
dokku_log_info1_quiet "Scaling $APP:$PROC_NAME to $PROC_COUNT"
if (egrep -q ^${PROC_NAME}= $DOKKU_SCALE_FILE > /dev/null 2>&1);then
sed --in-place "s:^${PROC_NAME}=.*:$PROC_NAME=$PROC_COUNT:g" $DOKKU_SCALE_FILE
else
echo "$PROC_NAME=$PROC_COUNT" >> $DOKKU_SCALE_FILE
fi
done
}

8
plugins/ps/pre-deploy Executable file
View File

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

View File

@@ -28,8 +28,15 @@ endif
@echo "-----> Setting up ssh config..."
ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0)
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
else ifeq ($(shell grep dokku.me /root/.ssh/config),)
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
endif
ifeq ($(shell grep 22333 /etc/ssh/sshd_config),)
sed --in-place "s:^Port 22:Port 22 \\nPort 22333:g" /etc/ssh/sshd_config
restart ssh
endif
@echo "-----> Installing SSH public key..."
@@ -38,6 +45,7 @@ endif
@echo "-----> Intitial SSH connection to populate known_hosts..."
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help > /dev/null
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
@echo "-----> Setting default VHOST to dokku.me..."
@@ -61,7 +69,11 @@ lint:
unit-tests:
@echo running unit tests...
ifndef UNIT_TEST_BATCH
@$(QUIET) bats tests/unit
else
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
endif
deploy-test-clojure:
@echo deploying config app...
@@ -125,7 +137,6 @@ deploy-test-static:
deploy-tests:
@echo running deploy tests...
# @$(QUIET) bats tests/deploy
@$(QUIET) $(MAKE) deploy-test-config
@$(QUIET) $(MAKE) deploy-test-clojure
@$(QUIET) $(MAKE) deploy-test-dockerfile

View File

@@ -1 +1,3 @@
cron: node worker.js
web: node web.js
worker: node worker.js

View File

@@ -9,4 +9,4 @@ app.get('/', function(request, response) {
var port = process.env.PORT || 5000;
app.listen(port, function() {
console.log("Listening on " + port);
});
});

View File

@@ -0,0 +1,6 @@
function worker() {
console.log('sleeping for 60 seconds');
setTimeout(worker, 60 * 1000);
}
worker();

View File

@@ -1,20 +1,46 @@
#!/usr/bin/env bash
MODE="$1"; MODE=${MODE:="testing"}
setup_circle() {
MAKE_ENV="CI=true"
[[ "$1" == "buildstack" ]] && MAKE_ENV+=" BUILD_STACK=true "
echo "setting up with MAKE_ENV: $MAKE_ENV"
sudo -E CI=true make -e sshcommand
# need to add the dokku user to the docker group
sudo usermod -G docker dokku
#### circle does some weird *expletive* with regards to root and gh auth (needed for gitsubmodules test)
sudo rsync -a ~ubuntu/.ssh/ ~root/.ssh/
sudo chown -R root:root ~root/.ssh/
sudo sed --in-place 's:/home/ubuntu:/root:g' ~root/.ssh/config
####
sudo -E $MAKE_ENV make -e install
sudo -E make -e setup-deploy-tests
make -e ci-dependencies
}
case "$CIRCLE_NODE_INDEX" in
0)
echo "=====> make unit-tests"
sudo -E make -e unit-tests
echo "=====> make unit-tests (1/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
sudo -E UNIT_TEST_BATCH=1 make -e unit-tests
;;
1)
echo "=====> make deploy-tests (buildstep release)"
sudo -E make -e deploy-tests
echo "=====> make unit-tests (2/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
sudo -E UNIT_TEST_BATCH=2 make -e unit-tests
;;
2)
echo "=====> make deploy-tests (buildstep master)"
docker rmi -f progrium/buildstep && \
sudo -E BUILD_STACK=true make -e stack && \
echo "=====> make deploy-tests (buildstep release) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
sudo -E make -e deploy-tests
;;
3)
echo "=====> make deploy-tests (buildstep master) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
[[ "$MODE" == "setup" ]] && setup_circle buildstack && exit 0
sudo -E make -e deploy-tests
;;
esac

37
tests/ci/unit_test_runner.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
is_number() {
local NUMBER=$1; local NUM_RE='^[0-9]+$'
if [[ $NUMBER =~ $NUM_RE ]];then
return 0
else
return 1
fi
}
usage() {
echo "usage: $0 1|2"
exit 0
}
BATCH_NUM="$1"
is_number $BATCH_NUM || usage
TESTS=($(find "$(dirname $0)"/../unit -maxdepth 1 -name "*.bats"))
HALF_TESTS=$(( ${#TESTS[@]} / 2 ))
FIRST_HALF=("${TESTS[@]:0:${HALF_TESTS}}")
LAST_HALF=("${TESTS[@]:${HALF_TESTS}:${#TESTS[@]}}")
case "$BATCH_NUM" in
1)
bats "${FIRST_HALF[@]}"
;;
2)
bats "${LAST_HALF[@]}"
;;
*)
usage
;;
esac

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy config app" {
run bash -c "cd tests && ./test_deploy ./apps/config dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy gitsubmodules app" {
run bash -c "cd tests && ./test_deploy ./apps/gitsubmodules dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy go app" {
run bash -c "cd tests && ./test_deploy ./apps/go dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy java app" {
run bash -c "cd tests && ./test_deploy ./apps/java dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy multi app" {
run bash -c "cd tests && ./test_deploy ./apps/multi dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy nodejs-express app" {
run bash -c "cd tests && ./test_deploy ./apps/nodejs-express dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy php app" {
skip "fails. ref: https://github.com/progrium/buildstep/issues/126"
run bash -c "cd tests && ./test_deploy ./apps/php dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy python-flask app" {
run bash -c "cd tests && ./test_deploy ./apps/python-flask dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy static app" {
skip "fails on apt-get update..."
run bash -c "cd tests && ./test_deploy ./apps/static dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -131,10 +131,12 @@ teardown() {
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
}
@test "(client) ps:stop" {
@@ -143,10 +145,12 @@ teardown() {
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_failure
done
}
@test "(client) ps:restart" {
@@ -155,8 +159,10 @@ teardown() {
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
}

View File

@@ -20,7 +20,7 @@ teardown() {
}
@test "(config) config:get" {
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\" test_var3=\"with\\nnewline\"
echo "output: "$output
echo "status: "$status
assert_success
@@ -28,6 +28,10 @@ teardown() {
echo "output: "$output
echo "status: "$status
assert_output 'hello world'
run dokku config:get $TEST_APP test_var3
echo "output: "$output
echo "status: "$status
assert_output 'with\nnewline'
}
@test "(config) config:unset" {

View File

@@ -115,3 +115,9 @@ build_nginx_config() {
assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://dokku.example.com"
}
@test "(core) git-remote (off-port)" {
run deploy_app nodejs-express ssh://dokku@127.0.0.1:22333/$TEST_APP
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -37,7 +37,7 @@ teardown() {
@test "(core) port exposure (with NO_VHOST set)" {
deploy_app
dokku config:set $TEST_APP NO_VHOST=1
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
echo "output: "$output
echo "status: "$status
@@ -97,7 +97,12 @@ teardown() {
echo "status: "$status
assert_success
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
run dokku ps:restart $TEST_APP
echo "output: "$output
echo "status: "$status
assert_success
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
echo "output: "$output
echo "status: "$status
@@ -111,7 +116,7 @@ teardown() {
@test "(core) dockerfile port exposure" {
deploy_app dockerfile
run bash -c "grep upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000"
run bash -c "grep -A1 upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000"
echo "output: "$output
echo "status: "$status
assert_success

View File

@@ -149,3 +149,14 @@ teardown() {
assert_success
deploy_app
}
@test "docker-options:add (all phases over SSH)" {
run ssh dokku@dokku.me docker-options:add $TEST_APP build,deploy,run "-v /tmp"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP | egrep '\-v /tmp' | wc -l | grep -q 3"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -28,6 +28,13 @@ teardown() {
assert_success
}
@test "(domains) domains:add (multiple)" {
run dokku domains:add $TEST_APP www.test.app.dokku.me test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
}
@test "(domains) domains:remove" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output

View File

@@ -9,7 +9,7 @@ setup() {
}
teardown() {
destroy_app
destroy_app 0 $TEST_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
@@ -53,6 +53,18 @@ assert_http_success() {
assert_output "200"
}
assert_access_log() {
local prefix=$1
run [ -a /var/log/nginx/$prefix-access.log ]
assert_success
}
assert_error_log() {
local prefix=$1
run [ -a /var/log/nginx/$prefix-error.log ]
assert_success
}
@test "(nginx-vhosts) nginx (no server tokens)" {
deploy_app
run /bin/bash -c "curl -s -D - $(dokku url $TEST_APP) -o /dev/null | egrep '^Server' | egrep '[0-9]+'"
@@ -61,6 +73,12 @@ assert_http_success() {
assert_failure
}
@test "(nginx-vhosts) logging" {
deploy_app
assert_access_log ${TEST_APP}
assert_error_log ${TEST_APP}
}
@test "(nginx-vhosts) nginx:build-config (wildcard SSL)" {
setup_test_tls_wildcard
add_domain "wildcard1.dokku.me"
@@ -72,12 +90,38 @@ assert_http_success() {
assert_nonssl_domain "www.test.dokku.me"
}
@test "(nginx-vhosts) nginx:build-config (wildcard SSL & custom nginx template)" {
setup_test_tls_wildcard
add_domain "wildcard1.dokku.me"
add_domain "wildcard2.dokku.me"
custom_ssl_nginx_template
deploy_app
assert_ssl_domain "wildcard1.dokku.me"
assert_ssl_domain "wildcard2.dokku.me"
}
@test "(nginx-vhosts) nginx:build-config (wildcard SSL & unrelated domain)" {
destroy_app
TEST_APP="${TEST_APP}.example.com"
setup_test_tls_wildcard
deploy_app nodejs-express dokku@dokku.me:$TEST_APP
run /bin/bash -c "egrep '*.dokku.me' $DOKKU_ROOT/${TEST_APP}/nginx.conf | wc -l"
assert_output "0"
}
@test "(nginx-vhosts) nginx:build-config (with SSL CN mismatch)" {
setup_test_tls
deploy_app
assert_ssl_domain "node-js-app.dokku.me"
}
@test "(nginx-vhosts) nginx:build-config (with SSL CN mismatch & custom nginx template)" {
setup_test_tls
custom_ssl_nginx_template
deploy_app
assert_ssl_domain "node-js-app.dokku.me"
}
@test "(nginx-vhosts) nginx:build-config (with SSL and Multiple SANs)" {
setup_test_tls_with_sans
deploy_app
@@ -86,6 +130,13 @@ assert_http_success() {
assert_ssl_domain "www.test.app.dokku.me"
}
@test "(nginx-vhosts) nginx:build-config (custom nginx template)" {
add_domain "www.test.app.dokku.me"
custom_nginx_template
deploy_app
assert_nonssl_domain "www.test.app.dokku.me"
}
@test "(nginx-vhosts) nginx:build-config (no global VHOST and domains:add)" {
destroy_app
rm "$DOKKU_ROOT/VHOST"
@@ -94,3 +145,12 @@ assert_http_success() {
deploy_app
assert_nonssl_domain "www.test.app.dokku.me"
}
@test "(nginx-vhosts) nginx:build-config (validate_nginx)" {
deploy_app
echo "some lame nginx config" > "$DOKKU_ROOT/$TEST_APP/nginx.conf.template"
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_failure
}

View File

@@ -3,7 +3,7 @@
load test_helper
setup() {
deploy_app
create_app
}
teardown() {
@@ -22,39 +22,104 @@ teardown() {
# }
@test "(ps) buildstep" {
deploy_app
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_failure
done
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
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)"
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
}
@test "(ps:scale) buildstep" {
run bash -c "dokku ps:scale $TEST_APP web=2 worker=2"
echo "output: "$output
echo "status: "$status
assert_success
deploy_app
for PROC_TYPE in web worker; do
CIDS=""
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.$PROC_TYPE.*; do
CIDS+=$(< $CID_FILE)
CIDS+=" "
done
CIDS_PATTERN=$(echo $CIDS | sed -e "s: :|:g")
run bash -c "docker ps -q --no-trunc | egrep \"$CIDS_PATTERN\" | wc -l | grep 2"
echo "output: "$output
echo "status: "$status
assert_success
done
run bash -c "dokku ps:scale $TEST_APP web=1 worker=1"
echo "output: "$output
echo "status: "$status
assert_success
for PROC_TYPE in web worker; do
CIDS=""
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.$PROC_TYPE.*; do
CIDS+=$(< $CID_FILE)
CIDS+=" "
done
CIDS_PATTERN=$(echo $CIDS | sed -e "s: :|:g")
run bash -c "docker ps -q --no-trunc | egrep \"$CIDS_PATTERN\" | wc -l | grep 1"
echo "output: "$output
echo "status: "$status
assert_success
done
run bash -c "dokku ps:scale $TEST_APP web=0 worker=0"
echo "output: "$output
echo "status: "$status
assert_success
for PROC_TYPE in web worker; do
CIDS=""
shopt -s nullglob
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.$PROC_TYPE.*; do
CIDS+=$(< $CID_FILE)
CIDS+=" "1
done
shopt -u nullglob
run bash -c "[[ -z \"$CIDS\" ]]"
echo "output: "$output
echo "status: "$status
assert_success
done
}

View File

@@ -3,7 +3,7 @@
load test_helper
setup() {
deploy_app dockerfile
create_app
}
teardown() {
@@ -22,38 +22,96 @@ teardown() {
# }
@test "(ps) dockerfile" {
deploy_app dockerfile
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_failure
done
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
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
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
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)"
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
echo "output: "$output
echo "status: "$status
assert_success
done
}
@test "(ps:scale) dockerfile" {
run bash -c "dokku ps:scale $TEST_APP web=2"
echo "output: "$output
echo "status: "$status
assert_success
deploy_app dockerfile
CIDS=""
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
CIDS+=$(< $CID_FILE)
CIDS+=" "
done
CIDS_PATTERN=$(echo $CIDS | sed -e "s: :|:g")
run bash -c "docker ps -q --no-trunc | egrep \"$CIDS_PATTERN\" | wc -l | grep 2"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku ps:scale $TEST_APP web=1"
echo "output: "$output
echo "status: "$status
assert_success
CIDS=""
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
CIDS+=$(< $CID_FILE)
CIDS+=" "
done
CIDS_PATTERN=$(echo $CIDS | sed -e "s: :|:g")
run bash -c "docker ps -q --no-trunc | egrep \"$CIDS_PATTERN\" | wc -l | grep 1"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku ps:scale $TEST_APP web=0"
echo "output: "$output
echo "status: "$status
assert_success
CIDS=""
shopt -s nullglob
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
CIDS+=$(< $CID_FILE)
CIDS+=" "
done
run bash -c "[[ -z \"$CIDS\" ]]"
echo "output: "$output
echo "status: "$status
assert_success

View File

@@ -89,7 +89,10 @@ create_app() {
}
destroy_app() {
local RC="$1"; local RC=${RC:=0}
local TEST_APP="$2"; local TEST_APP=${TEST_APP:=my-cool-guy-test-app}
echo $TEST_APP | dokku apps:destroy $TEST_APP
return $RC
}
add_domain() {
@@ -98,22 +101,24 @@ add_domain() {
deploy_app() {
APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"}
TMP=$(mktemp -d -t "$TARGET.XXXXX")
GIT_REMOTE="$2"; GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
TMP=$(mktemp -d -t "dokku.me.XXXXX")
rmdir $TMP && cp -r ./tests/apps/$APP_TYPE $TMP
cd $TMP
git init
git config user.email "robot@example.com"
git config user.name "Test Robot"
git remote add target dokku@dokku.me:$TEST_APP
echo "setting up remote: $GIT_REMOTE"
git remote add target $GIT_REMOTE
[[ -f gitignore ]] && mv gitignore .gitignore
git add .
git commit -m 'initial commit'
git push target master || destroy_app
git push target master || destroy_app $?
}
setup_client_repo() {
TMP=$(mktemp -d -t "$TARGET.XXXXX")
TMP=$(mktemp -d -t "dokku.me.XXXXX")
rmdir $TMP && cp -r ./tests/apps/nodejs-express $TMP
cd $TMP
git init
@@ -156,3 +161,63 @@ disable_tls_wildcard() {
-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
}
custom_ssl_nginx_template() {
APP="$1"
[[ -z "$APP" ]] && APP="$TEST_APP"
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf.template
server {
listen [::]:80;
listen 80;
server_name \$NOSSL_SERVER_NAME;
return 301 https://\$SSL_SERVER_NAME\\\$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name \$SSL_SERVER_NAME;
\$SSL_DIRECTIVES
keepalive_timeout 70;
add_header Alternate-Protocol 443:npn-spdy/2;
location / {
proxy_pass http://\$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \\\$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \\\$http_host;
proxy_set_header X-Forwarded-Proto \\\$scheme;
proxy_set_header X-Forwarded-For \\\$remote_addr;
proxy_set_header X-Forwarded-Port \\\$server_port;
proxy_set_header X-Request-Start \\\$msec;
}
include \$DOKKU_ROOT/\$APP/nginx.conf.d/*.conf;
}
EOF
}
custom_nginx_template() {
APP="$1"
[[ -z "$APP" ]] && APP="$TEST_APP"
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf.template
server {
listen [::]:80;
listen 80;
server_name \$NOSSL_SERVER_NAME;
location / {
proxy_pass http://\$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \\\$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \\\$http_host;
proxy_set_header X-Forwarded-Proto \\\$scheme;
proxy_set_header X-Forwarded-For \\\$remote_addr;
proxy_set_header X-Forwarded-Port \\\$server_port;
proxy_set_header X-Request-Start \\\$msec;
}
include \$DOKKU_ROOT/\$APP/nginx.conf.d/*.conf;
}
EOF
}