Compare commits

...

193 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
aa74315389 Release 0.6.4 2016-06-29 01:27:16 -04:00
Jose Diaz-Gonzalez
b7bb766f53 Merge pull request #2279 from dokku/2278_mh-checks-disabled-bug
only attempt to stop a checks-disabled container if it is actually running
2016-06-29 01:15:24 -04:00
Michael Hobbs
ae972cf3cd only attempt to stop a checks-disabled container if it is actually running. closes #2278 2016-06-28 20:32:04 -07:00
Jose Diaz-Gonzalez
b20a91d24f Merge pull request #2272 from dokku/2177-document-env
Add documentation surrounding when the /app/.env file is populated
2016-06-28 20:27:12 -04:00
Jose Diaz-Gonzalez
bd8ca6ca5c Merge pull request #2271 from dokku/2106-purge-dokku-user
Handle purging the dokku user, group, and logs directory during `apt-get purge`
2016-06-28 20:27:03 -04:00
Michael Hobbs
6543f5d11c Merge pull request #2275 from sseemayer/master
Prefer file import in certs:add if files given
2016-06-27 10:13:25 -07:00
Stefan Seemayer
f0000a18ba Prefer file import in certs:add if files given
Fixes dokku/dokku-letsencrypt#67

Change the certs:add command to use a file import without trying to
detect a piped-in tarball if server.crt and server.key files were passed
in as arguments and those files exist.

Fixes hangs on certificate imports by filename when the check for a
STDIN pipe fails e.g. when running dokku remotely using a SSH command.
2016-06-27 16:09:05 +02:00
Michael Hobbs
80d13234f9 Merge pull request #2270 from guillaumewuip/better_apps_destroy
Allow apps:destroy when not in a project
2016-06-26 14:23:57 -07:00
Jose Diaz-Gonzalez
f6c1ad1b8f Add documentation surrounding when the /app/.env file is populated
Closes #2177

[ci skip]
2016-06-26 17:13:46 -04:00
Jose Diaz-Gonzalez
2f5fce36e4 Handle purging the dokku user, group, and logs directory during apt-get purge
Closes #2106

[ci skip]
2016-06-26 16:56:23 -04:00
Guillaume Wuip
8d14d15acc Fix obvious missing "git" 2016-06-26 21:09:31 +02:00
Guillaume Wuip
3cc1b42160 Fix has_dokku_remote
`git remote show <remote>` seems to really check if the remote is a git repo
whereas we just want to know if a remote named "dokku" is present
2016-06-26 21:06:42 +02:00
Guillaume Wuip
2a76f7c3b3 Allow apps:destroy when not in a project 2016-06-26 14:33:20 +02:00
Jose Diaz-Gonzalez
2b019aef2f Release 0.6.3 2016-06-25 00:16:36 -04:00
Jose Diaz-Gonzalez
7dc6d449bd Minor re-ordering of commands to match our existing doc structure
[ci skip]
2016-06-24 23:57:10 -04:00
Jose Diaz-Gonzalez
a7ec68e107 Move around doc section a bit to clarify what is available.
[ci skip]
2016-06-24 23:38:13 -04:00
Michael Hobbs
3192f9b724 [ci skip] fix missing backtick 2016-06-24 20:30:26 -07:00
Jose Diaz-Gonzalez
3decb4e780 Merge pull request #2266 from dokku/mh-proxy-docs
update docs with info about proxy port mapping default behavior
2016-06-24 23:28:00 -04:00
Jose Diaz-Gonzalez
a1ae7d76f4 Clarify proxy documentation
- note that the port changes on every deploy when the proxy is disabled
- make it clear that the proxy is being disabled for the app
- note that the nginx-vhosts plugin supports the proxy plugin mapping
- minor formatting changes

[ci skip]
2016-06-24 23:22:58 -04:00
Jose Diaz-Gonzalez
47dfde16f5 Use $ to signify bash command prompts
[ci skip]
2016-06-24 23:21:23 -04:00
Jose Diaz-Gonzalez
99632b7141 Link directly to proxy port mapping section
[ci skip]
2016-06-24 23:08:27 -04:00
Jose Diaz-Gonzalez
424827d813 Move ports management section to new section
This clarifies what was added when, and also sets a bit of a divide between the sections.

[ci skip]
2016-06-24 23:07:44 -04:00
Jose Diaz-Gonzalez
b7d1f54bd5 Fix header
[ci skip]
2016-06-24 23:07:05 -04:00
Michael Hobbs
bc93e5da17 [ci skip] update docs with info about proxy port mapping default behavior 2016-06-24 15:06:27 -07:00
Jose Diaz-Gonzalez
71a8142ed9 Merge pull request #2264 from troy/sponsor-links
Use Markdown for sponsors page, so it's clickable from GitHub
2016-06-23 12:45:53 -04:00
Troy Davis
688cb910dd Add newline 2016-06-23 09:45:23 -07:00
Troy Davis
d3b4c49d17 Make sponsors page clickable from GitHub w/Markdown 2016-06-23 09:42:41 -07:00
Jose Diaz-Gonzalez
25422a4a2a Merge pull request #2262 from dokku/josegonzalez-patch-1
Document that REV is optional in the receive-app trigger
2016-06-22 14:40:06 -04:00
Jose Diaz-Gonzalez
62143b1fa1 Document that REV is optional
[ci skip]
2016-06-22 14:39:52 -04:00
Jose Diaz-Gonzalez
a522adfecb Merge pull request #2261 from dokku/josegonzalez-patch-1
Drop apparmor requirement to support systemd systems
2016-06-22 14:37:55 -04:00
Jose Diaz-Gonzalez
83f4df3017 Drop apparmor requirement to support systemd systems
On Debian Jessie, apparmor conflicts with systemd. As we only required it for lxc-docker, dropping the requirement is the best course of action.
2016-06-22 12:16:12 -04:00
Jose Diaz-Gonzalez
3df37bcc99 Merge pull request #2260 from dokku/remove-port-mapping-tuple
Add ability to remove a specific port mapping tuple
2016-06-21 02:09:29 -04:00
Jose Diaz-Gonzalez
4b0163103e Add docs for removing a specific proxy tuple
[ci skip]
2016-06-20 23:19:44 -04:00
Jose Diaz-Gonzalez
bd7deae883 Add ability to remove a specific port mapping tuple
This allows users to specify port 80 after an application has had domain added. Normally, when we first add an extra domain, the following tuple is added:

    http:80:5000

A user might then want to remap port 80 to another port, such as port 8080:

    dokku proxy:ports-add APP http:80:8080

The application would then have the following proxy map:

    http:80:5000 http:80:8080

As nginx vhosts are resolved in FIFO order, the "correct" upstream of 8080 would basically be ignored. The workaround would be to remove the original port mapping, but the following:

    dokku proxy:ports-remove APP 80

Would remove *both* entries and then re-add the default of `http:80:5000`. Thus it was not possible to use the porcelain to correct the port mapping and a user would have to fall back to using the following hack to fix their mapping:

    dokku config:set APP DOKKU_PROXY_PORT_MAP='http:80:8080'

You can now use the previous syntax *as well as* the following to remove a port mapping:

    dokku proxy:ports-remove APP http:80:5000
2016-06-20 23:17:55 -04:00
Jose Diaz-Gonzalez
d4cf23ec07 Merge pull request #2258 from dokku/2257_mh-domains-regex
support domains that start with digits per RFC1123
2016-06-20 22:47:12 -04:00
Jose Diaz-Gonzalez
bdd2b4bfe5 Release 0.6.2 2016-06-20 21:16:21 -04:00
Jose Diaz-Gonzalez
ecd47dcdeb Merge pull request #2259 from andrewsomething/installer-fix
Don't run DeleteInstallerThread() until after set_debconf_selection
2016-06-20 20:21:23 -04:00
Andrew Starr-Bochicchio
3762b7b9f9 Don't run DeleteInstallerThread() until after set_debconf_selection calls. 2016-06-20 19:59:19 -04:00
Michael Hobbs
98ef078d33 support domains that start with digits per RFC1123. closes #2257 2016-06-20 15:01:48 -07:00
Jose Diaz-Gonzalez
a79cd7aebf Merge pull request #2256 from dokku/2254_mh-remove-storage-mount-on-build
Revert automatically binding storage mounts in build phase
2016-06-20 14:50:02 -04:00
Michael Hobbs
aa345fad01 revert automatically binding storage mounts in build phase. closes #2254 2016-06-20 11:39:08 -07:00
Jose Diaz-Gonzalez
ed06b8961e Release 0.6.1 2016-06-18 23:54:00 -04:00
Michael Hobbs
8e2a3783ce Merge pull request #2250 from dokku/mh-fix-nginx-template-context-variable
fix missing $ sign in default nginx template
2016-06-18 16:12:29 -07:00
Michael Hobbs
d9ab4d1424 fix missing $ sign in default nginx template 2016-06-18 16:06:46 -07:00
Jose Diaz-Gonzalez
833db67f25 Release 0.6.0 2016-06-18 01:53:48 -04:00
Jose Diaz-Gonzalez
01f370ab82 Add docs for new repository-related tags
Closes #2249

[ci skip]
2016-06-18 01:31:51 -04:00
Michael Hobbs
9d4a288579 Merge pull request #2242 from dokku/2166-avoid-calling-dokku
Avoid calling dokku binary
2016-06-17 20:24:22 -07:00
Jose Diaz-Gonzalez
b6f9672d40 Add note to plugin creation regarding calling the binary directly
[ci skip]
2016-06-17 23:12:11 -04:00
Jose Diaz-Gonzalez
8f8ee9c5da Add a section on how calling the dokku binary should work
[ci skip]
2016-06-17 23:00:43 -04:00
Michael Hobbs
9effe275bd don't call dokku binary in checks/install. fix variable typo 2016-06-17 19:49:15 -07:00
Michael Hobbs
c1ae280a78 [ci skip] clarify triggers being called by internal functions 2016-06-17 19:30:25 -07:00
Michael Hobbs
ce3aa4b93e remove calls to dokku binary for build/receive/release 2016-06-17 16:40:35 -07:00
Michael Hobbs
fcefd4a29b use central deploy lock in git plugin 2016-06-17 16:16:20 -07:00
Michael Hobbs
4f8c1b64c9 implement central deploy lock and use in tar plugin 2016-06-17 15:58:31 -07:00
Michael Hobbs
2ece0e1bf8 move DOKKU_NGINX_SSL_PORT setting to correct logic block 2016-06-17 15:25:09 -07:00
Jose Diaz-Gonzalez
1216a5e65a Remove use of dokku binary from tar plugin 2016-06-17 13:55:43 -07:00
Jose Diaz-Gonzalez
aca2540651 Move tar functions into sourceable functions file 2016-06-17 13:55:43 -07:00
Jose Diaz-Gonzalez
2cb20f3fd0 Remove use of dokku binary from git plugin 2016-06-17 13:55:43 -07:00
Jose Diaz-Gonzalez
946756bd43 Move git functions into sourceable functions file 2016-06-17 13:55:43 -07:00
Michael Hobbs
d74006b51a Merge pull request #2248 from dokku/2239_mh-proxy-ports
proxy port mapping
2016-06-16 19:48:45 -07:00
Michael Hobbs
e6dfdc0732 fix reference to .SPDY_SUPPORTED in default template 2016-06-16 17:23:35 -07:00
Michael Hobbs
21d0859253 make proxy port listing a callable function 2016-06-16 16:04:44 -07:00
Michael Hobbs
2b19881f01 [ci skip] port mapping docs 2016-06-16 16:04:44 -07:00
Michael Hobbs
39375342e0 add port mapping tests 2016-06-16 16:04:44 -07:00
Michael Hobbs
ab94a9fc67 fix broken tar/urls tests 2016-06-16 16:04:44 -07:00
Michael Hobbs
ff18e0d6be cleanup external references to nginx-vhosts plugin 2016-06-16 16:04:44 -07:00
Michael Hobbs
6c1d6225f9 initial pass at implementing DOKKU_PROXY_PORT_MAP. closes #2239. 2016-06-16 16:04:44 -07:00
Michael Hobbs
99c56ccd6d Merge pull request #2243 from dokku/nginx-fixes
Nginx 1.9.5+ support
2016-06-16 16:02:02 -07:00
Jose Diaz-Gonzalez
f99aa2b128 Skip upgrading nginx when the version of nginx is at least 1.8.0
Refs #2059
2016-06-16 17:18:47 -04:00
Jose Diaz-Gonzalez
a43fc39d9a Support nginx 1.9.5+
Newer versions of nginx drop spdy support in favor of http2, and thus the nginx config that we bundle with dokku causes nginx to fail to reload in certain cases. This change drops spdy support in favor of http2 for versions of nginx greater than 1.9.5.

Closes #2216
2016-06-16 17:18:43 -04:00
Michael Hobbs
6be1fd33cd Merge pull request #2241 from dokku/2146-debconf-set-selections
Set debconf selections from dokku-installer.py. Closes #2146
2016-06-16 12:47:09 -07:00
Michael Hobbs
5e9df3a92d Merge pull request #2168 from dokku/2073_mh-zero-downtime
allow zero-downtime to be completely disabled.
2016-06-16 12:46:30 -07:00
Michael Hobbs
5c741696fc Merge pull request #2109 from dokku/modify-deployed-image
Allow user to modify the repository and tag when deploying an app
2016-06-16 12:43:11 -07:00
Michael Hobbs
8e30722c1e Merge pull request #2050 from dokku/1570-repo-plugin
Implement repo:gc and repo:purge-cache
2016-06-16 12:42:25 -07:00
Michael Hobbs
cd48505922 Merge pull request #2018 from pascalw/feature/dokku-run-from-procfile
Support running Procfile commands using `dokku run`
2016-06-16 12:42:01 -07:00
Jose Diaz-Gonzalez
24cab65d9c Make opencollective badges flat-square
Also move gratipay to same line

[ci skip]
2016-06-15 14:24:01 -04:00
Michael Hobbs
dc8acc0da6 Merge pull request #2209 from piamancini/patch-1
Added backers and sponsors from OpenCollective
2016-06-15 10:42:58 -07:00
Michael Hobbs
0297dd9e1f Merge pull request #2244 from basgys/master
Add InfluxDB to plugins
2016-06-13 07:26:51 -07:00
Bastien
e4268148cf Add InfluxDB to plugins 2016-06-13 09:51:08 +02:00
Jose Diaz-Gonzalez
f226dc7c27 Set debconf selections from dokku-installer.py. Closes #2146 2016-06-12 15:07:42 -04:00
Jose Diaz-Gonzalez
b71c5b668f Release 0.5.8 2016-06-10 22:40:57 -04:00
Michael Hobbs
30ae651a59 Merge pull request #2238 from dokku/2207_mh-storage-on-build
mount storage mounts on build and filter for dockerfile apps
2016-06-10 15:33:45 -07:00
Jose Diaz-Gonzalez
d2ee0994c0 Merge pull request #2233 from dokku/lintian-cleanup
Lintian cleanup
2016-06-10 17:09:55 -04:00
Michael Hobbs
1e5a8b146c Merge pull request #2237 from dokku/2231_mh-reject-invalid-domains
reject invalid domains in domains:add
2016-06-10 13:56:39 -07:00
Michael Hobbs
6bf9ef0aa5 mount storage mounts on build and filter for dockerfile apps. closes #2207 2016-06-10 13:50:53 -07:00
Michael Hobbs
100afca1ca Merge pull request #2236 from dokku/2235_mh-hide-img-check-err-output
no need to show output from is_image_herokuish_based()
2016-06-10 13:18:08 -07:00
Michael Hobbs
9a29cc59a8 reject invalid domains in domains:add. closes #2231 2016-06-10 13:10:11 -07:00
Michael Hobbs
6c08b9b343 no need to show output from is_image_herokuish_based(). closes #2235 2016-06-10 12:31:25 -07:00
Michael Hobbs
48965e05bd add tests for repo commands 2016-06-09 20:05:19 -07:00
Jose Diaz-Gonzalez
2c1f32199a Implement repo:gc and repo:purge-cache
These are helper plugins that mimic the repo plugin: https://github.com/heroku/heroku-repo

The following commands will remain unimplemented:

- `clone`: not useful for the host client to clone
- `download`: currently not possible for us to "host" a tarball of the repo
- `reset`: we still store files in the repo (though we shouldn't) so we cannot easily reinitialize the repository.

Also fixes a potential race condition if two separate processes create an application's `$CACHE_DIR`.

Closes #1570
2016-06-09 20:05:19 -07:00
Michael Hobbs
1e0c585b74 allow zero-downtime to be completely disabled. closes #2073. closes #2125 2016-06-09 18:37:31 -07:00
Michael Hobbs
0c58aeaa52 Merge pull request #2234 from dokku/2230_mh-fix-container-rename-on-remove-proctype
cleanup container state files when proc type is removed from app
2016-06-09 17:56:54 -07:00
Michael Hobbs
2cedc19b2a cleanup container state files when proc type is removed from app. closes #2230 2016-06-09 17:03:36 -07:00
Jose Diaz-Gonzalez
9bb554e5bc Run lintian on all built packages 2016-06-09 15:07:31 -04:00
Jose Diaz-Gonzalez
4aab4dcfcf Allow building non-release (patch) packages for dokku 2016-06-09 15:07:13 -04:00
Jose Diaz-Gonzalez
d4660d9fe9 Skip moving the deb to the correct place by building to /tmp 2016-06-09 14:54:19 -04:00
Jose Diaz-Gonzalez
9a7d4fb402 Call deb-setup once to speed up build process 2016-06-09 14:37:15 -04:00
Jose Diaz-Gonzalez
d302316549 sort mkdir calls 2016-06-09 14:33:13 -04:00
Jose Diaz-Gonzalez
327db3d07a Add build-essential requirement 2016-06-09 14:32:58 -04:00
Jose Diaz-Gonzalez
1cba46f3a1 Do not grep a non-existent file 2016-06-09 14:29:50 -04:00
Jose Diaz-Gonzalez
54c5d0dfa6 ensure help2man exists before running addman 2016-06-09 14:29:21 -04:00
Jose Diaz-Gonzalez
ef59ff38f6 Ignore chown failures
This can occur in build environments where there is no dokku user
2016-06-09 14:29:06 -04:00
Jose Diaz-Gonzalez
683113ef78 Update doc reference to dokku binary 2016-06-09 14:28:35 -04:00
Jose Diaz-Gonzalez
79a7342808 Check that the confmodule is sourceable before sourcing it 2016-06-09 12:48:54 -04:00
Jose Diaz-Gonzalez
eab69bd6d5 Create a lintian-overrides file so that we can pass lintian during testing 2016-06-09 12:41:36 -04:00
Jose Diaz-Gonzalez
b1deb45c81 Rewrite sshcommand calls to take into account potential locations of sshcommand 2016-06-09 12:40:01 -04:00
Michael Hobbs
5ff73995f2 Merge pull request #2229 from vshn/fix_slash_domain_removal
Fix removal of domains with schema
2016-06-08 12:44:47 -07:00
Michael Hanselmann
e0f6435d86 Fix removal of domains with schema
In at least one case a customer of ours added a domain including
a schema, as in “http://domain.tld/”. That is obviously incorrect, but
then they couldn't remove it using the dokku command:

  $ dokku domains:remove app7 http://domain.tld/
  sed: -e expression #1, char 9: unknown command: `/'

This patch changes the sed command to use the "\CregexpC" syntax. The
character used is a vertical pipe, which is far less likely to be used
in a URL. After the change:

  $ dokku domains:remove app7 http://domain.tld/
  -----> Removed http://domain.tld/ from app7

Signed-off-by: Michael Hanselmann <hansmi@vshn.ch>
2016-06-08 11:34:30 +02:00
Michael Hobbs
2565ea1543 Merge pull request #2228 from dokku/mh-copy-scale-file-from-workdir
support WORKDIR location for DOKKU_SCALE
2016-06-06 18:26:05 -07:00
Michael Hobbs
cb8a9648c9 support WORKDIR location for DOKKU_SCALE. refs #2226 2016-06-06 17:45:33 -07:00
Michael Hobbs
17f7708226 Merge pull request #2227 from dokku/2226_mh-extract-procfile-with-tags
pass image tag from release_and_deploy down through extract_procfile
2016-06-06 16:55:38 -07:00
Michael Hobbs
166f7f38e4 pass image tag from release_and_deploy down through extract_procfile. closed #2226 2016-06-06 11:31:59 -07:00
Michael Hobbs
74e861417e Merge pull request #2220 from dokku/josegonzalez-patch-1
remove DOKKU_PROCFILE before attempting to extract it
2016-06-03 10:16:52 -07:00
Jose Diaz-Gonzalez
0487083f37 Merge pull request #2223 from dokku/jg-nginx-vhosts
De-duplicate nginx restarting
2016-06-03 12:49:58 -04:00
Jose Diaz-Gonzalez
3c6982a942 De-duplicate restart_nginx in post-delete hook 2016-06-03 03:19:26 -04:00
Michael Hobbs
6760a2d143 Merge pull request #2222 from dokku/mh-reorder-nginx-blocks-in-docs
move nginx upstream blocks to the bottom in docs examples
2016-06-02 13:01:25 -07:00
Michael Hobbs
a9fd2cdbf6 [ci skip] move nginx upstream blocks to the bottom in docs examples 2016-06-02 13:00:39 -07:00
Jose Diaz-Gonzalez
377412f9f8 remove DOKKU_PROCFILE before attempting to extract it 2016-05-31 17:02:25 -04:00
Michael Hobbs
848f92ef7f Merge pull request #2214 from dokku/2210_mh-client-remove-git-push
remove git push from client
2016-05-26 18:04:16 -07:00
Michael Hobbs
8bbb210a10 remove git push from client. closes #2210 2016-05-26 15:32:41 -07:00
Jose Diaz-Gonzalez
401a42f5c4 Merge pull request #2212 from jbothma/unsafe-installer-docs
Warn and instruct users about unsafe publicly-accessible web installer
2016-05-25 11:41:09 -04:00
JD Bothma
5a99b8f0ed Warn and instruct users about unsafe publicly-accessible web installer
Addresses #2211
2016-05-25 14:07:48 +02:00
Pia Mancini
346efbfdd8 removed plus signs 2016-05-23 15:27:45 -07:00
Pia Mancini
498f0eda22 Added backers and sponsors from OpenCollective
Now, your backers & sponsors from open collective will appear automatically here.
2016-05-23 14:58:14 -07:00
Jose Diaz-Gonzalez
c268432bc3 Merge pull request #2205 from dokku/fix-lintian-errors
Fix lintian errors
2016-05-18 16:52:28 -04:00
Jose Diaz-Gonzalez
a833688355 Allow users to override their server_names_hash_bucket_size 2016-05-18 14:45:11 -04:00
Jose Diaz-Gonzalez
4917330b79 Make bash files executable 2016-05-18 14:12:40 -04:00
Jose Diaz-Gonzalez
4d91b2085e Add extended description to dokku package 2016-05-18 14:11:06 -04:00
Jose Diaz-Gonzalez
29c69f9f86 Move dokku binary to /usr/bin from /usr/local/bin 2016-05-18 14:10:45 -04:00
Jose Diaz-Gonzalez
476429a7db Remove stray DS_Store files from package 2016-05-18 14:10:27 -04:00
Jose Diaz-Gonzalez
2d045d1ae1 Update sponsor references 2016-05-18 14:03:11 -04:00
Jose Diaz-Gonzalez
9bd0c69dac Do not peg nginx to a specific version 2016-05-18 13:56:09 -04:00
Jose Diaz-Gonzalez
b232f7cd49 Fix description lintian issue in plugn, sshcommand and sigil 2016-05-18 13:53:30 -04:00
Jose Diaz-Gonzalez
904dfb64aa Pass more lintian rules in sshcommand package 2016-05-18 13:42:47 -04:00
Jose Diaz-Gonzalez
a5ef53f2f5 Pass more lintian rules in plugn package 2016-05-18 13:37:23 -04:00
Jose Diaz-Gonzalez
88db4daa62 Install lintian so built packages can be linted 2016-05-18 13:28:33 -04:00
Jose Diaz-Gonzalez
56dde3ff31 Rename sigil package to gliderlabs-sigl
Also fix a few lintian issues
2016-05-18 13:28:02 -04:00
Jose Diaz-Gonzalez
2da58ff351 Release 0.5.7 2016-05-17 03:15:27 -04:00
Jose Diaz-Gonzalez
af48605054 Merge pull request #2203 from dokku/josegonzalez-patch-1
Allow specifying NO_INSTALL_RECOMMENDS in bootstrapped installs
2016-05-17 03:02:45 -04:00
Jose Diaz-Gonzalez
66790e3d82 Allow specifying NO_INSTALL_RECOMMENDS in bootstrapped installs
[ci skip]
2016-05-17 03:02:17 -04:00
Michael Hobbs
2c201a7d6f Merge pull request #2202 from dokku/2197_mh-nginx-install
attempt to bypass inconsistencies in nginx start behavior
2016-05-16 14:57:44 -07:00
Michael Hobbs
78d2b3e7d2 attempt to bypass inconsistencies in nginx start behavior. closes #2197 2016-05-16 13:29:16 -07:00
Jose Diaz-Gonzalez
9b60f0c3c6 Merge pull request #2195 from dokku/2179-clarify-triggers
Clarify when certain plugin triggers are invoked.
2016-05-14 15:05:08 -04:00
Jose Diaz-Gonzalez
668437a9e5 Clarify when certain plugin triggers are invoked.
Closes #2179

[ci skip]
2016-05-14 15:04:47 -04:00
Jose Diaz-Gonzalez
5f30115796 Merge pull request #2194 from dokku/2158-procfile-docs
Clarify the role of process types for buildpack deployment
2016-05-14 14:54:11 -04:00
Jose Diaz-Gonzalez
5c6e39d2c0 Clarify the role of process types for buildpack deployment
Closes #2158

[ci skip]
2016-05-14 14:53:46 -04:00
Jose Diaz-Gonzalez
6a9d9f212f Merge pull request #2193 from dokku/deb-upgrade-herokuish
Upgrade herokuish version built via deb packaging
2016-05-14 14:39:29 -04:00
Jose Diaz-Gonzalez
599bd59c6f Upgrade herokuish version built via deb packaging
[ci skip]
2016-05-14 14:38:51 -04:00
Jose Diaz-Gonzalez
e4dd40bbcc Merge pull request #2192 from dokku/2186-checks-web
Clarify that the checks are only run against the web process
2016-05-14 14:37:13 -04:00
Jose Diaz-Gonzalez
325b9258e4 Clarify that the checks are only run against the web process
Closes #2186

[ci skip]
2016-05-14 14:36:53 -04:00
Jose Diaz-Gonzalez
8cef6b2074 Merge pull request #2191 from dokku/2041-upgrade-docs
Clarify upgrade docs for bootstrap.sh installations
2016-05-14 14:29:34 -04:00
Jose Diaz-Gonzalez
fe00835aa7 clarify what happens when installing via the bootstrap.sh file
Closes #2041

[ci skip]
2016-05-14 14:28:46 -04:00
Jose Diaz-Gonzalez
ad0d2b1f6d Remove unused contents from docs/index.md
[ci skip]
2016-05-14 14:28:46 -04:00
Jose Diaz-Gonzalez
c27b0c08ed Merge pull request #2187 from pltchuong/patch-1
Update plugin-triggers.md
2016-05-14 11:51:26 -04:00
Jose Diaz-Gonzalez
c73094615e Merge pull request #2175 from dokku/2174_mh-dokku-enter-errmsg
show available types and ids on dokku enter error
2016-05-13 14:30:45 -04:00
Phan Chuong
989ea72490 Update plugin-triggers.md 2016-05-13 09:05:11 -07:00
Michael Hobbs
d9e1548683 Merge pull request #2190 from cu12/add-elasticmq-plugin
Add ElasticMQ plugin to documentation
2016-05-13 07:48:14 -07:00
Domonkos Czinke
e474d49320 Remove newline 2016-05-13 14:45:20 +02:00
Domonkos Czinke
e4d916c308 Add ElasticMQ plugin to documentation 2016-05-13 14:39:52 +02:00
Phan Chuong
e30c01c234 Update plugin-triggers.md
add missing trigger
2016-05-12 20:53:51 -07:00
Michael Hobbs
9ae9c7ad11 Merge pull request #2183 from Epigene/patch-2
Update nginx.md
2016-05-12 08:48:11 -07:00
Augusts Bautra
ea240f117e Update nginx.md
In the spirit of discoverability and least surprise, primary custom template example mirrors nginx.conf generated by default.
2016-05-12 18:45:07 +03:00
Michael Hobbs
68fb0e7b98 Merge pull request #2182 from cu12/add-fake_sns-plugin
Add link to FakeSNS plugin
2016-05-12 06:12:53 -07:00
Domonkos Czinke
9d74f1ecf2 Add FakeSNS plugin to documentation 2016-05-12 14:52:36 +02:00
Michael Hobbs
2356dbd594 make buggy docker-options test consistent 2016-05-11 17:53:12 -07:00
Michael Hobbs
7aa48d3426 enter default container type if only a single type is running 2016-05-11 16:40:10 -07:00
Michael Hobbs
b8b4f6fedf show available types and ids on dokku enter error. closes #2174 2016-05-11 13:12:07 -07:00
Michael Hobbs
25a2801cb1 Merge pull request #2170 from jvanbaarsen/dont-fail-duplicated-domain
Dont fail when adding a duplicated domain
2016-05-10 14:06:04 -07:00
Jeroen van Baarsen
86ef6ae5d1 Make sure we shift by 1 to remove the app_name from the $@ var 2016-05-10 21:31:53 +02:00
Michael Hobbs
4e99078ac1 Merge pull request #2173 from dokku/2171_mh-test-restore
add test for ps:restore with undeployed app
2016-05-10 10:53:41 -07:00
Michael Hobbs
7de160b64d add test for ps:restore with undeployed app. refs #2171 2016-05-10 09:30:55 -07:00
Michael Hobbs
99030a110c Merge pull request #2171 from vshn/fix_apprestore_on_boot
allow all apps to be restored on boot
2016-05-10 08:14:05 -07:00
Tobias Brunner
ee18909935 allow all apps to be restored on boot
When rebooting a Dokku host the init process tries to restore all apps
using `dokku ps:restore`, alphabetically. If an app is defined but not
deployed, the function `ps_start` called by `dokku ps:restore` will
exit 0 and stop trying to restore the other apps later in the alphabet.
This change fixes the restore behaviour.
2016-05-10 11:41:25 +02:00
Jeroen van Baarsen
4f621916a7 Dont fail when adding a duplicated domain
Currently we exit when trying to add a duplicated domain, even if we give a list
of domain names. This behaviour is not as it suppose to work.

**Expected behaviour**
When adding a domain, and the domain already exists, just skip that domain, and
continue with the world. This is no problem since we are already in the state we
want to be in.

**New behaviour**
When you try to add a domain that is already added, we notify the user of this
by showing a log message: `Skipping: example.com already added to example app`,
and then we continue with the list of domain names.

Fixes #2165
2016-05-10 08:58:15 +02:00
Jose Diaz-Gonzalez
f89f946c40 Merge pull request #2167 from iloveitaly/rollbar-plugin
Adding link to rollbar plugin
2016-05-09 12:53:15 -04:00
Michael Bianco
8e34477c96 Adding link to rollbar plugin 2016-05-09 12:41:57 -04:00
Jose Diaz-Gonzalez
5940e43c85 Merge pull request #2164 from iloveitaly/additional-plugins
Adding longtimeout and hostname to dokku plugin list
2016-05-07 20:56:41 -04:00
Michael Bianco
c1c76362e7 Adding longtimeout and hostname to dokku plugin list 2016-05-07 17:53:06 -04:00
Michael Hobbs
a034ec9803 Merge pull request #2163 from dokku/2153_mh-extract-ports-from-image
support deployment of arbitrary docker images not built by dokku build
2016-05-06 12:08:58 -07:00
Michael Hobbs
2da4f5ef03 [ci skip] clarify how we get ports when deploying an arbitrary image 2016-05-06 11:45:58 -07:00
Michael Hobbs
d7386317fc support deployment of arbitrary docker images not built by dokku build. closes #2153 2016-05-06 11:30:22 -07:00
Michael Hobbs
851ca592d5 Merge pull request #2157 from dokku/mh-run-detached-test
test detached container is running
2016-05-03 12:14:23 -07:00
Michael Hobbs
9d584ed145 test detached container is running 2016-05-03 08:22:49 -07:00
Jose Diaz-Gonzalez
ac1c4dc571 Merge pull request #2155 from dokku/detached-run
Add the ability to run containers in detached mode
2016-05-03 10:53:45 -04:00
Jose Diaz-Gonzalez
32505b14e7 Update HISTORY.md 2016-05-02 21:12:01 -04:00
Jose Diaz-Gonzalez
1bcd76ffe9 Add detached run tests 2016-05-02 21:11:28 -04:00
Jose Diaz-Gonzalez
565cd5c0e8 Update one-off-processes.md
[ci skip]
2016-05-02 12:37:49 -04:00
Jose Diaz-Gonzalez
8597b692ee Add the ability to run containers in detached mode 2016-05-02 00:02:37 -04:00
Jose Diaz-Gonzalez
d7566daacc Allow user to modify the repository and tag when deploying an app
Uses two new plugin triggers:

- deployed-app-repository
- deployed-app-image-tag

Useful when the image is a custom tagged image on a remote repository
2016-04-16 08:35:18 -04:00
Pascal Widdershoven
f073ebe4cd Cleanup Procfile after using it in dokku run 2016-03-24 08:47:49 +01:00
Pascal Widdershoven
5bc3e14eb4 Silence extract_profile logging output in dokku run 2016-03-24 07:36:48 +01:00
Pascal Widdershoven
6548cc4477 Update test to not depend on passing named arguments via Herokuish
There may be a bug in Herokuish that messes up with quoted named
arguments, see discussion in
https://github.com/dokku/dokku/pull/2018
2016-03-24 07:34:43 +01:00
Pascal Widdershoven
e64daa18cf First stab at dokku run Procfile shorthand 2016-03-23 21:36:50 +01:00
149 changed files with 2872 additions and 1160 deletions

View File

@@ -1,8 +1,160 @@
# History
## 0.6.4
Included in this release are a couple of bug fixes for existing features.
Thanks to all the contributors who helped with this release!
### Bug Fixes
- #2275: @sseemayer Prefer file import in certs:add if files given
- #2279: @michaelshobbs Only attempt to stop a checks-disabled container if it is actually running
### New Features
- #2270: @guillaumewuip Allow apps:destroy when not in a project
- #2271: @josegonzalez Handle purging the dokku user, group, and logs directory during `apt-get purge`
### Documentation
- #2272: @josegonzalez Add documentation surrounding when the /app/.env file is populated
## 0.6.3
This release is mostly a documentation release.
Thanks to all the contributors who helped with this release!
### Bug Fixes
- #2258: @michaelshobbs Support domains that start with digits per RFC1123
### New Features
- #2260: @josegonzalez Add ability to remove a specific port mapping tuple
- #2261: @josegonzalez Drop apparmor requirement to support systemd systems
### Documentation
- #2262: @josegonzalez Document that REV is optional in the receive-app trigger
- #2264: @troy Use Markdown for sponsors page, so it's clickable from GitHub
- #2266: @michaelshobbs Add documentation surrounding proxy port mapping
## 0.6.2
This release is a minor bugfix for the web setup, and also reverts a previous addition to the persistent storage. Please see the pull requests for more details.
Thanks to all the contributors who helped with this release!
### Bug Fixes
- #2256: @michaelshobbs Revert automatically binding storage mounts in build phase
- #2259: @andrewsomething Don't run DeleteInstallerThread() until after set_debconf_selection
## 0.6.1
This release is a minor bugfix to fix an issue with ssl support for spdy-enabled nginx servers. Users are encouraged to upgrade if they have an older version of nginx installed.
### Bug Fixes
- #2250: @michaelshobbs Fix missing $ sign in default nginx template
## 0.6.0
The big-six-o. This release is largely comprised of new features that should allow for easier management of dokku. The highlights of this release are:
- The proxy plugin has been enhanced to allow users to map container ports to host ports. In the 0.5.0 release, we changed the semantics of how Dockerfile `EXPOSE` calls work to better follow Docker's lead, which ended up breaking how some applications were deployed to dokku. Please read our documentation surrounding [port management](http://dokku.viewdocs.io/dokku/proxy/) for more details.
- Zero-downtime deploys can be disabled on a per-app and per-process basis. This can be used to speed up deploys when there are non-web processes being deployed, or when a user wishes to completely avoid any such waiting period. Please see the [checks documentation](http://dokku.viewdocs.io/dokku/checks-examples/) for further information.
Thanks to all the contributors who helped with this release, and a special thanks to @michaelshobbs for ferrying the majority of our new functionality to it's current state!
### Bug Fixes
- #2241: @josegonzalez Set debconf selections from dokku-installer.py
- #2242: @michaelshobbs Avoid calling dokku binary
- #2243: @josegonzalez Nginx 1.9.5+ support
### New Features
- #2018: @pascalw Support running Procfile commands using `dokku run`
- #2050: @josegonzalez Implement repo:gc and repo:purge-cache
- #2109: @josegonzalez Allow user to modify the repository and tag when deploying an app
- #2168: @michaelshobbs Allow zero-downtime deploys to be completely disabled
- #2248: @michaelshobbs Allow users to map container ports to host ports via the proxy plugin
### Documentation
- #2209: @piamancini Added backers and sponsors from OpenCollective
- #2244: @basgys Add InfluxDB to plugins
## 0.5.8
This release is the last release in the `0.5.x` series, and as such is mainly a bugfix release. Users are highly encouraged to upgrade to this release *before* moving to the upcoming `0.6.x` release, as we will be removing deprecated features at that point.
Thanks to all the contributors who helped with this release!
### Bug Fixes
- #2214: @michaelshobbs Remove git push from client
- #2220: @josegonzalez Remove DOKKU_PROCFILE before attempting to extract it
- #2227: @michaelshobbs Pass image tag from release_and_deploy down through extract_procfile
- #2228: @michaelshobbs Support WORKDIR location for DOKKU_SCALE
- #2229: @hansmi Fix removal of domains with schema
- #2234: @michaelshobbs Cleanup container state files when a process type is removed from app
- #2236: @michaelshobbs Hide unnecessary output from is_image_herokuish_based()
- #2233: @josegonzalez Lintian cleanup
### New Features
- #2205: @josegonzalez Fix lintian errors in built debian packages
- #2223: @josegonzalez De-duplicate nginx restarting
- #2237: @michaelshobbs Reject invalid domains in domains:add
- #2238: @michaelshobbs Mount storage mounts on build for buildpack deploys
### Documentation
- #2212: @jbothma Warn and instruct users about unsafe publicly-accessible web installer
- #2222: @michaelshobbs Move nginx upstream blocks to the bottom in docs examples
## 0.5.7
0.5.7 includes quite a few documentation updates, and a few minor changes in how we handle certain edge-cases in day-to-day dokku tasks.
Thanks to all the contributors who helped with this release!
### Bug Fixes
- #2157: @michaelshobbs test detached container is running
- #2170: @jvanbaarsen Do not fail domains:add when adding a duplicated domain
- #2171: @tobru Continue to restore applications during boot when any given application does not start
- #2173: @michaelshobbs Add test for ps:restore with undeployed app
- #2202: @michaelshobbs Attempt to bypass inconsistencies in nginx start behavior
### New Features
- #2155: @josegonzalez Add the ability to run containers in detached mode
- #2163: @michaelshobbs Support deployment of arbitrary docker images not built by dokku build
- #2175: @michaelshobbs Show available types and ids on dokku enter error
- #2193: @josegonzalez Upgrade herokuish version built via deb packaging
- #2203: Allow specifying NO_INSTALL_RECOMMENDS via DOKKU_NO_INSTALL_RECOMMENDS in bootstrapped installs
### Documentation
- #2164: @iloveitaly Adding longtimeout and hostname to dokku plugin list
- #2167: @iloveitaly Adding link to rollbar plugin
- #2182: @cu12 Add link to FakeSNS plugin
- #2183: @Epigene Update nginx docs to mirror generated nginx.conf from core
- #2187: @pltchuong Add missing trigger to plugin triggers documentation
- #2190: @cu12 Add ElasticMQ plugin to documentation
- #2191: @josegonzalez Clarify upgrade docs for bootstrap.sh installations
- #2192: @josegonzalez Clarify that the checks are only run against the web process
- #2194: @josegonzalez Clarify the role of process types for buildpack deployment
- #2195: @josegonzalez Clarify when certain plugin triggers are invoked
## 0.5.6
Release 0.5.5 is mostly a documentation release. Please note, however, that we now inject application environment variables into sigil-generated nginx configurations. You can use this to further improve your generated nginx configuration files.
Release 0.5.6 is mostly a documentation release. Please note, however, that we now inject application environment variables into sigil-generated nginx configurations. You can use this to further improve your generated nginx configuration files.
Thanks to all the contributors who helped with this release!

View File

@@ -62,10 +62,10 @@ copyfiles:
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\
done
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH}
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true
$(MAKE) addman
addman:
addman: help2man
mkdir -p /usr/local/share/man/man1
help2man -Nh help -v version -n "configure and get information from your dokku installation" -o /usr/local/share/man/man1/dokku.1 dokku
mandb

View File

@@ -1,6 +1,9 @@
# Dokku [![Build Status](https://img.shields.io/circleci/project/dokku/dokku/master.svg?style=flat-square "Build Status")](https://circleci.com/gh/dokku/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?style=flat-square "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) [![Slack Group](https://img.shields.io/badge/irc-slack-blue.svg?style=flat-square "Slack Group")](https://glider-slackin.herokuapp.com/) [![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://dokku.viewdocs.io/dokku/) [![Gratipay](https://img.shields.io/gratipay/dokku.svg?style=flat-square)](https://gratipay.com/dokku/)
# Dokku [![Build Status](https://img.shields.io/circleci/project/dokku/dokku/master.svg?style=flat-square "Build Status")](https://circleci.com/gh/dokku/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?style=flat-square "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) [![Slack Group](https://img.shields.io/badge/irc-slack-blue.svg?style=flat-square "Slack Group")](https://glider-slackin.herokuapp.com/) [![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://dokku.viewdocs.io/dokku/)
[![OpenCollective](https://opencollective.com/dokku/sponsors/badge.svg?style=flat-square)](#sponsors)
[![OpenCollective](https://opencollective.com/dokku/backers/badge.svg?style=flat-square)](#backers)
[![Gratipay](https://img.shields.io/gratipay/dokku.svg?style=flat-square)](https://gratipay.com/dokku/)
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
## Requirements
@@ -10,8 +13,8 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
To install the latest stable release, you can run the following commands as a user that has access to `sudo`:
wget https://raw.githubusercontent.com/dokku/dokku/v0.5.6/bootstrap.sh
sudo DOKKU_TAG=v0.5.6 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.6.4/bootstrap.sh
sudo DOKKU_TAG=v0.6.4 bash bootstrap.sh
### Upgrading
@@ -33,7 +36,76 @@ While we may not merge your PR as is, they serve to start conversations and impr
## Sponsors
Dokku is currently sponsored by the enterprise grade, multi-host PaaS project [Deis](http://deis.io/).
See our list of past sponsors in the [SPONSORS](https://github.com/dokku/dokku/blob/master/SPONSORS) file.
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/dokku#sponsor)]
<a href="https://opencollective.com/dokku/sponsor/0/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/1/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/2/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/3/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/4/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/5/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/6/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/7/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/8/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/9/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/10/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/11/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/12/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/13/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/14/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/15/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/16/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/17/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/18/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/19/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/20/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/21/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/22/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/23/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/24/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/25/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/26/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/27/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/28/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/29/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/29/avatar.svg"></a>
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/dokku#backer)]
<a href="https://opencollective.com/dokku/backer/0/website" target="_blank"><img src="https://opencollective.com/dokku/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/1/website" target="_blank"><img src="https://opencollective.com/dokku/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/2/website" target="_blank"><img src="https://opencollective.com/dokku/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/3/website" target="_blank"><img src="https://opencollective.com/dokku/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/4/website" target="_blank"><img src="https://opencollective.com/dokku/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/5/website" target="_blank"><img src="https://opencollective.com/dokku/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/6/website" target="_blank"><img src="https://opencollective.com/dokku/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/7/website" target="_blank"><img src="https://opencollective.com/dokku/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/8/website" target="_blank"><img src="https://opencollective.com/dokku/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/9/website" target="_blank"><img src="https://opencollective.com/dokku/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/10/website" target="_blank"><img src="https://opencollective.com/dokku/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/11/website" target="_blank"><img src="https://opencollective.com/dokku/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/12/website" target="_blank"><img src="https://opencollective.com/dokku/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/13/website" target="_blank"><img src="https://opencollective.com/dokku/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/14/website" target="_blank"><img src="https://opencollective.com/dokku/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/15/website" target="_blank"><img src="https://opencollective.com/dokku/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/16/website" target="_blank"><img src="https://opencollective.com/dokku/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/17/website" target="_blank"><img src="https://opencollective.com/dokku/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/18/website" target="_blank"><img src="https://opencollective.com/dokku/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/19/website" target="_blank"><img src="https://opencollective.com/dokku/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/20/website" target="_blank"><img src="https://opencollective.com/dokku/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/21/website" target="_blank"><img src="https://opencollective.com/dokku/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/22/website" target="_blank"><img src="https://opencollective.com/dokku/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/23/website" target="_blank"><img src="https://opencollective.com/dokku/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/24/website" target="_blank"><img src="https://opencollective.com/dokku/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/25/website" target="_blank"><img src="https://opencollective.com/dokku/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/26/website" target="_blank"><img src="https://opencollective.com/dokku/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/27/website" target="_blank"><img src="https://opencollective.com/dokku/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/28/website" target="_blank"><img src="https://opencollective.com/dokku/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/dokku/backer/29/website" target="_blank"><img src="https://opencollective.com/dokku/backer/29/avatar.svg"></a>
## License

View File

@@ -1,2 +0,0 @@
Deis http://deis.io
DigitalOcean https://www.digitalocean.com/

3
SPONSORS.md Normal file
View File

@@ -0,0 +1,3 @@
[Deis](http://deis.io)
[DigitalOcean](https://www.digitalocean.com/)

2
Vagrantfile vendored
View File

@@ -82,7 +82,7 @@ Vagrant::configure("2") do |config|
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
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 deb-all"
vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all"
end
config.vm.define "build-arch", autostart: false do |vm|

View File

@@ -85,7 +85,7 @@ install-dokku-from-source() {
install-dokku-from-package() {
local DOKKU_CHECKOUT="$1"
local NO_INSTALL_RECOMMENDS=""
local NO_INSTALL_RECOMMENDS=${DOKKU_NO_INSTALL_RECOMMENDS:=""}
if [[ -n $DOKKU_DOCKERFILE ]]; then
NO_INSTALL_RECOMMENDS=" --no-install-recommends "

View File

@@ -9,7 +9,7 @@ import subprocess
import sys
import threading
VERSION = 'v0.5.6'
VERSION = 'v0.6.4'
hostname = ''
try:
@@ -86,8 +86,10 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
'REQUEST_METHOD': 'POST',
'CONTENT_TYPE': self.headers['Content-Type']})
vhost_enable = 'false'
dokku_root = os.getenv('DOKKU_ROOT', '/home/dokku')
if 'vhost' in params and params['vhost'].value == 'true':
vhost_enable = 'true'
with open('{0}/VHOST'.format(dokku_root), 'w') as f:
f.write(params['hostname'].value)
else:
@@ -98,7 +100,6 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open('{0}/HOSTNAME'.format(dokku_root), 'w') as f:
f.write(params['hostname'].value)
command = ['sshcommand', 'acl-add', 'dokku', 'admin']
for key in params['keys'].value.split("\n"):
proc = subprocess.Popen(command, stdin=subprocess.PIPE)
@@ -106,6 +107,11 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
proc.stdin.close()
proc.wait()
set_debconf_selection('boolean', 'skip_key_file', 'true')
set_debconf_selection('boolean', 'vhost_enable', vhost_enable)
set_debconf_selection('boolean', 'web_config', 'false')
set_debconf_selection('string', 'hostname', params['hostname'].value)
if 'selfdestruct' in sys.argv:
DeleteInstallerThread()
@@ -114,6 +120,28 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
self.wfile.write(json.dumps({'status': 'ok'}))
def set_debconf_selection(debconf_type, key, value):
found = False
with open('/etc/os-release', 'r') as f:
for line in f:
if 'debian' in line:
found = True
if not found:
return
ps = subprocess.Popen(['echo', 'dokku dokku/{0} {1} {2}'.format(
key, debconf_type, value
)], stdout=subprocess.PIPE)
try:
subprocess.check_output(['debconf-set-selections'], stdin=ps.stdout)
except subprocess.CalledProcessError:
pass
ps.wait()
class DeleteInstallerThread(object):
def __init__(self, interval=1):
thread = threading.Thread(target=self.run, args=())

View File

@@ -33,6 +33,14 @@ client_help_msg() {
exit 20 # exit with specific status. only used in units tests for now
}
is_git_repo() {
git rev-parse &>/dev/null
}
has_dokku_remote() {
git remote show | grep dokku
}
if [[ -z $DOKKU_HOST ]]; then
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
@@ -79,11 +87,9 @@ if [[ ! -z $DOKKU_HOST ]]; then
echo "! Dokku remote not added! Do you already have a dokku remote?"
return
fi
git push dokku master
return $?
;;
apps:destroy)
git remote remove dokku
is_git_repo && has_dokku_remote && git remote remove dokku
;;
esac

107
deb.mk
View File

@@ -1,6 +1,6 @@
HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
HEROKUISH_REPO_NAME ?= gliderlabs/herokuish
HEROKUISH_VERSION ?= 0.3.12
HEROKUISH_VERSION ?= 0.3.13
HEROKUISH_ARCHITECTURE = amd64
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
@@ -8,27 +8,50 @@ DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash'
DOKKU_REPO_NAME ?= dokku/dokku
DOKKU_ARCHITECTURE = amd64
PLUGN_DESCRIPTION = 'Hook system that lets users extend your application with plugins'
define PLUGN_DESCRIPTION
Hook system that lets users extend your application with plugins
Plugin triggers are simply scripts that are executed by the system.
You can use any language you want, so long as the script is
executable and has the proper language requirements installed
endef
PLUGN_REPO_NAME ?= dokku/plugn
PLUGN_VERSION ?= 0.2.1
PLUGN_ARCHITECTURE = amd64
PLUGN_PACKAGE_NAME = plugn_$(PLUGN_VERSION)_$(PLUGN_ARCHITECTURE).deb
PLUGN_URL = https://github.com/dokku/plugn/releases/download/v$(PLUGN_VERSION)/plugn_$(PLUGN_VERSION)_linux_x86_64.tgz
SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app'
define SSHCOMMAND_DESCRIPTION
Turn SSH into a thin client specifically for your app
Simplifies running a single command over SSH, and
manages authorized keys (ACL) and users in order to do so.
endef
SSHCOMMAND_REPO_NAME ?= dokku/sshcommand
SSHCOMMAND_VERSION ?= 0.4.0
SSHCOMMAND_ARCHITECTURE = amd64
SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v$(SSHCOMMAND_VERSION)/sshcommand
SIGIL_DESCRIPTION = 'Standalone string interpolator and template processor'
define SIGIL_DESCRIPTION
Standalone string interpolator and template processor
Sigil is a command line tool for template processing
and POSIX-compliant variable expansion. It was created
for configuration templating, but can be used for any
text processing.
endef
SIGIL_REPO_NAME ?= gliderlabs/sigil
SIGIL_VERSION ?= 0.4.0
SIGIL_ARCHITECTURE = amd64
SIGIL_PACKAGE_NAME = sigil_$(SIGIL_VERSION)_$(SIGIL_ARCHITECTURE).deb
SIGIL_PACKAGE_NAME = gliderlabs_sigil_$(SIGIL_VERSION)_$(SIGIL_ARCHITECTURE).deb
SIGIL_URL = https://github.com/gliderlabs/sigil/releases/download/v$(SIGIL_VERSION)/sigil_$(SIGIL_VERSION)_Linux_x86_64.tgz
ifndef IS_RELEASE
IS_RELEASE = true
endif
export PLUGN_DESCRIPTION
export SIGIL_DESCRIPTION
export SSHCOMMAND_DESCRIPTION
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-plugn deb-setup deb-sshcommand deb-sigil
install-from-deb:
@@ -45,18 +68,18 @@ install-from-deb:
sudo apt-get update -qq > /dev/null
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -yy dokku
deb-all: deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil
deb-all: deb-setup deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil
mv /tmp/*.deb .
@echo "Done"
deb-setup:
@echo "-> Updating deb repository and installing build requirements"
@sudo apt-get update -qq > /dev/null
@sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y gcc git ruby-dev ruby1.9.1 > /dev/null 2>&1
@sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y gcc git build-essential wget ruby-dev ruby1.9.1 lintian > /dev/null 2>&1
@command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
@ssh -o StrictHostKeyChecking=no git@github.com || true
deb-herokuish: deb-setup
deb-herokuish:
rm -rf /tmp/tmp /tmp/build $(HEROKUISH_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
@@ -83,19 +106,21 @@ deb-herokuish: deb-setup
sudo fpm -t deb -s dir -C /tmp/build -n herokuish -v $(HEROKUISH_VERSION) -a $(HEROKUISH_ARCHITECTURE) -p $(HEROKUISH_PACKAGE_NAME) --deb-pre-depends 'docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1)' --deb-pre-depends sudo --after-install /tmp/tmp/post-install --url "https://github.com/$(HEROKUISH_REPO_NAME)" --description $(HEROKUISH_DESCRIPTION) --license 'MIT License' .
mv *.deb /tmp
deb-dokku: deb-setup
deb-dokku:
rm -rf /tmp/tmp /tmp/build dokku_*_$(DOKKU_ARCHITECTURE).deb
mkdir -p /tmp/tmp /tmp/build
cp -r debian /tmp/build/DEBIAN
mkdir -p /tmp/build/usr/local/bin
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
mkdir -p /tmp/build/usr/share/man/man1
mkdir -p /tmp/build/usr/share/dokku/contrib
mkdir -p /tmp/build/usr/bin
mkdir -p /tmp/build/usr/share/doc/dokku
mkdir -p /tmp/build/usr/share/dokku/contrib
mkdir -p /tmp/build/usr/share/lintian/overrides
mkdir -p /tmp/build/usr/share/man/man1
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
cp dokku /tmp/build/usr/local/bin
cp dokku /tmp/build/usr/bin
cp LICENSE /tmp/build/usr/share/doc/dokku/copyright
find . -name ".DS_Store" -depth -exec rm {} \;
cp -r plugins/* /tmp/build/var/lib/dokku/core-plugins/available
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/core-plugins/available/$$plugin/.core; done
$(MAKE) help2man
@@ -105,24 +130,38 @@ deb-dokku: deb-setup
cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib
git describe --tags > /tmp/build/var/lib/dokku/VERSION
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
ifneq (,$(findstring false,$(IS_RELEASE)))
sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
endif
rm /tmp/build/DEBIAN/lintian-overrides
mv debian/lintian-overrides /tmp/build/usr/share/lintian/overrides/dokku
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
sed -i "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control
dpkg-deb --build /tmp/build "/vagrant/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
mv *.deb /tmp
dpkg-deb --build /tmp/build "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
lintian "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
deb-plugn: deb-setup
deb-plugn:
rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/plugn-$(PLUGN_VERSION).tgz $(PLUGN_URL)
cd /tmp/tmp/ && tar zxf /tmp/tmp/plugn-$(PLUGN_VERSION).tgz
@echo "-> Copying files into place"
cp /tmp/tmp/plugn /tmp/build/usr/local/bin/plugn && chmod +x /tmp/build/usr/local/bin/plugn
cp /tmp/tmp/plugn /tmp/build/usr/bin/plugn && chmod +x /tmp/build/usr/bin/plugn
@echo "-> Creating $(PLUGN_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n plugn -v $(PLUGN_VERSION) -a $(PLUGN_ARCHITECTURE) -p $(PLUGN_PACKAGE_NAME) --url "https://github.com/$(PLUGN_REPO_NAME)" --description $(PLUGN_DESCRIPTION) --license 'MIT License' .
sudo fpm -t deb -s dir -C /tmp/build -n plugn \
--version $(PLUGN_VERSION) \
--architecture $(PLUGN_ARCHITECTURE) \
--package $(PLUGN_PACKAGE_NAME) \
--url "https://github.com/$(PLUGN_REPO_NAME)" \
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
--category utils \
--description "$$PLUGN_DESCRIPTION" \
--license 'MIT License' \
.
mv *.deb /tmp
deb-sshcommand:
@@ -138,20 +177,38 @@ deb-sshcommand:
chmod +x /tmp/build/usr/local/bin/sshcommand
@echo "-> Creating $(SSHCOMMAND_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n sshcommand -v $(SSHCOMMAND_VERSION) -a $(SSHCOMMAND_ARCHITECTURE) -p $(SSHCOMMAND_PACKAGE_NAME) --url "https://github.com/$(SSHCOMMAND_REPO_NAME)" --description $(SSHCOMMAND_DESCRIPTION) --license 'MIT License' .
sudo fpm -t deb -s dir -C /tmp/build -n sshcommand \
--version $(SSHCOMMAND_VERSION) \
--architecture $(SSHCOMMAND_ARCHITECTURE) \
--package $(SSHCOMMAND_PACKAGE_NAME) \
--url "https://github.com/$(SSHCOMMAND_REPO_NAME)" \
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
--category admin \
--description "$$SSHCOMMAND_DESCRIPTION" \
--license 'MIT License' \
.
mv *.deb /tmp
deb-sigil: deb-setup
deb-sigil:
rm -rf /tmp/tmp /tmp/build $(SIGIL_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/sigil-$(SIGIL_VERSION).tgz $(SIGIL_URL)
cd /tmp/tmp/ && tar zxf /tmp/tmp/sigil-$(SIGIL_VERSION).tgz
@echo "-> Copying files into place"
cp /tmp/tmp/sigil /tmp/build/usr/local/bin/sigil && chmod +x /tmp/build/usr/local/bin/sigil
cp /tmp/tmp/sigil /tmp/build/usr/bin/sigil && chmod +x /tmp/build/usr/bin/sigil
@echo "-> Creating $(SIGIL_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n sigil -v $(SIGIL_VERSION) -a $(SIGIL_ARCHITECTURE) -p $(SIGIL_PACKAGE_NAME) --url "https://github.com/$(SIGIL_REPO_NAME)" --description $(SIGIL_DESCRIPTION) --license 'MIT License' .
sudo fpm -t deb -s dir -C /tmp/build -n gliderlabs-sigil \
--version $(SIGIL_VERSION) \
--architecture $(SIGIL_ARCHITECTURE) \
--package $(SIGIL_PACKAGE_NAME) \
--url "https://github.com/$(SIGIL_REPO_NAME)" \
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
--category utils \
--description "$$SIGIL_DESCRIPTION" \
--license 'MIT License' \
.
mv *.deb /tmp

8
debian/config vendored
View File

@@ -1,6 +1,10 @@
#!/bin/sh -e
#!/bin/bash
set -eo pipefail; [[ $TRACE ]] && set -x
. /usr/share/debconf/confmodule
if [[ -e /usr/share/debconf/confmodule ]]; then
# shellcheck disable=SC1091
. /usr/share/debconf/confmodule
fi
readonly ACTION="${1:-configure}"
readonly VERSION="${2:-dev}"

9
debian/control vendored
View File

@@ -1,11 +1,12 @@
Package: dokku
Version: 0.5.6
Version: 0.6.4
Section: web
Priority: optional
Architecture: amd64
Depends: locales, git, make, curl, gcc, man-db, sshcommand, sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties
Depends: locales, git, make, curl, gcc, man-db, sshcommand, gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties
Recommends: herokuish
Pre-Depends: nginx (>= 1.4.6), dnsutils, apparmor, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf
Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
Description: Docker-powered PaaS that helps build and manage the lifecycle of applications
Dokku is an extensible, open source Platform as a Service
that runs on a single server of your choice.

3
debian/lintian-overrides vendored Normal file
View File

@@ -0,0 +1,3 @@
dokku: command-with-path-in-maintainer-script postinst:16 /usr/bin/sshcommand
dokku: maintainer-script-calls-systemctl postinst:87
dokku: changelog-file-missing-in-native-package

28
debian/postinst vendored
View File

@@ -1,11 +1,25 @@
#!/bin/bash
set -eo pipefail; [[ $TRACE ]] && set -x
. /usr/share/debconf/confmodule
if [[ -e /usr/share/debconf/confmodule ]]; then
# shellcheck disable=SC1091
. /usr/share/debconf/confmodule
fi
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
call-sshcommand() {
if [[ -x /usr/local/bin/sshcommand ]]; then
/usr/local/bin/sshcommand "$@"
elif [[ -x /usr/bin/sshcommand ]]; then
/usr/bin/sshcommand "$@"
else
echo "Unable to find sshcommand binary" 1>&2
exit 1
fi
}
case "$1" in
abort-upgrade|abort-remove|abort-deconfigure)
;;
@@ -14,7 +28,8 @@ case "$1" in
mandb
[ ! -x /usr/bin/docker.io ] || ln -sf /usr/bin/docker.io /usr/local/bin/docker
modprobe aufs || echo "WARNING: Restart server to finish installing dokku!"
sshcommand create dokku /usr/local/bin/dokku
call-sshcommand create dokku /usr/bin/dokku
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
@@ -50,6 +65,13 @@ case "$1" in
find -L ${DOKKU_LIB_ROOT} -type l -delete
chown dokku:dokku -R ${DOKKU_LIB_ROOT}/plugins ${DOKKU_LIB_ROOT}/core-plugins
echo "Ensure proper sshcommand path"
echo '/usr/bin/dokku' > "${DOKKU_ROOT}/.sshcommand"
if [[ -f .ssh/authorized_keys ]]; then
sed -i.bak 's#/usr/local/bin/dokku#/usr/bin/dokku#' "${DOKKU_ROOT}/.ssh/authorized_keys"
rm "${DOKKU_ROOT}/.ssh/authorized_keys"
fi
echo "Install all core plugins"
dokku plugin:install --core
@@ -92,7 +114,7 @@ case "$1" in
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
db_get "dokku/key_file"
if [ -f "$RET" ]; then
sshcommand acl-add dokku default < "$RET" || true
call-sshcommand acl-add dokku default < "$RET" || true
fi
fi
;;

16
debian/postrm vendored
View File

@@ -1,8 +1,14 @@
#!/bin/bash
set -eo pipefail; [[ $TRACE ]] && set -x
if [[ -e /usr/share/debconf/confmodule ]]; then
# shellcheck disable=SC1091
. /usr/share/debconf/confmodule
fi
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
readonly DOKKU_LOGS_DIR="${DOKKU_LOGS_DIR:="/var/log/dokku"}"
main() {
if [[ -f /etc/systemd/system/dokku-installer.conf ]] || [[ -f /etc/init/dokku-installer.conf ]]; then
@@ -35,10 +41,12 @@ main() {
find ${DOKKU_ROOT} -type d -empty -delete
fi
if [[ -e /usr/share/debconf/confmodule ]]; then
. /usr/share/debconf/confmodule
db_purge
fi
rm -rf "${DOKKU_LOGS_DIR}"
deluser dokku || true
delgroup dokku || true
db_purge
fi
}

5
debian/preinst vendored
View File

@@ -1,7 +1,10 @@
#!/bin/bash
set -eo pipefail; [[ $TRACE ]] && set -x
. /usr/share/debconf/confmodule
if [[ -e /usr/share/debconf/confmodule ]]; then
# shellcheck disable=SC1091
. /usr/share/debconf/confmodule
fi
case "$1" in
install)

View File

@@ -3,7 +3,9 @@
You can always install dokku straight from the latest - potentially unstable - master release via the following bash command:
```shell
wget -qO- https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash
# using a branch results in installing from source
wget https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh
sudo DOKKU_BRANCH=master bash bootstrap.sh
```
## Development
@@ -46,6 +48,8 @@ sudo BUILD_STACK=true STACK_URL=https://github.com/gliderlabs/herokuish.git make
Once dokku is installed, if you are not using the web-installer, you'll want to configure a the virtualhost setup as well as the push user. If you do not, your installation will be considered incomplete and you will not be able to deploy applications.
*You should also stop and disable the `dokku-installer` service to remove public access to adding SSH keys.*
Set up a domain and a wildcard domain pointing to that host. Make sure `/home/dokku/VHOST` is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (`dig +short $(hostname -f)`). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, dokku will publish the app with a port number (i.e. `http://example.com:49154` - note the missing subdomain).
Follow the [user management documentation](/dokku/deployment/user-management) in order to add users to dokku.

View File

@@ -0,0 +1,32 @@
# 0.6.0 Migration Guide
## zero-downtime deployment
- You can now **actually** disable zero-downtime deployments per-app and per-process-type
- Some config variables have been moved around
- `DOKKU_CHECKS_ENABLED` has been migrated to `DOKKU_CHECKS_SKIPPED`
- `DOKKU_CHECKS_DISABLED` is now a thing
- The values for the above can be a comma-separated list of process-types or the literal string `_all_`
- See the [updated `checks`](/dokku/checks-examples/) docs for more info
## proxy port mapping
- You can now configure host -> container proxy port mappings
- The UI is handled by the [proxy](/dokku/proxy/) interface plugin by setting the `DOKKU_PROXY_PORT_MAP` config variable in the format of `scheme:host-port:container-port`. The default `nginx-vhosts` proxy plugin supports both the `http` and `https` schemes.
- Default port mappings
- buildpack apps will be set to `http:80:5000` and will also include `https:443:5000` if SSL is enabled.
- dockerfile apps with explicitly exposed ports (i.e. using the `EXPOSE` directive) will be configured with a listener on each exposed port that proxies to the same port of the deployed application container.
- You may override this behavior with the [`proxy:ports-*` commands](/dokku/proxy/) or by directly setting `DOKKU_PROXY_PORT_MAP` with the `config:set` command
- dockerfile apps without explicitly exposed ports will behave the same as a buildpack app
- NOTE: These defaults **are not** automatically changed on subsequent pushes and must be manipulated with the aforementioned commands
## calling the dokku binary
- Plugins should *not* call the dokku binary directly. Clients using the `--app` argument are potentially broken, amongst others, when doing so. Instead, please source the `functions` file for a given plugin when attempting to call dokku internal functions. As a result, the following dokku commands are no longer publicly exposed:
- dokku build
- dokku receive
- dokku release
- dokku tar:build
- dokku tar:build-locked
- dokku git:build
- dokku git:build-locked

View File

@@ -2,10 +2,10 @@
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/mstile-310x150.png"/>
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-310x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>

View File

@@ -2,37 +2,37 @@
"name": "Dokku",
"icons": [
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.6\/docs\/assets\/favicons\/android-chrome-36x36.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.6\/docs\/assets\/favicons\/android-chrome-48x48.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.6\/docs\/assets\/favicons\/android-chrome-72x72.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.6\/docs\/assets\/favicons\/android-chrome-96x96.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.6\/docs\/assets\/favicons\/android-chrome-144x144.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.6\/docs\/assets\/favicons\/android-chrome-192x192.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"

View File

@@ -36,13 +36,13 @@ h1 {
background-repeat: no-repeat;
}
.header .navbar-brand a {
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/dokku.png);
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/dokku.png);
text-indent: 40px;
}
.blurb {
color: #424242;
background-color: #ededed;
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/gplaypattern.png);
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/gplaypattern.png);
padding: 45px 0;
text-align: center;
}
@@ -230,6 +230,15 @@ a.list-group-item {
margin-top: 2em;
text-transform: uppercase;
}
.table-of-contents {
font-size: 0.8em;
padding: 1em;
margin: 0 0 0.5em 0.5em;
}
.table-of-contents ul {
margin-bottom: 0;
padding-left: 20px;
}
.anchorjs-link {
color: #24cbce;
}

View File

@@ -2,6 +2,7 @@
"max-versions": [
"0.3.26",
"0.4.14",
"0.5.6"
"0.5.8",
"0.6.4"
]
}

View File

@@ -3,9 +3,10 @@
> New as of 0.5.0
```
checks <app> Show zero-downtime status
checks:disable <app> Disable zero-downtime checks
checks:enable <app> Enable zero-downtime checks
checks <app> Show zero-downtime status
checks:disable <app> [process-type(s)] Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
checks:enable <app> [process-type(s)] Enable zero-downtime deployment for all processes (or comma-separated process-type list)
checks:skip <app> [process-type(s)] Skip zero-downtime checks for all processes (or comma-separated process-type list)
```
Following a deploy, dokku will wait `10` seconds before routing traffic to the new container to give your application time to boot up. If the application is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value globally or on a per-application basis:
@@ -15,10 +16,32 @@ dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30
dokku config:set <app> DOKKU_DEFAULT_CHECKS_WAIT=30
```
You can also choose to skip checks completely on a per-application basis:
You can also choose to skip checks or disable zero-downtime completely on a per-application/per-process basis:
```shell
dokku checks:disable <app>
dokku checks:skip <app> worker,web
```
```shell
dokku checks:disable <app> worker,web
```
> Note that `checks:disable` will now (as of 0.6.0) cause downtime for that process-type during deployments.
Additionally, any given process can only be configured to skip OR disable zero-downtime. example:
```shell
$ dokku checks:skip testapp worker,web
-----> Skipping zero downtime for app's (testapp) proctypes (worker,web)
-----> Unsetting testapp
-----> Unsetting DOKKU_CHECKS_DISABLED
-----> Setting config vars
DOKKU_CHECKS_SKIPPED: worker,web
$ dokku checks:disable testapp worker
-----> Disabling zero downtime for app's (testapp) proctypes (worker)
-----> Setting config vars
DOKKU_CHECKS_DISABLED: worker
-----> Setting config vars
DOKKU_CHECKS_SKIPPED: web
```
Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. You can modify this value globally or on a per-application basis:
@@ -34,6 +57,8 @@ dokku config:set <app> DOKKU_WAIT_TO_RETIRE=120
If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not.
Checks are run against the detected `web` process from your application's `Procfile`. For non-web processes, dokku will fallback to the aforementioned process uptime check.
To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file should be plain text and may contain:
* Check instructions
@@ -272,7 +297,7 @@ Could not start due to 1 failed checks.
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection
=====> end myapp container output
/usr/local/bin/dokku: line 49: 23409 Killed dokku deploy "$APP"
/usr/bin/dokku: line 49: 23409 Killed dokku deploy "$APP"
To dokku@dokku.example.com:myapp
! [remote rejected] dokku -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@dokku.example.com:myapp'

View File

@@ -13,6 +13,8 @@ config:unset (<app>|--global) KEY1 [KEY2 ...] Unset one or more conf
The variables are available both at run time and during the application build/compilation step for buildpack-based deploys. For security reasons - and as per [docker recommendations](https://github.com/docker/docker/issues/13490) - Dockerfile-based deploys have variables available *only* during runtime, as noted in [this issue](https://github.com/dokku/dokku/issues/1860).
For buildpack deploys, Dokku will create a `/app/.env` file that can be used for legacy buildpacks. Note that this is *not* updated when `config:set` or `config:unset` is called, and is only written during a `deploy` or `ps:rebuild`. Developers are encouraged to instead read from the application environment directly, as the proper values will be available then.
> Note: Global `ENV` files are sourced before app-specific `ENV` files. 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.
You can set multiple environment variables at once:

View File

@@ -4,6 +4,7 @@ Dokku normally defaults to using [heroku buildpacks](https://devcenter.heroku.co
- Use `dokku config:set` to set the `BUILDPACK_URL` environment variable.
- Add `BUILDPACK_URL` to a committed `.env` file in the root of your repository.
- See the [environment variable documentation](/dokku/configuration-management/) for more details.
- Create a `.buildpacks` file in the root of your repository.
## Specifying a custom buildpack
@@ -56,6 +57,31 @@ You may also wish to use a **specific** version of a buildpack, which is also si
dokku config:set APP BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#v87
```
## Specifying commands via Procfile
While many buildpacks have a default command that is run when a detected repository is pushed, it is possible to override this command via a Procfile. A Procfile can also be used to specify multiple commands, each of which is subject to process scaling. See the [process scaling documentation](/dokku/process-management/) for more details around scaling individual processes.
A Procfile is a file named `Procfile`. It should be named `Procfile` exactly, and not anything else. For example, `Procfile.txt` is not valid. The file should be a simple text file.
The file must be placed in the root directory of your application. It will not function if placed in a subdirectory.
If the file exists, it should not be empty, as doing so may result in a failed deploy.
The syntax for declaring a `Procfile` is as follows. Note that the format is one process type per line, with no duplicate process types.
```
<process type>: <command>
```
If, for example, you have multiple queue workers and wish to scale them separately, the following would be a valid way to work around the requirement of not duplicating process types:
```
worker: env QUEUE=* bundle exec rake resque:work
importantworker: env QUEUE=important bundle exec rake resque:work
```
The `web` process type holds some significance in that it is the only process type that is automatically scaled to `1` on the initial application deploy. See the [process scaling documentation](/dokku/process-management/) for more details around scaling individual processes.
## Clearing buildpack cache
Building containers with buildpacks currently results in a persistent `cache` directory between deploys. If you need to clear this cache directory for any reason, you may do so by running the following shell command:

View File

@@ -14,21 +14,21 @@ tags:destroy <app> <tag> Remove app image tag
Example:
```
root@dokku:~# dokku tags node-js-app
$ dokku tags node-js-app
=====> Image tags for dokku/node-js-app
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
root@dokku:~# dokku tags:create node-js-app v0.9.0
$ dokku tags:create node-js-app v0.9.0
=====> Added v0.9.0 tag to dokku/node-js-app
root@dokku:~# dokku tags node-js-app
$ dokku tags node-js-app
=====> Image tags for dokku/node-js-app
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
dokku/node-js-app v0.9.0 936a42f25901 About a minute ago 1.025 GB
root@dokku:~# dokku tags:deploy node-js-app v0.9.0
$ dokku tags:deploy node-js-app v0.9.0
-----> Releasing node-js-app (dokku/node-js-app:v0.9.0)...
-----> Deploying node-js-app (dokku/node-js-app:v0.9.0)...
-----> Running pre-flight checks
@@ -84,6 +84,9 @@ You can alternatively add image pulled from a docker Registry and deploy app fro
dokku tags:deploy test-app v12
```
> Note: When deploying an image, we will use `docker inspect` to extract the `ExposedPorts` configuration and if defined, use that to populate `DOKKU_DOCKERFILE_PORTS`. If this behavior is not desired, you can override that configuration variable with the `config:set` command.
> Example: `dokku config:set test-app DOKKU_DOCKERFILE_PORTS="5984/tcp 80/tcp"`
## Deploying an image from CI
To ensure your builds are always reproducible, it's considered bad practice to store build

View File

@@ -15,6 +15,17 @@ The `run` command can be used to run a one-off process for a specific command. T
dokku run node-js-app ls -lah
```
The `run` command can also be used to run a command defined in your Procfile:
```
console: bundle exec racksh
```
```shell
# runs `bundle exec racksh` in the `/app` directory of the application `my-app`
dokku run my-app console
```
If you want to remove the container after a command has started, you can run the following command:
```shell
@@ -32,6 +43,15 @@ dokku --rm-container run node-js-app ls -lah
dokku --rm run node-js-app ls -lah
```
Finally, you may wish to run a container in "detached" mode via the `--detach` dokku flag. Running a process in detached mode will immediately return a `CONTAINER_ID`. It is up to the user to then further manage this container in whatever manner they see fit, as dokku will *not* automatically terminate the container.
```shell
dokku --detach run node-js-app ls -lah
# returns the ID of the new container
```
> Note that you may not use the `--rm-container` or `--rm` flags when running containers in detached mode, and attempting to do so will result in the `--detach` flag being ignored.
### Using `run` for cron tasks
You can always use a one-off container to run an application task:
@@ -59,6 +79,8 @@ dokku enter node-js-app web.1
dokku enter node-js-app --container-id ID
```
Additionally, you can run `enter` with no container-type. If only a single container-type is defined in your app, you will be dropped into the only running container. This behavior is not supported when specifying a custom command; as described below.
By default, it runs a `/bin/bash`, but can also be used to run a custom command:
```shell

View File

@@ -54,7 +54,7 @@ If you decide to obtain a CA signed certficate, you can import that certificate
The `certs:info` command will simply inspect the install SSL cert and print out details. NOTE: The server-wide certificate will be inspect if installed and no app-specific certificate exists.
```
root@dokku:~/dokku# dokku certs:info node-js-app
$ dokku certs:info node-js-app
-----> Fetching SSL Endpoint info for node-js-app...
-----> Certificate details:
=====> Common Name(s):
@@ -84,12 +84,6 @@ Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarde
If your server runs behind an HTTP/S load balancer, then Nginx will see all requests as coming from the load balancer. If your load balancer sets the `X-Forwarded-` headers, you can tell Nginx to pass these headers from load balancer to your application by using the following [nginx custom template](/dokku/nginx/#customizing-the-nginx-configuration)
```shell
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
server {
listen [::]:{{ .NGINX_PORT }};
listen {{ .NGINX_PORT }};
@@ -113,6 +107,12 @@ server {
}
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
}
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
```
Only use this option if:

View File

@@ -155,3 +155,4 @@ A few notes:
- From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files.
- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](/dokku/development/plugin-triggers) doc for examples.
- As of 0.5.0, we use container labels to help cleanup intermediate containers with `dokku cleanup`. If manually calling `docker run`, include `$DOKKU_GLOBAL_RUN_ARGS`. This will ensure you intermediate containers labeled correctly.
- As of 0.6.0, we advise you to *not* call the dokku binary directly from within plugins. Clients using the `--app` argument are potentially broken, amongst other issues, when doing so. Instead, please source the `functions` file for a given plugin when attempting to call dokku internal functions

View File

@@ -29,6 +29,21 @@ The following plugin triggers describe those available to a dokku installation.
> The example plugin trigger code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples.
### `post-config-update`
- Description: Allows you to get notified when one or more configs is added or removed. Action can be *set* or *unset*
- Invoked by: `dokku config:set`, `dokku config:unset`
- Arguments: `$APP` `set|unset` `key1=VALUE1 key2=VALUE2`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `bind-external-ip`
- Description: Allows you to disable binding to the external box ip
@@ -146,10 +161,41 @@ case "$DOKKU_DISTRO" in
esac
```
### `deployed-app-image-tag`
- Description: Used to manage the tag of the image being deployed. Useful for deploying a specific version of an image, or when deploying from an external registry
- Invoked by: `internal function dokku_deploy_cmd() (deploy phase)`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# customize the tag version
echo 'not-latest'
```
### `deployed-app-repository`
- Description: Used to manage the remote repository of the image being deployed.
- Invoked by: `internal function dokku_deploy_cmd() (deploy phase)`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
echo 'derp.dkr.ecr.us-east-1.amazonaws.com'
```
### `docker-args-build`
- Description:
- Invoked by: `dokku build`
- Invoked by: `internal function dokku_build() (build phase)`
- Arguments: `$APP $IMAGE_SOURCE_TYPE`
- Example:
@@ -285,7 +331,7 @@ nginx -t
### `post-build-buildpack`
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildpacks.
- Invoked by: `dokku build`
- Invoked by: `internal function dokku_build() (build phase)`
- Arguments: `$APP`
- Example:
@@ -300,7 +346,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
### `post-build-dockerfile`
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using a dockerfile.
- Invoked by: `dokku build`
- Invoked by: `internal function dokku_build() (build phase)`
- Arguments: `$APP`
- Example:
@@ -354,7 +400,7 @@ dokku postgres:destroy $APP
### `post-deploy`
- Description: Allows running of commands after a deploy has completed. Dokku core currently uses this to switch traffic on nginx.
- Description: Allows running of commands after an application's processes have been scaled up, but before old containers are torn down. Dokku core currently uses this to switch traffic on nginx.
- Invoked by: `dokku deploy`
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG`
- Example:
@@ -385,10 +431,30 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
sudo service haproxy reload
```
### `post-proxy-ports-update`
- Description: Allows you to run commands once the proxy port mappings for an application have been updated. It also sends the invoking command. This can be "add", "clear" or "remove".
- Invoked by: `dokku proxy:ports-add`, `dokku proxy:ports-clear`, `dokku proxy:ports-remove`
- Arguments: `$APP` `action name`
- Example:
```shell
#!/usr/bin/env bash
# Rebuilds haproxy config for our imaginary haproxy plugin
# that replaces the nginx-vhosts plugin
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/haproxy/functions"
APP="$1"; verify_app_name "$APP"
haproxy-build-config "$APP"
```
### `post-release-buildpack`
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
- Invoked by: `dokku release`
- Invoked by: `internal function dokku_release() (release phase)`
- Arguments: `$APP $IMAGE_TAG`
- Example:
@@ -415,7 +481,7 @@ docker commit $ID $IMAGE > /dev/null
### `post-release-dockerfile`
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
- Invoked by: `dokku release`
- Invoked by: `internal function dokku_release() (release phase)`
- Arguments: `$APP $IMAGE_TAG`
- Example:
@@ -451,7 +517,7 @@ dokku config:set --no-restart $APP MANUALLY_STOPPED=1
### `pre-build-buildpack`
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildpacks.
- Invoked by: `dokku build`
- Invoked by: `internal function dokku_build() (build phase)`
- Arguments: `$APP`
- Example:
@@ -466,7 +532,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
### `pre-build-dockerfile`
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using a dockerfile.
- Invoked by: `dokku build`
- Invoked by: `internal function dokku_build() (build phase)`
- Arguments: `$APP`
- Example:
@@ -502,7 +568,7 @@ fi
### `pre-deploy`
- Description: Allows the running of code before the container's process is started.
- Description: Allows the running of code before the application's processes are scaled up and after the docker images are prepared.
- Invoked by: `dokku deploy`
- Arguments: `$APP $IMAGE_TAG`
- Example:
@@ -545,7 +611,7 @@ echo "$APP" > "$TMP_WORK_DIR/dokku-is-awesome"
### `pre-release-buildpack`
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
- Invoked by: `dokku release`
- Invoked by: `internal function dokku_release() (release phase)`
- Arguments: `$APP $IMAGE_TAG`
- Example:
@@ -572,7 +638,7 @@ docker commit $ID $IMAGE > /dev/null
### `pre-release-dockerfile`
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
- Invoked by: `dokku release`
- Invoked by: `internal function dokku_release() (release phase)`
- Arguments: `$APP $IMAGE_TAG`
- Example:
@@ -587,11 +653,79 @@ verify_app_name "$APP"
# TODO
```
### `pre-disable-vhost`
- Description: Allows you to run commands before the VHOST feature is disabled
- Invoked by: `dokku domains:disable`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
### `pre-enable-vhost`
- Description: Allows you to run commands before the VHOST feature is enabled
- Invoked by: `dokku domains:enable`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
### `post-certs-update`
- Description: Allows you to run commands after a cert is added/updated
- Invoked by: `dokku certs:add`, `dokku certs:update`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
### `post-certs-remove`
- Description: Allows you to run commands after a cert is removed
- Invoked by: `dokku certs:remove`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
### `receive-app`
- Description: Allows you to customize what occurs when an app is received. Normally just triggers an application build.
- Invoked by: `dokku git-hook`, `dokku ps:rebuild`
- Arguments: `$APP $REV`
- Arguments: `$APP $REV` (`$REV` may not be included in cases where a repository is not pushed)
- Example:
```shell

View File

@@ -8,7 +8,6 @@ To propose a release, the following tasks need to be performed:
- The installable version must be changed in the `contrib/dokku-installer.py` file.
- The installable version must be changed in the `debian/control` file.
- The installable version must be changed in the `docs/home.html` file
- The installable version must be changed in the `docs/index.md` file
- The installable version must be changed in the `docs/installation.md` file.
- The installable version must be changed in the `docs/template.html` file.
- The installable version must be changed in the `README.md` file.
@@ -67,7 +66,7 @@ The workflow looks like this:
```shell
# having dokku-arch in ../dokku-arch
vagrant up build-arch
# wait for "==> build-arch: ==> Finished making: dokku 0.5.6-2 (Mon Feb 22 23:20:37 CET 2016)"
# wait for "==> build-arch: ==> Finished making: dokku 0.6.4-2 (Mon Feb 22 23:20:37 CET 2016)"
cd ../dokku-arch
git add PKGBUILD .SRCINFO
git commit -m 'Update to dokku 0.9.9'

View File

@@ -41,6 +41,15 @@ Your app may be used in a cluster that requires containers or resources not runn
Your app may have services that are running in memory and need to be backed up locally (like a key store). Mount a non ephemeral storage mount will allow backups that are not lost when the app is shut down.
### Build phase
By default, dokku will only bind storage mounts during the deploy and run phases. Under certain conditions, one might want to bind a storage mount during the build phase. This can be accomplished by using the `docker-options` plugin directly.
```
$ dokku docker-options:add <app> "-v /tmp/python-test:/opt/test"
```
NOTE: **This can cause data loss** if you bind a mount under `/app` in buildpack apps as herokuish will attempt to remove the original app path during the build phase.
## Docker-Options Note
The storage plugins is compatible with storage mounts created with the docker-options. The storage plugin will only list mounts from the deploy phase.

View File

@@ -10,30 +10,30 @@
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<style>
</style>
@@ -90,17 +90,17 @@
</div>
<div class="shell shell-curl shell-active">
<p class="line">
<span class="output">&nbsp;# only works on debian systems!</span>
<span class="output">&nbsp;# for debian systems, installs dokku via apt-get</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.5.6/bootstrap.sh</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.6.4/bootstrap.sh</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.5.6 bash bootstrap.sh</span>
<span class="command">sudo DOKKU_TAG=v0.6.4 bash bootstrap.sh</span>
</p>
<p class="line">
<span class="output">&nbsp;# go to your server's IP and follow the web installer</span>

View File

@@ -1,70 +0,0 @@
<div class="blurb">
<div class="container">
<h2>The smallest PaaS implementation you've ever seen</h2>
<p>Docker powered mini-Heroku in around 200 lines of Bash</p>
<div class="blurb-buttons">
<a class="btn btn-lg btn-warning" href="/dokku/installation">View Documentation</a>
</div>
</div>
</div>
<div class="container marketing">
<div class="quickstart-code">
<p class="title">Quick-start Instructions</p>
<div class="shell">
<p class="line">
<span class="path">~</span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.5.6/bootstrap.sh</span>
</p>
<p class="line">
<span class="path">~</span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.5.6 bash bootstrap.sh</span>
</p>
<p class="line">
<span class="output"># =&gt; Go to your server's IP and follow the web installer</span>
</p>
</div>
</div>
<hr class="featurette-divider">
<!-- START THE FEATURETTES -->
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">Own Your PaaS. <span class="text-muted">Infrastructure at a fraction of the cost.</span></h2>
<p class="lead">Powered by Docker, you can install Dokku on any hardware. Use it on inexpensive cloud providers. Use the extra cash to buy a pony or feed kittens. You'll save tens of dollars a year on your dog photo sharing website.</p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive center-block" alt="Docker Logo" src="assets/docker.png">
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7 col-md-push-5">
<h2 class="featurette-heading">Easy Git Deploys. <span class="text-muted">From your command-line to the cloud.</span></h2>
<p class="lead">Once it's set up on a host, you can push Heroku-compatible applications to it via Git. They'll build using Heroku buildpacks and then run in isolated containers. The end result is your own, single-host version of Heroku.</p>
</div>
<div class="col-md-5 col-md-pull-7">
<img class="featurette-image img-responsive center-block" alt="Git Logo" src="assets/git.png">
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">Extensible Platform. <span class="text-muted">Customize your PaaS.</span></h2>
<p class="lead">Write dokku plugins in any language. Share them online with others, and extend those already available. Dokku's simple core is easy to hack and add the features you need to get your job done.</p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive center-block" alt="Extend Logo" src="assets/extend.png">
</div>
</div>
<hr class="featurette-divider">
</div>

View File

@@ -20,9 +20,9 @@ Dokku is designed for usage on a fresh installation of Ubuntu, and should instal
To install the latest stable version of dokku, you can run the following shell commands:
```shell
# installs dokku via apt-get
wget https://raw.githubusercontent.com/dokku/dokku/v0.5.6/bootstrap.sh
sudo DOKKU_TAG=v0.5.6 bash bootstrap.sh
# for debian systems, installs dokku via apt-get
wget https://raw.githubusercontent.com/dokku/dokku/v0.6.4/bootstrap.sh
sudo DOKKU_TAG=v0.6.4 bash bootstrap.sh
```
The installation process takes about 5-10 minutes, depending upon internet connection speed.
@@ -31,6 +31,8 @@ The installation process takes about 5-10 minutes, depending upon internet conne
Once the installation is complete, you can open a browser to setup your SSH key and virtualhost settings. Open your browser of choice and navigate to the host's IP address - or the domain you assigned to that IP previously - and configure dokku via the web admin.
*If you don't complete setup via the web installer (even if you set up SSH keys and virtual hosts otherwise) your dokku installation will remain vulnerable to anyone finding the setup page and inserting their key.*
#### 3. Deploy your first application
Once you save your settings, the web admin will self-terminate and you should be able to run or deploy to the dokku installation.

View File

@@ -25,11 +25,6 @@ Dokku uses a templating library by the name of [sigil](https://github.com/glider
Use case: add an `X-Served-By` header to requests
```
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
server {
listen [::]:{{ .NGINX_PORT }};
listen {{ .NGINX_PORT }};
@@ -40,6 +35,13 @@ server {
# set a custom header for requests
add_header X-Served-By www-ec2-01;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
gzip_vary on;
gzip_comp_level 6;
location / {
proxy_pass http://{{ .APP }};
proxy_http_version 1.1;
@@ -53,6 +55,12 @@ server {
}
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
}
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
```
### Available template variables
@@ -64,6 +72,8 @@ server {
{{ .NGINX_PORT }} Non-SSL nginx listener port (same as `DOKKU_NGINX_PORT` config var)
{{ .NGINX_SSL_PORT }} SSL nginx listener port (same as `DOKKU_NGINX_SSL_PORT` config var)
{{ .NOSSL_SERVER_NAME }} List of non-SSL VHOSTS
{{ .PROXY_PORT_MAP }} List of port mappings (same as `DOKKU_PROXY_PORT_MAP` config var)
{{ .PROXY_UPSTREAM_PORTS }} List of configured upstream ports (derived from `DOKKU_PROXY_PORT_MAP` config var)
{{ .RAW_TCP_PORTS }} List of exposed tcp ports as defined by Dockerfile `EXPOSE` directive (**Dockerfile apps only**)
{{ .SSL_INUSE }} Boolean set when an app is SSL-enabled
{{ .SSL_SERVER_NAME }} List of SSL VHOSTS
@@ -75,11 +85,6 @@ server {
### Example HTTP to HTTPS Custom Template
Use case: a simple dockerfile app that includes `EXPOSE 80`
```
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
server {
listen [::]:80;
listen 80;
@@ -116,6 +121,60 @@ server {
}
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
}
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
```
### Example using new proxy port mapping
```
{{ range $port_map := .PROXY_PORT_MAP | split " " }}
{{ $port_map_list := $port_map | split ":" }}
{{ $scheme := index $port_map_list 0 }}
{{ $listen_port := index $port_map_list 1 }}
{{ $upstream_port := index $port_map_list 2 }}
server {
listen [::]:{{ $listen_port }};
listen {{ $listen_port }};
server_name {{ $.NOSSL_SERVER_NAME }};
access_log /var/log/nginx/{{ $.APP }}-access.log;
error_log /var/log/nginx/{{ $.APP }}-error.log;
location / {
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
gzip_vary on;
gzip_comp_level 6;
proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
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;
}
{{ range $upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }}
upstream {{ $.APP }}-{{ $upstream_port }} {
{{ range $listeners := $.DOKKU_APP_LISTENERS | split " " }}
{{ $listener_list := $listeners | split ":" }}
{{ $listener_ip := index $listener_list 0 }}
{{ $listener_port := index $listener_list 1 }}
server {{ $listener_ip }}:{{ $upstream_port }};{{ end }}
}
{{ end }}
```
### Customizing via configuration files included by the default templates
@@ -168,3 +227,7 @@ See the [ssl documentation](/dokku/deployment/ssl-configuration/).
## Disabling Nginx
See the [proxy documentation](/dokku/proxy/).
## Managing Proxy Port mappings
See the [proxy documentation](/dokku/proxy/#proxy-port-mapping).

View File

@@ -152,13 +152,16 @@ Note: The following plugins have been supplied by our community and may not have
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
| [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | 0.3.x |
| [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | 0.3.x |
| [ElasticMQ (SQS compatible)](https://github.com/cu12/dokku-elasticmq) | [cu12][] | 0.5.0+ |
#### Other
| Plugin | Author | Compatibility |
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
| [etcd](https://github.com/basgys/dokku-etcd) | [basgys][] | 0.4.x |
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 0.3.x |
| [etcd](https://github.com/basgys/dokku-etcd) | [basgys][] | 0.4.x |
| [FakeSNS](https://github.com/cu12/dokku-fake_sns) | [cu12][] | 0.5.0+ |
| [InfluxDB](https://github.com/basgys/dokku-influxdb) | [basgys][] | 0.4.x |
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 0.3.x |
[dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709
@@ -241,6 +244,9 @@ Note: The following plugins have been supplied by our community and may not have
| [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | |
| [Wkhtmltopdf](https://github.com/mbriskar/dokku-wkhtmltopdf) | [mbriskar][] | |
| [Wordpress](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | Dokku dev, mariadb, volume, domains |
| [Long Timeout](https://github.com/investtools/dokku-long-timeout-plugin) | [investtools][] | 0.4.0+ |
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | 0.4.0+ |
| [Rollbar](https://github.com/iloveitaly/dokku-rollbar) | [iloveitaly][] | 0.5.0+ |
<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

@@ -1,32 +1,80 @@
# Proxy plugin
> New as of 0.5.0
As of dokku 0.5.0, the proxy functionality has been decoupled from the nginx-vhosts plugin into the proxy plugin. In the future this will allow other proxy software (HAproxy for example) to be used instead of nginx.
> New as of 0.5.0, Enhanced in 0.6.0
```
proxy:disable <app> Disable proxy for app
proxy:enable <app> Enable proxy for app
proxy:set <app> <proxy_type> NOT IMPLEMENTED YET!!
proxy <app> Show proxy settings for app
proxy:disable <app> Disable proxy for app
proxy:enable <app> Enable proxy for app
proxy:ports <app> List proxy port mappings for app
proxy:ports-add <app> <scheme>:<host-port>:<container-port> [<scheme>:<host-port>:<container-port>...] Set proxy port mappings for app
proxy:ports-clear <app> Clear all proxy port mappings for app
proxy:ports-remove <app> <host-port> [<host-port>|<scheme>:<host-port>:<container-port>...] Unset proxy port mappings for app
proxy:set <app> <proxy-type> Set proxy type for app
```
In Dokku 0.5.0, port proxying was decoupled from the `nginx-vhosts` plugin into the proxy plugin. Dokku 0.6.0 introduced the ability to map host ports to specific container ports. In the future this will allow other proxy software - such as HAProxy or Caddy - to be used in place of nginx.
## Container network interface binding
By default, the deployed docker container running your app's web process will bind to the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`). This behavior can be modified per app by disabling the proxy (i.e. `dokku proxy:disable <app>`). In this case, the container will bind to an external interface (i.e. 0.0.0.0) and your app container will be directly accessible by other hosts on your network.
> New as of 0.5.0
> If a proxy is disabled, dokku will bind your container's port to a random port on the host, e.g. `0.0.0.0:32771->5000/tcp`.
By default, the deployed docker container running your app's web process will bind to the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`). This behavior can be modified per app by disabling the proxy (i.e. `dokku proxy:disable <app>`). In this case, the container will bind to an external interface (i.e. `0.0.0.0`) and your app container will be directly accessible by other hosts on your network.
> If a proxy is disabled, dokku will bind your container's port to a random port on the host for every deploy, e.g. `0.0.0.0:32771->5000/tcp`.
```shell
# container bound to docker interface
root@dokku:~/dokku# docker ps
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute node-js-app.web.1
root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
# internal IP address for the container
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
172.17.0.6
# disable the proxy so it listens on a host ip address
$ dokku proxy:disable node-js-app
# container bound to all interfaces
root@dokku:/home/dokku# docker ps
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1
```
## Proxy port mapping
> New as of 0.6.0
You can now configure `host -> container` port mappings with the `proxy:ports-*` commands. This mapping is currently supported by the built-in nginx-vhosts plugin.
```shell
$ dokku proxy:ports node-js-app
-----> Port mappings for node-js-app
-----> scheme host port container port
http 80 5000
$ curl http://node-js-app.dokku.me
Hello World!
$ curl http://node-js-app.dokku.me:8080
curl: (7) Failed to connect to node-js-app.dokku.me port 8080: Connection refused
$ dokku proxy:ports-add node-js-app http:8080:5000
-----> Setting config vars
DOKKU_PROXY_PORT_MAP: http:80:5000 http:8080:5000
-----> Configuring node-js-app.dokku.me...(using built-in template)
-----> Creating http nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
$ curl http://node-js-app.dokku.me
Hello World!
$ curl http://node-js-app.dokku.me:8080
Hello World!
```
By default, buildpack apps and dockerfile apps **without** explicitly exposed ports (i.e. using the `EXPOSE` directive) will be configured with a listener on port `80` (and additionally a listener on 443 if ssl is enabled) that will proxy to the application container on port `5000`. Dockerfile apps **with** explicitly exposed ports will be configured with a listener on each exposed port and will proxy to that same port of the deployed application container.
> NOTE: This default behavior **will not** be automatically changed on subsequent pushes and must be manipulated with the `proxy:ports-*` syntax detailed above.

View File

@@ -10,26 +10,26 @@
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400:sans-serif|Open+Sans:400:sans-serif" rel="stylesheet" type="text/css">
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<script>
@@ -43,19 +43,10 @@
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.5.6/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
<style>
.table-of-contents {
font-size: 0.8em;
padding: 1em;
margin: 0 0 0.5em 0.5em;
}
.table-of-contents ul {
margin-bottom: 0;
padding-left: 20px;
}
</style>
</head>
<body>

View File

@@ -7,7 +7,7 @@ __Solution:__
Most of the time it's caused by some defaults newer versions of nginx set. To make sure that's the issue you're having run the following:
```
root@dockerapps:/home/git# nginx
$ nginx -t
nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
```
@@ -27,9 +27,9 @@ A value of 64 would allow domains with up to 64 characters. Set it to 128 if you
Save the file and try stopping nginx and starting it again:
```
root@dockerapps:~/dokku# /etc/init.d/nginx stop
$ /etc/init.d/nginx stop
* Stopping nginx nginx [ OK ]
root@dockerapps:~/dokku# /etc/init.d/nginx start
$ /etc/init.d/nginx start
* Starting nginx nginx [ OK ]
```
@@ -65,14 +65,14 @@ __Solution (Less solution, more helpful troubleshooting steps):__
Find the failed phase's container image (*077581956a92* in this example)
```
root@dokku:~# docker ps -a | grep build
$ docker ps -a | grep build
94d9515e6d93 077581956a92 "/build" 29 minutes ago Exited (0) 25 minutes ago cocky_bell
```
Start a new container with the failed image and poke around (i.e. ensure you can access the internet from within the container or attempt the failed command, if known)
```
root@dokku:~# docker run -ti 077581956a92 /bin/bash
$ docker run -ti 077581956a92 /bin/bash
root@9763ab86e1b4:/# curl -s -S icanhazip.com
192.168.0.1
curl http://s3pository.heroku.com/node/v0.10.30/node-v0.10.30-linux-x64.tar.gz -o node-v0.10.30-linux-x64.tar.gz
@@ -84,7 +84,7 @@ __Solution (Less solution, more helpful troubleshooting steps):__
Additionally we've seen issues if changing networks that have different DNS resolvers. In this case, you can run the following to update your resolv.conf
```
root@dokku:~# resolvconf -u
$ resolvconf -u
```
Please see https://github.com/dokku/dokku/issues/841 and https://github.com/dokku/dokku/issues/649

View File

@@ -7,6 +7,7 @@ If your version of dokku is pre 0.3.0 (check with `dokku version`), we recommend
Before upgrading, check the migration guides to get comfortable with new features and prepare your deployment to be upgraded.
- [0.5 Migration Guide](/dokku/appendices/0.5.0-migration-guide/)
- [0.6 Migration Guide](/dokku/appendices/0.6.0-migration-guide/)
## Upgrade Instructions

7
dokku
View File

@@ -100,13 +100,10 @@ execute_dokku_cmd() {
nginx|nginx:*)
local PLUGIN_NAME=${PLUGIN_NAME/nginx/nginx-vhosts}
;;
receive|deploy|build|release)
deploy|delete|ls|run|cleanup)
local PLUGIN_NAME="00_dokku-standard"
;;
trace|delete|ls|run|cleanup)
local PLUGIN_NAME="00_dokku-standard"
;;
url|urls|report|version)
trace|url|urls|report|version)
local PLUGIN_NAME="00_dokku-standard"
;;
esac

View File

@@ -23,7 +23,8 @@ get_phase_script() {
execute_script() {
declare desc="executes appropriate phase script key from app.json"
local APP="$1"; local IMAGE="$2"; local PHASE_SCRIPT_KEY="$3"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
local PHASE_SCRIPT_KEY="$3"
local SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY" 2>/dev/null)
if [[ -n "$SCRIPT_CMD" ]];then
dokku_log_info1 "Running '$SCRIPT_CMD' in app container"
@@ -48,7 +49,7 @@ execute_script() {
COMMAND+=" fi "
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
local DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP")
local DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
# strip --restart args from DOCKER_ARGS
local DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
@@ -60,6 +61,9 @@ execute_script() {
if ! is_image_herokuish_based "$IMAGE"; then
local DOKKU_DOCKERFILE_ENTRYPOINT=$(config_get "$APP" DOKKU_DOCKERFILE_ENTRYPOINT)
local DOKKU_DOCKERFILE_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_CMD)
[[ -z "$DOKKU_DOCKERFILE_ENTRYPOINT" ]] && DOKKU_DOCKERFILE_ENTRYPOINT="$(get_entrypoint_from_image "$IMAGE")"
[[ -z "$DOKKU_DOCKERFILE_CMD" ]] && DOKKU_DOCKERFILE_CMD="$(get_cmd_from_image "$IMAGE")"
[[ -n "$DOKKU_DOCKERFILE_ENTRYPOINT" ]] && local DOCKER_COMMIT_ENTRYPOINT_CHANGE_ARG="--change='$DOKKU_DOCKERFILE_ENTRYPOINT'"
[[ -n "$DOKKU_DOCKERFILE_CMD" ]] && local DOCKER_COMMIT_CMD_CHANGE_ARG="--change='$DOKKU_DOCKERFILE_CMD'"
@@ -74,27 +78,3 @@ execute_script() {
fi
fi
}
exec_app_json_scripts() {
declare desc="core app.json scripts execution"
local trigger="$0 app_json_scripts"
local APP="$1"
case "$0" in
*pre-deploy)
local IMAGE_TAG="$2"
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
local PHASE_SCRIPT_KEY="predeploy"
;;
*post-deploy)
local IMAGE_TAG="$4"
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
local PHASE_SCRIPT_KEY="postdeploy"
;;
esac
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
execute_script "$APP" "$IMAGE" "$PHASE_SCRIPT_KEY"
}
exec_app_json_scripts "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core standard plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -1 +0,0 @@
exec-app-json-scripts

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts"
exec_app_json_scripts() {
declare desc="core app.json scripts execution"
local trigger="pre-deploy app_json_scripts"
local APP="$1"; local IMAGE_TAG="$4"; local PHASE_SCRIPT_KEY="postdeploy"
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
}
cleanup_container_state() {
declare desc="core post-deploy state cleanup"
local trigger="post-deploy cleanup_container_state"
local APP="$1"; local PROCTYPES="$(egrep -v "^#" "$DOKKU_ROOT/$APP/DOKKU_SCALE" | awk -F '=' '{ print $1 }' | xargs)"
local CONTAINER_FILES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -printf "%f\n" | sort -t . -k 3 -n | xargs)"
local CONTAINER_FILE
for CONTAINER_FILE in $CONTAINER_FILES; do
local CONTAINER_TYPE="$(awk -F '.' '{ print $2 }' <<< "$CONTAINER_FILE")"
if [[ "$(is_val_in_list "$CONTAINER_TYPE" "$PROCTYPES" " ")" == "false" ]]; then
dokku_log_info1 "Container type ($CONTAINER_TYPE) is no longer defined. Removing state"
local IP_FILE="${CONTAINER_FILE//CONTAINER/IP}"
local PORT_FILE="${CONTAINER_FILE//CONTAINER/PORT}"
rm -f "$DOKKU_ROOT/$APP/$CONTAINER_FILE" "$DOKKU_ROOT/$APP/$IP_FILE" "$DOKKU_ROOT/$APP/$PORT_FILE"
fi
done
}
exec_app_json_scripts "$@"
cleanup_container_state "$@"

View File

@@ -1 +0,0 @@
exec-app-json-scripts

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts"
exec_app_json_scripts() {
declare desc="core app.json scripts execution"
local trigger="pre-deploy app_json_scripts"
local APP="$1"; local IMAGE_TAG="$2"; local PHASE_SCRIPT_KEY="predeploy"
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
}
exec_app_json_scripts "$@"

View File

@@ -1,62 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
dokku_build_cmd() {
declare desc="build phase"
local cmd="build"
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"; local IMAGE=$(get_app_image_name "$APP")
verify_app_name "$APP"
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
eval "$(config_export app "$APP")"
pushd "$TMP_WORK_DIR" &> /dev/null
case "$IMAGE_SOURCE_TYPE" in
herokuish)
local id=$(tar -c . | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
[[ -d $CACHE_DIR ]] || mkdir "$CACHE_DIR"
plugn trigger pre-build-buildpack "$APP"
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
docker attach "$id"
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
plugn trigger post-build-buildpack "$APP"
;;
dockerfile)
# extract first port from Dockerfile
local DOCKERFILE_PORTS=$(get_dockerfile_exposed_ports Dockerfile)
[[ -n "$DOCKERFILE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKERFILE_PORTS"
# extract ENTRYPOINT/CMD from Dockerfile
local DOCKERFILE_ENTRYPOINT=$(extract_directive_from_dockerfile Dockerfile ENTRYPOINT)
[[ -n "$DOCKERFILE_ENTRYPOINT" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_ENTRYPOINT="$DOCKERFILE_ENTRYPOINT"
local DOCKERFILE_CMD=$(extract_directive_from_dockerfile Dockerfile CMD)
[[ -n "$DOCKERFILE_CMD" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_CMD="$DOCKERFILE_CMD"
plugn trigger pre-build-dockerfile "$APP"
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
# shellcheck disable=SC2086
docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE .
plugn trigger post-build-dockerfile "$APP"
;;
*)
dokku_log_fail "Building image source type $IMAGE_SOURCE_TYPE not supported!"
;;
esac
}
dokku_build_cmd "$@"

View File

@@ -1,168 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
dokku_deploy_cmd() {
declare desc="deploy phase"
local cmd="deploy"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy"
local APP="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
is_image_herokuish_based "$IMAGE" && local DOKKU_HEROKUISH=true
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
local oldids=$(get_app_container_ids "$APP")
local DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
local DOKKU_IS_APP_PROXY_ENABLED="$(is_app_proxy_enabled "$APP")"
local line; local PROC_TYPE; local PROC_COUNT; local CONTAINER_INDEX
while read -r line || [[ -n "$line" ]]; do
[[ "$line" =~ ^#.* ]] && continue
line="$(strip_inline_comments "$line")"
PROC_TYPE=${line%%=*}
PROC_COUNT=${line#*=}
CONTAINER_INDEX=1
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
local id=""; local port=""; local ipaddr=""
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
# start the app
local DOCKER_ARGS="$DOKKU_DEFAULT_DOCKER_ARGS"
local DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' "
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
[[ -n "$DOKKU_HEROKUISH" ]] && local START_CMD="/start $PROC_TYPE"
if [[ -z "$DOKKU_HEROKUISH" ]]; then
local DOKKU_DOCKERFILE_PORTS=($(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true))
local DOKKU_DOCKERFILE_START_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_START_CMD || true)
local DOKKU_PROCFILE_START_CMD=$(get_cmd_from_procfile "$APP" "$PROC_TYPE")
local START_CMD=${DOKKU_DOCKERFILE_START_CMD:-$DOKKU_PROCFILE_START_CMD}
fi
if [[ "$PROC_TYPE" == "web" ]]; then
if [[ -z "${DOKKU_DOCKERFILE_PORTS[*]}" ]]; then
local port=5000
local DOKKU_DOCKER_PORT_ARGS+="-p $port"
else
local p
for p in ${DOKKU_DOCKERFILE_PORTS[*]};do
if [[ ! "$p" =~ .*udp.* ]]; then
# set port to first non-udp port
local p=${p//\/tcp}
local port=${port:="$p"}
fi
local DOKKU_DOCKER_PORT_ARGS+=" -p $p "
done
fi
if [[ "$DOKKU_IS_APP_PROXY_ENABLED" == "true" ]]; then
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
local ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$id")
# Docker < 1.9 compatibility
if [[ -z $ipaddr ]]; then
local ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$id")
fi
else
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
local port=$(docker port "$id" "$port" | sed 's/[0-9.]*://')
local ipaddr=127.0.0.1
fi
else
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOCKER_ARGS $IMAGE $START_CMD)
fi
# if we can't post-deploy successfully, kill new container
kill_new() {
declare desc="wrapper function to kill newly started app container"
local id="$1"
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
if [[ "$(is_app_checks_enabled "$APP")" == "false" ]]; then
dokku_log_info1 "zero downtime is disabled for app ($APP). skipping pre-flight checks"
else
trap 'kill_new $id' INT TERM EXIT
dokku_log_info1 "Running pre-flight checks"
plugn trigger check-deploy "$APP" "$id" "$PROC_TYPE" "$port" "$ipaddr"
trap - INT TERM EXIT
fi
# 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"
# cleanup pre-migration files
rm -f "$DOKKU_ROOT/$APP/CONTAINER" "$DOKKU_ROOT/$APP/IP" "$DOKKU_ROOT/$APP/PORT"
local CONTAINER_INDEX=$(( CONTAINER_INDEX + 1 ))
done
# cleanup when we scale down
if [[ "$PROC_COUNT" == 0 ]]; then
local CONTAINER_IDX_OFFSET=0
else
local CONTAINER_IDX_OFFSET=$((PROC_COUNT + 1))
fi
local container_state_filetype
for container_state_filetype in CONTAINER IP PORT; do
cd "$DOKKU_ROOT/$APP"
find . -maxdepth 1 -name "$container_state_filetype.$PROC_TYPE.*" -printf "%f\n" | sort -t . -k 3 -n | tail -n +$CONTAINER_IDX_OFFSET | xargs rm -f
done
done < "$DOKKU_SCALE_FILE"
dokku_log_info1 "Running post-deploy"
plugn trigger post-deploy "$APP" "$port" "$ipaddr" "$IMAGE_TAG"
# kill the old container
if [[ -n "$oldids" ]]; then
if [[ -z "$DOKKU_WAIT_TO_RETIRE" ]]; then
local DOKKU_APP_DOKKU_WAIT_TO_RETIRE=$(config_get "$APP" DOKKU_WAIT_TO_RETIRE || true)
local DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE=$(config_get --global DOKKU_WAIT_TO_RETIRE || true)
local DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
fi
# Let the old container finish processing requests, before terminating it
local WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
local oldid
for oldid in $oldids; do
dokku_log_info2 "$oldid"
done
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
(
exec >/dev/null 2>/dev/null </dev/null
trap '' INT HUP
sleep "$WAIT"
for oldid in $oldids; do
# Attempt to stop, if that fails, then force a kill as docker seems
# to not send SIGKILL as the docs would indicate. If that fails, move
# on to the next.
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$oldid" \
|| docker kill "$oldid" \
|| plugn trigger retire-container-failed "$APP" # plugin trigger for event logging
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
}
shift 1
dokku_deploy_cmd "$@"

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
dokku_receive_cmd() {
declare desc="receives an app kicks off deploy process"
local cmd="receive"
local APP="$2"; local IMAGE=$(get_app_image_name "$APP"); local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"
if [[ -z "$DOKKU_SKIP_CLEANUP" ]]; then
dokku_log_info1 "Cleaning up..."
docker_cleanup
else
dokku_log_info1 "DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup"
fi
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &> /dev/null
dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
release_and_deploy "$APP"
}
dokku_receive_cmd "$@"

View File

@@ -1,40 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
dokku_release_cmd() {
declare desc="release phase"
local cmd="release"
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local IMAGE_TAG="$4"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
case "$IMAGE_SOURCE_TYPE" in
herokuish)
plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG"
if [[ -n $(config_export global) ]]; then
local id=$(config_export global | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
fi
if [[ -n $(config_export app "$APP") ]]; then
local id=$(config_export app "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
fi
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
;;
dockerfile)
# buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
;;
*)
dokku_log_fail "Releasing image source type $IMAGE_SOURCE_TYPE not supported!"
;;
esac
}
dokku_release_cmd "$@"

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
dokku_run_cmd() {
@@ -20,9 +21,28 @@ dokku_run_cmd() {
local DOCKER_ARGS=$(: | plugn trigger docker-args-run "$APP" "$IMAGE_TAG")
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
[[ "$DOKKU_RM_CONTAINER" ]] && local DOKKU_RUN_OPTS="--rm"
has_tty && local DOKKU_RUN_OPTS+=" -i -t"
local DOKKU_RUN_OPTS=""
if [[ "$DOKKU_RM_CONTAINER" ]]; then
DOKKU_RUN_OPTS+=" --rm"
elif [[ "$DOKKU_DETACH_CONTAINER" ]]; then
DOKKU_RUN_OPTS+=" --detach"
fi
has_tty && DOKKU_RUN_OPTS+=" -i -t"
is_image_herokuish_based "$IMAGE" && local EXEC_CMD="/exec"
DOKKU_QUIET_OUTPUT=1 extract_procfile "$APP"
POTENTIAL_PROCFILE_KEY="$1"
PROC_CMD=$(get_cmd_from_procfile "$APP" "$POTENTIAL_PROCFILE_KEY" || echo '')
remove_procfile "$APP"
if [ ! -z "$PROC_CMD" ]; then
dokku_log_info1 "Found '$POTENTIAL_PROCFILE_KEY' in Procfile, running that command"
set -- "$PROC_CMD" "${@:2}"
fi
# shellcheck disable=SC2086
docker run $DOKKU_GLOBAL_RUN_ARGS $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
}

View File

@@ -1,10 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
dokku_version_cmd() {
declare desc="prints dokku version"

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core events logging plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core apps plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core build-env plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core certificate management plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -2,7 +2,6 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
is_tar_import() {
declare desc="determines if we have STDIN open in an attempt to detect a streamed tar import"
@@ -35,9 +34,12 @@ certs_set() {
verify_app_name "$2"
local APP="$2"; local CRT_FILE="$3"; local KEY_FILE="$4"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
is_file_import "$CRT_FILE" "$KEY_FILE" || is_tar_import || dokku_log_fail "Tar archive containing server.crt and server.key expected on stdin"
if is_tar_import; then
if is_file_import "$CRT_FILE" "$KEY_FILE"; then
# importing from file
true
elif is_tar_import; then
local CERTS_SET_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_certs_set.XXXX")
pushd "$CERTS_SET_TMP_WORK_DIR" &> /dev/null
trap 'popd &> /dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR > /dev/null' RETURN
@@ -62,6 +64,10 @@ certs_set() {
else
local KEY_FILE=$KEY_FILE_SEARCH
fi
else
dokku_log_fail "Tar archive containing server.crt and server.key expected on stdin"
fi
mkdir -p "$APP_SSL_PATH"
@@ -70,7 +76,8 @@ certs_set() {
chmod 750 "$APP_SSL_PATH"
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key"
cd "$DOKKU_ROOT"
nginx_build_config "$APP"
plugn trigger post-certs-update "$APP"
plugn trigger post-domains-update "$APP"
}
certs_set "$@"

View File

@@ -2,7 +2,6 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
certs_generate_cmd() {
declare desc="generates a self-signed SSL certificate/key combo"
@@ -26,7 +25,7 @@ certs_generate_cmd() {
mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$APP_SSL_PATH"
chmod 750 "$APP_SSL_PATH"
chmod 640 "$APP_SSL_PATH/server.key" "$APP_SSL_PATH/server.crt"
[[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || nginx_build_config "$APP")
[[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP")
dokku_log_info1 "The following is a certificate signing request that can be used"
dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN"
dokku_log_info1 "by a CA of your choosing."

View File

@@ -12,6 +12,7 @@ certs_remove_cmd() {
if [[ -d "$APP_SSL_PATH" ]]; then
dokku_log_info1 "Removing SSL endpoint from $APP"
rm -rf "$APP_SSL_PATH"
plugn trigger post-certs-remove "$APP"
plugn trigger post-domains-update "$APP"
else
dokku_log_fail "An app-specific SSL endpoint is not defined"

View File

@@ -58,8 +58,8 @@ checks_check_deploy() {
eval "$(config_export global)"
eval "$(config_export app "$APP")"
if [[ "$(is_app_checks_enabled "$APP")" == "false" ]]; then
dokku_log_info2_quiet "Zero downtime checks for app ($APP) have been disabled. moving on..."
if [[ "$(is_app_proctype_checks_skipped "$APP" "$DOKKU_APP_CONTAINER_TYPE")" == "true" ]]; then
dokku_log_info2_quiet "Zero downtime checks for app ($APP) have been skipped. moving on..."
exit 0
fi

View File

@@ -8,15 +8,16 @@ case "$1" in
declare desc="return checks plugin help content"
cat<<help_content
checks <app>, Show zero-downtime status
checks:enable <app>, Enable zero-downtime checks
checks:disable <app>, Disable zero-downtime checks
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
help_content
}
if [[ $1 = "checks:help" ]] ; then
echo -e 'Usage: dokku checks[:COMAND]'
echo ''
echo 'Manage zero-downtime checks.'
echo 'Manage zero-downtime settings.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,

View File

@@ -3,15 +3,27 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
is_app_checks_enabled() {
declare desc="return app zero-downtime checks status"
is_app_proctype_checks_disabled() {
declare desc="return true if app's proctype(s) checks are disabled"
local APP="$1"; verify_app_name "$APP"
local DOKKU_CHECKS_ENABLED=$(config_get "$APP" DOKKU_CHECKS_ENABLED)
local PROCTYPE="$2" status=false
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
if [[ -z "$DOKKU_CHECKS_ENABLED" ]] || [[ "$DOKKU_CHECKS_ENABLED" == "1" ]];then
local status=true
else
local status=false
if [[ "$DOKKU_CHECKS_DISABLED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] ;then
status=true
fi
echo $status
}
is_app_proctype_checks_skipped() {
declare desc="return true if app's proctype(s) checks are skipped"
local APP="$1"; verify_app_name "$APP"
local PROCTYPE="$2" status=false
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
if [[ "$DOKKU_CHECKS_SKIPPED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]] ;then
status=true
fi
echo $status

View File

@@ -3,39 +3,63 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
migrate_checks_vars() {
migrate_checks_vars_0_5_0() {
declare desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x"
local APPS="$(dokku_apps)"
local GLOBAL_SKIP_ALL_CHECKS=$(dokku config:get --global DOKKU_SKIP_ALL_CHECKS || true)
local GLOBAL_SKIP_DEFAULT_CHECKS=$(dokku config:get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
local GLOBAL_SKIP_ALL_CHECKS=$(config_get --global DOKKU_SKIP_ALL_CHECKS || true)
local GLOBAL_SKIP_DEFAULT_CHECKS=$(config_get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
local app
dokku_log_info1 "Migrating zero downtime env variables. The following variables have been deprecated"
dokku_log_info1 "Migrating zero downtime env variables to 0.5.x. The following variables have been deprecated"
dokku_log_info2 "DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS"
dokku_log_info2 "Please use dokku checks:[disable|enable] <app> to control zero downtime functionality"
for app in $APPS; do
local APP_SKIP_ALL_CHECKS=$(dokku config:get "$app" DOKKU_SKIP_ALL_CHECKS || true)
local APP_SKIP_DEFAULT_CHECKS=$(dokku config:get "$app" DOKKU_SKIP_DEFAULT_CHECKS || true)
local APP_SKIP_ALL_CHECKS=$(config_get "$app" DOKKU_SKIP_ALL_CHECKS || true)
local APP_SKIP_DEFAULT_CHECKS=$(config_get "$app" DOKKU_SKIP_DEFAULT_CHECKS || true)
if [[ "$APP_SKIP_ALL_CHECKS" == "true" ]] || [[ "$APP_SKIP_DEFAULT_CHECKS" == "true" ]] || \
[[ "$GLOBAL_SKIP_ALL_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_DEFAULT_CHECKS" == "true" ]]; then
dokku_log_info2 ""
dokku_log_info2 "zero downtime disabled for app ($app)"
if [[ "$APP_SKIP_ALL_CHECKS" == "true" ]] || [[ "$APP_SKIP_DEFAULT_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_ALL_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_DEFAULT_CHECKS" == "true" ]]; then
dokku_log_info2 ""
dokku_log_info2 "zero downtime checks disabled for app ($app)"
config_set --no-restart "$app" DOKKU_CHECKS_ENABLED=0
fi
if [[ -n "$APP_SKIP_ALL_CHECKS" ]] || [[ -n "$APP_SKIP_DEFAULT_CHECKS" ]]; then
config_unset --no-restart "$app" DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
fi
dokku_log_info2 "Migration complete"
dokku_log_info2 ""
done
if [[ -n "$GLOBAL_SKIP_ALL_CHECKS" ]] || [[ -n "$GLOBAL_SKIP_DEFAULT_CHECKS" ]]; then
dokku_log_info1 "Removing global zero downtime settings"
config_unset --global DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
fi
dokku_log_info2 "Migration complete"
dokku_log_info2 ""
}
migrate_checks_vars "$@"
migrate_checks_vars_0_5_0 "$@"
migrate_checks_vars_0_6_0() {
declare desc="migrates CHECKS config variables from 0.5.x to support fully-disabled zero-downtime checks"
local APPS="$(dokku_apps)"
local app
dokku_log_info1 "Migrating zero downtime env variables to 0.6.x. The following variables will be migrated"
dokku_log_info2 "DOKKU_CHECKS_ENABLED -> DOKKU_CHECKS_SKIPPED"
for app in $APPS; do
local APP_DOKKU_CHECKS_ENABLED=$(config_get "$app" DOKKU_CHECKS_ENABLED || true)
if [[ $APP_DOKKU_CHECKS_ENABLED ]]; then
if [[ "$APP_DOKKU_CHECKS_ENABLED" == "0" ]]; then
dokku_log_info2 ""
dokku_log_info2 "zero downtime checks disabled for app ($app)"
config_set --no-restart "$app" DOKKU_CHECKS_SKIPPED="_all_"
fi
config_unset --no-restart "$app" DOKKU_CHECKS_ENABLED || true
fi
done
dokku_log_info2 "Migration complete"
dokku_log_info2 ""
}
migrate_checks_vars_0_6_0 "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core checks plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -4,19 +4,24 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
checks_main_cmd() {
declare desc="displays app zero-downtime status"
declare desc="displays app zero-downtime checks status"
local cmd="checks"
[[ "$1" == "$cmd" ]] && shift 1
local APPS=$(dokku_apps)
if [[ -n "$1" ]]; then
local APPS="$1"
fi
dokku_col_log_info1_quiet "App Name" "Zero-Downtime Status"
dokku_col_log_info1_quiet "App Name" "Proctypes Disabled" "Proctypes Skipped"
local app
for app in $APPS; do
verify_app_name "$app"
dokku_col_log_msg "$app" "$(is_app_checks_enabled "$app")"
local DOKKU_CHECKS_DISABLED=$(config_get "$app" DOKKU_CHECKS_DISABLED)
local DOKKU_CHECKS_SKIPPED=$(config_get "$app" DOKKU_CHECKS_SKIPPED)
local checks_disabled="${DOKKU_CHECKS_DISABLED:-none}"
local checks_skipped="${DOKKU_CHECKS_SKIPPED:-none}"
dokku_col_log_msg "$app" "$checks_disabled" "$checks_skipped"
done
}
checks_main_cmd "$2"
checks_main_cmd "$@"

View File

@@ -4,18 +4,41 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
checks_disable_cmd() {
declare desc="disable zero-downtime for app"
local cmd="check:disable"
declare desc="disable zero-downtime checks for app/proctypes"
local cmd="checks:disable"
[[ "$1" == "$cmd" ]] && shift 1
local APP="$1"; verify_app_name "$APP"
local PROCTYPES="${2:-_all_}"
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
if [[ "$(is_app_checks_enabled "$APP")" == "true" ]]; then
if [[ "$PROCTYPES" == "_all_" ]]; then
dokku_log_info1 "Disabling zero downtime for app ($APP)"
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
# shellcheck disable=SC2086
config_set $CONFIG_SET_ARGS $APP DOKKU_CHECKS_ENABLED=0
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$PROCTYPES"
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
dokku_log_info1 "zero downtime is already disable for app ($APP)"
dokku_log_info1 "Disabling zero downtime for app's ($APP) proctypes ($PROCTYPES)"
local PROCTYPE OIFS="$IFS" IFS=,
for PROCTYPE in $PROCTYPES; do
IFS="$OIFS"
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "false" ]] && \
DOKKU_CHECKS_DISABLED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]] && \
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
done
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_DISABLED")"
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
fi
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
fi
fi
}
checks_disable_cmd "$2" --no-restart
checks_disable_cmd "$@"

View File

@@ -4,18 +4,40 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
checks_enable_cmd() {
declare desc="enable zero-downtime for app"
declare desc="enable zero-downtime checks for app/proctypes"
local cmd="checks:enable"
[[ "$1" == "$cmd" ]] && shift 1
local APP="$1"; verify_app_name "$APP"
local PROCTYPES="${2:-_all_}"
if [[ "$(is_app_checks_enabled "$APP")" == "false" ]]; then
dokku_log_info1 "Enabling zero downtime for app ($APP)"
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
# shellcheck disable=SC2086
config_set $CONFIG_SET_ARGS $APP DOKKU_CHECKS_ENABLED=1
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
if [[ "$PROCTYPES" == "_all_" ]]; then
dokku_log_info1 "Enabling zero downtime for app's ($APP)"
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
dokku_log_info1 "zero downtime is already enabled for app ($APP)"
dokku_log_info1 "Enabling zero downtime for app's ($APP) proctypes ($PROCTYPES)"
local PROCTYPE OIFS="$IFS" IFS=,
for PROCTYPE in $PROCTYPES; do
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
done
IFS="$OIFS"
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
fi
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
fi
fi
}
checks_enable_cmd "$2" --no-restart
checks_enable_cmd "$@"

44
plugins/checks/subcommands/skip Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
checks_skip_cmd() {
declare desc="skip zero-downtime checks for app/proctypes"
local cmd="checks:skip"
[[ "$1" == "$cmd" ]] && shift 1
local APP="$1"; verify_app_name "$APP"
local PROCTYPES="${2:-_all_}"
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
if [[ "$PROCTYPES" == "_all_" ]]; then
dokku_log_info1 "Skipping zero downtime for app ($APP)"
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$PROCTYPES"
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
dokku_log_info1 "Skipping zero downtime for app's ($APP) proctypes ($PROCTYPES)"
local PROCTYPE OIFS="$IFS" IFS=,
for PROCTYPE in $PROCTYPES; do
IFS="$OIFS"
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "false" ]] && \
DOKKU_CHECKS_SKIPPED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] && \
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
done
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_SKIPPED")"
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
fi
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
fi
fi
}
checks_skip_cmd "$@"

View File

@@ -167,6 +167,25 @@ get_app_image_repo() {
echo "$IMAGE_REPO"
}
get_deploying_app_image_name() {
declare desc="return deployed image identifier for a given app, tag tuple. validate if tag is presented"
local APP="$1"; local IMAGE_TAG="$2";
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null"
local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP")
local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP")
if [[ -n "$NEW_IMAGE_TAG" ]]; then
IMAGE_TAG="$NEW_IMAGE_TAG"
fi
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
if [[ -n "$IMAGE_REMOTE_REPOSITORY" ]]; then
IMAGE="${IMAGE_REMOTE_REPOSITORY}${IMAGE}"
fi
echo "$IMAGE"
}
get_app_image_name() {
declare desc="return image identifier for a given app, tag tuple. validate if tag is presented"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE_REPO=$(get_app_image_repo "$APP")
@@ -196,7 +215,7 @@ is_image_herokuish_based() {
declare desc="returns true if app image is based on herokuish"
# circleci can't support --rm as they run lxc in lxc
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec"
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec" &> /dev/null
}
is_number() {
@@ -228,6 +247,9 @@ parse_args() {
--quiet)
export DOKKU_QUIET_OUTPUT=1
;;
--detach)
export DOKKU_DETACH_CONTAINER=1
;;
--trace)
export DOKKU_TRACE=1
;;
@@ -266,7 +288,7 @@ copy_from_image() {
}
get_app_container_ids() {
declare desc="returns list of docker container ids for given app"
declare desc="returns list of docker container ids for given app and optional container_type"
local APP="$1"; local CONTAINER_TYPE="$2"
verify_app_name "$APP"
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(< "$DOKKU_ROOT/$APP/CONTAINER")
@@ -293,21 +315,37 @@ get_app_container_ids() {
}
get_app_running_container_ids() {
declare desc="return list of running docker container ids for given apps"
local APP=$1
declare desc="return list of running docker container ids for given app and optional container_type"
local APP="$1" CONTAINER_TYPE="$2"
verify_app_name "$APP"
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
local CIDS=$(get_app_container_ids "$APP")
local CIDS=$(get_app_container_ids "$APP" "$CONTAINER_TYPE")
for CID in $CIDS; do
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2>/dev/null || true)
[[ "$APP_CONTAINER_STATUS" == "true" ]] && local APP_RUNNING_CONTAINER_IDS+="$CID "
done
echo "$APP_RUNNING_CONTAINER_IDS"
}
get_app_running_container_types() {
declare desc="return list of running container types for given app"
local APP=$1 CONTAINER_TYPES
verify_app_name "$APP"
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
CONTAINER_TYPES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -print0 | xargs -0)"
if [[ -n "$CONTAINER_TYPES" ]]; then
CONTAINER_TYPES="${CONTAINER_TYPES//$DOKKU_ROOT\/$APP\//}"
CONTAINER_TYPES="$(tr " " $'\n' <<< "$CONTAINER_TYPES" | awk -F. '{ print $2 }' | sort | uniq | xargs)"
fi
echo "$CONTAINER_TYPES"
}
get_cmd_from_procfile() {
declare desc="parse cmd from app Procfile"
local APP=$1; local PROC_TYPE=$2; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
@@ -376,6 +414,272 @@ is_app_running() {
fi
}
dokku_build() {
declare desc="build phase"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local TMP_WORK_DIR="$3"; local IMAGE=$(get_app_image_name "$APP")
verify_app_name "$APP"
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
eval "$(config_export app "$APP")"
pushd "$TMP_WORK_DIR" &> /dev/null
case "$IMAGE_SOURCE_TYPE" in
herokuish)
local id=$(tar -c . | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
[[ -d $CACHE_DIR ]] || mkdir -p "$CACHE_DIR"
plugn trigger pre-build-buildpack "$APP"
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
docker attach "$id"
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
plugn trigger post-build-buildpack "$APP"
;;
dockerfile)
# extract first port from Dockerfile
local DOCKERFILE_PORTS=$(get_dockerfile_exposed_ports Dockerfile)
[[ -n "$DOCKERFILE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKERFILE_PORTS"
# extract ENTRYPOINT/CMD from Dockerfile
local DOCKERFILE_ENTRYPOINT=$(extract_directive_from_dockerfile Dockerfile ENTRYPOINT)
[[ -n "$DOCKERFILE_ENTRYPOINT" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_ENTRYPOINT="$DOCKERFILE_ENTRYPOINT"
local DOCKERFILE_CMD=$(extract_directive_from_dockerfile Dockerfile CMD)
[[ -n "$DOCKERFILE_CMD" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_CMD="$DOCKERFILE_CMD"
plugn trigger pre-build-dockerfile "$APP"
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
# strip --volume and -v args from DOCKER_ARGS
local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
# shellcheck disable=SC2086
docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE .
plugn trigger post-build-dockerfile "$APP"
;;
*)
dokku_log_fail "Building image source type $IMAGE_SOURCE_TYPE not supported!"
;;
esac
}
dokku_release() {
declare desc="release phase"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
case "$IMAGE_SOURCE_TYPE" in
herokuish)
plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG"
if [[ -n $(config_export global) ]]; then
local id=$(config_export global | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
fi
if [[ -n $(config_export app "$APP") ]]; then
local id=$(config_export app "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
fi
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
;;
dockerfile)
# buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
;;
*)
dokku_log_fail "Releasing image source type $IMAGE_SOURCE_TYPE not supported!"
;;
esac
}
dokku_deploy_cmd() {
declare desc="deploy phase"
local cmd="deploy"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
[[ -z $1 ]] && dokku_log_fail "Please specify an app to deploy"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
is_image_herokuish_based "$IMAGE" && local DOKKU_HEROKUISH=true
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
local oldids=$(get_app_container_ids "$APP")
local DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
local DOKKU_IS_APP_PROXY_ENABLED="$(is_app_proxy_enabled "$APP")"
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
local line; local PROC_TYPE; local PROC_COUNT; local CONTAINER_INDEX
while read -r line || [[ -n "$line" ]]; do
[[ "$line" =~ ^#.* ]] && continue
line="$(strip_inline_comments "$line")"
PROC_TYPE=${line%%=*}
PROC_COUNT=${line#*=}
CONTAINER_INDEX=1
if [[ "$(is_app_proctype_checks_disabled "$APP" "$PROC_TYPE")" == "true" ]]; then
dokku_log_info1 "zero downtime is disabled for app ($APP.$PROC_TYPE). stopping currently running containers"
local cid proctype_oldids="$(get_app_running_container_ids "$APP" "$PROC_TYPE")"
for cid in $proctype_oldids; do
dokku_log_info2 "stopping $APP.$PROC_TYPE ($cid)"
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$cid" &> /dev/null
done
fi
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
local id=""; local port=""; local ipaddr=""
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
# start the app
local DOCKER_ARGS="$DOKKU_DEFAULT_DOCKER_ARGS"
local DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' "
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
[[ -n "$DOKKU_HEROKUISH" ]] && local START_CMD="/start $PROC_TYPE"
if [[ -z "$DOKKU_HEROKUISH" ]]; then
local DOKKU_DOCKERFILE_PORTS=($(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true))
local DOKKU_DOCKERFILE_START_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_START_CMD || true)
local DOKKU_PROCFILE_START_CMD=$(get_cmd_from_procfile "$APP" "$PROC_TYPE")
local START_CMD=${DOKKU_DOCKERFILE_START_CMD:-$DOKKU_PROCFILE_START_CMD}
fi
if [[ "$PROC_TYPE" == "web" ]]; then
if [[ -z "${DOKKU_DOCKERFILE_PORTS[*]}" ]]; then
local port=5000
local DOKKU_DOCKER_PORT_ARGS+="-p $port"
else
local p
for p in ${DOKKU_DOCKERFILE_PORTS[*]};do
if [[ ! "$p" =~ .*udp.* ]]; then
# set port to first non-udp port
local p=${p//\/tcp}
local port=${port:="$p"}
fi
local DOKKU_DOCKER_PORT_ARGS+=" -p $p "
done
fi
if [[ "$DOKKU_IS_APP_PROXY_ENABLED" == "true" ]]; then
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
local ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$id")
# Docker < 1.9 compatibility
if [[ -z $ipaddr ]]; then
local ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$id")
fi
else
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
local port=$(docker port "$id" "$port" | sed 's/[0-9.]*://')
local ipaddr=127.0.0.1
fi
else
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOCKER_ARGS $IMAGE $START_CMD)
fi
kill_new() {
declare desc="wrapper function to kill newly started app container"
local id="$1"
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 proxy traffic
trap 'kill_new $id' INT TERM EXIT
if [[ "$(is_app_proctype_checks_disabled "$APP" "$PROC_TYPE")" == "false" ]]; then
dokku_log_info1 "Attempting pre-flight checks"
plugn trigger check-deploy "$APP" "$id" "$PROC_TYPE" "$port" "$ipaddr"
fi
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"
# cleanup pre-migration files
rm -f "$DOKKU_ROOT/$APP/CONTAINER" "$DOKKU_ROOT/$APP/IP" "$DOKKU_ROOT/$APP/PORT"
local CONTAINER_INDEX=$(( CONTAINER_INDEX + 1 ))
done
# cleanup when we scale down
if [[ "$PROC_COUNT" == 0 ]]; then
local CONTAINER_IDX_OFFSET=0
else
local CONTAINER_IDX_OFFSET=$((PROC_COUNT + 1))
fi
local container_state_filetype
for container_state_filetype in CONTAINER IP PORT; do
cd "$DOKKU_ROOT/$APP"
find . -maxdepth 1 -name "$container_state_filetype.$PROC_TYPE.*" -printf "%f\n" | sort -t . -k 3 -n | tail -n +$CONTAINER_IDX_OFFSET | xargs rm -f
done
done < "$DOKKU_SCALE_FILE"
dokku_log_info1 "Running post-deploy"
plugn trigger post-deploy "$APP" "$port" "$ipaddr" "$IMAGE_TAG"
# kill the old container
if [[ -n "$oldids" ]]; then
if [[ -z "$DOKKU_WAIT_TO_RETIRE" ]]; then
local DOKKU_APP_DOKKU_WAIT_TO_RETIRE=$(config_get "$APP" DOKKU_WAIT_TO_RETIRE || true)
local DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE=$(config_get --global DOKKU_WAIT_TO_RETIRE || true)
local DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
fi
# Let the old container finish processing requests, before terminating it
local WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
local oldid
for oldid in $oldids; do
dokku_log_info2 "$oldid"
done
(
exec >/dev/null 2>/dev/null </dev/null
trap '' INT HUP
sleep "$WAIT"
for oldid in $oldids; do
# Attempt to stop, if that fails, then force a kill as docker seems
# to not send SIGKILL as the docs would indicate. If that fails, move
# on to the next.
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$oldid" \
|| docker kill "$oldid" \
|| plugn trigger retire-container-failed "$APP" # plugin trigger for event logging
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
}
release_and_deploy() {
declare desc="main function for releasing and deploying an app"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
@@ -388,6 +692,11 @@ release_and_deploy() {
local IMAGE_SOURCE_TYPE="herokuish"
else
local IMAGE_SOURCE_TYPE="dockerfile"
local DOKKU_DOCKERFILE_PORTS=$(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true)
if [[ -z "$DOKKU_DOCKERFILE_PORTS" ]]; then
local DOCKER_IMAGE_PORTS=$(get_exposed_ports_from_image "$IMAGE")
[[ -n "$DOCKER_IMAGE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKER_IMAGE_PORTS"
fi
fi
local DOKKU_APP_SKIP_DEPLOY="$(config_get "$APP" DOKKU_SKIP_DEPLOY || true)"
@@ -396,11 +705,11 @@ release_and_deploy() {
local DOKKU_SKIP_DEPLOY=${DOKKU_APP_SKIP_DEPLOY:="$DOKKU_GLOBAL_SKIP_DEPLOY"}
dokku_log_info1 "Releasing $APP ($IMAGE)..."
dokku release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG"
dokku_release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG"
if [[ "$DOKKU_SKIP_DEPLOY" != "true" ]]; then
dokku_log_info1 "Deploying $APP ($IMAGE)..."
dokku deploy "$APP" "$IMAGE_TAG"
dokku_deploy_cmd "$APP" "$IMAGE_TAG"
dokku_log_info2 "Application deployed:"
get_app_urls urls "$APP" | sed "s/^/ /"
else
@@ -411,6 +720,23 @@ release_and_deploy() {
fi
}
dokku_receive() {
declare desc="receives an app kicks off deploy process"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local IMAGE_SOURCE_TYPE="$2"; local TMP_WORK_DIR="$3"
if [[ -z "$DOKKU_SKIP_CLEANUP" ]]; then
dokku_log_info1 "Cleaning up..."
docker_cleanup
else
dokku_log_info1 "DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup"
fi
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &> /dev/null
dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
release_and_deploy "$APP"
}
docker_cleanup() {
declare desc="cleans up all exited/dead containers and removes all dangling images"
# delete all non-running containers
@@ -530,9 +856,8 @@ disable_app_vhost() {
local APP=$1; verify_app_name "$APP"
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
local APP_URLS_FILE="$DOKKU_ROOT/$APP/URLS"
local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT)
local DOKKU_NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT)
plugn trigger pre-disable-vhost "$APP"
if [[ -f "$APP_VHOST_FILE" ]]; then
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
rm "$APP_VHOST_FILE"
@@ -541,12 +866,6 @@ disable_app_vhost() {
dokku_log_info1 "VHOST support disabled, deleting $APP/URLS"
rm "$APP_URLS_FILE"
fi
if [[ "$DOKKU_NGINX_PORT" == "80" ]]; then
config_unset --no-restart "$APP" DOKKU_NGINX_PORT
fi
if [[ "$DOKKU_NGINX_SSL_PORT" == "443" ]]; then
config_unset --no-restart "$APP" DOKKU_NGINX_SSL_PORT
fi
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
# shellcheck disable=SC2086
@@ -559,7 +878,7 @@ enable_app_vhost() {
local APP=$1; verify_app_name "$APP"
config_unset --no-restart "$APP" DOKKU_NGINX_PORT DOKKU_NGINX_SSL_PORT
plugn trigger pre-enable-vhost "$APP"
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
# shellcheck disable=SC2086
config_set $CONFIG_SET_ARGS "$APP" NO_VHOST=0
@@ -571,6 +890,29 @@ get_dockerfile_exposed_ports() {
echo "$DOCKERFILE_PORTS"
}
get_exposed_ports_from_image() {
declare desc="return all exposed ports from passed image name"
local IMAGE="$1"; verify_image "$IMAGE"
# shellcheck disable=SC2016
local DOCKER_IMAGE_EXPOSED_PORTS="$(docker inspect -f '{{range $key, $value := .Config.ExposedPorts}}{{$key}} {{end}}' "$IMAGE")"
echo "$DOCKER_IMAGE_EXPOSED_PORTS"
}
get_entrypoint_from_image() {
declare desc="return .Config.Entrypoint from passed image name"
local IMAGE="$1"; verify_image "$IMAGE"
local DOCKER_IMAGE_ENTRYPOINT="$(docker inspect --format '{{range .Config.Entrypoint}}{{.}} {{end}}' "$IMAGE")"
echo "ENTRYPOINT $DOCKER_IMAGE_ENTRYPOINT"
}
get_cmd_from_image() {
declare desc="return .Config.Cmd from passed image name"
local IMAGE="$1"; verify_image "$IMAGE"
local DOCKER_IMAGE_CMD="$(docker inspect --format '{{range .Config.Cmd}}{{.}} {{end}}' "$IMAGE")"
DOCKER_IMAGE_CMD="${DOCKER_IMAGE_CMD/\/bin\/sh -c/}"
echo "CMD $DOCKER_IMAGE_CMD"
}
extract_directive_from_dockerfile() {
declare desc="return requested directive from passed file path"
local FILE_PATH="$1"; local SEARCH_STRING="$2"
@@ -610,36 +952,43 @@ get_container_ports() {
get_app_urls() {
declare desc="print an app's available urls"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
local APP="$2"; verify_app_name "$APP"
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
local URLS_FILE="$DOKKU_ROOT/$APP/URLS"
local DOKKU_PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)
if [[ -s "$URLS_FILE" ]]; then
local app_urls="$(egrep -v "^#" "$URLS_FILE")"
if [[ -n "$RAW_TCP_PORTS" ]]; then
for url in ${app_urls[*]}; do
for p in $RAW_TCP_PORTS; do
local port_urls+="$url:$p "
if [[ -n "$DOKKU_PROXY_PORT_MAP" ]]; then
local port_map app_vhost
local app_vhosts=$(get_app_domains "$APP")
for port_map in $DOKKU_PROXY_PORT_MAP; do
local scheme="$(awk -F ':' '{ print $1 }' <<< "$port_map")"
local listen_port="$(awk -F ':' '{ print $2 }' <<< "$port_map")"
for app_vhost in $app_vhosts; do
if [[ "$listen_port" != "80" ]] && [[ "$listen_port" != "443" ]]; then
port_urls+=" $scheme://$app_vhost:$listen_port "
else
port_urls+=" $scheme://$app_vhost "
fi
done
done
local port_urls="$(echo "$port_urls"| xargs)"
fi
local URLS=${port_urls:=$app_urls}
local port_urls="$(echo "$port_urls"| xargs)"
local URLS="$(merge_dedupe_list "$port_urls $app_urls" " ")"
case "$1" in
url)
echo "$URLS" | tr ' ' '\n' | head -n1
;;
urls)
echo "$URLS" | tr ' ' '\n'
echo "$URLS" | tr ' ' '\n' | sort
;;
esac
else
local SCHEME="http"; local SSL="$DOKKU_ROOT/$APP/tls"
local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT || true)
local DOKKU_NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT || true)
if [[ -e "$SSL/server.crt" && -e "$SSL/server.key" ]]; then
local SCHEME="https"
fi
@@ -658,13 +1007,13 @@ get_app_urls() {
done
shopt -u nullglob
fi
elif [[ -n "$DOKKU_NGINX_PORT" ]] || [[ -n "$DOKKU_NGINX_SSL_PORT" ]]; then
if [[ -n "$DOKKU_NGINX_PORT" ]];then
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_PORT ($(get_app_proxy_type "$APP"))"
fi
if [[ -n "$DOKKU_NGINX_SSL_PORT" ]]; then
echo "https://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_SSL_PORT ($(get_app_proxy_type "$APP")-ssl)"
fi
elif [[ -n "$DOKKU_PROXY_PORT_MAP" ]]; then
local port_map
for port_map in $DOKKU_PROXY_PORT_MAP; do
local scheme="$(awk -F ':' '{ print $1 }' <<< "$port_map")"
local listen_port="$(awk -F ':' '{ print $2 }' <<< "$port_map")"
echo "$scheme://$(< "$DOKKU_ROOT/HOSTNAME"):$listen_port"
done
elif [[ -n "$RAW_TCP_PORTS" ]]; then
for p in $RAW_TCP_PORTS; do
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$p"
@@ -705,3 +1054,85 @@ strip_inline_comments() {
echo "$stripped_line"
}
is_valid_hostname() {
declare desc="return 0 if argument is a valid hostname; else return 1"
local hostname_string="$1"; local hostname_regex='^(([a-zA-Z0-9\*](-?[a-zA-Z0-9])*)\.)*[a-zA-Z\*](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$'
if [[ $hostname_string =~ $hostname_regex ]]; then
return 0
else
return 1
fi
}
is_val_in_list() {
declare desc="return true if value ($1) is in list ($2) separated by delimiter ($3); delimiter defaults to comma"
local value="$1" list="$2" delimiter="${3:-,}"
local IFS="$delimiter" val_in_list=false
for val in $list; do
if [[ "$val" == "$value" ]]; then
val_in_list=true
fi
done
echo "$val_in_list"
}
remove_val_from_list() {
declare desc="remove value ($1) from list ($2) separated by delimiter ($3) (delimiter defaults to comma) and return list"
local value="$1" list="$2" delimiter="${3:-,}"
list="${list//$value/}"
list="${list//$delimiter$delimiter/$delimiter}"
list="${list/#$delimiter/}"
list="${list/%$delimiter/}"
echo "$list"
}
add_val_to_list() {
declare desc="add value ($1) to list ($2) separated by delimiter ($3) (delimiter defaults to comma) and return list"
local value="$1" list="$2" delimiter="${3:-,}"
list+="${delimiter}$value"
echo "$list"
}
merge_dedupe_list() {
declare desc="combine lists ($1) separated by delimiter ($2) (delimiter defaults to comma), dedupe and return list"
local input_lists="$1" delimiter="${2:-,}"
local merged_list="$(tr "$delimiter" $'\n' <<< "$input_lists" | sort | uniq | xargs)"
echo "$merged_list"
}
acquire_app_deploy_lock() {
declare desc="acquire advisory lock for use in git/tar deploys"
local APP="$1"; verify_app_name "$APP"
local LOCK_TYPE="${2:-waiting}"
local APP_DEPLOY_LOCK_FD="200"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
local LOCK_WAITING_MSG="$APP is currently being deployed. Waiting..."
local LOCK_FAILED_MSG="$APP is currently being deployed. Exiting..."
local SHOW_MSG=true
eval "exec $APP_DEPLOY_LOCK_FD>$APP_DEPLOY_LOCK_FILE"
if [[ "$LOCK_TYPE" == "waiting" ]]; then
while [[ $(flock -n "$APP_DEPLOY_LOCK_FD" &>/dev/null ; echo $?) -ne 0 ]]; do
if [[ "$SHOW_MSG" == "true" ]]; then
echo "$LOCK_WAITING_MSG"
SHOW_MSG=false
fi
sleep 1
done
else
flock -n "$APP_DEPLOY_LOCK_FD" &>/dev/null || dokku_log_fail "$LOCK_FAILED_MSG"
fi
}
release_app_deploy_lock() {
declare desc="release advisory lock used in git/tar deploys"
local APP="$1"; verify_app_name "$APP"
local APP_DEPLOY_LOCK_FD="200"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
flock -u "$APP_DEPLOY_LOCK_FD" && rm -f "$APP_DEPLOY_LOCK_FILE" &> /dev/null
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core common plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

8
plugins/config/functions Normal file → Executable file
View File

@@ -160,6 +160,8 @@ config_get() {
config_set() {
declare desc="set value of given config var"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
[[ "$1" == "config:set" ]] || set -- "config:set" "$@"
config_parse_args "$@"
@@ -214,12 +216,14 @@ ${var}"
[[ $APP ]] && local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]] && [[ "$DOKKU_APP_RESTORE" != 0 ]]; then
dokku_log_info1 "Restarting app $APP"
dokku ps:restart "$APP"
ps_restart "$APP"
fi
}
config_unset() {
declare desc="unset given config var"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
[[ "$1" == "config:unset" ]] || set -- "config:unset" "$@"
config_parse_args "$@"
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
@@ -247,6 +251,6 @@ config_unset() {
[[ $APP ]] && local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]] && [[ "$DOKKU_APP_RESTORE" != 0 ]]; then
dokku_log_info1 "Restarting app $APP"
dokku ps:restart "$APP"
ps_restart "$APP"
fi
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core config plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

0
plugins/docker-options/functions Normal file → Executable file
View File

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core docker-options plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -66,15 +66,20 @@ domains_add() {
verify_app_name "$1"
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
if [[ $(egrep -w "^${2}$" "$APP_VHOST_PATH" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
dokku_log_fail "$2 is already defined for $APP"
exit 1
fi
shift 1
for DOMAIN in "$@"; do
if ! (is_valid_hostname "$DOMAIN"); then
dokku_log_fail "$DOMAIN is invalid. exiting..."
fi
done
for DOMAIN in "$@"; do
echo "$DOMAIN" >> "$APP_VHOST_PATH"
dokku_log_info1 "Added $DOMAIN to $APP"
if [[ $(egrep -w "^$DOMAIN$" "$APP_VHOST_PATH" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
dokku_log_info1 "Skipping: $DOMAIN already added to $APP"
else
echo "$DOMAIN" >> "$APP_VHOST_PATH"
dokku_log_info1 "Added $DOMAIN to $APP"
fi
done
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]];then
@@ -92,7 +97,7 @@ domains_remove() {
shift 1
for DOMAIN in "$@"; do
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
sed -i "\|^$DOMAIN\$|d" "$DOKKU_ROOT/$APP/VHOST"
dokku_log_info1 "Removed $DOMAIN from $APP"
done
plugn trigger post-domains-update "$APP" "remove" "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core domains plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core enter plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -7,25 +7,45 @@ enter_default_cmd() {
local cmd="enter"
local APP="$2"; local CONTAINER_TYPE="$3"; local IMAGE_TAG=$(get_running_image_tag "$APP"); local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
local AVAILABLE_CONTAINER_TYPES=($(get_app_running_container_types "$APP"))
[[ ! -n "$3" ]] && dokku_log_fail "No container id specified"
if [[ -z "$3" ]]; then
if [[ ${#AVAILABLE_CONTAINER_TYPES[@]} -gt 1 ]]; then
dokku_log_warn "No container type specified."
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[@]}"
else
CONTAINER_TYPE="${AVAILABLE_CONTAINER_TYPES[0]}"
fi
fi
if [[ "$3" == "--container-id" ]]; then
[[ ! -n "$4" ]] && dokku_log_fail "No container id specified"
local DOKKU_APP_CIDS=( $(get_app_container_ids "$APP") )
printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -q -e "^$4" || dokku_log_fail "Invalid container id for app"
if [[ ! -n "$4" ]]; then
dokku_log_warn "No container id specified."
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[@]}"
fi
if ! (printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -q -e "^$4"); then
dokku_log_warn "Invalid container id for app"
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[@]}"
fi
local ID=$(printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -e "^$4")
shift 4
else
local DOKKU_APP_CIDS=( $(get_app_container_ids "$APP" "$CONTAINER_TYPE") )
local ID=${DOKKU_APP_CIDS[0]}
[[ ! -n $ID ]] && dokku_log_fail "No containers found for type '$CONTAINER_TYPE'"
shift 3
if [[ ! -n $ID ]]; then
dokku_log_warn "No containers found for type '$CONTAINER_TYPE'"
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[@]}"
fi
if [[ $3 ]]; then
shift 3
else
shift 2
fi
fi
docker ps -aq --no-trunc | grep -e "^$ID" > /dev/null || dokku_log_fail "Container does not exist"
docker ps -q --no-trunc | grep -e "^$ID" > /dev/null || dokku_log_fail "Container is not running"
docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist"
docker inspect -f '{{ .State.Running }}' "$ID" | grep -q "true" > /dev/null || dokku_log_fail "Container is not running"
local EXEC_CMD=""
has_tty && local DOKKU_RUN_OPTS+=" -i -t"

View File

@@ -1,130 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
git_build_app_repo() {
declare desc="builds local git app repo for app"
verify_app_name "$1"
local APP="$1"; local REV="$2"
# clean up after ourselves
local GIT_BUILD_APP_REPO_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_git.XXXX")
trap 'rm -rf "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
# git clone - this method creates a new git repository and adds the primary
# repo as a remote, then does a fetch depth=1 to avoid cloning
# the entire repo
local TMP_TAG="dokku/$REV"
chmod 755 "$GIT_BUILD_APP_REPO_TMP_WORK_DIR"
unset GIT_DIR GIT_WORK_TREE
pushd "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null
[[ ! -d "$DOKKU_ROOT/$APP" ]] && apps_create "$APP"
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
GIT_DIR="$DOKKU_ROOT/$APP" git tag "$TMP_TAG" "$REV" &> /dev/null
git init &> /dev/null
git config advice.detachedHead false
git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null
git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null
git reset --hard FETCH_HEAD &> /dev/null
git submodule update --init --recursive &> /dev/null
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
find -name .git -prune -exec rm -rf {} \; > /dev/null
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then
plugn trigger pre-receive-app "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
dokku receive "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
else
plugn trigger pre-receive-app "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
dokku receive "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
fi
}
git_hook_cmd() {
declare desc="kick off receive-app trigger from git prereceive hook"
local cmd="git-hook"
local APP="$2"
local oldrev newrev refname
while read -r oldrev newrev refname; do
# Only run this script for the master branch. You can remove this
# if block if you wish to run it for others as well.
if [[ $refname = "refs/heads/master" ]]; then
# broken out into plugin so we might support other methods to receive an app
# shellcheck disable=SC2086
plugn trigger receive-app $APP $newrev
else
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 0 ]]; then
# shellcheck disable=SC2086
plugn trigger receive-branch $APP $newrev $refname
else
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
fi
fi
done
}
git_upload_pack_cmd() {
declare desc="executes git-upload-pack"
local cmd="git-upload-pack"
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
plugn trigger git-pre-pull "$APP"
cat | git-upload-pack "$DOKKU_ROOT/$APP"
plugn trigger git-post-pull "$APP"
}
git_build_cmd() {
declare desc="lock git-build"
local cmd="git-build"
local APP="$2"; local APP_BUILD_LOCK="$DOKKU_ROOT/$APP/.build.lock"
local APP_BUILD_LOCK_MSG="$APP is currently being deployed or locked. Waiting..."
[[ $(flock -n "$APP_BUILD_LOCK" true &>/dev/null ; echo $?) -ne 0 ]] && echo "$APP_BUILD_LOCK_MSG"
shift 1
flock -o "$APP_BUILD_LOCK" dokku git-build-locked "$@"
}
git_build_locked_cmd() {
declare desc="setup and call git_build_app_repo"
local cmd="git-build-locked"
local APP="$2"
if [[ $# -ge 3 ]]; then
local REF="$3"
else
local REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
fi
# shellcheck disable=SC2086
git_build_app_repo $APP $REF
}
git_glob_cmd() {
declare desc="catch-all for any other git-* commands"
local cmd="git-*"
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
local APP_PATH=$DOKKU_ROOT/$APP
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
git init --bare "$APP_PATH" > /dev/null
local PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
cat > "$PRERECEIVE_HOOK" <<EOF
#!/usr/bin/env bash
set -e; set -o pipefail;
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
EOF
chmod +x "$PRERECEIVE_HOOK"
fi
if [[ $1 == "git-receive-pack" ]]; then
local args="$1 '$APP_PATH'"
else
local args=$*
fi
git-shell -c "$args"
}
source "$PLUGIN_AVAILABLE_PATH/git/functions"
case "$1" in
git-hook)
@@ -135,14 +11,6 @@ case "$1" in
git_upload_pack_cmd "$@"
;;
git-build)
git_build_cmd "$@"
;;
git-build-locked)
git_build_locked_cmd "$@"
;;
git-*)
git_glob_cmd "$@"
;;

115
plugins/git/functions Executable file
View File

@@ -0,0 +1,115 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
git_build_app_repo() {
declare desc="builds local git app repo for app"
verify_app_name "$1"
local APP="$1"; local REV="$2"
# clean up after ourselves
local GIT_BUILD_APP_REPO_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_git.XXXX")
trap 'rm -rf "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
# git clone - this method creates a new git repository and adds the primary
# repo as a remote, then does a fetch depth=1 to avoid cloning
# the entire repo
local TMP_TAG="dokku/$REV"
chmod 755 "$GIT_BUILD_APP_REPO_TMP_WORK_DIR"
unset GIT_DIR GIT_WORK_TREE
pushd "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null
[[ ! -d "$DOKKU_ROOT/$APP" ]] && apps_create "$APP"
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
GIT_DIR="$DOKKU_ROOT/$APP" git tag "$TMP_TAG" "$REV" &> /dev/null
git init &> /dev/null
git config advice.detachedHead false
git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null
git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null
git reset --hard FETCH_HEAD &> /dev/null
git submodule update --init --recursive &> /dev/null
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
find -name .git -prune -exec rm -rf {} \; > /dev/null
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then
plugn trigger pre-receive-app "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
dokku_receive "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
else
plugn trigger pre-receive-app "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
dokku_receive "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
fi
}
git_hook_cmd() {
declare desc="kick off receive-app trigger from git prereceive hook"
local cmd="git-hook"
local APP="$2"
local oldrev newrev refname
while read -r oldrev newrev refname; do
# Only run this script for the master branch. You can remove this
# if block if you wish to run it for others as well.
if [[ $refname = "refs/heads/master" ]]; then
# broken out into plugin so we might support other methods to receive an app
# shellcheck disable=SC2086
plugn trigger receive-app $APP $newrev
else
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 0 ]]; then
# shellcheck disable=SC2086
plugn trigger receive-branch $APP $newrev $refname
else
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
fi
fi
done
}
git_build() {
declare desc="setup and call git_build_app_repo"
local APP="$1"
if [[ $# -ge 2 ]]; then
local REF="$2"
else
local REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
fi
# shellcheck disable=SC2086
git_build_app_repo $APP $REF
}
git_upload_pack_cmd() {
declare desc="executes git-upload-pack"
local cmd="git-upload-pack"
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
plugn trigger git-pre-pull "$APP"
cat | git-upload-pack "$DOKKU_ROOT/$APP"
plugn trigger git-post-pull "$APP"
}
git_glob_cmd() {
declare desc="catch-all for any other git-* commands"
local cmd="git-*"
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
local APP_PATH=$DOKKU_ROOT/$APP
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
git init --bare "$APP_PATH" > /dev/null
local PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
cat > "$PRERECEIVE_HOOK" <<EOF
#!/usr/bin/env bash
set -e; set -o pipefail;
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
EOF
chmod +x "$PRERECEIVE_HOOK"
fi
if [[ $1 == "git-receive-pack" ]]; then
local args="$1 '$APP_PATH'"
else
local args=$*
fi
git-shell -c "$args"
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core git plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/git/functions"
git_receive_app(){
git_receive_app() {
declare desc="git receive-app plugin trigger"
local trigger="git_receive_app"
local APP="$1"; local REV="$2"
@@ -11,8 +12,10 @@ git_receive_app(){
if [[ ! -d "$DOKKU_ROOT/$APP/refs" ]]; then
true
else
acquire_app_deploy_lock "$APP" "exclusive"
# shellcheck disable=SC2086
dokku git-build $APP $REV
git_build $APP $REV
release_app_deploy_lock "$APP"
fi
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core logs plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core named containers plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -6,9 +6,10 @@ named_containers_post_deploy() {
declare desc="names deployed app container is consistent manner"
local trigger="named_containers_post_deploy"
local APP="$1"; local APP_ROOT="$DOKKU_ROOT/$APP"
[[ -z $(stat -t "$APP_ROOT"/CONTAINER.* 2>/dev/null) ]] && exit 0
local container
for container in "$APP_ROOT"/CONTAINER.*; do
shopt -s nullglob
for container in $APP_ROOT/CONTAINER.*; do
local DYNO=$(echo "$container" | sed -r 's/.*CONTAINER\.(.*)/\1/') || true
local NAME="$APP.$DYNO"
local CURRENT_CONTAINER_ID="$(< "$container")"
@@ -29,9 +30,12 @@ named_containers_post_deploy() {
fi
local ID=$(cat "$container")
local CURRENT_NAME=$(docker inspect -f '{{.Name}}' "$ID" | tr -d /)
dokku_log_info2_quiet "renaming container (${ID:0:12}) $CURRENT_NAME to $NAME"
docker rename "$CURRENT_NAME" "$NAME" > /dev/null
if [[ -n "$CURRENT_NAME" ]]; then
dokku_log_info2_quiet "renaming container (${ID:0:12}) $CURRENT_NAME to $NAME"
docker rename "$CURRENT_NAME" "$NAME" > /dev/null
fi
done
shopt -u nullglob
}
named_containers_post_deploy "$@"

View File

@@ -1,32 +1,63 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$DOKKU_DISTRO" in
debian)
export DEBIAN_FRONTEND=noninteractive
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
;;
nginx_needs_upgrade() {
declare desc="checks as to whether nginx needs to be installed or upgraded"
local MAJOR_VERSION MINOR_VERSION
local NEEDS_UPGRADE=true
ubuntu)
export DEBIAN_FRONTEND=noninteractive
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
if ! which nginx > /dev/null 2>&1; then
echo $NEEDS_UPGRADE
return
fi
ubuntu_year=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[1]}')
ubuntu_month=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[2]}')
[[ "$ubuntu_year" -ge "16" ]] && exit 0
[[ "$ubuntu_year" -eq "15" ]] && [[ "$ubuntu_month" -eq "10" ]] && exit 0
MAJOR_VERSION=$(nginx -v 2>&1 | cut -d'/' -f 2 | awk '{split($0,a,"."); print a[1]}')
MINOR_VERSION=$(nginx -v 2>&1 | cut -d'/' -f 2 | awk '{split($0,a,"."); print a[2]}')
if [[ "$MAJOR_VERSION" -ge "2" ]]; then
NEEDS_UPGRADE=false
elif [[ "$MAJOR_VERSION" -ge "1" ]] && [[ "$MINOR_VERSION" -ge "8" ]]; then
NEEDS_UPGRADE=false
fi
add-apt-repository -y ppa:nginx/stable
apt-get update -qq > /dev/null
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
;;
echo $NEEDS_UPGRADE
}
opensuse)
zypper -q in -y nginx bind-utils
;;
nginx_dependencies() {
declare desc="installs dependencies for the nginx-vhosts plugin"
case "$DOKKU_DISTRO" in
debian)
export DEBIAN_FRONTEND=noninteractive
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
;;
arch)
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
;;
esac
ubuntu)
export DEBIAN_FRONTEND=noninteractive
local NEEDS_UPGRADE=$(nginx_needs_upgrade)
if [[ "$NEEDS_UPGRADE" == "false" ]]; then
return
fi
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
ubuntu_year=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[1]}')
ubuntu_month=$(lsb_release -d | cut -d ' ' -f 2 | awk '{split($0,a,"."); print a[2]}')
[[ "$ubuntu_year" -ge "16" ]] && exit 0
[[ "$ubuntu_year" -eq "15" ]] && [[ "$ubuntu_month" -eq "10" ]] && exit 0
add-apt-repository -y ppa:nginx/stable
apt-get update -qq > /dev/null
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
;;
opensuse)
zypper -q in -y nginx bind-utils
;;
arch)
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
;;
esac
}
nginx_dependencies "$@"

View File

@@ -14,6 +14,12 @@ validate_nginx() {
set -e
if [[ "$exit_code" -ne "0" ]]; then
sudo /usr/sbin/nginx -t
shopt -s nullglob
local conf_file
for conf_file in $DOKKU_ROOT/*/nginx.conf; do
dokku_log_verbose "validate_nginx failed. contents of $conf_file below..."
cat "$conf_file"
done
exit "$exit_code"
fi
}
@@ -61,30 +67,51 @@ configure_nginx_ports() {
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT)
local DOKKU_NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT)
local DOKKU_PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP)
local IS_APP_VHOST_ENABLED="$(is_app_vhost_enabled "$APP")"
local UPSTREAM_PORT="5000"
if [[ -z "$DOKKU_NGINX_PORT" ]]; then
if [[ -z "$RAW_TCP_PORTS" ]]; then
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
dokku_log_info1 "no nginx port set. setting to random open high port"
local NGINX_PORT=$(get_available_port)
else
local NGINX_PORT=80
fi
if [[ -z "$DOKKU_NGINX_PORT" ]] && [[ -z "$RAW_TCP_PORTS" ]]; then
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
dokku_log_info1 "no nginx port set. setting to random open high port"
local NGINX_PORT=$(get_available_port)
else
local NGINX_PORT=80
fi
if [[ -n "$NGINX_PORT" ]]; then
config_set --no-restart "$APP" DOKKU_NGINX_PORT="${NGINX_PORT}"
config_set --no-restart "$APP" DOKKU_NGINX_PORT="$NGINX_PORT"
fi
if [[ -z "$DOKKU_NGINX_SSL_PORT" ]]; then
if (is_ssl_enabled "$APP") && [[ -z "$RAW_TCP_PORTS" ]]; then
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
dokku_log_info1 "no nginx ssl port set. setting to random open high port"
local NGINX_SSL_PORT=$(get_available_port)
else
local NGINX_SSL_PORT=443
fi
config_set --no-restart "$APP" DOKKU_NGINX_SSL_PORT="$NGINX_SSL_PORT"
fi
fi
if (is_ssl_enabled "$APP") && [[ -z "$DOKKU_NGINX_SSL_PORT" ]] && [[ -z "$RAW_TCP_PORTS" ]]; then
if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then
dokku_log_info1 "no nginx ssl port set. setting to random open high port"
local NGINX_SSL_PORT=$(get_available_port)
if [[ -z "$DOKKU_PROXY_PORT_MAP" ]]; then
if [[ -n "$RAW_TCP_PORTS" ]]; then
local RAW_TCP_PORT
for RAW_TCP_PORT in $RAW_TCP_PORTS; do
local PROXY_PORT_MAP+=" http:${RAW_TCP_PORT}:${RAW_TCP_PORT} "
done
else
local NGINX_SSL_PORT=443
local NGINX_PORT=${NGINX_PORT:-$DOKKU_NGINX_PORT}
local NGINX_SSL_PORT=${NGINX_SSL_PORT:-$DOKKU_NGINX_SSL_PORT}
[[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]] && local UPSTREAM_PORT="$(< "$DOKKU_ROOT/$APP/PORT.web.1")"
if [[ -n "$NGINX_PORT" ]] && [[ -n "$NGINX_SSL_PORT" ]]; then
local PROXY_PORT_MAP+=" http:${NGINX_PORT}:$UPSTREAM_PORT https:${NGINX_SSL_PORT}:$UPSTREAM_PORT "
elif [[ -n "$NGINX_PORT" ]]; then
local PROXY_PORT_MAP+=" http:${NGINX_PORT}:$UPSTREAM_PORT "
fi
fi
if [[ -n "$PROXY_PORT_MAP" ]]; then
local PROXY_PORT_MAP="$(echo "$PROXY_PORT_MAP" | xargs)"
local PROXY_PORT_MAP+=" $(merge_dedupe_list "$(remove_val_from_list "$PORT_MAP" "$DOKKU_PROXY_PORT_MAP" " ")" " ") "
config_set --no-restart "$APP" DOKKU_PROXY_PORT_MAP="$PROXY_PORT_MAP"
fi
config_set --no-restart "$APP" DOKKU_NGINX_SSL_PORT="${NGINX_SSL_PORT}"
fi
}
@@ -93,12 +120,12 @@ validate_ssl_domains() {
local APP=$1; verify_app_name "$APP"
local SSL_HOSTNAME=$(get_ssl_hostnames "$APP")
local SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | xargs | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g' | sed 's/ /|/g')
local domain
if ! (egrep -q "^${SSL_HOSTNAME_REGEX}$" "$VHOST_PATH" &> /dev/null); then
dokku_log_info1 "No matching configured domains for $APP found in SSL certificate. Your app will show as insecure in a browser if accessed via SSL"
dokku_log_info1 "Please add appropriate domains via the dokku domains command"
[[ -n "$NONSSL_VHOSTS" ]] && dokku_log_info1 "Configured domains for app:"
local domain
for domain in $(echo "$NONSSL_VHOSTS"| xargs); do
dokku_log_info2 "$domain"
done
@@ -120,6 +147,33 @@ get_custom_nginx_template() {
copy_from_image "$IMAGE" "$NGINX_TEMPLATE_NAME" "$DESTINATION" 2>/dev/null || true
}
is_spdy_enabled() {
declare desc="detects whether the installed nginx version has spdy or http2 support"
local NGINX_VERSION="$1"
local MAJOR_VERSION MINOR_VERSION PATCH_VERSION
local HAS_SUPPORT=true
if ! which nginx > /dev/null 2>&1; then
echo $HAS_SUPPORT
return
fi
MAJOR_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[1]}')
MINOR_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[2]}')
PATCH_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[3]}')
if [[ "$MAJOR_VERSION" -ge "2" ]]; then
HAS_SUPPORT=false
elif [[ "$MAJOR_VERSION" -eq "1" ]]; then
if [[ "$MINOR_VERSION" -ge "10" ]]; then
HAS_SUPPORT=false
elif [[ "$MINOR_VERSION" -ge "9" ]] && [[ "$PATCH_VERSION" -ge "5" ]]; then
HAS_SUPPORT=false
fi
fi
echo $HAS_SUPPORT
}
nginx_build_config() {
declare desc="build nginx config to proxy app containers using sigil"
local APP="$1"; verify_app_name "$APP"
@@ -142,19 +196,29 @@ nginx_build_config() {
local DOKKU_APP_PORT_FILE="${DOKKU_APP_IP_FILE//IP/PORT}"
local DOKKU_APP_LISTENER_IP=$(< "$DOKKU_APP_IP_FILE")
local DOKKU_APP_LISTENER_PORT=$(< "$DOKKU_APP_PORT_FILE")
if [[ -z "$RAW_TCP_PORTS" ]]; then
local DOKKU_APP_LISTENERS+=" $DOKKU_APP_LISTENER_IP:$DOKKU_APP_LISTENER_PORT "
else
local DOKKU_APP_LISTENERS+=" $DOKKU_APP_LISTENER_IP "
fi
local DOKKU_APP_LISTENERS=$(echo "$DOKKU_APP_LISTENERS" | xargs)
local DOKKU_APP_LISTENERS+="$DOKKU_APP_LISTENER_IP:$DOKKU_APP_LISTENER_PORT "
done
local DOKKU_APP_LISTENERS="$(echo "$DOKKU_APP_LISTENERS" | xargs)"
shopt -u nullglob
elif [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
local PASSED_LISTEN_IP_PORT=true
fi
# setup nginx listen ports
configure_nginx_ports "$APP"
local NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT)
local NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT)
local PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP)
local PORT_MAP
for PORT_MAP in $PROXY_PORT_MAP; do
local PROXY_UPSTREAM_PORT="$(awk -F ':' '{ print $3 }' <<< "$PORT_MAP")"
if [[ "$(is_val_in_list "$PROXY_UPSTREAM_PORT" "$PROXY_UPSTREAM_PORTS" " ")" == "false" ]]; then
local PROXY_UPSTREAM_PORTS+="$PROXY_UPSTREAM_PORT "
fi
done
local PROXY_UPSTREAM_PORTS="$(echo "$PROXY_UPSTREAM_PORTS" | xargs)"
local NGINX_BUILD_CONFIG_TMP_WORK_DIR=$(mktemp -d /tmp/dokku_nginx_template.XXXXX)
local NGINX_CONF=$(mktemp --tmpdir="${NGINX_BUILD_CONFIG_TMP_WORK_DIR}" "nginx.conf.XXXXXX")
local CUSTOM_NGINX_TEMPLATE="$NGINX_BUILD_CONFIG_TMP_WORK_DIR/$NGINX_TEMPLATE_NAME"
@@ -168,11 +232,6 @@ nginx_build_config() {
local NGINX_TEMPLATE_SOURCE="app-supplied"
fi
# setup nginx listen ports
configure_nginx_ports "$APP"
local NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT)
local NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT)
local NONSSL_VHOSTS=$(get_app_domains "$APP")
local NOSSL_SERVER_NAME=$(echo "$NONSSL_VHOSTS" | xargs)
if is_ssl_enabled "$APP"; then
@@ -188,19 +247,25 @@ nginx_build_config() {
fi
local SSL_SERVER_NAME=$(echo "$SSL_VHOSTS" | xargs)
fi
local NGINX_VERSION="$(nginx -v 2>&1 | cut -d'/' -f 2)"
local SPDY_SUPPORTED="$(is_spdy_enabled "$NGINX_VERSION")"
eval "$(config_export app "$APP")"
local SIGIL_PARAMS=(-f $NGINX_TEMPLATE APP="$APP" DOKKU_ROOT="$DOKKU_ROOT"
NOSSL_SERVER_NAME="$NOSSL_SERVER_NAME"
DOKKU_APP_LISTENERS="$DOKKU_APP_LISTENERS"
PASSED_LISTEN_IP_PORT="$PASSED_LISTEN_IP_PORT"
SPDY_SUPPORTED="$SPDY_SUPPORTED"
DOKKU_APP_LISTEN_PORT="$DOKKU_APP_LISTEN_PORT" DOKKU_APP_LISTEN_IP="$DOKKU_APP_LISTEN_IP"
APP_SSL_PATH="$APP_SSL_PATH" SSL_INUSE="$SSL_INUSE" SSL_SERVER_NAME="$SSL_SERVER_NAME"
NGINX_PORT="$NGINX_PORT" NGINX_SSL_PORT="$NGINX_SSL_PORT" RAW_TCP_PORTS="$RAW_TCP_PORTS")
NGINX_PORT="$NGINX_PORT" NGINX_SSL_PORT="$NGINX_SSL_PORT" RAW_TCP_PORTS="$RAW_TCP_PORTS"
PROXY_PORT_MAP="$PROXY_PORT_MAP" PROXY_UPSTREAM_PORTS="$PROXY_UPSTREAM_PORTS")
# execute sigil template processing
xargs -i echo "-----> Configuring {}...(using $NGINX_TEMPLATE_SOURCE template)" <<< "$(echo "${SSL_VHOSTS}" "${NONSSL_VHOSTS}" | tr ' ' '\n' | sort -u)"
# echo "sigil ${SIGIL_PARAMS[@]}"
sigil "${SIGIL_PARAMS[@]}" > "$NGINX_CONF"
sigil "${SIGIL_PARAMS[@]}" | cat -s > "$NGINX_CONF"
if is_deployed "$APP"; then
dokku_log_info1 "Creating $SCHEME nginx.conf"

View File

@@ -36,7 +36,10 @@ ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:
EOF
fi
echo 'server_names_hash_bucket_size 512;' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
# allow users to override their server_names_hash_bucket_size
if [[ ! -f /etc/nginx/conf.d/server_names_hash_bucket_size.conf ]]; then
echo 'server_names_hash_bucket_size 512;' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
fi
# revert dokku group changes
gpasswd -a dokku adm
@@ -49,18 +52,24 @@ gpasswd -M "" dokku
case "$DOKKU_DISTRO" in
debian)
/usr/sbin/invoke-rc.d nginx start
NGINX_INIT="/usr/sbin/invoke-rc.d"
"$NGINX_INIT" nginx start || "$NGINX_INIT" nginx reload
;;
ubuntu)
/etc/init.d/nginx start
NGINX_INIT="/etc/init.d/nginx"
"$NGINX_INIT" start || "$NGINX_INIT" reload
;;
opensuse)
/sbin/service nginx start
NGINX_INIT="/sbin/service"
"$NGINX_INIT" nginx start || "$NGINX_INIT" nginx reload
;;
arch)
/usr/bin/systemctl start nginx
NGINX_INIT="/usr/bin/systemctl"
"$NGINX_INIT" start nginx || "$NGINX_INIT" reload nginx
;;
esac

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core nginx-vhosts plugin"
version = "0.5.6"
version = "0.6.4"
[plugin.config]

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
nginx_post_certs_remove() {
declare desc="unset port config vars after SSL cert is removed"
local trigger="nginx_post_certs_remove"
local APP="$1"
if [[ "$(get_app_proxy_type "$APP")" == "nginx" ]]; then
config_unset --no-restart "$APP" DOKKU_NGINX_PORT DOKKU_NGINX_SSL_PORT DOKKU_PROXY_PORT_MAP
fi
}
nginx_post_certs_remove "$@"

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