Compare commits
239 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa74315389 | ||
|
|
b7bb766f53 | ||
|
|
ae972cf3cd | ||
|
|
b20a91d24f | ||
|
|
bd8ca6ca5c | ||
|
|
6543f5d11c | ||
|
|
f0000a18ba | ||
|
|
80d13234f9 | ||
|
|
f6c1ad1b8f | ||
|
|
2f5fce36e4 | ||
|
|
8d14d15acc | ||
|
|
3cc1b42160 | ||
|
|
2a76f7c3b3 | ||
|
|
2b019aef2f | ||
|
|
7dc6d449bd | ||
|
|
a7ec68e107 | ||
|
|
3192f9b724 | ||
|
|
3decb4e780 | ||
|
|
a1ae7d76f4 | ||
|
|
47dfde16f5 | ||
|
|
99632b7141 | ||
|
|
424827d813 | ||
|
|
b7d1f54bd5 | ||
|
|
bc93e5da17 | ||
|
|
71a8142ed9 | ||
|
|
688cb910dd | ||
|
|
d3b4c49d17 | ||
|
|
25422a4a2a | ||
|
|
62143b1fa1 | ||
|
|
a522adfecb | ||
|
|
83f4df3017 | ||
|
|
3df37bcc99 | ||
|
|
4b0163103e | ||
|
|
bd7deae883 | ||
|
|
d4cf23ec07 | ||
|
|
bdd2b4bfe5 | ||
|
|
ecd47dcdeb | ||
|
|
3762b7b9f9 | ||
|
|
98ef078d33 | ||
|
|
a79cd7aebf | ||
|
|
aa345fad01 | ||
|
|
ed06b8961e | ||
|
|
8e2a3783ce | ||
|
|
d9ab4d1424 | ||
|
|
833db67f25 | ||
|
|
01f370ab82 | ||
|
|
9d4a288579 | ||
|
|
b6f9672d40 | ||
|
|
8f8ee9c5da | ||
|
|
9effe275bd | ||
|
|
c1ae280a78 | ||
|
|
ce3aa4b93e | ||
|
|
fcefd4a29b | ||
|
|
4f8c1b64c9 | ||
|
|
2ece0e1bf8 | ||
|
|
1216a5e65a | ||
|
|
aca2540651 | ||
|
|
2cb20f3fd0 | ||
|
|
946756bd43 | ||
|
|
d74006b51a | ||
|
|
e6dfdc0732 | ||
|
|
21d0859253 | ||
|
|
2b19881f01 | ||
|
|
39375342e0 | ||
|
|
ab94a9fc67 | ||
|
|
ff18e0d6be | ||
|
|
6c1d6225f9 | ||
|
|
99c56ccd6d | ||
|
|
f99aa2b128 | ||
|
|
a43fc39d9a | ||
|
|
6be1fd33cd | ||
|
|
5e9df3a92d | ||
|
|
5c741696fc | ||
|
|
8e30722c1e | ||
|
|
cd48505922 | ||
|
|
24cab65d9c | ||
|
|
dc8acc0da6 | ||
|
|
0297dd9e1f | ||
|
|
e4268148cf | ||
|
|
f226dc7c27 | ||
|
|
b71c5b668f | ||
|
|
30ae651a59 | ||
|
|
d2ee0994c0 | ||
|
|
1e5a8b146c | ||
|
|
6bf9ef0aa5 | ||
|
|
100afca1ca | ||
|
|
9a29cc59a8 | ||
|
|
6c08b9b343 | ||
|
|
48965e05bd | ||
|
|
2c1f32199a | ||
|
|
1e0c585b74 | ||
|
|
0c58aeaa52 | ||
|
|
2cedc19b2a | ||
|
|
9bb554e5bc | ||
|
|
4aab4dcfcf | ||
|
|
d4660d9fe9 | ||
|
|
9a7d4fb402 | ||
|
|
d302316549 | ||
|
|
327db3d07a | ||
|
|
1cba46f3a1 | ||
|
|
54c5d0dfa6 | ||
|
|
ef59ff38f6 | ||
|
|
683113ef78 | ||
|
|
79a7342808 | ||
|
|
eab69bd6d5 | ||
|
|
b1deb45c81 | ||
|
|
5ff73995f2 | ||
|
|
e0f6435d86 | ||
|
|
2565ea1543 | ||
|
|
cb8a9648c9 | ||
|
|
17f7708226 | ||
|
|
166f7f38e4 | ||
|
|
74e861417e | ||
|
|
0487083f37 | ||
|
|
3c6982a942 | ||
|
|
6760a2d143 | ||
|
|
a9fd2cdbf6 | ||
|
|
377412f9f8 | ||
|
|
848f92ef7f | ||
|
|
8bbb210a10 | ||
|
|
401a42f5c4 | ||
|
|
5a99b8f0ed | ||
|
|
346efbfdd8 | ||
|
|
498f0eda22 | ||
|
|
c268432bc3 | ||
|
|
a833688355 | ||
|
|
4917330b79 | ||
|
|
4d91b2085e | ||
|
|
29c69f9f86 | ||
|
|
476429a7db | ||
|
|
2d045d1ae1 | ||
|
|
9bd0c69dac | ||
|
|
b232f7cd49 | ||
|
|
904dfb64aa | ||
|
|
a5ef53f2f5 | ||
|
|
88db4daa62 | ||
|
|
56dde3ff31 | ||
|
|
2da58ff351 | ||
|
|
af48605054 | ||
|
|
66790e3d82 | ||
|
|
2c201a7d6f | ||
|
|
78d2b3e7d2 | ||
|
|
9b60f0c3c6 | ||
|
|
668437a9e5 | ||
|
|
5f30115796 | ||
|
|
5c6e39d2c0 | ||
|
|
6a9d9f212f | ||
|
|
599bd59c6f | ||
|
|
e4dd40bbcc | ||
|
|
325b9258e4 | ||
|
|
8cef6b2074 | ||
|
|
fe00835aa7 | ||
|
|
ad0d2b1f6d | ||
|
|
c27b0c08ed | ||
|
|
c73094615e | ||
|
|
989ea72490 | ||
|
|
d9e1548683 | ||
|
|
e474d49320 | ||
|
|
e4d916c308 | ||
|
|
e30c01c234 | ||
|
|
9ae9c7ad11 | ||
|
|
ea240f117e | ||
|
|
68fb0e7b98 | ||
|
|
9d74f1ecf2 | ||
|
|
2356dbd594 | ||
|
|
7aa48d3426 | ||
|
|
b8b4f6fedf | ||
|
|
25a2801cb1 | ||
|
|
86ef6ae5d1 | ||
|
|
4e99078ac1 | ||
|
|
7de160b64d | ||
|
|
99030a110c | ||
|
|
ee18909935 | ||
|
|
4f621916a7 | ||
|
|
f89f946c40 | ||
|
|
8e34477c96 | ||
|
|
5940e43c85 | ||
|
|
c1c76362e7 | ||
|
|
a034ec9803 | ||
|
|
2da4f5ef03 | ||
|
|
d7386317fc | ||
|
|
851ca592d5 | ||
|
|
9d584ed145 | ||
|
|
ac1c4dc571 | ||
|
|
32505b14e7 | ||
|
|
1bcd76ffe9 | ||
|
|
565cd5c0e8 | ||
|
|
8597b692ee | ||
|
|
e9447a26d9 | ||
|
|
17a602efe8 | ||
|
|
7b1bc522f6 | ||
|
|
64f83f976e | ||
|
|
cb9efa3322 | ||
|
|
28f83ab0d5 | ||
|
|
be13b0149a | ||
|
|
e73c89abc8 | ||
|
|
7a36ecf196 | ||
|
|
33dd90a091 | ||
|
|
c67a4dcc7d | ||
|
|
546551e6e9 | ||
|
|
bd4aee0864 | ||
|
|
06d18b4cbd | ||
|
|
075de78442 | ||
|
|
3cead25acf | ||
|
|
559347f985 | ||
|
|
613679352b | ||
|
|
d6c7682068 | ||
|
|
4cd847fb27 | ||
|
|
58e3556e0e | ||
|
|
500a6dd73b | ||
|
|
7d3571757d | ||
|
|
26ee0d7ae2 | ||
|
|
13f7727fe3 | ||
|
|
8a14b34446 | ||
|
|
6a39fd70e1 | ||
|
|
fff050c71d | ||
|
|
61327620da | ||
|
|
80cc57caa0 | ||
|
|
55f38414d1 | ||
|
|
96da38a8e4 | ||
|
|
25b144e496 | ||
|
|
478f5e34d3 | ||
|
|
47dfa921cd | ||
|
|
c162f57dbd | ||
|
|
92073eda12 | ||
|
|
bb9b36b291 | ||
|
|
8b93d9bf54 | ||
|
|
d7566daacc | ||
|
|
7b8cefbadc | ||
|
|
579ffa5a62 | ||
|
|
c6fa061604 | ||
|
|
fd811b020a | ||
|
|
9ae2ab105b | ||
|
|
1a94a62fe3 | ||
|
|
cdc327b777 | ||
|
|
f073ebe4cd | ||
|
|
5bc3e14eb4 | ||
|
|
6548cc4477 | ||
|
|
e64daa18cf |
181
HISTORY.md
181
HISTORY.md
@@ -1,5 +1,186 @@
|
||||
# History
|
||||
|
||||
## 0.6.4
|
||||
|
||||
Included in this release are a couple of bug fixes for existing features.
|
||||
|
||||
Thanks to all the contributors who helped with this release!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2275: @sseemayer Prefer file import in certs:add if files given
|
||||
- #2279: @michaelshobbs Only attempt to stop a checks-disabled container if it is actually running
|
||||
|
||||
### New Features
|
||||
|
||||
- #2270: @guillaumewuip Allow apps:destroy when not in a project
|
||||
- #2271: @josegonzalez Handle purging the dokku user, group, and logs directory during `apt-get purge`
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2272: @josegonzalez Add documentation surrounding when the /app/.env file is populated
|
||||
|
||||
## 0.6.3
|
||||
|
||||
This release is mostly a documentation release.
|
||||
|
||||
Thanks to all the contributors who helped with this release!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2258: @michaelshobbs Support domains that start with digits per RFC1123
|
||||
|
||||
### New Features
|
||||
|
||||
- #2260: @josegonzalez Add ability to remove a specific port mapping tuple
|
||||
- #2261: @josegonzalez Drop apparmor requirement to support systemd systems
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2262: @josegonzalez Document that REV is optional in the receive-app trigger
|
||||
- #2264: @troy Use Markdown for sponsors page, so it's clickable from GitHub
|
||||
- #2266: @michaelshobbs Add documentation surrounding proxy port mapping
|
||||
|
||||
## 0.6.2
|
||||
|
||||
This release is a minor bugfix for the web setup, and also reverts a previous addition to the persistent storage. Please see the pull requests for more details.
|
||||
|
||||
Thanks to all the contributors who helped with this release!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2256: @michaelshobbs Revert automatically binding storage mounts in build phase
|
||||
- #2259: @andrewsomething Don't run DeleteInstallerThread() until after set_debconf_selection
|
||||
|
||||
## 0.6.1
|
||||
|
||||
This release is a minor bugfix to fix an issue with ssl support for spdy-enabled nginx servers. Users are encouraged to upgrade if they have an older version of nginx installed.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2250: @michaelshobbs Fix missing $ sign in default nginx template
|
||||
|
||||
## 0.6.0
|
||||
|
||||
The big-six-o. This release is largely comprised of new features that should allow for easier management of dokku. The highlights of this release are:
|
||||
|
||||
- The proxy plugin has been enhanced to allow users to map container ports to host ports. In the 0.5.0 release, we changed the semantics of how Dockerfile `EXPOSE` calls work to better follow Docker's lead, which ended up breaking how some applications were deployed to dokku. Please read our documentation surrounding [port management](http://dokku.viewdocs.io/dokku/proxy/) for more details.
|
||||
- Zero-downtime deploys can be disabled on a per-app and per-process basis. This can be used to speed up deploys when there are non-web processes being deployed, or when a user wishes to completely avoid any such waiting period. Please see the [checks documentation](http://dokku.viewdocs.io/dokku/checks-examples/) for further information.
|
||||
|
||||
Thanks to all the contributors who helped with this release, and a special thanks to @michaelshobbs for ferrying the majority of our new functionality to it's current state!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2241: @josegonzalez Set debconf selections from dokku-installer.py
|
||||
- #2242: @michaelshobbs Avoid calling dokku binary
|
||||
- #2243: @josegonzalez Nginx 1.9.5+ support
|
||||
|
||||
### New Features
|
||||
|
||||
- #2018: @pascalw Support running Procfile commands using `dokku run`
|
||||
- #2050: @josegonzalez Implement repo:gc and repo:purge-cache
|
||||
- #2109: @josegonzalez Allow user to modify the repository and tag when deploying an app
|
||||
- #2168: @michaelshobbs Allow zero-downtime deploys to be completely disabled
|
||||
- #2248: @michaelshobbs Allow users to map container ports to host ports via the proxy plugin
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2209: @piamancini Added backers and sponsors from OpenCollective
|
||||
- #2244: @basgys Add InfluxDB to plugins
|
||||
|
||||
## 0.5.8
|
||||
|
||||
This release is the last release in the `0.5.x` series, and as such is mainly a bugfix release. Users are highly encouraged to upgrade to this release *before* moving to the upcoming `0.6.x` release, as we will be removing deprecated features at that point.
|
||||
|
||||
Thanks to all the contributors who helped with this release!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2214: @michaelshobbs Remove git push from client
|
||||
- #2220: @josegonzalez Remove DOKKU_PROCFILE before attempting to extract it
|
||||
- #2227: @michaelshobbs Pass image tag from release_and_deploy down through extract_procfile
|
||||
- #2228: @michaelshobbs Support WORKDIR location for DOKKU_SCALE
|
||||
- #2229: @hansmi Fix removal of domains with schema
|
||||
- #2234: @michaelshobbs Cleanup container state files when a process type is removed from app
|
||||
- #2236: @michaelshobbs Hide unnecessary output from is_image_herokuish_based()
|
||||
- #2233: @josegonzalez Lintian cleanup
|
||||
|
||||
### New Features
|
||||
|
||||
- #2205: @josegonzalez Fix lintian errors in built debian packages
|
||||
- #2223: @josegonzalez De-duplicate nginx restarting
|
||||
- #2237: @michaelshobbs Reject invalid domains in domains:add
|
||||
- #2238: @michaelshobbs Mount storage mounts on build for buildpack deploys
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2212: @jbothma Warn and instruct users about unsafe publicly-accessible web installer
|
||||
- #2222: @michaelshobbs Move nginx upstream blocks to the bottom in docs examples
|
||||
|
||||
## 0.5.7
|
||||
|
||||
0.5.7 includes quite a few documentation updates, and a few minor changes in how we handle certain edge-cases in day-to-day dokku tasks.
|
||||
|
||||
Thanks to all the contributors who helped with this release!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2157: @michaelshobbs test detached container is running
|
||||
- #2170: @jvanbaarsen Do not fail domains:add when adding a duplicated domain
|
||||
- #2171: @tobru Continue to restore applications during boot when any given application does not start
|
||||
- #2173: @michaelshobbs Add test for ps:restore with undeployed app
|
||||
- #2202: @michaelshobbs Attempt to bypass inconsistencies in nginx start behavior
|
||||
|
||||
### New Features
|
||||
|
||||
- #2155: @josegonzalez Add the ability to run containers in detached mode
|
||||
- #2163: @michaelshobbs Support deployment of arbitrary docker images not built by dokku build
|
||||
- #2175: @michaelshobbs Show available types and ids on dokku enter error
|
||||
- #2193: @josegonzalez Upgrade herokuish version built via deb packaging
|
||||
- #2203: Allow specifying NO_INSTALL_RECOMMENDS via DOKKU_NO_INSTALL_RECOMMENDS in bootstrapped installs
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2164: @iloveitaly Adding longtimeout and hostname to dokku plugin list
|
||||
- #2167: @iloveitaly Adding link to rollbar plugin
|
||||
- #2182: @cu12 Add link to FakeSNS plugin
|
||||
- #2183: @Epigene Update nginx docs to mirror generated nginx.conf from core
|
||||
- #2187: @pltchuong Add missing trigger to plugin triggers documentation
|
||||
- #2190: @cu12 Add ElasticMQ plugin to documentation
|
||||
- #2191: @josegonzalez Clarify upgrade docs for bootstrap.sh installations
|
||||
- #2192: @josegonzalez Clarify that the checks are only run against the web process
|
||||
- #2194: @josegonzalez Clarify the role of process types for buildpack deployment
|
||||
- #2195: @josegonzalez Clarify when certain plugin triggers are invoked
|
||||
|
||||
## 0.5.6
|
||||
|
||||
Release 0.5.6 is mostly a documentation release. Please note, however, that we now inject application environment variables into sigil-generated nginx configurations. You can use this to further improve your generated nginx configuration files.
|
||||
|
||||
Thanks to all the contributors who helped with this release!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2120: @u2mejc Add apex help_content for certs,nginx,storage,tar plugins
|
||||
- #2122: @michaelshobbs Add 10.0.0.2 so *.dokku.me works
|
||||
- #2145: @michaelshobbs Fix dockerfile-procfile test
|
||||
|
||||
### New Features
|
||||
|
||||
- #2150: @michaelshobbs export app config vars into sigil environment for use in nginx templates
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2099: @ojosdegris Added clarification on configuration via separate files
|
||||
- #2107: @simenbrekken Add CI deployment recipe
|
||||
- #2112: @josegonzalez Alphabetize triggers
|
||||
- #2114: @josegonzalez Add table of contents to sidebar when there is a table of contents
|
||||
- #2115: @josegonzalez Document potential dockerfile/nginx.conf.sigil issues
|
||||
- #2116: @josegonzalez Warn users when there is a low memory condition on installation
|
||||
- #2127: @crisward Added dokku require plugin
|
||||
- #2129: @christiangenco Condense upgrading instructions
|
||||
- #2136: @josegonzalez Use `sleep infinity` for enter cron task
|
||||
- #2142: @Aluxian Add dokku-nginx-cache to the list of plugins
|
||||
|
||||
## 0.5.5
|
||||
|
||||
Release 0.5.5 is mostly a documentation release, further clarifying how our default proxy implementation (nginx) interacts with Dockerfiles. Note that we also updated how ssl certificates interact with application domains, so please check out our domains and ssl documentation.
|
||||
|
||||
4
Makefile
4
Makefile
@@ -62,10 +62,10 @@ copyfiles:
|
||||
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\
|
||||
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\
|
||||
done
|
||||
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH}
|
||||
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true
|
||||
$(MAKE) addman
|
||||
|
||||
addman:
|
||||
addman: help2man
|
||||
mkdir -p /usr/local/share/man/man1
|
||||
help2man -Nh help -v version -n "configure and get information from your dokku installation" -o /usr/local/share/man/man1/dokku.1 dokku
|
||||
mandb
|
||||
|
||||
82
README.md
82
README.md
@@ -1,6 +1,9 @@
|
||||
# Dokku [](https://circleci.com/gh/dokku/dokku/tree/master) [](https://packagecloud.io/dokku/dokku) [](https://webchat.freenode.net/?channels=dokku) [](https://glider-slackin.herokuapp.com/) [](http://dokku.viewdocs.io/dokku/) [](https://gratipay.com/dokku/)
|
||||
# Dokku [](https://circleci.com/gh/dokku/dokku/tree/master) [](https://packagecloud.io/dokku/dokku) [](https://webchat.freenode.net/?channels=dokku) [](https://glider-slackin.herokuapp.com/) [](http://dokku.viewdocs.io/dokku/)
|
||||
[](#sponsors)
|
||||
[](#backers)
|
||||
[](https://gratipay.com/dokku/)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -10,8 +13,8 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
|
||||
|
||||
To install the latest stable release, you can run the following commands as a user that has access to `sudo`:
|
||||
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.5.5/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.5.5 bash bootstrap.sh
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.6.4/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.6.4 bash bootstrap.sh
|
||||
|
||||
### Upgrading
|
||||
|
||||
@@ -33,7 +36,76 @@ While we may not merge your PR as is, they serve to start conversations and impr
|
||||
|
||||
## Sponsors
|
||||
|
||||
Dokku is currently sponsored by the enterprise grade, multi-host PaaS project [Deis](http://deis.io/).
|
||||
See our list of past sponsors in the [SPONSORS](https://github.com/dokku/dokku/blob/master/SPONSORS) file.
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/dokku#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/dokku/sponsor/0/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/1/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/2/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/3/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/4/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/5/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/6/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/7/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/8/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/9/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/10/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/11/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/12/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/13/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/14/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/15/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/16/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/17/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/18/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/19/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/20/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/21/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/22/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/23/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/24/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/25/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/26/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/27/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/28/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/sponsor/29/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/dokku#backer)]
|
||||
|
||||
<a href="https://opencollective.com/dokku/backer/0/website" target="_blank"><img src="https://opencollective.com/dokku/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/1/website" target="_blank"><img src="https://opencollective.com/dokku/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/2/website" target="_blank"><img src="https://opencollective.com/dokku/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/3/website" target="_blank"><img src="https://opencollective.com/dokku/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/4/website" target="_blank"><img src="https://opencollective.com/dokku/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/5/website" target="_blank"><img src="https://opencollective.com/dokku/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/6/website" target="_blank"><img src="https://opencollective.com/dokku/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/7/website" target="_blank"><img src="https://opencollective.com/dokku/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/8/website" target="_blank"><img src="https://opencollective.com/dokku/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/9/website" target="_blank"><img src="https://opencollective.com/dokku/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/10/website" target="_blank"><img src="https://opencollective.com/dokku/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/11/website" target="_blank"><img src="https://opencollective.com/dokku/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/12/website" target="_blank"><img src="https://opencollective.com/dokku/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/13/website" target="_blank"><img src="https://opencollective.com/dokku/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/14/website" target="_blank"><img src="https://opencollective.com/dokku/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/15/website" target="_blank"><img src="https://opencollective.com/dokku/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/16/website" target="_blank"><img src="https://opencollective.com/dokku/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/17/website" target="_blank"><img src="https://opencollective.com/dokku/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/18/website" target="_blank"><img src="https://opencollective.com/dokku/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/19/website" target="_blank"><img src="https://opencollective.com/dokku/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/20/website" target="_blank"><img src="https://opencollective.com/dokku/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/21/website" target="_blank"><img src="https://opencollective.com/dokku/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/22/website" target="_blank"><img src="https://opencollective.com/dokku/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/23/website" target="_blank"><img src="https://opencollective.com/dokku/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/24/website" target="_blank"><img src="https://opencollective.com/dokku/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/25/website" target="_blank"><img src="https://opencollective.com/dokku/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/26/website" target="_blank"><img src="https://opencollective.com/dokku/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/27/website" target="_blank"><img src="https://opencollective.com/dokku/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/28/website" target="_blank"><img src="https://opencollective.com/dokku/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/29/website" target="_blank"><img src="https://opencollective.com/dokku/backer/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
|
||||
3
SPONSORS.md
Normal file
3
SPONSORS.md
Normal file
@@ -0,0 +1,3 @@
|
||||
[Deis](http://deis.io)
|
||||
|
||||
[DigitalOcean](https://www.digitalocean.com/)
|
||||
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@@ -82,7 +82,7 @@ Vagrant::configure("2") do |config|
|
||||
vm.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
vm.vm.network :private_network, ip: DOKKU_IP
|
||||
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
|
||||
vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all"
|
||||
end
|
||||
|
||||
config.vm.define "build-arch", autostart: false do |vm|
|
||||
|
||||
@@ -12,6 +12,7 @@ set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
# It also means that we can't run a partially downloaded script.
|
||||
|
||||
ensure-environment() {
|
||||
local FREE_MEMORY
|
||||
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/"
|
||||
@@ -22,6 +23,12 @@ ensure-environment() {
|
||||
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
|
||||
}
|
||||
|
||||
FREE_MEMORY=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
||||
if [[ "$FREE_MEMORY" -lt 1003600 ]]; then
|
||||
echo "For dokku to build containers, it is strongly suggested that you have 1024 megabytes or more of free memory"
|
||||
echo "If necessary, please consult this document to setup swap: http://dokku.viewdocs.io/dokku/advanced-installation/#vms-with-less-than-1gb-of-memory"
|
||||
fi
|
||||
}
|
||||
|
||||
install-requirements() {
|
||||
@@ -78,7 +85,7 @@ install-dokku-from-source() {
|
||||
|
||||
install-dokku-from-package() {
|
||||
local DOKKU_CHECKOUT="$1"
|
||||
local NO_INSTALL_RECOMMENDS=""
|
||||
local NO_INSTALL_RECOMMENDS=${DOKKU_NO_INSTALL_RECOMMENDS:=""}
|
||||
|
||||
if [[ -n $DOKKU_DOCKERFILE ]]; then
|
||||
NO_INSTALL_RECOMMENDS=" --no-install-recommends "
|
||||
|
||||
@@ -11,6 +11,8 @@ dependencies:
|
||||
override:
|
||||
- ./tests/ci/parallel_runner.sh setup: { timeout: 300 }
|
||||
- echo "export DOKKU_SKIP_CLEANUP=true" > /home/dokku/.dokkurc/dokku_skip_cleanup
|
||||
# dokku.me now resolves to 10.0.0.2. add 10.0.0.2/24 to eth0
|
||||
- sudo ip a a 10.0.0.2/24 broadcast 10.0.0.255 dev eth0
|
||||
post:
|
||||
- sudo -E make -e lint
|
||||
test:
|
||||
|
||||
@@ -9,7 +9,7 @@ import subprocess
|
||||
import sys
|
||||
import threading
|
||||
|
||||
VERSION = 'v0.5.5'
|
||||
VERSION = 'v0.6.4'
|
||||
|
||||
hostname = ''
|
||||
try:
|
||||
@@ -86,8 +86,10 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
'REQUEST_METHOD': 'POST',
|
||||
'CONTENT_TYPE': self.headers['Content-Type']})
|
||||
|
||||
vhost_enable = 'false'
|
||||
dokku_root = os.getenv('DOKKU_ROOT', '/home/dokku')
|
||||
if 'vhost' in params and params['vhost'].value == 'true':
|
||||
vhost_enable = 'true'
|
||||
with open('{0}/VHOST'.format(dokku_root), 'w') as f:
|
||||
f.write(params['hostname'].value)
|
||||
else:
|
||||
@@ -98,7 +100,6 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
with open('{0}/HOSTNAME'.format(dokku_root), 'w') as f:
|
||||
f.write(params['hostname'].value)
|
||||
|
||||
|
||||
command = ['sshcommand', 'acl-add', 'dokku', 'admin']
|
||||
for key in params['keys'].value.split("\n"):
|
||||
proc = subprocess.Popen(command, stdin=subprocess.PIPE)
|
||||
@@ -106,6 +107,11 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
proc.stdin.close()
|
||||
proc.wait()
|
||||
|
||||
set_debconf_selection('boolean', 'skip_key_file', 'true')
|
||||
set_debconf_selection('boolean', 'vhost_enable', vhost_enable)
|
||||
set_debconf_selection('boolean', 'web_config', 'false')
|
||||
set_debconf_selection('string', 'hostname', params['hostname'].value)
|
||||
|
||||
if 'selfdestruct' in sys.argv:
|
||||
DeleteInstallerThread()
|
||||
|
||||
@@ -114,6 +120,28 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
self.wfile.write(json.dumps({'status': 'ok'}))
|
||||
|
||||
|
||||
def set_debconf_selection(debconf_type, key, value):
|
||||
found = False
|
||||
with open('/etc/os-release', 'r') as f:
|
||||
for line in f:
|
||||
if 'debian' in line:
|
||||
found = True
|
||||
|
||||
if not found:
|
||||
return
|
||||
|
||||
ps = subprocess.Popen(['echo', 'dokku dokku/{0} {1} {2}'.format(
|
||||
key, debconf_type, value
|
||||
)], stdout=subprocess.PIPE)
|
||||
|
||||
try:
|
||||
subprocess.check_output(['debconf-set-selections'], stdin=ps.stdout)
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
|
||||
ps.wait()
|
||||
|
||||
|
||||
class DeleteInstallerThread(object):
|
||||
def __init__(self, interval=1):
|
||||
thread = threading.Thread(target=self.run, args=())
|
||||
|
||||
@@ -33,6 +33,14 @@ client_help_msg() {
|
||||
exit 20 # exit with specific status. only used in units tests for now
|
||||
}
|
||||
|
||||
is_git_repo() {
|
||||
git rev-parse &>/dev/null
|
||||
}
|
||||
|
||||
has_dokku_remote() {
|
||||
git remote show | grep dokku
|
||||
}
|
||||
|
||||
if [[ -z $DOKKU_HOST ]]; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
|
||||
@@ -79,11 +87,9 @@ if [[ ! -z $DOKKU_HOST ]]; then
|
||||
echo "! Dokku remote not added! Do you already have a dokku remote?"
|
||||
return
|
||||
fi
|
||||
git push dokku master
|
||||
return $?
|
||||
;;
|
||||
apps:destroy)
|
||||
git remote remove dokku
|
||||
is_git_repo && has_dokku_remote && git remote remove dokku
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
107
deb.mk
107
deb.mk
@@ -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.11
|
||||
HEROKUISH_VERSION ?= 0.3.13
|
||||
HEROKUISH_ARCHITECTURE = amd64
|
||||
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
|
||||
|
||||
@@ -8,27 +8,50 @@ DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash'
|
||||
DOKKU_REPO_NAME ?= dokku/dokku
|
||||
DOKKU_ARCHITECTURE = amd64
|
||||
|
||||
PLUGN_DESCRIPTION = 'Hook system that lets users extend your application with plugins'
|
||||
define PLUGN_DESCRIPTION
|
||||
Hook system that lets users extend your application with plugins
|
||||
Plugin triggers are simply scripts that are executed by the system.
|
||||
You can use any language you want, so long as the script is
|
||||
executable and has the proper language requirements installed
|
||||
endef
|
||||
PLUGN_REPO_NAME ?= dokku/plugn
|
||||
PLUGN_VERSION ?= 0.2.1
|
||||
PLUGN_ARCHITECTURE = amd64
|
||||
PLUGN_PACKAGE_NAME = plugn_$(PLUGN_VERSION)_$(PLUGN_ARCHITECTURE).deb
|
||||
PLUGN_URL = https://github.com/dokku/plugn/releases/download/v$(PLUGN_VERSION)/plugn_$(PLUGN_VERSION)_linux_x86_64.tgz
|
||||
|
||||
SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app'
|
||||
define SSHCOMMAND_DESCRIPTION
|
||||
Turn SSH into a thin client specifically for your app
|
||||
Simplifies running a single command over SSH, and
|
||||
manages authorized keys (ACL) and users in order to do so.
|
||||
endef
|
||||
SSHCOMMAND_REPO_NAME ?= dokku/sshcommand
|
||||
SSHCOMMAND_VERSION ?= 0.4.0
|
||||
SSHCOMMAND_ARCHITECTURE = amd64
|
||||
SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb
|
||||
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v$(SSHCOMMAND_VERSION)/sshcommand
|
||||
|
||||
SIGIL_DESCRIPTION = 'Standalone string interpolator and template processor'
|
||||
define SIGIL_DESCRIPTION
|
||||
Standalone string interpolator and template processor
|
||||
Sigil is a command line tool for template processing
|
||||
and POSIX-compliant variable expansion. It was created
|
||||
for configuration templating, but can be used for any
|
||||
text processing.
|
||||
endef
|
||||
SIGIL_REPO_NAME ?= gliderlabs/sigil
|
||||
SIGIL_VERSION ?= 0.4.0
|
||||
SIGIL_ARCHITECTURE = amd64
|
||||
SIGIL_PACKAGE_NAME = sigil_$(SIGIL_VERSION)_$(SIGIL_ARCHITECTURE).deb
|
||||
SIGIL_PACKAGE_NAME = gliderlabs_sigil_$(SIGIL_VERSION)_$(SIGIL_ARCHITECTURE).deb
|
||||
SIGIL_URL = https://github.com/gliderlabs/sigil/releases/download/v$(SIGIL_VERSION)/sigil_$(SIGIL_VERSION)_Linux_x86_64.tgz
|
||||
|
||||
ifndef IS_RELEASE
|
||||
IS_RELEASE = true
|
||||
endif
|
||||
|
||||
export PLUGN_DESCRIPTION
|
||||
export SIGIL_DESCRIPTION
|
||||
export SSHCOMMAND_DESCRIPTION
|
||||
|
||||
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-plugn deb-setup deb-sshcommand deb-sigil
|
||||
|
||||
install-from-deb:
|
||||
@@ -45,18 +68,18 @@ install-from-deb:
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -yy dokku
|
||||
|
||||
deb-all: deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil
|
||||
deb-all: deb-setup deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil
|
||||
mv /tmp/*.deb .
|
||||
@echo "Done"
|
||||
|
||||
deb-setup:
|
||||
@echo "-> Updating deb repository and installing build requirements"
|
||||
@sudo apt-get update -qq > /dev/null
|
||||
@sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y gcc git ruby-dev ruby1.9.1 > /dev/null 2>&1
|
||||
@sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y gcc git build-essential wget ruby-dev ruby1.9.1 lintian > /dev/null 2>&1
|
||||
@command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
|
||||
@ssh -o StrictHostKeyChecking=no git@github.com || true
|
||||
|
||||
deb-herokuish: deb-setup
|
||||
deb-herokuish:
|
||||
rm -rf /tmp/tmp /tmp/build $(HEROKUISH_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
@@ -83,19 +106,21 @@ deb-herokuish: deb-setup
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n herokuish -v $(HEROKUISH_VERSION) -a $(HEROKUISH_ARCHITECTURE) -p $(HEROKUISH_PACKAGE_NAME) --deb-pre-depends 'docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1)' --deb-pre-depends sudo --after-install /tmp/tmp/post-install --url "https://github.com/$(HEROKUISH_REPO_NAME)" --description $(HEROKUISH_DESCRIPTION) --license 'MIT License' .
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-dokku: deb-setup
|
||||
deb-dokku:
|
||||
rm -rf /tmp/tmp /tmp/build dokku_*_$(DOKKU_ARCHITECTURE).deb
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
cp -r debian /tmp/build/DEBIAN
|
||||
mkdir -p /tmp/build/usr/local/bin
|
||||
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
|
||||
mkdir -p /tmp/build/usr/share/man/man1
|
||||
mkdir -p /tmp/build/usr/share/dokku/contrib
|
||||
mkdir -p /tmp/build/usr/bin
|
||||
mkdir -p /tmp/build/usr/share/doc/dokku
|
||||
mkdir -p /tmp/build/usr/share/dokku/contrib
|
||||
mkdir -p /tmp/build/usr/share/lintian/overrides
|
||||
mkdir -p /tmp/build/usr/share/man/man1
|
||||
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
|
||||
|
||||
cp dokku /tmp/build/usr/local/bin
|
||||
cp dokku /tmp/build/usr/bin
|
||||
cp LICENSE /tmp/build/usr/share/doc/dokku/copyright
|
||||
find . -name ".DS_Store" -depth -exec rm {} \;
|
||||
cp -r plugins/* /tmp/build/var/lib/dokku/core-plugins/available
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/core-plugins/available/$$plugin/.core; done
|
||||
$(MAKE) help2man
|
||||
@@ -105,24 +130,38 @@ deb-dokku: deb-setup
|
||||
cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib
|
||||
git describe --tags > /tmp/build/var/lib/dokku/VERSION
|
||||
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
|
||||
ifneq (,$(findstring false,$(IS_RELEASE)))
|
||||
sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
|
||||
endif
|
||||
rm /tmp/build/DEBIAN/lintian-overrides
|
||||
mv debian/lintian-overrides /tmp/build/usr/share/lintian/overrides/dokku
|
||||
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
|
||||
sed -i "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control
|
||||
dpkg-deb --build /tmp/build "/vagrant/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
mv *.deb /tmp
|
||||
dpkg-deb --build /tmp/build "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
lintian "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
|
||||
deb-plugn: deb-setup
|
||||
deb-plugn:
|
||||
rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin
|
||||
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
|
||||
|
||||
@echo "-> Downloading package"
|
||||
wget -q -O /tmp/tmp/plugn-$(PLUGN_VERSION).tgz $(PLUGN_URL)
|
||||
cd /tmp/tmp/ && tar zxf /tmp/tmp/plugn-$(PLUGN_VERSION).tgz
|
||||
|
||||
@echo "-> Copying files into place"
|
||||
cp /tmp/tmp/plugn /tmp/build/usr/local/bin/plugn && chmod +x /tmp/build/usr/local/bin/plugn
|
||||
cp /tmp/tmp/plugn /tmp/build/usr/bin/plugn && chmod +x /tmp/build/usr/bin/plugn
|
||||
|
||||
@echo "-> Creating $(PLUGN_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n plugn -v $(PLUGN_VERSION) -a $(PLUGN_ARCHITECTURE) -p $(PLUGN_PACKAGE_NAME) --url "https://github.com/$(PLUGN_REPO_NAME)" --description $(PLUGN_DESCRIPTION) --license 'MIT License' .
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n plugn \
|
||||
--version $(PLUGN_VERSION) \
|
||||
--architecture $(PLUGN_ARCHITECTURE) \
|
||||
--package $(PLUGN_PACKAGE_NAME) \
|
||||
--url "https://github.com/$(PLUGN_REPO_NAME)" \
|
||||
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
|
||||
--category utils \
|
||||
--description "$$PLUGN_DESCRIPTION" \
|
||||
--license 'MIT License' \
|
||||
.
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-sshcommand:
|
||||
@@ -138,20 +177,38 @@ deb-sshcommand:
|
||||
chmod +x /tmp/build/usr/local/bin/sshcommand
|
||||
|
||||
@echo "-> Creating $(SSHCOMMAND_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n sshcommand -v $(SSHCOMMAND_VERSION) -a $(SSHCOMMAND_ARCHITECTURE) -p $(SSHCOMMAND_PACKAGE_NAME) --url "https://github.com/$(SSHCOMMAND_REPO_NAME)" --description $(SSHCOMMAND_DESCRIPTION) --license 'MIT License' .
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n sshcommand \
|
||||
--version $(SSHCOMMAND_VERSION) \
|
||||
--architecture $(SSHCOMMAND_ARCHITECTURE) \
|
||||
--package $(SSHCOMMAND_PACKAGE_NAME) \
|
||||
--url "https://github.com/$(SSHCOMMAND_REPO_NAME)" \
|
||||
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
|
||||
--category admin \
|
||||
--description "$$SSHCOMMAND_DESCRIPTION" \
|
||||
--license 'MIT License' \
|
||||
.
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-sigil: deb-setup
|
||||
deb-sigil:
|
||||
rm -rf /tmp/tmp /tmp/build $(SIGIL_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin
|
||||
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
|
||||
|
||||
@echo "-> Downloading package"
|
||||
wget -q -O /tmp/tmp/sigil-$(SIGIL_VERSION).tgz $(SIGIL_URL)
|
||||
cd /tmp/tmp/ && tar zxf /tmp/tmp/sigil-$(SIGIL_VERSION).tgz
|
||||
|
||||
@echo "-> Copying files into place"
|
||||
cp /tmp/tmp/sigil /tmp/build/usr/local/bin/sigil && chmod +x /tmp/build/usr/local/bin/sigil
|
||||
cp /tmp/tmp/sigil /tmp/build/usr/bin/sigil && chmod +x /tmp/build/usr/bin/sigil
|
||||
|
||||
@echo "-> Creating $(SIGIL_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n sigil -v $(SIGIL_VERSION) -a $(SIGIL_ARCHITECTURE) -p $(SIGIL_PACKAGE_NAME) --url "https://github.com/$(SIGIL_REPO_NAME)" --description $(SIGIL_DESCRIPTION) --license 'MIT License' .
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n gliderlabs-sigil \
|
||||
--version $(SIGIL_VERSION) \
|
||||
--architecture $(SIGIL_ARCHITECTURE) \
|
||||
--package $(SIGIL_PACKAGE_NAME) \
|
||||
--url "https://github.com/$(SIGIL_REPO_NAME)" \
|
||||
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
|
||||
--category utils \
|
||||
--description "$$SIGIL_DESCRIPTION" \
|
||||
--license 'MIT License' \
|
||||
.
|
||||
mv *.deb /tmp
|
||||
|
||||
8
debian/config
vendored
8
debian/config
vendored
@@ -1,6 +1,10 @@
|
||||
#!/bin/sh -e
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
. /usr/share/debconf/confmodule
|
||||
fi
|
||||
|
||||
readonly ACTION="${1:-configure}"
|
||||
readonly VERSION="${2:-dev}"
|
||||
|
||||
9
debian/control
vendored
9
debian/control
vendored
@@ -1,11 +1,12 @@
|
||||
Package: dokku
|
||||
Version: 0.5.5
|
||||
Version: 0.6.4
|
||||
Section: web
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: locales, git, make, curl, gcc, man-db, sshcommand, sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties
|
||||
Depends: locales, git, make, curl, gcc, man-db, sshcommand, gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties
|
||||
Recommends: herokuish
|
||||
Pre-Depends: nginx (>= 1.4.6), dnsutils, apparmor, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf
|
||||
Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf
|
||||
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
Description: Docker-powered PaaS that helps build and manage the lifecycle of applications
|
||||
|
||||
Dokku is an extensible, open source Platform as a Service
|
||||
that runs on a single server of your choice.
|
||||
|
||||
3
debian/lintian-overrides
vendored
Normal file
3
debian/lintian-overrides
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
dokku: command-with-path-in-maintainer-script postinst:16 /usr/bin/sshcommand
|
||||
dokku: maintainer-script-calls-systemctl postinst:87
|
||||
dokku: changelog-file-missing-in-native-package
|
||||
28
debian/postinst
vendored
28
debian/postinst
vendored
@@ -1,11 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
. /usr/share/debconf/confmodule
|
||||
fi
|
||||
|
||||
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
|
||||
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
|
||||
|
||||
call-sshcommand() {
|
||||
if [[ -x /usr/local/bin/sshcommand ]]; then
|
||||
/usr/local/bin/sshcommand "$@"
|
||||
elif [[ -x /usr/bin/sshcommand ]]; then
|
||||
/usr/bin/sshcommand "$@"
|
||||
else
|
||||
echo "Unable to find sshcommand binary" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
@@ -14,7 +28,8 @@ case "$1" in
|
||||
mandb
|
||||
[ ! -x /usr/bin/docker.io ] || ln -sf /usr/bin/docker.io /usr/local/bin/docker
|
||||
modprobe aufs || echo "WARNING: Restart server to finish installing dokku!"
|
||||
sshcommand create dokku /usr/local/bin/dokku
|
||||
call-sshcommand create dokku /usr/bin/dokku
|
||||
|
||||
egrep -i "^docker" /etc/group || groupadd docker
|
||||
usermod -aG docker dokku
|
||||
|
||||
@@ -50,6 +65,13 @@ case "$1" in
|
||||
find -L ${DOKKU_LIB_ROOT} -type l -delete
|
||||
chown dokku:dokku -R ${DOKKU_LIB_ROOT}/plugins ${DOKKU_LIB_ROOT}/core-plugins
|
||||
|
||||
echo "Ensure proper sshcommand path"
|
||||
echo '/usr/bin/dokku' > "${DOKKU_ROOT}/.sshcommand"
|
||||
if [[ -f .ssh/authorized_keys ]]; then
|
||||
sed -i.bak 's#/usr/local/bin/dokku#/usr/bin/dokku#' "${DOKKU_ROOT}/.ssh/authorized_keys"
|
||||
rm "${DOKKU_ROOT}/.ssh/authorized_keys"
|
||||
fi
|
||||
|
||||
echo "Install all core plugins"
|
||||
dokku plugin:install --core
|
||||
|
||||
@@ -92,7 +114,7 @@ case "$1" in
|
||||
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
|
||||
db_get "dokku/key_file"
|
||||
if [ -f "$RET" ]; then
|
||||
sshcommand acl-add dokku default < "$RET" || true
|
||||
call-sshcommand acl-add dokku default < "$RET" || true
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
16
debian/postrm
vendored
16
debian/postrm
vendored
@@ -1,8 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
. /usr/share/debconf/confmodule
|
||||
fi
|
||||
|
||||
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
|
||||
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
|
||||
readonly DOKKU_LOGS_DIR="${DOKKU_LOGS_DIR:="/var/log/dokku"}"
|
||||
|
||||
main() {
|
||||
if [[ -f /etc/systemd/system/dokku-installer.conf ]] || [[ -f /etc/init/dokku-installer.conf ]]; then
|
||||
@@ -35,10 +41,12 @@ main() {
|
||||
find ${DOKKU_ROOT} -type d -empty -delete
|
||||
fi
|
||||
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
. /usr/share/debconf/confmodule
|
||||
db_purge
|
||||
fi
|
||||
rm -rf "${DOKKU_LOGS_DIR}"
|
||||
|
||||
deluser dokku || true
|
||||
delgroup dokku || true
|
||||
|
||||
db_purge
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
5
debian/preinst
vendored
5
debian/preinst
vendored
@@ -1,7 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail; [[ $TRACE ]] && set -x
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
if [[ -e /usr/share/debconf/confmodule ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
. /usr/share/debconf/confmodule
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
install)
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
You can always install dokku straight from the latest - potentially unstable - master release via the following bash command:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash
|
||||
# using a branch results in installing from source
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh
|
||||
sudo DOKKU_BRANCH=master bash bootstrap.sh
|
||||
```
|
||||
|
||||
## Development
|
||||
@@ -46,6 +48,8 @@ sudo BUILD_STACK=true STACK_URL=https://github.com/gliderlabs/herokuish.git make
|
||||
|
||||
Once dokku is installed, if you are not using the web-installer, you'll want to configure a the virtualhost setup as well as the push user. If you do not, your installation will be considered incomplete and you will not be able to deploy applications.
|
||||
|
||||
*You should also stop and disable the `dokku-installer` service to remove public access to adding SSH keys.*
|
||||
|
||||
Set up a domain and a wildcard domain pointing to that host. Make sure `/home/dokku/VHOST` is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (`dig +short $(hostname -f)`). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, dokku will publish the app with a port number (i.e. `http://example.com:49154` - note the missing subdomain).
|
||||
|
||||
Follow the [user management documentation](/dokku/deployment/user-management) in order to add users to dokku.
|
||||
|
||||
32
docs/appendices/0.6.0-migration-guide.md
Normal file
32
docs/appendices/0.6.0-migration-guide.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# 0.6.0 Migration Guide
|
||||
|
||||
## zero-downtime deployment
|
||||
|
||||
- You can now **actually** disable zero-downtime deployments per-app and per-process-type
|
||||
- Some config variables have been moved around
|
||||
- `DOKKU_CHECKS_ENABLED` has been migrated to `DOKKU_CHECKS_SKIPPED`
|
||||
- `DOKKU_CHECKS_DISABLED` is now a thing
|
||||
- The values for the above can be a comma-separated list of process-types or the literal string `_all_`
|
||||
- See the [updated `checks`](/dokku/checks-examples/) docs for more info
|
||||
|
||||
## proxy port mapping
|
||||
|
||||
- You can now configure host -> container proxy port mappings
|
||||
- The UI is handled by the [proxy](/dokku/proxy/) interface plugin by setting the `DOKKU_PROXY_PORT_MAP` config variable in the format of `scheme:host-port:container-port`. The default `nginx-vhosts` proxy plugin supports both the `http` and `https` schemes.
|
||||
- Default port mappings
|
||||
- buildpack apps will be set to `http:80:5000` and will also include `https:443:5000` if SSL is enabled.
|
||||
- dockerfile apps with explicitly exposed ports (i.e. using the `EXPOSE` directive) will be configured with a listener on each exposed port that proxies to the same port of the deployed application container.
|
||||
- You may override this behavior with the [`proxy:ports-*` commands](/dokku/proxy/) or by directly setting `DOKKU_PROXY_PORT_MAP` with the `config:set` command
|
||||
- dockerfile apps without explicitly exposed ports will behave the same as a buildpack app
|
||||
- NOTE: These defaults **are not** automatically changed on subsequent pushes and must be manipulated with the aforementioned commands
|
||||
|
||||
## calling the dokku binary
|
||||
|
||||
- Plugins should *not* call the dokku binary directly. Clients using the `--app` argument are potentially broken, amongst others, when doing so. Instead, please source the `functions` file for a given plugin when attempting to call dokku internal functions. As a result, the following dokku commands are no longer publicly exposed:
|
||||
- dokku build
|
||||
- dokku receive
|
||||
- dokku release
|
||||
- dokku tar:build
|
||||
- dokku tar:build-locked
|
||||
- dokku git:build
|
||||
- dokku git:build-locked
|
||||
@@ -182,11 +182,11 @@ 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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
### Adding deploy users
|
||||
## Adding deploy users
|
||||
|
||||
See the [user management documentation](/dokku/deployment/user-management).
|
||||
|
||||
@@ -198,7 +198,7 @@ See the [nginx documentation](/dokku/nginx/#default-site).
|
||||
|
||||
See the [dockerfile documentation](/dokku/deployment/dockerfiles/).
|
||||
|
||||
### Specifying a custom buildpack
|
||||
## Specifying a custom buildpack
|
||||
|
||||
See the [buildpack documentation](/dokku/deployment/buildpacks/).
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/mstile-70x70.png"/>
|
||||
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/mstile-150x150.png"/>
|
||||
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/mstile-310x310.png"/>
|
||||
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/mstile-310x150.png"/>
|
||||
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-70x70.png"/>
|
||||
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-150x150.png"/>
|
||||
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-310x310.png"/>
|
||||
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-310x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
|
||||
@@ -2,37 +2,37 @@
|
||||
"name": "Dokku",
|
||||
"icons": [
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.5\/docs\/assets\/favicons\/android-chrome-36x36.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-36x36.png",
|
||||
"sizes": "36x36",
|
||||
"type": "image\/png",
|
||||
"density": "0.75"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.5\/docs\/assets\/favicons\/android-chrome-48x48.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-48x48.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image\/png",
|
||||
"density": "1.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.5\/docs\/assets\/favicons\/android-chrome-72x72.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image\/png",
|
||||
"density": "1.5"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.5\/docs\/assets\/favicons\/android-chrome-96x96.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image\/png",
|
||||
"density": "2.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.5\/docs\/assets\/favicons\/android-chrome-144x144.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image\/png",
|
||||
"density": "3.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.5.5\/docs\/assets\/favicons\/android-chrome-192x192.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.6.4\/docs\/assets\/favicons\/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image\/png",
|
||||
"density": "4.0"
|
||||
|
||||
@@ -36,13 +36,13 @@ h1 {
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.header .navbar-brand a {
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/dokku.png);
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/dokku.png);
|
||||
text-indent: 40px;
|
||||
}
|
||||
.blurb {
|
||||
color: #424242;
|
||||
background-color: #ededed;
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/gplaypattern.png);
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/gplaypattern.png);
|
||||
padding: 45px 0;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -230,6 +230,15 @@ a.list-group-item {
|
||||
margin-top: 2em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.table-of-contents {
|
||||
font-size: 0.8em;
|
||||
padding: 1em;
|
||||
margin: 0 0 0.5em 0.5em;
|
||||
}
|
||||
.table-of-contents ul {
|
||||
margin-bottom: 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.anchorjs-link {
|
||||
color: #24cbce;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"max-versions": [
|
||||
"0.3.26",
|
||||
"0.4.14",
|
||||
"0.5.5"
|
||||
"0.5.8",
|
||||
"0.6.4"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
> New as of 0.5.0
|
||||
|
||||
```
|
||||
checks <app> Show zero-downtime status
|
||||
checks:disable <app> Disable zero-downtime checks
|
||||
checks:enable <app> Enable zero-downtime checks
|
||||
checks <app> Show zero-downtime status
|
||||
checks:disable <app> [process-type(s)] Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)] Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
checks:skip <app> [process-type(s)] Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
```
|
||||
|
||||
Following a deploy, dokku will wait `10` seconds before routing traffic to the new container to give your application time to boot up. If the application is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value globally or on a per-application basis:
|
||||
@@ -15,10 +16,32 @@ dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30
|
||||
dokku config:set <app> DOKKU_DEFAULT_CHECKS_WAIT=30
|
||||
```
|
||||
|
||||
You can also choose to skip checks completely on a per-application basis:
|
||||
You can also choose to skip checks or disable zero-downtime completely on a per-application/per-process basis:
|
||||
|
||||
```shell
|
||||
dokku checks:disable <app>
|
||||
dokku checks:skip <app> worker,web
|
||||
```
|
||||
|
||||
```shell
|
||||
dokku checks:disable <app> worker,web
|
||||
```
|
||||
> Note that `checks:disable` will now (as of 0.6.0) cause downtime for that process-type during deployments.
|
||||
|
||||
Additionally, any given process can only be configured to skip OR disable zero-downtime. example:
|
||||
|
||||
```shell
|
||||
$ dokku checks:skip testapp worker,web
|
||||
-----> Skipping zero downtime for app's (testapp) proctypes (worker,web)
|
||||
-----> Unsetting testapp
|
||||
-----> Unsetting DOKKU_CHECKS_DISABLED
|
||||
-----> Setting config vars
|
||||
DOKKU_CHECKS_SKIPPED: worker,web
|
||||
$ dokku checks:disable testapp worker
|
||||
-----> Disabling zero downtime for app's (testapp) proctypes (worker)
|
||||
-----> Setting config vars
|
||||
DOKKU_CHECKS_DISABLED: worker
|
||||
-----> Setting config vars
|
||||
DOKKU_CHECKS_SKIPPED: web
|
||||
```
|
||||
|
||||
Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. You can modify this value globally or on a per-application basis:
|
||||
@@ -34,6 +57,8 @@ dokku config:set <app> DOKKU_WAIT_TO_RETIRE=120
|
||||
|
||||
If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not.
|
||||
|
||||
Checks are run against the detected `web` process from your application's `Procfile`. For non-web processes, dokku will fallback to the aforementioned process uptime check.
|
||||
|
||||
To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file should be plain text and may contain:
|
||||
|
||||
* Check instructions
|
||||
@@ -272,8 +297,15 @@ Could not start due to 1 failed checks.
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection
|
||||
=====> end myapp container output
|
||||
/usr/local/bin/dokku: line 49: 23409 Killed dokku deploy "$APP"
|
||||
/usr/bin/dokku: line 49: 23409 Killed dokku deploy "$APP"
|
||||
To dokku@dokku.example.com:myapp
|
||||
! [remote rejected] dokku -> master (pre-receive hook declined)
|
||||
error: failed to push some refs to 'dokku@dokku.example.com:myapp'
|
||||
````
|
||||
|
||||
### Configuring docker stop timeout
|
||||
|
||||
[By default](https://docs.docker.com/engine/reference/commandline/stop/), docker will wait 10 seconds from the time the `stop` command is passed to a container before it attempts to kill said container. This timeout can be configured on a per-app basis in dokku by setting the `DOKKU_DOCKER_STOP_TIMEOUT` configuration variable. This timeout applies to normal zero-downtime deployments as well as the `ps:stop` and `apps:destroy` commands.
|
||||
```
|
||||
$ dokku config:set $APP DOKKU_DOCKER_STOP_TIMEOUT=20
|
||||
```
|
||||
|
||||
@@ -13,6 +13,8 @@ config:unset (<app>|--global) KEY1 [KEY2 ...] Unset one or more conf
|
||||
|
||||
The variables are available both at run time and during the application build/compilation step for buildpack-based deploys. For security reasons - and as per [docker recommendations](https://github.com/docker/docker/issues/13490) - Dockerfile-based deploys have variables available *only* during runtime, as noted in [this issue](https://github.com/dokku/dokku/issues/1860).
|
||||
|
||||
For buildpack deploys, Dokku will create a `/app/.env` file that can be used for legacy buildpacks. Note that this is *not* updated when `config:set` or `config:unset` is called, and is only written during a `deploy` or `ps:rebuild`. Developers are encouraged to instead read from the application environment directly, as the proper values will be available then.
|
||||
|
||||
> Note: Global `ENV` files are sourced before app-specific `ENV` files. This means that app-specific variables will take precedence over global variables. Configuring your global `ENV` file is manual, and should be considered potentially dangerous as configuration applies to all applications.
|
||||
|
||||
You can set multiple environment variables at once:
|
||||
|
||||
@@ -4,6 +4,7 @@ Dokku normally defaults to using [heroku buildpacks](https://devcenter.heroku.co
|
||||
|
||||
- Use `dokku config:set` to set the `BUILDPACK_URL` environment variable.
|
||||
- Add `BUILDPACK_URL` to a committed `.env` file in the root of your repository.
|
||||
- See the [environment variable documentation](/dokku/configuration-management/) for more details.
|
||||
- Create a `.buildpacks` file in the root of your repository.
|
||||
|
||||
## Specifying a custom buildpack
|
||||
@@ -56,6 +57,31 @@ You may also wish to use a **specific** version of a buildpack, which is also si
|
||||
dokku config:set APP BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#v87
|
||||
```
|
||||
|
||||
## Specifying commands via Procfile
|
||||
|
||||
While many buildpacks have a default command that is run when a detected repository is pushed, it is possible to override this command via a Procfile. A Procfile can also be used to specify multiple commands, each of which is subject to process scaling. See the [process scaling documentation](/dokku/process-management/) for more details around scaling individual processes.
|
||||
|
||||
A Procfile is a file named `Procfile`. It should be named `Procfile` exactly, and not anything else. For example, `Procfile.txt` is not valid. The file should be a simple text file.
|
||||
|
||||
The file must be placed in the root directory of your application. It will not function if placed in a subdirectory.
|
||||
|
||||
If the file exists, it should not be empty, as doing so may result in a failed deploy.
|
||||
|
||||
The syntax for declaring a `Procfile` is as follows. Note that the format is one process type per line, with no duplicate process types.
|
||||
|
||||
```
|
||||
<process type>: <command>
|
||||
```
|
||||
|
||||
If, for example, you have multiple queue workers and wish to scale them separately, the following would be a valid way to work around the requirement of not duplicating process types:
|
||||
|
||||
```
|
||||
worker: env QUEUE=* bundle exec rake resque:work
|
||||
importantworker: env QUEUE=important bundle exec rake resque:work
|
||||
```
|
||||
|
||||
The `web` process type holds some significance in that it is the only process type that is automatically scaled to `1` on the initial application deploy. See the [process scaling documentation](/dokku/process-management/) for more details around scaling individual processes.
|
||||
|
||||
## Clearing buildpack cache
|
||||
|
||||
Building containers with buildpacks currently results in a persistent `cache` directory between deploys. If you need to clear this cache directory for any reason, you may do so by running the following shell command:
|
||||
@@ -65,7 +91,7 @@ Building containers with buildpacks currently results in a persistent `cache` di
|
||||
sudo rm -rf /home/dokku/APP/cache/*
|
||||
```
|
||||
|
||||
### Curl Build Timeouts
|
||||
## Curl Build Timeouts
|
||||
|
||||
Certain buildpacks may time out in retrieving dependencies via curl. This can happen when your network connection is poor or if there is significant network congestion. You may see a message similar to `gzip: stdin: unexpected end of file` after a curl command.
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
While Dokku normally defaults to using [heroku buildpacks](https://devcenter.heroku.com/articles/buildpacks) for deployment, you can also use docker's native `Dockerfile` system to define a container.
|
||||
|
||||
> Dockerfile support is considered a **Power User** feature. By using Dockerfile-based deployment, you agree that you will not have the same comfort as that enjoyed by Buildpack users, and Dokku features may work differently. Differences between the two systems will be documented here.
|
||||
|
||||
To use a dockerfiles for deployment, commit a valid `Dockerfile` to the root of your repository and push the repository to your Dokku installation. If this file is detected, Dokku will default to using it to construct containers **except** in the following two cases:
|
||||
|
||||
- The application has a `BUILDPACK_URL` environment variable set via the `dokku config:set` command or in a committed `.env` file. In this case, Dokku will use your specified buildpack.
|
||||
|
||||
@@ -14,21 +14,21 @@ tags:destroy <app> <tag> Remove app image tag
|
||||
Example:
|
||||
|
||||
```
|
||||
root@dokku:~# dokku tags node-js-app
|
||||
$ dokku tags node-js-app
|
||||
=====> Image tags for dokku/node-js-app
|
||||
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
||||
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
|
||||
|
||||
root@dokku:~# dokku tags:create node-js-app v0.9.0
|
||||
$ dokku tags:create node-js-app v0.9.0
|
||||
=====> Added v0.9.0 tag to dokku/node-js-app
|
||||
|
||||
root@dokku:~# dokku tags node-js-app
|
||||
$ dokku tags node-js-app
|
||||
=====> Image tags for dokku/node-js-app
|
||||
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
||||
dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB
|
||||
dokku/node-js-app v0.9.0 936a42f25901 About a minute ago 1.025 GB
|
||||
|
||||
root@dokku:~# dokku tags:deploy node-js-app v0.9.0
|
||||
$ dokku tags:deploy node-js-app v0.9.0
|
||||
-----> Releasing node-js-app (dokku/node-js-app:v0.9.0)...
|
||||
-----> Deploying node-js-app (dokku/node-js-app:v0.9.0)...
|
||||
-----> Running pre-flight checks
|
||||
@@ -55,3 +55,70 @@ root@dokku:~# dokku tags:deploy node-js-app v0.9.0
|
||||
http://node-js-app.dokku.me
|
||||
|
||||
```
|
||||
|
||||
## Deploying from a Docker Registry
|
||||
|
||||
You can alternatively add image pulled from a docker Registry and deploy app from it by using tagging feature. In this example, we are deploying from Docker Hub.
|
||||
|
||||
1. Create dokku app as usual
|
||||
|
||||
```shell
|
||||
dokku apps:create test-app
|
||||
```
|
||||
|
||||
2. Pull image from Docker Hub
|
||||
|
||||
```shell
|
||||
docker pull demo-repo/some-image:v12
|
||||
```
|
||||
|
||||
3. Retag the image to match the created app
|
||||
|
||||
```shell
|
||||
docker tag demo-repo/some-image:v12 dokku/test-app:v12
|
||||
```
|
||||
|
||||
4. Deploy tag
|
||||
|
||||
```shell
|
||||
dokku tags:deploy test-app v12
|
||||
```
|
||||
|
||||
> Note: When deploying an image, we will use `docker inspect` to extract the `ExposedPorts` configuration and if defined, use that to populate `DOKKU_DOCKERFILE_PORTS`. If this behavior is not desired, you can override that configuration variable with the `config:set` command.
|
||||
> Example: `dokku config:set test-app DOKKU_DOCKERFILE_PORTS="5984/tcp 80/tcp"`
|
||||
|
||||
## Deploying an image from CI
|
||||
|
||||
To ensure your builds are always reproducible, it's considered bad practice to store build
|
||||
artifacts in your repository. For some projects however, building artifacts during deployment
|
||||
to dokku may affect the performance of running applications.
|
||||
|
||||
One solution is to build a finished Docker image on a CI service (or even locally) and deploy
|
||||
it directly to the host running dokku.
|
||||
|
||||
1. Build image on CI (or locally)
|
||||
|
||||
```shell
|
||||
docker build -t dokku/test-app:v12
|
||||
# Note: The image must be tagged `dokku/<app-name>:<version>`
|
||||
```
|
||||
|
||||
2. Deploy image to dokku host
|
||||
|
||||
```shell
|
||||
docker save dokku/test-app:v12 | ssh my.dokku.host "docker load | dokku tags:deploy test-app v12"
|
||||
```
|
||||
|
||||
> Note: You can also use a Docker Registry to push and pull
|
||||
> the image rather than uploading it directly.
|
||||
|
||||
Here's a more complete example using the above method:
|
||||
|
||||
```shell
|
||||
# build the image
|
||||
docker build -t dokku/test-app:v12
|
||||
# copy the image to the dokku host
|
||||
docker save dokku/test-app:v12 | bzip2 | ssh my.dokku.host "bunzip2 | docker load"
|
||||
# tag and deploy the image
|
||||
ssh my.dokku.host "dokku tags:create test-app previous; dokku tags:deploy test-app v12 && dokku tags:create test-app latest"
|
||||
```
|
||||
|
||||
@@ -15,6 +15,17 @@ The `run` command can be used to run a one-off process for a specific command. T
|
||||
dokku run node-js-app ls -lah
|
||||
```
|
||||
|
||||
The `run` command can also be used to run a command defined in your Procfile:
|
||||
|
||||
```
|
||||
console: bundle exec racksh
|
||||
```
|
||||
|
||||
```shell
|
||||
# runs `bundle exec racksh` in the `/app` directory of the application `my-app`
|
||||
dokku run my-app console
|
||||
```
|
||||
|
||||
If you want to remove the container after a command has started, you can run the following command:
|
||||
|
||||
```shell
|
||||
@@ -32,6 +43,15 @@ dokku --rm-container run node-js-app ls -lah
|
||||
dokku --rm run node-js-app ls -lah
|
||||
```
|
||||
|
||||
Finally, you may wish to run a container in "detached" mode via the `--detach` dokku flag. Running a process in detached mode will immediately return a `CONTAINER_ID`. It is up to the user to then further manage this container in whatever manner they see fit, as dokku will *not* automatically terminate the container.
|
||||
|
||||
```shell
|
||||
dokku --detach run node-js-app ls -lah
|
||||
# returns the ID of the new container
|
||||
```
|
||||
|
||||
> Note that you may not use the `--rm-container` or `--rm` flags when running containers in detached mode, and attempting to do so will result in the `--detach` flag being ignored.
|
||||
|
||||
### Using `run` for cron tasks
|
||||
|
||||
You can always use a one-off container to run an application task:
|
||||
@@ -59,6 +79,8 @@ dokku enter node-js-app web.1
|
||||
dokku enter node-js-app --container-id ID
|
||||
```
|
||||
|
||||
Additionally, you can run `enter` with no container-type. If only a single container-type is defined in your app, you will be dropped into the only running container. This behavior is not supported when specifying a custom command; as described below.
|
||||
|
||||
By default, it runs a `/bin/bash`, but can also be used to run a custom command:
|
||||
|
||||
```shell
|
||||
@@ -74,7 +96,7 @@ dokku enter node-js-app web python script/background-worker.py
|
||||
Your procfile can have the following entry:
|
||||
|
||||
```
|
||||
cron: while true; do sleep 10; done
|
||||
cron: sleep infinity
|
||||
```
|
||||
|
||||
With the `cron` process scaled to `1`:
|
||||
|
||||
@@ -54,7 +54,7 @@ If you decide to obtain a CA signed certficate, you can import that certificate
|
||||
The `certs:info` command will simply inspect the install SSL cert and print out details. NOTE: The server-wide certificate will be inspect if installed and no app-specific certificate exists.
|
||||
|
||||
```
|
||||
root@dokku:~/dokku# dokku certs:info node-js-app
|
||||
$ dokku certs:info node-js-app
|
||||
-----> Fetching SSL Endpoint info for node-js-app...
|
||||
-----> Certificate details:
|
||||
=====> Common Name(s):
|
||||
@@ -84,12 +84,6 @@ Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarde
|
||||
If your server runs behind an HTTP/S load balancer, then Nginx will see all requests as coming from the load balancer. If your load balancer sets the `X-Forwarded-` headers, you can tell Nginx to pass these headers from load balancer to your application by using the following [nginx custom template](/dokku/nginx/#customizing-the-nginx-configuration)
|
||||
|
||||
```shell
|
||||
upstream {{ .APP }} {
|
||||
{{ range .DOKKU_APP_LISTENERS | split " " }}
|
||||
server {{ . }};
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:{{ .NGINX_PORT }};
|
||||
listen {{ .NGINX_PORT }};
|
||||
@@ -113,6 +107,12 @@ server {
|
||||
}
|
||||
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
|
||||
}
|
||||
|
||||
upstream {{ .APP }} {
|
||||
{{ range .DOKKU_APP_LISTENERS | split " " }}
|
||||
server {{ . }};
|
||||
{{ end }}
|
||||
}
|
||||
```
|
||||
|
||||
Only use this option if:
|
||||
|
||||
@@ -155,3 +155,4 @@ A few notes:
|
||||
- From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files.
|
||||
- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](/dokku/development/plugin-triggers) doc for examples.
|
||||
- As of 0.5.0, we use container labels to help cleanup intermediate containers with `dokku cleanup`. If manually calling `docker run`, include `$DOKKU_GLOBAL_RUN_ARGS`. This will ensure you intermediate containers labeled correctly.
|
||||
- As of 0.6.0, we advise you to *not* call the dokku binary directly from within plugins. Clients using the `--app` argument are potentially broken, amongst other issues, when doing so. Instead, please source the `functions` file for a given plugin when attempting to call dokku internal functions
|
||||
|
||||
@@ -29,69 +29,64 @@ The following plugin triggers describe those available to a dokku installation.
|
||||
|
||||
> The example plugin trigger code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples.
|
||||
|
||||
### `install`
|
||||
### `post-config-update`
|
||||
|
||||
- Description: Used to setup any files/configuration for a plugin.
|
||||
- Invoked by: `dokku plugin:install`.
|
||||
- Arguments: None
|
||||
- Description: Allows you to get notified when one or more configs is added or removed. Action can be *set* or *unset*
|
||||
- Invoked by: `dokku config:set`, `dokku config:unset`
|
||||
- Arguments: `$APP` `set|unset` `key1=VALUE1 key2=VALUE2`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Sets the hostname of the dokku server
|
||||
# based on the output of `hostname -f`
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
hostname -f > $DOKKU_ROOT/HOSTNAME
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `bind-external-ip`
|
||||
|
||||
- Description: Allows you to disable binding to the external box ip
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Force always binding to the docker ip, no matter
|
||||
# what the settings are for a given app.
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
echo false
|
||||
```
|
||||
|
||||
### `check-deploy`
|
||||
|
||||
- Description: Allows you to run checks on a deploy before dokku allows the container to handle requests.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$CONTAINER_ID $APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Disables deploys of containers based on whether the
|
||||
# `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
|
||||
|
||||
eval "$(config_export app $APP)"
|
||||
DOKKU_DISABLE_DEPLOY="${DOKKU_DISABLE_DEPLOY:-false}"
|
||||
|
||||
if [[ "$DOKKU_DISABLE_DEPLOY" = "true" ]]; then
|
||||
echo -e "\033[31m\033[1mDeploys disabled, sorry.\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
### `dependencies`
|
||||
|
||||
- Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`.
|
||||
- Invoked by: `dokku plugin:install-dependencies`
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs nginx for the current plugin
|
||||
# Supports both opensuse and ubuntu
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
debian|ubuntu)
|
||||
apt-get install --force-yes -qq -y nginx
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
zypper -q in -y nginx
|
||||
;;
|
||||
esac
|
||||
```
|
||||
|
||||
### `update`
|
||||
|
||||
- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates.
|
||||
- Invoked by: `dokku plugin:update`.
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Update the herokuish image from git source
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cd /root/dokku
|
||||
sudo BUILD_STACK=true make install
|
||||
```
|
||||
|
||||
### `comands help` and `commands <PLUGIN_NAME>: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.
|
||||
@@ -139,10 +134,37 @@ help_content
|
||||
esac
|
||||
```
|
||||
|
||||
### `pre-build-buildpack`
|
||||
### `dependencies`
|
||||
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildpacks.
|
||||
- Invoked by: `dokku build`
|
||||
- Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`.
|
||||
- Invoked by: `dokku plugin:install-dependencies`
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs nginx for the current plugin
|
||||
# Supports both opensuse and ubuntu
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
debian|ubuntu)
|
||||
apt-get install --force-yes -qq -y nginx
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
zypper -q in -y nginx
|
||||
;;
|
||||
esac
|
||||
```
|
||||
|
||||
### `deployed-app-image-tag`
|
||||
|
||||
- Description: Used to manage the tag of the image being deployed. Useful for deploying a specific version of an image, or when deploying from an external registry
|
||||
- Invoked by: `internal function dokku_deploy_cmd() (deploy phase)`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
@@ -151,13 +173,14 @@ esac
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
# customize the tag version
|
||||
echo 'not-latest'
|
||||
```
|
||||
|
||||
### `post-build-buildpack`
|
||||
### `deployed-app-repository`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildpacks.
|
||||
- Invoked by: `dokku build`
|
||||
- Description: Used to manage the remote repository of the image being deployed.
|
||||
- Invoked by: `internal function dokku_deploy_cmd() (deploy phase)`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
@@ -166,278 +189,13 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-release-buildpack`
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs the graphicsmagick package into the container
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1" Installing GraphicsMagick..."
|
||||
|
||||
CMD="cat > gm && \
|
||||
dpkg -s graphicsmagick > /dev/null 2>&1 || \
|
||||
(apt-get update && apt-get install -y graphicsmagick && apt-get clean)"
|
||||
|
||||
ID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
||||
test $(docker wait $ID) -eq 0
|
||||
docker commit $ID $IMAGE > /dev/null
|
||||
```
|
||||
|
||||
### `post-release-buildpack`
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs a package specified by the `CONTAINER_PACKAGE` env var
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1" Installing $CONTAINER_PACKAGE..."
|
||||
|
||||
CMD="cat > gm && \
|
||||
dpkg -s CONTAINER_PACKAGE > /dev/null 2>&1 || \
|
||||
(apt-get update && apt-get install -y CONTAINER_PACKAGE && apt-get clean)"
|
||||
|
||||
ID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
||||
test $(docker wait $ID) -eq 0
|
||||
docker commit $ID $IMAGE > /dev/null
|
||||
```
|
||||
|
||||
### `pre-release-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-release-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `check-deploy`
|
||||
|
||||
- Description: Allows you to run checks on a deploy before dokku allows the container to handle requests.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$CONTAINER_ID $APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Disables deploys of containers based on whether the
|
||||
# `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
|
||||
|
||||
eval "$(config_export app $APP)"
|
||||
DOKKU_DISABLE_DEPLOY="${DOKKU_DISABLE_DEPLOY:-false}"
|
||||
|
||||
if [[ "$DOKKU_DISABLE_DEPLOY" = "true" ]]; then
|
||||
echo -e "\033[31m\033[1mDeploys disabled, sorry.\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
### `pre-deploy`
|
||||
|
||||
- Description: Allows the running of code before the container's process is started.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs gulp in our container
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1 "Running gulp"
|
||||
id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $IMAGE /bin/bash -c "cd /app && gulp default")
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
dokku_log_info1 "Building UI Complete"
|
||||
```
|
||||
|
||||
### `post-create`
|
||||
|
||||
- Description: Can be used to run commands after an application is created.
|
||||
- Invoked by: `dokku apps:create`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs a command to ensure that an app
|
||||
# has a postgres database when it is starting
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1";
|
||||
POSTGRES="$1"
|
||||
|
||||
dokku postgres:create $POSTGRES
|
||||
dokku postgres:link $POSTGRES $APP
|
||||
```
|
||||
|
||||
### `post-deploy`
|
||||
|
||||
- Description: Allows running of commands after a deploy has completed. Dokku core currently uses this to switch traffic on nginx.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Notify an external service that a successful deploy has occurred.
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
curl "http://httpstat.us/200"
|
||||
```
|
||||
|
||||
### `pre-delete`
|
||||
|
||||
- Description: Can be used to run commands before an app is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Clears out the gulp asset build cache for applications
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ -d $GULP_CACHE_DIR ]]; then
|
||||
docker run $DOKKU_GLOBAL_RUN_ARGS --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
fi
|
||||
```
|
||||
|
||||
### `post-delete`
|
||||
|
||||
- Description: Can be used to run commands after an application is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs a command to ensure that an app's
|
||||
# postgres installation is removed
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1";
|
||||
|
||||
dokku postgres:destroy $APP
|
||||
```
|
||||
|
||||
### `post-stop`
|
||||
|
||||
- Description: Can be used to run commands after an application is manually stopped
|
||||
- Invoked by: `dokku ps:stop`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Marks an application as manually stopped
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1";
|
||||
|
||||
dokku config:set --no-restart $APP MANUALLY_STOPPED=1
|
||||
echo 'derp.dkr.ecr.us-east-1.amazonaws.com'
|
||||
```
|
||||
|
||||
### `docker-args-build`
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku build`
|
||||
- Invoked by: `internal function dokku_build() (build phase)`
|
||||
- Arguments: `$APP $IMAGE_SOURCE_TYPE`
|
||||
- Example:
|
||||
|
||||
@@ -485,38 +243,19 @@ verify_app_name "$APP"
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `bind-external-ip`
|
||||
### `git-post-pull`
|
||||
|
||||
- Description: Allows you to disable binding to the external box ip
|
||||
- Invoked by: `dokku deploy`
|
||||
- Description:
|
||||
- Invoked by: `dokku git-upload-pack`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Force always binding to the docker ip, no matter
|
||||
# what the settings are for a given app.
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
echo false
|
||||
```
|
||||
|
||||
### `post-domains-update`
|
||||
|
||||
- Description: Allows you to run commands once the domain for an application has been updated. It also sends in the command that has been used. This can be "add", "clear" or "remove". The third argument will be the optional list of domains
|
||||
- Invoked by: `dokku domains:add`, `dokku domains:clear`, `dokku domains:remove`
|
||||
- Arguments: `$APP` `action name` `domains`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Reloads haproxy for our imaginary haproxy plugin
|
||||
# that replaces the nginx-vhosts plugin
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
sudo service haproxy reload
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `git-pre-pull`
|
||||
@@ -534,19 +273,23 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `git-post-pull`
|
||||
### `install`
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku git-upload-pack`
|
||||
- Arguments: `$APP`
|
||||
- Description: Used to setup any files/configuration for a plugin.
|
||||
- Invoked by: `dokku plugin:install`.
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Sets the hostname of the dokku server
|
||||
# based on the output of `hostname -f`
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
hostname -f > $DOKKU_ROOT/HOSTNAME
|
||||
fi
|
||||
```
|
||||
|
||||
### `nginx-hostname`
|
||||
@@ -585,6 +328,267 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
nginx -t
|
||||
```
|
||||
|
||||
### `post-build-buildpack`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildpacks.
|
||||
- Invoked by: `internal function dokku_build() (build phase)`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `internal function dokku_build() (build phase)`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-create`
|
||||
|
||||
- Description: Can be used to run commands after an application is created.
|
||||
- Invoked by: `dokku apps:create`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs a command to ensure that an app
|
||||
# has a postgres database when it is starting
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1";
|
||||
POSTGRES="$1"
|
||||
|
||||
dokku postgres:create $POSTGRES
|
||||
dokku postgres:link $POSTGRES $APP
|
||||
```
|
||||
|
||||
### `post-delete`
|
||||
|
||||
- Description: Can be used to run commands after an application is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs a command to ensure that an app's
|
||||
# postgres installation is removed
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1";
|
||||
|
||||
dokku postgres:destroy $APP
|
||||
```
|
||||
|
||||
### `post-deploy`
|
||||
|
||||
- Description: Allows running of commands after an application's processes have been scaled up, but before old containers are torn down. Dokku core currently uses this to switch traffic on nginx.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Notify an external service that a successful deploy has occurred.
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
curl "http://httpstat.us/200"
|
||||
```
|
||||
|
||||
### `post-domains-update`
|
||||
|
||||
- Description: Allows you to run commands once the domain for an application has been updated. It also sends in the command that has been used. This can be "add", "clear" or "remove". The third argument will be the optional list of domains
|
||||
- Invoked by: `dokku domains:add`, `dokku domains:clear`, `dokku domains:remove`
|
||||
- Arguments: `$APP` `action name` `domains`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Reloads haproxy for our imaginary haproxy plugin
|
||||
# that replaces the nginx-vhosts plugin
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
sudo service haproxy reload
|
||||
```
|
||||
|
||||
### `post-proxy-ports-update`
|
||||
|
||||
- Description: Allows you to run commands once the proxy port mappings for an application have been updated. It also sends the invoking command. This can be "add", "clear" or "remove".
|
||||
- Invoked by: `dokku proxy:ports-add`, `dokku proxy:ports-clear`, `dokku proxy:ports-remove`
|
||||
- Arguments: `$APP` `action name`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Rebuilds haproxy config for our imaginary haproxy plugin
|
||||
# that replaces the nginx-vhosts plugin
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/haproxy/functions"
|
||||
APP="$1"; verify_app_name "$APP"
|
||||
|
||||
haproxy-build-config "$APP"
|
||||
```
|
||||
|
||||
### `post-release-buildpack`
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
|
||||
- Invoked by: `internal function dokku_release() (release phase)`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs a package specified by the `CONTAINER_PACKAGE` env var
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1" Installing $CONTAINER_PACKAGE..."
|
||||
|
||||
CMD="cat > gm && \
|
||||
dpkg -s CONTAINER_PACKAGE > /dev/null 2>&1 || \
|
||||
(apt-get update && apt-get install -y CONTAINER_PACKAGE && apt-get clean)"
|
||||
|
||||
ID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
||||
test $(docker wait $ID) -eq 0
|
||||
docker commit $ID $IMAGE > /dev/null
|
||||
```
|
||||
|
||||
### `post-release-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `internal function dokku_release() (release phase)`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-stop`
|
||||
|
||||
- Description: Can be used to run commands after an application is manually stopped
|
||||
- Invoked by: `dokku ps:stop`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Marks an application as manually stopped
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1";
|
||||
|
||||
dokku config:set --no-restart $APP MANUALLY_STOPPED=1
|
||||
```
|
||||
|
||||
### `pre-build-buildpack`
|
||||
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildpacks.
|
||||
- Invoked by: `internal function dokku_build() (build phase)`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `internal function dokku_build() (build phase)`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-delete`
|
||||
|
||||
- Description: Can be used to run commands before an app is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Clears out the gulp asset build cache for applications
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ -d $GULP_CACHE_DIR ]]; then
|
||||
docker run $DOKKU_GLOBAL_RUN_ARGS --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
fi
|
||||
```
|
||||
|
||||
### `pre-deploy`
|
||||
|
||||
- Description: Allows the running of code before the application's processes are scaled up and after the docker images are prepared.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs gulp in our container
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1 "Running gulp"
|
||||
id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $IMAGE /bin/bash -c "cd /app && gulp default")
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
dokku_log_info1 "Building UI Complete"
|
||||
```
|
||||
|
||||
### `pre-receive-app`
|
||||
|
||||
- Description: Allows you to customize the contents of an application directory before they are processed for deployment. The `IMAGE_SOURCE_TYPE` can be any of `[herokuish, dockerfile]`
|
||||
@@ -604,11 +608,124 @@ APP="$1"; IMAGE_SOURCE_TYPE="$2"; TMP_WORK_DIR="$3"; REV="$4"
|
||||
echo "$APP" > "$TMP_WORK_DIR/dokku-is-awesome"
|
||||
```
|
||||
|
||||
### `pre-release-buildpack`
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
|
||||
- Invoked by: `internal function dokku_release() (release phase)`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs the graphicsmagick package into the container
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1" Installing GraphicsMagick..."
|
||||
|
||||
CMD="cat > gm && \
|
||||
dpkg -s graphicsmagick > /dev/null 2>&1 || \
|
||||
(apt-get update && apt-get install -y graphicsmagick && apt-get clean)"
|
||||
|
||||
ID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
||||
test $(docker wait $ID) -eq 0
|
||||
docker commit $ID $IMAGE > /dev/null
|
||||
```
|
||||
|
||||
### `pre-release-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `internal function dokku_release() (release phase)`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-disable-vhost`
|
||||
|
||||
- Description: Allows you to run commands before the VHOST feature is disabled
|
||||
- Invoked by: `dokku domains:disable`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
APP="$1"; verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-enable-vhost`
|
||||
|
||||
- Description: Allows you to run commands before the VHOST feature is enabled
|
||||
- Invoked by: `dokku domains:enable`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
APP="$1"; verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-certs-update`
|
||||
|
||||
- Description: Allows you to run commands after a cert is added/updated
|
||||
- Invoked by: `dokku certs:add`, `dokku certs:update`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
APP="$1"; verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-certs-remove`
|
||||
|
||||
- Description: Allows you to run commands after a cert is removed
|
||||
- Invoked by: `dokku certs:remove`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
APP="$1"; verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `receive-app`
|
||||
|
||||
- Description: Allows you to customize what occurs when an app is received. Normally just triggers an application build.
|
||||
- Invoked by: `dokku git-hook`, `dokku ps:rebuild`
|
||||
- Arguments: `$APP $REV`
|
||||
- Arguments: `$APP $REV` (`$REV` may not be included in cases where a repository is not pushed)
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -646,6 +763,23 @@ fi
|
||||
plugn trigger receive-app $APP $newrev
|
||||
```
|
||||
|
||||
### `retire-container-failed`
|
||||
|
||||
- Description: Allows you to run commands if/when retiring old containers has failed
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Send an email when a container failed to retire
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; HOSTNAME=$(hostname -s)
|
||||
|
||||
mail -s "$APP containers on $HOSTNAME failed to retire" ops@example.com
|
||||
```
|
||||
|
||||
### `tags-create`
|
||||
|
||||
- Description: Allows you to run commands once a tag for an application image has been added
|
||||
@@ -682,21 +816,21 @@ APP="$1"; IMAGE_TAG="$2"
|
||||
some code to remove a docker hub tag because it's not implemented in the CLI....
|
||||
```
|
||||
|
||||
### `retire-container-failed`
|
||||
### `update`
|
||||
|
||||
- Description: Allows you to run commands if/when retiring old containers has failed
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates.
|
||||
- Invoked by: `dokku plugin:update`.
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Send an email when a container failed to retire
|
||||
# Update the herokuish image from git source
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; HOSTNAME=$(hostname -s)
|
||||
|
||||
mail -s "$APP containers on $HOSTNAME failed to retire" ops@example.com
|
||||
cd /root/dokku
|
||||
sudo BUILD_STACK=true make install
|
||||
```
|
||||
|
||||
### `user-auth`
|
||||
|
||||
@@ -8,7 +8,6 @@ To propose a release, the following tasks need to be performed:
|
||||
- The installable version must be changed in the `contrib/dokku-installer.py` file.
|
||||
- The installable version must be changed in the `debian/control` file.
|
||||
- The installable version must be changed in the `docs/home.html` file
|
||||
- The installable version must be changed in the `docs/index.md` file
|
||||
- The installable version must be changed in the `docs/installation.md` file.
|
||||
- The installable version must be changed in the `docs/template.html` file.
|
||||
- The installable version must be changed in the `README.md` file.
|
||||
@@ -67,7 +66,7 @@ The workflow looks like this:
|
||||
```shell
|
||||
# having dokku-arch in ../dokku-arch
|
||||
vagrant up build-arch
|
||||
# wait for "==> build-arch: ==> Finished making: dokku 0.5.5-2 (Mon Feb 22 23:20:37 CET 2016)"
|
||||
# wait for "==> build-arch: ==> Finished making: dokku 0.6.4-2 (Mon Feb 22 23:20:37 CET 2016)"
|
||||
cd ../dokku-arch
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m 'Update to dokku 0.9.9'
|
||||
|
||||
23
docs/dns.md
23
docs/dns.md
@@ -2,27 +2,30 @@
|
||||
|
||||
> Note: This is a work in progress.
|
||||
|
||||
### DNS Versions
|
||||
## DNS Versions
|
||||
|
||||
There are many different DNS servers 'in the wild'. Some of the popular ones on Linux are BIND, dnsmasq, and pdns. Windows has its own built-in DNS server as well as Unbound, Posadis, and more. A full list of DNS packages can be found on Wikipedia under [Comparison of DNS Server Software](http://en.wikipedia.org/wiki/Comparison_of_DNS_server_software). In addition to the various DNS packages, there are tens of thousands of [Managed DNS Providers](http://en.wikipedia.org/wiki/List_of_managed_DNS_providers) out that all have different DNS interfaces.
|
||||
|
||||
### Focus
|
||||
## Focus
|
||||
|
||||
Because there are so many different DNS server packages out there as well as a tremendous number of Managed DNS Providers, we will focus on the concepts of DNS as well as providing examples in the 'BIND' format so you can adapt the information to your own server package or managed DNS provider.
|
||||
|
||||
### Assumptions
|
||||
## Assumptions
|
||||
|
||||
* We assume you have a passing familiarity with DNS. If not, you can read an [in-depth article](http://www.diaryofaninja.com/blog/2012/03/03/devops-dns-for-developers-ndash-now-therersquos-no-excuse-not-to-know) on DNS. But basically you need to know that DNS changes names (like example.tld) into addresses (like 127.0.0.1)
|
||||
* We assume you already have a domain name registered and pointed to your favorite Managed DNS Provider or have your own BIND DNS server running.
|
||||
* You have a server on the internet and are about to follow the instructions in the [README](https://github.com/dokku/dokku/blob/master/README.md) to get dokku installed. Don't do the install just yet though.
|
||||
|
||||
## Caching
|
||||
|
||||
### HELP!
|
||||
Please remember that DNS relies heavily on _caching_. Changes you make to DNS could take anywhere from a few seconds to a few *days* to propagate. If you tried surfing to example.tld, then changed the IP address in DNS, it could be a while before your computer picks up on the changes.
|
||||
|
||||
## HELP!
|
||||
|
||||
Don't be afraid to ask if you need help. Create a [new issue](https://github.com/dokku/dokku/issues) and someone will be glad to assist you.
|
||||
|
||||
|
||||
# Getting started
|
||||
## Getting started
|
||||
|
||||
For the examples, we will use the domain name `example.tld` and the IP address `127.0.0.1`.
|
||||
|
||||
@@ -30,17 +33,11 @@ Dokku uses DNS to differentiate between apps on your dokku-powered server. If y
|
||||
|
||||
To get started, you need to know the IP address of your dokku server. Connect to it and run `ifconfig` or `ip addr` to see the IP address.
|
||||
|
||||
# Caching
|
||||
|
||||
Please remember that DNS relies heavily on _caching_. Changes you make to DNS could take anywhere from a few seconds to a few *days* to propagate. If you tried surfing to example.tld, then changed the IP address in DNS, it could be a while before your computer picks up on the changes.
|
||||
|
||||
## The two methods
|
||||
|
||||
Now you have to make a decision about your domain. Do you want everything and anything at `example.tld` to go to your dokku server, or would you rather use a 'sub domain' for your dokku server?
|
||||
|
||||
In other words, do you want your applications on your dokku server accessible via `myapp.example.tld` or via `myapp.myserver.example.tld`?
|
||||
|
||||
### Using a sub-domain (myapp.myserver.example.tld)
|
||||
#### Using a sub-domain (myapp.myserver.example.tld)
|
||||
|
||||
Using a sub-domain is easy. When you set up your server, you probably gave it a name like `myserver.example.tld`.
|
||||
|
||||
@@ -75,7 +72,7 @@ If they all return your IP address, you have set DNS up properly for dokku. You
|
||||
|
||||
Proceed with the setup instructions in the [README](https://github.com/dokku/dokku/blob/master/README.md)
|
||||
|
||||
### Using the root of your domain (myapp.example.tld)
|
||||
#### Using the root of your domain (myapp.example.tld)
|
||||
|
||||
This section is a work in progress. It is incomplete.
|
||||
|
||||
|
||||
@@ -41,6 +41,15 @@ Your app may be used in a cluster that requires containers or resources not runn
|
||||
|
||||
Your app may have services that are running in memory and need to be backed up locally (like a key store). Mount a non ephemeral storage mount will allow backups that are not lost when the app is shut down.
|
||||
|
||||
### Build phase
|
||||
|
||||
By default, dokku will only bind storage mounts during the deploy and run phases. Under certain conditions, one might want to bind a storage mount during the build phase. This can be accomplished by using the `docker-options` plugin directly.
|
||||
```
|
||||
$ dokku docker-options:add <app> "-v /tmp/python-test:/opt/test"
|
||||
```
|
||||
|
||||
NOTE: **This can cause data loss** if you bind a mount under `/app` in buildpack apps as herokuish will attempt to remove the original app path during the build phase.
|
||||
|
||||
## Docker-Options Note
|
||||
|
||||
The storage plugins is compatible with storage mounts created with the docker-options. The storage plugin will only list mounts from the deploy phase.
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
git clone https://github.com/dokku/dokku.git
|
||||
```
|
||||
|
||||
- Setup SSH hosts in your `/etc/hosts`
|
||||
|
||||
```
|
||||
10.0.0.2 dokku.me
|
||||
```
|
||||
|
||||
- Create VM
|
||||
```
|
||||
# Optional ENV arguments:
|
||||
@@ -35,6 +29,7 @@
|
||||
|
||||
- Copy your SSH key via `cat ~/.ssh/id_rsa.pub | pbcopy` and paste it into the dokku-installer at http://dokku.me . Change the `Hostname` field on the Dokku Setup screen to your domain and then check the box that says `Use virtualhost naming`. Then click *Finish Setup* to install your key. You'll be directed to application deployment instructions from here.
|
||||
|
||||
Please note, the `dokku.me` domain is setup to point to `10.0.0.2` along with all subdomains (ie yourapp.dokku.me). If you change the `DOKKU_IP` in your vagrant setup you'll need to update your `/etc/hosts` file to point your reconfigured ip address.
|
||||
|
||||
You are now ready to deploy an app or install plugins.
|
||||
|
||||
For a different, complete, example see https://github.com/RyanBalfanz/dokku-vagrant-example.
|
||||
|
||||
@@ -10,30 +10,30 @@
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
|
||||
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-title" content="Dokku">
|
||||
<meta name="application-name" content="Dokku">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/style.css" rel="stylesheet">
|
||||
<link href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/style.css" rel="stylesheet">
|
||||
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
|
||||
<style>
|
||||
</style>
|
||||
@@ -90,17 +90,17 @@
|
||||
</div>
|
||||
<div class="shell shell-curl shell-active">
|
||||
<p class="line">
|
||||
<span class="output"> # only works on debian systems!</span>
|
||||
<span class="output"> # for debian systems, installs dokku via apt-get</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path"></span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.5.5/bootstrap.sh</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.6.4/bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path"></span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.5.5 bash bootstrap.sh</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.6.4 bash bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="output"> # go to your server's IP and follow the web installer</span>
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<div class="blurb">
|
||||
<div class="container">
|
||||
<h2>The smallest PaaS implementation you've ever seen</h2>
|
||||
<p>Docker powered mini-Heroku in around 200 lines of Bash</p>
|
||||
<div class="blurb-buttons">
|
||||
<a class="btn btn-lg btn-warning" href="/dokku/installation">View Documentation</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container marketing">
|
||||
<div class="quickstart-code">
|
||||
<p class="title">Quick-start Instructions</p>
|
||||
<div class="shell">
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.5.5/bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.5.5 bash bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="output"># => Go to your server's IP and follow the web installer</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="featurette-divider">
|
||||
|
||||
<!-- START THE FEATURETTES -->
|
||||
|
||||
<div class="row featurette">
|
||||
<div class="col-md-7">
|
||||
<h2 class="featurette-heading">Own Your PaaS. <span class="text-muted">Infrastructure at a fraction of the cost.</span></h2>
|
||||
<p class="lead">Powered by Docker, you can install Dokku on any hardware. Use it on inexpensive cloud providers. Use the extra cash to buy a pony or feed kittens. You'll save tens of dollars a year on your dog photo sharing website.</p>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<img class="featurette-image img-responsive center-block" alt="Docker Logo" src="assets/docker.png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="featurette-divider">
|
||||
|
||||
<div class="row featurette">
|
||||
<div class="col-md-7 col-md-push-5">
|
||||
<h2 class="featurette-heading">Easy Git Deploys. <span class="text-muted">From your command-line to the cloud.</span></h2>
|
||||
<p class="lead">Once it's set up on a host, you can push Heroku-compatible applications to it via Git. They'll build using Heroku buildpacks and then run in isolated containers. The end result is your own, single-host version of Heroku.</p>
|
||||
</div>
|
||||
<div class="col-md-5 col-md-pull-7">
|
||||
<img class="featurette-image img-responsive center-block" alt="Git Logo" src="assets/git.png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="featurette-divider">
|
||||
|
||||
<div class="row featurette">
|
||||
<div class="col-md-7">
|
||||
<h2 class="featurette-heading">Extensible Platform. <span class="text-muted">Customize your PaaS.</span></h2>
|
||||
<p class="lead">Write dokku plugins in any language. Share them online with others, and extend those already available. Dokku's simple core is easy to hack and add the features you need to get your job done.</p>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<img class="featurette-image img-responsive center-block" alt="Extend Logo" src="assets/extend.png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="featurette-divider">
|
||||
</div>
|
||||
|
||||
@@ -20,9 +20,9 @@ Dokku is designed for usage on a fresh installation of Ubuntu, and should instal
|
||||
To install the latest stable version of dokku, you can run the following shell commands:
|
||||
|
||||
```shell
|
||||
# installs dokku via apt-get
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.5.5/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.5.5 bash bootstrap.sh
|
||||
# for debian systems, installs dokku via apt-get
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.6.4/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.6.4 bash bootstrap.sh
|
||||
```
|
||||
|
||||
The installation process takes about 5-10 minutes, depending upon internet connection speed.
|
||||
@@ -31,6 +31,8 @@ The installation process takes about 5-10 minutes, depending upon internet conne
|
||||
|
||||
Once the installation is complete, you can open a browser to setup your SSH key and virtualhost settings. Open your browser of choice and navigate to the host's IP address - or the domain you assigned to that IP previously - and configure dokku via the web admin.
|
||||
|
||||
*If you don't complete setup via the web installer (even if you set up SSH keys and virtual hosts otherwise) your dokku installation will remain vulnerable to anyone finding the setup page and inserting their key.*
|
||||
|
||||
#### 3. Deploy your first application
|
||||
Once you save your settings, the web admin will self-terminate and you should be able to run or deploy to the dokku installation.
|
||||
|
||||
|
||||
@@ -19,14 +19,12 @@ Dokku uses a templating library by the name of [sigil](https://github.com/glider
|
||||
- `ADD` it to your dockerfile `WORKDIR`
|
||||
- if your dockerfile has no `WORKDIR`, `ADD` it to the `/app` folder
|
||||
|
||||
> When using a custom `nginx.conf.sigil` file, depending upon your application configuration, you *may* be exposing the file externally. As this file is extracted before the container is run, you can, safely delete it in a custom `entrypoint.sh` configured in a Dockerfile `ENTRYPOINT`.
|
||||
|
||||
### Example Custom Template
|
||||
|
||||
Use case: add an `X-Served-By` header to requests
|
||||
```
|
||||
upstream {{ .APP }} {
|
||||
{{ range .DOKKU_APP_LISTENERS | split " " }}
|
||||
server {{ . }};
|
||||
{{ end }}
|
||||
}
|
||||
server {
|
||||
listen [::]:{{ .NGINX_PORT }};
|
||||
listen {{ .NGINX_PORT }};
|
||||
@@ -37,6 +35,13 @@ server {
|
||||
# set a custom header for requests
|
||||
add_header X-Served-By www-ec2-01;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 32k;
|
||||
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
|
||||
location / {
|
||||
proxy_pass http://{{ .APP }};
|
||||
proxy_http_version 1.1;
|
||||
@@ -50,6 +55,12 @@ server {
|
||||
}
|
||||
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
|
||||
}
|
||||
|
||||
upstream {{ .APP }} {
|
||||
{{ range .DOKKU_APP_LISTENERS | split " " }}
|
||||
server {{ . }};
|
||||
{{ end }}
|
||||
}
|
||||
```
|
||||
|
||||
### Available template variables
|
||||
@@ -61,20 +72,19 @@ server {
|
||||
{{ .NGINX_PORT }} Non-SSL nginx listener port (same as `DOKKU_NGINX_PORT` config var)
|
||||
{{ .NGINX_SSL_PORT }} SSL nginx listener port (same as `DOKKU_NGINX_SSL_PORT` config var)
|
||||
{{ .NOSSL_SERVER_NAME }} List of non-SSL VHOSTS
|
||||
{{ .PROXY_PORT_MAP }} List of port mappings (same as `DOKKU_PROXY_PORT_MAP` config var)
|
||||
{{ .PROXY_UPSTREAM_PORTS }} List of configured upstream ports (derived from `DOKKU_PROXY_PORT_MAP` config var)
|
||||
{{ .RAW_TCP_PORTS }} List of exposed tcp ports as defined by Dockerfile `EXPOSE` directive (**Dockerfile apps only**)
|
||||
{{ .SSL_INUSE }} Boolean set when an app is SSL-enabled
|
||||
{{ .SSL_SERVER_NAME }} List of SSL VHOSTS
|
||||
```
|
||||
|
||||
> NOTE: Application config variables are available for use in custom templates. To do so, use the form of `{{ var "FOO" }}` to access a variable named `FOO`.
|
||||
|
||||
|
||||
### Example HTTP to HTTPS Custom Template
|
||||
Use case: a simple dockerfile app that includes `EXPOSE 80`
|
||||
```
|
||||
upstream {{ .APP }} {
|
||||
{{ range .DOKKU_APP_LISTENERS | split " " }}
|
||||
server {{ . }};
|
||||
{{ end }}
|
||||
}
|
||||
server {
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
@@ -111,8 +121,61 @@ server {
|
||||
}
|
||||
include {{ .DOKKU_ROOT }}/{{ .APP }}/nginx.conf.d/*.conf;
|
||||
}
|
||||
|
||||
upstream {{ .APP }} {
|
||||
{{ range .DOKKU_APP_LISTENERS | split " " }}
|
||||
server {{ . }};
|
||||
{{ end }}
|
||||
}
|
||||
```
|
||||
|
||||
### Example using new proxy port mapping
|
||||
```
|
||||
{{ range $port_map := .PROXY_PORT_MAP | split " " }}
|
||||
{{ $port_map_list := $port_map | split ":" }}
|
||||
{{ $scheme := index $port_map_list 0 }}
|
||||
{{ $listen_port := index $port_map_list 1 }}
|
||||
{{ $upstream_port := index $port_map_list 2 }}
|
||||
|
||||
server {
|
||||
listen [::]:{{ $listen_port }};
|
||||
listen {{ $listen_port }};
|
||||
server_name {{ $.NOSSL_SERVER_NAME }};
|
||||
access_log /var/log/nginx/{{ $.APP }}-access.log;
|
||||
error_log /var/log/nginx/{{ $.APP }}-error.log;
|
||||
|
||||
location / {
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 32k;
|
||||
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
|
||||
proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Request-Start $msec;
|
||||
}
|
||||
include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
|
||||
}
|
||||
|
||||
{{ range $upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }}
|
||||
upstream {{ $.APP }}-{{ $upstream_port }} {
|
||||
{{ range $listeners := $.DOKKU_APP_LISTENERS | split " " }}
|
||||
{{ $listener_list := $listeners | split ":" }}
|
||||
{{ $listener_ip := index $listener_list 0 }}
|
||||
{{ $listener_port := index $listener_list 1 }}
|
||||
server {{ $listener_ip }}:{{ $upstream_port }};{{ end }}
|
||||
}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
### Customizing via configuration files included by the default templates
|
||||
|
||||
@@ -131,6 +194,8 @@ chown dokku:dokku /home/dokku/myapp/nginx.conf.d/upload.conf
|
||||
service nginx reload
|
||||
```
|
||||
|
||||
The example above uses additional configuration files directly on the dokku host. Unlike the `nginx.conf.sigil` file, these additional files will not be copied over from your application repo, and thus need to be placed in the `/home/dokku/myapp/nginx.conf.d/` directory manually.
|
||||
|
||||
## Domains plugin
|
||||
|
||||
See the [domain-configuration documentation](/dokku/deployment/domain-configuration/).
|
||||
@@ -162,3 +227,7 @@ See the [ssl documentation](/dokku/deployment/ssl-configuration/).
|
||||
## Disabling Nginx
|
||||
|
||||
See the [proxy documentation](/dokku/proxy/).
|
||||
|
||||
## Managing Proxy Port mappings
|
||||
|
||||
See the [proxy documentation](/dokku/proxy/#proxy-port-mapping).
|
||||
|
||||
@@ -63,6 +63,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[alex-sherwin]: https://github.com/alex-sherwin
|
||||
[alexanderbeletsky]: https://github.com/alexanderbeletsky
|
||||
[alexkruegger]: https://github.com/alexkruegger
|
||||
[Aluxian]: https://github.com/Aluxian
|
||||
[Aomitayo]: https://github.com/Aomitayo
|
||||
[apmorton]: https://github.com/apmorton
|
||||
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell
|
||||
@@ -140,7 +141,8 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Redis](https://github.com/sekjun9878/dokku-redis-plugin) | [sekjun9878][] | 0.3.26+ |
|
||||
| [Nginx Cache](https://github.com/Aluxian/dokku-nginx-cache) | [Aluxian][] | 0.5.0+ |
|
||||
| [Redis](https://github.com/sekjun9878/dokku-redis-plugin) | [sekjun9878][] | 0.3.26+ |
|
||||
| [Redis (single container)](https://github.com/ohardy/dokku-redis) | [ohardy][] | 0.3.x |
|
||||
| [Varnish](https://github.com/Zenedith/dokku-varnish-plugin) | [Zenedith][] | Varnish cache between nginx and application with base configuration|
|
||||
|
||||
@@ -150,13 +152,16 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | 0.3.x |
|
||||
| [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | 0.3.x |
|
||||
| [ElasticMQ (SQS compatible)](https://github.com/cu12/dokku-elasticmq) | [cu12][] | 0.5.0+ |
|
||||
|
||||
#### Other
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [etcd](https://github.com/basgys/dokku-etcd) | [basgys][] | 0.4.x |
|
||||
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 0.3.x |
|
||||
| [etcd](https://github.com/basgys/dokku-etcd) | [basgys][] | 0.4.x |
|
||||
| [FakeSNS](https://github.com/cu12/dokku-fake_sns) | [cu12][] | 0.5.0+ |
|
||||
| [InfluxDB](https://github.com/basgys/dokku-influxdb) | [basgys][] | 0.4.x |
|
||||
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 0.3.x |
|
||||
|
||||
[dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709
|
||||
|
||||
@@ -180,12 +185,14 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [App name as env](https://github.com/cjblomqvist/dokku-app-name-env) | [cjblomqvist][] | 0.3.x |
|
||||
| [App User](https://github.com/expa/dokku-app-user) | [michaelshobbs][] | 0.4.0+ |
|
||||
| [Dokku Clone](https://github.com/crisward/dokku-clone) | [crisward][] | 0.4.0+ |
|
||||
| [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | |
|
||||
| [Dokku Copy App Config Files](https://github.com/alexkruegger/dokku-app-configfiles) | [alexkruegger][] | Compatible with 0.3.17+ |
|
||||
| [Dokku Copy App Config Files](https://github.com/heichblatt/dokku-supply-config) | [heichblatt][] | |
|
||||
| [Dokku Name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | dokku >= [c77cbf1][] |
|
||||
| [Dokku Registry](https://github.com/agco-adm/dokku-registry)<sup>1</sup> | [agco-adm][] | 0.4.0+ |
|
||||
| [Dokku Require](https://github.com/crisward/dokku-require)<sup>2</sup> | [crisward][] | 0.4.0+ |
|
||||
| [git rev-parse HEAD in env](https://github.com/cjblomqvist/dokku-git-rev) | [cjblomqvist][] | 0.4.0+ |
|
||||
| [Graduate (Environment Management)](https://github.com/glassechidna/dokku-graduate) | [Benjamin-Dobell][] | 0.3.14+ |
|
||||
| [Haproxy tcp load balancer](https://github.com/256dpi/dokku-haproxy) | [256dpi][] | 0.4.0+ |
|
||||
@@ -195,17 +202,20 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| [Nuke Containers](https://github.com/heichblatt/dokku-nuke) | [heichblatt][] | |
|
||||
| [Open App Ports](https://github.com/heichblatt/dokku-ports) | [heichblatt][] | |
|
||||
| [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | 0.4.0+ |
|
||||
| [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)<sup>2</sup> | [cedricziel][] | 0.3.x |
|
||||
| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)<sup>3</sup> | [cedricziel][] | 0.3.x |
|
||||
| [Proctype Filter](https://github.com/expa/dokku-proctype-filter) | [michaelshobbs][] | 0.4.0+ |
|
||||
| [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)<sup>3</sup> | [cedricziel][] | 0.3.x |
|
||||
| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)<sup>4</sup> | [cedricziel][] | 0.3.x |
|
||||
| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | 0.3.x |
|
||||
|
||||
[217d00a]: https://github.com/dokku/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7
|
||||
|
||||
<sup>1</sup> On Heroku similar functionality is offered by the [heroku-labs pipeline feature](https://devcenter.heroku.com/articles/labs-pipelines), which allows you to promote builds across multiple environments (staging -> production)
|
||||
|
||||
<sup>2</sup> Adds the possibility to add SSH deployment keys to receive private hosted packages
|
||||
<sup>2</sup> Extends app.json support to include creating volumes and creating / linking databases on push
|
||||
|
||||
<sup>3</sup> Adds the ability to add custom hosts to the containers known_hosts file to be able to ssh them easily (useful with deployment keys)
|
||||
<sup>3</sup> Adds the possibility to add SSH deployment keys to receive private hosted packages
|
||||
|
||||
<sup>4</sup> Adds the ability to add custom hosts to the containers known_hosts file to be able to ssh them easily (useful with deployment keys)
|
||||
|
||||
### Other Plugins
|
||||
|
||||
@@ -224,15 +234,19 @@ 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+ |
|
||||
| [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 |
|
||||
| [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | 0.4.0+ |
|
||||
| [Tor](https://github.com/michaelshobbs/dokku-tor) | [michaelshobbs][] | 0.4.0+ |
|
||||
| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | 0.4.0+ |
|
||||
| [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | |
|
||||
| [Wkhtmltopdf](https://github.com/mbriskar/dokku-wkhtmltopdf) | [mbriskar][] | |
|
||||
| [Wordpress](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | Dokku dev, mariadb, volume, domains |
|
||||
| [Long Timeout](https://github.com/investtools/dokku-long-timeout-plugin) | [investtools][] | 0.4.0+ |
|
||||
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | 0.4.0+ |
|
||||
| [Rollbar](https://github.com/iloveitaly/dokku-rollbar) | [iloveitaly][] | 0.5.0+ |
|
||||
|
||||
<sup>1</sup> Forked from [jezdez/dokku-elasticsearch-plugin](https://github.com/jezdez/dokku-elasticsearch-plugin): uses Elasticsearch 1.2 (instead of 0.90), doesn't depend on dokku-link, runs as elasticsearch user instead of root, and turns off multicast autodiscovery for use in a VPS environment.
|
||||
|
||||
|
||||
@@ -1,32 +1,80 @@
|
||||
# Proxy plugin
|
||||
|
||||
> New as of 0.5.0
|
||||
|
||||
As of dokku 0.5.0, the proxy functionality has been decoupled from the nginx-vhosts plugin into the proxy plugin. In the future this will allow other proxy software (HAproxy for example) to be used instead of nginx.
|
||||
> New as of 0.5.0, Enhanced in 0.6.0
|
||||
|
||||
```
|
||||
proxy:disable <app> Disable proxy for app
|
||||
proxy:enable <app> Enable proxy for app
|
||||
proxy:set <app> <proxy_type> NOT IMPLEMENTED YET!!
|
||||
proxy <app> Show proxy settings for app
|
||||
proxy:disable <app> Disable proxy for app
|
||||
proxy:enable <app> Enable proxy for app
|
||||
proxy:ports <app> List proxy port mappings for app
|
||||
proxy:ports-add <app> <scheme>:<host-port>:<container-port> [<scheme>:<host-port>:<container-port>...] Set proxy port mappings for app
|
||||
proxy:ports-clear <app> Clear all proxy port mappings for app
|
||||
proxy:ports-remove <app> <host-port> [<host-port>|<scheme>:<host-port>:<container-port>...] Unset proxy port mappings for app
|
||||
proxy:set <app> <proxy-type> Set proxy type for app
|
||||
```
|
||||
|
||||
In Dokku 0.5.0, port proxying was decoupled from the `nginx-vhosts` plugin into the proxy plugin. Dokku 0.6.0 introduced the ability to map host ports to specific container ports. In the future this will allow other proxy software - such as HAProxy or Caddy - to be used in place of nginx.
|
||||
|
||||
## Container network interface binding
|
||||
|
||||
By default, the deployed docker container running your app's web process will bind to the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`). This behavior can be modified per app by disabling the proxy (i.e. `dokku proxy:disable <app>`). In this case, the container will bind to an external interface (i.e. 0.0.0.0) and your app container will be directly accessible by other hosts on your network.
|
||||
> New as of 0.5.0
|
||||
|
||||
> If a proxy is disabled, dokku will bind your container's port to a random port on the host, e.g. `0.0.0.0:32771->5000/tcp`.
|
||||
By default, the deployed docker container running your app's web process will bind to the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`). This behavior can be modified per app by disabling the proxy (i.e. `dokku proxy:disable <app>`). In this case, the container will bind to an external interface (i.e. `0.0.0.0`) and your app container will be directly accessible by other hosts on your network.
|
||||
|
||||
> If a proxy is disabled, dokku will bind your container's port to a random port on the host for every deploy, e.g. `0.0.0.0:32771->5000/tcp`.
|
||||
|
||||
```shell
|
||||
# container bound to docker interface
|
||||
root@dokku:~/dokku# docker ps
|
||||
$ docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute node-js-app.web.1
|
||||
|
||||
root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
|
||||
# internal IP address for the container
|
||||
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
|
||||
172.17.0.6
|
||||
|
||||
# disable the proxy so it listens on a host ip address
|
||||
$ dokku proxy:disable node-js-app
|
||||
|
||||
# container bound to all interfaces
|
||||
root@dokku:/home/dokku# docker ps
|
||||
$ docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1
|
||||
```
|
||||
|
||||
## Proxy port mapping
|
||||
|
||||
> New as of 0.6.0
|
||||
|
||||
You can now configure `host -> container` port mappings with the `proxy:ports-*` commands. This mapping is currently supported by the built-in nginx-vhosts plugin.
|
||||
|
||||
```shell
|
||||
$ dokku proxy:ports node-js-app
|
||||
-----> Port mappings for node-js-app
|
||||
-----> scheme host port container port
|
||||
http 80 5000
|
||||
|
||||
$ curl http://node-js-app.dokku.me
|
||||
Hello World!
|
||||
|
||||
$ curl http://node-js-app.dokku.me:8080
|
||||
curl: (7) Failed to connect to node-js-app.dokku.me port 8080: Connection refused
|
||||
|
||||
$ dokku proxy:ports-add node-js-app http:8080:5000
|
||||
-----> Setting config vars
|
||||
DOKKU_PROXY_PORT_MAP: http:80:5000 http:8080:5000
|
||||
-----> Configuring node-js-app.dokku.me...(using built-in template)
|
||||
-----> Creating http nginx.conf
|
||||
-----> Running nginx-pre-reload
|
||||
Reloading nginx
|
||||
|
||||
$ curl http://node-js-app.dokku.me
|
||||
Hello World!
|
||||
|
||||
$ curl http://node-js-app.dokku.me:8080
|
||||
Hello World!
|
||||
```
|
||||
|
||||
By default, buildpack apps and dockerfile apps **without** explicitly exposed ports (i.e. using the `EXPOSE` directive) will be configured with a listener on port `80` (and additionally a listener on 443 if ssl is enabled) that will proxy to the application container on port `5000`. Dockerfile apps **with** explicitly exposed ports will be configured with a listener on each exposed port and will proxy to that same port of the deployed application container.
|
||||
|
||||
> NOTE: This default behavior **will not** be automatically changed on subsequent pushes and must be manipulated with the `proxy:ports-*` syntax detailed above.
|
||||
|
||||
@@ -10,26 +10,26 @@
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400:sans-serif|Open+Sans:400:sans-serif" rel="stylesheet" type="text/css">
|
||||
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-title" content="Dokku">
|
||||
<meta name="application-name" content="Dokku">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.5.5/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<script>
|
||||
@@ -43,7 +43,7 @@
|
||||
</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.5/docs/assets/style.css" rel="stylesheet">
|
||||
<link href="https://cdn.rawgit.com/dokku/dokku/v0.6.4/docs/assets/style.css" rel="stylesheet">
|
||||
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
|
||||
<style>
|
||||
@@ -188,6 +188,8 @@
|
||||
currentVersionEl = document.querySelectorAll('.rst-current-version')[0],
|
||||
currentVersion = currentVersionEl.getAttribute('data-ref'),
|
||||
versionContainer = document.querySelectorAll('.rst-versions.rst-badge')[0],
|
||||
pageHeader = document.querySelectorAll('.markdown-body p')[0],
|
||||
headers = document.querySelectorAll('h2, h3, h4'),
|
||||
classNames = ['table', 'table-striped', 'table-hover', 'table-condensed'],
|
||||
localPath = location.pathname.split('/').splice(2).join("/"),
|
||||
addClass = function (el, className) {
|
||||
@@ -238,6 +240,46 @@
|
||||
}
|
||||
};
|
||||
|
||||
var ToC =
|
||||
"<nav role='navigation' class='table-of-contents'>" +
|
||||
"<ul>";
|
||||
|
||||
var newLine, el, title, link, currentDepth, count = 0, lastNodeDepth = null;
|
||||
Array.prototype.forEach.call(headers, function (el, i) {
|
||||
count++;
|
||||
title = el.innerText || element.textContent;
|
||||
link = "#" + el.getAttribute('id');
|
||||
currentDepth = parseInt(el.nodeName.replace('H', ''), 10);
|
||||
|
||||
newLine =
|
||||
"<li>" +
|
||||
"<a href='" + link + "' class='current-depth-" + currentDepth + "'>" +
|
||||
title +
|
||||
"</a>" +
|
||||
"</li>";
|
||||
|
||||
if (currentDepth === lastNodeDepth || lastNodeDepth === null) {
|
||||
} else if (currentDepth > lastNodeDepth) {
|
||||
newLine = '<ul>' + newLine;
|
||||
} else if (currentDepth < lastNodeDepth) {
|
||||
newLine = '</ul>' + newLine;
|
||||
}
|
||||
ToC += newLine;
|
||||
|
||||
lastNodeDepth = currentDepth;
|
||||
});
|
||||
ToC += "</ul></nav>";
|
||||
|
||||
if (count > 1) {
|
||||
var navItems = document.querySelectorAll('.list-group-item');
|
||||
Array.prototype.forEach.call(navItems, function(el, i){
|
||||
if (el.getAttribute('href') == location.pathname) {
|
||||
el.insertAdjacentHTML('afterEnd', ToC);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Array.prototype.forEach.call(blockquotes, function (el, i) {
|
||||
if (el.innerHTML.toLowerCase().indexOf('new as of') !== -1) {
|
||||
addClass(el, 'new-as-of');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Troubleshooting
|
||||
# Troubleshooting
|
||||
|
||||
__Symptom:__ I deployed my app but I am getting the default nginx page
|
||||
|
||||
@@ -7,7 +7,7 @@ __Solution:__
|
||||
Most of the time it's caused by some defaults newer versions of nginx set. To make sure that's the issue you're having run the following:
|
||||
|
||||
```
|
||||
root@dockerapps:/home/git# nginx
|
||||
$ nginx -t
|
||||
nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
|
||||
```
|
||||
|
||||
@@ -27,9 +27,9 @@ A value of 64 would allow domains with up to 64 characters. Set it to 128 if you
|
||||
Save the file and try stopping nginx and starting it again:
|
||||
|
||||
```
|
||||
root@dockerapps:~/dokku# /etc/init.d/nginx stop
|
||||
$ /etc/init.d/nginx stop
|
||||
* Stopping nginx nginx [ OK ]
|
||||
root@dockerapps:~/dokku# /etc/init.d/nginx start
|
||||
$ /etc/init.d/nginx start
|
||||
* Starting nginx nginx [ OK ]
|
||||
```
|
||||
|
||||
@@ -65,14 +65,14 @@ __Solution (Less solution, more helpful troubleshooting steps):__
|
||||
Find the failed phase's container image (*077581956a92* in this example)
|
||||
|
||||
```
|
||||
root@dokku:~# docker ps -a | grep build
|
||||
$ docker ps -a | grep build
|
||||
94d9515e6d93 077581956a92 "/build" 29 minutes ago Exited (0) 25 minutes ago cocky_bell
|
||||
```
|
||||
|
||||
Start a new container with the failed image and poke around (i.e. ensure you can access the internet from within the container or attempt the failed command, if known)
|
||||
|
||||
```
|
||||
root@dokku:~# docker run -ti 077581956a92 /bin/bash
|
||||
$ docker run -ti 077581956a92 /bin/bash
|
||||
root@9763ab86e1b4:/# curl -s -S icanhazip.com
|
||||
192.168.0.1
|
||||
curl http://s3pository.heroku.com/node/v0.10.30/node-v0.10.30-linux-x64.tar.gz -o node-v0.10.30-linux-x64.tar.gz
|
||||
@@ -84,7 +84,7 @@ __Solution (Less solution, more helpful troubleshooting steps):__
|
||||
Additionally we've seen issues if changing networks that have different DNS resolvers. In this case, you can run the following to update your resolv.conf
|
||||
|
||||
```
|
||||
root@dokku:~# resolvconf -u
|
||||
$ resolvconf -u
|
||||
```
|
||||
|
||||
Please see https://github.com/dokku/dokku/issues/841 and https://github.com/dokku/dokku/issues/649
|
||||
|
||||
@@ -1,36 +1,33 @@
|
||||
# Upgrading
|
||||
|
||||
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.
|
||||
If your version of dokku is pre 0.3.0 (check with `dokku version`), we recommend [a fresh install](/dokku/installation) on a new server.
|
||||
|
||||
## Migration Guides
|
||||
|
||||
Migration guides contain information regarding the new features introduced in each version and the migration path between versions.
|
||||
Before upgrading, check the migration guides to get comfortable with new features and prepare your deployment to be upgraded.
|
||||
|
||||
- [0.5 Migration Guide](/dokku/appendices/0.5.0-migration-guide/)
|
||||
- [0.6 Migration Guide](/dokku/appendices/0.6.0-migration-guide/)
|
||||
|
||||
## General Information
|
||||
## Upgrade Instructions
|
||||
|
||||
Upgrading is not advised on running apps. Stop them before with `dokku ps:stop <app>`.
|
||||
|
||||
Before using `apt-get install`, run `apt-get update` to download the latest packages.
|
||||
|
||||
If dokku was installed via a debian package, you can upgrade dokku via the following command:
|
||||
If dokku was installed via `apt-get install dokku` or `bootstrap.sh` (most common), upgrade with:
|
||||
|
||||
```shell
|
||||
sudo apt-get install dokku
|
||||
sudo apt-get update
|
||||
dokku apps
|
||||
dokku ps:stop <app> # repeat to shut down each running app
|
||||
sudo apt-get install -qq -y dokku herokuish
|
||||
dokku ps:rebuildall # restart all applications
|
||||
```
|
||||
|
||||
For unattended upgrades, you may run the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install -qq -y dokku
|
||||
```
|
||||
|
||||
If you have installed dokku from source, you may run the following commands to upgrade:
|
||||
### Upgrade From Source
|
||||
|
||||
If you installed dokku from source (less common), upgrade with:
|
||||
|
||||
```shell
|
||||
dokku apps
|
||||
dokku ps:stop <app> # repeat to shut down each running app
|
||||
cd ~/dokku
|
||||
git pull --tags origin master
|
||||
|
||||
@@ -39,29 +36,10 @@ sudo DOKKU_BRANCH=master make install
|
||||
|
||||
# upgrade to debian package-based installation
|
||||
sudo make install
|
||||
dokku ps:rebuildall # restart all applications
|
||||
```
|
||||
|
||||
All changes will take effect upon next application deployment. To trigger a rebuild and restart every application, simply run the following command:
|
||||
|
||||
```shell
|
||||
dokku ps:rebuildall
|
||||
```
|
||||
|
||||
### Herokuish image
|
||||
|
||||
If dokku was installed via a debian package, you can upgrade herokuish via the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install herokuish
|
||||
```
|
||||
|
||||
For unattended upgrades, you may run the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install -qq -y herokuish
|
||||
```
|
||||
|
||||
In some cases, it may be desirable to run a specific version of herokuish. To install/upgrade herokuish from source, run the following commands:
|
||||
To upgrade herokuish from source, upgrade with:
|
||||
|
||||
```shell
|
||||
cd /tmp
|
||||
|
||||
7
dokku
7
dokku
@@ -100,13 +100,10 @@ execute_dokku_cmd() {
|
||||
nginx|nginx:*)
|
||||
local PLUGIN_NAME=${PLUGIN_NAME/nginx/nginx-vhosts}
|
||||
;;
|
||||
receive|deploy|build|release)
|
||||
deploy|delete|ls|run|cleanup)
|
||||
local PLUGIN_NAME="00_dokku-standard"
|
||||
;;
|
||||
trace|delete|ls|run|cleanup)
|
||||
local PLUGIN_NAME="00_dokku-standard"
|
||||
;;
|
||||
url|urls|report|version)
|
||||
trace|url|urls|report|version)
|
||||
local PLUGIN_NAME="00_dokku-standard"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -23,7 +23,8 @@ get_phase_script() {
|
||||
|
||||
execute_script() {
|
||||
declare desc="executes appropriate phase script key from app.json"
|
||||
local APP="$1"; local IMAGE="$2"; local PHASE_SCRIPT_KEY="$3"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local PHASE_SCRIPT_KEY="$3"
|
||||
local SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY" 2>/dev/null)
|
||||
if [[ -n "$SCRIPT_CMD" ]];then
|
||||
dokku_log_info1 "Running '$SCRIPT_CMD' in app container"
|
||||
@@ -48,7 +49,7 @@ execute_script() {
|
||||
COMMAND+=" fi "
|
||||
|
||||
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP")
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
|
||||
# strip --restart args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
|
||||
|
||||
@@ -60,6 +61,9 @@ execute_script() {
|
||||
if ! is_image_herokuish_based "$IMAGE"; then
|
||||
local DOKKU_DOCKERFILE_ENTRYPOINT=$(config_get "$APP" DOKKU_DOCKERFILE_ENTRYPOINT)
|
||||
local DOKKU_DOCKERFILE_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_CMD)
|
||||
[[ -z "$DOKKU_DOCKERFILE_ENTRYPOINT" ]] && DOKKU_DOCKERFILE_ENTRYPOINT="$(get_entrypoint_from_image "$IMAGE")"
|
||||
[[ -z "$DOKKU_DOCKERFILE_CMD" ]] && DOKKU_DOCKERFILE_CMD="$(get_cmd_from_image "$IMAGE")"
|
||||
|
||||
[[ -n "$DOKKU_DOCKERFILE_ENTRYPOINT" ]] && local DOCKER_COMMIT_ENTRYPOINT_CHANGE_ARG="--change='$DOKKU_DOCKERFILE_ENTRYPOINT'"
|
||||
[[ -n "$DOKKU_DOCKERFILE_CMD" ]] && local DOCKER_COMMIT_CMD_CHANGE_ARG="--change='$DOKKU_DOCKERFILE_CMD'"
|
||||
|
||||
@@ -74,27 +78,3 @@ execute_script() {
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
exec_app_json_scripts() {
|
||||
declare desc="core app.json scripts execution"
|
||||
local trigger="$0 app_json_scripts"
|
||||
local APP="$1"
|
||||
|
||||
case "$0" in
|
||||
*pre-deploy)
|
||||
local IMAGE_TAG="$2"
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local PHASE_SCRIPT_KEY="predeploy"
|
||||
;;
|
||||
*post-deploy)
|
||||
local IMAGE_TAG="$4"
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local PHASE_SCRIPT_KEY="postdeploy"
|
||||
;;
|
||||
esac
|
||||
|
||||
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
|
||||
execute_script "$APP" "$IMAGE" "$PHASE_SCRIPT_KEY"
|
||||
}
|
||||
|
||||
exec_app_json_scripts "$@"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core standard plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
exec-app-json-scripts
|
||||
34
plugins/00_dokku-standard/post-deploy
Executable file
34
plugins/00_dokku-standard/post-deploy
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts"
|
||||
|
||||
exec_app_json_scripts() {
|
||||
declare desc="core app.json scripts execution"
|
||||
local trigger="pre-deploy app_json_scripts"
|
||||
local APP="$1"; local IMAGE_TAG="$4"; local PHASE_SCRIPT_KEY="postdeploy"
|
||||
|
||||
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
}
|
||||
|
||||
cleanup_container_state() {
|
||||
declare desc="core post-deploy state cleanup"
|
||||
local trigger="post-deploy cleanup_container_state"
|
||||
local APP="$1"; local PROCTYPES="$(egrep -v "^#" "$DOKKU_ROOT/$APP/DOKKU_SCALE" | awk -F '=' '{ print $1 }' | xargs)"
|
||||
local CONTAINER_FILES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -printf "%f\n" | sort -t . -k 3 -n | xargs)"
|
||||
|
||||
local CONTAINER_FILE
|
||||
for CONTAINER_FILE in $CONTAINER_FILES; do
|
||||
local CONTAINER_TYPE="$(awk -F '.' '{ print $2 }' <<< "$CONTAINER_FILE")"
|
||||
if [[ "$(is_val_in_list "$CONTAINER_TYPE" "$PROCTYPES" " ")" == "false" ]]; then
|
||||
dokku_log_info1 "Container type ($CONTAINER_TYPE) is no longer defined. Removing state"
|
||||
local IP_FILE="${CONTAINER_FILE//CONTAINER/IP}"
|
||||
local PORT_FILE="${CONTAINER_FILE//CONTAINER/PORT}"
|
||||
rm -f "$DOKKU_ROOT/$APP/$CONTAINER_FILE" "$DOKKU_ROOT/$APP/$IP_FILE" "$DOKKU_ROOT/$APP/$PORT_FILE"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
exec_app_json_scripts "$@"
|
||||
cleanup_container_state "$@"
|
||||
@@ -1 +0,0 @@
|
||||
exec-app-json-scripts
|
||||
15
plugins/00_dokku-standard/pre-deploy
Executable file
15
plugins/00_dokku-standard/pre-deploy
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts"
|
||||
|
||||
exec_app_json_scripts() {
|
||||
declare desc="core app.json scripts execution"
|
||||
local trigger="pre-deploy app_json_scripts"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local PHASE_SCRIPT_KEY="predeploy"
|
||||
|
||||
dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)"
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
}
|
||||
|
||||
exec_app_json_scripts "$@"
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
dokku_build_cmd() {
|
||||
declare desc="build phase"
|
||||
local cmd="build"
|
||||
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"; local IMAGE=$(get_app_image_name "$APP")
|
||||
verify_app_name "$APP"
|
||||
|
||||
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
|
||||
eval "$(config_export app "$APP")"
|
||||
pushd "$TMP_WORK_DIR" &> /dev/null
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
herokuish)
|
||||
local id=$(tar -c . | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
[[ -d $CACHE_DIR ]] || mkdir "$CACHE_DIR"
|
||||
plugn trigger pre-build-buildpack "$APP"
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
|
||||
docker attach "$id"
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
|
||||
plugn trigger post-build-buildpack "$APP"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# extract first port from Dockerfile
|
||||
local DOCKERFILE_PORTS=$(get_dockerfile_exposed_ports Dockerfile)
|
||||
[[ -n "$DOCKERFILE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKERFILE_PORTS"
|
||||
|
||||
# extract ENTRYPOINT/CMD from Dockerfile
|
||||
local DOCKERFILE_ENTRYPOINT=$(extract_directive_from_dockerfile Dockerfile ENTRYPOINT)
|
||||
[[ -n "$DOCKERFILE_ENTRYPOINT" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_ENTRYPOINT="$DOCKERFILE_ENTRYPOINT"
|
||||
local DOCKERFILE_CMD=$(extract_directive_from_dockerfile Dockerfile CMD)
|
||||
[[ -n "$DOCKERFILE_CMD" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_CMD="$DOCKERFILE_CMD"
|
||||
plugn trigger pre-build-dockerfile "$APP"
|
||||
|
||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
|
||||
# shellcheck disable=SC2086
|
||||
docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE .
|
||||
|
||||
plugn trigger post-build-dockerfile "$APP"
|
||||
;;
|
||||
|
||||
*)
|
||||
dokku_log_fail "Building image source type $IMAGE_SOURCE_TYPE not supported!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
dokku_build_cmd "$@"
|
||||
@@ -1,165 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
dokku_deploy_cmd() {
|
||||
declare desc="deploy phase"
|
||||
local cmd="deploy"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy"
|
||||
local APP="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
verify_app_name "$APP"
|
||||
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
|
||||
|
||||
is_image_herokuish_based "$IMAGE" && local DOKKU_HEROKUISH=true
|
||||
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
local oldids=$(get_app_container_ids "$APP")
|
||||
|
||||
local DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
|
||||
local DOKKU_IS_APP_PROXY_ENABLED="$(is_app_proxy_enabled "$APP")"
|
||||
|
||||
local line; local PROC_TYPE; local PROC_COUNT; local CONTAINER_INDEX
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
[[ "$line" =~ ^#.* ]] && continue
|
||||
line="$(strip_inline_comments "$line")"
|
||||
PROC_TYPE=${line%%=*}
|
||||
PROC_COUNT=${line#*=}
|
||||
CONTAINER_INDEX=1
|
||||
|
||||
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
|
||||
local id=""; local port=""; local ipaddr=""
|
||||
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
local DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
local DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
|
||||
# start the app
|
||||
local DOCKER_ARGS="$DOKKU_DEFAULT_DOCKER_ARGS"
|
||||
local DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' "
|
||||
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
|
||||
|
||||
[[ -n "$DOKKU_HEROKUISH" ]] && local START_CMD="/start $PROC_TYPE"
|
||||
|
||||
if [[ -z "$DOKKU_HEROKUISH" ]]; then
|
||||
local DOKKU_DOCKERFILE_PORTS=($(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true))
|
||||
local DOKKU_DOCKERFILE_START_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_START_CMD || true)
|
||||
local DOKKU_PROCFILE_START_CMD=$(get_cmd_from_procfile "$APP" "$PROC_TYPE")
|
||||
local START_CMD=${DOKKU_DOCKERFILE_START_CMD:-$DOKKU_PROCFILE_START_CMD}
|
||||
fi
|
||||
|
||||
if [[ "$PROC_TYPE" == "web" ]]; then
|
||||
if [[ -z "${DOKKU_DOCKERFILE_PORTS[*]}" ]]; then
|
||||
local port=5000
|
||||
local DOKKU_DOCKER_PORT_ARGS+="-p $port"
|
||||
else
|
||||
local p
|
||||
for p in ${DOKKU_DOCKERFILE_PORTS[*]};do
|
||||
if [[ ! "$p" =~ .*udp.* ]]; then
|
||||
# set port to first non-udp port
|
||||
local p=${p//\/tcp}
|
||||
local port=${port:="$p"}
|
||||
fi
|
||||
local DOKKU_DOCKER_PORT_ARGS+=" -p $p "
|
||||
done
|
||||
fi
|
||||
if [[ "$DOKKU_IS_APP_PROXY_ENABLED" == "true" ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
local ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$id")
|
||||
# Docker < 1.9 compatibility
|
||||
if [[ -z $ipaddr ]]; then
|
||||
local ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$id")
|
||||
fi
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
local port=$(docker port "$id" "$port" | sed 's/[0-9.]*://')
|
||||
local ipaddr=127.0.0.1
|
||||
fi
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
fi
|
||||
|
||||
# if we can't post-deploy successfully, kill new container
|
||||
kill_new() {
|
||||
declare desc="wrapper function to kill newly started app container"
|
||||
local id="$1"
|
||||
docker inspect "$id" &> /dev/null && docker stop "$id" > /dev/null && docker kill "$id" &> /dev/null
|
||||
trap - INT TERM EXIT
|
||||
kill -9 $$
|
||||
}
|
||||
|
||||
# run checks first, then post-deploy hooks, which switches Nginx traffic
|
||||
if [[ "$(is_app_checks_enabled "$APP")" == "false" ]]; then
|
||||
dokku_log_info1 "zero downtime is disabled for app ($APP). skipping pre-flight checks"
|
||||
else
|
||||
trap 'kill_new $id' INT TERM EXIT
|
||||
dokku_log_info1 "Running pre-flight checks"
|
||||
plugn trigger check-deploy "$APP" "$id" "$PROC_TYPE" "$port" "$ipaddr"
|
||||
trap - INT TERM EXIT
|
||||
fi
|
||||
|
||||
# now using the new container
|
||||
[[ -n "$id" ]] && echo "$id" > "$DOKKU_CONTAINER_ID_FILE"
|
||||
[[ -n "$ipaddr" ]] && echo "$ipaddr" > "$DOKKU_IP_FILE"
|
||||
[[ -n "$port" ]] && echo "$port" > "$DOKKU_PORT_FILE"
|
||||
|
||||
# cleanup pre-migration files
|
||||
rm -f "$DOKKU_ROOT/$APP/CONTAINER" "$DOKKU_ROOT/$APP/IP" "$DOKKU_ROOT/$APP/PORT"
|
||||
|
||||
local CONTAINER_INDEX=$(( CONTAINER_INDEX + 1 ))
|
||||
done
|
||||
# cleanup when we scale down
|
||||
if [[ "$PROC_COUNT" == 0 ]]; then
|
||||
local CONTAINER_IDX_OFFSET=0
|
||||
else
|
||||
local CONTAINER_IDX_OFFSET=$((PROC_COUNT + 1))
|
||||
fi
|
||||
local container_state_filetype
|
||||
for container_state_filetype in CONTAINER IP PORT; do
|
||||
cd "$DOKKU_ROOT/$APP"
|
||||
find . -maxdepth 1 -name "$container_state_filetype.$PROC_TYPE.*" -printf "%f\n" | sort -t . -k 3 -n | tail -n +$CONTAINER_IDX_OFFSET | xargs rm -f
|
||||
done
|
||||
done < "$DOKKU_SCALE_FILE"
|
||||
|
||||
dokku_log_info1 "Running post-deploy"
|
||||
plugn trigger post-deploy "$APP" "$port" "$ipaddr" "$IMAGE_TAG"
|
||||
|
||||
# kill the old container
|
||||
if [[ -n "$oldids" ]]; then
|
||||
|
||||
if [[ -z "$DOKKU_WAIT_TO_RETIRE" ]]; then
|
||||
local DOKKU_APP_DOKKU_WAIT_TO_RETIRE=$(config_get "$APP" DOKKU_WAIT_TO_RETIRE || true)
|
||||
local DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE=$(config_get --global DOKKU_WAIT_TO_RETIRE || true)
|
||||
local DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
|
||||
fi
|
||||
|
||||
# Let the old container finish processing requests, before terminating it
|
||||
local WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
|
||||
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
|
||||
local oldid
|
||||
for oldid in $oldids; do
|
||||
dokku_log_info2 "$oldid"
|
||||
done
|
||||
(
|
||||
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
|
||||
}
|
||||
|
||||
shift 1
|
||||
dokku_deploy_cmd "$@"
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
dokku_receive_cmd() {
|
||||
declare desc="receives an app kicks off deploy process"
|
||||
local cmd="receive"
|
||||
local APP="$2"; local IMAGE=$(get_app_image_name "$APP"); local IMAGE_SOURCE_TYPE="$3"; local TMP_WORK_DIR="$4"
|
||||
if [[ -z "$DOKKU_SKIP_CLEANUP" ]]; then
|
||||
dokku_log_info1 "Cleaning up..."
|
||||
docker_cleanup
|
||||
else
|
||||
dokku_log_info1 "DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup"
|
||||
fi
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
||||
config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &> /dev/null
|
||||
dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||
release_and_deploy "$APP"
|
||||
}
|
||||
|
||||
dokku_receive_cmd "$@"
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
dokku_release_cmd() {
|
||||
declare desc="release phase"
|
||||
local cmd="release"
|
||||
local APP="$2"; local IMAGE_SOURCE_TYPE="$3"; local IMAGE_TAG="$4"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
verify_app_name "$APP"
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
herokuish)
|
||||
plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
if [[ -n $(config_export global) ]]; then
|
||||
local id=$(config_export global | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
fi
|
||||
if [[ -n $(config_export app "$APP") ]]; then
|
||||
local id=$(config_export app "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
fi
|
||||
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||
;;
|
||||
|
||||
*)
|
||||
dokku_log_fail "Releasing image source type $IMAGE_SOURCE_TYPE not supported!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
dokku_release_cmd "$@"
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
dokku_run_cmd() {
|
||||
@@ -20,9 +21,28 @@ dokku_run_cmd() {
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-run "$APP" "$IMAGE_TAG")
|
||||
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
|
||||
[[ "$DOKKU_RM_CONTAINER" ]] && local DOKKU_RUN_OPTS="--rm"
|
||||
has_tty && local DOKKU_RUN_OPTS+=" -i -t"
|
||||
|
||||
local DOKKU_RUN_OPTS=""
|
||||
if [[ "$DOKKU_RM_CONTAINER" ]]; then
|
||||
DOKKU_RUN_OPTS+=" --rm"
|
||||
elif [[ "$DOKKU_DETACH_CONTAINER" ]]; then
|
||||
DOKKU_RUN_OPTS+=" --detach"
|
||||
fi
|
||||
|
||||
has_tty && DOKKU_RUN_OPTS+=" -i -t"
|
||||
is_image_herokuish_based "$IMAGE" && local EXEC_CMD="/exec"
|
||||
|
||||
DOKKU_QUIET_OUTPUT=1 extract_procfile "$APP"
|
||||
|
||||
POTENTIAL_PROCFILE_KEY="$1"
|
||||
PROC_CMD=$(get_cmd_from_procfile "$APP" "$POTENTIAL_PROCFILE_KEY" || echo '')
|
||||
remove_procfile "$APP"
|
||||
|
||||
if [ ! -z "$PROC_CMD" ]; then
|
||||
dokku_log_info1 "Found '$POTENTIAL_PROCFILE_KEY' in Procfile, running that command"
|
||||
set -- "$PROC_CMD" "${@:2}"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
docker run $DOKKU_GLOBAL_RUN_ARGS $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
dokku_version_cmd() {
|
||||
declare desc="prints dokku version"
|
||||
|
||||
1
plugins/20_events/deployed-app-image-tag
Symbolic link
1
plugins/20_events/deployed-app-image-tag
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/deployed-app-repository
Symbolic link
1
plugins/20_events/deployed-app-repository
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core events logging plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
1
plugins/20_events/post-certs-remove
Symbolic link
1
plugins/20_events/post-certs-remove
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/post-certs-update
Symbolic link
1
plugins/20_events/post-certs-update
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/post-config-update
Symbolic link
1
plugins/20_events/post-config-update
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/post-create
Symbolic link
1
plugins/20_events/post-create
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/post-proxy-ports-update
Symbolic link
1
plugins/20_events/post-proxy-ports-update
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/post-stop
Symbolic link
1
plugins/20_events/post-stop
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/pre-disable-vhost
Symbolic link
1
plugins/20_events/pre-disable-vhost
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/pre-enable-vhost
Symbolic link
1
plugins/20_events/pre-enable-vhost
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/user-auth
Symbolic link
1
plugins/20_events/user-auth
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
apps_create() {
|
||||
declare desc="verifies app name and creates an app"
|
||||
@@ -34,11 +35,14 @@ apps_destroy() {
|
||||
|
||||
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
|
||||
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
|
||||
local cid
|
||||
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
|
||||
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
||||
|
||||
if [[ -n $DOKKU_APP_CIDS ]]; then
|
||||
local cid
|
||||
for cid in $DOKKU_APP_CIDS; do
|
||||
docker stop "$cid" > /dev/null || true
|
||||
# shellcheck disable=SC2086
|
||||
docker stop $DOCKER_STOP_TIME_ARG "$cid" > /dev/null || true
|
||||
docker rm "$cid" > /dev/null || true
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core apps plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core build-env plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -7,13 +7,14 @@ case "$1" in
|
||||
help_content_func () {
|
||||
declare desc="return certs plugin help content"
|
||||
cat<<help_content
|
||||
certs, Manage Dokku apps SSL (TLS) certs
|
||||
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: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)
|
||||
certs:info <app>, Show certificate information for an ssl endpoint.
|
||||
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate.
|
||||
certs:remove <app>, Remove an SSL Endpoint from an app.
|
||||
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app.
|
||||
certs:info <app>, Show certificate information for an ssl endpoint
|
||||
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate
|
||||
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
|
||||
help_content
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core certificate management plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
is_tar_import() {
|
||||
declare desc="determines if we have STDIN open in an attempt to detect a streamed tar import"
|
||||
@@ -35,9 +34,12 @@ certs_set() {
|
||||
verify_app_name "$2"
|
||||
local APP="$2"; local CRT_FILE="$3"; local KEY_FILE="$4"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
is_file_import "$CRT_FILE" "$KEY_FILE" || is_tar_import || dokku_log_fail "Tar archive containing server.crt and server.key expected on stdin"
|
||||
|
||||
if is_tar_import; then
|
||||
if is_file_import "$CRT_FILE" "$KEY_FILE"; then
|
||||
# importing from file
|
||||
true
|
||||
|
||||
elif is_tar_import; then
|
||||
local CERTS_SET_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_certs_set.XXXX")
|
||||
pushd "$CERTS_SET_TMP_WORK_DIR" &> /dev/null
|
||||
trap 'popd &> /dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR > /dev/null' RETURN
|
||||
@@ -62,6 +64,10 @@ certs_set() {
|
||||
else
|
||||
local KEY_FILE=$KEY_FILE_SEARCH
|
||||
fi
|
||||
|
||||
else
|
||||
dokku_log_fail "Tar archive containing server.crt and server.key expected on stdin"
|
||||
|
||||
fi
|
||||
|
||||
mkdir -p "$APP_SSL_PATH"
|
||||
@@ -70,7 +76,8 @@ certs_set() {
|
||||
chmod 750 "$APP_SSL_PATH"
|
||||
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key"
|
||||
cd "$DOKKU_ROOT"
|
||||
nginx_build_config "$APP"
|
||||
plugn trigger post-certs-update "$APP"
|
||||
plugn trigger post-domains-update "$APP"
|
||||
}
|
||||
|
||||
certs_set "$@"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
certs_generate_cmd() {
|
||||
declare desc="generates a self-signed SSL certificate/key combo"
|
||||
@@ -26,7 +25,7 @@ certs_generate_cmd() {
|
||||
mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$APP_SSL_PATH"
|
||||
chmod 750 "$APP_SSL_PATH"
|
||||
chmod 640 "$APP_SSL_PATH/server.key" "$APP_SSL_PATH/server.crt"
|
||||
[[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || nginx_build_config "$APP")
|
||||
[[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP")
|
||||
dokku_log_info1 "The following is a certificate signing request that can be used"
|
||||
dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN"
|
||||
dokku_log_info1 "by a CA of your choosing."
|
||||
|
||||
@@ -12,6 +12,7 @@ certs_remove_cmd() {
|
||||
if [[ -d "$APP_SSL_PATH" ]]; then
|
||||
dokku_log_info1 "Removing SSL endpoint from $APP"
|
||||
rm -rf "$APP_SSL_PATH"
|
||||
plugn trigger post-certs-remove "$APP"
|
||||
plugn trigger post-domains-update "$APP"
|
||||
else
|
||||
dokku_log_fail "An app-specific SSL endpoint is not defined"
|
||||
|
||||
@@ -58,8 +58,8 @@ checks_check_deploy() {
|
||||
eval "$(config_export global)"
|
||||
eval "$(config_export app "$APP")"
|
||||
|
||||
if [[ "$(is_app_checks_enabled "$APP")" == "false" ]]; then
|
||||
dokku_log_info2_quiet "Zero downtime checks for app ($APP) have been disabled. moving on..."
|
||||
if [[ "$(is_app_proctype_checks_skipped "$APP" "$DOKKU_APP_CONTAINER_TYPE")" == "true" ]]; then
|
||||
dokku_log_info2_quiet "Zero downtime checks for app ($APP) have been skipped. moving on..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -8,15 +8,16 @@ case "$1" in
|
||||
declare desc="return checks plugin help content"
|
||||
cat<<help_content
|
||||
checks <app>, Show zero-downtime status
|
||||
checks:enable <app>, Enable zero-downtime checks
|
||||
checks:disable <app>, Disable zero-downtime checks
|
||||
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "checks:help" ]] ; then
|
||||
echo -e 'Usage: dokku checks[:COMAND]'
|
||||
echo ''
|
||||
echo 'Manage zero-downtime checks.'
|
||||
echo 'Manage zero-downtime settings.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
|
||||
@@ -3,15 +3,27 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
is_app_checks_enabled() {
|
||||
declare desc="return app zero-downtime checks status"
|
||||
is_app_proctype_checks_disabled() {
|
||||
declare desc="return true if app's proctype(s) checks are disabled"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local DOKKU_CHECKS_ENABLED=$(config_get "$APP" DOKKU_CHECKS_ENABLED)
|
||||
local PROCTYPE="$2" status=false
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
|
||||
if [[ -z "$DOKKU_CHECKS_ENABLED" ]] || [[ "$DOKKU_CHECKS_ENABLED" == "1" ]];then
|
||||
local status=true
|
||||
else
|
||||
local status=false
|
||||
if [[ "$DOKKU_CHECKS_DISABLED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] ;then
|
||||
status=true
|
||||
fi
|
||||
|
||||
echo $status
|
||||
}
|
||||
|
||||
is_app_proctype_checks_skipped() {
|
||||
declare desc="return true if app's proctype(s) checks are skipped"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local PROCTYPE="$2" status=false
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
|
||||
|
||||
if [[ "$DOKKU_CHECKS_SKIPPED" == "_all_" ]] || [[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]] ;then
|
||||
status=true
|
||||
fi
|
||||
|
||||
echo $status
|
||||
|
||||
@@ -3,39 +3,63 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
migrate_checks_vars() {
|
||||
migrate_checks_vars_0_5_0() {
|
||||
declare desc="migrates deprecated CHECKS config variables to simplified counter part introduced in 0.5.x"
|
||||
local APPS="$(dokku_apps)"
|
||||
local GLOBAL_SKIP_ALL_CHECKS=$(dokku config:get --global DOKKU_SKIP_ALL_CHECKS || true)
|
||||
local GLOBAL_SKIP_DEFAULT_CHECKS=$(dokku config:get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
local GLOBAL_SKIP_ALL_CHECKS=$(config_get --global DOKKU_SKIP_ALL_CHECKS || true)
|
||||
local GLOBAL_SKIP_DEFAULT_CHECKS=$(config_get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
|
||||
local app
|
||||
|
||||
dokku_log_info1 "Migrating zero downtime env variables. The following variables have been deprecated"
|
||||
dokku_log_info1 "Migrating zero downtime env variables to 0.5.x. The following variables have been deprecated"
|
||||
dokku_log_info2 "DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS"
|
||||
dokku_log_info2 "Please use dokku checks:[disable|enable] <app> to control zero downtime functionality"
|
||||
|
||||
for app in $APPS; do
|
||||
local APP_SKIP_ALL_CHECKS=$(dokku config:get "$app" DOKKU_SKIP_ALL_CHECKS || true)
|
||||
local APP_SKIP_DEFAULT_CHECKS=$(dokku config:get "$app" DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
local APP_SKIP_ALL_CHECKS=$(config_get "$app" DOKKU_SKIP_ALL_CHECKS || true)
|
||||
local APP_SKIP_DEFAULT_CHECKS=$(config_get "$app" DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
|
||||
if [[ "$APP_SKIP_ALL_CHECKS" == "true" ]] || [[ "$APP_SKIP_DEFAULT_CHECKS" == "true" ]] || \
|
||||
[[ "$GLOBAL_SKIP_ALL_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_DEFAULT_CHECKS" == "true" ]]; then
|
||||
dokku_log_info2 ""
|
||||
dokku_log_info2 "zero downtime disabled for app ($app)"
|
||||
if [[ "$APP_SKIP_ALL_CHECKS" == "true" ]] || [[ "$APP_SKIP_DEFAULT_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_ALL_CHECKS" == "true" ]] || [[ "$GLOBAL_SKIP_DEFAULT_CHECKS" == "true" ]]; then
|
||||
dokku_log_info2 ""
|
||||
dokku_log_info2 "zero downtime checks disabled for app ($app)"
|
||||
config_set --no-restart "$app" DOKKU_CHECKS_ENABLED=0
|
||||
fi
|
||||
if [[ -n "$APP_SKIP_ALL_CHECKS" ]] || [[ -n "$APP_SKIP_DEFAULT_CHECKS" ]]; then
|
||||
config_unset --no-restart "$app" DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
|
||||
fi
|
||||
dokku_log_info2 "Migration complete"
|
||||
dokku_log_info2 ""
|
||||
done
|
||||
|
||||
if [[ -n "$GLOBAL_SKIP_ALL_CHECKS" ]] || [[ -n "$GLOBAL_SKIP_DEFAULT_CHECKS" ]]; then
|
||||
dokku_log_info1 "Removing global zero downtime settings"
|
||||
config_unset --global DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
|
||||
fi
|
||||
dokku_log_info2 "Migration complete"
|
||||
dokku_log_info2 ""
|
||||
}
|
||||
|
||||
migrate_checks_vars "$@"
|
||||
migrate_checks_vars_0_5_0 "$@"
|
||||
|
||||
migrate_checks_vars_0_6_0() {
|
||||
declare desc="migrates CHECKS config variables from 0.5.x to support fully-disabled zero-downtime checks"
|
||||
local APPS="$(dokku_apps)"
|
||||
|
||||
local app
|
||||
|
||||
dokku_log_info1 "Migrating zero downtime env variables to 0.6.x. The following variables will be migrated"
|
||||
dokku_log_info2 "DOKKU_CHECKS_ENABLED -> DOKKU_CHECKS_SKIPPED"
|
||||
for app in $APPS; do
|
||||
local APP_DOKKU_CHECKS_ENABLED=$(config_get "$app" DOKKU_CHECKS_ENABLED || true)
|
||||
if [[ $APP_DOKKU_CHECKS_ENABLED ]]; then
|
||||
if [[ "$APP_DOKKU_CHECKS_ENABLED" == "0" ]]; then
|
||||
dokku_log_info2 ""
|
||||
dokku_log_info2 "zero downtime checks disabled for app ($app)"
|
||||
config_set --no-restart "$app" DOKKU_CHECKS_SKIPPED="_all_"
|
||||
fi
|
||||
config_unset --no-restart "$app" DOKKU_CHECKS_ENABLED || true
|
||||
fi
|
||||
done
|
||||
dokku_log_info2 "Migration complete"
|
||||
dokku_log_info2 ""
|
||||
}
|
||||
|
||||
migrate_checks_vars_0_6_0 "$@"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core checks plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -4,19 +4,24 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
checks_main_cmd() {
|
||||
declare desc="displays app zero-downtime status"
|
||||
declare desc="displays app zero-downtime checks status"
|
||||
local cmd="checks"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APPS=$(dokku_apps)
|
||||
if [[ -n "$1" ]]; then
|
||||
local APPS="$1"
|
||||
fi
|
||||
|
||||
dokku_col_log_info1_quiet "App Name" "Zero-Downtime Status"
|
||||
dokku_col_log_info1_quiet "App Name" "Proctypes Disabled" "Proctypes Skipped"
|
||||
local app
|
||||
for app in $APPS; do
|
||||
verify_app_name "$app"
|
||||
dokku_col_log_msg "$app" "$(is_app_checks_enabled "$app")"
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$app" DOKKU_CHECKS_DISABLED)
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$app" DOKKU_CHECKS_SKIPPED)
|
||||
local checks_disabled="${DOKKU_CHECKS_DISABLED:-none}"
|
||||
local checks_skipped="${DOKKU_CHECKS_SKIPPED:-none}"
|
||||
dokku_col_log_msg "$app" "$checks_disabled" "$checks_skipped"
|
||||
done
|
||||
}
|
||||
|
||||
checks_main_cmd "$2"
|
||||
checks_main_cmd "$@"
|
||||
|
||||
@@ -4,18 +4,41 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
checks_disable_cmd() {
|
||||
declare desc="disable zero-downtime for app"
|
||||
local cmd="check:disable"
|
||||
declare desc="disable zero-downtime checks for app/proctypes"
|
||||
local cmd="checks:disable"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local PROCTYPES="${2:-_all_}"
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
|
||||
|
||||
if [[ "$(is_app_checks_enabled "$APP")" == "true" ]]; then
|
||||
if [[ "$PROCTYPES" == "_all_" ]]; then
|
||||
dokku_log_info1 "Disabling zero downtime for app ($APP)"
|
||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
||||
# shellcheck disable=SC2086
|
||||
config_set $CONFIG_SET_ARGS $APP DOKKU_CHECKS_ENABLED=0
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$PROCTYPES"
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
|
||||
else
|
||||
dokku_log_info1 "zero downtime is already disable for app ($APP)"
|
||||
dokku_log_info1 "Disabling zero downtime for app's ($APP) proctypes ($PROCTYPES)"
|
||||
local PROCTYPE OIFS="$IFS" IFS=,
|
||||
for PROCTYPE in $PROCTYPES; do
|
||||
IFS="$OIFS"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "false" ]] && \
|
||||
DOKKU_CHECKS_DISABLED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "true" ]] && \
|
||||
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
||||
done
|
||||
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_DISABLED")"
|
||||
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
|
||||
else
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
|
||||
fi
|
||||
|
||||
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
|
||||
else
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checks_disable_cmd "$2" --no-restart
|
||||
checks_disable_cmd "$@"
|
||||
|
||||
@@ -4,18 +4,40 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
checks_enable_cmd() {
|
||||
declare desc="enable zero-downtime for app"
|
||||
declare desc="enable zero-downtime checks for app/proctypes"
|
||||
local cmd="checks:enable"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local PROCTYPES="${2:-_all_}"
|
||||
|
||||
if [[ "$(is_app_checks_enabled "$APP")" == "false" ]]; then
|
||||
dokku_log_info1 "Enabling zero downtime for app ($APP)"
|
||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
||||
# shellcheck disable=SC2086
|
||||
config_set $CONFIG_SET_ARGS $APP DOKKU_CHECKS_ENABLED=1
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
|
||||
|
||||
if [[ "$PROCTYPES" == "_all_" ]]; then
|
||||
dokku_log_info1 "Enabling zero downtime for app's ($APP)"
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
|
||||
else
|
||||
dokku_log_info1 "zero downtime is already enabled for app ($APP)"
|
||||
dokku_log_info1 "Enabling zero downtime for app's ($APP) proctypes ($PROCTYPES)"
|
||||
local PROCTYPE OIFS="$IFS" IFS=,
|
||||
for PROCTYPE in $PROCTYPES; do
|
||||
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
||||
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
||||
done
|
||||
|
||||
IFS="$OIFS"
|
||||
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
|
||||
else
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
|
||||
fi
|
||||
|
||||
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
|
||||
else
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checks_enable_cmd "$2" --no-restart
|
||||
checks_enable_cmd "$@"
|
||||
|
||||
44
plugins/checks/subcommands/skip
Executable file
44
plugins/checks/subcommands/skip
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
checks_skip_cmd() {
|
||||
declare desc="skip zero-downtime checks for app/proctypes"
|
||||
local cmd="checks:skip"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local PROCTYPES="${2:-_all_}"
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true)
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true)
|
||||
|
||||
if [[ "$PROCTYPES" == "_all_" ]]; then
|
||||
dokku_log_info1 "Skipping zero downtime for app ($APP)"
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$PROCTYPES"
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
|
||||
else
|
||||
dokku_log_info1 "Skipping zero downtime for app's ($APP) proctypes ($PROCTYPES)"
|
||||
local PROCTYPE OIFS="$IFS" IFS=,
|
||||
for PROCTYPE in $PROCTYPES; do
|
||||
IFS="$OIFS"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")" == "false" ]] && \
|
||||
DOKKU_CHECKS_SKIPPED="$(add_val_to_list "$PROCTYPE" "$DOKKU_CHECKS_SKIPPED")"
|
||||
[[ "$(is_val_in_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")" == "true" ]] && \
|
||||
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "$PROCTYPE" "$DOKKU_CHECKS_DISABLED")"
|
||||
done
|
||||
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_SKIPPED")"
|
||||
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
|
||||
else
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
|
||||
fi
|
||||
|
||||
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
|
||||
else
|
||||
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checks_skip_cmd "$@"
|
||||
@@ -167,6 +167,25 @@ get_app_image_repo() {
|
||||
echo "$IMAGE_REPO"
|
||||
}
|
||||
|
||||
get_deploying_app_image_name() {
|
||||
declare desc="return deployed image identifier for a given app, tag tuple. validate if tag is presented"
|
||||
local APP="$1"; local IMAGE_TAG="$2";
|
||||
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null"
|
||||
|
||||
local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP")
|
||||
local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP")
|
||||
|
||||
if [[ -n "$NEW_IMAGE_TAG" ]]; then
|
||||
IMAGE_TAG="$NEW_IMAGE_TAG"
|
||||
fi
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
if [[ -n "$IMAGE_REMOTE_REPOSITORY" ]]; then
|
||||
IMAGE="${IMAGE_REMOTE_REPOSITORY}${IMAGE}"
|
||||
fi
|
||||
echo "$IMAGE"
|
||||
}
|
||||
|
||||
get_app_image_name() {
|
||||
declare desc="return image identifier for a given app, tag tuple. validate if tag is presented"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE_REPO=$(get_app_image_repo "$APP")
|
||||
@@ -196,7 +215,7 @@ is_image_herokuish_based() {
|
||||
declare desc="returns true if app image is based on herokuish"
|
||||
# circleci can't support --rm as they run lxc in lxc
|
||||
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
|
||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec"
|
||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec" &> /dev/null
|
||||
}
|
||||
|
||||
is_number() {
|
||||
@@ -228,6 +247,9 @@ parse_args() {
|
||||
--quiet)
|
||||
export DOKKU_QUIET_OUTPUT=1
|
||||
;;
|
||||
--detach)
|
||||
export DOKKU_DETACH_CONTAINER=1
|
||||
;;
|
||||
--trace)
|
||||
export DOKKU_TRACE=1
|
||||
;;
|
||||
@@ -266,7 +288,7 @@ copy_from_image() {
|
||||
}
|
||||
|
||||
get_app_container_ids() {
|
||||
declare desc="returns list of docker container ids for given app"
|
||||
declare desc="returns list of docker container ids for given app and optional container_type"
|
||||
local APP="$1"; local CONTAINER_TYPE="$2"
|
||||
verify_app_name "$APP"
|
||||
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
@@ -293,21 +315,37 @@ get_app_container_ids() {
|
||||
}
|
||||
|
||||
get_app_running_container_ids() {
|
||||
declare desc="return list of running docker container ids for given apps"
|
||||
local APP=$1
|
||||
declare desc="return list of running docker container ids for given app and optional container_type"
|
||||
local APP="$1" CONTAINER_TYPE="$2"
|
||||
verify_app_name "$APP"
|
||||
|
||||
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
|
||||
local CIDS=$(get_app_container_ids "$APP")
|
||||
local CIDS=$(get_app_container_ids "$APP" "$CONTAINER_TYPE")
|
||||
|
||||
for CID in $CIDS; do
|
||||
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
|
||||
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2>/dev/null || true)
|
||||
[[ "$APP_CONTAINER_STATUS" == "true" ]] && local APP_RUNNING_CONTAINER_IDS+="$CID "
|
||||
done
|
||||
|
||||
echo "$APP_RUNNING_CONTAINER_IDS"
|
||||
}
|
||||
|
||||
get_app_running_container_types() {
|
||||
declare desc="return list of running container types for given app"
|
||||
local APP=$1 CONTAINER_TYPES
|
||||
verify_app_name "$APP"
|
||||
|
||||
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
|
||||
|
||||
CONTAINER_TYPES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -print0 | xargs -0)"
|
||||
if [[ -n "$CONTAINER_TYPES" ]]; then
|
||||
CONTAINER_TYPES="${CONTAINER_TYPES//$DOKKU_ROOT\/$APP\//}"
|
||||
CONTAINER_TYPES="$(tr " " $'\n' <<< "$CONTAINER_TYPES" | awk -F. '{ print $2 }' | sort | uniq | xargs)"
|
||||
fi
|
||||
|
||||
echo "$CONTAINER_TYPES"
|
||||
}
|
||||
|
||||
get_cmd_from_procfile() {
|
||||
declare desc="parse cmd from app Procfile"
|
||||
local APP=$1; local PROC_TYPE=$2; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
|
||||
@@ -376,6 +414,272 @@ is_app_running() {
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_build() {
|
||||
declare desc="build phase"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local TMP_WORK_DIR="$3"; local IMAGE=$(get_app_image_name "$APP")
|
||||
verify_app_name "$APP"
|
||||
|
||||
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
|
||||
eval "$(config_export app "$APP")"
|
||||
pushd "$TMP_WORK_DIR" &> /dev/null
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
herokuish)
|
||||
local id=$(tar -c . | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
[[ -d $CACHE_DIR ]] || mkdir -p "$CACHE_DIR"
|
||||
plugn trigger pre-build-buildpack "$APP"
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
|
||||
docker attach "$id"
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
|
||||
plugn trigger post-build-buildpack "$APP"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# extract first port from Dockerfile
|
||||
local DOCKERFILE_PORTS=$(get_dockerfile_exposed_ports Dockerfile)
|
||||
[[ -n "$DOCKERFILE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKERFILE_PORTS"
|
||||
|
||||
# extract ENTRYPOINT/CMD from Dockerfile
|
||||
local DOCKERFILE_ENTRYPOINT=$(extract_directive_from_dockerfile Dockerfile ENTRYPOINT)
|
||||
[[ -n "$DOCKERFILE_ENTRYPOINT" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_ENTRYPOINT="$DOCKERFILE_ENTRYPOINT"
|
||||
local DOCKERFILE_CMD=$(extract_directive_from_dockerfile Dockerfile CMD)
|
||||
[[ -n "$DOCKERFILE_CMD" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_CMD="$DOCKERFILE_CMD"
|
||||
plugn trigger pre-build-dockerfile "$APP"
|
||||
|
||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
|
||||
# strip --volume and -v args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE .
|
||||
|
||||
plugn trigger post-build-dockerfile "$APP"
|
||||
;;
|
||||
|
||||
*)
|
||||
dokku_log_fail "Building image source type $IMAGE_SOURCE_TYPE not supported!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
dokku_release() {
|
||||
declare desc="release phase"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
verify_app_name "$APP"
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
herokuish)
|
||||
plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
if [[ -n $(config_export global) ]]; then
|
||||
local id=$(config_export global | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
fi
|
||||
if [[ -n $(config_export app "$APP") ]]; then
|
||||
local id=$(config_export app "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
|
||||
test "$(docker wait "$id")" -eq 0
|
||||
docker commit "$id" "$IMAGE" > /dev/null
|
||||
fi
|
||||
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||
;;
|
||||
|
||||
*)
|
||||
dokku_log_fail "Releasing image source type $IMAGE_SOURCE_TYPE not supported!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
dokku_deploy_cmd() {
|
||||
declare desc="deploy phase"
|
||||
local cmd="deploy"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to deploy"
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
|
||||
verify_app_name "$APP"
|
||||
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
|
||||
|
||||
is_image_herokuish_based "$IMAGE" && local DOKKU_HEROKUISH=true
|
||||
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
local oldids=$(get_app_container_ids "$APP")
|
||||
|
||||
local DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
|
||||
local DOKKU_IS_APP_PROXY_ENABLED="$(is_app_proxy_enabled "$APP")"
|
||||
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
|
||||
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
|
||||
|
||||
local line; local PROC_TYPE; local PROC_COUNT; local CONTAINER_INDEX
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
[[ "$line" =~ ^#.* ]] && continue
|
||||
line="$(strip_inline_comments "$line")"
|
||||
PROC_TYPE=${line%%=*}
|
||||
PROC_COUNT=${line#*=}
|
||||
CONTAINER_INDEX=1
|
||||
|
||||
if [[ "$(is_app_proctype_checks_disabled "$APP" "$PROC_TYPE")" == "true" ]]; then
|
||||
dokku_log_info1 "zero downtime is disabled for app ($APP.$PROC_TYPE). stopping currently running containers"
|
||||
local cid proctype_oldids="$(get_app_running_container_ids "$APP" "$PROC_TYPE")"
|
||||
for cid in $proctype_oldids; do
|
||||
dokku_log_info2 "stopping $APP.$PROC_TYPE ($cid)"
|
||||
# shellcheck disable=SC2086
|
||||
docker stop $DOCKER_STOP_TIME_ARG "$cid" &> /dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
|
||||
local id=""; local port=""; local ipaddr=""
|
||||
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
local DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
local DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
|
||||
# start the app
|
||||
local DOCKER_ARGS="$DOKKU_DEFAULT_DOCKER_ARGS"
|
||||
local DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' "
|
||||
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
|
||||
|
||||
[[ -n "$DOKKU_HEROKUISH" ]] && local START_CMD="/start $PROC_TYPE"
|
||||
|
||||
if [[ -z "$DOKKU_HEROKUISH" ]]; then
|
||||
local DOKKU_DOCKERFILE_PORTS=($(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true))
|
||||
local DOKKU_DOCKERFILE_START_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_START_CMD || true)
|
||||
local DOKKU_PROCFILE_START_CMD=$(get_cmd_from_procfile "$APP" "$PROC_TYPE")
|
||||
local START_CMD=${DOKKU_DOCKERFILE_START_CMD:-$DOKKU_PROCFILE_START_CMD}
|
||||
fi
|
||||
|
||||
if [[ "$PROC_TYPE" == "web" ]]; then
|
||||
if [[ -z "${DOKKU_DOCKERFILE_PORTS[*]}" ]]; then
|
||||
local port=5000
|
||||
local DOKKU_DOCKER_PORT_ARGS+="-p $port"
|
||||
else
|
||||
local p
|
||||
for p in ${DOKKU_DOCKERFILE_PORTS[*]};do
|
||||
if [[ ! "$p" =~ .*udp.* ]]; then
|
||||
# set port to first non-udp port
|
||||
local p=${p//\/tcp}
|
||||
local port=${port:="$p"}
|
||||
fi
|
||||
local DOKKU_DOCKER_PORT_ARGS+=" -p $p "
|
||||
done
|
||||
fi
|
||||
if [[ "$DOKKU_IS_APP_PROXY_ENABLED" == "true" ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
local ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$id")
|
||||
# Docker < 1.9 compatibility
|
||||
if [[ -z $ipaddr ]]; then
|
||||
local ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$id")
|
||||
fi
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
local port=$(docker port "$id" "$port" | sed 's/[0-9.]*://')
|
||||
local ipaddr=127.0.0.1
|
||||
fi
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
fi
|
||||
|
||||
kill_new() {
|
||||
declare desc="wrapper function to kill newly started app container"
|
||||
local id="$1"
|
||||
docker inspect "$id" &> /dev/null && docker stop "$id" > /dev/null && docker kill "$id" &> /dev/null
|
||||
trap - INT TERM EXIT
|
||||
kill -9 $$
|
||||
}
|
||||
|
||||
# run checks first, then post-deploy hooks, which switches proxy traffic
|
||||
trap 'kill_new $id' INT TERM EXIT
|
||||
if [[ "$(is_app_proctype_checks_disabled "$APP" "$PROC_TYPE")" == "false" ]]; then
|
||||
dokku_log_info1 "Attempting pre-flight checks"
|
||||
plugn trigger check-deploy "$APP" "$id" "$PROC_TYPE" "$port" "$ipaddr"
|
||||
fi
|
||||
trap - INT TERM EXIT
|
||||
|
||||
# now using the new container
|
||||
[[ -n "$id" ]] && echo "$id" > "$DOKKU_CONTAINER_ID_FILE"
|
||||
[[ -n "$ipaddr" ]] && echo "$ipaddr" > "$DOKKU_IP_FILE"
|
||||
[[ -n "$port" ]] && echo "$port" > "$DOKKU_PORT_FILE"
|
||||
|
||||
# cleanup pre-migration files
|
||||
rm -f "$DOKKU_ROOT/$APP/CONTAINER" "$DOKKU_ROOT/$APP/IP" "$DOKKU_ROOT/$APP/PORT"
|
||||
|
||||
local CONTAINER_INDEX=$(( CONTAINER_INDEX + 1 ))
|
||||
done
|
||||
# cleanup when we scale down
|
||||
if [[ "$PROC_COUNT" == 0 ]]; then
|
||||
local CONTAINER_IDX_OFFSET=0
|
||||
else
|
||||
local CONTAINER_IDX_OFFSET=$((PROC_COUNT + 1))
|
||||
fi
|
||||
local container_state_filetype
|
||||
for container_state_filetype in CONTAINER IP PORT; do
|
||||
cd "$DOKKU_ROOT/$APP"
|
||||
find . -maxdepth 1 -name "$container_state_filetype.$PROC_TYPE.*" -printf "%f\n" | sort -t . -k 3 -n | tail -n +$CONTAINER_IDX_OFFSET | xargs rm -f
|
||||
done
|
||||
done < "$DOKKU_SCALE_FILE"
|
||||
|
||||
dokku_log_info1 "Running post-deploy"
|
||||
plugn trigger post-deploy "$APP" "$port" "$ipaddr" "$IMAGE_TAG"
|
||||
|
||||
# kill the old container
|
||||
if [[ -n "$oldids" ]]; then
|
||||
|
||||
if [[ -z "$DOKKU_WAIT_TO_RETIRE" ]]; then
|
||||
local DOKKU_APP_DOKKU_WAIT_TO_RETIRE=$(config_get "$APP" DOKKU_WAIT_TO_RETIRE || true)
|
||||
local DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE=$(config_get --global DOKKU_WAIT_TO_RETIRE || true)
|
||||
local DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
|
||||
fi
|
||||
|
||||
# Let the old container finish processing requests, before terminating it
|
||||
local WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
|
||||
dokku_log_info1 "Shutting down old containers in $WAIT seconds"
|
||||
local oldid
|
||||
for oldid in $oldids; do
|
||||
dokku_log_info2 "$oldid"
|
||||
done
|
||||
(
|
||||
exec >/dev/null 2>/dev/null </dev/null
|
||||
trap '' INT HUP
|
||||
sleep "$WAIT"
|
||||
for oldid in $oldids; do
|
||||
# Attempt to stop, if that fails, then force a kill as docker seems
|
||||
# to not send SIGKILL as the docs would indicate. If that fails, move
|
||||
# on to the next.
|
||||
# shellcheck disable=SC2086
|
||||
docker stop $DOCKER_STOP_TIME_ARG "$oldid" \
|
||||
|| docker kill "$oldid" \
|
||||
|| plugn trigger retire-container-failed "$APP" # plugin trigger for event logging
|
||||
done
|
||||
) & disown -a
|
||||
# Use trap since disown/nohup don't seem to keep child alive
|
||||
# Give child process just enough time to set the traps
|
||||
sleep 0.1
|
||||
fi
|
||||
}
|
||||
|
||||
release_and_deploy() {
|
||||
declare desc="main function for releasing and deploying an app"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
@@ -388,6 +692,11 @@ release_and_deploy() {
|
||||
local IMAGE_SOURCE_TYPE="herokuish"
|
||||
else
|
||||
local IMAGE_SOURCE_TYPE="dockerfile"
|
||||
local DOKKU_DOCKERFILE_PORTS=$(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true)
|
||||
if [[ -z "$DOKKU_DOCKERFILE_PORTS" ]]; then
|
||||
local DOCKER_IMAGE_PORTS=$(get_exposed_ports_from_image "$IMAGE")
|
||||
[[ -n "$DOCKER_IMAGE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKER_IMAGE_PORTS"
|
||||
fi
|
||||
fi
|
||||
|
||||
local DOKKU_APP_SKIP_DEPLOY="$(config_get "$APP" DOKKU_SKIP_DEPLOY || true)"
|
||||
@@ -396,11 +705,11 @@ release_and_deploy() {
|
||||
local DOKKU_SKIP_DEPLOY=${DOKKU_APP_SKIP_DEPLOY:="$DOKKU_GLOBAL_SKIP_DEPLOY"}
|
||||
|
||||
dokku_log_info1 "Releasing $APP ($IMAGE)..."
|
||||
dokku release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG"
|
||||
dokku_release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG"
|
||||
|
||||
if [[ "$DOKKU_SKIP_DEPLOY" != "true" ]]; then
|
||||
dokku_log_info1 "Deploying $APP ($IMAGE)..."
|
||||
dokku deploy "$APP" "$IMAGE_TAG"
|
||||
dokku_deploy_cmd "$APP" "$IMAGE_TAG"
|
||||
dokku_log_info2 "Application deployed:"
|
||||
get_app_urls urls "$APP" | sed "s/^/ /"
|
||||
else
|
||||
@@ -411,6 +720,23 @@ release_and_deploy() {
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_receive() {
|
||||
declare desc="receives an app kicks off deploy process"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local IMAGE_SOURCE_TYPE="$2"; local TMP_WORK_DIR="$3"
|
||||
if [[ -z "$DOKKU_SKIP_CLEANUP" ]]; then
|
||||
dokku_log_info1 "Cleaning up..."
|
||||
docker_cleanup
|
||||
else
|
||||
dokku_log_info1 "DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup"
|
||||
fi
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
||||
config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &> /dev/null
|
||||
dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||
release_and_deploy "$APP"
|
||||
}
|
||||
|
||||
docker_cleanup() {
|
||||
declare desc="cleans up all exited/dead containers and removes all dangling images"
|
||||
# delete all non-running containers
|
||||
@@ -530,9 +856,8 @@ disable_app_vhost() {
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
local APP_URLS_FILE="$DOKKU_ROOT/$APP/URLS"
|
||||
local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT)
|
||||
local DOKKU_NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT)
|
||||
|
||||
plugn trigger pre-disable-vhost "$APP"
|
||||
if [[ -f "$APP_VHOST_FILE" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
|
||||
rm "$APP_VHOST_FILE"
|
||||
@@ -541,12 +866,6 @@ disable_app_vhost() {
|
||||
dokku_log_info1 "VHOST support disabled, deleting $APP/URLS"
|
||||
rm "$APP_URLS_FILE"
|
||||
fi
|
||||
if [[ "$DOKKU_NGINX_PORT" == "80" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_NGINX_PORT
|
||||
fi
|
||||
if [[ "$DOKKU_NGINX_SSL_PORT" == "443" ]]; then
|
||||
config_unset --no-restart "$APP" DOKKU_NGINX_SSL_PORT
|
||||
fi
|
||||
|
||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
||||
# shellcheck disable=SC2086
|
||||
@@ -559,7 +878,7 @@ enable_app_vhost() {
|
||||
|
||||
local APP=$1; verify_app_name "$APP"
|
||||
|
||||
config_unset --no-restart "$APP" DOKKU_NGINX_PORT DOKKU_NGINX_SSL_PORT
|
||||
plugn trigger pre-enable-vhost "$APP"
|
||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
||||
# shellcheck disable=SC2086
|
||||
config_set $CONFIG_SET_ARGS "$APP" NO_VHOST=0
|
||||
@@ -571,6 +890,29 @@ get_dockerfile_exposed_ports() {
|
||||
echo "$DOCKERFILE_PORTS"
|
||||
}
|
||||
|
||||
get_exposed_ports_from_image() {
|
||||
declare desc="return all exposed ports from passed image name"
|
||||
local IMAGE="$1"; verify_image "$IMAGE"
|
||||
# shellcheck disable=SC2016
|
||||
local DOCKER_IMAGE_EXPOSED_PORTS="$(docker inspect -f '{{range $key, $value := .Config.ExposedPorts}}{{$key}} {{end}}' "$IMAGE")"
|
||||
echo "$DOCKER_IMAGE_EXPOSED_PORTS"
|
||||
}
|
||||
|
||||
get_entrypoint_from_image() {
|
||||
declare desc="return .Config.Entrypoint from passed image name"
|
||||
local IMAGE="$1"; verify_image "$IMAGE"
|
||||
local DOCKER_IMAGE_ENTRYPOINT="$(docker inspect --format '{{range .Config.Entrypoint}}{{.}} {{end}}' "$IMAGE")"
|
||||
echo "ENTRYPOINT $DOCKER_IMAGE_ENTRYPOINT"
|
||||
}
|
||||
|
||||
get_cmd_from_image() {
|
||||
declare desc="return .Config.Cmd from passed image name"
|
||||
local IMAGE="$1"; verify_image "$IMAGE"
|
||||
local DOCKER_IMAGE_CMD="$(docker inspect --format '{{range .Config.Cmd}}{{.}} {{end}}' "$IMAGE")"
|
||||
DOCKER_IMAGE_CMD="${DOCKER_IMAGE_CMD/\/bin\/sh -c/}"
|
||||
echo "CMD $DOCKER_IMAGE_CMD"
|
||||
}
|
||||
|
||||
extract_directive_from_dockerfile() {
|
||||
declare desc="return requested directive from passed file path"
|
||||
local FILE_PATH="$1"; local SEARCH_STRING="$2"
|
||||
@@ -610,36 +952,43 @@ get_container_ports() {
|
||||
get_app_urls() {
|
||||
declare desc="print an app's available urls"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
local APP="$2"; verify_app_name "$APP"
|
||||
local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")"
|
||||
local URLS_FILE="$DOKKU_ROOT/$APP/URLS"
|
||||
local DOKKU_PROXY_PORT_MAP=$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)
|
||||
|
||||
if [[ -s "$URLS_FILE" ]]; then
|
||||
local app_urls="$(egrep -v "^#" "$URLS_FILE")"
|
||||
if [[ -n "$RAW_TCP_PORTS" ]]; then
|
||||
for url in ${app_urls[*]}; do
|
||||
for p in $RAW_TCP_PORTS; do
|
||||
local port_urls+="$url:$p "
|
||||
if [[ -n "$DOKKU_PROXY_PORT_MAP" ]]; then
|
||||
local port_map app_vhost
|
||||
local app_vhosts=$(get_app_domains "$APP")
|
||||
for port_map in $DOKKU_PROXY_PORT_MAP; do
|
||||
local scheme="$(awk -F ':' '{ print $1 }' <<< "$port_map")"
|
||||
local listen_port="$(awk -F ':' '{ print $2 }' <<< "$port_map")"
|
||||
for app_vhost in $app_vhosts; do
|
||||
if [[ "$listen_port" != "80" ]] && [[ "$listen_port" != "443" ]]; then
|
||||
port_urls+=" $scheme://$app_vhost:$listen_port "
|
||||
else
|
||||
port_urls+=" $scheme://$app_vhost "
|
||||
fi
|
||||
done
|
||||
done
|
||||
local port_urls="$(echo "$port_urls"| xargs)"
|
||||
fi
|
||||
local URLS=${port_urls:=$app_urls}
|
||||
local port_urls="$(echo "$port_urls"| xargs)"
|
||||
local URLS="$(merge_dedupe_list "$port_urls $app_urls" " ")"
|
||||
case "$1" in
|
||||
url)
|
||||
echo "$URLS" | tr ' ' '\n' | head -n1
|
||||
;;
|
||||
urls)
|
||||
echo "$URLS" | tr ' ' '\n'
|
||||
echo "$URLS" | tr ' ' '\n' | sort
|
||||
;;
|
||||
esac
|
||||
else
|
||||
local SCHEME="http"; local SSL="$DOKKU_ROOT/$APP/tls"
|
||||
local DOKKU_NGINX_PORT=$(config_get "$APP" DOKKU_NGINX_PORT || true)
|
||||
local DOKKU_NGINX_SSL_PORT=$(config_get "$APP" DOKKU_NGINX_SSL_PORT || true)
|
||||
|
||||
if [[ -e "$SSL/server.crt" && -e "$SSL/server.key" ]]; then
|
||||
local SCHEME="https"
|
||||
fi
|
||||
@@ -658,13 +1007,13 @@ get_app_urls() {
|
||||
done
|
||||
shopt -u nullglob
|
||||
fi
|
||||
elif [[ -n "$DOKKU_NGINX_PORT" ]] || [[ -n "$DOKKU_NGINX_SSL_PORT" ]]; then
|
||||
if [[ -n "$DOKKU_NGINX_PORT" ]];then
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_PORT ($(get_app_proxy_type "$APP"))"
|
||||
fi
|
||||
if [[ -n "$DOKKU_NGINX_SSL_PORT" ]]; then
|
||||
echo "https://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_SSL_PORT ($(get_app_proxy_type "$APP")-ssl)"
|
||||
fi
|
||||
elif [[ -n "$DOKKU_PROXY_PORT_MAP" ]]; then
|
||||
local port_map
|
||||
for port_map in $DOKKU_PROXY_PORT_MAP; do
|
||||
local scheme="$(awk -F ':' '{ print $1 }' <<< "$port_map")"
|
||||
local listen_port="$(awk -F ':' '{ print $2 }' <<< "$port_map")"
|
||||
echo "$scheme://$(< "$DOKKU_ROOT/HOSTNAME"):$listen_port"
|
||||
done
|
||||
elif [[ -n "$RAW_TCP_PORTS" ]]; then
|
||||
for p in $RAW_TCP_PORTS; do
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$p"
|
||||
@@ -705,3 +1054,85 @@ strip_inline_comments() {
|
||||
|
||||
echo "$stripped_line"
|
||||
}
|
||||
|
||||
is_valid_hostname() {
|
||||
declare desc="return 0 if argument is a valid hostname; else return 1"
|
||||
local hostname_string="$1"; local hostname_regex='^(([a-zA-Z0-9\*](-?[a-zA-Z0-9])*)\.)*[a-zA-Z\*](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$'
|
||||
if [[ $hostname_string =~ $hostname_regex ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_val_in_list() {
|
||||
declare desc="return true if value ($1) is in list ($2) separated by delimiter ($3); delimiter defaults to comma"
|
||||
local value="$1" list="$2" delimiter="${3:-,}"
|
||||
local IFS="$delimiter" val_in_list=false
|
||||
|
||||
for val in $list; do
|
||||
if [[ "$val" == "$value" ]]; then
|
||||
val_in_list=true
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$val_in_list"
|
||||
}
|
||||
|
||||
remove_val_from_list() {
|
||||
declare desc="remove value ($1) from list ($2) separated by delimiter ($3) (delimiter defaults to comma) and return list"
|
||||
local value="$1" list="$2" delimiter="${3:-,}"
|
||||
list="${list//$value/}"
|
||||
list="${list//$delimiter$delimiter/$delimiter}"
|
||||
list="${list/#$delimiter/}"
|
||||
list="${list/%$delimiter/}"
|
||||
echo "$list"
|
||||
}
|
||||
|
||||
add_val_to_list() {
|
||||
declare desc="add value ($1) to list ($2) separated by delimiter ($3) (delimiter defaults to comma) and return list"
|
||||
local value="$1" list="$2" delimiter="${3:-,}"
|
||||
list+="${delimiter}$value"
|
||||
echo "$list"
|
||||
}
|
||||
|
||||
merge_dedupe_list() {
|
||||
declare desc="combine lists ($1) separated by delimiter ($2) (delimiter defaults to comma), dedupe and return list"
|
||||
local input_lists="$1" delimiter="${2:-,}"
|
||||
|
||||
local merged_list="$(tr "$delimiter" $'\n' <<< "$input_lists" | sort | uniq | xargs)"
|
||||
echo "$merged_list"
|
||||
}
|
||||
|
||||
acquire_app_deploy_lock() {
|
||||
declare desc="acquire advisory lock for use in git/tar deploys"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local LOCK_TYPE="${2:-waiting}"
|
||||
local APP_DEPLOY_LOCK_FD="200"
|
||||
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
|
||||
local LOCK_WAITING_MSG="$APP is currently being deployed. Waiting..."
|
||||
local LOCK_FAILED_MSG="$APP is currently being deployed. Exiting..."
|
||||
local SHOW_MSG=true
|
||||
|
||||
eval "exec $APP_DEPLOY_LOCK_FD>$APP_DEPLOY_LOCK_FILE"
|
||||
if [[ "$LOCK_TYPE" == "waiting" ]]; then
|
||||
while [[ $(flock -n "$APP_DEPLOY_LOCK_FD" &>/dev/null ; echo $?) -ne 0 ]]; do
|
||||
if [[ "$SHOW_MSG" == "true" ]]; then
|
||||
echo "$LOCK_WAITING_MSG"
|
||||
SHOW_MSG=false
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
flock -n "$APP_DEPLOY_LOCK_FD" &>/dev/null || dokku_log_fail "$LOCK_FAILED_MSG"
|
||||
fi
|
||||
}
|
||||
|
||||
release_app_deploy_lock() {
|
||||
declare desc="release advisory lock used in git/tar deploys"
|
||||
local APP="$1"; verify_app_name "$APP"
|
||||
local APP_DEPLOY_LOCK_FD="200"
|
||||
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
|
||||
|
||||
flock -u "$APP_DEPLOY_LOCK_FD" && rm -f "$APP_DEPLOY_LOCK_FILE" &> /dev/null
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core common plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
103
plugins/config/functions
Normal file → Executable file
103
plugins/config/functions
Normal file → Executable file
@@ -17,36 +17,55 @@ config_export() {
|
||||
return 0
|
||||
}
|
||||
|
||||
get_sanitized_config_args() {
|
||||
local desc="return sanitized arguments for config plugin"
|
||||
local SANITIZED_ARGS=("$@")
|
||||
|
||||
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
|
||||
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
|
||||
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
|
||||
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
|
||||
|
||||
echo "${SANITIZED_ARGS[@]}"
|
||||
}
|
||||
|
||||
config_parse_args() {
|
||||
declare desc="parse config plugin args"
|
||||
unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
|
||||
case "$2" in
|
||||
--global)
|
||||
unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
|
||||
|
||||
for var; do
|
||||
if [[ "$var" == "--global" ]]; then
|
||||
ENV_FILE="$DOKKU_ROOT/ENV"
|
||||
DOKKU_CONFIG_TYPE="global"
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
;;
|
||||
--no-restart)
|
||||
APP="$3"
|
||||
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
fi
|
||||
if [[ "$var" == "--no-restart" ]]; then
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
DOKKU_CONFIG_TYPE="app"
|
||||
set -- "${@:1:1}" "${@:3}"
|
||||
esac
|
||||
fi
|
||||
if [[ "$var" == "--export" ]]; then
|
||||
DOKKU_CONFIG_EXPORT=true
|
||||
fi
|
||||
if [[ "$var" == "--shell" ]]; then
|
||||
DOKKU_CONFIG_SHELL=true
|
||||
fi
|
||||
done
|
||||
|
||||
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
|
||||
set -- "${SANITIZED_ARGS[@]}"
|
||||
|
||||
APP=${APP:="$2"}
|
||||
ENV_FILE=${ENV_FILE:="$DOKKU_ROOT/$APP/ENV"}
|
||||
DOKKU_CONFIG_TYPE=${DOKKU_CONFIG_TYPE:="app"}
|
||||
DOKKU_CONFIG_RESTART=${DOKKU_CONFIG_RESTART:=true}
|
||||
|
||||
if [[ "$DOKKU_CONFIG_TYPE" = "app" ]]; then
|
||||
if [[ -z $APP ]]; then
|
||||
if [[ "$DOKKU_CONFIG_TYPE" == "app" ]]; then
|
||||
if [[ -z $2 ]]; then
|
||||
dokku_log_fail "Please specify an app to run the command on"
|
||||
else
|
||||
verify_app_name "$2"
|
||||
APP=${APP:="$2"}
|
||||
ENV_FILE=${ENV_FILE:="$DOKKU_ROOT/$APP/ENV"}
|
||||
fi
|
||||
fi
|
||||
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
|
||||
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
|
||||
}
|
||||
|
||||
config_create () {
|
||||
@@ -95,35 +114,22 @@ config_write() {
|
||||
rm -f "$ENV_FILE_TEMP"
|
||||
}
|
||||
|
||||
is_config_export() {
|
||||
declare desc="return 0 if we're supposed to export"
|
||||
for var in "$@"; do
|
||||
if [[ "$var" == "--export" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
config_all() {
|
||||
declare desc="print or export config vars"
|
||||
[[ "$1" == "config" ]] || set -- "config" "$@"
|
||||
config_parse_args "$@"
|
||||
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
|
||||
set -- "${SANITIZED_ARGS[@]}"
|
||||
|
||||
config_create "$ENV_FILE"
|
||||
is_config_export "$@" && config_export "$DOKKU_CONFIG_TYPE" "$APP" && return 0
|
||||
[[ $DOKKU_CONFIG_EXPORT ]] && config_export "$DOKKU_CONFIG_TYPE" "$APP" && return 0
|
||||
|
||||
[[ "$APP" ]] && local DOKKU_CONFIG_TYPE=$APP
|
||||
[[ $APP ]] && local DOKKU_CONFIG_TYPE=$APP
|
||||
[[ ! -s $ENV_FILE ]] && dokku_log_fail "no config vars for $DOKKU_CONFIG_TYPE"
|
||||
|
||||
local VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" "$ENV_FILE" | cut -d" " -f2-)
|
||||
|
||||
for var in "$@"; do
|
||||
if [[ "$var" == "--shell" ]]; then
|
||||
echo "$VARS"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
[[ $DOKKU_CONFIG_SHELL ]] && echo "$VARS" && return 0
|
||||
|
||||
dokku_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars"
|
||||
config_styled_hash "$VARS"
|
||||
@@ -133,8 +139,10 @@ config_get() {
|
||||
declare desc="get value of given config var"
|
||||
[[ "$1" == "config:get" ]] || set -- "config:get" "$@"
|
||||
config_parse_args "$@"
|
||||
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
|
||||
set -- "${SANITIZED_ARGS[@]}"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Usage: dokku config:get APP KEY"
|
||||
echo "Must specify KEY."
|
||||
exit 1
|
||||
@@ -145,16 +153,17 @@ config_get() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
local KEY="$3"
|
||||
local KEY="${*: -1}"
|
||||
|
||||
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" "$ENV_FILE" | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
|
||||
}
|
||||
|
||||
config_set() {
|
||||
declare desc="set value of given config var"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
[[ "$1" == "config:set" ]] || set -- "config:set" "$@"
|
||||
config_parse_args "$@"
|
||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
@@ -170,7 +179,9 @@ config_set() {
|
||||
shift 2
|
||||
|
||||
for var; do
|
||||
if [[ $var != *"="* ]]; then
|
||||
if [[ $var == "--global" ]] || [[ $var == "--no-restart" ]] || ([[ $APP ]] && [[ $var == "$APP" ]]); then
|
||||
shift 1
|
||||
elif [[ $var != *"="* ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
echo "Whitespaces need to be escaped, i.e. KEY=\"VAL\ WITH\ SPACES\""
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
@@ -202,20 +213,23 @@ ${var}"
|
||||
plugn trigger post-config-update "$APP" "set" "$@"
|
||||
fi
|
||||
|
||||
local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
|
||||
[[ $APP ]] && local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
|
||||
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]] && [[ "$DOKKU_APP_RESTORE" != 0 ]]; then
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart "$APP"
|
||||
ps_restart "$APP"
|
||||
fi
|
||||
}
|
||||
|
||||
config_unset() {
|
||||
declare desc="unset given config var"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
[[ "$1" == "config:unset" ]] || set -- "config:unset" "$@"
|
||||
config_parse_args "$@"
|
||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
|
||||
set -- "${SANITIZED_ARGS[@]}"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
|
||||
echo "Must specify KEY to unset."
|
||||
exit 1
|
||||
@@ -223,7 +237,7 @@ config_unset() {
|
||||
|
||||
config_create "$ENV_FILE"
|
||||
local ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
local VARS="${*:3}"
|
||||
local VARS="${*:2}"
|
||||
|
||||
for var in $VARS; do
|
||||
dokku_log_info1 "Unsetting $var"
|
||||
@@ -234,10 +248,9 @@ config_unset() {
|
||||
|
||||
plugn trigger post-config-update "$APP" "unset" "$@"
|
||||
|
||||
local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
|
||||
[[ $APP ]] && local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
|
||||
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]] && [[ "$DOKKU_APP_RESTORE" != 0 ]]; then
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart "$APP"
|
||||
ps_restart "$APP"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core config plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
0
plugins/docker-options/functions
Normal file → Executable file
0
plugins/docker-options/functions
Normal file → Executable file
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core docker-options plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -66,15 +66,20 @@ domains_add() {
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
if [[ $(egrep -w "^${2}$" "$APP_VHOST_PATH" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
dokku_log_fail "$2 is already defined for $APP"
|
||||
exit 1
|
||||
fi
|
||||
shift 1
|
||||
for DOMAIN in "$@"; do
|
||||
if ! (is_valid_hostname "$DOMAIN"); then
|
||||
dokku_log_fail "$DOMAIN is invalid. exiting..."
|
||||
fi
|
||||
done
|
||||
|
||||
for DOMAIN in "$@"; do
|
||||
echo "$DOMAIN" >> "$APP_VHOST_PATH"
|
||||
dokku_log_info1 "Added $DOMAIN to $APP"
|
||||
if [[ $(egrep -w "^$DOMAIN$" "$APP_VHOST_PATH" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
dokku_log_info1 "Skipping: $DOMAIN already added to $APP"
|
||||
else
|
||||
echo "$DOMAIN" >> "$APP_VHOST_PATH"
|
||||
dokku_log_info1 "Added $DOMAIN to $APP"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]];then
|
||||
@@ -92,7 +97,7 @@ domains_remove() {
|
||||
shift 1
|
||||
|
||||
for DOMAIN in "$@"; do
|
||||
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
|
||||
sed -i "\|^$DOMAIN\$|d" "$DOKKU_ROOT/$APP/VHOST"
|
||||
dokku_log_info1 "Removed $DOMAIN from $APP"
|
||||
done
|
||||
plugn trigger post-domains-update "$APP" "remove" "$@"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core domains plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core enter plugin"
|
||||
version = "0.5.5"
|
||||
version = "0.6.4"
|
||||
[plugin.config]
|
||||
|
||||
@@ -7,25 +7,45 @@ enter_default_cmd() {
|
||||
local cmd="enter"
|
||||
local APP="$2"; local CONTAINER_TYPE="$3"; local IMAGE_TAG=$(get_running_image_tag "$APP"); local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
verify_app_name "$APP"
|
||||
local AVAILABLE_CONTAINER_TYPES=($(get_app_running_container_types "$APP"))
|
||||
|
||||
[[ ! -n "$3" ]] && dokku_log_fail "No container id specified"
|
||||
if [[ -z "$3" ]]; then
|
||||
if [[ ${#AVAILABLE_CONTAINER_TYPES[@]} -gt 1 ]]; then
|
||||
dokku_log_warn "No container type specified."
|
||||
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[@]}"
|
||||
else
|
||||
CONTAINER_TYPE="${AVAILABLE_CONTAINER_TYPES[0]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$3" == "--container-id" ]]; then
|
||||
[[ ! -n "$4" ]] && dokku_log_fail "No container id specified"
|
||||
|
||||
local DOKKU_APP_CIDS=( $(get_app_container_ids "$APP") )
|
||||
printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -q -e "^$4" || dokku_log_fail "Invalid container id for app"
|
||||
if [[ ! -n "$4" ]]; then
|
||||
dokku_log_warn "No container id specified."
|
||||
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[@]}"
|
||||
fi
|
||||
if ! (printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -q -e "^$4"); then
|
||||
dokku_log_warn "Invalid container id for app"
|
||||
dokku_log_fail "Available ids for app ($APP): ${DOKKU_APP_CIDS[@]}"
|
||||
fi
|
||||
local ID=$(printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -e "^$4")
|
||||
shift 4
|
||||
else
|
||||
local DOKKU_APP_CIDS=( $(get_app_container_ids "$APP" "$CONTAINER_TYPE") )
|
||||
local ID=${DOKKU_APP_CIDS[0]}
|
||||
[[ ! -n $ID ]] && dokku_log_fail "No containers found for type '$CONTAINER_TYPE'"
|
||||
shift 3
|
||||
if [[ ! -n $ID ]]; then
|
||||
dokku_log_warn "No containers found for type '$CONTAINER_TYPE'"
|
||||
dokku_log_fail "Available types for app ($APP): ${AVAILABLE_CONTAINER_TYPES[@]}"
|
||||
fi
|
||||
if [[ $3 ]]; then
|
||||
shift 3
|
||||
else
|
||||
shift 2
|
||||
fi
|
||||
fi
|
||||
|
||||
docker ps -aq --no-trunc | grep -e "^$ID" > /dev/null || dokku_log_fail "Container does not exist"
|
||||
docker ps -q --no-trunc | grep -e "^$ID" > /dev/null || dokku_log_fail "Container is not running"
|
||||
docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist"
|
||||
docker inspect -f '{{ .State.Running }}' "$ID" | grep -q "true" > /dev/null || dokku_log_fail "Container is not running"
|
||||
|
||||
local EXEC_CMD=""
|
||||
has_tty && local DOKKU_RUN_OPTS+=" -i -t"
|
||||
|
||||
@@ -1,130 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
git_build_app_repo() {
|
||||
declare desc="builds local git app repo for app"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local REV="$2"
|
||||
|
||||
# clean up after ourselves
|
||||
local GIT_BUILD_APP_REPO_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_git.XXXX")
|
||||
trap 'rm -rf "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
|
||||
|
||||
|
||||
# git clone - this method creates a new git repository and adds the primary
|
||||
# repo as a remote, then does a fetch depth=1 to avoid cloning
|
||||
# the entire repo
|
||||
local TMP_TAG="dokku/$REV"
|
||||
chmod 755 "$GIT_BUILD_APP_REPO_TMP_WORK_DIR"
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
pushd "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null
|
||||
[[ ! -d "$DOKKU_ROOT/$APP" ]] && apps_create "$APP"
|
||||
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
|
||||
GIT_DIR="$DOKKU_ROOT/$APP" git tag "$TMP_TAG" "$REV" &> /dev/null
|
||||
git init &> /dev/null
|
||||
git config advice.detachedHead false
|
||||
git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null
|
||||
git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null
|
||||
git reset --hard FETCH_HEAD &> /dev/null
|
||||
git submodule update --init --recursive &> /dev/null
|
||||
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
|
||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||
|
||||
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then
|
||||
plugn trigger pre-receive-app "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
|
||||
dokku receive "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
else
|
||||
plugn trigger pre-receive-app "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
|
||||
dokku receive "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
fi
|
||||
}
|
||||
|
||||
git_hook_cmd() {
|
||||
declare desc="kick off receive-app trigger from git prereceive hook"
|
||||
local cmd="git-hook"
|
||||
local APP="$2"
|
||||
|
||||
local oldrev newrev refname
|
||||
while read -r oldrev newrev refname; do
|
||||
# Only run this script for the master branch. You can remove this
|
||||
# if block if you wish to run it for others as well.
|
||||
if [[ $refname = "refs/heads/master" ]]; then
|
||||
# broken out into plugin so we might support other methods to receive an app
|
||||
# shellcheck disable=SC2086
|
||||
plugn trigger receive-app $APP $newrev
|
||||
else
|
||||
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 0 ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
plugn trigger receive-branch $APP $newrev $refname
|
||||
else
|
||||
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
|
||||
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git_upload_pack_cmd() {
|
||||
declare desc="executes git-upload-pack"
|
||||
local cmd="git-upload-pack"
|
||||
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
plugn trigger git-pre-pull "$APP"
|
||||
cat | git-upload-pack "$DOKKU_ROOT/$APP"
|
||||
plugn trigger git-post-pull "$APP"
|
||||
}
|
||||
|
||||
git_build_cmd() {
|
||||
declare desc="lock git-build"
|
||||
local cmd="git-build"
|
||||
local APP="$2"; local APP_BUILD_LOCK="$DOKKU_ROOT/$APP/.build.lock"
|
||||
local APP_BUILD_LOCK_MSG="$APP is currently being deployed or locked. Waiting..."
|
||||
[[ $(flock -n "$APP_BUILD_LOCK" true &>/dev/null ; echo $?) -ne 0 ]] && echo "$APP_BUILD_LOCK_MSG"
|
||||
|
||||
shift 1
|
||||
flock -o "$APP_BUILD_LOCK" dokku git-build-locked "$@"
|
||||
}
|
||||
|
||||
git_build_locked_cmd() {
|
||||
declare desc="setup and call git_build_app_repo"
|
||||
local cmd="git-build-locked"
|
||||
local APP="$2"
|
||||
if [[ $# -ge 3 ]]; then
|
||||
local REF="$3"
|
||||
else
|
||||
local REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
git_build_app_repo $APP $REF
|
||||
}
|
||||
|
||||
git_glob_cmd() {
|
||||
declare desc="catch-all for any other git-* commands"
|
||||
local cmd="git-*"
|
||||
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
|
||||
local APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||
git init --bare "$APP_PATH" > /dev/null
|
||||
local PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > "$PRERECEIVE_HOOK" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e; set -o pipefail;
|
||||
|
||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||
EOF
|
||||
chmod +x "$PRERECEIVE_HOOK"
|
||||
fi
|
||||
|
||||
if [[ $1 == "git-receive-pack" ]]; then
|
||||
local args="$1 '$APP_PATH'"
|
||||
else
|
||||
local args=$*
|
||||
fi
|
||||
git-shell -c "$args"
|
||||
}
|
||||
source "$PLUGIN_AVAILABLE_PATH/git/functions"
|
||||
|
||||
case "$1" in
|
||||
git-hook)
|
||||
@@ -135,14 +11,6 @@ case "$1" in
|
||||
git_upload_pack_cmd "$@"
|
||||
;;
|
||||
|
||||
git-build)
|
||||
git_build_cmd "$@"
|
||||
;;
|
||||
|
||||
git-build-locked)
|
||||
git_build_locked_cmd "$@"
|
||||
;;
|
||||
|
||||
git-*)
|
||||
git_glob_cmd "$@"
|
||||
;;
|
||||
|
||||
115
plugins/git/functions
Executable file
115
plugins/git/functions
Executable file
@@ -0,0 +1,115 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
git_build_app_repo() {
|
||||
declare desc="builds local git app repo for app"
|
||||
verify_app_name "$1"
|
||||
local APP="$1"; local REV="$2"
|
||||
|
||||
# clean up after ourselves
|
||||
local GIT_BUILD_APP_REPO_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku_git.XXXX")
|
||||
trap 'rm -rf "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
|
||||
|
||||
# git clone - this method creates a new git repository and adds the primary
|
||||
# repo as a remote, then does a fetch depth=1 to avoid cloning
|
||||
# the entire repo
|
||||
local TMP_TAG="dokku/$REV"
|
||||
chmod 755 "$GIT_BUILD_APP_REPO_TMP_WORK_DIR"
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
pushd "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null
|
||||
[[ ! -d "$DOKKU_ROOT/$APP" ]] && apps_create "$APP"
|
||||
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
|
||||
GIT_DIR="$DOKKU_ROOT/$APP" git tag "$TMP_TAG" "$REV" &> /dev/null
|
||||
git init &> /dev/null
|
||||
git config advice.detachedHead false
|
||||
git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null
|
||||
git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null
|
||||
git reset --hard FETCH_HEAD &> /dev/null
|
||||
git submodule update --init --recursive &> /dev/null
|
||||
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
|
||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||
|
||||
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then
|
||||
plugn trigger pre-receive-app "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
|
||||
dokku_receive "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
else
|
||||
plugn trigger pre-receive-app "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
|
||||
dokku_receive "$APP" "herokuish" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
fi
|
||||
}
|
||||
|
||||
git_hook_cmd() {
|
||||
declare desc="kick off receive-app trigger from git prereceive hook"
|
||||
local cmd="git-hook"
|
||||
local APP="$2"
|
||||
|
||||
local oldrev newrev refname
|
||||
while read -r oldrev newrev refname; do
|
||||
# Only run this script for the master branch. You can remove this
|
||||
# if block if you wish to run it for others as well.
|
||||
if [[ $refname = "refs/heads/master" ]]; then
|
||||
# broken out into plugin so we might support other methods to receive an app
|
||||
# shellcheck disable=SC2086
|
||||
plugn trigger receive-app $APP $newrev
|
||||
else
|
||||
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 0 ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
plugn trigger receive-branch $APP $newrev $refname
|
||||
else
|
||||
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
|
||||
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git_build() {
|
||||
declare desc="setup and call git_build_app_repo"
|
||||
local APP="$1"
|
||||
if [[ $# -ge 2 ]]; then
|
||||
local REF="$2"
|
||||
else
|
||||
local REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
git_build_app_repo $APP $REF
|
||||
}
|
||||
|
||||
git_upload_pack_cmd() {
|
||||
declare desc="executes git-upload-pack"
|
||||
local cmd="git-upload-pack"
|
||||
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
plugn trigger git-pre-pull "$APP"
|
||||
cat | git-upload-pack "$DOKKU_ROOT/$APP"
|
||||
plugn trigger git-post-pull "$APP"
|
||||
}
|
||||
|
||||
git_glob_cmd() {
|
||||
declare desc="catch-all for any other git-* commands"
|
||||
local cmd="git-*"
|
||||
local APP="$(echo "$2" | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
|
||||
local APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||
git init --bare "$APP_PATH" > /dev/null
|
||||
local PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > "$PRERECEIVE_HOOK" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e; set -o pipefail;
|
||||
|
||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||
EOF
|
||||
chmod +x "$PRERECEIVE_HOOK"
|
||||
fi
|
||||
|
||||
if [[ $1 == "git-receive-pack" ]]; then
|
||||
local args="$1 '$APP_PATH'"
|
||||
else
|
||||
local args=$*
|
||||
fi
|
||||
git-shell -c "$args"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user