Compare commits

...

160 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
12ca7adcd1 Release 0.5.2 2016-03-27 17:09:36 -04:00
Jose Diaz-Gonzalez
a4e8efedc8 Merge pull request #2027 from dokku/2025_mh-sigil-deb-dep
add sigil to debian control file
2016-03-27 17:01:49 -04:00
Michael Hobbs
d86ed5d6ee [ci skip] add sigil to debian control file. closes #2025 2016-03-27 10:30:06 -07:00
Jose Diaz-Gonzalez
668dc0e7a5 Release 0.5.1 2016-03-26 19:54:25 -04:00
Jose Diaz-Gonzalez
f5b454e110 Merge pull request #2024 from dokku/delete-bad-symlinks
Delete bad symlinks without confirmation
2016-03-26 19:33:13 -04:00
Jose Diaz-Gonzalez
aefd5bb251 Delete bad symlinks without confirmation
[ci skip]
2016-03-26 19:28:09 -04:00
Jose Diaz-Gonzalez
8b8df9e093 Merge pull request #2023 from dokku/sigil-packaging
Sigil packaging
2016-03-26 19:20:13 -04:00
Jose Diaz-Gonzalez
cdd62b09d3 Correctly build sigil using the sigil makefile
[ci skip]
2016-03-26 19:19:32 -04:00
Jose Diaz-Gonzalez
107697dc95 Clone proper sigil tag for packaging
[ci skip]
2016-03-26 19:19:12 -04:00
Jose Diaz-Gonzalez
cae5030804 Release 0.5.0
- Drop tutum-agent, lxc-docker, docker.io apt package support
- Release a new herokuish version
- Fix release docs
- Upgrade sigil
2016-03-26 18:13:14 -04:00
Michael Hobbs
4357e529ce Merge pull request #1983 from dokku/u2mejc-issue1688
Collapse help into expandable command topics
2016-03-22 15:02:39 -07:00
Michael Hobbs
7becc749aa Merge pull request #2013 from dokku/mh-issue1688-help-desc
make help desc local consistent
2016-03-22 13:54:23 -07:00
Michael Hobbs
de9b1f6273 [ci skip] make help desc local consistent 2016-03-22 13:33:35 -07:00
Justin Clark
14a1d06c03 Collapse help into expandable command topics 2016-03-22 10:50:20 -07:00
Michael Hobbs
f864017cc5 Merge pull request #2012 from dokku/mh-minor-bug-fixes
minor bug fixes around app.json and docker-options
2016-03-22 06:50:56 -07:00
Michael Hobbs
0f4ff8b724 no need for newlines in docker args 2016-03-21 18:57:14 -07:00
Michael Hobbs
024f98c2c8 make sure we set HOME and exit with status from app.json script 2016-03-21 18:56:20 -07:00
Michael Hobbs
1b78f5c882 actually test docker-options are ending up in container config 2016-03-21 09:26:27 -07:00
Jose Diaz-Gonzalez
693297ac9e Add missing dividers
[ci skip]
2016-03-21 01:48:16 -04:00
Jose Diaz-Gonzalez
ff6677b932 Merge pull request #2011 from dokku/jdg-installation-docs
Updated installation docs
2016-03-21 01:46:42 -04:00
Jose Diaz-Gonzalez
aaad577a68 Fix formatting on upgrading docs
[ci skip]
2016-03-21 01:41:03 -04:00
Jose Diaz-Gonzalez
b315fcfbdd Fix formatting in "Where to get help" docs
[ci skip]
2016-03-21 01:40:51 -04:00
Jose Diaz-Gonzalez
e011ed0b3e Better landing page
- unified css between home and template layouts
- use same version of bootstrap everywhere
- add our cute whale sushi logo to the homepage
- use fewer styles
- add a better installation section to point out different installation methods
- add navigation bar items

[ci skip]
2016-03-21 01:40:23 -04:00
Jose Diaz-Gonzalez
4b253c80f7 use addEventListener wrapper where necessary to add simple support for older browsers 2016-03-20 21:45:33 -04:00
Jose Diaz-Gonzalez
9b9872db60 properly link to memory tip
[ci skip]
2016-03-20 21:41:22 -04:00
Jose Diaz-Gonzalez
7682fb0029 Redirect to correct landing page 2016-03-19 23:32:34 -04:00
Jose Diaz-Gonzalez
fc63061eaf Merge pull request #2009 from samholmes1337/master
Clarify purpose and potential penalties of primary vhost
2016-03-19 02:46:48 -04:00
Sam Holmes
43759985f2 Clarify purpose and penalties of primary vhost 2016-03-19 02:17:26 +00:00
Jose Diaz-Gonzalez
2eb1f256fb Merge pull request #2007 from dokku/josegonzalez-patch-1
Document when configuration variables are available. Closes #1860
2016-03-18 10:42:16 -04:00
Jose Diaz-Gonzalez
49cf31baad Document when configuration variables are available. Closes #1860
[ci skip]
2016-03-18 10:42:02 -04:00
Jose Diaz-Gonzalez
b97fbde7e2 Merge pull request #2006 from baob/fix-too-many-redirects
Fix too many redirects
2016-03-18 10:36:04 -04:00
baob
391f9358a6 Fix too many redirects
Example error message on vagrant up:

Error response from daemon: Get
https://registry-1.docker.io/v2/library/postgres/manifests/9.5.0:
Get
https://auth.docker.io/token?scope=repository%3Alibrary%2Fpostgres%3Apull&service=registry.docker.io:
dial tcp: lookup auth.docker.io on 10.0.2.3:53: too many redirects
2016-03-18 14:15:47 +00:00
Jose Diaz-Gonzalez
2d99da59c4 Merge pull request #1987 from dokku/1889-dont-start-stopped
Do not restart stopped processes on config:set/unset
2016-03-18 09:51:31 -04:00
Jose Diaz-Gonzalez
097d0e67bc Merge pull request #2004 from dokku/josegonzalez-patch-1
Document 0.5.x container removal strategy. Closes #1982
2016-03-18 01:52:35 -04:00
Jose Diaz-Gonzalez
9da1d5d0ea Document 0.5.x container removal strategy. Closes #1982
[ci skip]
2016-03-18 01:52:29 -04:00
Michael Hobbs
f930a974a5 Merge pull request #2003 from dokku/mh-dep-tasks-docs
add more useful post-deploy task and make blockquote
2016-03-16 14:24:14 -07:00
Michael Hobbs
a3b1730719 [ci skip] add more useful post-deploy task and make blockquote 2016-03-16 14:23:05 -07:00
Michael Hobbs
273cfc1013 Merge pull request #2002 from dokku/mh-dep-tasks-docs
clarify deployment tasks are supported in both buildpack and dockerfile apps
2016-03-16 13:51:33 -07:00
Michael Hobbs
111bac03ab [ci skip] clarify deployment tasks are supported in both buildpack and dockerfile apps 2016-03-16 13:51:08 -07:00
Michael Hobbs
a33b4ee99a Merge pull request #2000 from iamale/patch-1
Add dokku-monorepo to the plugin list in docs
2016-03-16 06:07:18 -07:00
Alexander Pushkov
4474236780 Add Monorepo plugin 2016-03-16 12:51:20 +03:00
Michael Hobbs
846d1fef2b Merge pull request #1993 from istarkov/master
Fix bash incorrect test command
2016-03-14 12:23:31 -07:00
Ivan Starkov
34a881f917 Fix incorrect test command 2016-03-14 20:18:40 +03:00
Jose Diaz-Gonzalez
d521932dcb Merge pull request #1992 from Sureiya/dokku-client-docs
Improved documentation for using official dokku_client.sh
2016-03-13 21:29:37 -04:00
Chris Modjeska
b255b6a700 Improved documentation for using official dokku_client.sh 2016-03-13 20:42:05 -04:00
Jose Diaz-Gonzalez
9bd092b6ec Fix scoping of css on .dev-warning
[ci skip]
2016-03-13 15:46:37 -04:00
Jose Diaz-Gonzalez
65e3b8d0f7 Use titlecase where necessary
[ci skip]
2016-03-13 15:40:38 -04:00
Jose Diaz-Gonzalez
5507db1d18 Merge pull request #1990 from ligthyear/fix-the-docs
Highlight features that are yet to come
2016-03-13 15:38:59 -04:00
Jose Diaz-Gonzalez
502d4c9e51 Merge pull request #1991 from dokku/fix-non-existent-VHOST
Only chown of existing files
2016-03-13 15:14:19 -04:00
Morris Jobke
01430cd618 Only chown of existing files
* this caused issues during installation if the file is not existent
2016-03-13 18:00:34 +01:00
Benjamin Kampmann
3e1a9abe9b Titlecase 2016-03-13 14:41:27 +01:00
Benjamin Kampmann
63db85b244 Merge pull request #1 from josegonzalez/patch-1
Minor changes
2016-03-13 12:33:06 +01:00
Jose Diaz-Gonzalez
f2050b6a11 Tone down the green 2016-03-13 06:53:22 -04:00
Jose Diaz-Gonzalez
6abdf34054 tone down the green 2016-03-13 06:52:56 -04:00
Jose Diaz-Gonzalez
091489b503 Use .toLowerCase() so casing does not need to be checked 2016-03-13 06:46:10 -04:00
Jose Diaz-Gonzalez
0616e77584 Update release notes regarding blockquotes 2016-03-13 06:45:11 -04:00
Jose Diaz-Gonzalez
6ed64724c0 Added yellow banner stating for doc release status
Also add the appropriate blockquote overrides in the template.html
2016-03-13 06:42:14 -04:00
Jose Diaz-Gonzalez
770c088507 Fix colors to be green
green == good to go, or released in a stable version.
2016-03-13 06:38:27 -04:00
Benjamin Kampmann
9af8389616 Highlight features that are yet to come
- Tone down "new as of version" boxes
 - Replace all "New as of 0.5" with "yet to be released" text
 - Use strong red only for "yet to be released" boxes

Fixes #1989
2016-03-13 11:30:14 +01:00
Jose Diaz-Gonzalez
7704175f0d Merge pull request #1981 from dokku/1220_mh-cleanup-dokku-label-containers
only remove containers with dokku label
2016-03-12 02:56:00 -05:00
Jose Diaz-Gonzalez
27ec5f0f6d Do not restart stopped processes on config:set/unset
Closes #1889
2016-03-12 02:21:53 -05:00
Jose Diaz-Gonzalez
900fcded9b Merge pull request #1985 from DNSFilter/master
Make history readable in github
2016-03-11 19:37:24 -05:00
Mike Schroll
9193e8c29d Make history readable in github 2016-03-11 18:15:04 -05:00
Michael Hobbs
ca2ff001a5 Merge pull request #1980 from dokku/1903_cu12-fix-dockerfile-vs-buildpack-environment-variable
(rebased) Fix issue when Dockerfile present but BUILDPACK_URL is set
2016-03-10 11:01:26 -05:00
Michael Hobbs
f810b5cd06 only remove containers with dokku label. closes #1220 2016-03-09 17:29:26 -05:00
Michael Hobbs
a91165d3e6 set DOKKU_APP_TYPE to IMAGE_SOURCE_TYPE value use in test case 2016-03-09 16:35:48 -05:00
Domonkos Czinke
1e3f29ad98 Fix issue when Dockerfile present but BUILDPACK_URL is set 2016-03-09 15:55:21 -05:00
Jose Diaz-Gonzalez
2f0e52abe1 Merge pull request #1979 from dokku/user-management-docs
Add specific documentation around user management. Closes #1978
2016-03-09 15:21:20 -05:00
Jose Diaz-Gonzalez
95eee5369d Add specific documentation around user management. Closes #1978
- Briefly cover sshcommand internals
- Show several examples for using sshcommand
- Split out docs onto a new page and relink to it where necessary
- Refer to user-auth plugin trigger for scoping commands to specific users.

[ci skip]
2016-03-09 15:20:59 -05:00
Jose Diaz-Gonzalez
e69b471134 Merge pull request #1963 from dokku/doc-fixes
Doc fixes
2016-03-08 21:36:57 -05:00
Jose Diaz-Gonzalez
cf77ee1d2a Cache the versions response in local storage to reduce network activity
[ci-skip]
2016-03-08 21:36:05 -05:00
Jose Diaz-Gonzalez
ec2a21c766 Better styling on menu item 2016-03-08 21:21:04 -05:00
Jose Diaz-Gonzalez
f385efbbfc Request a json file and set the proper cache-control header
[ci skip]
2016-03-08 21:05:44 -05:00
Jose Diaz-Gonzalez
8bf666f56d Add dynamic version menu
This will allow a user to browse the documentation as it was at any point in time. In doing so, this allows us to more easily deprecate/remove features without worrying about having to duplicate old documentation in the future.

[ci skip]
2016-03-08 21:05:44 -05:00
Jose Diaz-Gonzalez
173a87a53e Add link to slack group to readme
[ci skip]
2016-03-08 21:05:44 -05:00
Jose Diaz-Gonzalez
45c180368f Update issue template
- Add application name and contents of Procfile as required debug info
- Capitalize a few things

[ci skip]
2016-03-08 21:05:44 -05:00
Jose Diaz-Gonzalez
37bfdbbbe0 Note that deployment tasks are new as of 0.5.0
[ci skip]
2016-03-08 21:05:44 -05:00
Jose Diaz-Gonzalez
40e169043a Add link to 0.5.x migration guide
[ci skip]
2016-03-08 21:05:43 -05:00
Jose Diaz-Gonzalez
6eaa06f613 Note the location of the CHECKS file for dockerfile deploys. Closes #1962
[ci skip]
2016-03-08 21:05:43 -05:00
Jose Diaz-Gonzalez
d8c5b7f484 Update sidebar links
- Refer to checks plugin in zero-downtime deploy link
- Refer to cron in one off processes link
- Add an "Advanced Usage" section
  - Add links to proxy management and deployment tasks
  - Move container options and persistent storage to advanced usage

[ci skip]
2016-03-08 21:03:32 -05:00
Jose Diaz-Gonzalez
60cd04c36a Add reference to cron to one-off-processes doc
[ci skip]
2016-03-08 21:03:32 -05:00
Jose Diaz-Gonzalez
ede399e95c Add link to disabling nginx
[ci skip]
2016-03-08 21:03:32 -05:00
Jose Diaz-Gonzalez
b721661e2c Fix formatting in dokku-storage
[ci skip]
2016-03-08 21:03:32 -05:00
Jose Diaz-Gonzalez
4452fcda98 Properly note when 0.5.0 features were released
[ci skip]
2016-03-08 21:03:32 -05:00
Michael Hobbs
37584be044 Merge pull request #1953 from dokku/1579_mh-commands_refactor
subcommands/bashstyle refactor
2016-03-08 16:35:30 -05:00
Michael Hobbs
42520a6126 remove documentation of old plugin structure 2016-03-08 15:32:20 -05:00
Michael Hobbs
987c5cfb9c use declare for description variable 2016-03-08 15:30:34 -05:00
Jose Diaz-Gonzalez
ed98616b83 Merge pull request #1974 from unfold/broken-azure-installation-link
Update link in Azure installation instructions. Fixes #1973
2016-03-07 11:41:03 -05:00
Simen Brekken
19141460b5 Update link in Azure installation instructions. Fixes #1973 2016-03-07 16:59:25 +01:00
Michael Hobbs
d8e00f4f8a balance tests 2016-03-04 20:59:27 -08:00
Michael Hobbs
3bffba945a show timing for each bats file and overall test run 2016-03-04 20:59:17 -08:00
Michael Hobbs
4204d210c1 port --app syntax to dokku_client. closes #1638 2016-03-04 12:38:23 -08:00
Michael Hobbs
62731aa434 support parallel tests on same host 2016-03-03 22:11:35 -08:00
Michael Hobbs
7dd8d635bc show container type when printing container output 2016-03-03 22:11:35 -08:00
Michael Hobbs
718b129041 allow overriding of vagrant cpus 2016-03-03 22:11:35 -08:00
Michael Hobbs
3aa8bbd629 move standard commands into subcommands 2016-03-03 22:11:35 -08:00
Michael Hobbs
aa2415eeb8 more style/function tweaks 2016-03-03 22:11:35 -08:00
Michael S. Hobbs
89f289b433 subcommand restructure and bashstyle refactor. closes #1579 2016-03-03 22:11:35 -08:00
Jose Diaz-Gonzalez
76e27f0333 Add support for --app flag. Refs #1638
This change sets a DOKKU_APP_NAME env var, which can be used by plugins as a replacement for the `app` param if specified. Note that each plugin will have to manually shift it's arguments if necessary
2016-03-03 22:11:35 -08:00
Jose Diaz-Gonzalez
a35e690a62 Merge pull request #1959 from dokku/1942-dokku-port
Allow customizing ssh port for the default client
2016-03-03 17:24:38 -05:00
Jose Diaz-Gonzalez
8a4926515b Merge pull request #1965 from trevorturk/checks-example-tweaks-2
Checks example tweaks 2
2016-03-03 14:18:13 -05:00
Trevor Turk
bd5a7dea3a Checks doc: standardize spacing on check instruction example lines 2016-03-03 12:50:22 -06:00
Trevor Turk
6a25c8b675 Checks doc: mention the ability to globally configure DOKKU_CHECKS_TIMEOUT (it looks like you can do this, but I'm not 100% sure) 2016-03-03 12:47:14 -06:00
Trevor Turk
2acd2c294a Checks doc: minor copy edits to use a consistent voice and sentence structure 2016-03-03 12:46:03 -06:00
Trevor Turk
b8c264f173 Checks doc: add an example for the simple check for the Rails deployment example 2016-03-03 12:32:15 -06:00
Trevor Turk
2df9bbeb83 Checks doc: clean up Rails example deployments a bit, add a note about WAIT, and change to from 5 to 10 since the default is 5 so using that variable wouldn't make sense 2016-03-03 12:28:13 -06:00
Trevor Turk
7d60e160ab Checks doc: fix typos 2016-03-03 12:25:56 -06:00
Trevor Turk
7d73f61cd3 Checks doc: add a section about disabling the default wait time when running multiple processes re #1964 2016-03-03 12:25:12 -06:00
Trevor Turk
9de5965dd1 Checks doc: combine and clean up redundant checks settings content 2016-03-03 12:22:59 -06:00
Trevor Turk
b92fe46387 Checks doc: move redundant content to the same spot for now 2016-03-03 11:31:56 -06:00
Trevor Turk
da1d362203 Checks doc: break checks instructions and checks settings into sub sections 2016-03-03 11:30:52 -06:00
Trevor Turk
93e8078a93 Checks doc: break CHECKS file explanation into bullet points for easier reading 2016-03-03 11:29:40 -06:00
Trevor Turk
f5ab02ac20 Checks doc: remove linebreak to match the formatting used elsewhere in this doc, remove stray empty line 2016-03-03 11:27:12 -06:00
Trevor Turk
78bb76249e Checks doc: combine redundant content into a single paragraph 2016-03-03 11:24:59 -06:00
Trevor Turk
405c23f2bd Checks doc: move redundant content to the same spot for now, add a bit of content to divide the single check and multi check examples 2016-03-03 11:22:39 -06:00
Trevor Turk
aeaf12a7a2 Checks doc: move settings explanation into its own section 2016-03-03 11:15:22 -06:00
Trevor Turk
85dab3b6ef Checks doc: move checks examples up so we're explaining the options in one place 2016-03-03 11:13:30 -06:00
Trevor Turk
fa018d3e8c Checks doc: mention dokku checks disable at the top, before we get into the custom checks explanation 2016-03-03 11:00:04 -06:00
Trevor Turk
80d2bf9e8f Checks doc: add a header before getting into the custom checks explanation 2016-03-03 10:42:54 -06:00
Trevor Turk
aabe456aa6 Checks doc: example for setting DOKKU_WAIT_TO_RETIRE for a single app 2016-03-03 10:41:42 -06:00
Trevor Turk
1848ea5d15 Checks doc: mention DOKKU_WAIT_TO_RETIRE at the top, before we get into custom checks and config 2016-03-03 10:40:31 -06:00
Trevor Turk
ec0306278e Checks doc: standardize use of <app> instead of APP for commands 2016-03-03 10:37:16 -06:00
Trevor Turk
ecc40c7ea3 Checks doc: example for setting DOKKU_DEFAULT_CHECKS_WAIT for a single app 2016-03-03 10:36:39 -06:00
Michael Hobbs
63fb33d03d Merge pull request #1958 from u2mejc/u2mejc-issue1957
Enable debug output for dokku global exports in trace
2016-03-02 20:07:06 -08:00
Jose Diaz-Gonzalez
3cbf2e0138 Merge pull request #1960 from dokku/1890-clarify-commands
Clarify which commands should be run where. Closes #1890
2016-03-02 22:11:15 -05:00
Jose Diaz-Gonzalez
9a1f8fb161 Clarify which commands should be run where. Closes #1890
[ci skip]
2016-03-02 22:10:48 -05:00
Jose Diaz-Gonzalez
a765789c4d Allow customizing ssh port for the default client
Closes #1942
2016-03-02 22:01:52 -05:00
Justin Clark
a0543dfccf enable debug output for dokku global exports in trace 2016-03-02 18:08:23 -08:00
Jose Diaz-Gonzalez
fb45f221b7 Merge pull request #1687 from u2mejc/u2mejc-nobackup
Deprecate and remove dokku backup plugin, replace with documentation.
2016-03-02 19:29:07 -05:00
Jose Diaz-Gonzalez
633e81848e Merge pull request #1830 from u2mejc/u2mejc-issue1820
Add core storage plugin to manage docker bind mounts
2016-03-02 19:28:45 -05:00
Justin Clark
84df69b387 Add core storage plugin to manage docker bind mounts [ci skip] 2016-03-02 16:09:50 -08:00
Justin Clark
86b4987588 Depreciate and remove dokku backup plugin, replace with documentation 2016-03-02 15:56:33 -08:00
Jose Diaz-Gonzalez
8c01fa8480 Merge pull request #1951 from znz/fix-typos
Fix typos
2016-03-01 00:01:56 -05:00
Kazuhiro NISHIYAMA
ccb74f968b Fix typos 2016-03-01 12:29:21 +09:00
Jose Diaz-Gonzalez
56e9b22e1c Merge pull request #1947 from basgys/master
plugins: add etcd to the list of plugins
2016-02-27 14:42:35 -05:00
Bastien
87d2196cde plugins: add etcd to the list of plugins 2016-02-27 17:47:56 +01:00
Jose Diaz-Gonzalez
fd059da29b Merge pull request #1918 from MorrisJobke/arch-linux
Adds support for ArchLinux as host OS
2016-02-25 01:26:06 -05:00
Jose Diaz-Gonzalez
95080fee69 Merge pull request #1938 from npazo/patch-1
Add information about Slack channel
2016-02-25 01:00:50 -05:00
Jose Diaz-Gonzalez
62b9748269 Merge pull request #1939 from pmclanahan/client-add-dokku-remote
(client) Add dokku git remote when specifying app name
2016-02-25 01:00:00 -05:00
Jose Diaz-Gonzalez
7d71521851 Merge pull request #1941 from cu12/fix-check-plugin-command
Fix issue with plugins having plugins command
2016-02-25 00:59:07 -05:00
Domonkos Czinke
ac5944ec79 Fix issue with plugins having plugins command 2016-02-24 23:44:19 +01:00
Paul McLanahan
1b6973665a (client) Add dokku git remote when specifying app name
Previously the client would only add the git remote
for you if it was generating a random name for you.
2016-02-24 12:17:23 -05:00
Nick Pazoles
a0ad88372f Add information about Slack channel 2016-02-23 18:24:20 -06:00
Morris Jobke
7a9cf8abb1 Adds support for ArchLinux as host OS
* fix rsyslog handling
* don't hardcode dokku path
* add documentation for ArchLinux package build
* add vagrant machine to run the ArchLinux specific steps
* add step in release process for ArchLinux
* enhance docs for easy ArchLinux steps
2016-02-24 00:02:06 +01:00
Michael Hobbs
a146849a58 Merge pull request #1936 from dokku/mh-shellcheck-cleanup
cleanup shellcheck SC2086
2016-02-23 09:03:24 -08:00
Michael Hobbs
d1b87bd7b7 cleanup shellcheck SC2086 2016-02-23 07:50:06 -08:00
Michael Hobbs
ff9bb2cbd7 Merge pull request #1935 from dokku/mh-remove-nginx-test
remove unnecessary nginx test
2016-02-22 12:43:20 -08:00
Michael Hobbs
9b8f002aa8 remove unnecessary nginx test 2016-02-22 11:18:57 -08:00
Jose Diaz-Gonzalez
42f2f6b334 Merge pull request #1934 from dokku/mh-docker-ps-output-cleanup
fix get_running_image_tag() with docker 1.10.x
2016-02-22 14:12:05 -05:00
Michael Hobbs
676e8782ed fix get_running_image_tag() with docker 1.10.x 2016-02-22 10:21:20 -08:00
Jose Diaz-Gonzalez
d125ec5230 Merge pull request #1931 from dokku/relative-doc-links
Standardize on "relative" doc links
2016-02-21 03:14:46 -05:00
Jose Diaz-Gonzalez
f7d85b41cc Standardize on "relative" doc links
This will allow us to weather any future repository movements

[ci skip]
2016-02-21 03:12:48 -05:00
Jose Diaz-Gonzalez
86f9ba3b34 Merge pull request #1925 from dokku/jg-better-bootstrap
Update bootstrap.sh
2016-02-20 18:42:03 -05:00
Michael Hobbs
a9de2994bf Merge pull request #1836 from dokku/1824_mh-app-json
support scripts.dokku. in app.json
2016-02-20 06:35:40 -08:00
Michael Hobbs
48f2dc074c support scripts.dokku in app.json. closes #1824 2016-02-19 13:29:42 -08:00
Jose Diaz-Gonzalez
a4bfb46d6d Update bootstrap.sh
This pr makes it slightly easier to support dockerfile installations

- "simplifies" the bootstrap process by dividing it into distinct chunks
- Allows specifying `--no-install-recommends` when a dockerfile installation is detected
- Uses functions everywhere
- Removes global variables where possible
- Fixes shellcheck issues
- Allows specifying debconf via the command-line

[ci skip]
2016-02-19 04:35:43 -05:00
Jose Diaz-Gonzalez
55a4cb3274 Merge pull request #1892 from dokku/mh-nginx-vhosts-rewrite
nginx-vhosts rewrite
2016-02-18 22:56:09 -05:00
Michael Hobbs
9842d7498b nginx-vhosts rewrite 2016-02-18 18:38:54 -08:00
Jose Diaz-Gonzalez
4404e145c0 Merge pull request #1924 from dokku/1915-support-procfile-for-dockerfile-deploy
Fix #1564: Use Procfile for process types in Dockerfile apps
2016-02-18 21:23:06 -05:00
Paul McLanahan
6a01abb905 Fix #1564: Use Procfile for process types in Dockerfile apps
* Document new Procfile feature
* Add and update tests
* Fix a typo in generate_scale_file (ref #1923)
2016-02-18 21:22:26 -05:00
282 changed files with 6751 additions and 3660 deletions

1
.gitignore vendored
View File

@@ -1,7 +1,6 @@
.vagrant
.DS_Store
stack.tgz
build
tmp
*.deb
.ruby-version

View File

@@ -58,6 +58,7 @@ etc). Please include:
* The output of `free -m`
* The output of `docker version`.
* The output of `docker -D info`.
* The output of `sigil -v`.
* The output of `docker run --rm -ti gliderlabs/herokuish:latest herokuish version`
* The output of `dokku version`.
* The output of `dokku plugin`.

View File

@@ -1,5 +1,94 @@
# History
## 0.5.2
This is a packaging fix release.
### Bug Fixes
- #2027: @michaelshobbs Add sigil to debian control file
## 0.5.1
That was quick! This is a bugfix release to fix issues in the packaging and release phases of dokku.
### Bug Fixes
- #2023: @josegonzalez Fix sigil packaging
- #2024: @josegonzalez Delete bad symlinks without confirmation
## 0.5.0
This is our largest, most feature-packed release in the history of the dokku project. Lots of delicious things, including:
- Support for docker 1.10/1.11. You *must* have docker 1.9.1+ to install dokku.
- Revamped documentation website
- [Deployment Tasks](http://dokku.viewdocs.io/dokku/deployment/deployment-tasks/)
- Heroku-style management of [dockerfile processes](http://dokku.viewdocs.io/dokku/deployment/dockerfiles/#procfiles-and-multiple-processes)
- Official [persistent storage plugin](http://dokku.viewdocs.io/dokku/dokku-storage/)
We'd also love it if you welcomed a few new core developers:
- @MorrisJobke: Maintainer of our new arch linux support
- @u2mejc: Contributed the help refactor and persistent storage plugins
Thanks to all the contributors who helped with this release!
## Refactor
- #1892: @michaelshobbs Refactor nginx proxy plugin to add usage flexibility
- #1925: @josegonzalez Simplify bootstrap.sh installation method
- #1953: @michaelshobbs Refactor commands into subcommands and add support for --app argument
- #1983: @u2mejc Collapse help into expandable command topics
- #1936: @michaelshobbs Cleanup shellcheck SC2086
### Bug Fixes
- #1934: @michaelshobbs Fix get_running_image_tag() with docker 1.10.x
- #1935: @michaelshobbs Remove unnecessary nginx test
- #1941: @cu12 Fix issue with plugins having plugins command
- #1980: @cu12 Fix issue when Dockerfile present but BUILDPACK_URL is set
- #1991: @MorrisJobke Only chown of existing files
- #1993: @istarkov Fix bash incorrect test command
- #2006: @baob Fix too many redirects
- #2012: @michaelshobbs minor bug fixes around app.json and docker-options
### New Features
- #1830: @u2mejc Add core storage plugin to manage docker bind mounts
- #1836: @michaelshobbs Support scripts.dokku. in app.json
- #1918: @MorrisJobke Adds support for ArchLinux as host OS
- #1924: @pmclanahan Use Procfile for process types in Dockerfile apps
- #1939: @pmclanahan Add dokku git remote when specifying app name in bash client
- #1958: @u2mejc Enable debug output for dokku global exports in trace
- #1959: @josegonzalez Allow customizing ssh port for the default client
- #1981: @josegonzalez Only remove containers with dokku label
- #1987: @josegonzalez Do not restart stopped processes on config:set/unset
### Documentation
- #1687: @u2mejc Deprecate and remove dokku backup plugin, replace with documentation.
- #1931: @josegonzalez Standardize on "relative" doc links
- #1938: @npazo Add information about Slack channel
- #1947: @basgys Add etcd to the list of plugins
- #1951: @znz Fix typos
- #1960: @josegonzalez Clarify which commands should be run where. Closes #1890
- #1963: @josegonzalez Add floating sidebar on documentation linking to released versions
- #1965: @trevorturk Clarify checks documentation
- #1974: @simenbrekken Update link in Azure installation instructions. Fixes #1973
- #1979: @josegonzalez Add specific documentation around user management. Closes #1978
- #1985: @MikeSchroll Make history readable in github
- #1990: @ligthyear Highlight features that are yet to come
- #1992: @Sureiya Improved documentation for using official dokku_client.sh
- #2000: @iamale Add dokku-monorepo to the plugin list in docs
- #2002: @michaelshobbs clarify deployment tasks are supported in both buildpack and dockerfile apps
- #2003: @michaelshobbs Add more useful post-deploy task and make blockquote
- #2004: @josegonzalez Document 0.5.x container removal strategy. Closes #1982
- #2007: @josegonzalez Document when configuration variables are available. Closes #1860
- #2009: @samholmes1337 Clarify purpose and potential penalties of primary vhost
- #2011: @josegonzalez Updated installation docs
- #2013: @michaelshobbs Make help desc local consistent
## 0.4.14
Hah you got us. We have to ship another 0.4.x release to fix issues with
@@ -12,22 +101,22 @@ Thanks to all the contributors who helped with this release!
### Bug Fixes
#1888: @u2mejc Remove broken symlinks when using copyfiles
#1887: @u2mejc Fix <command>:help hangs for certs, enter, tags, tar
#1901: @josegonzalez Add shebang to config/functions so editors see it as a shell script
#1907: @michaelshobbs Fix dokku run --rm regression
#1911: @2mia Add support for github url patterns when installing plugins
#1912: @mattberther Pass -i -t to docker exec only if tty present
#1923: @michaelshobbs Fix typo in generate_scale_file()
- #1888: @u2mejc Remove broken symlinks when using copyfiles
- #1887: @u2mejc Fix <command>:help hangs for certs, enter, tags, tar
- #1901: @josegonzalez Add shebang to config/functions so editors see it as a shell script
- #1907: @michaelshobbs Fix dokku run --rm regression
- #1911: @2mia Add support for github url patterns when installing plugins
- #1912: @mattberther Pass -i -t to docker exec only if tty present
- #1923: @michaelshobbs Fix typo in generate_scale_file()
### Documentation
#1882: @josegonzalez Add a note to warn users to peg to specific versions of buildpacks
#1883: @michaelshobbs Show plugn version when listing plugins
#1900: @josegonzalez Upgrade our CoC to 1.4 of the Contributor Covenant
#1913: @michaelshobbs document appropriate crontab usage
#1921: @josegonzalez Create ISSUE_TEMPLATE.md
#1922: @josegonzalez Link to our new ISSUE_TEMPLATE.md
- #1882: @josegonzalez Add a note to warn users to peg to specific versions of buildpacks
- #1883: @michaelshobbs Show plugn version when listing plugins
- #1900: @josegonzalez Upgrade our CoC to 1.4 of the Contributor Covenant
- #1913: @michaelshobbs document appropriate crontab usage
- #1921: @josegonzalez Create ISSUE_TEMPLATE.md
- #1922: @josegonzalez Link to our new ISSUE_TEMPLATE.md
## 0.4.13

View File

@@ -7,6 +7,7 @@ Output of the following commands
- `free -m`:
- `docker version`:
- `docker -D info`:
- `sigil -v`:
- `docker run -ti gliderlabs/herokuish:latest herokuish version`:
- `dokku version`:
- `dokku plugin`:
@@ -15,9 +16,11 @@ Output of the following commands
- `cat /home/dokku/<app>/nginx.conf` (if applicable):
- Link to the exact repository being deployed (if possible/applicable):
- If a deploy is failing:
- the type of application being deployed (node, php, python, ruby, etc.)
- whether or not you have a `Dockerfile` in the root of your repository
- if using buildpacks, which custom buildpacks are in use
- Application name
- The type of application being deployed (node, php, python, ruby, etc.)
- Whether or not you have a `Dockerfile` in the root of your repository
- If using buildpacks, which custom buildpacks are in use
- If it exists, the contents of your `Procfile`.
- Output of failing dokku commands after running `dokku trace on`
(BEWARE: `trace on` will print environment variables for some commands, be sure you're not exposing any sensitive information when posting issues. You may replace these values with XXXXXXX):

View File

@@ -2,6 +2,7 @@ DOKKU_VERSION = master
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/master/sshcommand
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v0.2.1/plugn_0.2.1_linux_x86_64.tgz
SIGIL_URL ?= https://github.com/gliderlabs/sigil/releases/download/v0.4.0/sigil_0.4.0_Linux_x86_64.tgz
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
DOKKU_LIB_ROOT ?= /var/lib/dokku
@@ -26,6 +27,7 @@ endif
include tests.mk
include deb.mk
include arch.mk
all:
# Type "make install" to install.
@@ -77,7 +79,7 @@ plugin-dependencies: plugn
plugins: plugn docker
sudo -E dokku plugin:install --core
dependencies: apt-update sshcommand plugn docker help2man man-db
dependencies: apt-update sshcommand plugn docker help2man man-db sigil
$(MAKE) -e stack
apt-update:
@@ -98,6 +100,10 @@ plugn:
wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL}
tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin
sigil:
wget -qO /tmp/sigil_latest.tgz ${SIGIL_URL}
tar xzf /tmp/sigil_latest.tgz -C /usr/local/bin
docker: aufs
apt-get install -qq -y curl
egrep -i "^docker" /etc/group || groupadd docker
@@ -150,4 +156,3 @@ vagrant-acl-add:
vagrant-dokku:
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"

View File

@@ -1,4 +1,4 @@
# 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) [![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/) [![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/).
@@ -10,8 +10,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.4.14/bootstrap.sh
sudo DOKKU_TAG=v0.4.14 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.5.2/bootstrap.sh
sudo DOKKU_TAG=v0.5.2 bash bootstrap.sh
### Upgrading

19
Vagrantfile vendored
View File

@@ -2,6 +2,7 @@
# vi: set ft=ruby :
BOX_NAME = ENV["BOX_NAME"] || "bento/ubuntu-14.04"
BOX_CPUS = ENV["BOX_CPUS"] || "1"
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
@@ -24,6 +25,7 @@ Vagrant::configure("2") do |config|
# Ubuntu's Raring 64-bit cloud image is set to a 32-bit Ubuntu OS type by
# default in Virtualbox and thus will not boot. Manually override that.
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
vb.customize ["modifyvm", :id, "--cpus", BOX_CPUS]
vb.customize ["modifyvm", :id, "--memory", BOX_MEMORY]
end
@@ -38,6 +40,13 @@ Vagrant::configure("2") do |config|
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
# Use the same nameserver as the host machine in order to avoid the "too many redirects" problem.
vm.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
end
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
vm.vm.provision :shell do |s|
@@ -76,6 +85,16 @@ Vagrant::configure("2") do |config|
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
end
config.vm.define "build-arch", autostart: false do |vm|
vm.vm.box = "bugyt/archlinux"
vm.vm.synced_folder File.dirname(__FILE__), "/dokku"
vm.vm.synced_folder "#{File.dirname(__FILE__)}/../dokku-arch", "/dokku-arch"
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /dokku && make arch-all", privileged: false
end
if Pathname.new(PUBLIC_KEY_PATH).exist?
config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub'
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && mkdir -p /root/.ssh && sudo cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"

28
arch.mk Normal file
View File

@@ -0,0 +1,28 @@
.PHONY: arch-all arch-dokku
arch-all: arch-dokku
echo "Done"
arch-setup:
echo "-> Updating pacman repository and installing package helper"
sudo pacman -Sy
sudo pacman -S --needed --noconfirm pkgbuild-introspection
echo "-> Download, build and install cower (dependency of pacaur) and pacaur"
curl -so /tmp/cower.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/cower.tar.gz
curl -so /tmp/pacaur.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/pacaur.tar.gz
tar -xzf /tmp/cower.tar.gz -C /tmp
tar -xzf /tmp/pacaur.tar.gz -C /tmp
gpg --recv-key 1EB2638FF56C0C53
cd /tmp/cower; makepkg -sri --noconfirm
cd /tmp/pacaur; makepkg -sri --noconfirm
echo "-> Installing build requirements"
pacaur --noconfirm --noedit -S plugn
arch-dokku: arch-setup
echo "-> Update package sums, create metadata file and test the build of the package"
git describe --tags > /tmp/VERSION
cat /tmp/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/STABLE_VERSION
sed -i -e "s/pkgver=.*/pkgver=`cat /tmp/STABLE_VERSION`/" /dokku-arch/PKGBUILD
cd /dokku-arch; updpkgsums; mksrcinfo; makepkg -fd

View File

@@ -1,55 +1,92 @@
#!/bin/bash
#
#!/usr/bin/env bash
set -eo pipefail; [[ $TRACE ]] && set -x
# A script to bootstrap dokku.
# It expects to be run on Ubuntu 14.04 via 'sudo'
# If installing a tag higher than 0.3.13, it may install dokku via a package (so long as the package is higher than 0.3.13)
# It checks out the dokku source code from Github into ~/dokku and then runs 'make install' from dokku source.
# We wrap this whole script in a function, so that we won't execute
# We wrap this whole script in functions, so that we won't execute
# until the entire script is downloaded.
# That's good because it prevents our output overlapping with wget's.
# It also means that we can't run a partially downloaded script.
ensure-environment() {
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
if ! command -v apt-get &>/dev/null; then
echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
exit 1
fi
bootstrap () {
set -eo pipefail
export DEBIAN_FRONTEND=noninteractive
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/dokku/dokku.git"}
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
if ! command -v apt-get &>/dev/null; then
echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
exit 1
fi
hostname -f > /dev/null 2>&1 || {
echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
exit 1
hostname -f > /dev/null 2>&1 || {
echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
exit 1
}
}
echo "--> Ensuring we have the proper dependencies"
apt-get update -qq > /dev/null
[[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties
install-requirements() {
echo "--> Ensuring we have the proper dependencies"
apt-get update -qq > /dev/null
if [[ $(lsb_release -sr) == "12.04" ]]; then
apt-get -qq -y install python-software-properties
fi
}
dokku_install_source() {
apt-get install -qq -y git make software-properties-common
install-dokku() {
if [[ -n $DOKKU_BRANCH ]]; then
install-dokku-from-source "origin/$DOKKU_BRANCH"
elif [[ -n $DOKKU_TAG ]]; then
local DOKKU_SEMVER="${DOKKU_TAG//v}"
major=$(echo "$DOKKU_SEMVER" | awk '{split($0,a,"."); print a[1]}')
minor=$(echo "$DOKKU_SEMVER" | awk '{split($0,a,"."); print a[2]}')
patch=$(echo "$DOKKU_SEMVER" | awk '{split($0,a,"."); print a[3]}')
# 0.3.13 was the first version with a debian package
if [[ "$major" -eq "0" ]] && [[ "$minor" -eq "3" ]] && [[ "$patch" -ge "13" ]]; then
install-dokku-from-package "$DOKKU_SEMVER"
echo "--> Running post-install dependency installation"
dokku plugins-install-dependencies
# 0.4.0 implemented a `plugin` plugin
elif [[ "$major" -eq "0" ]] && [[ "$minor" -ge "4" ]] && [[ "$patch" -ge "0" ]]; then
install-dokku-from-package "$DOKKU_SEMVER"
echo "--> Running post-install dependency installation"
sudo -E dokku plugin:install-dependencies --core
else
install-dokku-from-source "$DOKKU_TAG"
fi
else
install-dokku-from-package
echo "--> Running post-install dependency installation"
sudo -E dokku plugin:install-dependencies --core
fi
}
install-dokku-from-source() {
local DOKKU_CHECKOUT="$1"
apt-get -qq -y install git make software-properties-common
cd /root
if [[ ! -d /root/dokku ]]; then
git clone $DOKKU_REPO /root/dokku
git clone "$DOKKU_REPO" /root/dokku
fi
cd /root/dokku
git fetch origin
git checkout $DOKKU_CHECKOUT
[[ -n $DOKKU_CHECKOUT ]] && git checkout "$DOKKU_CHECKOUT"
make install
}
dokku_install_package() {
install-dokku-from-package() {
local DOKKU_CHECKOUT="$1"
local NO_INSTALL_RECOMMENDS=""
if [[ -n $DOKKU_DOCKERFILE ]]; then
NO_INSTALL_RECOMMENDS=" --no-install-recommends "
fi
echo "--> Initial apt-get update"
apt-get update -qq > /dev/null
apt-get install -qq -y apt-transport-https
apt-get -qq -y install apt-transport-https
echo "--> Installing docker"
if uname -r | grep -q linode; then
@@ -65,44 +102,28 @@ dokku_install_package() {
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | tee /etc/apt/sources.list.d/dokku.list
apt-get update -qq > /dev/null
[[ -n $DOKKU_VHOST_ENABLE ]] && echo "dokku dokku/vhost_enable boolean $VHOST_ENABLE" | sudo debconf-set-selections
[[ -n $DOKKU_WEB_CONFIG ]] && echo "dokku dokku/web_config boolean $DOKKU_WEB_CONFIG" | sudo debconf-set-selections
[[ -n $DOKKU_HOSTNAME ]] && echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | sudo debconf-set-selections
[[ -n $DOKKU_SKIP_KEY_FILE ]] && echo "dokku dokku/skip_key_file boolean $DOKKU_SKIP_KEY_FILE" | sudo debconf-set-selections
[[ -n $DOKKU_KEY_FILE ]] && echo "dokku dokku/key_file string $DOKKU_KEY_FILE" | sudo debconf-set-selections
if [[ -n $DOKKU_CHECKOUT ]]; then
apt-get install -y dokku=$DOKKU_CHECKOUT
# shellcheck disable=SC2086
apt-get -qq -y $NO_INSTALL_RECOMMENDS install "dokku=$DOKKU_CHECKOUT"
else
apt-get install -y dokku
# shellcheck disable=SC2086
apt-get -qq -y $NO_INSTALL_RECOMMENDS install dokku
fi
}
if [[ -n $DOKKU_BRANCH ]]; then
export DOKKU_CHECKOUT="origin/$DOKKU_BRANCH"
dokku_install_source
elif [[ -n $DOKKU_TAG ]]; then
export DOKKU_SEMVER="${DOKKU_TAG//v}"
major=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[1]}')
minor=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[2]}')
patch=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[3]}')
# 0.3.13 was the first version with a debian package
if [[ "$major" -eq "0" ]] && [[ "$minor" -eq "3" ]] && [[ "$patch" -ge "13" ]]; then
export DOKKU_CHECKOUT="$DOKKU_SEMVER"
dokku_install_package
echo "--> Running post-install dependency installation"
dokku plugins-install-dependencies
# 0.4.0 implemented a `plugin` plugin
elif [[ "$major" -eq "0" ]] && [[ "$minor" -ge "4" ]] && [[ "$patch" -ge "0" ]]; then
export DOKKU_CHECKOUT="$DOKKU_SEMVER"
dokku_install_package
echo "--> Running post-install dependency installation"
sudo -E dokku plugin:install-dependencies --core
else
export DOKKU_CHECKOUT="$DOKKU_TAG"
dokku_install_source
fi
else
dokku_install_package
echo "--> Running post-install dependency installation"
sudo -E dokku plugin:install-dependencies --core
fi
main() {
export DEBIAN_FRONTEND=noninteractive
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/dokku/dokku.git"}
ensure-environment
install-requirements
install-dokku
}
bootstrap
main "$@"

View File

@@ -9,7 +9,7 @@ import subprocess
import sys
import threading
VERSION = 'v0.4.14'
VERSION = 'v0.5.2'
hostname = ''
try:

View File

@@ -41,6 +41,8 @@ if [[ -z $DOKKU_HOST ]]; then
fi
fi
export DOKKU_PORT=${DOKKU_PORT:=22}
if [[ ! -z $DOKKU_HOST ]]; then
_dokku() {
appname=""
@@ -52,76 +54,43 @@ if [[ ! -z $DOKKU_HOST ]]; then
echo "This is not a git repository"
fi
if [[ "$appname" != "" ]] && [[ -n "$*" ]]; then
case "$1" in
apps|backup*|help|plugins*|ps:restartall|trace|version)
true
;;
apps:destroy)
if [[ -z "$2" ]] || [[ "$2" == "force" ]]; then
donotshift="YES"
fi
;;
*)
donotshift="YES"
;;
esac
fi
if [[ "$1" = "apps:create" ]] && [[ -z "$2" ]]; then
appname=$(random_name)
counter=0
while ssh "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do
if [[ $counter -ge 100 ]]; then
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
ssh "dokku@$DOKKU_HOST" apps
exit 1
else
case "$1" in
apps:create)
if [[ -z "$2" ]]; then
appname=$(random_name)
counter=$((counter+1))
counter=0
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do
if [[ $counter -ge 100 ]]; then
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps
exit 1
else
appname=$(random_name)
counter=$((counter+1))
fi
done
else
appname="$2"
fi
done
if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then
echo "-----> Dokku remote added at $DOKKU_HOST"
echo "-----> Application name is $appname"
else
echo "! Dokku remote not added! Do you already have a dokku remote?"
return
fi
git push dokku master
return $?
fi
if [[ -z "$donotshift" ]]; then
# shellcheck disable=SC2029
ssh -o LogLevel=QUIET -t "dokku@$DOKKU_HOST" "$@"
exit $?
fi
if [[ -z "$verb" ]]; then
if [[ ! "$1" =~ --* ]]; then
verb=$1
shift
if [[ "$1" == "$appname" ]]; then
shift
if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then
echo "-----> Dokku remote added at $DOKKU_HOST"
echo "-----> Application name is $appname"
else
echo "! Dokku remote not added! Do you already have a dokku remote?"
return
fi
git push dokku master
return $?
;;
apps:destroy)
git remote remove dokku
;;
esac
args="$*"
else
long_args="--"
for arg in "$@"; do
if [[ "$arg" =~ --* ]]; then
long_args+=" $arg"
args=("${args[@]/$arg}")
else
verb="$arg"
fi
done
fi
fi
# shellcheck disable=SC2086,SC2029
ssh -o LogLevel=QUIET -t "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}"
[[ -n "$@" ]] && [[ -n "$appname" ]] && app_arg="--app $appname"
# echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@"
# shellcheck disable=SC2068,SC2086
ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@
}
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then

117
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.8
HEROKUISH_VERSION ?= 0.3.9
HEROKUISH_ARCHITECTURE = amd64
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
@@ -20,34 +20,52 @@ SSHCOMMAND_VERSION ?= 0.1.0
SSHCOMMAND_ARCHITECTURE = amd64
SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb
GOROOT = /usr/lib/go
GOBIN = /usr/bin/go
GOPATH = /home/vagrant/gocode
SIGIL_DESCRIPTION = 'Standalone string interpolator and template processor'
SIGIL_REPO_NAME ?= gliderlabs/sigil
SIGIL_VERSION ?= 0.4.0
SIGIL_ARCHITECTURE = amd64
SIGIL_PACKAGE_NAME = sigil_$(SIGIL_VERSION)_$(SIGIL_ARCHITECTURE).deb
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-plugn deb-setup deb-sshcommand
GOROOT = /usr/local/go
GOBIN = /usr/local/go/bin/go
GOPATH = /home/vagrant/gocode
GOTARBALL = go1.5.3.linux-amd64.tar.gz
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-plugn deb-setup deb-sshcommand deb-sigil
install-from-deb:
echo "--> Initial apt-get update"
@echo "--> Initial apt-get update"
sudo apt-get update -qq > /dev/null
sudo apt-get install -qq -y apt-transport-https
echo "--> Installing docker"
@echo "--> Installing docker"
wget -nv -O - https://get.docker.com/ | sh
echo "--> Installing dokku"
@echo "--> Installing dokku"
wget -nv -O - https://packagecloud.io/gpg.key | apt-key add -
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/dokku.list
@echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/dokku.list
sudo apt-get update -qq > /dev/null
sudo apt-get install dokku
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -yy dokku
deb-all: deb-herokuish deb-dokku deb-plugn deb-sshcommand
golang:
ifeq (,$(wildcard /tmp/$(GOTARBALL)))
@echo "-> Installing golang"
mkdir -p /tmp/build/usr/local/bin $(GOPATH)
sudo apt-get clean
sudo apt-get update -qq > /dev/null
sudo apt-get install -qq -y git mercurial > /dev/null 2>&1
sudo wget -nv -O /tmp/$(GOTARBALL) https://storage.googleapis.com/golang/$(GOTARBALL)
sudo tar -C /usr/local -xzf /tmp/$(GOTARBALL)
endif
deb-all: deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil
mv /tmp/*.deb .
echo "Done"
@echo "Done"
deb-setup:
echo "-> Updating deb repository and installing build requirements"
@echo "-> Updating deb repository and installing build requirements"
sudo apt-get update -qq > /dev/null
sudo 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 ruby-dev ruby1.9.1 > /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
@@ -55,27 +73,27 @@ deb-herokuish: deb-setup
rm -rf /tmp/tmp /tmp/build $(HEROKUISH_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
echo "-> Creating deb files"
echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install
echo "sleep 5" >> /tmp/tmp/post-install
echo "count=\`sudo docker images | grep gliderlabs/herokuish | wc -l\`" >> /tmp/tmp/post-install
echo 'if [ "$$count" -ne 0 ]; then' >> /tmp/tmp/post-install
echo " echo 'Removing old herokuish image'" >> /tmp/tmp/post-install
echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install
echo "fi" >> /tmp/tmp/post-install
echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install
echo "sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install
@echo "-> Creating deb files"
@echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install
@echo "sleep 5" >> /tmp/tmp/post-install
@echo "count=\`sudo docker images | grep gliderlabs/herokuish | wc -l\`" >> /tmp/tmp/post-install
@echo 'if [ "$$count" -ne 0 ]; then' >> /tmp/tmp/post-install
@echo " echo 'Removing old herokuish image'" >> /tmp/tmp/post-install
@echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install
@echo "fi" >> /tmp/tmp/post-install
@echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install
@echo "sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install
echo "-> Cloning repository"
@echo "-> Cloning repository"
git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" /tmp/tmp/herokuish > /dev/null
rm -rf /tmp/tmp/herokuish/.git /tmp/tmp/herokuish/.gitignore
echo "-> Copying files into place"
@echo "-> Copying files into place"
mkdir -p "/tmp/build/var/lib"
cp -rf /tmp/tmp/herokuish /tmp/build/var/lib/herokuish
echo "-> Creating $(HEROKUISH_PACKAGE_NAME)"
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 | docker-engine | lxc-docker (>= 1.6.1) | docker.io (>= 1.6.1) | tutum-agent' --deb-pre-depends sudo --after-install /tmp/tmp/post-install --url "https://github.com/$(HEROKUISH_REPO_NAME)" --description $(HEROKUISH_DESCRIPTION) --license 'MIT License' .
@echo "-> Creating $(HEROKUISH_PACKAGE_NAME)"
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
@@ -105,41 +123,56 @@ deb-dokku: deb-setup
dpkg-deb --build /tmp/build "/vagrant/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
mv *.deb /tmp
deb-plugn: deb-setup
deb-plugn: deb-setup golang
rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin
echo "-> Cloning repository"
@echo "-> Cloning repository"
git clone -q "https://github.com/$(PLUGN_REPO_NAME).git" /tmp/tmp/plugn > /dev/null
rm -rf /tmp/tmp/plugn/.git /tmp/tmp/plugn/.gitignore
echo "-> Copying files into place"
mkdir -p /tmp/build/usr/local/bin $(GOPATH)
sudo apt-get clean
sudo apt-get update -qq > /dev/null
sudo apt-get install -qq -y git golang mercurial > /dev/null 2>&1
@echo "-> Copying files into place"
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH):/tmp/tmp/plugn && go get github.com/dokku/plugn
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH):/tmp/tmp/plugn && cd /home/vagrant/gocode/src/github.com/dokku/plugn && make deps
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH):/tmp/tmp/plugn && cd /home/vagrant/gocode/src/github.com/dokku/plugn && rm plugn && go build -o plugn
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH):/tmp/tmp/plugn && cd /home/vagrant/gocode/src/github.com/dokku/plugn && rm -f plugn && go build -o plugn
mv /home/vagrant/gocode/src/github.com/dokku/plugn/plugn /tmp/build/usr/local/bin/plugn
echo "-> Creating $(PLUGN_PACKAGE_NAME)"
@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' .
mv *.deb /tmp
deb-sshcommand: deb-setup
rm -rf /tmp/tmp /tmp/build $(SSHCOMMAND_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin
echo "-> Cloning repository"
@echo "-> Cloning repository"
git clone -q "https://github.com/$(SSHCOMMAND_REPO_NAME).git" /tmp/tmp/sshcommand > /dev/null
rm -rf /tmp/tmp/sshcommand/.git /tmp/tmp/sshcommand/.gitignore
echo "-> Copying files into place"
@echo "-> Copying files into place"
mkdir -p "/tmp/build/usr/local/bin"
cp /tmp/tmp/sshcommand/sshcommand /tmp/build/usr/local/bin/sshcommand
chmod +x /tmp/build/usr/local/bin/sshcommand
echo "-> Creating $(SSHCOMMAND_PACKAGE_NAME)"
@echo "-> Creating $(SSHCOMMAND_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n sshcommand -v $(SSHCOMMAND_VERSION) -a $(SSHCOMMAND_ARCHITECTURE) -p $(SSHCOMMAND_PACKAGE_NAME) --url "https://github.com/$(SSHCOMMAND_REPO_NAME)" --description $(SSHCOMMAND_DESCRIPTION) --license 'MIT License' .
mv *.deb /tmp
deb-sigil: deb-setup golang
rm -rf /tmp/tmp /tmp/build $(SIGIL_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin
@echo "-> Cloning repository"
git clone -q -b v$(SIGIL_VERSION) "https://github.com/$(SIGIL_REPO_NAME).git" /tmp/tmp/sigil > /dev/null
rm -rf /tmp/tmp/sigil/.git /tmp/tmp/sigil/.gitignore
@echo "-> Copying files into place"
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH):/tmp/tmp/sigil && go get github.com/gliderlabs/sigil
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH):/tmp/tmp/sigil && cd /home/vagrant/gocode/src/github.com/gliderlabs/sigil && make deps
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH):/tmp/tmp/sigil && cd /home/vagrant/gocode/src/github.com/gliderlabs/sigil && make build
cp /home/vagrant/gocode/src/github.com/gliderlabs/sigil/build/Linux/sigil /tmp/build/usr/local/bin/sigil
chmod +x /tmp/build/usr/local/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' .
mv *.deb /tmp

4
debian/control vendored
View File

@@ -1,9 +1,9 @@
Package: dokku
Version: 0.4.14
Version: 0.5.2
Section: web
Priority: optional
Architecture: amd64
Depends: locales, git, make, curl, gcc, man-db, sshcommand, docker-engine-cs | docker-engine | lxc-docker (>= 1.6.1) | docker.io (>= 1.6.1) | tutum-agent, software-properties-common, python-software-properties
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
Recommends: herokuish
Pre-Depends: nginx (>= 1.4.6), dnsutils, apparmor, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>

1
debian/postinst vendored
View File

@@ -43,6 +43,7 @@ case "$1" in
PLUGIN_PATH=${DOKKU_LIB_ROOT}/plugins plugn enable $plugin
fi
done
find -L ${DOKKU_LIB_ROOT} -type l -delete
chown dokku:dokku -R ${DOKKU_LIB_ROOT}/plugins ${DOKKU_LIB_ROOT}/core-plugins
echo "Install all core plugins"

View File

@@ -48,13 +48,7 @@ Once dokku is installed, if you are not using the web-installer, you'll want to
Set up a domain and a wildcard domain pointing to that host. Make sure `/home/dokku/VHOST` is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (`dig +short $(hostname -f)`). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, dokku will publish the app with a port number (i.e. `http://example.com:49154` - note the missing subdomain).
You'll have to add a public key associated with a username by doing something like this from your local machine:
$ cat ~/.ssh/id_rsa.pub | ssh dokku.me "sudo sshcommand acl-add dokku $USER"
If you are using the vagrant installation, you can use the following command to add your public key to dokku:
$ cat ~/.ssh/id_rsa.pub | make vagrant-acl-add
Follow the [user management documentation](/dokku/deployment/user-management) in order to add users to dokku.
That's it!

View File

@@ -0,0 +1,22 @@
# 0.5.0 Migration Guide
## nginx-vhosts
- The nginx-vhosts template language is now [sigil](https://github.com/gliderlabs/sigil)
- No need to escape literal `$` characters (or other "bash-isms")
- Template variables are represented as {{ .VARIABLE_NAME }}
- A detailed list of template variables can be found [here](/dokku/nginx#available-template-variables)
- A custom nginx-vhosts template must be named `nginx.conf.sigil`
- The default path for this custom template is the root of your repo (i.e. `/app` in the container or `WORKDIR` if defined in a dockerfile app)
- Dokku no longer looks for this file in `/home/dokku/myapp` on the dokku server
- Check out an example template [here](/dokku/nginx/)
- Support for server-wide SSL certs have been dropped in favor of using the `certs` plugin
- `dokku certs:add myapp < certs.tar`
- All domains for an SSL-enabled app will be redirected to https by default
- This can be overridden with a custom template
- Replaced "magic" `NO_VHOST` variable with `domains:enable/disable`
- Simplified zero downtime control
- `checks:enable/disable`
## Dockerfile apps with multiple ports
- Dockerfiles with multiple `EXPOSE` clauses will get all **tcp** ports proxied by default (nginx does not support proxying udp)
- UDP can be exposed by disabling the nginx proxy with `dokku proxy:disable myapp`

View File

@@ -5,6 +5,7 @@
Once Dokku has been configured with at least one user, applications can be deployed via a `git push` command. To quickly see Dokku deployment in action, you can use the Heroku Ruby on Rails example app.
```shell
# from your local machine
git clone git@github.com:heroku/ruby-rails-sample.git
```
@@ -13,6 +14,7 @@ git clone git@github.com:heroku/ruby-rails-sample.git
Create the application on the Dokku host. You will need to ssh onto the host to run this command.
```shell
# on your dokku host
dokku apps:create ruby-rails-sample
```
@@ -21,6 +23,7 @@ dokku apps:create ruby-rails-sample
When you create a new app, Dokku by default *does not* provide any datastores such as MySQL or PostgreSQL. You will need to install plugins to handle that, but fortunately [Dokku has official plugins](/dokku/plugins/#official-plugins-beta) for common datastores. Our sample app requires a PostgreSQL service:
```shell
# on your dokku host
# install the postgres plugin
# plugin installation requires root, hence the user change
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
@@ -36,6 +39,7 @@ dokku postgres:create rails-database
Once the service creation is complete, set the `POSTGRES_URL` environment variable by linking the service.
```shell
# on your dokku host
# each official datastore offers a `link` method to link a service to any application
dokku postgres:link rails-database ruby-rails-sample
```
@@ -47,6 +51,7 @@ dokku postgres:link rails-database ruby-rails-sample
Now you can deploy the `ruby-rails-sample` app to your Dokku server. All you have to do is add a remote to name the app. Applications are created on-the-fly on the Dokku server.
```shell
# from your local machine
git remote add dokku dokku@dokku.me:ruby-rails-sample
git push dokku master
```
@@ -89,6 +94,7 @@ Dokku supports deploying applications via [Heroku buildpacks](https://devcenter.
You can also remove an application from your Dokku installation. This will unlink all linked services and destroy any config related to the application. Note that linked services will retain their data for later use (or removal).
```shell
# on your dokku host
# replace APP with the name of your application
dokku apps:destroy APP
```
@@ -96,6 +102,7 @@ dokku apps:destroy APP
This will prompt you to verify the application's name before destroying it. You may also use the `--force` flag to circumvent this verification process:
```shell
# on your dokku host
# replace APP with the name of your application
dokku --force apps:destroy APP
```
@@ -107,21 +114,12 @@ dokku --force apps:destroy APP
You can rename a deployed app using the `apps:rename` CLI tool:
```shell
# on your dokku host
dokku apps:rename OLD_NAME NEW_NAME
```
This will copy all of your app's contents into a new app directory with the name of your choice, delete your old app, then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved.
### Adding deploy users
While it is possible to use password-based authorization to push to Dokku, it is preferable to use key-based authentication for security. You can add your public key to the dokku user's `authorized_keys` file with the following command:
```shell
# replace dokku.me with your domain name or the host's IP
# replace root with your server's root user
cat ~/.ssh/id_rsa.pub | ssh root@dokku.com "sudo sshcommand acl-add dokku [description]"
```
### Deploying non-master branch
Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku <local branch>:master```
@@ -133,6 +131,7 @@ You can also support pushing multiple branches using the [receive-branch](/dokku
If you only want to rebuild and tag a container, you can skip the deployment phase by setting `$DOKKU_SKIP_DEPLOY` to `true` by running:
``` shell
# on your dokku host
dokku config:set ruby-rails-sample DOKKU_SKIP_DEPLOY=true
```
@@ -141,6 +140,7 @@ dokku config:set ruby-rails-sample DOKKU_SKIP_DEPLOY=true
Dokku uses git locally (i.e. not a docker image) to build its own copy of your app repo, including submodules. This is done as the `dokku` user. Therefore, in order to deploy private git submodules, you'll need to drop your deploy key in `/home/dokku/.ssh/` and potentially add github.com (or your VCS host key) into `/home/dokku/.ssh/known_hosts`. The following test should help confirm you've done it correctly.
```shell
# on your dokku host
su - dokku
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
ssh -T git@github.com
@@ -182,11 +182,13 @@ This is in particular useful, then you want to deploy to root domain, as
## Dokku/Docker Container Management Compatibility
Dokku is, at its core, a docker container manager. Thus, it does not necessarily play well with other out-of-band processes interacting with the docker daemon. One thing to note as in [issue #1220](https://github.com/dokku/dokku/issues/1220), dokku executes a cleanup function prior to every deployment. This function removes all exited containers and all 'unattached' images.
Dokku is, at its core, a docker container manager. Thus, it does not necessarily play well with other out-of-band processes interacting with the docker daemon. One thing to note as in [issue #1220](https://github.com/dokku/dokku/issues/1220), dokku executes a cleanup function prior to every deployment.
### Specifying a custom buildpack
As of 0.5.x, this function removes all containers with the label `dokku` where the status is either `dead` or `exited`, as well as all `dangling` images. Previous versions would remove `dead` or `exited` containers, regardless of their label.
See the [buildpack documentation](/dokku/deployment/buildpacks/).
### Adding deploy users
See the [user management documentation](/dokku/deployment/user-management).
## Default vhost
@@ -196,10 +198,14 @@ See the [nginx documentation](/dokku/nginx/#default-site).
See the [dockerfile documentation](/dokku/deployment/dockerfiles/).
## Zero downtime deploy
### Specifying a custom buildpack
See the [zero-downtime deploy documentation](/dokku/checks-examples/).
See the [buildpack documentation](/dokku/deployment/buildpacks/).
## Image tagging
See the [image tagging documentation](/dokku/deployment/images).
## Zero downtime deploy
See the [zero-downtime deploy documentation](/dokku/checks-examples/).

View File

@@ -2,10 +2,10 @@
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/mstile-310x150.png"/>
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.2/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.4.14\/docs\/assets\/favicons\/android-chrome-36x36.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.2\/docs\/assets\/favicons\/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.4.14\/docs\/assets\/favicons\/android-chrome-48x48.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.2\/docs\/assets\/favicons\/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.4.14\/docs\/assets\/favicons\/android-chrome-72x72.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.2\/docs\/assets\/favicons\/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.4.14\/docs\/assets\/favicons\/android-chrome-96x96.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.2\/docs\/assets\/favicons\/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.4.14\/docs\/assets\/favicons\/android-chrome-144x144.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.2\/docs\/assets\/favicons\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.4.14\/docs\/assets\/favicons\/android-chrome-192x192.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.2\/docs\/assets\/favicons\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"

View File

@@ -1,11 +1,11 @@
body {
font-family: 'Open Sans', sans-serif;
font-weight: 400;
font-size: 12px;
padding-bottom: 40px;
color: #5a5a5a;
-webkit-font-smoothing: antialiased;
}
h1 {
color: #5a5a5a;
font-weight: 400;
@@ -25,9 +25,7 @@ h1 {
padding: 0 0 0 1em;
}
.header a {
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/dokku.png);
color: #fff;
text-indent: 40px;
background-position: center left;
display: block;
width: 100%;
@@ -37,23 +35,25 @@ h1 {
background-size: contain;
background-repeat: no-repeat;
}
.header .navbar-brand a {
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/dokku.png);
text-indent: 40px;
}
.blurb {
color: #424242;
background-color: #ededed;
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/gplaypattern.png);
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/gplaypattern.png);
padding: 45px 0;
text-align: center;
}
.blurb p {
font-size: 17px;
font-weight: 300;
margin: 18px 0 18px;
margin: 18px 0;
text-align: center;
}
.quickstart-code {
display: block;
font-size: 12px;
line-height: 1.3em;
margin: 45px auto;
max-width: 750px;
@@ -62,7 +62,8 @@ h1 {
.quickstart-code .title {
background-color: #dfdfdf;
background-image: linear-gradient(top, #f7f7f7 0%, #dfdfdf 7%, #ccc 100%);
border-bottom: 1px solid #111;
border-radius: 5px 5px 0 0;
box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
color: #444;
display: block;
font-weight: 400;
@@ -70,18 +71,47 @@ h1 {
margin: 0 20px;
padding: 3px 0;
text-align: center;
text-shadow: 0 1px 0 rgba(255,255,255,0.5);
border-radius: 5px 5px 0 0;
box-shadow: 0 3px 0 rgba(0,0,0,0.5);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.quickstart-code .tabs {
background-color: #bcbcbc;
border-top: 1px solid #686868;
color: #444;
display: flex;
display: -webkit-flex;
font-weight: bold;
margin: 0 20px;
padding: 0;
text-align: center;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.quickstart-code .tab {
border-right: 1px solid #686868;
cursor: pointer;
flex: 1;
-webkit-flex: 1;
}
.quickstart-code .tab-active {
background-color: #ededed;
border-radius: 0 0 5px 5px;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
.quickstart-code .tab:last-of-type {
border-right: none;
}
.quickstart-code .shell {
background-color: #171717;
border-radius: 0 0 5px 5px;
border-top: 1px solid #bcbcbc;
box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
display: none;
font-family: Menlo, Consolas, "Courier New", Courier, "Liberation Mono", monospace;
margin: 0 20px;
padding: 20px;
text-shadow: none;
border-radius: 0 0 5px 5px;
box-shadow: 0 5px 30px rgba(0,0,0,0.3);
}
.quickstart-code .shell-active {
display: block;
}
.quickstart-code .line {
display: block;
@@ -91,19 +121,28 @@ h1 {
.quickstart-code .line span {
display: inline-block;
}
.quickstart-code .line .output {
color: #aaa;
}
.quickstart-code .path {
color: #2a8fbd;
content: '~';
user-select: none;
}
.quickstart-code .prompt {
color: #ff9900;
color: #f90;
user-select: none;
}
.quickstart-code .command {
color: #ffffcc;
color: #ffc;
}
.quickstart-code .line .output {
color: #aaaaaa;
.alternate-instructions {
display: block;
line-height: 1.3em;
margin: 45px auto;
max-width: 750px;
padding: 0;
text-align: center;
}
.marketing .col-lg-4 {
margin-bottom: 20px;
@@ -113,7 +152,6 @@ h1 {
margin-right: 10px;
margin-left: 10px;
}
.featurette-divider {
margin: 20px 0;
}
@@ -125,9 +163,20 @@ h1 {
.featurette-heading .text-muted {
font-weight: 300;
}
.slack-channel {
background-color: #EEF1F7;
font-size: 16px;
font-weight: 300;
margin-bottom: 2.5em;
padding: 2.5em 0;
text-align: center
}
.slack-channel .inline-container {
display: inline-block;
margin-left: 0.5em
}
.list-group-item {
border: none;
font-size: 13px;
font-weight: normal;
padding: .2rem .5rem;
color: #157577;
@@ -143,13 +192,12 @@ a.list-group-item {
color: #bbb;
cursor: default;
font-weight: normal;
font-size: 11px;
margin-bottom: 1em;
margin-top: 2em;
text-transform: uppercase;
}
.anchorjs-link {
color: #24cbce;
color: #24cbce;
}
.markdown-body {
-webkit-font-smoothing: antialiased;
@@ -173,7 +221,7 @@ a.list-group-item {
font-size: 17px;
font-weight: 700;
color: #555;
margin-top: 3em;
margin-top: 2em;
text-transform: uppercase;
}
.markdown-body h3 {
@@ -198,7 +246,7 @@ code {
margin: 0;
font-size: 85%;
background-color: #fff;
background-color: rgba(0,0,0,0.06);
background-color: rgba(0, 0, 0, 0.06);
color: #333;
-webkit-border-radius: 3px;
border-radius: 3px;
@@ -223,9 +271,8 @@ pre {
word-wrap: normal;
border: 1px solid #cccccc;
border-radius: 4px;
font-size: 12px;
box-shadow: 0 0 0 3px #eee;
overflow: auto !important;
overflow: auto;
padding: 10px;
background-color: #fff;
color: #4d4d4c;
@@ -237,20 +284,207 @@ blockquote {
padding: 15px 15px 1px;
margin-bottom: 30px;
}
blockquote.new-as-of {
.new-as-of {
border-left: 4px solid #d1f2a5;
background-color: #effab4;
}
.not-yet-released {
border-left: 4px solid #ef5b58;
background-color: #f9ad76;
}
.fa:before {
-webkit-font-smoothing: antialiased
}
.clearfix {
*zoom: 1
}
.clearfix:before, .clearfix:after {
display: table;
content: ""
}
.clearfix:after {
clear: both
}
a .fa {
display: inline-block;
text-decoration: inherit
}
li .fa {
display: inline-block
}
li .fa-large:before, li .fa-large:before {
width: 1.875em
}
ul.fas {
list-style-type: none;
margin-left: 2em;
text-indent: -0.8em
}
ul.fas li .fa {
width: 0.8em
}
ul.fas li .fa-large:before, ul.fas li .fa-large:before {
vertical-align: baseline
}
.rst-versions {
position: fixed;
bottom: 0;
left: 0;
width: 300px;
color: #fcfcfc;
background: #15518d;
border-top: solid 10px #343131;
font-family: "Lato", "proxima-nova", "Helvetica Neue", Arial, sans-serif;
z-index: 400
}
.rst-versions a {
color: #7c8e98;
text-decoration: none
}
.rst-versions .rst-badge-small {
display: none
}
.rst-versions .rst-current-version {
padding: 12px;
background-color: #2475c3;
display: block;
text-align: right;
cursor: pointer;
color: #d8edf8;
*zoom: 1
}
.rst-versions .rst-current-version:before, .rst-versions .rst-current-version:after {
display: table;
content: ""
}
.rst-versions .rst-current-version:after {
clear: both
}
.rst-versions .rst-current-version .fa {
color: #fcfcfc
}
.rst-versions .rst-current-version .fa-book {
float: left;
line-height: 30px
}
.rst-versions .rst-current-version .icon-book {
float: left
}
.rst-versions .rst-current-version.rst-out-of-date {
background-color: #E74C3C;
color: #fff
}
.rst-versions .rst-current-version.rst-active-old-version {
background-color: #F1C40F;
color: #000
}
.rst-versions.rst-badge {
border: none;
bottom: 20px;
display: block;
left: auto;
max-width: 300px;
right: 20px;
width: auto;
}
.rst-versions.rst-badge .icon-book {
float: none
}
.rst-versions.rst-badge .fa-book {
float: none
}
.rst-versions.rst-badge.shift-up .rst-current-version {
text-align: right
}
.rst-versions.rst-badge.shift-up .rst-current-version .fa-book {
float: left
}
.rst-versions.rst-badge.shift-up .rst-current-version .icon-book {
float: left
}
.rst-versions.rst-badge .rst-current-version {
width: auto;
height: 30px;
line-height: 30px;
padding: 0 6px;
display: block;
text-align: center
}
.rst-other-versions {
display: none;
padding: 12px;
text-align: left;
}
.shift-up .rst-other-versions {
display: block;
}
.rst-other-versions a {
border: 0;
}
.rst-other-versions hr {
display: block;
border: 0;
margin: 20px 0;
padding: 0;
border-top: solid 1px #d6edf9
}
.rst-other-versions dl {
margin: 0;
}
.rst-other-versions dd {
display: inline-block;
margin: 0
}
.rst-other-versions dd a {
display: inline-block;
padding: 6px;
color: #fcfcfc
}
.dev-warning, .outdated-warning {
position: absolute;
top: 0;
width: 100%;
padding: 8px 20px 8px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background-image: -webkit-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.04) 50%, rgba(0, 0, 0, 0.04) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.04) 50%, rgba(0, 0, 0, 0.04) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.04) 50%, rgba(0, 0, 0, 0.04) 75%, transparent 75%, transparent);
background-image: -ms-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.04) 50%, rgba(0, 0, 0, 0.04) 75%, transparent 75%, transparent);
background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.04) 50%, rgba(0, 0, 0, 0.04) 75%, transparent 75%, transparent);
font-family: "Roboto", Corbel, Avenir, "Lucida Grande", "Lucida Sans", sans-serif;
font-size: 14px;
text-align: center;
background-color: #ffe761;
}
@media screen and (max-width: 768px) {
.rst-versions {
width: 85%;
display: none
}
.rst-versions.shift {
display: block
}
img {
width: 100%;
height: auto
}
}
@media (min-width: 768px) {
.quickstart-code {
.col-md-offset-right-2 {
margin-right: 20.666667%;
}
.quickstart-code shell {
font-size: 14px;
}
.quickstart-code {
line-height: 22px;
}
.featurette-heading {
font-size: 50px;
}
}
@media (min-width: 992px) {
.featurette-heading {
margin-top: 120px;

View File

@@ -0,0 +1,7 @@
{
"max-versions": [
"0.3.26",
"0.4.14",
"0.5.2"
]
}

45
docs/backup-recovery.md Normal file
View File

@@ -0,0 +1,45 @@
# Backup and Recovery
> The backup plugin was deprecated in 0.4.x, below are backup recommendations for 0.5.x and later.
## Backup and Migration Tutorial
Because Dokku is git based, rebuilding a deployed app is as easy as pushing from git. You can push to a new server by updating the dokku remote in you local app's repo.
```
$ git remote rm dokku
$ git remote add dokku dokku@[dokku.me:dokku.me]
$ git push dokku [master]
```
## Databases
Some plugins, like the official [dokku-postgres] plugin, have built-in commands that allow non-volatile data be exported and imported.
For [dokku-postgres], use:
```
dokku postgres:export [db_name] > [db_name].dump
dokku postgres:import [db_name] < [db_name].dump
```
## Volumes and Static Assets
Dokku doesn't enforce a [300mb] limit on apps, but it's best practice to keep binary assets outside of git. Since containers are considered volatile in Dokku, external stores like s3 or storage mounts should be used for non-volatile items like user uploads. The dokku storage core plugin can be used to mount local directories / volumes inside the docker container.
```
storage:list <app>, List bind mounts for app's container(s) (host:container)
storage:mount <app> <host-dir:container-dir>, Create a new bind mount
storage:unmount <app> <host-dir:container-dir>, Remove an existing bind mount
```
## Disaster Recovery
The best plan for disaster recovery is to always keep multiple (remote) copies of your local repo, static assets and periodic database dumps. In case of an emergency when your git repo and backups are completely lost, you can recover the last pushed copy from your remote dokku server (assuming you still have the ssh key).
```
mkdir [app-name] ; cd !$
git init && git remote add dokku dokku@[dokku.me:app-name]
git pull dokku/master && git checkout dokku/master
```
[dokku-postgres]: <https://github.com/dokku/dokku-postgres>
[300mb]: <https://devcenter.heroku.com/articles/slug-compiler#slug-size>

View File

@@ -1,60 +1,57 @@
# Zero Downtime Deploys
> New as of 0.3.0
> New as of 0.5.0
Following a deploy, dokku will now wait `10` seconds before routing traffic to the new container. If the container is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value using the following command:
```
checks <app> Show zero-downtime status
checks:disable <app> Disable zero-downtime checks
checks:enable <app> Enable zero-downtime checks
```
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:
```shell
dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30
dokku config:set <app> DOKKU_DEFAULT_CHECKS_WAIT=30
```
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.
To specify checks, add a `CHECKS` file to the root of your project directory. This is a text file with one line per check. Empty lines and lines starting with `#` are ignored.
A check is a relative URL and may be followed by expected content from the page, for example:
```
/about Our Amazing Team
```
Dokku will wait `5` seconds before running the checks to give the server time to start. This value can be overridden on a per-app basis in the `CHECKS` file by setting `WAIT=nn`. You may also override this for the global dokku installation:
You can also choose to skip checks completely on a per-application basis:
```shell
dokku config:set --global DOKKU_CHECKS_WAIT=15
dokku checks:disable <app>
```
Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. This value is also configurable globally:
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:
```shell
dokku config:set --global DOKKU_WAIT_TO_RETIRE=120
dokku config:set <app> DOKKU_WAIT_TO_RETIRE=120
```
> Note that during this time, multiple containers may be running on your server, which can be an issue for memory-hungry applications on memory-constrained servers.
Dokku will retry the checks `5` times until the checks are successful. If all 5 checks fail, the deployment is considered failed. This can be overridden in the `CHECKS` file by setting `ATTEMPTS=nn`. This number is also configurable globally:
## Checks
```shell
dokku config:set --global DOKKU_CHECKS_ATTEMPTS=2
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.
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
* Settings (NAME=VALUE)
* Comments (lines starting with #)
* Empty lines
> For dockerfile-based deploys, the file *must* be in `/app/CHECKS` within the container. `/app` is used by default as the root container directory for buildpack-based deploys.
### Check Instructions
The format of a check instruction is a path or relative URL, optionally followed by the expected content:
```
/about Our Amazing Team
```
You can also choose to skip checks completely either globally or on a per-application basis:
```shell
# globally
dokku config:set --global DOKKU_SKIP_ALL_CHECKS=true
# for APP
dokku config:set APP DOKKU_SKIP_ALL_CHECKS=true
```
## Checks Examples
The CHECKS file may contain empty lines, comments (lines starting with #),
settings (NAME=VALUE) and check instructions.
The format of a check instruction is a path, optionally followed by the
expected content. For example:
The `CHECKS` file can contain multiple checks:
```
/ My Amazing App
@@ -63,50 +60,65 @@ expected content. For example:
/images/logo.png
```
To check an application that supports multiple hostnames, use relative URLs
that include the hostname, for example:
To check an application that supports multiple hostnames, use relative URLs that include the hostname:
```
//admin.example.com Admin Dashboard
//admin.example.com Admin Dashboard
//static.example.com/logo.png
```
You can also specify the protocol to explicitly check HTTPS requests.
You can also specify the protocol to explicitly check HTTPS requests:
```
https://admin.example.com Admin Dashboard
https://admin.example.com Admin Dashboard
https://static.example.com/logo.png
```
The default behavior is to wait for 5 seconds before running the first check, and timeout each check to 30 seconds.
### Check Settings
By default, checks will be attempted 5 times. (Retried 4 times)
The default behavior is to wait for `5` seconds before running the checks, to timeout the checks after `30` seconds, and to attempt the checks `5` times. If the checks fail `5` times, the deployment is considered failed and the old container will continue serving traffic.
You can change these by setting `WAIT`, `TIMEOUT` and `ATTEMPTS` to different values, for
example:
You can change the default behavior by setting `WAIT`, `TIMEOUT`, and `ATTEMPTS` to different values in the `CHECKS` file:
```
WAIT=30 # Wait 1/2 minute
TIMEOUT=60 # Timeout after a minute
ATTEMPTS=10 # attempt checks 10 times
ATTEMPTS=10 # Attempt checks 10 times
/ My Amazing App
/ My Amazing App
```
You can also override the default `WAIT`, `TIMEOUT`, and `ATTEMPTS` variables for the global dokku installation:
```shell
dokku config:set --global DOKKU_CHECKS_WAIT=30
dokku config:set --global DOKKU_CHECKS_TIMEOUT=60
dokku config:set --global DOKKU_CHECKS_ATTEMPTS=10
```
If your application runs multiple processes (a background worker configured in your `Procfile`, for example) and you have checks to ensure that your web application has booted up, you may want to disable the default check wait time for that application to avoid the `10` second wait per non-web process:
```shell
dokku config:set <app> DOKKU_DEFAULT_CHECKS_WAIT=0
```
## Example: Successful Rails Deployment
In this example, a rails applicaiton is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `ATTEMPTS` is set to 6, but the third attempt succeeds.
In this example, a Rails application is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `WAIT` is set to `10` because our application takes a while to boot up. `ATTEMPTS` is set to `6`, but the third attempt succeeds.
### CHECKS file
````
WAIT=5
WAIT=10
ATTEMPTS=6
/check.txt simple_check
/check.txt simple_check
````
> check.txt is a text file returning the string 'simple_check'
For this check to work, we've added a line to `config/routes.rb` that simply returns a string:
````
get '/check.txt', to: proc {[200, {}, ['simple_check']]}
````
### Deploy Output
@@ -129,19 +141,19 @@ git push dokku master
-----> Releasing myapp...
-----> Deploying myapp...
-----> Running pre-flight checks
-----> Attempt 1/6 Waiting for 5 seconds ...
-----> Attempt 1/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/check.txt => "simple_check"
!
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
! Check attempt 1/6 failed.
-----> Attempt 2/6 Waiting for 5 seconds ...
-----> Attempt 2/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/check.txt => "simple_check"
!
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
! Check attempt 2/6 failed.
-----> Attempt 3/6 Waiting for 5 seconds ...
-----> Attempt 3/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/check.txt => "simple_check"
-----> All checks successful!
@@ -165,14 +177,15 @@ curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
````
## Example: Failing Rails Deployment
In this example, a Rails application fails to deploy. The reason for the failure is that the postgres database connection fails. The initial checks will fail while we wait for the server to start up, just like in the above example. However, once the server does start accepting connections, we will see an error 500 due to the postgres database connection failure.
In this example, a Rails application fails to deploy. The reason for the failure is that the postgres database connection fails. The initial checks will fail while we wait for the server to start up, just like in the above example. However, once the server does start accepting connections, we will see an error 500 due to the postgres database connection failure.
Once the attempts have been exceeded, the deployment fails and we see the container output, which shows the Postgres connection errors.
### CHECKS file
````
WAIT=5
WAIT=10
ATTEMPTS=6
/
````
@@ -200,37 +213,37 @@ Procfile declares types -> web
Releasing myapp...
Deploying myapp...
Running pre-flight checks
-----> Attempt 1/6 Waiting for 5 seconds ...
-----> Attempt 1/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
! Check attempt 1/6 failed.
-----> Attempt 2/6 Waiting for 5 seconds ...
-----> Attempt 2/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
! Check attempt 2/6 failed.
-----> Attempt 3/6 Waiting for 5 seconds ...
-----> Attempt 3/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (22) The requested URL returned error: 500 Internal Server Error
! Check attempt 3/6 failed.
-----> Attempt 4/6 Waiting for 5 seconds ...
-----> Attempt 4/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (22) The requested URL returned error: 500 Internal Server Error
! Check attempt 4/6 failed.
-----> Attempt 5/6 Waiting for 5 seconds ...
-----> Attempt 5/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (22) The requested URL returned error: 500 Internal Server Error
! Check attempt 5/6 failed.
-----> Attempt 6/6 Waiting for 5 seconds ...
-----> Attempt 6/6 Waiting for 10 seconds ...
CHECKS expected result:
http://localhost/ => ""
!

View File

@@ -13,6 +13,10 @@ To install, simply clone the dokku repository down and add the `dokku` alias poi
```shell
git clone git@github.com:dokku/dokku.git ~/.dokku
# optional: make sure that the dokku_client.sh version matches your dokku version
cd ~/.dokku
git checkout <tag/branch>
# add the following to either your
# .bashrc, .bash_profile, or .profile file
alias dokku='$HOME/.dokku/contrib/dokku_client.sh'
@@ -33,6 +37,8 @@ alias dokku 'bash $HOME/.dokku/contrib/dokku_client.sh'
Configure the `DOKKU_HOST` environment variable or run `dokku` from a repository with a git remote named dokku pointed at your dokku host in order to use the script as normal.
You can also configure a `DOKKU_PORT` environment variable if you are running ssh on a non-standard port. This defaults to `22`.
## (nodejs) dokku-toolbelt
Dokku-toolbelt is a node-based cli wrapper that proxies requests to the dokku command running on remote hosts. You can install it via the following shell command (assuming you have nodejs and npm installed):

View File

@@ -11,7 +11,7 @@ config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config
config:unset (<app>|--global) KEY1 [KEY2 ...] Unset one or more config vars
```
The variables are available both at run time and during the application build/compilation step.
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).
> 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.

View File

@@ -0,0 +1,57 @@
# Deployment Tasks
> New as of 0.5.0
Sometimes you need to run a command on at deployment time, but before an app is completely deployed.
Common use cases include:
* Checking a database is initialised
* Running database migrations
* Any commands required to set up the server (e.g. something like a Django `collectstatic`)
## `app.json` and `scripts.dokku`
Dokku accomplishes this by using an `app.json` file. We (mostly) use the same format as Heroku's [app.json](https://devcenter.heroku.com/articles/app-json-schema).
However, dokku currently only supports the nodes `scripts.dokku.predeploy` and `scripts.dokku.postdeploy`.
Simply place an `app.json` file in the root of your repository or for dockerfile apps, `ADD` it to /app.
>NOTE: postdeploy changes are *NOT* committed to the app image.
### Example app.json
```
{
"name": "barebones nodejs",
"description": "A barebones Node.js app using Express 4.",
"keywords": [
"nodejs",
"express"
],
"repository": "https://github.com/michaelshobbs/node-js-sample",
"scripts": {
"dokku": {
"predeploy": "touch /app/predeploy.test",
"postdeploy": "curl https://some.external.api.service.com/deployment?state=succuss"
}
},
"env": {
"SECRET_TOKEN": {
"description": "A secret key for verifying the integrity of signed cookies.",
"value": "secret"
},
"WEB_CONCURRENCY": {
"description": "The number of processes to run.",
"generator": "echo 5"
}
},
"image": "gliderlabs/herokuish",
"addons": [
"dokku-postgres",
"dokku-redis"
],
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-nodejs"
}
]
}
```

View File

@@ -39,3 +39,35 @@ dokku config:set APP DOKKU_DOCKERFILE_START_CMD="--harmony server.js"
To tell docker what to run.
Setting `$DOKKU_DOCKERFILE_CACHE_BUILD` to `true` or `false` will enable or disable docker's image layer cache. Lastly, for more granular build control, you may also pass any `docker build` option to `docker`, by setting `$DOKKU_DOCKER_BUILD_OPTS`.
### Procfiles and Multiple Processes
> New as of 0.5.0
You can also customize the run command using a `Procfile`, much like you would on Heroku or
with a buildpack deployed app. The `Procfile` should contain one or more lines defining [process
types and associated commands](https://devcenter.heroku.com/articles/procfile#declaring-process-types).
When you deploy your app a Docker image will be built, the `Procfile` will be extracted from the image
(it must be in the folder defined in your `Dockerfile` as `WORKDIR` or `/app`) and the commands
in it will be passed to `docker run` to start your process(es). Here's an example `Procfile`:
```
web: bin/run-prod.sh
worker: bin/run-worker.sh
```
And `Dockerfile`:
```
FROM debian:jessie
WORKDIR /app
COPY . ./
CMD ["bin/run-dev.sh"]
```
When you deploy this app the `web` process will automatically be scaled to 1 and your Docker container
will be started basically using the command `docker run bin/run-prod.sh`. If you want to also run
a worker container for this app, you can run `dokku ps:scale worker=1` and a new container will be
started by running `docker run bin/run-worker.sh` (the actual `docker run` commands are a bit more
complex, but this is the basic idea). If you use an `ENTRYPOINT` in your `Dockerfile`, the lines
in your `Procfile` will be passed as arguments to the `ENTRYPOINT` script instead of being executed.

View File

@@ -1,4 +1,4 @@
# One-off Processes
# One-off Processes and Cron
Sometimes you need to either inspect running containers or run a one-off command under an application. In those cases, Dokku makes it easy to either connect to a running container or run a fresh container.

View File

@@ -101,14 +101,40 @@ Beware that if you enable the header and a subsequent deploy of your application
## Running behind a load balancer
> New as of 0.3.17
Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarded-For` and `X-Forwarded-Port`. These headers indicate the protocol of the original request (HTTP or HTTPS), the port number, and the IP address of the client making the request, respectively. The default configuration is for Nginx to set these headers.
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 setting the `DOKKU_SSL_TERMINATED` environment variable:
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
dokku config:set myapp DOKKU_SSL_TERMINATED=1
server {
listen [::]:{{ .NGINX_PORT }};
listen {{ .NGINX_PORT }};
server_name {{ .NOSSL_SERVER_NAME }};
access_log /var/log/nginx/{{ .APP }}-access.log;
error_log /var/log/nginx/{{ .APP }}-error.log;
# set a custom header for requests
add_header X-Served-By www-ec2-01;
location / {
proxy_pass http://{{ .APP }};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
proxy_set_header X-Request-Start $msec;
}
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
}
```
Only use this option if:

View File

@@ -0,0 +1,48 @@
# User Management
While it is possible to use password-based authorization to push to Dokku, it is preferable to use key-based authentication for security.
Users in dokku are managed via the `~/dokku/.ssh/authorized_keys` file. While you *can* manually edit this file, it is **highly** recommended that you follow the below steps to manage users on a dokku server.
## SSHCommand
Dokku uses the [`sshcommand`](https://github.com/dokku/sshcommand) utility to manage ssh keys for the dokku user. The following is the usage output for sshcommand.
```
sshcommand create <user> <command> # creates a user forced to run command when SSH connects
sshcommand acl-add <user> <ssh-key-name> # adds named SSH key to user from STDIN
sshcommand acl-remove <user> <ssh-key-name> # removes SSH key by name
sshcommand help # displays the usage help message
```
In dokku's case, the `<user>` section is *always* `dokku`, as this is the system user that the dokku binary performs all it's actions. Keys are given unique names, which can be used in conjunction with the [user-auth](/dokku/development/plugin-triggers/#user-auth) plugin trigger to handle command authorization.
## Adding deploy users
You can add your public key to the dokku user's `~/dokku/.ssh/authorized_keys` file with the following command:
```shell
# from your local machine
# replace dokku.me with your domain name or the host's IP
# replace root with your server's root user
# USER is the username you use to refer to this particular key
cat ~/.ssh/id_rsa.pub | ssh root@dokku.me "sudo sshcommand acl-add dokku USER"
```
At it's base, the `sshcommand` *must* be run under a user with sudo access, as it sets keys for the dokku user.
For instance, if you stored your public key at `~/.ssh/id_rsa.pub-open` and are deploying to EC2 where the default root-enabled user is `ubuntu`, you can run the following command to add your key under the `superuser` username:
```
cat ~/.ssh/id_rsa.pub-open | ssh ubuntu@dokku.me "sudo sshcommand acl-add dokku superuser"
```
If you are using the vagrant installation, you can also use the `make vagrant-acl-add` target to add your public key to dokku (it will use your host username as the `USER`):
```
cat ~/.ssh/id_rsa.pub | make vagrant-acl-add
```
## Scoping commands to specific users
See the [user auth plugin trigger documentation](/dokku/development/plugin-triggers/#user-auth).

View File

@@ -3,38 +3,102 @@
If you create your own plugin:
1. Take a look at the plugins shipped with dokku and hack away!
2. Check out the [list of triggers](http://dokku.viewdocs.io/dokku/development/plugin-triggers) your plugin can implement.
2. Check out the [list of triggers](/dokku/development/plugin-triggers) your plugin can implement.
3. Upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
4. Edit [this page](http://dokku.viewdocs.io/dokku/plugins) and add a link to it.
4. Edit [this page](/dokku/plugins) and add a link to it.
5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
### Sample plugin
The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file:
### Sample plugin
The below plugin is a dummy `dokku hello` plugin.
hello/subcommands/default
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
hello_main_cmd() {
declare desc="prints Hello \$APP"
local cmd="hello"
# Support --app/$DOKKU_APP_NAME flag
# Use the following lines to reorder args into "$cmd $DOKKU_APP_NAME $@""
local argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
[[ ! -z $DOKKU_APP_NAME ]] && set -- $DOKKU_APP_NAME $@
set -- $cmd $@
##
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
local APP="$2";
echo "Hello $APP"
}
hello_main_cmd "$@"
```
hello/subcommands/world
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
hello_world_cmd() {
declare desc="prints Hello World"
local cmd="hello:world"
# Support --app/$DOKKU_APP_NAME flag
# Use the following lines to reorder args into "$cmd $DOKKU_APP_NAME $@""
local argv=("$@")
[[ ${argv[0]} == "$cmd" ]] && shift 1
[[ ! -z $DOKKU_APP_NAME ]] && set -- $DOKKU_APP_NAME $@
set -- $cmd $@
##
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
local APP="$2";
echo "Hello world"
}
hello_world_cmd "$@"
```
hello/commands
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
hello)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP); IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
echo "Hello $APP"
;;
hello:world)
echo "Hello world"
;;
help)
cat<<EOF
help | hello:help)
help_content_func () {
declare desc="return help_content string"
cat<<help_content
hello <app>, Says "Hello <app>"
hello:world, Says "Hello world"
EOF
help_content
}
if [[ $1 = "hello:help" ]] ; then
echo -e 'Usage: dokku hello[:world] [<app>]'
echo ''
echo 'Say Hello World.'
echo ''
echo 'Example:'
echo ''
echo '$ dokku hello:world'
echo 'Hello world'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
@@ -89,5 +153,5 @@ A few notes:
dokku config:unset --no-restart APP KEY1 [KEY2 ...]
```
- 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](http://dokku.viewdocs.io/dokku/development/plugin-triggers) doc for examples.
- 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.

View File

@@ -23,7 +23,7 @@ echo "$NEW_SUBDOMAIN.$VHOST"
## Available plugin triggers
There are a number of plugin-related triggers. These can be optionally implemented by plugins and allow integration into the standard dokku setup/backup/teardown process.
There are a number of plugin-related triggers. These can be optionally implemented by plugins and allow integration into the standard dokku setup/teardown process.
The following plugin triggers describe those available to a dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugin development.
@@ -92,10 +92,10 @@ cd /root/dokku
sudo BUILD_STACK=true make install
```
### `commands help`
### `comands help` and `commands <PLUGIN_NAME>:help`
- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this plugin trigger. This must be implemented inside the `commands` plugin file.
- Invoked by: `dokku help`
- Description: Your plugin should implement a `help` command in your `commands` file to take advantage of this plugin trigger. `commands help` is used by `dokku help` to aggregate all plugins abbreviated `help` output. Implementing `<PLUGIN_NAME>:help` in your `commands` file gives users looking for help, a more detailed output. 'commands help' must be implemented inside the `commands` plugin file. It's recommended that `PLUGIN_NAME:help` be added to the commands file to ensure consistency among community plugins and give you a new avenue to share rich help content with your user.
- Invoked by: `dokku help` and `commands <PLUGIN_NAME>:help`
- Arguments: None
- Example:
@@ -106,11 +106,30 @@ sudo BUILD_STACK=true make install
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | derp:help)
cat<<EOF
derp:herp, Herps the derp
derp:serp [file], Shows the file's serp
EOF
help | hello:help)
help_content_func () {
declare desc="return help_content string"
cat<<help_content
hello <app>, Says "Hello <app>"
hello:world, Says "Hello world"
help_content
}
if [[ $1 = "hello:help" ]] ; then
echo -e 'Usage: dokku hello[:world] [<app>]'
echo ''
echo 'Say Hello World.'
echo ''
echo 'Example:'
echo ''
echo '$ dokku hello:world'
echo 'Hello world'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
@@ -120,67 +139,6 @@ EOF
esac
```
### `backup-export`
- Description: Used to backup files for a given plugin. If your plugin writes files to disk, this plugin trigger should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz.
- Invoked by: `dokku backup:export`
- Arguments: `$VERSION $DOKKU_ROOT`
- Example:
```shell
#!/usr/bin/env bash
# Echos out the location of every `REDIRECT` file
# that are used by the apps
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
DOKKU_ROOT="$2"
cat; for i in $DOKKU_ROOT/*/REDIRECT; do echo $i; done
```
### `backup-check`
- Description: Checks that a backup being imported passes sanity checks.
- Invoked by: `dokku backup:import`
- Arguments: `$VERSION $BACKUP_ROOT $DOKKU_ROOT $BACKUP_TMP_DIR/.dokku_backup_apps`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `backup-import`
- Description: Allows a plugin to import specific files from a `$BACKUP_ROOT` to the `DOKKU_ROOT` directory.
- Invoked by: `dokku backup:import`
- Arguments: `$VERSION $BACKUP_ROOT $DOKKU_ROOT $BACKUP_TMP_DIR/.dokku_backup_apps`
- Example:
```shell
#!/usr/bin/env bash
# Copies all redirect files from the backup
# into the correct app path.
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
BACKUP_ROOT="$2"
DOKKU_ROOT="$3"
cd $BACKUP_ROOT
for file in */REDIRECT; do
cp $file "$DOKKU_ROOT/$file"
done
```
### `pre-build-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.
@@ -405,7 +363,7 @@ dokku postgres:link $POSTGRES $APP
- Description: Allows running of commands after a deploy has completed. Dokku core currently uses this to switch traffic on nginx.
- Invoked by: `dokku deploy`
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG`
- Example:
```shell

View File

@@ -4,6 +4,7 @@ Dokku is released in intervals *at most* three weeks apart, though may be releas
To propose a release, the following tasks need to be performed:
- Update all blockquote references of `not yet released and only available in master` to point to release version.
- 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
@@ -17,12 +18,13 @@ To propose a release, the following tasks need to be performed:
- The versioned links should be updated in the `docs/assets/style.css` file.
- The versioned links should be updated in the `docs/home.html` file.
- The versioned links should be updated in the `docs/template.html` file.
- The versioned links should be updated in the `docs/template.html` file.
- The versioned links should be updated or added to the `docs/assets/versions.json` file.
- A list of changes must be made in the `HISTORY.md`.
- A tag must be created locally with your release version
- Debian packages *must* be created via `vagrant up build`
- The packages should be uploaded to packagecloud.io
- All changes are pushed to master and the tag should be turned into a release which will contain the changelog.
- ArchLinux package description *must* be updated via `vagrant up build-arch` (needs to be done after the tag is pushed to GitHub, because it is based on that)
## Versioning
@@ -56,6 +58,24 @@ If new versions of other packages were created, these should also be pushed at t
> If you are a maintainer and need the PACKAGECLOUD_TOKEN in order to make a release, please contact @josegonzalez to get this information.
## ArchLinux Packages
ArchLinux packages are not really build, because all that is needed for an Arch User Repo (AUR) package is the description of how to build the package. To make this process as easy as possible there is a vagrant box called `build-arch` that updates the version of this build description (a file called `PKGBUILD`), then runs some helper scripts to fill all additional information and does test if the package could be build. Then only those changes need to be pushed to the AUR repo and an updated version of the package is ready for usage for our ArchLinux users. For detailed information see the section below.
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.2-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'
git push aur master
```
> If you are a maintainer and need access to the AUR repositories in order to make a release, please contact @morrisjobke or @josegonzalez to get this co-maintainership.
## Changelog format
The `HISTORY.md` should be added to based on the changes made since the previous release. This can be done by reviewing all merged pull requests to the master branch on github. The format is as follows:
@@ -77,3 +97,28 @@ Some description concerning major changes in this release, or potential incompat
- #SOME_ID: @pull-request-creator Description
```
## Detailed information for ArchLinux packages
All of the information to build the ArchLinux package is in the AUR git repository (see [dokku AUR page](https://aur.archlinux.org/packages/dokku/)). The release of a AUR package only consists of pushing the package information into the AUR git repo. Then users could use that information to build the package on their machines.
To update the package clone the repository and adjust the files in the repository. Then a helper script - `updpkgsums` - to update the SHA sum could be called (check against the original SHA sum). Another helper script - `mksrcinfo` - needs to be called to update the meta information of the package in a file called `.SRCINFO`. The next step builds the package locally for verification - `makepkg`. As last step commit your changes and push the commit.
* dependencies are defined in the `depends` attribute in `PKGBUILD`
* build steps during package build time are defined in the `package()` method in `PKGBUILD`
* steps that should be executed during install/update/remove time are defined in the file `dokku.install`
* detailed information about all attributes in `PKGBUILD` could be found in the [ArchLinux wiki](https://wiki.archlinux.org/index.php/PKGBUILD)
* detailed information about the AUR workflow could be found in the [AUR article](https://wiki.archlinux.org/index.php/Arch_User_Repository) in the ArchLinux wiki
That is the usual workflow:
```shell
updpkgsums # update sha sums - compare them with the original ones
mksrcinfo # update package metadata for AUR
makepkg # test package builds
git add PKGBUILD .SRCINFO
git commit -m 'Update to dokku 0.9.9'
git push
```
> If there is something unclear simply ask @morrisjobke for help.

View File

@@ -14,7 +14,7 @@ Example apps can be found here:
### Executing tests locally
- Setup dokku in a [vagrant vm](http://dokku.viewdocs.io/dokku/getting-started/install/vagrant)
- Setup dokku in a [vagrant vm](/dokku/getting-started/install/vagrant)
- Test setup and execution
```shell

View File

@@ -5,8 +5,7 @@
Pass [options](https://docs.docker.com/engine/reference/run/) to Docker during Dokku's `build`, `deploy` and `run` phases
```
docker-options <app> Display app's Docker options for all phases
docker-options <app> <phase(s)> Display app's Docker options for phase (comma-separated phase list)
docker-options <app> [phase(s)] Display app's Docker options for all phases (or comma separated phase list)
docker-options:add <app> <phase(s)> OPTION Add Docker option to app for phase (comma-separated phase list)
docker-options:remove <app> <phase(s)> OPTION Remove Docker option from app for phase (comma-separated phase list)
```

View File

@@ -44,7 +44,6 @@ Jul 3 16:30:02 dokku.me dokku[131384]: INVOKED: docker-args-run( rubyapp )
You can list all events that are currently being recorded via `dokku events:list`:
```
=====> Events currently logged
backup-check
docker-args-build
pre-delete
post-deploy
@@ -56,8 +55,6 @@ post-build-buildpack
post-domains-update
post-release-dockerfile
check-deploy
backup-import
backup-export
git-pre-pull
git-post-pull
nginx-hostname

46
docs/dokku-storage.md Normal file
View File

@@ -0,0 +1,46 @@
# Dokku Core Storage Plugin
> New as of 0.5.0
The preferred method to mount external containers to a dokku managed container, is to use the dokku storage plugin.
```shell
storage:list <app>, List bind mounts for app's container(s) (host:container)
storage:mount <app> <host-dir:container-dir>, Create a new bind mount
storage:unmount <app> <host-dir:container-dir>, Remove an existing bind mount
```
## Ideology and Background
The storage plugin requires explicit paths on the host side. This is intentional to ensure that new users avoid running into unexpected results with implicit paths that may not exist (a feature deprecate in [Docker 1.9.0](https://github.com/docker/docker/releases/tag/v1.9.0])). The container directory is created for the mount point in the container. Any existing directory contents are not accessible after a mount is added to the container. Dokku creates a new directory `/var/lib/dokku/data/storage` during installation, it's the general consensus that new users should use this directory. Mounts are only available at run and deploy times, you must redeploy (restart) an app to mount or unmount to an existing app's container.
## Usage
This example demonstrates how to mount the recommended directory to `/storage` inside the container:
```
$ dokku storage:mount app-name /var/lib/dokku/data/storage:/storage
```
Dokku will then mount the shared contents of`/var/lib/dokku/storage` to `/storage` inside the container.
## Use Cases
### Persistent storage
Dokku is powered by Docker containers, which recommends in their [best practices](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#containers-should-be-ephemeral) that containers be treated as ephemeral. In order to manage persistent storage for web applications, like user uploads or large binary assets like images, a directory outside the container should be mounted.
### Shared storage between containers
When scaling your app, you may require a common location to access shared assets between containers, a storage mount can be used in this situation.
### Shared storage across environments
Your app may be used in a cluster that requires containers or resources not running on the same host access your data. Mounting a shared file service (like S3FS or EFS) inside your container will give you great flexibility.
### Backing up
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.
## 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

@@ -2,7 +2,7 @@
- If you don't already have one [generate an SSH key pair](https://help.github.com/articles/generating-ssh-keys/).
- Go to the [dokku on azure deployment page](https://azure.microsoft.com/en-us/documentation/templates/dokku-vm/) and click **Deploy to Azure**.
- Go to the [dokku on azure deployment page](https://github.com/azure/azure-quickstart-templates/tree/master/dokku-vm) and click **Deploy to Azure**.
- You'll be prompted to enter a few parameters, including a unique storage account name and a unique name for the sub-domain used for your public IP address. For the `sshKeyData` parameter, copy and paste the contents of the **public** key file you just created. After a few minutes the Dokku instance will be deployed.

View File

@@ -36,4 +36,4 @@ __Warning__: These steps will delete *everything* on your Linode.
9. Lastly, reboot the Linode.
Once your server comes back online, you'll be running Ubuntu's default kernel. You can now follow Dokku's [normal installation instructions](http://dokku.viewdocs.io/dokku/installation) and `bootstrap.sh` will take care of everything else.
Once your server comes back online, you'll be running Ubuntu's default kernel. You can now follow Dokku's [normal installation instructions](/dokku/installation) and `bootstrap.sh` will take care of everything else.

View File

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

View File

@@ -10,72 +10,69 @@
<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.4.14/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/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.4.14/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body{padding-bottom:40px;color:#5a5a5a}
h1{color:#5a5a5a;font-family:'montserrat',Optima,Segoe,"Segoe UI",Candara,Calibri,Arial,sans-serif;font-weight:700;line-height:1.1;margin-bottom:12px;margin-top:12px;text-rendering:optimizelegibility}
.header{background-color:#2a8fbd;padding:22px 0}
.header .heading{color:#fff;font-size:23px;margin:0;padding:0}
.blurb{color:#424242;background-color:#ededed;background-image:url(./assets/gplaypattern.png);padding:45px 0;text-align:center}
.blurb p{font-size:17px;font-weight:300;margin:18px 0;text-align:center}
.quickstart-code{display:block;font-size:12px;line-height:1.3em;margin:45px auto;max-width:750px;padding:0}
.quickstart-code .title{background-color:#dfdfdf;background-image:linear-gradient(top,#f7f7f7 0%,#dfdfdf 7%,#ccc 100%);border-bottom:1px solid #111;color:#444;display:block;font-weight:400;font-size:14px;margin:0 20px;padding:3px 0;text-align:center;text-shadow:0 1px 0 rgba(255,255,255,0.5);border-radius:5px 5px 0 0;box-shadow:0 3px 0 rgba(0,0,0,0.5)}
.quickstart-code .shell{background-color:#171717;font-family:Menlo,Consolas,"Courier New",Courier,"Liberation Mono",monospace;margin:0 20px;padding:20px;text-shadow:none;border-radius:0 0 5px 5px;box-shadow:0 5px 30px rgba(0,0,0,0.3)}
.quickstart-code .line{display:block;margin:0;padding:0}
.quickstart-code .line span{display:inline-block}
.quickstart-code .line .output{color:#aaaaaa;}
.quickstart-code .path{color:#2a8fbd;user-select:none}
.quickstart-code .prompt{color:#f90;user-select:none}
.quickstart-code .command{color:#ffc}
.marketing .col-lg-4{margin-bottom:20px;text-align:center}
.marketing .col-lg-4 p{margin-right:10px;margin-left:10px}
.featurette-divider{margin:20px 0}
.featurette-heading{font-weight:400;line-height:1;letter-spacing:-1px}
.featurette-heading .text-muted{font-weight:300}
@media (min-width: 768px) {
.quickstart-code{font-size:14px;line-height:22px}
.featurette-heading{font-size:50px}
}
@media (min-width: 992px) {
.featurette-heading{margin-top:120px}
}
<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.2/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<style>
</style>
</head>
<body>
<div class="header">
<div class="container">
<h1 class="heading">Dokku</h1>
<div class="row">
<div>
<h1 class="heading navbar-brand">
<a href="http://dokku.viewdocs.io/dokku/">Dokku</a>
</h1>
<ul class="nav nav-pills pull-xs-right">
<li class="nav-item">
<a class="nav-link" href="https://github.com/dokku/dokku/">Code</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/{{NAME}}/installation/">Docs</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://webchat.freenode.net/?channels=dokku">IRC</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://glider-slackin.herokuapp.com/">Slack</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<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 class="row">
<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>
@@ -83,27 +80,101 @@
<div class="container marketing">
<div class="quickstart-code">
<p class="title">Quick-start Instructions</p>
<div class="shell">
<div class="tabs">
<div data-tab="curl" class="tab tab-curl tab-active">curl | bash</div>
<div data-tab="apt" class="tab tab-apt">apt</div>
<div data-tab="arch" class="tab tab-arch">arch</div>
</div>
<div class="shell shell-curl shell-active">
<p class="line">
<span class="path">~</span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.4.14/bootstrap.sh</span>
<span class="output">&nbsp;# only works on debian systems!</span>
</p>
<p class="line">
<span class="path">~</span>
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.4.14 bash bootstrap.sh</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.5.2/bootstrap.sh</span>
</p>
<p class="line">
<span class="output"># =&gt; Go to your server's IP and follow the web installer</span>
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.5.2 bash bootstrap.sh</span>
</p>
<p class="line">
<span class="output">&nbsp;# go to your server's IP and follow the web installer</span>
</p>
</div>
<div class="shell shell-apt">
<p class="line">
<span class="output">&nbsp;# install docker</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">wget -nv -O - https://get.docker.com/ | sh</span>
</p>
<p class="line">
<span class="output">&nbsp;# setup dokku apt repository</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">wget -nv -O - https://packagecloud.io/gpg.key | apt-key add -</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">export SOURCE="https://packagecloud.io/dokku/dokku/ubuntu/"</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">echo "deb $SOURCE trusty main" | tee /etc/apt/sources.list.d/dokku.list</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">apt-get update</span>
</p>
<p class="line">
<span class="output">&nbsp;# install dokku</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">apt-get install dokku</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">dokku plugin:install-dependencies --core <span class="output"># run with root!</span></span>
</p>
<p class="line">
<span class="output">&nbsp;# go to your server's IP and follow the web installer</span>
</p>
</div>
<div class="shell shell-arch">
<p class="line">
<span class="output">&nbsp;# install dokku via yaourt</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">yaourt -S dokku</span>
</p>
</div>
</div>
<hr class="featurette-divider">
<div class="alternate-instructions">
<p>Hate <code>curl | bash</code>? See our official <a href="https://github.com/Azure/azure-quickstart-templates/tree/master/dokku-vm" target="_blank">Azure</a>, <a href="https://www.digitalocean.com/features/one-click-apps/dokku/" target="_blank">DigitalOcean</a>, and <a href="/{{NAME}}~{{REF}}/getting-started/install/linode/" target="_blank">Linode</a> instructions.<p>
<p>Still no love? <a href="https://github.com/dokku/dokku/blob/master/CONTRIBUTING.md" target="_blank">Contributions welcome</a>!</a>
</div>
<!-- START THE FEATURETTES -->
<hr class="featurette-divider">
<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>
@@ -141,11 +212,76 @@
<hr class="featurette-divider">
</div>
<!--
<div class="container-fluid slack-channel">
Have a question? Join us in our public slack channel!
<div class="inline-container">
<a class="button slack-button" href="https://glider-slackin.herokuapp.com/">
<img src="/assets/slack-logo.png" alt="Slack Logo">
</a>
</div>
</div>
-->
<div class="container">
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013-2016 Dokku</p>
</footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', function (e) {
var addClass = function (el, className) {
if (el.classList) {
el.classList.add(className);
} else {
el.className += ' ' + className;
}
},
addListener = function (elem, type, fn) {
if (elem.addEventListener) {
elem.addEventListener(type, fn, false);
} else if (elem.attachEvent) {
elem.attachEvent("on" + type, function() {
return fn.call(elem, window.event);
});
} else {
elem["on" + type] = fn;
}
},
hasClass = function(el, className) {
if (el.classList) {
return el.classList.contains(className);
} else {
return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
}
},
removeClass = function(el, className) {
if (el.classList) {
el.classList.remove(className);
} else {
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');;
}
},
activateTab = function(tab) {
removeClass(document.querySelectorAll('.shell-active')[0], 'shell-active');
removeClass(document.querySelectorAll('.tab-active')[0], 'tab-active');
addClass(document.querySelectorAll('.shell-' + tab)[0], 'shell-active');
addClass(document.querySelectorAll('.tab-' + tab)[0], 'tab-active');
window.location.hash = '#install-' + tab;
};
var hash = window.location.hash.replace('#install-', '');
if (['curl', 'apt', 'arch'].indexOf(hash) !== -1) {
activateTab(hash);
}
Array.prototype.forEach.call(document.querySelectorAll('.tab'), function (el, i) {
addListener(el, 'click', function(e) {
activateTab(this.getAttribute('data-tab'));
});
});
});
</script>
</body>
</html>

View File

@@ -15,12 +15,12 @@
<p class="line">
<span class="path">~</span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.4.14/bootstrap.sh</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.5.2/bootstrap.sh</span>
</p>
<p class="line">
<span class="path">~</span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.4.14 bash bootstrap.sh</span>
<span class="command">sudo DOKKU_TAG=v0.5.2 bash bootstrap.sh</span>
</p>
<p class="line">
<span class="output"># =&gt; Go to your server's IP and follow the web installer</span>

View File

@@ -19,8 +19,8 @@ To install the latest stable version of dokku, you can run the following shell c
```shell
# installs dokku via apt-get
wget https://raw.githubusercontent.com/dokku/dokku/v0.4.14/bootstrap.sh
sudo DOKKU_TAG=v0.4.14 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.5.2/bootstrap.sh
sudo DOKKU_TAG=v0.5.2 bash bootstrap.sh
```
The installation process takes about 5-10 minutes, depending upon internet connection speed.
@@ -33,17 +33,17 @@ Once you save your settings, the web admin will self-terminate and you should be
For various reasons, certain hosting providers may have other steps that should be preferred to the above. If hosted on any of the following popular hosts, please follow the linked to instructions:
- [Digital Ocean Installation Notes](http://dokku.viewdocs.io/dokku/getting-started/install/digitalocean)
- [Linode Installation Notes](http://dokku.viewdocs.io/dokku/getting-started/install/linode/)
- [Microsoft Azure Installation Notes](http://dokku.viewdocs.io/dokku/getting-started/install/azure/)
- [Digital Ocean Installation Notes](/dokku/getting-started/install/digitalocean)
- [Linode Installation Notes](/dokku/getting-started/install/linode/)
- [Microsoft Azure Installation Notes](/dokku/getting-started/install/azure/)
As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started:
- [Debian Package Installation Notes](http://dokku.viewdocs.io/dokku/getting-started/install/debian)
- [Vagrant Installation Notes](http://dokku.viewdocs.io/dokku/getting-started/install/vagrant)
- [Advanced Install Customization](http://dokku.viewdocs.io/dokku/advanced-installation)
- [Debian Package Installation Notes](/dokku/getting-started/install/debian)
- [Vagrant Installation Notes](/dokku/getting-started/install/vagrant)
- [Advanced Install Customization](/dokku/advanced-installation)
---
- <sup>[1]: To check whether your system has an fqdn set, run `sudo hostname -f`</sup>
- <sup>[2]: If your system has less than 1GB of memory, you can use ([this workaround](http://dokku.viewdocs.io/dokku/advanced-installation)).</sup>
- <sup>[2]: If your system has less than 1GB of memory, you can use [this workaround](/dokku/advanced-installation/#vms-with-less-than-1gb-of-memory).</sup>

View File

@@ -3,70 +3,76 @@
Dokku uses nginx as its server for routing requests to specific applications. By default, access and error logs are written for each app to `/var/log/nginx/${APP}-access.log` and `/var/log/nginx/${APP}-error.log` respectively
```
nginx:access-logs <app> [-t] Show the nginx access logs for an application (-t follows)
nginx:build-config <app> (Re)builds nginx config for given app
nginx:disable <app> Disable nginx for an application (forces container binding to external interface)
nginx:enable <app> Enable nginx for an application
nginx:error-logs <app> [-t] Show the nginx error logs for an application (-t follows)
nginx:access-logs <app> [-t] Show the nginx access logs for an application (-t follows)
nginx:build-config <app> (Re)builds nginx config for given app
nginx:error-logs <app> [-t] Show the nginx error logs for an application (-t follows)
```
## Customizing the nginx configuration
> New as of 0.3.10.
> New as of 0.5.0
Dokku currently templates out an nginx configuration that is included in the `nginx-vhosts` plugin. If you'd like to provide a custom template for your application, there are a few options:
Dokku uses a templating library by the name of [sigil](https://github.com/gliderlabs/sigil) to generate nginx configuration for each app. If you'd like to provide a custom template for your application, there are a couple options:
- Copy the existing pertinent (ssl or non-ssl) template found (by default) in `/var/lib/dokku/plugins/available/nginx-vhosts/templates`, place it either in `/home/dokku/APP` or check it into the root of your app repo, and name it one of the following:
- `nginx.conf.template` (since 0.3.10)
- `nginx.conf.ssl_terminated.template` (since 0.4.0)
- `nginx.ssl.conf.template` (since 0.4.2)
> If placed on the dokku server, the template file **must** be owned by user and group `dokku:dokku`.
For instance - assuming defaults - to customize the nginx template in use for the `myapp` application, create the file `nginx.conf.template` in your repo or on disk with the with the following contents:
- Copy the following example template to a file named `nginx.conf.sigil` and either:
- check it into the root of your app repo
- `ADD` it to your dockerfile `WORKDIR`
### Example Custom Template
```
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
access_log /var/log/nginx/${APP}-access.log;
error_log /var/log/nginx/${APP}-error.log;
listen [::]:{{ .NGINX_PORT }};
listen {{ .NGINX_PORT }};
server_name {{ .NOSSL_SERVER_NAME }};
access_log /var/log/nginx/{{ .APP }}-access.log;
error_log /var/log/nginx/{{ .APP }}-error.log;
# set a custom header for requests
add_header X-Served-By www-ec2-01;
location / {
proxy_pass http://$APP;
proxy_pass http://{{ .APP }};
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
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;
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;
upstream {{ .APP }} {
{{ range .DOKKU_APP_LISTENERS | split " " }}
server {{ . }};
{{ end }}
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}
```
The above is a sample http configuration that adds an `X-Served-By` header to requests.
A few tips for custom nginx templates:
- Special characters - dollar signs, spaces inside of quotes, etc. - should be escaped with a single backslash or can cause deploy failures.
- Templated files will be validated via `nginx -t`.
- Application environment variables can be used within your nginx configuration.
After your changes a `dokku deploy myapp` will regenerate the `/home/dokku/myapp/nginx.conf` file which is then used.
### Available template variables
```
{{ .APP }} Application name
{{ .APP_SSL_PATH }} Path to SSL certificate and key
{{ .DOKKU_ROOT }} Global dokku root directory (ex: app dir would be `{{ .DOKKU_ROOT }}/{{ .APP }}`)
{{ .DOKKU_APP_LISTENERS }} List of IP:PORT pairs of app containers
{{ .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
{{ .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
```
### Customizing via configuration files included by the default templates
The default nginx.conf- templates will include everything from your apps `nginx.conf.d/` subdirectory in the main `server {}` block (see above):
The default nginx.conf template will include everything from your apps `nginx.conf.d/` subdirectory in the main `server {}` block (see above):
```
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
```
That means you can put additional configuration in separate files, for example to limit the uploaded body size to 50 megabytes, do
@@ -86,7 +92,9 @@ Applications typically have the following structure for their hostname:
scheme://subdomain.domain.tld
```
The `subdomain` is inferred from the pushed application name, while the `domain` is set during initial configuration in the `$DOKKU_ROOT/VHOST` file.
The `subdomain` is inferred from the pushed application name, while the `domain.tld` is set during initial configuration and stored in the `$DOKKU_ROOT/VHOST` file. It can then be modified with `dokku domains:set-global`. This value is used as a default TLD for all applications on a host.
If a FQDN such as `other.tld` is used as the application name, the default `$DOKKU_ROOT/VHOST` will be ignored and the resulting vhost URL for that application will be `other.tld`. The exception to this rule being that if the FQDN has the same ending as the default vhost (such as `subdomain.domain.tld`), then the entire FQDN will be treated as a subdomain. The application will therefore be deployed at `subdomain.domain.tld.domain.tld`.
You can optionally override this in a plugin by implementing the `nginx-hostname` plugin trigger. For example, you can reverse the subdomain with the following sample `nginx-hostname` plugin trigger:
@@ -104,30 +112,32 @@ If the `nginx-hostname` has no output, the normal hostname algorithm will be exe
You can also use the built-in `domains` plugin to handle:
### Disabling VHOSTS
If desired, it is possible to disable vhosts by setting the environment variable `NO_VHOST=1`:
```shell
dokku config:set myapp NO_VHOST=1
```
On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable. As of 0.4.0, nginx will still be configured to proxy your app on some random high port. This allows internal services to maintain the same port between deployments. You may change this port by setting `DOKKU_NGINX_PORT` and/or `DOKKU_NGINX_SSL_PORT` (for services configured to use SSL.)
### Domains plugin
> New as of 0.3.10
```shell
domains:add <app> DOMAIN Add a custom domain to app
domains <app> List custom domains for app
domains:clear <app> Clear all custom domains for app
domains:remove <app> DOMAIN Remove a custom domain from app
domains:add <app> DOMAIN Add a domain to app
domains [<app>] List domains
domains:clear <app> Clear all domains for app
domains:disable <app> Disable VHOST support
domains:enable <app> Enable VHOST support
domains:remove <app> DOMAIN Remove a domain from app
domains:set-global <domain> Set global domain name
```
The domains plugin allows you to specify custom domains for applications. This plugin is aware of any ssl certificates that are imported via `nginx:import-ssl`. Be aware that setting `NO_VHOST` will override any custom domains.
### Disabling VHOSTS
Custom domains are also backed up via the built-in `backup` plugin
If desired, it is possible to disable vhosts with the domains plugin.
```shell
dokku domains:disable myapp
```
On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable. As of 0.4.0, nginx will still be configured to proxy your app on some random high port. This allows internal services to maintain the same port between deployments. You may change this port by setting `DOKKU_NGINX_PORT` and/or `DOKKU_NGINX_SSL_PORT` (for services configured to use SSL.)
The domains plugin allows you to specify custom domains for applications. This plugin is aware of any ssl certificates that are imported via `certs:add`. Be aware that disabling domains (with `domains:disable`) will override any custom domains.
```shell
# where `myapp` is the name of your app
@@ -145,26 +155,6 @@ dokku domains:clear myapp
dokku domains:remove myapp example.com
```
## Container network interface binding
> New as of 0.3.13
The deployed docker container running your app's web process will bind to either the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`) or an external interface (i.e. 0.0.0.0) depending on dokku's VHOST configuration. Dokku will attempt to bind to the internal docker network interface unless you specifically set NO_VHOST for the given app or your dokku installation is not setup to use VHOSTS (i.e. $DOKKU_ROOT/VHOST is missing or $DOKKU_ROOT/HOSTNAME is set to an IPv4 or IPv6 address)
```shell
# container bound to docker interface
root@dokku:~/dokku# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute goofy_albattani
root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' goofy_albattani
172.17.0.6
# container bound to all interfaces (previous default)
root@dokku:/home/dokku# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp nostalgic_tesla
```
## Default site
@@ -207,3 +197,7 @@ See the [HSTS documentation](/dokku/deployment/ssl-configuration/#hsts-header).
## SSL Configuration
See the [ssl documentation](/dokku/deployment/ssl-configuration/).
## Disabling Nginx
See the [proxy documentation](/dokku/deployment/proxy/).

View File

@@ -26,7 +26,7 @@ dokku plugins-install
## Creating your own plugin
[See the full documentation](http://dokku.viewdocs.io/dokku/development/plugin-creation).
[See the full documentation](/dokku/development/plugin-creation).
## Official Plugins (Beta)
@@ -66,6 +66,7 @@ Note: The following plugins have been supplied by our community and may not have
[Aomitayo]: https://github.com/Aomitayo
[apmorton]: https://github.com/apmorton
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell
[basgys]: https://github.com/basgys
[blag]: https://github.com/blag
[cameron-martin]: https://github.com/cameron-martin
[cedricziel]: https://github.com/cedricziel
@@ -81,6 +82,7 @@ Note: The following plugins have been supplied by our community and may not have
[gdi2290]: https://github.com/gdi2290
[heichblatt]: https://github.com/heichblatt
[hughfletcher]: https://github.com/hughfletcher
[iamale]: https://github.com/iamale
[ignlg]: https://github.com/ignlg
[iskandar]: https://github.com/iskandar
[jagandecapri]: https://github.com/jagandecapri
@@ -152,6 +154,7 @@ Note: The following plugins have been supplied by our community and may not have
| 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 |
[dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709
@@ -219,6 +222,7 @@ Note: The following plugins have been supplied by our community and may not have
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski] | <0.4.0 |
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-grafana) | [jlachowski] | 0.4.0+, graphite & statsd plugin with grafana dashboard frontend |
| [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | 0.3.26+ |
| [Monorepo](https://github.com/iamale/dokku-monorepo) | [iamale][] | 0.4.0+ |
| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | |
| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | |
| [Reset mtime](https://github.com/mixxorz/dokku-docker-reset-mtime) | [mixxorz][] | 0.3.15+, Dockerfile support |

30
docs/proxy.md Normal file
View File

@@ -0,0 +1,30 @@
# 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.
```
proxy:disable <app> Disable proxy for app
proxy:enable <app> Enable proxy for app
proxy:set <app> <proxy_type> NOT IMPLEMENTED YET!!
```
## 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.
```shell
# container bound to docker interface
root@dokku:~/dokku# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute node-js-app.web.1
root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
172.17.0.6
# container bound to all interfaces
root@dokku:/home/dokku# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1
```

View File

@@ -10,34 +10,49 @@
<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.4.14/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.5.2/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.4.14/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.5.2/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.5.2/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/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.4.14/docs/assets/style.css" rel="stylesheet">
<script>
if ('{{DOC}}' == 'index.md') {
var indexLink = '/{{NAME}}/';
if ('{{REF}}' !== 'master') {
indexLink = '/{{NAME}}~{{REF}}/';
}
window.location.replace(window.location.origin + indexLink);
}
</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.2/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>
</style>
</head>
<body>
<div class="dev-warning doc-floating-warning" style="display:none">
This document is for dokku's development version, which can be significantly different from previous releases. For older releases, use the version selector floating in the bottom right corner of this page.
</div>
<div class="header">
<div class="container-fluid">
<div class="row">
@@ -45,6 +60,20 @@
<h1 class="heading navbar-brand">
<a href="http://dokku.viewdocs.io/dokku/">Dokku</a>
</h1>
<ul class="nav nav-pills pull-xs-right col-md-offset-right-2">
<li class="nav-item">
<a class="nav-link" href="https://github.com/dokku/dokku/">Code</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/{{NAME}}/installation/">Docs</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://webchat.freenode.net/?channels=dokku">IRC</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://glider-slackin.herokuapp.com/">Slack</a>
</li>
</ul>
</div>
</div>
</div>
@@ -59,7 +88,7 @@
<div class="list-group">
<a href="#" class="list-group-item disabled">Getting Started</a>
<a href="/dokku/installation/" class="list-group-item">Getting Started with Dokku</a>
<a href="/dokku/upgrading/" class="list-group-item">Upgrading</a>
<a href="/dokku/upgrading/" class="list-group-item">Upgrading Dokku</a>
<a href="/dokku/troubleshooting/" class="list-group-item">Troubleshooting</a>
<a href="/dokku/getting-started/where-to-get-help/" class="list-group-item">Getting Help</a>
@@ -70,9 +99,10 @@
<a href="/dokku/deployment/dockerfiles/" class="list-group-item">Dockerfile Deployment</a>
<a href="/dokku/deployment/images/" class="list-group-item">Image Tagging</a>
<a href="/dokku/remote-commands/" class="list-group-item">Remote Commands</a>
<a href="/dokku/deployment/one-off-processes/" class="list-group-item">One Off Processes</a>
<a href="/dokku/deployment/one-off-processes/" class="list-group-item">One Off Processes/Cron</a>
<a href="/dokku/process-management/" class="list-group-item">Scaling Apps</a>
<a href="/dokku/checks-examples/" class="list-group-item">Zero Downtime Deploys</a>
<a href="/dokku/deployment/user-management/" class="list-group-item">User Management</a>
<a href="/dokku/checks-examples/" class="list-group-item">Zero Downtime Deploy Checks</a>
<a href="#" class="list-group-item disabled">Configuration</a>
@@ -80,9 +110,16 @@
<a href="/dokku/dns" class="list-group-item">DNS Configuration</a>
<a href="/dokku/nginx/" class="list-group-item">Nginx Configuration</a>
<a href="/dokku/deployment/ssl-configuration/" class="list-group-item">SSL Configuration</a>
<a href="/dokku/docker-options/" class="list-group-item">Docker Container Options</a>
<a href="/dokku/dokku-events-logs/" class="list-group-item">Dokku Event Logs</a>
<a href="#" class="list-group-item disabled">Advanced Usage</a>
<a href="/dokku/backup-recovery/" class="list-group-item">Backup and Recovery</a>
<a href="/dokku/deployment/deployment-tasks/" class="list-group-item">Deployment Tasks</a>
<a href="/dokku/docker-options/" class="list-group-item">Docker Container Options</a>
<a href="/dokku/dokku-storage/" class="list-group-item">Persistent Storage</a>
<a href="/dokku/proxy/" class="list-group-item">Proxy Management</a>
<a href="#" class="list-group-item disabled">Community Contributions</a>
<a href="/dokku/community/clients/" class="list-group-item">Clients</a>
@@ -99,9 +136,39 @@
</div>
</div>
<div class="rst-versions rst-badge" data-toggle="rst-versions">
<span class="rst-current-version" data-toggle="rst-current-version" data-doc="{{DOC}}" data-ref="{{REF}}">
<span class="fa fa-book">&nbsp;</span>
v: {{REF}}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
<dt>Versions</dt>
</dl>
<dl>
<dt>On GitHub</dt>
<dd>
<a href="https://github.com/{{USER}}/{{NAME}}/blob/master/docs/{{DOC}}" target="_blank">View</a>
</dd>
<dd>
<a href="https://github.com/{{USER}}/{{NAME}}/edit/master/docs/{{DOC}}" target="_blank">Edit</a>
</dd>
</dl>
<hr>
Free document hosting provided by <a href="http://progrium.viewdocs.io/viewdocs/">Viewdocs</a>.
</div>
</div>
<div class="dev-warning doc-floating-warning" style="display:none">
This document is for dokku's development version, which can be significantly different from previous releases. For older releases, use the version selector floating in the bottom right corner of this page.
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/1.3.0/anchor.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function (e) {
document.addEventListener('DOMContentLoaded', function (e) {
var markdownBody = document.querySelectorAll('.markdown-body')[0],
isRedirect = markdownBody.innerHTML.trim().indexOf('<p>See the <a href=') === 0;
if (isRedirect) {
@@ -113,18 +180,65 @@
var tables = document.querySelectorAll('table'),
blockquotes = document.querySelectorAll('blockquote'),
versionList = document.querySelectorAll('.rst-other-versions dl')[0],
currentVersionEl = document.querySelectorAll('.rst-current-version')[0],
currentVersion = currentVersionEl.getAttribute('data-ref'),
versionContainer = document.querySelectorAll('.rst-versions.rst-badge')[0],
classNames = ['table', 'table-striped', 'table-hover', 'table-condensed'],
localPath = location.pathname.split('/').splice(2).join("/"),
addClass = function (el, className) {
if (el.classList) {
el.classList.add(className);
} else {
el.className += ' ' + className;
}
}
},
addListener = function (elem, type, fn) {
if (elem.addEventListener) {
elem.addEventListener(type, fn, false);
} else if (elem.attachEvent) {
elem.attachEvent("on" + type, function() {
return fn.call(elem, window.event);
});
} else {
elem["on" + type] = fn;
}
},
hasClass = function(el, className) {
if (el.classList) {
return el.classList.contains(className);
} else {
return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
}
},
removeClass = function(el, className) {
if (el.classList) {
el.classList.remove(className);
} else {
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');;
}
};
var ls2 = {
save : function(key, jsonData, expirationMS) {
if (typeof (Storage) == "undefined") { return false; }
var record = {value: JSON.stringify(jsonData), timestamp: new Date().getTime()/1000 + expirationMS}
localStorage.setItem(key, JSON.stringify(record));
return jsonData;
},
load : function(key) {
if (typeof (Storage) == "undefined") { return false; }
var record = JSON.parse(localStorage.getItem(key));
if (!record){return false;}
return (new Date().getTime()/1000 < record.timestamp && JSON.parse(record.value));
}
};
Array.prototype.forEach.call(blockquotes, function (el, i) {
if (el.innerHTML.indexOf('New as of') !== -1) {
if (el.innerHTML.toLowerCase().indexOf('new as of') !== -1) {
addClass(el, 'new-as-of');
} else if (el.innerHTML.toLowerCase().indexOf('not yet released') !== -1) {
addClass(el, 'not-yet-released');
}
});
Array.prototype.forEach.call(classNames, function (className, i) {
@@ -132,6 +246,102 @@
addClass(el, className);
});
});
addListener(currentVersionEl, 'click', function() {
if (hasClass(versionContainer, 'shift-up')) {
removeClass(versionContainer, 'shift-up');
} else {
addClass(versionContainer, 'shift-up');
}
});
var range = function(start, count) {
return Array.apply(0, Array(count))
.map(function (element, index) {
return index + start;
});
}
var parseVersions = function(version, versions) {
var pieces = version.split('.'),
prefix = pieces.slice(0, 2).join('.') + '.',
maxPatchVersion = parseInt(pieces.slice(2, 3)[0], 10),
versionRange = range(0, maxPatchVersion + 1);
for (var i in versionRange) {
versions.push(prefix.concat(versionRange[i]));
}
return versions;
}
var addVersionLink = function(version) {
var a = document.createElement('a'),
dd = document.createElement('dd'),
ref = 'dokku~v' + version,
versionName = 'v' + version;
if (version == 'master') {
ref = 'dokku';
versionName = 'master';
}
a.setAttribute('href', "/" + ref + "/" + localPath);
a.appendChild(document.createTextNode(versionName));
if (versionName == currentVersion) {
var strong = document.createElement('strong');
strong.appendChild(a);
dd.appendChild(strong);
} else {
dd.appendChild(a);
}
versionList.appendChild(dd);
};
var processVersions = function(data) {
var versions = [];
for (var key in data['max-versions']) {
if (!data['max-versions'].hasOwnProperty(key)) {
continue;
}
versions = parseVersions(data['max-versions'][key], versions);
}
addVersionLink('master');
Array.prototype.forEach.call(versions, function (version, i) {
addVersionLink(version);
});
};
if (currentVersion === 'master') {
document.querySelectorAll('.dev-warning')[0].style.position = 'relative';
Array.prototype.forEach.call(document.querySelectorAll('.dev-warning'), function (el, i) {
el.style.display = '';
});
}
data = ls2.load('max-versions');
if (!data) {
var request = new XMLHttpRequest();
request.open('GET', '/dokku/assets/versions.json', true);
request.setRequestHeader("Cache-Control", "no-cache, no-store");
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
var data = JSON.parse(request.responseText);
// store for 1 day
ls2.save('max-versions', data, 86400);
processVersions(data);
}
};
request.onerror = function() {
// There was a connection error of some sort
};
request.send();
} else {
processVersions(data);
}
});
</script>
</body>

View File

@@ -1,10 +1,16 @@
# Upgrading
This document covers upgrades for the 0.3.0 series and up. If upgrading from older versions, we recommend [a fresh install](http://dokku.viewdocs.io/dokku/installation) on a new server.
This document covers upgrades for the 0.3.0 series and up. If upgrading from older versions, we recommend [a fresh install](/dokku/installation) on a new server.
> As of 0.3.18, dokku is installed by default via a debian package. Source-based installations are still available, though not recommended.
## Dokku
## Migration Guides
Migration guides contain information regarding the new features introduced in each version and the migration path between versions.
- [0.5 Migration Guide](/dokku/appendices/0.5.0-migration-guide/)
## General Information
If dokku was installed via a debian package, you can upgrade dokku via the following command:
@@ -37,7 +43,7 @@ All changes will take effect upon next application deployment. To trigger a rebu
dokku ps:rebuildall
```
## Herokuish image
### Herokuish image
If dokku was installed via a debian package, you can upgrade herokuish via the following command:

303
dokku
View File

@@ -2,7 +2,15 @@
set -eo pipefail
shopt -s nullglob
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
[[ -f $DOKKU_ROOT/dokkurc ]] && source "$DOKKU_ROOT/dokkurc"
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source "$f"; done
[[ $DOKKU_TRACE ]] && set -x
case "$(lsb_release -si)" in
Arch)
export DOKKU_DISTRO=${DOKKU_DISTRO:="arch"}
;;
Debian)
export DOKKU_DISTRO=${DOKKU_DISTRO:="debian"}
;;
@@ -12,7 +20,6 @@ case "$(lsb_release -si)" in
esac
export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"}
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"}
export PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"}
@@ -34,16 +41,13 @@ export DOKKU_GLOBAL_RUN_ARGS="--label=$DOKKU_CONTAINER_LABEL"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done
[[ $DOKKU_TRACE ]] && set -x
parse_args "$@"
args=("$@")
if [[ "${args[0]}" =~ ^--.* ]]; then
for arg in "$@"; do
if [[ "$arg" =~ ^--.* ]]; then
if [[ "$arg" == "--app" ]]; then
shift 2
elif [[ "$arg" =~ ^--.* ]]; then
shift 1
else
break
@@ -54,21 +58,23 @@ fi
if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]]; then
export SSH_USER=$(id -un)
sudo -u dokku -E -H $0 "$@"
sudo -u dokku -E -H "$0" "$@"
exit $?
fi
if [[ $(id -un) != "root" && $1 =~ plugin:.* ]]; then
if [[ $(id -un) != "root" && $1 =~ ^plugin:.* ]]; then
dokku_log_fail "plugin:* commands must be run as root"
fi
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
export -n SSH_ORIGINAL_COMMAND
if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]]; then
# shellcheck disable=SC2086
xargs $0 <<<$SSH_ORIGINAL_COMMAND
exit $?
else
set -f
# shellcheck disable=SC2086
$0 $SSH_ORIGINAL_COMMAND
set +f
exit $?
@@ -80,200 +86,129 @@ if ! dokku_auth "$@" ; then
exit 1
fi
case "$1" in
receive)
APP="$2"; IMAGE=$(get_app_image_name $APP); IMAGE_SOURCE_TYPE="$3"; 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..."
dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
release_and_deploy "$APP"
;;
execute_dokku_cmd() {
declare desc="executes dokku sub-commands"
local PLUGIN_NAME="$1"
local PLUGIN_CMD=$PLUGIN_NAME
local implemented=0; local script
local argv=("$@")
deploy)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy"
APP="$2"; IMAGE_TAG="$3"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
plugn trigger pre-deploy $APP $IMAGE_TAG
case "$PLUGIN_NAME" in
events|events:*)
local PLUGIN_NAME=${PLUGIN_NAME/events/20_events}
;;
nginx|nginx:*)
local PLUGIN_NAME=${PLUGIN_NAME/nginx/nginx-vhosts}
;;
receive|deploy|build|release)
local PLUGIN_NAME="00_dokku-standard"
;;
trace|delete|ls|run|cleanup)
local PLUGIN_NAME="00_dokku-standard"
;;
url|urls|report|version)
local PLUGIN_NAME="00_dokku-standard"
;;
esac
is_image_herokuish_based "$IMAGE" && DOKKU_HEROKUISH=true
DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
oldids=$(get_app_container_ids $APP)
DOKKU_APP_SKIP_ALL_CHECKS=$(dokku config:get $APP DOKKU_SKIP_ALL_CHECKS || true)
DOKKU_APP_SKIP_DEFAULT_CHECKS=$(dokku config:get $APP DOKKU_SKIP_DEFAULT_CHECKS || true)
DOKKU_GLOBAL_SKIP_ALL_CHECKS=$(dokku config:get --global DOKKU_SKIP_ALL_CHECKS || true)
DOKKU_GLOBAL_SKIP_DEFAULT_CHECKS=$(dokku config:get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
DOKKU_SKIP_ALL_CHECKS=${DOKKU_APP_SKIP_ALL_CHECKS:="$DOKKU_GLOBAL_SKIP_ALL_CHECKS"}
DOKKU_SKIP_DEFAULT_CHECKS=${DOKKU_APP_SKIP_DEFAULT_CHECKS:="$DOKKU_GLOBAL_SKIP_DEFAULT_CHECKS"}
DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy $APP $IMAGE_TAG)
while read -r line || [[ -n "$line" ]]; do
[[ "$line" =~ ^#.* ]] && continue
TRIM=${line%#*}
PROC_TYPE=${TRIM%%=*}
PROC_COUNT=${TRIM#*=}
CONTAINER_INDEX=1
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
id=""; port=""; ipaddr=""
DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
# start the app
DOCKER_ARGS="$DOKKU_DEFAULT_DOCKER_ARGS"
DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' "
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
BIND_EXTERNAL=$(plugn trigger bind-external-ip $APP)
[[ -n "$DOKKU_HEROKUISH" ]] && START_CMD="/start $PROC_TYPE"
if [[ -z "$DOKKU_HEROKUISH" ]]; then
DOKKU_DOCKERFILE_PORT=$(dokku config:get $APP DOKKU_DOCKERFILE_PORT || true)
START_CMD=$(dokku config:get $APP DOKKU_DOCKERFILE_START_CMD || $START_CMD)
fi
if [[ "$PROC_TYPE" == "web" ]]; then
port=${DOKKU_DOCKERFILE_PORT:=5000}
if [[ "$BIND_EXTERNAL" = "true" ]]; then
id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -p $port -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
port=$(docker port $id $port | sed 's/[0-9.]*://')
ipaddr=127.0.0.1
else
id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $id)
# Docker < 1.9 compatibility
if [[ -z $ipaddr ]]; then
ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id)
fi
fi
else
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() {
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 [[ "$DOKKU_SKIP_ALL_CHECKS" = "true" ]]; then
dokku_log_info1 "Skipping pre-flight checks"
else
trap kill_new 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"
[[ -n "$port" ]] && echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
# cleanup pre-migration files
rm -f $DOKKU_ROOT/$APP/CONTAINER $DOKKU_ROOT/$APP/IP $DOKKU_ROOT/$APP/PORT
CONTAINER_INDEX=$(( CONTAINER_INDEX + 1 ))
done
# cleanup when we scale down
if [[ "$PROC_COUNT" == 0 ]]; then
CONTAINER_IDX_OFFSET=0
if [[ "$(readlink -f "$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}")" == *core-plugins* ]] ; then
[[ ${argv[0]} == "$PLUGIN_CMD" ]] && shift 1
if [[ ! -z $DOKKU_APP_NAME ]]; then
if [[ "$PLUGIN_CMD" == config* ]] && [[ ${argv[1]} == "--no-restart" ]]; then
shift 1
set -- "--no-restart" "$DOKKU_APP_NAME" "$@"
else
CONTAINER_IDX_OFFSET=$((PROC_COUNT + 1))
set -- "$DOKKU_APP_NAME" "$@"
fi
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
# kill the old container
if [[ -n "$oldids" ]]; then
if [[ -z "$DOKKU_WAIT_TO_RETIRE" ]]; then
DOKKU_APP_DOKKU_WAIT_TO_RETIRE=$(dokku config:get $APP DOKKU_WAIT_TO_RETIRE || true)
DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE=$(dokku config:get --global DOKKU_WAIT_TO_RETIRE || true)
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
WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
for oldid in $oldids; do
dokku_log_info2 "$oldid"
done
(
exec >/dev/null 2>/dev/null </dev/null
trap '' INT HUP
sleep $WAIT
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.
docker stop $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
;;
set -- "$PLUGIN_CMD" "$@"
fi
cleanup)
docker_cleanup
;;
if [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default ]]; then
"$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/default" "$@"
implemented=1
elif [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD ]]; then
"$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD" "$@"
implemented=1
elif [[ -x $PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:} ]]; then
"$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:}" "$@"
implemented=1
fi
# DEPRECATED as of v0.3.14
deploy:all)
echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions"
dokku ps:restartall
;;
help|'')
echo "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND <app> [command-specific-options]"
echo ""
echo "Options:"
cat<<EOF | plugn trigger commands help | sort | column -c2 -t -s,
help, Print the list of commands
EOF
;;
*)
implemented=0
if [[ $implemented -eq 0 ]];then
for script in $PLUGIN_ENABLED_PATH/*/commands; do
set +e; $script "$@" ; exit_code=$? ; set -e
if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then
continue
fi
implemented=1
if [[ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]]; then
exit $exit_code
fi
done
fi
if [[ "$implemented" -eq 0 ]]; then
dokku_log_warn "\`$*\` is not a dokku command."
dokku_log_warn "See \`dokku help\` for a list of available commands."
exit 1
if [[ "$implemented" -eq 0 ]]; then
dokku_log_warn "\`$*\` is not a dokku command."
dokku_log_warn "See \`dokku help\` for a list of available commands."
exit 1
fi
}
case "$1" in
help|'')
export LC_ALL=C # so sort will respect non alpha characters
ALL_PLUGIN_COMMANDS=$(find -L "$PLUGIN_PATH/enabled" -name commands 2> /dev/null || true)
# build list of core plugin command files
for plugin_command in $ALL_PLUGIN_COMMANDS;do
if [[ "$(readlink -f "$plugin_command")" == *core-plugins* ]]; then
CORE_PLUGIN_COMMANDS+="$plugin_command "
fi
done
# build list of non-core plugin command files
for plugin_command in $ALL_PLUGIN_COMMANDS;do
if [[ "$(readlink -f "$plugin_command")" != *core-plugins* ]]; then
COMMUNITY_PLUGIN_COMMANDS+="$plugin_command "
fi
done
# New lines are blank echos for readability
echo "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND <app> [command-specific-options]"
echo ""
echo "Primary help options, type \"dokku COMMAND:help\" for more details, or dokku help --all to see all commands."
echo ""
echo "Commands:"
echo ""
if [[ "$2" == "--all" ]] ; then
for core_plugin_command in $CORE_PLUGIN_COMMANDS; do
$core_plugin_command help
done | sort | column -c2 -t -s,
echo ""
echo "Community plugin commands:"
echo ""
for community_plugin_command in $COMMUNITY_PLUGIN_COMMANDS; do
$community_plugin_command help
done | sort | column -c2 -t -s,
else
for core_plugin_command in $CORE_PLUGIN_COMMANDS; do
$core_plugin_command help
# When done, sort, sed cuts arugments out of strings and colum make it pretty
done | sort | sed -e '/^.*:/d' -e 's/\s[\[\<\-\(].*,/,/' | column -c2 -t -s,
if [[ -n "$COMMUNITY_PLUGIN_COMMANDS" ]]; then
echo ""
echo "Community plugin commands:"
echo ""
for community_plugin_command in $COMMUNITY_PLUGIN_COMMANDS; do
$community_plugin_command help
done | sort | column -c2 -t -s,
fi
fi
;;
*)
execute_dokku_cmd "$@"
;;
esac

View File

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

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
VERSION="$1"
BASE_DIR="$2"
cat;
[[ -f $BASE_DIR/.sshcommand ]] && echo "$BASE_DIR/.sshcommand"
[[ -f $BASE_DIR/.ssh/authorized_keys ]] && echo "$BASE_DIR/.ssh/authorized_keys"
[[ -f $BASE_DIR/HOSTNAME ]] && echo "$BASE_DIR/HOSTNAME"
[[ -f $BASE_DIR/VHOST ]] && echo "$BASE_DIR/VHOST"

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
VERSION="$1"
IMPORT_DIR="$2"
TARGET_DIR="$3"
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
mkdir -p $TARGET_DIR/.ssh
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > tmpfile && mv tmpfile $TARGET_DIR/.ssh/authorized_keys
chmod 0700 $TARGET_DIR/.ssh
chmod 0600 $TARGET_DIR/.ssh/*
fi
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME
[[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST

View File

@@ -1,230 +1,32 @@
#!/usr/bin/env bash
[[ " build release trace delete ls run url urls report version help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
[[ " help help:help ls:help run:help trace:help url:help urls:help version:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
case "$1" in
build)
APP="$2"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"; IMAGE=$(get_app_image_name $APP)
verify_app_name "$APP"
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
eval "$(config_export app $APP)"
pushd "$TMP_WORK_DIR" &> /dev/null
case "$IMAGE_SOURCE_TYPE" in
herokuish)
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"
DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP $IMAGE_SOURCE_TYPE)
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
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
DOCKERFILE_PORT=$(get_dockerfile_exposed_port Dockerfile)
[[ -n "$DOCKERFILE_PORT" ]] && config_set --no-restart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
plugn trigger pre-build-dockerfile "$APP"
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP $IMAGE_SOURCE_TYPE)
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
;;
release)
APP="$2"; IMAGE_SOURCE_TYPE="$3"; IMAGE_TAG="$4"; 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
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
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
;;
trace)
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p $DOKKU_ROOT/.dokkurc
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
dokku_log_fail "Valid trace options are [on/off]"
}
if [[ "$2" == "on" ]]; then
echo "Enabling dokku trace"
echo "export DOKKU_TRACE=1" > $DOKKU_ROOT/.dokkurc/DOKKU_TRACE
fi
if [[ "$2" == "off" ]]; then
echo "Disabling dokku trace"
rm -f $DOKKU_ROOT/.dokkurc/DOKKU_TRACE
fi
;;
delete)
dokku apps:destroy $2
;;
ls)
installed_apps=$(dokku_apps)
dokku_col_log_info1_quiet "App Name" "Container Type" "Container Id" "Status"
for dokku_app in $installed_apps; do
APP=$(basename $dokku_app)
DOKKU_APP_CIDS=$(get_app_container_ids $APP)
DOCKER_RUNNING_CONTAINERS=$(docker ps -q --no-trunc)
if [[ -n $DOKKU_APP_CIDS ]]; then
for DOKKU_APP_CID in $DOKKU_APP_CIDS; do
DOKKU_APP_CONTAINER_STATUS="stopped"
[[ $DOCKER_RUNNING_CONTAINERS =~ $DOKKU_APP_CID ]] && DOKKU_APP_CONTAINER_STATUS="running"
DOKKU_APP_CONTAINER_TYPE=$(grep -l $DOKKU_APP_CID $DOKKU_ROOT/$APP/CONTAINER.* | awk -F '/' '{ print $5 }' | awk -F '.' '{ print $2 }')
dokku_col_log_msg "$APP" "$DOKKU_APP_CONTAINER_TYPE" "${DOKKU_APP_CID:0:12}" "$DOKKU_APP_CONTAINER_STATUS"
done
else
dokku_col_log_msg "$APP" "NOT_DEPLOYED" "NOT_DEPLOYED" "NOT_DEPLOYED"
fi
done
;;
run)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP); IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
shift 2
if [[ -z "$DOKKU_RM_CONTAINER" ]]; then
DOKKU_APP_RM_CONTAINER=$(dokku config:get $APP DOKKU_RM_CONTAINER || true)
DOKKU_GLOBAL_RM_CONTAINER=$(dokku config:get --global DOKKU_RM_CONTAINER || true)
DOKKU_RM_CONTAINER=${DOKKU_APP_RM_CONTAINER:="$DOKKU_GLOBAL_RM_CONTAINER"}
fi
DOCKER_ARGS=$(: | plugn trigger docker-args-run $APP $IMAGE_TAG)
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
[[ "$DOKKU_RM_CONTAINER" ]] && DOKKU_RUN_OPTS="--rm"
has_tty && DOKKU_RUN_OPTS+=" -i -t"
is_image_herokuish_based "$IMAGE" && EXEC_CMD="/exec"
docker run $DOKKU_GLOBAL_RUN_ARGS $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
;;
url | urls)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
APP="$2"; verify_app_name "$2"
eval "$(config_export app $APP)"
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then
case "$1" in
url)
grep "^http" "$DOKKU_ROOT/$APP/URLS" | head -1
;;
urls)
grep "^http" "$DOKKU_ROOT/$APP/URLS"
;;
esac
exit 0
fi
SCHEME="http"; SSL="$DOKKU_ROOT/$APP/tls"; WILDCARD_SSL="$DOKKU_ROOT/tls"
if [[ -e "$SSL/server.crt" && -e "$SSL/server.key" ]] || [[ -e "$WILDCARD_SSL/server.crt" && -e "$WILDCARD_SSL/server.key" ]]; then
SCHEME="https"
fi
if [[ "$(is_app_vhost_enabled $APP)" == "false" ]]; then
shopt -s nullglob
for PORT_FILE in $DOKKU_ROOT/$APP/PORT.*; do
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$PORT_FILE") (container)"
done
shopt -u nullglob
DOKKU_NGINX_PORT=$(config_get $APP DOKKU_NGINX_PORT || true)
DOKKU_NGINX_SSL_PORT=$(config_get $APP DOKKU_NGINX_SSL_PORT || true)
if [[ -n "$DOKKU_NGINX_PORT" ]]; then
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_PORT (nginx)"
fi
if [[ -n "$DOKKU_NGINX_SSL_PORT" ]]; then
echo "https://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_SSL_PORT (nginx-ssl)"
fi
else
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
fi
;;
report)
dokku_log_info1 "uname: $(uname -a)"
dokku_log_info1 "memory: "
free -m
dokku_log_info1 "docker version: "
docker version
dokku_log_info1 "docker daemon info: "
docker -D info
dokku_log_info1 "herokuish version: "
docker run --rm -ti gliderlabs/herokuish:latest herokuish version
dokku_log_info1 "dokku version: $(dokku version)"
dokku_log_info1 "dokku plugins: "
dokku plugin
;;
version)
cat "$DOKKU_ROOT/VERSION" || dokku_log_fail "Unable to determine dokku's version"
;;
help)
cat<<EOF
ls, Pretty listing of deployed applications and containers
help|ls:help|run:help|trace:help|url:help|urls:help|version:help)
[[ $(echo "$1" | sed '/.*:help/!d') ]] && help_topic="${1%\:help}"
help_content_func () {
declare desc="return standard plugin help content"
cat<<help_content
ls , Pretty listing of deployed applications and containers
run <app> <cmd>, Run a command in the environment of an application
trace [on/off], Enable dokku tracing
url <app>, Show the first URL for an application (compatibility)
urls <app>, Show all URLs for an application
version, Print dokku's version
EOF
version , Print dokku's version
help , Print the list of commands
help_content
}
if [[ $help_topic ]] ; then
help_content_func | sed "/^\s*$help_topic\s/!d" | sort | sed '/^.*:/d' | column -c2 -t -s,
else
help_content_func
fi
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

View File

@@ -0,0 +1,73 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
get_phase_script() {
declare desc="extracts app.json from app image and returns the appropriate json key/value"
local IMAGE="$1"; local PHASE_SCRIPT_KEY="$2"
local TMP_WORK_DIR=$(mktemp -d -t "dokku_get_phase_script.XXXX")
local APP_JSON_FILE="$TMP_WORK_DIR/app.json"
trap 'rm -rf "$TMP_WORK_DIR" > /dev/null' RETURN INT TERM
copy_from_image "$IMAGE" "/app/app.json" "$TMP_WORK_DIR" 2>/dev/null || true
if [[ -f "$APP_JSON_FILE" ]];then
local VALUE=$(get_json_value "scripts.dokku.${PHASE_SCRIPT_KEY}" < "$APP_JSON_FILE")
else
return 0
fi
echo "$VALUE"
}
execute_script() {
declare desc="executes appropriate phase script key from app.json"
local APP="$1"; local IMAGE="$2"; 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"
local COMMAND="export HOME=/app ; "
local COMMAND+=" cd \$HOME ; "
local COMMAND+=" for file in /app/.profile.d/*; do source \$file; done ; "
local COMMAND+=" echo restoring installation cache... ; "
local COMMAND+=" rm -rf /tmp/cache || true ; "
local COMMAND+=" ln -sf /cache /tmp/cache || true ; "
local COMMAND+=" $SCRIPT_CMD ; RC=\$? ;"
local COMMAND+=" echo removing installation cache... ; "
local COMMAND+=" rm -f /tmp/cache || true ; "
local COMMAND+=" exit \$RC "
local DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP")
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
# shellcheck disable=SC2086
local id=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_DIR:/cache" $DOCKER_ARGS "$IMAGE" /bin/bash -c "$COMMAND")
test "$(docker wait "$id")" -eq 0 || (dokku_container_log_verbose_quiet "$id"; exit 1)
dokku_container_log_verbose_quiet "$id"
if [[ "$PHASE_SCRIPT_KEY" != "postdeploy" ]];then
docker commit "$id" "$IMAGE" > /dev/null
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

@@ -2,13 +2,15 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
hostname -f > $DOKKU_ROOT/HOSTNAME
hostname -f > "$DOKKU_ROOT/HOSTNAME"
fi
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
fi
dokku_path=$(which dokku)
# temporary hack for https://github.com/dokku/dokku/issues/82
# redeploys all apps after a reboot
if [[ $(/sbin/init --version 2> /dev/null) =~ upstart ]]; then
@@ -19,7 +21,7 @@ start on filesystem and started docker
script
sleep 2 # give docker some time
sudo -i -u dokku /usr/local/bin/dokku ps:restore
sudo -i -u dokku $dokku_path ps:restore
end script
EOF
fi
@@ -33,7 +35,7 @@ After=docker.target
[Service]
Type=simple
User=dokku
ExecStart=/usr/local/bin/dokku ps:restore
ExecStart=$dokku_path ps:restore
[Install]
WantedBy=multi-user.target
@@ -57,3 +59,9 @@ if [ ! -f "/home/dokku/HOSTNAME" ]; then
fi
EOF
chmod +x /etc/update-motd.d/99-dokku
chown dokku:dokku "$DOKKU_ROOT/HOSTNAME"
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
chown dokku:dokku "$DOKKU_ROOT/VHOST"
fi

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,56 @@
#!/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"
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

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku_cleanup_cmd(){
declare desc="cleans up old deployment cruft"
local cmd="cleanup"
docker_cleanup
}
dokku_cleanup_cmd "$@"

View File

@@ -0,0 +1,166 @@
#!/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
while read -r line || [[ -n "$line" ]]; do
[[ "$line" =~ ^#.* ]] && continue
local TRIM=${line%#*}
local PROC_TYPE=${TRIM%%=*}
local PROC_COUNT=${TRIM#*=}
local 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_PORT=$(config_get "$APP" DOKKU_DOCKERFILE_PORT || 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
(
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.
docker stop "$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
}
dokku_deploy_cmd "$@"

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku_ls_cmd() {
declare desc="lists installed apps with status"
local cmd="ls"
local installed_apps=$(dokku_apps)
local dokku_app
dokku_col_log_info1_quiet "App Name" "Container Type" "Container Id" "Status"
for dokku_app in $installed_apps; do
local APP=$(basename "$dokku_app")
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
local DOCKER_RUNNING_CONTAINERS=$(docker ps -q --no-trunc)
if [[ -n $DOKKU_APP_CIDS ]]; then
local DOKKU_APP_CID
for DOKKU_APP_CID in $DOKKU_APP_CIDS; do
local DOKKU_APP_CONTAINER_STATUS="stopped"
[[ $DOCKER_RUNNING_CONTAINERS =~ $DOKKU_APP_CID ]] && local DOKKU_APP_CONTAINER_STATUS="running"
local DOKKU_APP_CONTAINER_TYPE=$(grep -l "$DOKKU_APP_CID" "$DOKKU_ROOT/$APP"/CONTAINER.* | awk -F '/' '{ print $5 }' | awk -F '.' '{ print $2 }')
dokku_col_log_msg "$APP" "$DOKKU_APP_CONTAINER_TYPE" "${DOKKU_APP_CID:0:12}" "$DOKKU_APP_CONTAINER_STATUS"
done
else
dokku_col_log_msg "$APP" "NOT_DEPLOYED" "NOT_DEPLOYED" "NOT_DEPLOYED"
fi
done
}
dokku_ls_cmd "$@"

View File

@@ -0,0 +1,22 @@
#!/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

@@ -0,0 +1,40 @@
#!/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

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku_report_cmd() {
declare desc="reports dokku vitals for troubleshooting"
local cmd="report"
dokku_log_info1 "uname: $(uname -a)"
dokku_log_info1 "memory: "
free -m
dokku_log_info1 "docker version: "
docker version
dokku_log_info1 "docker daemon info: "
docker -D info
dokku_log_info1 "sigil version: $(sigil -v)"
dokku_log_info1 "herokuish version: "
docker run --rm -ti gliderlabs/herokuish:latest herokuish version
dokku_log_info1 "dokku version: $(dokku version)"
dokku_log_info1 "dokku plugins: "
dokku plugin
}
dokku_report_cmd "$@"

View File

@@ -0,0 +1,30 @@
#!/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_run_cmd() {
declare desc="runs command in container based on app image"
local cmd="run"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"; local IMAGE_TAG=$(get_running_image_tag "$APP"); local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
shift 2
if [[ -z "$DOKKU_RM_CONTAINER" ]]; then
local DOKKU_APP_RM_CONTAINER=$(config_get "$APP" DOKKU_RM_CONTAINER || true)
local DOKKU_GLOBAL_RM_CONTAINER=$(config_get --global DOKKU_RM_CONTAINER || true)
local DOKKU_RM_CONTAINER=${DOKKU_APP_RM_CONTAINER:="$DOKKU_GLOBAL_RM_CONTAINER"}
fi
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"
is_image_herokuish_based "$IMAGE" && local EXEC_CMD="/exec"
# shellcheck disable=SC2086
docker run $DOKKU_GLOBAL_RUN_ARGS $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
}
dokku_run_cmd "$@"

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku_trace_cmd() {
declare desc="enables/disables DOKKU_TRACE"
local cmd="trace"
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
dokku_log_fail "Valid trace options are [on/off]"
}
if [[ "$2" == "on" ]]; then
echo "Enabling dokku trace"
echo "export DOKKU_TRACE=1" > "$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
fi
if [[ "$2" == "off" ]]; then
echo "Disabling dokku trace"
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_TRACE"
fi
}
dokku_trace_cmd "$@"

View File

@@ -0,0 +1 @@
urls

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku_urls_cmd() {
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"
get_app_urls "$@"
}
dokku_urls_cmd "$@"

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_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"
local cmd="version"
cat "$DOKKU_ROOT/VERSION" || dokku_log_fail "Unable to determine dokku's version"
}
dokku_version_cmd "$@"

View File

@@ -1 +0,0 @@
hook

View File

@@ -1 +0,0 @@
hook

View File

@@ -1 +0,0 @@
hook

View File

@@ -1,54 +1,33 @@
#!/usr/bin/env bash
[[ " events events:on events:off events:list help events:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
[[ " help events:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
case "$1" in
events)
if [[ -f $DOKKU_EVENTS_LOGFILE ]]; then
if [[ $2 == "-t" ]]; then
tail -F $DOKKU_EVENTS_LOGFILE
else
tail -n 100 $DOKKU_EVENTS_LOGFILE
fi
fi
;;
events:on)
echo "Enabling dokku events logger"
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p $DOKKU_ROOT/.dokkurc
echo "export DOKKU_EVENTS=1" > $DOKKU_ROOT/.dokkurc/DOKKU_EVENTS
;;
events:off)
echo "Disabling dokku events logger"
rm -f $DOKKU_ROOT/.dokkurc/DOKKU_EVENTS
;;
events:list)
PLUGIN_DIR="$(dirname $0)/"
if [[ "$DOKKU_EVENTS" ]]; then
logged="$(find $PLUGIN_DIR -type l -printf '%f ' | sort)"
dokku_col_log_info2_quiet "Events currently logged"
for hook in $logged; do
dokku_col_log_msg "$hook"
done
else
dokku_log_warn "Events logger disabled"
fi
;;
help | events:help)
cat<<EOF
help_content_func () {
declare desc="return events plugin help content"
cat<<help_content
events [-t], Show the last events (-t follows)
events:list, List logged events
events:on, Enable events logger
events:off, Disable events logger
EOF
help_content
}
if [[ $1 = "events:help" ]] ; then
echo 'Usage: dokku events:COMMAND [-t]'
echo ''
echo 'Interact with Dokku event logger.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

View File

@@ -2,4 +2,4 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@"
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename "$0")" "$@"

View File

@@ -2,7 +2,8 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
DOKKU_RSYSLOG_FILTER=/etc/rsyslog.d/99-dokku.conf
DOKKU_RSYSLOG_FILTER_DIR=/etc/rsyslog.d
DOKKU_RSYSLOG_FILTER=$DOKKU_RSYSLOG_FILTER_DIR/99-dokku.conf
DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku
flag_rsyslog_needs_restart=n
@@ -11,7 +12,7 @@ flag_rsyslog_needs_restart=n
# exits gracefully if the path already exists
mkdir -m 775 -p "$DOKKU_LOGS_DIR"
case "$DOKKU_DISTRO" in
debian)
arch|debian)
chgrp dokku "$DOKKU_LOGS_DIR"
;;
*)
@@ -22,7 +23,7 @@ esac
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
touch "$DOKKU_EVENTS_LOGFILE"
case "$DOKKU_DISTRO" in
debian)
arch|debian)
chgrp dokku "$DOKKU_EVENTS_LOGFILE"
;;
*)
@@ -33,7 +34,7 @@ if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
chmod 664 "$DOKKU_EVENTS_LOGFILE"
fi
if [[ ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
if [[ -d "$DOKKU_RSYSLOG_FILTER_DIR" && ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
cat >"$DOKKU_RSYSLOG_FILTER" <<EOF
:syslogtag, contains, "dokku" $DOKKU_EVENTS_LOGFILE
EOF
@@ -64,10 +65,10 @@ EOF
flag_rsyslog_needs_restart=y
fi
if [[ "$flag_rsyslog_needs_restart" == "y" ]]; then
if [[ -f "$DOKKU_RSYSLOG_FILTER" && "$flag_rsyslog_needs_restart" == "y" ]]; then
service rsyslog restart
fi
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@"
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename "$0")" "$@"
exit 0

View File

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

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
events_main_cmd() {
declare desc="shows contents of dokku events log"
local cmd="events"
if [[ -f $DOKKU_EVENTS_LOGFILE ]]; then
if [[ $2 == "-t" ]]; then
tail -F "$DOKKU_EVENTS_LOGFILE"
else
tail -n 100 "$DOKKU_EVENTS_LOGFILE"
fi
fi
}
events_main_cmd "$@"

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
events_list_cmd() {
declare desc="lists enabled events"
local cmd="events:list"
local PLUGIN_DIR="$(dirname "$0")/.."
if [[ "$DOKKU_EVENTS" ]]; then
local logged="$(find "$PLUGIN_DIR" -type l -printf '%f ' | sort)"
dokku_col_log_info2_quiet "Events currently logged"
local hook
for hook in $logged; do
dokku_col_log_msg "$hook"
done
else
dokku_log_warn "Events logger disabled"
fi
}
events_list_cmd "$@"

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
events_off_cmd() {
declare desc="disables dokku events logger"
local cmd="events:off"
echo "Disabling dokku events logger"
rm -f "$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"
}
events_off_cmd "$@"

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
events_on_cmd() {
declare desc="enables dokku events logger"
local cmd="events:on"
echo "Enabling dokku events logger"
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p "$DOKKU_ROOT/.dokkurc"
echo "export DOKKU_EVENTS=1" > "$DOKKU_ROOT/.dokkurc/DOKKU_EVENTS"
}
events_on_cmd "$@"

View File

@@ -1,84 +1,40 @@
#!/usr/bin/env bash
[[ " apps apps:create apps:rename apps:destroy help apps:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
case "$1" in
apps)
dokku_log_info2_quiet "My Apps"
for app in $(dokku_apps); do
echo "$app"
done
;;
apps:create)
apps_create $2
;;
apps:rename)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -d "$DOKKU_ROOT/$3" ]] && dokku_log_fail "Name is already taken"
OLD_APP="$2"
NEW_APP="$3"
mkdir -p "$DOKKU_ROOT/$NEW_APP"
docker run $DOKKU_GLOBAL_RUN_ARGS --rm -v "$DOKKU_ROOT/$OLD_APP/cache:/cache" "dokku/$OLD_APP" chmod 777 -R /cache
rm -rf "$DOKKU_ROOT/$OLD_APP/cache"
cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP"
dokku apps:destroy $OLD_APP --force
sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS"
sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
dokku ps:rebuild $NEW_APP
plugn trigger post-app-rename $OLD_APP $NEW_APP
echo "Renaming $OLD_APP to $NEW_APP... done"
;;
apps:destroy)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ "$2" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
[[ "$3" == "force" ]] && DOKKU_APPS_FORCE_DELETE=1
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP)
verify_app_name "$APP"
if [[ -z "$DOKKU_APPS_FORCE_DELETE" ]]; then
dokku_log_warn "WARNING: Potentially Destructive Action"
dokku_log_warn "This command will destroy $APP (including all add-ons)."
dokku_log_warn "To proceed, type \"$APP\""
echo ""
read -rp "> " app_name
if [[ "$app_name" != "$APP" ]]; then
dokku_log_fail "Confirmation did not match $APP. Aborted."
fi
fi
echo "Destroying $APP (including all add-ons)"
plugn trigger pre-delete $APP $IMAGE_TAG
DOKKU_APP_CIDS=$(get_app_container_ids $APP)
if [[ -n $DOKKU_APP_CIDS ]]; then
for ID in $DOKKU_APP_CIDS; do
docker stop $ID > /dev/null || true
docker rm $ID > /dev/null || true
done
fi
plugn trigger post-delete $APP $IMAGE_TAG
;;
help | apps:help)
cat<<EOF
help_content_func () {
declare desc="return apps plugin help content"
cat<<help_content
apps, List your apps
apps:create <app>, Create a new app
apps:destroy <app>, Permanently destroy an app
apps:rename <old-app> <new-app>, Rename an app
EOF
help_content
}
if [[ $1 = "apps:help" ]] ; then
echo -e 'Usage: dokku apps[:COMMAND]'
echo ''
echo 'List your apps.'
echo ''
echo 'Example:'
echo ''
echo '$ dokku apps'
echo '=====> My Apps'
echo 'example'
echo 'example2'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

View File

@@ -3,6 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
apps_create() {
declare desc="verifies app name and creates an app"
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ ! "$1" =~ ^[a-z].* && ! "$1" =~ ^[0-9].* ]] && dokku_log_fail "App name must begin with lowercase alphanumeric character"
[[ -d "$DOKKU_ROOT/$1" ]] && dokku_log_fail "Name is already taken"
@@ -10,5 +11,37 @@ apps_create() {
mkdir -p "$DOKKU_ROOT/$APP"
echo "Creating $APP... done"
plugn trigger post-create $APP
plugn trigger post-create "$APP"
}
apps_destroy() {
local APP="$1"; local IMAGE_TAG=$(get_running_image_tag "$APP")
verify_app_name "$APP"
if [[ -z "$DOKKU_APPS_FORCE_DELETE" ]]; then
dokku_log_warn "WARNING: Potentially Destructive Action"
dokku_log_warn "This command will destroy $APP (including all add-ons)."
dokku_log_warn "To proceed, type \"$APP\""
echo ""
read -rp "> " app_name
if [[ "$app_name" != "$APP" ]]; then
dokku_log_fail "Confirmation did not match $APP. Aborted."
fi
fi
echo "Destroying $APP (including all add-ons)"
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
local cid
if [[ -n $DOKKU_APP_CIDS ]]; then
for cid in $DOKKU_APP_CIDS; do
docker stop "$cid" > /dev/null || true
docker rm "$cid" > /dev/null || true
done
fi
plugn trigger post-delete "$APP" "$IMAGE_TAG"
}

View File

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

View File

@@ -2,11 +2,17 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP)
[[ -n $APP ]] && rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
app_post_delete() {
declare desc="apps post-delete plugin trigger"
local trigger="app_post_delete"
local APP="$1"; local IMAGE_REPO=$(get_app_image_repo "$APP")
[[ -n $APP ]] && rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
# remove all application containers & images
# shellcheck disable=SC2046
docker rm -f $(docker ps -a --no-trunc | egrep "dokku/${APP}:" | awk '{ print $1 }' | xargs) &>/dev/null || true
# shellcheck disable=SC2046
docker rmi $(docker images -q $IMAGE_REPO | xargs) &>/dev/null || true
# remove all application containers & images
# shellcheck disable=SC2046
docker rm -f $(docker ps -a --no-trunc | egrep "dokku/${APP}:" | awk '{ print $1 }' | xargs) &>/dev/null || true
# shellcheck disable=SC2046
docker rmi $(docker images -q "$IMAGE_REPO" | xargs) &>/dev/null || true
}
app_post_delete "$@"

View File

@@ -2,9 +2,15 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG); CACHE_DIR="$DOKKU_ROOT/$APP/cache"
verify_app_name "$APP"
apps_pre_delete() {
declare desc="apps pre-delete plugin trigger"
local trigger="apps_pre_delete"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG"); local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
verify_app_name "$APP"
if [[ -d $CACHE_DIR ]]; then
docker run $DOKKU_GLOBAL_RUN_ARGS --rm -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
fi
if [[ -d $CACHE_DIR ]]; then
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
fi
}
apps_pre_delete "$@"

11
plugins/apps/subcommands/create Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
apps_create_cmd() {
declare desc="creates app via command line"
local cmd="apps:create"
apps_create "$2"
}
apps_create_cmd "$@"

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
apps_main_cmd() {
declare desc="lists all apps"
local cmd="apps"
local app
dokku_log_info2_quiet "My Apps"
for app in $(dokku_apps); do
echo "$app"
done
}
apps_main_cmd "$@"

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/apps/functions"
apps_destroy_cmd() {
declare desc="destroys an app"
local cmd="apps:destroy"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ "$2" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
[[ "$3" == "force" ]] && export DOKKU_APPS_FORCE_DELETE=1
local APP="$2"
apps_destroy "$APP"
}
apps_destroy_cmd "$@"

28
plugins/apps/subcommands/rename Executable file
View File

@@ -0,0 +1,28 @@
#!/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/ps/functions"
apps_rename_cmd() {
declare desc="renames an app"
local cmd="apps:rename"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -d "$DOKKU_ROOT/$3" ]] && dokku_log_fail "Name is already taken"
local OLD_APP="$2"
local NEW_APP="$3"
mkdir -p "$DOKKU_ROOT/$NEW_APP"
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$DOKKU_ROOT/$OLD_APP/cache:/cache" "dokku/$OLD_APP" chmod 777 -R /cache
rm -rf "$DOKKU_ROOT/$OLD_APP/cache"
cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP"
DOKKU_APPS_FORCE_DELETE=1 apps_destroy "$OLD_APP"
sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS"
sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
ps_rebuild "$NEW_APP"
plugn trigger post-app-rename "$OLD_APP" "$NEW_APP"
echo "Renaming $OLD_APP to $NEW_APP... done"
}
apps_rename_cmd "$@"

View File

@@ -1,96 +0,0 @@
#!/usr/bin/env bash
[[ " backup:export backup:import help backup:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
backup:export)
CURRENT_BACKUP_VERSION=1
OUTPUT_FILE="$2"
BACKUP_DIR="$DOKKU_ROOT"
BACKUP_TMP_DIR=$(mktemp -d)
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
: | plugn trigger backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
pushd $BACKUP_DIR > /dev/null
find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
popd > /dev/null
# we want to insert the files in the root of the tar
pushd $BACKUP_TMP_DIR > /dev/null
echo $CURRENT_BACKUP_VERSION > .dokku_backup_version
tar --append -f $BACKUP_TMP_FILE .dokku_backup_version
tar --append -f $BACKUP_TMP_FILE .dokku_backup_apps
popd > /dev/null
# if no file specified, output to stdout
if [[ -z $OUTPUT_FILE ]]; then
cat $BACKUP_TMP_FILE
else
mv $BACKUP_TMP_FILE $OUTPUT_FILE
fi
rm -rf $BACKUP_TMP_DIR
;;
backup:import)
if [[ $2 == "-f" ]]; then
force=true
shift
else
force=false
fi
INPUT_FILE="$2"
[[ -z $INPUT_FILE ]] && INPUT_FILE="-"
BACKUP_TMP_DIR=$(mktemp -d)
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
dokku_log_fail "Unable to determine backup version"
fi
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
if [[ $VERSION -ne 1 ]]; then
dokku_log_fail "Unknown format version $VERSION"
fi
echo "Importing a version $VERSION backup..."
BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
TARGET_DIR="$DOKKU_ROOT"
if ! plugn trigger backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then
if $force; then
echo "-f used. Ignoring warnings."
else
dokku_log_fail "Archive did not pass sanity checks. Use -f to import anyway"
fi
fi
# create all the app directories
while read -r app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps
# have the plugins import their stuff
plugn trigger backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
rm -rf $BACKUP_TMP_DIR
echo "Import complete."
;;
help | backup:help)
cat<<EOF
backup:export [file], Export dokku configuration files
backup:import [file], Import dokku configuration files
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -1,4 +0,0 @@
[plugin]
description = "dokku core backup plugin"
version = "0.4.0"
[plugin.config]

View File

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

View File

@@ -3,33 +3,39 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV=""
verify_app_name "$APP"
build_env_pre_build_buildpack() {
declare desc="build-env pre-build-buildpack plugin trigger"
local trigger="build_env_pre_build_buildpack"
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local BUILD_ENV=""
verify_app_name "$APP"
[[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=5
[[ -z $(config_get --global CURL_TIMEOUT) ]] && config_set --global CURL_TIMEOUT=30
[[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=5
[[ -z $(config_get --global CURL_TIMEOUT) ]] && config_set --global CURL_TIMEOUT=30
if [[ -n $(config_export global) ]]; then
BUILD_ENV+=$'\n'
BUILD_ENV+=$(config_export global)
BUILD_ENV+=$'\n'
fi
if [[ -n $(config_export app $APP) ]]; then
BUILD_ENV+=$'\n'
BUILD_ENV+=$(config_export app $APP)
BUILD_ENV+=$'\n'
fi
if [[ -n $(config_export global) ]]; then
local BUILD_ENV+=$'\n'
local BUILD_ENV+=$(config_export global)
local BUILD_ENV+=$'\n'
fi
if [[ -n $(config_export app "$APP") ]]; then
local BUILD_ENV+=$'\n'
local BUILD_ENV+=$(config_export app "$APP")
local BUILD_ENV+=$'\n'
fi
if [[ ! -z "$BUILD_ENV" ]]; then
dokku_log_info1 "Adding BUILD_ENV to build environment..."
# create build env files for use in buildpacks like this:
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
id=$(echo $BUILD_ENV |sed -e 's@export @@g' -e 's@\\n@ @g' | docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
if [[ ! -z "$BUILD_ENV" ]]; then
dokku_log_info1 "Adding BUILD_ENV to build environment..."
# create build env files for use in buildpacks like this:
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
local id=$(echo $BUILD_ENV |sed -e 's@export @@g' -e 's@\\n@ @g' | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
# create build env for 'old style' buildpacks and dokku plugins
id=$(echo -e "$BUILD_ENV" | docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
fi
# create build env for 'old style' buildpacks and dokku plugins
local id=$(echo -e "$BUILD_ENV" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
fi
}
build_env_pre_build_buildpack "$@"

View File

@@ -1,173 +1,12 @@
#!/usr/bin/env bash
[[ " certs:add certs:generate certs:info certs:remove certs:update help certs:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
[[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
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() {
[[ -t 0 ]] && return 1
return 0
}
is_file_import() {
local CRT_FILE="$1"
local KEY_FILE="$2"
if [[ $CRT_FILE ]] && [[ $KEY_FILE ]]; then
if [[ ! -f $CRT_FILE ]]; then
dokku_log_fail "CRT file specified not found, please check file paths"
elif [[ ! -f $KEY_FILE ]]; then
dokku_log_fail "KEY file specified not found, please check file paths"
else
return 0
fi
fi
return 1
}
certs_set() {
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
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
TEMP_DIR=$(mktemp -d)
cd $TEMP_DIR
tar xvf - <&0
CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.crt")
CRT_FILE_COUNT=$(printf "%s" "$CRT_FILE_SEARCH" | grep -c '^')
if [[ $CRT_FILE_COUNT -lt 1 ]]; then
dokku_log_fail "Tar archive is missing .crt file"
elif [[ $CRT_FILE_COUNT -gt 1 ]]; then
dokku_log_fail "Tar archive contains more than one .crt file"
else
CRT_FILE=$CRT_FILE_SEARCH
fi
KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.key")
KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^')
if [[ $KEY_FILE_COUNT -lt 1 ]]; then
dokku_log_fail "Tar archive is missing .key file"
elif [[ $KEY_FILE_COUNT -gt 1 ]]; then
dokku_log_fail "Tar archive contains more than one .key file"
else
KEY_FILE=$KEY_FILE_SEARCH
fi
fi
mkdir -p "$APP_SSL_PATH"
cp "$CRT_FILE" "$APP_SSL_PATH/server.crt"
cp "$KEY_FILE" "$APP_SSL_PATH/server.key"
chmod 750 $APP_SSL_PATH
chmod 640 $APP_SSL_PATH/server.crt $APP_SSL_PATH/server.key
cd $DOKKU_ROOT
rm -rf $TEMP_DIR
nginx_build_config $APP
}
case "$1" in
certs:add)
certs_set "$@"
;;
certs:generate)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
APP="$2"; DOMAIN="$3"; APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if [[ ! -f "$APP_SSL_PATH/server.key" ]] && [[ ! -f "$APP_SSL_PATH/server.crt" ]]; then
TMP_WORK_DIR=$(mktemp -d -t "dokku_certs.XXXXXXXXX")
trap 'rm -rf "$TMP_WORK_DIR" > /dev/null' INT TERM EXIT
pushd $TMP_WORK_DIR > /dev/null
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
mkdir -p "$APP_SSL_PATH"
dokku_log_info1 "Installing certificate and key..."
mv -f $TMP_WORK_DIR/server.key $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" ]] && (dokku domains:add $APP $DOMAIN || nginx_build_config $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."
cat server.csr
else
dokku_log_info1 "$APP has an SSL endpoint already defined"
fi
;;
certs:info)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
APP="$2"; SSL_TYPE=$(is_ssl_enabled $APP)
case "$SSL_TYPE" in
app)
SSL_PATH="$DOKKU_ROOT/$APP/tls"
;;
global)
SSL_PATH="$DOKKU_ROOT/tls"
;;
*)
;;
esac
if [[ -n "$SSL_PATH" ]]; then
dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
dokku_log_info1 "Certificate details:"
dokku_log_info2 "Common Name(s): "
for domain in $(get_ssl_hostnames $APP | xargs); do
dokku_log_info2 " $domain"
done
dokku_log_info2 "Expires At: $(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
dokku_log_info2 "Issuer: $(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
dokku_log_info2 "Starts At: $(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
dokku_log_info2 "Subject: $(openssl x509 -in $SSL_PATH/server.crt -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver $SSL_PATH/server.crt | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
SSL_SELF_SIGNED="verified by a certificate authority."
else
SSL_SELF_SIGNED="self signed."
fi
dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
else
dokku_log_info1 "$APP does not have an SSL endpoint"
fi
;;
certs:remove)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
APP="$2"; APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if [[ -d "$APP_SSL_PATH" ]]; then
dokku_log_info1 "Removing SSL endpoint from $APP"
rm -rf $APP_SSL_PATH
plugn trigger post-domains-update $APP
else
dokku_log_fail "An app-specific SSL endpoint is not defined"
fi
;;
certs:update)
certs_set "$@"
;;
help | certs:help)
cat<<EOF
help_content_func () {
declare desc="return certs plugin help content"
cat<<help_content
certs:add <app> CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin
certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate.
certs:generate <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
@@ -176,11 +15,23 @@ case "$1" in
certs:remove <app>, Remove an SSL Endpoint from an app.
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app.
certs:update <app> CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin
EOF
help_content
}
if [[ $1 = "certs:help" ]] ; then
echo -e 'Usage: dokku certs:COMMAND'
echo ''
echo 'Manage Dokku apps SSL (TLS) certs.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

View File

@@ -2,18 +2,12 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
# returns 'global', 'app', 'false'
# if both are configured, app trumps global
is_ssl_enabled() {
local APP=$1; verify_app_name $APP
APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
WILDCARD_SSL_PATH="$DOKKU_ROOT/tls"
declare desc="returns 0 if ssl is enabled for given app"
local APP=$1; verify_app_name "$APP"
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if [[ -e "$APP_SSL_PATH/server.crt" ]] && [[ -e "$APP_SSL_PATH/server.key" ]]; then
echo app
return 0
elif [[ -e "$WILDCARD_SSL_PATH/server.crt" ]] && [[ -e "$WILDCARD_SSL_PATH/server.key" ]]; then
echo global
return 0
else
return 1
@@ -21,24 +15,17 @@ is_ssl_enabled() {
}
get_ssl_hostnames() {
local APP=$1; verify_app_name $APP
case "$(is_ssl_enabled $APP)" in
app)
SSL_PATH="$DOKKU_ROOT/$APP/tls"
;;
declare desc="returns a string of ssl hostnames extracted from an app's ssl certificate"
local APP=$1; verify_app_name "$APP"
local SSL_PATH="$DOKKU_ROOT/$APP/tls"
global)
SSL_PATH="$DOKKU_ROOT/tls"
;;
esac
SSL_HOSTNAME=$(openssl x509 -in $SSL_PATH/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
SSL_HOSTNAME_ALT=$(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
local SSL_HOSTNAME=$(openssl x509 -in "$SSL_PATH/server.crt" -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
local SSL_HOSTNAME_ALT=$(openssl x509 -in "$SSL_PATH/server.crt" -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
if [[ -n "$SSL_HOSTNAME_ALT" ]]; then
SSL_HOSTNAMES="${SSL_HOSTNAME}\n${SSL_HOSTNAME_ALT}"
local SSL_HOSTNAMES="${SSL_HOSTNAME}\n${SSL_HOSTNAME_ALT}"
else
SSL_HOSTNAMES=$SSL_HOSTNAME
local SSL_HOSTNAMES=$SSL_HOSTNAME
fi
echo -e $SSL_HOSTNAMES
echo -e "$SSL_HOSTNAMES"
return 0
}

View File

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

76
plugins/certs/subcommands/add Executable file
View File

@@ -0,0 +1,76 @@
#!/usr/bin/env bash
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"
[[ -t 0 ]] && return 1
return 0
}
is_file_import() {
declare desc="determines if we have passed in a file and key path for a file import"
local CRT_FILE="$1"
local KEY_FILE="$2"
if [[ $CRT_FILE ]] && [[ $KEY_FILE ]]; then
if [[ ! -f $CRT_FILE ]]; then
dokku_log_fail "CRT file specified not found, please check file paths"
elif [[ ! -f $KEY_FILE ]]; then
dokku_log_fail "KEY file specified not found, please check file paths"
else
return 0
fi
fi
return 1
}
certs_set() {
declare desc="imports an SSL cert/key combo either on STDIN via a tarball or from specified cert/key filenames"
local cmd="$1"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
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
local TEMP_DIR=$(mktemp -d -t "dokku_certs_set.XXXX")
pushd "$TEMP_DIR" &> /dev/null
trap 'popd &> /dev/null || true; rm -rf $TEMP_DIR > /dev/null' RETURN
tar xvf - <&0
local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.crt")
local CRT_FILE_COUNT=$(printf "%s" "$CRT_FILE_SEARCH" | grep -c '^')
if [[ $CRT_FILE_COUNT -lt 1 ]]; then
dokku_log_fail "Tar archive is missing .crt file"
elif [[ $CRT_FILE_COUNT -gt 1 ]]; then
dokku_log_fail "Tar archive contains more than one .crt file"
else
local CRT_FILE=$CRT_FILE_SEARCH
fi
local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.key")
local KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^')
if [[ $KEY_FILE_COUNT -lt 1 ]]; then
dokku_log_fail "Tar archive is missing .key file"
elif [[ $KEY_FILE_COUNT -gt 1 ]]; then
dokku_log_fail "Tar archive contains more than one .key file"
else
local KEY_FILE=$KEY_FILE_SEARCH
fi
fi
mkdir -p "$APP_SSL_PATH"
cp "$CRT_FILE" "$APP_SSL_PATH/server.crt"
cp "$KEY_FILE" "$APP_SSL_PATH/server.key"
chmod 750 "$APP_SSL_PATH"
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key"
cd "$DOKKU_ROOT"
nginx_build_config "$APP"
}
certs_set "$@"

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
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"
local cmd="certs:generate"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
local APP="$2"; local DOMAIN="$3"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if [[ ! -f "$APP_SSL_PATH/server.key" ]] && [[ ! -f "$APP_SSL_PATH/server.crt" ]]; then
local TMP_WORK_DIR=$(mktemp -d -t "dokku_certs.XXXXXXXXX")
pushd "$TMP_WORK_DIR" > /dev/null
trap 'popd &> /dev/null || true; rm -rf "$TMP_WORK_DIR" > /dev/null' INT TERM EXIT
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
mkdir -p "$APP_SSL_PATH"
dokku_log_info1 "Installing certificate and key..."
mv -f "$TMP_WORK_DIR/server.key" "$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")
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."
cat server.csr
else
dokku_log_info1 "$APP has an SSL endpoint already defined"
fi
}
certs_generate_cmd "$@"

38
plugins/certs/subcommands/info Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
certs_info_cmd() {
declare desc="prints SSL certificate info for app"
local cmd="certs:info"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
if [[ -n "$APP_SSL_PATH" ]]; then
dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
dokku_log_info1 "Certificate details:"
dokku_log_info2 "Common Name(s): "
for domain in $(get_ssl_hostnames "$APP" | xargs); do
dokku_log_info2 " $domain"
done
dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
local SSL_SELF_SIGNED="verified by a certificate authority."
else
local SSL_SELF_SIGNED="self signed."
fi
dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
else
dokku_log_info1 "$APP does not have an SSL endpoint"
fi
}
certs_info_cmd "$@"

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