Compare commits
358 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bba7ee658e | ||
|
|
a8b4efb3cf | ||
|
|
fc85105a86 | ||
|
|
0048a631c6 | ||
|
|
f4102975f9 | ||
|
|
8df4404d93 | ||
|
|
d88de2b97c | ||
|
|
98616f50dc | ||
|
|
5c396da0df | ||
|
|
8a117aa59f | ||
|
|
d27b9b9705 | ||
|
|
31c5d82775 | ||
|
|
e9a7862a50 | ||
|
|
9878de5526 | ||
|
|
7f08489e9f | ||
|
|
b6cc3a65b5 | ||
|
|
c362d4b9e3 | ||
|
|
643bf8a3a8 | ||
|
|
59597aa10c | ||
|
|
f1860ab83d | ||
|
|
4c64470830 | ||
|
|
dc12388c93 | ||
|
|
5f6b9e2824 | ||
|
|
3005a5c2c6 | ||
|
|
843e2be8eb | ||
|
|
d2ad75daa4 | ||
|
|
f75cf277dd | ||
|
|
c8514d4590 | ||
|
|
50e35dd481 | ||
|
|
b1d985df19 | ||
|
|
89b24bef19 | ||
|
|
8b21b5dc13 | ||
|
|
5dfad4a89b | ||
|
|
d46221a4f5 | ||
|
|
18934c1b5b | ||
|
|
8a2f82efbf | ||
|
|
680db39ba9 | ||
|
|
e7e43141d6 | ||
|
|
19f66f69ee | ||
|
|
4c1cc38338 | ||
|
|
75b06bb02e | ||
|
|
fb5e5de6a3 | ||
|
|
01a6a5719e | ||
|
|
07e94de205 | ||
|
|
81523b3bd0 | ||
|
|
3a8f227355 | ||
|
|
85f785c93c | ||
|
|
2c8678ebd0 | ||
|
|
ee853a5b35 | ||
|
|
fe19ef15bc | ||
|
|
a7ec8dbd05 | ||
|
|
b776d4cfef | ||
|
|
629ed5cca6 | ||
|
|
4c002030d5 | ||
|
|
bd0377570d | ||
|
|
e0a89609ed | ||
|
|
92e9ab84ac | ||
|
|
40e869fe00 | ||
|
|
717ac8703b | ||
|
|
474ea3c9b3 | ||
|
|
781b8e9009 | ||
|
|
6b01da6dda | ||
|
|
b49cceefd7 | ||
|
|
c941a64eba | ||
|
|
03dee47d69 | ||
|
|
3ff11e0b9f | ||
|
|
a79834739e | ||
|
|
f8c9d9b823 | ||
|
|
9ace6cfec5 | ||
|
|
9e0f8dc7d1 | ||
|
|
7978aa9011 | ||
|
|
be1dc623db | ||
|
|
895b4d2c6a | ||
|
|
5e9c88ca63 | ||
|
|
e345cb6b93 | ||
|
|
8f2db587f2 | ||
|
|
80a2018c1f | ||
|
|
f25fabeae5 | ||
|
|
a8be09a866 | ||
|
|
616c3a6c50 | ||
|
|
b43422f544 | ||
|
|
dce98529d3 | ||
|
|
ec893fe330 | ||
|
|
c7820c0cf2 | ||
|
|
d11b976de3 | ||
|
|
fa033a2589 | ||
|
|
02d63b9d8d | ||
|
|
1aee4fdde8 | ||
|
|
92ec4462be | ||
|
|
2282b48ff1 | ||
|
|
9b9e983d2c | ||
|
|
0f14e9652f | ||
|
|
5bb62c0430 | ||
|
|
fd44635e74 | ||
|
|
7c76de93a0 | ||
|
|
3e18d9aff9 | ||
|
|
d71554e647 | ||
|
|
f914e6207b | ||
|
|
d3c218f95e | ||
|
|
70511c340d | ||
|
|
467264d31f | ||
|
|
1e543afb78 | ||
|
|
b9ecb32d3f | ||
|
|
bf1349bec8 | ||
|
|
28450eb4f3 | ||
|
|
068810ad36 | ||
|
|
7a0161dd86 | ||
|
|
b6c4a750de | ||
|
|
6e7ca94d84 | ||
|
|
9efa8beb81 | ||
|
|
e07ae7ad6a | ||
|
|
f84c2bf6d8 | ||
|
|
89dd783924 | ||
|
|
943e9b387c | ||
|
|
de6ccf4ce2 | ||
|
|
4dd4d7c567 | ||
|
|
a1d8cc23b9 | ||
|
|
1975384292 | ||
|
|
c1e9630052 | ||
|
|
ab8eb5a727 | ||
|
|
4ad955adcb | ||
|
|
c8b8b9bb93 | ||
|
|
1ebfedcfb5 | ||
|
|
7443a2f49e | ||
|
|
27a2478a33 | ||
|
|
1c53250211 | ||
|
|
30aa89ce8a | ||
|
|
ebe4af70dc | ||
|
|
433ced0f26 | ||
|
|
95388b07bb | ||
|
|
1e479c63bd | ||
|
|
1be4b94226 | ||
|
|
64b57359b5 | ||
|
|
39aedd158b | ||
|
|
c62ac4bcc3 | ||
|
|
964a84dc31 | ||
|
|
170f44f3d7 | ||
|
|
1b84527f8c | ||
|
|
72a1b76b63 | ||
|
|
cca49230d9 | ||
|
|
9ea0a8fe8b | ||
|
|
63d8994243 | ||
|
|
c929edfbe5 | ||
|
|
cadba248b6 | ||
|
|
872fbc130e | ||
|
|
5fdd69a657 | ||
|
|
e8fb585fa8 | ||
|
|
4bcc9ac05d | ||
|
|
8095df79f6 | ||
|
|
d6341e9ab7 | ||
|
|
30631692a5 | ||
|
|
bef51a1c6b | ||
|
|
424f9f1e5b | ||
|
|
18d234a925 | ||
|
|
e873f27eac | ||
|
|
aaa7a4ecb0 | ||
|
|
cd3af6b961 | ||
|
|
525e6f503d | ||
|
|
92497cf095 | ||
|
|
c9bca838f0 | ||
|
|
b3ddcbed53 | ||
|
|
aaae9adac3 | ||
|
|
ce23cf6ce6 | ||
|
|
ad72a137e1 | ||
|
|
37b8ccbe9d | ||
|
|
fcfc02be52 | ||
|
|
e2d138f55e | ||
|
|
2a4cbc7bee | ||
|
|
6d70751cfc | ||
|
|
5d8359c12e | ||
|
|
6c914173cb | ||
|
|
c21aea00ad | ||
|
|
7a545759f2 | ||
|
|
ac75c726ad | ||
|
|
48c6460b45 | ||
|
|
dc6e1ea987 | ||
|
|
2ba9809a7f | ||
|
|
1c48c9c1e9 | ||
|
|
0ef3f71d8d | ||
|
|
cfe2663f61 | ||
|
|
ce2c1e3f1d | ||
|
|
7eb8da5302 | ||
|
|
d3cdef44d9 | ||
|
|
59c8be210b | ||
|
|
8b357b2805 | ||
|
|
51e8b540cc | ||
|
|
01525e3164 | ||
|
|
9bc7f459ef | ||
|
|
2123917e9b | ||
|
|
a7c0020ceb | ||
|
|
299d530959 | ||
|
|
1b5756ca54 | ||
|
|
9e98fe11e0 | ||
|
|
b2949d2199 | ||
|
|
ff6de12196 | ||
|
|
b4b4e266b2 | ||
|
|
c4766b7f8d | ||
|
|
88bd50abaf | ||
|
|
39f09740b7 | ||
|
|
dca4e87d31 | ||
|
|
1265463dcf | ||
|
|
b71f6f4660 | ||
|
|
56e7c09733 | ||
|
|
34c5b53857 | ||
|
|
ad9d331257 | ||
|
|
a26602f3f2 | ||
|
|
5fa167c408 | ||
|
|
5f17720d3f | ||
|
|
1de092d84e | ||
|
|
ba82b544f0 | ||
|
|
d0c0ffc19c | ||
|
|
342e9aa95b | ||
|
|
7a1c080051 | ||
|
|
d50db13065 | ||
|
|
3c894fd130 | ||
|
|
515afa8d62 | ||
|
|
adfc3a8101 | ||
|
|
95161a2a9f | ||
|
|
76cf4d2969 | ||
|
|
71ebf1e476 | ||
|
|
1371056b20 | ||
|
|
148d563b82 | ||
|
|
db4e847e8d | ||
|
|
d37e64d3d6 | ||
|
|
f2e153744c | ||
|
|
5cb62b168f | ||
|
|
8ea5cfa2aa | ||
|
|
5378337456 | ||
|
|
983e0910b1 | ||
|
|
aec138ef32 | ||
|
|
f9da2d5c25 | ||
|
|
a983456030 | ||
|
|
0904c3d458 | ||
|
|
9eb30d9e33 | ||
|
|
74e1bf9f46 | ||
|
|
5f7c4426b7 | ||
|
|
ccb9e4a571 | ||
|
|
9c37069a6a | ||
|
|
433db65635 | ||
|
|
14acb8af1a | ||
|
|
880c4d11a0 | ||
|
|
495b1d2ba0 | ||
|
|
2f16b06a76 | ||
|
|
8be5c874ec | ||
|
|
d696013fe2 | ||
|
|
d8828c2d25 | ||
|
|
1c8722c763 | ||
|
|
5be7641f87 | ||
|
|
04a4da7fc5 | ||
|
|
03165ee3f8 | ||
|
|
a701b5d29a | ||
|
|
06b2347486 | ||
|
|
7db481fe36 | ||
|
|
e2954fee1e | ||
|
|
934f18c268 | ||
|
|
646fd467ab | ||
|
|
7b5ea80ea4 | ||
|
|
a62f914646 | ||
|
|
b01d371c46 | ||
|
|
59a80f7857 | ||
|
|
c32bf8f035 | ||
|
|
99f1f1b6d3 | ||
|
|
e08f02aca7 | ||
|
|
fa5fe2efd6 | ||
|
|
7979751d71 | ||
|
|
4e0fed18a6 | ||
|
|
5605863c79 | ||
|
|
e7c035e207 | ||
|
|
ae2e0bc57c | ||
|
|
3580e16733 | ||
|
|
cddc4afcea | ||
|
|
5d5c575251 | ||
|
|
d4c122c277 | ||
|
|
66ad7d0985 | ||
|
|
cc66905c6e | ||
|
|
12f97ee18e | ||
|
|
14f228b1b5 | ||
|
|
60c0f56724 | ||
|
|
afe65a86fb | ||
|
|
6566be04e5 | ||
|
|
2de2151f58 | ||
|
|
c2626bf934 | ||
|
|
b2cc353166 | ||
|
|
770139d2ca | ||
|
|
2bcb9caaf7 | ||
|
|
9055f90dcc | ||
|
|
b687e3297d | ||
|
|
3a3550e667 | ||
|
|
28288f70ed | ||
|
|
7d28f751b7 | ||
|
|
9637884861 | ||
|
|
d5df6a4190 | ||
|
|
32a8c0307f | ||
|
|
1372c426ef | ||
|
|
84fff1c2e2 | ||
|
|
5a51246007 | ||
|
|
712e1cada7 | ||
|
|
0f1faf06a2 | ||
|
|
cd23310042 | ||
|
|
ebfcece620 | ||
|
|
b6ef5af3d1 | ||
|
|
bd0803cf29 | ||
|
|
a1e747f4ad | ||
|
|
f3e0c63f68 | ||
|
|
771eaa33ee | ||
|
|
eccdc04268 | ||
|
|
606352b6ed | ||
|
|
e349d38581 | ||
|
|
09ee1def8f | ||
|
|
4f25392d9b | ||
|
|
4c05fbc020 | ||
|
|
4021b19dfc | ||
|
|
1622fc3673 | ||
|
|
461e79386a | ||
|
|
183edc9839 | ||
|
|
5676dbc4c6 | ||
|
|
6d71c164f0 | ||
|
|
3f43a64430 | ||
|
|
f20d24463f | ||
|
|
98990b6885 | ||
|
|
42905c345b | ||
|
|
d0623ea37b | ||
|
|
0a1cd5d9a5 | ||
|
|
a93ff02d50 | ||
|
|
5717e3afef | ||
|
|
268c8763b2 | ||
|
|
cb0565eb56 | ||
|
|
4cd40aef03 | ||
|
|
a95166c381 | ||
|
|
1a8ac56673 | ||
|
|
c589e8e267 | ||
|
|
66c7f8f056 | ||
|
|
2980731db5 | ||
|
|
ef6f58a96c | ||
|
|
198fe14b7b | ||
|
|
9409fc2ef0 | ||
|
|
ab6f49cebe | ||
|
|
5492b0e4e0 | ||
|
|
acd28f4647 | ||
|
|
e5976e62c7 | ||
|
|
55d4fb788e | ||
|
|
c6e4f95550 | ||
|
|
c750f5a768 | ||
|
|
c1a0e0ce68 | ||
|
|
d21caa4811 | ||
|
|
dc5f34534b | ||
|
|
14e72ea337 | ||
|
|
fd187ec837 | ||
|
|
eebcfd85ab | ||
|
|
ab2539e894 | ||
|
|
039cfdc7ba | ||
|
|
27b79222c1 | ||
|
|
059ebcd9fc | ||
|
|
1668f3bbc6 | ||
|
|
f99f9cd5d7 | ||
|
|
2e9bb4eed1 | ||
|
|
a801592b56 | ||
|
|
0840d8fd1f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ stack.tgz
|
||||
build
|
||||
tmp
|
||||
*.deb
|
||||
.ruby-version
|
||||
|
||||
22
AUTHORS
22
AUTHORS
@@ -1,22 +0,0 @@
|
||||
# If you're submitting a patch, please add your name here in alphabetical order as part of the patch.
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
#
|
||||
3onyc <3onyc@x3tech.com>
|
||||
Alexander <iam.asm89@gmail.com>
|
||||
Alexander Beletsky <alexander.beletsky@gmail.com>
|
||||
Alexis Gavoty <kload@kload.fr>
|
||||
Christian Joudrey <cmallette@gmail.com>
|
||||
Felipe Coury <felipe.coury@gmail.com>
|
||||
Jeff Lindsay <progrium@gmail.com>
|
||||
Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
Leo Unbekandt <leo@unbekandt.eu>
|
||||
Ludovic Perrine <jazzzz@gmail.com>
|
||||
Luigi Maselli <grigio.org@gmail.com>
|
||||
Martin Weiss <kornnflake@gmail.com>
|
||||
Michael Hobbs <github@psudo.net>
|
||||
Paul Lietar <paul@lietar.net>
|
||||
Rajiv Makhijani <rajiv@blue-tech.org>
|
||||
rhy-jot <rhy-jot@myeml.net>
|
||||
Richard North <rich.north@gmail.com>
|
||||
Sebastian Götte <github@jaseg.net>
|
||||
Silas Baronda <silas.baronda@gmail.com>
|
||||
191
CONTRIBUTING.md
Normal file
191
CONTRIBUTING.md
Normal file
@@ -0,0 +1,191 @@
|
||||
# How to contribute
|
||||
|
||||
Dokku loves to welcome your contributions. There are several ways to help out:
|
||||
|
||||
* Create an [issue](https://github.com/progrium/dokku/issues) on GitHub, if you
|
||||
have found a bug
|
||||
* Write test cases for open bug issues
|
||||
* Write patches for open bug/feature issues, preferably with test cases
|
||||
included
|
||||
* Contribute to the [documentation](http://progrium.viewdocs.io/dokku/)
|
||||
|
||||
There are a few guidelines that we need contributors to follow so that we have
|
||||
a chance of keeping on top of things.
|
||||
|
||||
## Topics
|
||||
|
||||
* [Reporting Security Issues](#reporting-security-issues)
|
||||
* [Reporting Issues](#reporting-other-issues)
|
||||
* [Contributing](#contributing)
|
||||
* [Making Changes](#making-changes)
|
||||
* [Which branch to base the work](#which-branch-to-base-the-work)
|
||||
* [Submitting Changes](#submitting-changes)
|
||||
* [When will my change be merged?](#when-will-my-change-be-merged)
|
||||
* [Test cases and codesniffs](#test-cases-and-codesniffs)
|
||||
* [Additional Resources](#additional-resources)
|
||||
|
||||
## Reporting security issues
|
||||
|
||||
The Dokku maintainers take security seriously. If you discover a security
|
||||
issue, please bring it to their attention right away!
|
||||
|
||||
Please **DO NOT** file a public issue, instead send your report privately to
|
||||
[dokku@josediazgonzalez.com](mailto:dokku@josediazgonzalez.com),
|
||||
|
||||
Security reports are greatly appreciated and we will publicly thank you for it.
|
||||
|
||||
## Reporting other issues
|
||||
|
||||
A great way to contribute to the project is to send a detailed report when you
|
||||
encounter an issue. We always appreciate a well-written, thorough bug report,
|
||||
and will thank you for it!
|
||||
|
||||
Sometimes dokku is missing a feature you need. In some cases, those features can
|
||||
be found in pre-existing [plugins](http://progrium.viewdocs.io/dokku/plugins/),
|
||||
and we encourage our users to create and contribute such packages. From time to
|
||||
time, we will also pull plugins into the dokku core when the task they solve is
|
||||
a common one for our users.
|
||||
|
||||
Check that [our issue database](https://github.com/progrium/dokku/issues)
|
||||
doesn't already include that problem or suggestion before submitting an issue.
|
||||
If you find a match, add a quick "+1" or "I have this problem too." Doing this
|
||||
helps prioritize the most common problems and requests.
|
||||
|
||||
When reporting issues, please include your host OS (Ubuntu 14.04, Fedora 19,
|
||||
etc). Please include:
|
||||
|
||||
* The output of `uname -a`.
|
||||
* The output of `docker version`.
|
||||
* The output of `docker -D info`.
|
||||
* The output of `dokku version`.
|
||||
|
||||
Please also include the steps required to reproduce the problem if possible and
|
||||
applicable. This information will help us review and fix your issue faster.
|
||||
|
||||
**Issue Report Template**:
|
||||
|
||||
```
|
||||
Description of problem:
|
||||
|
||||
|
||||
Output of the following commands
|
||||
|
||||
- `dokku version`:
|
||||
- `dokku plugin`:
|
||||
- `docker version`:
|
||||
- `docker info`:
|
||||
- `uname -a`:
|
||||
- `cat /home/dokku/<app>/nginx.conf` (if applicable):
|
||||
- Output of failing dokku commands with `dokku trace on`:
|
||||
|
||||
Environment details (AWS, VirtualBox, physical, etc.):
|
||||
|
||||
How was dokku installed?:
|
||||
|
||||
How reproducible:
|
||||
|
||||
|
||||
Steps to Reproduce:
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
Actual Results:
|
||||
|
||||
|
||||
Expected Results:
|
||||
|
||||
|
||||
Additional info:
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Before you contribute to the dokku project, there are a few things that you'll
|
||||
need to do
|
||||
|
||||
* Make sure you have a [GitHub account](https://github.com/signup/free).
|
||||
* Submit an [issue](https://github.com/progrium/dokku/issues), assuming one
|
||||
does not already exist.
|
||||
* Clearly describe the issue including steps to reproduce when it is a bug.
|
||||
* Make sure you fill in the earliest version that you know has the issue.
|
||||
* Fork the repository on GitHub.
|
||||
|
||||
### Making Changes
|
||||
|
||||
* Create a topic branch from where you want to base your work.
|
||||
* This is usually the master branch.
|
||||
* Only target an existing branch if you are certain your fix must be on that
|
||||
branch.
|
||||
* To quickly create a topic branch based on master; `git checkout -b my_contribution origin/master`.
|
||||
It is best to avoid working directly on the `master` branch. Doing so will
|
||||
help avoid conflicts if you pull in updates from origin.
|
||||
* Make commits of logical units. Implementing a new function and calling it in
|
||||
another file constitute a single logical unit of work.
|
||||
* Before you make a pull request, squash your commits into logical units of work
|
||||
using `git rebase -i` and `git push -f`.
|
||||
* A majority of submissions should have a single commit, so if in doubt,
|
||||
squash your commits down to one commit.
|
||||
* Check for unnecessary whitespace with `git diff --check` before committing.
|
||||
* Use descriptive commit messages and reference the #issue number.
|
||||
* Core test cases should continue to pass. You can run tests locally or enable
|
||||
[circle-ci](https://circleci.com/gh/progrium/dokku) for your fork, so all
|
||||
tests and codesniffs will be executed.
|
||||
* Your work should apply the [Dokku coding standards](https://github.com/progrium/bashstyle)
|
||||
* Pull requests must be cleanly rebased on top of master without multiple branches
|
||||
mixed into the PR.
|
||||
* **Git tip**: If your PR no longer merges cleanly, use `rebase master` in your
|
||||
feature branch to update your pull request rather than `merge master`.
|
||||
|
||||
### Which branch to base the work
|
||||
|
||||
All changes should be be based on the latest master commit.
|
||||
|
||||
### Submitting Changes
|
||||
|
||||
* Push your changes to a topic branch in your fork of the repository.
|
||||
* Submit a pull request to the repository on github, with the correct target
|
||||
branch.
|
||||
|
||||
### When will my change be merged?
|
||||
|
||||
Be patient! The dokku maintainers will review all pull requests and comment as
|
||||
quickly as possible. There may be some back and forth while the details of your
|
||||
pull request are discussed.
|
||||
|
||||
In the unlikely event that your pull request does not get merged, the dokku
|
||||
maintainers will either provide an alternative patch or guide you towards a
|
||||
better solution to the problem at hand.
|
||||
|
||||
During our pre-1.0 cycle, we will follow these general rules when merging pull
|
||||
requests:
|
||||
|
||||
- bugfix (patch)
|
||||
- security (patch/minor)
|
||||
- minor feature (patch)
|
||||
- backwards incompatible change (minor)
|
||||
- major feature (minor)
|
||||
|
||||
### Test cases and codesniffs
|
||||
|
||||
Dokku tests require [bats](https://github.com/sstephenson/bats).
|
||||
To run the test cases locally use the following command:
|
||||
|
||||
make ci-dependencies
|
||||
make unit-tests deploy-tests
|
||||
|
||||
To run the shellcheck sniffs for Dokku coding standards:
|
||||
|
||||
make ci-dependencies
|
||||
make lint
|
||||
|
||||
The [testing docs](http://progrium.viewdocs.io/dokku/development/testing/)
|
||||
contains installation info for bats and shellcheck.
|
||||
|
||||
# Additional Resources
|
||||
|
||||
* [Dokku coding standards](https://github.com/progrium/bashstyle)
|
||||
* [Existing issues](https://github.com/progrium/dokku/issues)
|
||||
* [General GitHub documentation](https://help.github.com/)
|
||||
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
|
||||
* [#dokku IRC channel on freenode.org](https://webchat.freenode.net/?channels=dokku)
|
||||
166
HISTORY.md
166
HISTORY.md
@@ -1,5 +1,166 @@
|
||||
# History
|
||||
|
||||
## 0.4.2
|
||||
|
||||
This release was mainly a documentation release, with a few notable features:
|
||||
|
||||
- You can now use the commercial version of docker-engine with dokku.
|
||||
- You can now name your containers using the official `named-containers` plugin
|
||||
|
||||
Huge thanks to @Flink for working on our official plugins and adding official [basic auth](https://github.com/dokku/dokku-http-auth), [couchdb](https://github.com/dokku/dokku-couchdb), and [site maintenance](https://github.com/dokku/dokku-maintenance) plugins!
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #1530: @Flink Fix nginx configuration for SSL
|
||||
|
||||
### New Features
|
||||
|
||||
- #1515: @leonardodino Allow local prebuilt stack sourcing
|
||||
- #1536 #1537: @josegonzalez Add docker-engine-cs as docker-engine alternative
|
||||
- #1511: @Flink Add `named-containers` as a core plugin
|
||||
|
||||
### Documentation
|
||||
|
||||
- #1520: @kimausloos Add `dokku` command-prefix to `plugin:install` command
|
||||
- #1519: @3onyc Fix typos in documentation
|
||||
- #1521: @edm00se Use correct url to bootstrap.sh in README.md
|
||||
- #1522: @josegonzalez Avoid redirects and use raw.githubusercontent.com for github links
|
||||
- #1523 #1548: @callahad Make room for the longer bootstrap.sh URL
|
||||
- #1524: @callahad Document idiosyncracies with Linode
|
||||
- #1529: @pzula Adds helpful information regarding whitespacing when setting config
|
||||
- #1525 #1550: @josegonzalez Add gratipay shield to readme
|
||||
- #1544 #1545 #1547 #1551: @josegonzalez @Flink Update compatibility for community plugins
|
||||
- #1546: @josegonzalez Add missing description to history output in HISTORY.md
|
||||
- #1552 #1553 #1555: @josegonzalez Various documentation styling tweaks
|
||||
|
||||
## 0.4.1
|
||||
|
||||
This release is primarily a bugfix and documentation update. In 0.4.0, we incorrectly handled setting environment variables in certain cases, resulting in misconfigured applications. We recommend that all users upgrade from 0.4.1 as soon as possible.
|
||||
|
||||
One new feature is colorized logging output, which should make it easier to debug application logging output when deploying multiple processes.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #1494: @callahad Correctly install packages for DOKKU_TAG=v0.4.0
|
||||
- #1496: @callahad Don't prompt users when installing dokku package
|
||||
- #1514: @michaelshobbs Do not use exit 0 in config functions and fix CURL environment variable setting
|
||||
|
||||
### New Features
|
||||
|
||||
- #1482: @Flink Strip the `dokku-` part from plugins on install
|
||||
- #1500: @jazzzz Log user name and fingerprint in events
|
||||
- #1512: @Flink Colorize output from logs
|
||||
|
||||
### Documentation
|
||||
|
||||
- #1485: @matto1990 Update Slack plugin compatability
|
||||
- #1488: @josegonzalez Update plugins list with compatibility changes
|
||||
- #1491: @josegonzalez Promote [maintenance](https://github.com/dokku/dokku-maintenance) and [http basic auth](https://github.com/dokku/dokku-http-auth) plugins to official status
|
||||
- #1492: @josegonzalez Upgrade hostname plugin to 0.4.0+ compatibility
|
||||
- #1501: @josegonzalez Clarify bootstrap installation documentation
|
||||
- #1502: @josegonzalez Update dokku-apt compatibility
|
||||
- #1504: @michaelshobbs Change plugin install doc to show one-step method
|
||||
|
||||
## 0.4.0
|
||||
|
||||
This is our first minor release in almost a year. Many new features and removals have occurred, so here is a neat summary:
|
||||
|
||||
- Plugins are now triggered via `plugn`. Notably, you'll need add a `plugin.toml` to describe the plugin as well as use `plugn trigger` instead of `pluginhook` to trigger plugin callbacks. Please see the [plugin creation documentation](http://progrium.viewdocs.io/dokku/development/plugin-creation/) for more details.
|
||||
- A few new official plugins have been added to the core, including [image tagging](http://progrium.viewdocs.io/dokku/application-deployment/), [certificate management](http://progrium.viewdocs.io/dokku/deployment/ssl-configuration/), a tar-based deploy solution, and much more. Check out the *New Features* section for more details.
|
||||
- We've removed a few deprecated plugin callbacks. Please see the [plugin triggers documentation](http://progrium.viewdocs.io/dokku/development/plugin-triggers/) to see what is available.
|
||||
- [Official datastorage plugins](https://github.com/dokku) have been created for the most commonly used datastores. If you previously used/maintained a community contributed plugin, please check these out. We'll be adding more official plugins as time goes on.
|
||||
|
||||
Thanks to the *many* contributors for making this release our best release so far, and special thanks to both @michaelshobbs and @Flink for pushing along the `0.4.0` release!
|
||||
|
||||
### Deprecations and Removals
|
||||
|
||||
- #1372: @SonicHedgehog Do no longer force-install a default nginx.conf
|
||||
- #1415: @tilgovi Remove uses of (un)set-norestart
|
||||
- #1432: @josegonzalez Delete unmaintained AUTHORS file
|
||||
- #1450: @michaelshobbs Rename event plugin buildstep hooks to buildpack
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #1344: @AdamVig Add better error checking on nginx:import-ssl
|
||||
- #1417: @josegonzalez Expose host and port in vagrant build vm
|
||||
- #1418: @josegonzalez Use cgroupfs-mount as alternative package to cgroup-lite dependency
|
||||
- #1419: @u2mejc Fix dokku ps <app> over ssh
|
||||
- #1422: @josegonzalez Guard against missing VHOST files when listing domains
|
||||
- #1428: @jimeh Use `$PLUGIN_PATH` instead of `$(dirname $0)/..`
|
||||
- #1430: @lubert Update vagrant box name to `bento/ubuntu-14.04`
|
||||
- #1439: @michaelshobbs Fix tar tests by sleeping for 5 seconds
|
||||
- #1447: @alanjds Properly detect app name in the official cli client
|
||||
- #1449: @josegonzalez Match herokuish deb with released version number
|
||||
- #1457: @lukechilds Bashstyle fixes
|
||||
- #1463: @josegonzalez Update `Xenify Distro` option for linode stackscript
|
||||
- #1464: @josegonzalez Limit number of log lines when calling `dokku logs -t`
|
||||
- #1466: @josegonzalez Follow bashstyle conventions where possible
|
||||
- #1471: @michaelshobbs Make the default scaling logic clearer
|
||||
- #1475: @josegonzalez Fix issue where restart on failure option overrode existing DOCKER_ARGS
|
||||
|
||||
### New features
|
||||
|
||||
- #1225: @michaelshobbs Add tags plugin to handle image tagging and deployment of tagged app images
|
||||
- #1228: @michaelshobbs Use plugn instead of pluginhook to trigger plugin hooks
|
||||
- #1402: @josegonzalez Consolidate configuration management into config plugin
|
||||
- #1414: @michaelshobbs Add certs plugin for certificate management
|
||||
- #1420: @josegonzalez Add `dokku enter` for connecting to an app container
|
||||
- #1421: @basicer Add tar plugin to manage tar-based deployments
|
||||
- #1423: @josegonzalez Set `DYNO_TYPE_NUMBER` environment variable for each container
|
||||
- #1431: @josegonzalez Add helper function for inspecting the state of a container
|
||||
- #1444: @josegonzalez Extract cleanup command into common function
|
||||
- #1445: @josegonzalez Create CONTRIBUTING.md
|
||||
- #1455: @michaelshobbs Continue and log an event if/when container retirement fails
|
||||
- #1458: @michaelshobbs Set Herokuish `TRACE=true` when `DOKKU_TRACE` is set
|
||||
- #1460: @michaelshobbs Bump herokuish version to 0.3.3
|
||||
- #1465: @josegonzalez Set DYNO environment variable to heroku-compatible value
|
||||
- #1467: @josegonzalez Upgrade dokku installation to use docker-engine
|
||||
- #1468: @michaelshobbs Clean up semver logic and run install-dependencies after package installation
|
||||
- #1469: @isundaylee Add nginx:access-logs and nginx:error-logs commands
|
||||
- #1470: @assaf Add nginx configuration for running behind load balancer
|
||||
- #1472: @michaelshobbs Use processes defined in `Procfile` when generating `DOKKU_SCALE` file
|
||||
- #1473: @josegonzalez Handle crashing containers by using restart=on-failure policy
|
||||
- #1476: @michaelshobbs Support static nginx port when deploying without an application VHOST
|
||||
- #1476: nginx proxy without VHOST
|
||||
- #1477: @arthurschreiber Support removing config variables that contain `\n`.
|
||||
|
||||
### Documentation
|
||||
|
||||
- #1407: @ertrzyiks Correct DOKKU_DOCKERFILE_PORT variable name in docs
|
||||
- #1408: @josegonzalez Add links to official dokku datastorage plugins
|
||||
- #1426: @henrik Update memcached link to maintained fork
|
||||
- #1437: @Flink Update compatibility version for several plugins
|
||||
- #1446: @johnfraney Correct nginx documentation
|
||||
- #1478: @eljojo Fix naming of herokuish package in installation docs
|
||||
|
||||
## 0.3.26
|
||||
|
||||
This release has a few new features, the largest of which is switching from buildstep to herokuish for building containers. Going forward, this should help ensure that built containers are as close to heroku containers as possible, and also allow us to be on the cutting edge of heroku buildpack support. Props to @michaelshobbs for his work on herokuish.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #1401: @josegonzalez Install apt-transport-https before adding https-backed apt sources
|
||||
|
||||
### New Features
|
||||
|
||||
- #1128: @michaelshobbs Switch from buildstep to herokuish
|
||||
- #1399: @basicer Make dokku play nice when there are multiple receive-app hooks
|
||||
- #1413: @michaelshobbs support comments in DOKKU_SCALE and print contents on deploy
|
||||
|
||||
### Documentation
|
||||
|
||||
- #1400: @josegonzalez Fix HISTORY.md formatting
|
||||
- #1410: @josegonzalez Clarify DOKKU_SCALE usage
|
||||
- #1411: @josegonzalez Clarify `ps:scale` example
|
||||
|
||||
## 0.3.25
|
||||
|
||||
This release is a bugfix release fixing a broken 0.3.25 apt-get installation.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #1398 @josegonzalez Revert "Remove `dokku plugins-install` from postinst hook
|
||||
|
||||
## 0.3.24
|
||||
|
||||
This release is a bugfix release covering dokku packaging.
|
||||
@@ -420,9 +581,10 @@ This release pegs Dokku to Docker 1.6.2. Docker 1.7.0 introduced changes in `doc
|
||||
- 969aed87: @jfrazelle Fix double brackets issue in nginx-vhosts install
|
||||
- 42fee25f: @rhy-jot Mention 14.04 & 12.10 sunset
|
||||
- 4f5fc586: @rhy-jot Update cipher list
|
||||
- #276: @joliv Add dependencies hook - wingrunr21- #476: Added man page entry
|
||||
- #276: @wingrunr21 Add dependencies hook
|
||||
- #476: @joliv Added man page entry
|
||||
- #522: @wingrunr21 Improve SSL support and implement SPDY
|
||||
- #544: @jfrazelle if dokku.conf has not been created, create it
|
||||
- #544: @jfrazelle if dokku.conf has not been created, create it
|
||||
- #555: @jakubholynet Readme fix, Env vars only set at run time
|
||||
- #562: @assaf Zero down-time deploy and server checks
|
||||
- #571: @joliv Added man page plugin command
|
||||
|
||||
88
Makefile
88
Makefile
@@ -1,10 +1,12 @@
|
||||
DOKKU_VERSION = master
|
||||
|
||||
SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand
|
||||
PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb
|
||||
STACK_URL ?= https://github.com/progrium/buildstep.git
|
||||
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2015-07-14/2015-07-14_1afb78e747.tar.gz
|
||||
PLUGINS_PATH ?= /var/lib/dokku/plugins
|
||||
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/progrium/sshcommand/master/sshcommand
|
||||
PLUGN_URL ?= https://github.com/progrium/plugn/releases/download/v0.1.0/plugn_0.1.0_linux_x86_64.tgz
|
||||
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
|
||||
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
|
||||
DOKKU_LIB_ROOT ?= /var/lib/dokku
|
||||
PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/plugins
|
||||
CORE_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/core-plugins
|
||||
|
||||
# If the first argument is "vagrant-dokku"...
|
||||
ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
||||
@@ -14,7 +16,13 @@ ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
||||
$(eval $(RUN_ARGS):;@:)
|
||||
endif
|
||||
|
||||
.PHONY: all apt-update install copyfiles man-db version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
ifeq ($(CIRCLECI),true)
|
||||
BUILD_STACK_TARGETS = circleci deps build
|
||||
else
|
||||
BUILD_STACK_TARGETS = build-in-docker
|
||||
endif
|
||||
|
||||
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
|
||||
include tests.mk
|
||||
include deb.mk
|
||||
@@ -22,14 +30,14 @@ include deb.mk
|
||||
all:
|
||||
# Type "make install" to install.
|
||||
|
||||
install: dependencies copyfiles plugin-dependencies plugins version
|
||||
install: dependencies version copyfiles plugin-dependencies plugins
|
||||
|
||||
release: deb-all package_cloud packer
|
||||
|
||||
package_cloud:
|
||||
package_cloud push dokku/dokku/ubuntu/trusty buildstep*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty pluginhook*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty plugn*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb
|
||||
|
||||
@@ -38,13 +46,21 @@ packer:
|
||||
|
||||
copyfiles:
|
||||
cp dokku /usr/local/bin/dokku
|
||||
mkdir -p ${PLUGINS_PATH}
|
||||
find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf
|
||||
mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH}
|
||||
rm -rf ${CORE_PLUGINS_PATH}/*
|
||||
test -d ${CORE_PLUGINS_PATH}/enabled || PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn init
|
||||
test -d ${PLUGINS_PATH}/enabled || PLUGIN_PATH=${PLUGINS_PATH} plugn init
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
|
||||
rm -Rf ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
||||
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
||||
rm -Rf ${CORE_PLUGINS_PATH}/available/$$plugin && \
|
||||
rm -Rf ${PLUGINS_PATH}/available/$$plugin && \
|
||||
rm -rf ${CORE_PLUGINS_PATH}/$$plugin && \
|
||||
rm -rf ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${CORE_PLUGINS_PATH}/available && \
|
||||
ln -s ${CORE_PLUGINS_PATH}/available/$$plugin ${PLUGINS_PATH}/available; \
|
||||
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}
|
||||
$(MAKE) addman
|
||||
|
||||
addman:
|
||||
@@ -55,13 +71,13 @@ addman:
|
||||
version:
|
||||
git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION
|
||||
|
||||
plugin-dependencies: pluginhook
|
||||
dokku plugins-install-dependencies
|
||||
plugin-dependencies: plugn
|
||||
dokku plugin:install-dependencies --core
|
||||
|
||||
plugins: pluginhook docker
|
||||
dokku plugins-install
|
||||
plugins: plugn docker
|
||||
dokku plugin:install --core
|
||||
|
||||
dependencies: apt-update sshcommand pluginhook docker help2man man-db
|
||||
dependencies: apt-update sshcommand plugn docker help2man man-db
|
||||
$(MAKE) -e stack
|
||||
|
||||
apt-update:
|
||||
@@ -78,22 +94,18 @@ sshcommand:
|
||||
chmod +x /usr/local/bin/sshcommand
|
||||
sshcommand create dokku /usr/local/bin/dokku
|
||||
|
||||
pluginhook:
|
||||
wget -qO /tmp/pluginhook_0.1.0_amd64.deb ${PLUGINHOOK_URL}
|
||||
dpkg -i /tmp/pluginhook_0.1.0_amd64.deb
|
||||
plugn:
|
||||
wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL}
|
||||
tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin
|
||||
|
||||
docker: aufs
|
||||
apt-get install -qq -y curl
|
||||
egrep -i "^docker" /etc/group || groupadd docker
|
||||
usermod -aG docker dokku
|
||||
ifndef CI
|
||||
curl -sSL https://get.docker.com/gpg | apt-key add -
|
||||
echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
|
||||
apt-get update
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
ifdef DOCKER_VERSION
|
||||
apt-get install -qq -y lxc-docker-${DOCKER_VERSION}
|
||||
else
|
||||
apt-get install -qq -y lxc-docker-1.6.2
|
||||
apt-get install -qq -y docker-engine=${DOCKER_VERSION} || (apt-cache madison docker-engine ; exit 1)
|
||||
endif
|
||||
sleep 2 # give docker a moment i guess
|
||||
endif
|
||||
@@ -104,22 +116,28 @@ ifndef CI
|
||||
endif
|
||||
|
||||
stack:
|
||||
ifeq ($(shell test -e /var/run/docker.sock && touch -a -c /var/run/docker.sock && echo $$?),0)
|
||||
@echo "Start building buildstep"
|
||||
ifeq ($(shell test -e /var/run/docker.sock && touch -c /var/run/docker.sock && echo $$?),0)
|
||||
ifdef BUILD_STACK
|
||||
@docker images | grep progrium/buildstep || (git clone ${STACK_URL} /tmp/buildstep && docker build -t progrium/buildstep /tmp/buildstep && rm -rf /tmp/buildstep)
|
||||
@echo "Start building herokuish from source"
|
||||
docker images | grep gliderlabs/herokuish || (git clone ${STACK_URL} /tmp/herokuish && cd /tmp/herokuish && IMAGE_NAME=gliderlabs/herokuish BUILD_TAG=latest VERSION=master make -e ${BUILD_STACK_TARGETS} && rm -rf /tmp/herokuish)
|
||||
else
|
||||
@docker images | grep progrium/buildstep || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep
|
||||
ifeq ($(shell echo ${PREBUILT_STACK_URL} | egrep -q 'http.*://|file://' && echo $$?),0)
|
||||
@echo "Start importing herokuish from ${PREBUILT_STACK_URL}"
|
||||
docker images | grep gliderlabs/herokuish || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - gliderlabs/herokuish
|
||||
else
|
||||
@echo "Start pulling herokuish from ${PREBUILT_STACK_URL}"
|
||||
docker images | grep gliderlabs/herokuish || docker pull ${PREBUILT_STACK_URL}
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
count:
|
||||
@echo "Core lines:"
|
||||
@cat dokku bootstrap.sh | egrep -v "^$$" | wc -l
|
||||
@cat dokku bootstrap.sh | sed 's/^$$//g' | wc -l
|
||||
@echo "Plugin lines:"
|
||||
@find plugins -type f | xargs cat | egrep -v "^$$" | wc -l
|
||||
@find plugins -type f -not -name .DS_Store | xargs cat | sed 's/^$$//g' | wc -l
|
||||
@echo "Test lines:"
|
||||
@find tests -type f | xargs cat | egrep -v "^$$" |wc -l
|
||||
@find tests -type f -not -name .DS_Store | xargs cat | sed 's/^$$//g' | wc -l
|
||||
|
||||
dokku-installer:
|
||||
apt-get install -qq -y ruby
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Dokku [](https://circleci.com/gh/progrium/dokku/tree/master) [](https://packagecloud.io/dokku/dokku) [](https://webchat.freenode.net/?channels=dokku) [](http://progrium.viewdocs.io/dokku/)
|
||||
# Dokku [](https://circleci.com/gh/progrium/dokku/tree/master) [](https://packagecloud.io/dokku/dokku) [](https://webchat.freenode.net/?channels=dokku) [](http://progrium.viewdocs.io/dokku/) [](https://gratipay.com/dokku/)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
|
||||
|
||||
@@ -10,8 +10,8 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
|
||||
|
||||
To install the latest stable release, you can run the following commands as a user that has access to `sudo`:
|
||||
|
||||
wget https://raw.github.com/progrium/dokku/v0.3.24/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.3.24 bash bootstrap.sh
|
||||
wget https://raw.githubusercontent.com/progrium/dokku/v0.4.2/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.4.2 bash bootstrap.sh
|
||||
|
||||
### Upgrading
|
||||
|
||||
|
||||
5
Vagrantfile
vendored
5
Vagrantfile
vendored
@@ -1,7 +1,7 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
BOX_NAME = ENV["BOX_NAME"] || "chef/ubuntu-14.04"
|
||||
BOX_NAME = ENV["BOX_NAME"] || "bento/ubuntu-14.04"
|
||||
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
|
||||
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
|
||||
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
|
||||
@@ -46,6 +46,9 @@ Vagrant::configure("2") do |config|
|
||||
end
|
||||
|
||||
config.vm.define "build", autostart: false do |vm|
|
||||
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
|
||||
vm.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
vm.vm.network :private_network, ip: DOKKU_IP
|
||||
vm.vm.provision :shell, :inline => "apt-get update > /dev/null && DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
|
||||
end
|
||||
|
||||
47
bootstrap.sh
47
bootstrap.sh
@@ -24,14 +24,14 @@ if ! command -v apt-get &>/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get update -qq > /dev/null
|
||||
which curl > /dev/null || apt-get install -qq -y curl
|
||||
[[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties
|
||||
|
||||
dokku_install_source() {
|
||||
apt-get install -qq -y git make software-properties-common
|
||||
cd /root
|
||||
if [ ! -d /root/dokku ]; then
|
||||
if [[ ! -d /root/dokku ]]; then
|
||||
git clone $DOKKU_REPO /root/dokku
|
||||
fi
|
||||
|
||||
@@ -42,19 +42,28 @@ dokku_install_source() {
|
||||
}
|
||||
|
||||
dokku_install_package() {
|
||||
curl -sSL https://get.docker.io/gpg | apt-key add -
|
||||
echo "--> Initial apt-get update"
|
||||
apt-get update -qq > /dev/null
|
||||
apt-get install -qq -y apt-transport-https
|
||||
|
||||
echo "--> Installing docker"
|
||||
if uname -r | grep -q linode; then
|
||||
echo "--> NOTE: Using Linode? Docker might complain about missing AUFS support."
|
||||
echo " See http://progrium.viewdocs.io/dokku/getting-started/install/linode/"
|
||||
echo " Installation will continue in 10 seconds."
|
||||
sleep 10
|
||||
fi
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
|
||||
echo "--> Installing dokku"
|
||||
curl -sSL https://packagecloud.io/gpg.key | apt-key add -
|
||||
|
||||
echo "deb https://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
apt-get update > /dev/null
|
||||
apt-get install -qq -y "linux-image-extra-$(uname -r)" apt-transport-https
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | tee /etc/apt/sources.list.d/dokku.list
|
||||
apt-get update -qq > /dev/null
|
||||
|
||||
if [[ -n $DOKKU_CHECKOUT ]]; then
|
||||
apt-get install -qq -y dokku=$DOKKU_CHECKOUT
|
||||
apt-get install -y dokku=$DOKKU_CHECKOUT
|
||||
else
|
||||
apt-get install -qq -y dokku
|
||||
apt-get install -y dokku
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -68,15 +77,23 @@ elif [[ -n $DOKKU_TAG ]]; then
|
||||
patch=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[3]}')
|
||||
|
||||
# 0.3.13 was the first version with a debian package
|
||||
if [[ "$major" -eq "0" ]] && [[ "$minor" -lt "4" ]] && [[ "$patch" -lt "13" ]]; then
|
||||
export DOKKU_CHECKOUT="$DOKKU_TAG"
|
||||
dokku_install_source
|
||||
else
|
||||
if [[ "$major" -eq "0" ]] && [[ "$minor" -eq "3" ]] && [[ "$patch" -ge "13" ]]; then
|
||||
export DOKKU_CHECKOUT="$DOKKU_SEMVER"
|
||||
dokku_install_package
|
||||
echo "--> Running post-install dependency installation"
|
||||
dokku plugins-install-dependencies
|
||||
# 0.4.0 implemented a `plugin` plugin
|
||||
elif [[ "$major" -eq "0" ]] && [[ "$minor" -ge "4" ]] && [[ "$patch" -ge "0" ]]; then
|
||||
export DOKKU_CHECKOUT="$DOKKU_SEMVER"
|
||||
dokku_install_package
|
||||
dokku plugin:install-dependencies --core
|
||||
else
|
||||
export DOKKU_CHECKOUT="$DOKKU_TAG"
|
||||
dokku_install_source
|
||||
fi
|
||||
else
|
||||
dokku_install_package
|
||||
dokku plugin:install-dependencies --core
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ if ARGV[0] == "onboot"
|
||||
exit
|
||||
end
|
||||
|
||||
version = "v0.3.24"
|
||||
version = "v0.4.2"
|
||||
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
|
||||
admin_keys = `cat /root/.ssh/authorized_keys`.split("\n")
|
||||
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip
|
||||
|
||||
@@ -6,7 +6,7 @@ NAMES=(SEED GRASS FLOWE SHAD CABR SNAKE GOLD COW GUIKI PEDAL DELAN B-FLY BIDE KE
|
||||
|
||||
random_number() {
|
||||
[[ -n "$1" ]] && RANGE="$1"
|
||||
if [[ -n "$RANGE" ]];then
|
||||
if [[ -n "$RANGE" ]]; then
|
||||
number=$RANDOM
|
||||
let "number %= $RANGE"
|
||||
else
|
||||
@@ -46,7 +46,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
|
||||
appname=""
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
set +e
|
||||
appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
set -e
|
||||
else
|
||||
echo "This is not a git repository"
|
||||
@@ -58,7 +58,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
|
||||
true
|
||||
;;
|
||||
apps:destroy)
|
||||
if [[ -z "$2" ]] || [[ "$2" == "force" ]];then
|
||||
if [[ -z "$2" ]] || [[ "$2" == "force" ]]; then
|
||||
donotshift="YES"
|
||||
fi
|
||||
;;
|
||||
@@ -72,7 +72,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
|
||||
appname=$(random_name)
|
||||
counter=0
|
||||
while ssh "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do
|
||||
if [[ $counter -ge 100 ]];then
|
||||
if [[ $counter -ge 100 ]]; then
|
||||
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
|
||||
ssh "dokku@$DOKKU_HOST" apps
|
||||
exit 1
|
||||
@@ -102,16 +102,16 @@ if [[ ! -z $DOKKU_HOST ]]; then
|
||||
if [[ ! "$1" =~ --* ]]; then
|
||||
verb=$1
|
||||
shift
|
||||
|
||||
|
||||
if [[ "$1" == "$appname" ]]; then
|
||||
shift
|
||||
fi
|
||||
|
||||
|
||||
args="$*"
|
||||
else
|
||||
long_args="--"
|
||||
for arg in "$@";do
|
||||
if [[ "$arg" =~ --* ]];then
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" =~ --* ]]; then
|
||||
long_args+=" $arg"
|
||||
args=("${args[@]/$arg}")
|
||||
else
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"sleep 30",
|
||||
|
||||
"echo '--> Updating apt repositories'",
|
||||
"sudo apt-get update > /dev/null",
|
||||
"sudo apt-get update -qq > /dev/null",
|
||||
|
||||
"echo '--> Installing make requirement'",
|
||||
"sudo apt-get -qq -y install build-essential",
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
# <UDF name="ssh_key" default="" label="Public SSH Key for root user" example="Sets the root user's public ssh key, which is also automatically imported into the dokku installer">
|
||||
# <UDF name="notify_email" default="" Label="Send Finish Notification To" example="Email address to send notification to when finished." />
|
||||
|
||||
function logit {
|
||||
logit() {
|
||||
# Simple logging function that prepends an easy-to-find marker '=> ' and a timestamp to a message
|
||||
TIMESTAMP=$(date -u +'%m/%d %H:%M:%S')
|
||||
MSG="=> ${TIMESTAMP} $1"
|
||||
echo ${MSG}
|
||||
}
|
||||
|
||||
function set_ssh_key {
|
||||
if [ -n "${SSH_KEY}" ]; then
|
||||
set_ssh_key() {
|
||||
if [[ -n "${SSH_KEY}" ]]; then
|
||||
logit "Setting root ssh key"
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 /root/.ssh
|
||||
@@ -21,20 +21,20 @@ function set_ssh_key {
|
||||
fi
|
||||
}
|
||||
|
||||
function set_passwordless_ssh {
|
||||
set_passwordless_ssh() {
|
||||
logit "Turn off password authentication and root login for SSH"
|
||||
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config
|
||||
service ssh restart
|
||||
}
|
||||
|
||||
function system_primary_ip {
|
||||
system_primary_ip() {
|
||||
# returns the primary IP assigned to eth0
|
||||
ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }'
|
||||
}
|
||||
|
||||
function set_hostname {
|
||||
set_hostname() {
|
||||
logit "Set up hostname"
|
||||
if [ -n "${HOSTNAME}" ]; then
|
||||
if [[ -n "${HOSTNAME}" ]]; then
|
||||
echo $HOSTNAME > /etc/hostname
|
||||
echo $IPADDR $FQDN $HOSTNAME >> /etc/hosts
|
||||
else
|
||||
@@ -46,7 +46,7 @@ function set_hostname {
|
||||
hostname -F /etc/hostname
|
||||
}
|
||||
|
||||
function postfix_install_loopback_only {
|
||||
postfix_install_loopback_only() {
|
||||
logit "Installing and configuring Postfix"
|
||||
# Installs postfix and configure to listen only on the local interface. Also
|
||||
# allows for local mail delivery
|
||||
@@ -62,8 +62,8 @@ function postfix_install_loopback_only {
|
||||
touch /tmp/restart-postfix
|
||||
}
|
||||
|
||||
function notify_install_via_email {
|
||||
if [ -n "${NOTIFY_EMAIL}" ]; then
|
||||
notify_install_via_email() {
|
||||
if [[ -n "${NOTIFY_EMAIL}" ]]; then
|
||||
logit "Sending notification email to ${NOTIFY_EMAIL}"
|
||||
/usr/sbin/sendmail "${NOTIFY_EMAIL}" <<EOD
|
||||
To: ${NOTIFY_EMAIL}
|
||||
@@ -77,8 +77,8 @@ EOD
|
||||
fi
|
||||
}
|
||||
|
||||
function notify_restart_via_email {
|
||||
if [ -n "${NOTIFY_EMAIL}" ]; then
|
||||
notify_restart_via_email() {
|
||||
if [[ -n "${NOTIFY_EMAIL}" ]]; then
|
||||
logit "Sending notification email to ${NOTIFY_EMAIL} of required restart"
|
||||
/usr/sbin/sendmail "${NOTIFY_EMAIL}" <<EOD
|
||||
To: ${NOTIFY_EMAIL}
|
||||
@@ -96,14 +96,14 @@ Before restarting, please go to this url:
|
||||
Then click "Edit" next to the selected configuration profile and make the following changes:
|
||||
|
||||
- Change the "Kernel" option to the current "pv-grub" release
|
||||
- Set the "Xenify Distro" option to "no"
|
||||
- Set the "Distro helper" option to "no"
|
||||
|
||||
Then save your changes. Next, reboot the instance from the Linode Dashboard. You'll receive an email once the instance is available to continue the dokku installation.
|
||||
EOD
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_linode {
|
||||
setup_linode() {
|
||||
logit "Installing via linode"
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y linux-virtual
|
||||
DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y grub2 grub-pc
|
||||
@@ -133,30 +133,21 @@ EOF
|
||||
chmod +x /etc/rc.local
|
||||
}
|
||||
|
||||
function install_prerequisites {
|
||||
sudo apt-get install -qq -y curl > /dev/null 2>&1
|
||||
|
||||
logit "Installing docker gpg key"
|
||||
curl -sSL https://get.docker.com/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
logit "Installing dokku gpg key"
|
||||
curl -sSL https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
logit "Running apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
|
||||
install_prerequisites() {
|
||||
logit "Installing pre-requisites"
|
||||
sudo apt-get install -qq -y apt-transport-https > /dev/null 2>&1
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install -qq -y apt-transport-https curl > /dev/null 2>&1
|
||||
|
||||
logit "Setting up apt repositories"
|
||||
echo "deb https://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
logit "Installing docker"
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
|
||||
logit "Installing dokku"
|
||||
curl -sSL https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
logit "Running apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get update -qq > /dev/null
|
||||
}
|
||||
|
||||
function install_dokku {
|
||||
install_dokku() {
|
||||
logit "Installing pre-requisites"
|
||||
sudo apt-get install -qq -y linux-image-extra-"$(uname -r)" > /dev/null 2>&1
|
||||
|
||||
@@ -174,7 +165,7 @@ postfix_install_loopback_only
|
||||
set_hostname
|
||||
install_prerequisites
|
||||
|
||||
if [ -n "$LINODE_ID" ]; then
|
||||
if [[ -n "$LINODE_ID" ]]; then
|
||||
setup_linode
|
||||
notify_restart_via_email
|
||||
else
|
||||
|
||||
106
deb.mk
106
deb.mk
@@ -1,22 +1,22 @@
|
||||
BUILDSTEP_DESCRIPTION = 'Buildstep uses Docker and Buildpacks to build applications like Heroku'
|
||||
BUILDSTEP_REPO_NAME ?= progrium/buildstep
|
||||
BUILDSTEP_VERSION ?= 0.0.2
|
||||
BUILDSTEP_ARCHITECTURE = amd64
|
||||
BUILDSTEP_PACKAGE_NAME = buildstep_$(BUILDSTEP_VERSION)_$(BUILDSTEP_ARCHITECTURE).deb
|
||||
HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
|
||||
HEROKUISH_REPO_NAME ?= gliderlabs/herokuish
|
||||
HEROKUISH_VERSION ?= 0.3.3
|
||||
HEROKUISH_ARCHITECTURE = amd64
|
||||
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
|
||||
|
||||
DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash'
|
||||
DOKKU_REPO_NAME ?= progrium/dokku
|
||||
DOKKU_ARCHITECTURE = amd64
|
||||
|
||||
PLUGINHOOK_DESCRIPTION = 'Simple dispatcher and protocol for shell-based plugins, an improvement to hook scripts'
|
||||
PLUGINHOOK_REPO_NAME ?= progrium/pluginhook
|
||||
PLUGINHOOK_VERSION ?= 0.2.0
|
||||
PLUGINHOOK_ARCHITECTURE = amd64
|
||||
PLUGINHOOK_PACKAGE_NAME = pluginhook_$(PLUGINHOOK_VERSION)_$(PLUGINHOOK_ARCHITECTURE).deb
|
||||
PLUGN_DESCRIPTION = 'Hook system that lets users extend your application with plugins'
|
||||
PLUGN_REPO_NAME ?= progrium/plugn
|
||||
PLUGN_VERSION ?= 0.2.0
|
||||
PLUGN_ARCHITECTURE = amd64
|
||||
PLUGN_PACKAGE_NAME = plugn_$(PLUGN_VERSION)_$(PLUGN_ARCHITECTURE).deb
|
||||
|
||||
SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app'
|
||||
SSHCOMMAND_REPO_NAME ?= progrium/sshcommand
|
||||
SSHCOMMAND_VERSION ?= 0.0.1
|
||||
SSHCOMMAND_VERSION ?= 0.1.0
|
||||
SSHCOMMAND_ARCHITECTURE = amd64
|
||||
SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb
|
||||
|
||||
@@ -26,70 +26,58 @@ GOROOT = /usr/lib/go
|
||||
GOBIN = /usr/bin/go
|
||||
GOPATH = /home/vagrant/gocode
|
||||
|
||||
.PHONY: install-from-deb deb-all deb-buildstep deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand
|
||||
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-gems deb-plugn deb-setup deb-sshcommand
|
||||
|
||||
install-from-deb:
|
||||
echo "--> Initial apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -y apt-transport-https curl
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install -qq -y apt-transport-https curl
|
||||
|
||||
echo "--> Installing docker gpg key"
|
||||
curl -sSL https://get.docker.com/gpg | apt-key add -
|
||||
|
||||
echo "--> Installing dokku gpg key"
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
|
||||
echo "--> Setting up apt repositories"
|
||||
echo "deb https://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
echo "--> Running apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
|
||||
echo "--> Installing pre-requisites"
|
||||
sudo apt-get install -y linux-image-extra-`uname -r`
|
||||
echo "--> Installing docker"
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
|
||||
echo "--> Installing dokku"
|
||||
sudo apt-get install -y dokku
|
||||
curl -sSL https://packagecloud.io/gpg.key | apt-key add -
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/dokku.list
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install dokku
|
||||
|
||||
echo "--> Done!"
|
||||
|
||||
deb-all: deb-buildstep deb-dokku deb-gems deb-pluginhook deb-sshcommand
|
||||
deb-all: deb-herokuish deb-dokku deb-gems deb-plugn deb-sshcommand
|
||||
mv /tmp/*.deb .
|
||||
echo "Done"
|
||||
|
||||
deb-setup:
|
||||
echo "-> Updating deb repository and installing build requirements"
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install -qq -y gcc git ruby1.9.1-dev 2>&1 > /dev/null
|
||||
command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
|
||||
ssh -o StrictHostKeyChecking=no git@github.com || true
|
||||
|
||||
deb-buildstep: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build $(BUILDSTEP_PACKAGE_NAME)
|
||||
deb-herokuish: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build $(HEROKUISH_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
echo "-> Creating deb files"
|
||||
echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install
|
||||
echo "sleep 5" >> /tmp/tmp/post-install
|
||||
echo "count=\`sudo docker images | grep progrium/buildstep | wc -l\`" >> /tmp/tmp/post-install
|
||||
echo "count=\`sudo docker images | grep gliderlabs/herokuish | wc -l\`" >> /tmp/tmp/post-install
|
||||
echo 'if [ "$$count" -ne 0 ]; then' >> /tmp/tmp/post-install
|
||||
echo " echo 'Removing old buildstep image'" >> /tmp/tmp/post-install
|
||||
echo " sudo docker rmi progrium/buildstep" >> /tmp/tmp/post-install
|
||||
echo " echo 'Removing old herokuish image'" >> /tmp/tmp/post-install
|
||||
echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install
|
||||
echo "fi" >> /tmp/tmp/post-install
|
||||
echo "echo 'Importing buildstep into docker (around 5 minutes)'" >> /tmp/tmp/post-install
|
||||
echo "sudo docker build -t progrium/buildstep /var/lib/buildstep 1> /dev/null" >> /tmp/tmp/post-install
|
||||
echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install
|
||||
echo "sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install
|
||||
|
||||
echo "-> Cloning repository"
|
||||
git clone -q "git@github.com:$(BUILDSTEP_REPO_NAME).git" /tmp/tmp/buildstep > /dev/null
|
||||
rm -rf /tmp/tmp/buildstep/.git /tmp/tmp/buildstep/.gitignore
|
||||
git clone -q "git@github.com:$(HEROKUISH_REPO_NAME).git" /tmp/tmp/herokuish > /dev/null
|
||||
rm -rf /tmp/tmp/herokuish/.git /tmp/tmp/herokuish/.gitignore
|
||||
|
||||
echo "-> Copying files into place"
|
||||
mkdir -p "/tmp/build/var/lib"
|
||||
cp -rf /tmp/tmp/buildstep /tmp/build/var/lib/buildstep
|
||||
cp -rf /tmp/tmp/herokuish /tmp/build/var/lib/herokuish
|
||||
|
||||
echo "-> Creating $(BUILDSTEP_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n buildstep -v $(BUILDSTEP_VERSION) -a $(BUILDSTEP_ARCHITECTURE) -p $(BUILDSTEP_PACKAGE_NAME) --deb-pre-depends 'lxc-docker-1.6.2' --after-install /tmp/tmp/post-install --url "https://github.com/$(BUILDSTEP_REPO_NAME)" --description $(BUILDSTEP_DESCRIPTION) --license 'MIT License' .
|
||||
echo "-> Creating $(HEROKUISH_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n herokuish -v $(HEROKUISH_VERSION) -a $(HEROKUISH_ARCHITECTURE) -p $(HEROKUISH_PACKAGE_NAME) --deb-pre-depends 'docker-engine | docker-engine-cs' --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
|
||||
@@ -98,13 +86,13 @@ deb-dokku: deb-setup
|
||||
|
||||
cp -r debian /tmp/build/DEBIAN
|
||||
mkdir -p /tmp/build/usr/local/bin
|
||||
mkdir -p /tmp/build/var/lib/dokku
|
||||
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
|
||||
mkdir -p /tmp/build/usr/local/share/man/man1
|
||||
mkdir -p /tmp/build/usr/local/share/dokku/contrib
|
||||
|
||||
cp dokku /tmp/build/usr/local/bin
|
||||
cp -r plugins /tmp/build/var/lib/dokku
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/plugins/$$plugin/.core; done
|
||||
cp -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
|
||||
$(MAKE) addman
|
||||
cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/local/share/man/man1/dokku.1
|
||||
@@ -128,24 +116,24 @@ deb-gems: deb-setup
|
||||
find /tmp/tmp/cache -name '*.gem' | xargs -rn1 fpm -d ruby -d ruby --prefix /var/lib/gems/1.9.1 -s gem -t deb -a $(GEM_ARCHITECTURE)
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-pluginhook: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build $(PLUGINHOOK_PACKAGE_NAME)
|
||||
deb-plugn: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
echo "-> Cloning repository"
|
||||
git clone -q "git@github.com:$(PLUGINHOOK_REPO_NAME).git" /tmp/tmp/pluginhook > /dev/null
|
||||
rm -rf /tmp/tmp/pluginhook/.git /tmp/tmp/pluginhook/.gitignore
|
||||
git clone -q "git@github.com:$(PLUGN_REPO_NAME).git" /tmp/tmp/plugn > /dev/null
|
||||
rm -rf /tmp/tmp/plugn/.git /tmp/tmp/plugn/.gitignore
|
||||
|
||||
echo "-> Copying files into place"
|
||||
mkdir -p /tmp/build/usr/local/bin $(GOPATH)
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install -qq -y git golang mercurial 2>&1 > /dev/null
|
||||
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && go get "golang.org/x/crypto/ssh/terminal"
|
||||
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/pluginhook && go build -o pluginhook
|
||||
mv /tmp/tmp/pluginhook/pluginhook /tmp/build/usr/local/bin/pluginhook
|
||||
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/plugn && make deps
|
||||
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/plugn && go build -o plugn
|
||||
mv /tmp/tmp/plugn/plugn /tmp/build/usr/local/bin/plugn
|
||||
|
||||
echo "-> Creating $(PLUGINHOOK_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n pluginhook -v $(PLUGINHOOK_VERSION) -a $(PLUGINHOOK_ARCHITECTURE) -p $(PLUGINHOOK_PACKAGE_NAME) --url "https://github.com/$(PLUGINHOOK_REPO_NAME)" --description $(PLUGINHOOK_DESCRIPTION) --license 'MIT License' .
|
||||
echo "-> Creating $(PLUGN_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n plugn -v $(PLUGN_VERSION) -a $(PLUGN_ARCHITECTURE) -p $(PLUGN_PACKAGE_NAME) --url "https://github.com/$(PLUGN_REPO_NAME)" --description $(PLUGN_DESCRIPTION) --license 'MIT License' .
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-sshcommand: deb-setup
|
||||
|
||||
4
debian/control
vendored
4
debian/control
vendored
@@ -3,7 +3,7 @@ Version: 0.3.12
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, gcc, python-software-properties, man-db, buildstep, sshcommand, pluginhook
|
||||
Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroup-lite
|
||||
Depends: locales, git, make, curl, software-properties-common, docker-engine | docker-engine-cs | lxc-docker, gcc, python-software-properties, man-db, herokuish, sshcommand
|
||||
Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroupfs-mount | cgroup-lite, plugn
|
||||
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
Description: Docker powered mini-Heroku in around 100 lines of Bash
|
||||
|
||||
32
debian/postinst
vendored
32
debian/postinst
vendored
@@ -16,7 +16,35 @@ case "$1" in
|
||||
sshcommand create dokku /usr/local/bin/dokku
|
||||
egrep -i "^docker" /etc/group || groupadd docker
|
||||
usermod -aG docker dokku
|
||||
echo "WARNING: Run 'dokku plugins-install' after installation if using custom plugins"
|
||||
|
||||
# setup plugin directories
|
||||
# should be replaced by `plugn init`
|
||||
mkdir -p /var/lib/dokku/core-plugins/available /var/lib/dokku/plugins/available
|
||||
mkdir -p /var/lib/dokku/core-plugins/enabled /var/lib/dokku/plugins/enabled
|
||||
touch /var/lib/dokku/core-plugins/config.toml /var/lib/dokku/plugins/config.toml
|
||||
|
||||
# migrate old plugins
|
||||
find /var/lib/dokku/plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do
|
||||
if [ "$plugin" = "available" ] || [ "$plugin" = "enabled" ]; then
|
||||
continue
|
||||
elif [ -f /var/lib/dokku/plugins/$plugin/.core ]; then
|
||||
rm -rf /var/lib/dokku/plugins/$plugin
|
||||
elif [ ! -d /var/lib/dokku/plugins/available/$plugin ]; then
|
||||
mv /var/lib/dokku/plugins/$plugin /var/lib/dokku/plugins/available;
|
||||
fi
|
||||
done
|
||||
|
||||
# enable all core plugins
|
||||
find /var/lib/dokku/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do
|
||||
if [ ! -d /var/lib/dokku/plugins/available/$plugin ]; then
|
||||
ln -s /var/lib/dokku/core-plugins/available/$plugin /var/lib/dokku/plugins/available/$plugin;
|
||||
PLUGIN_PATH=/var/lib/dokku/core-plugins plugn enable $plugin
|
||||
PLUGIN_PATH=/var/lib/dokku/plugins plugn enable $plugin
|
||||
fi
|
||||
done
|
||||
|
||||
dokku plugin:install --core
|
||||
|
||||
rm -f /home/dokku/VERSION
|
||||
cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION
|
||||
|
||||
@@ -31,7 +59,7 @@ case "$1" in
|
||||
|
||||
db_get "dokku/vhost_enable"
|
||||
if [ "$RET" = "true" ]; then
|
||||
db_get "dokku/hostname"
|
||||
db_get "dokku/hostname"
|
||||
echo "$RET" > "${DOKKU_ROOT}/VHOST"
|
||||
else
|
||||
rm -f "${DOKKU_ROOT}/VHOST"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
You can always install dokku straight from the latest - potentially unstable - master release via the following bash command:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash
|
||||
wget -qO- https://raw.githubusercontent.com/progrium/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash
|
||||
```
|
||||
|
||||
## Development
|
||||
@@ -16,10 +16,10 @@ cd dokku
|
||||
sudo make install
|
||||
```
|
||||
|
||||
The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example:
|
||||
The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGN_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example:
|
||||
|
||||
```shell
|
||||
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
|
||||
sudo SSHCOMMAND_URL=https://raw.githubusercontent.com/yourusername/sshcommand/master/sshcommand make install
|
||||
```
|
||||
|
||||
## Bootstrap a server from your own repository
|
||||
@@ -27,19 +27,19 @@ sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcom
|
||||
The bootstrap script allows the dokku repository URL to be overridden to bootstrap a host from your own clone of dokku using the `DOKKU_REPO` environment variable. Example:
|
||||
|
||||
```shell
|
||||
wget https://raw.github.com/progrium/dokku/master/bootstrap.sh
|
||||
wget https://raw.githubusercontent.com/progrium/dokku/master/bootstrap.sh
|
||||
chmod +x bootstrap.sh
|
||||
sudo DOKKU_REPO=https://github.com/yourusername/dokku.git DOKKU_BRANCH=master ./bootstrap.sh
|
||||
```
|
||||
|
||||
## Custom buildstep build
|
||||
## Custom herokuish build
|
||||
|
||||
Dokku ships with a pre-built version of version of the [buildstep](https://github.com/progrium/buildstep) component by default. If you want to build your own version you can specify that with an env variable.
|
||||
Dokku ships with a pre-built version of version of the [herokuish](https://github.com/gliderlabs/herokuish) component by default. If you want to build your own version you can specify that with an env variable.
|
||||
|
||||
```shell
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
cd dokku
|
||||
sudo BUILD_STACK=true STACK_URL=https://github.com/progrium/buildstep.git make install
|
||||
sudo BUILD_STACK=true STACK_URL=https://github.com/gliderlabs/herokuish.git make install
|
||||
```
|
||||
|
||||
## Configuring
|
||||
|
||||
@@ -25,7 +25,7 @@ You're done!
|
||||
|
||||
Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku <local branch>:master```
|
||||
|
||||
Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)!
|
||||
Right now Herokuish supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/gliderlabs/herokuish#buildpacks).
|
||||
Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root.
|
||||
|
||||
## Deploying to server over SSH
|
||||
@@ -48,13 +48,13 @@ ssh -T git@github.com
|
||||
|
||||
## Specifying a custom buildpack
|
||||
|
||||
If buildpack detection isn't working well for you or you want to specify a custom buildpack for one repository you can create & commit a file in the root of your git repository named `.env` containing `export BUILDPACK_URL=<repository>` before pushing. This will tell buildstep to fetch the specified buildpack and use it instead of relying on the built-in buildpacks & their detection methods.
|
||||
If buildpack detection isn't working well for you or you want to specify a custom buildpack for one repository you can create & commit a file in the root of your git repository named `.env` containing `export BUILDPACK_URL=<repository>` before pushing. This will tell herokuish to fetch the specified buildpack and use it instead of relying on the built-in buildpacks & their detection methods.
|
||||
|
||||
## Dockerfile deployment
|
||||
|
||||
Deployment of `Dockerfile` repos is supported as of v0.3.15. Simply place a Dockerfile in the root of your repo and push to dokku. If you are converting from a heroku/dokku buildpack deployment, ensure you are not setting `$BUILDPACK_URL` or including a `.buildpacks` file in the root of your repo.
|
||||
|
||||
By default, we will extract the first `EXPOSE` port and tell nginx to proxy your app to that port. Alternatively, you can set `$DOCKERFILE_PORT` in your app's dokku configuration.
|
||||
By default, we will extract the first `EXPOSE` port and tell nginx to proxy your app to that port. Alternatively, you can set `$DOKKU_DOCKERFILE_PORT` in your app's dokku configuration.
|
||||
|
||||
By default no arguments are passed to `docker run` when deploying the container and the `CMD` or `ENTRYPOINT` defined in the `Dockerfile` are executed. You can take advantage of docker ability of overriding the `CMD` or passing parameters to your `ENTRYPOINT` setting `$DOKKU_DOCKERFILE_START_CMD`. Let's say for example you are deploying a base nodejs image, with the following `ENTRYPOINT`:
|
||||
|
||||
@@ -121,7 +121,7 @@ This is in particular useful, then you want to deploy to root domain, as
|
||||
remote: -----> Application deployed:
|
||||
remote: http://dokku.me
|
||||
|
||||
# Zero downtime deploy
|
||||
## Zero downtime deploy
|
||||
|
||||
Following a deploy, dokku will now wait `DOKKU_DEFAULT_CHECKS_WAIT` seconds (default: `10`), and if the container is still running, then route traffic to the new container.
|
||||
|
||||
@@ -147,7 +147,7 @@ Checks can be skipped entirely by setting `DOKKU_SKIP_ALL_CHECKS` to `true` eith
|
||||
|
||||
See [checks-examples.md](checks-examples.md) for examples and output.
|
||||
|
||||
# Removing a deployed app
|
||||
## Removing a deployed app
|
||||
|
||||
SSH onto the server, then execute:
|
||||
|
||||
@@ -155,6 +155,61 @@ SSH onto the server, then execute:
|
||||
dokku apps:destroy myapp
|
||||
```
|
||||
|
||||
# Dokku/Docker Container Management Compatibility
|
||||
## Image tagging
|
||||
|
||||
The dokku tags plugin allows you to add docker image tags to the currently deployed app image for versioning and subsequent deployment.
|
||||
|
||||
```
|
||||
tags <app> List all app image tags
|
||||
tags:create <app> <tag> Add tag to latest running app image
|
||||
tags:deploy <app> <tag> Deploy tagged app image
|
||||
tags:destroy <app> <tag> Remove app image tag
|
||||
```
|
||||
|
||||
Example:
|
||||
```
|
||||
root@dokku:~# 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
|
||||
=====> Added v0.9.0 tag to dokku/node-js-app
|
||||
|
||||
root@dokku:~# 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
|
||||
-----> 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
|
||||
For more efficient zero downtime deployments, create a file CHECKS.
|
||||
See http://progrium.viewdocs.io/dokku/checks-examples.md for examples
|
||||
CHECKS file not found in container: Running simple container check...
|
||||
-----> Waiting for 10 seconds ...
|
||||
-----> Default container check successful!
|
||||
=====> node-js-app container output:
|
||||
Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
|
||||
Recommending WEB_CONCURRENCY=1
|
||||
> node-js-sample@0.1.0 start /app
|
||||
> node index.js
|
||||
Node app is running at localhost:5000
|
||||
=====> end node-js-app container output
|
||||
-----> Running post-deploy
|
||||
-----> Configuring node-js-app.dokku.me...
|
||||
-----> Creating http nginx.conf
|
||||
-----> Running nginx-pre-reload
|
||||
Reloading nginx
|
||||
-----> Shutting down old containers in 60 seconds
|
||||
=====> 025eec3fa3b442fded90933d58d8ed8422901f0449f5ea0c23d00515af5d3137
|
||||
=====> Application deployed:
|
||||
http://node-js-app.dokku.me
|
||||
|
||||
```
|
||||
|
||||
## Dokku/Docker Container Management Compatibility
|
||||
|
||||
Dokku is, at it's 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/progrium/dokku/issues/1220), dokku executes a cleanup function prior to every deployment. This function removes all exited containers and all 'unattached' images.
|
||||
|
||||
BIN
docs/assets/dokku.png
Normal file
BIN
docs/assets/dokku.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -1,12 +1,14 @@
|
||||
body {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-weight: 400;
|
||||
padding-bottom: 40px;
|
||||
color: #5a5a5a;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #5a5a5a;
|
||||
font-family: 'montserrat', Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif;
|
||||
font-weight: 700;
|
||||
font-weight: 400;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 12px;
|
||||
margin-top: 12px;
|
||||
@@ -20,12 +22,25 @@ h1 {
|
||||
color: #fff;
|
||||
font-size: 23px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding: 0 0 0 1em;
|
||||
}
|
||||
.header a {
|
||||
background-image: url(https://cdn.rawgit.com/progrium/dokku/master/docs/assets/dokku.png);
|
||||
color: #fff;
|
||||
text-indent: 40px;
|
||||
background-position: center left;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-webkit-background-size: contain;
|
||||
-moz-background-size: contain;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.blurb {
|
||||
color: #424242;
|
||||
background-color: #ededed;
|
||||
background-image: url(gplaypattern.png);
|
||||
background-image: url(https://cdn.rawgit.com/progrium/dokku/master/docs/assets/gplaypattern.png);
|
||||
padding: 45px 0;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -41,7 +56,7 @@ h1 {
|
||||
font-size: 12px;
|
||||
line-height: 1.3em;
|
||||
margin: 45px auto;
|
||||
max-width: 650px;
|
||||
max-width: 750px;
|
||||
padding: 0;
|
||||
}
|
||||
.quickstart-code .title {
|
||||
@@ -107,7 +122,112 @@ h1 {
|
||||
.featurette-heading .text-muted {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
border: none;
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
padding: .2rem .5rem;
|
||||
color: #157577;
|
||||
}
|
||||
a.list-group-item {
|
||||
color: #666
|
||||
}
|
||||
.list-group-item.disabled:first-child, .list-group-item.disabled:first-child:focus, .list-group-item.disabled:first-child:hover {
|
||||
margin-top: 0;
|
||||
}
|
||||
.list-group-item.disabled, .list-group-item.disabled:focus, .list-group-item.disabled:hover {
|
||||
background: none;
|
||||
color: #bbb;
|
||||
cursor: default;
|
||||
font-weight: normal;
|
||||
font-size: 11px;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 2em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.anchorjs-link {
|
||||
color: #24cbce;
|
||||
}
|
||||
.markdown-body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
box-sizing: border-box;
|
||||
color: rgb(71, 74, 84);
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
.markdown-body h1 {
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
color: #444;
|
||||
font-size: 24px;
|
||||
padding-bottom: 1em;
|
||||
margin-top: 0;
|
||||
text-rendering: optimizelegibility;
|
||||
}
|
||||
.markdown-body h2 {
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
color: #555;
|
||||
margin-top: 3em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.markdown-body h3 {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #555;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.markdown-body h4 {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #555;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.markdown-body h1 + h2 {
|
||||
margin-top: 1em;
|
||||
}
|
||||
code {
|
||||
padding: 0;
|
||||
padding-top: 0.2em;
|
||||
padding-bottom: 0.2em;
|
||||
margin: 0;
|
||||
font-size: 85%;
|
||||
background-color: #fff;
|
||||
background-color: rgba(0,0,0,0.06);
|
||||
color: #333;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
}
|
||||
code:before {
|
||||
letter-spacing: -0.2em;
|
||||
content: "\00a0";
|
||||
}
|
||||
code:after {
|
||||
letter-spacing: -0.2em;
|
||||
content: "\00a0";
|
||||
}
|
||||
pre code:before, pre code:after {
|
||||
letter-spacing: 0;
|
||||
content: "";
|
||||
}
|
||||
pre {
|
||||
display: block;
|
||||
line-height: 1.428571429;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
border: 1px solid #cccccc;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
box-shadow: 0 0 0 3px #eee;
|
||||
overflow: auto !important;
|
||||
padding: 10px;
|
||||
background-color: #fff;
|
||||
color: #4d4d4c;
|
||||
margin: 2em 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.quickstart-code {
|
||||
font-size: 14px;
|
||||
|
||||
@@ -53,7 +53,7 @@ ATTEMPTS=6
|
||||
git push dokku master
|
||||
|
||||
-----> Cleaning up...
|
||||
-----> Building myapp from buildstep...
|
||||
-----> Building myapp from herokuish...
|
||||
-----> Adding BUILD_ENV to build environment...
|
||||
-----> Ruby app detected
|
||||
-----> Compiling Ruby/Rails
|
||||
@@ -71,13 +71,13 @@ git push dokku master
|
||||
http://localhost/check.txt => "simple_check"
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
|
||||
! Check attempt 1/6 failed.
|
||||
! Check attempt 1/6 failed.
|
||||
-----> Attempt 2/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/check.txt => "simple_check"
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
|
||||
! Check attempt 2/6 failed.
|
||||
! Check attempt 2/6 failed.
|
||||
-----> Attempt 3/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/check.txt => "simple_check"
|
||||
@@ -124,7 +124,7 @@ ATTEMPTS=6
|
||||
git push dokku master
|
||||
|
||||
-----> Cleaning up...
|
||||
-----> Building myapp from buildstep...
|
||||
-----> Building myapp from herokuish...
|
||||
-----> Adding BUILD_ENV to build environment...
|
||||
-----> Ruby app detected
|
||||
-----> Compiling Ruby/Rails
|
||||
@@ -142,38 +142,38 @@ Running pre-flight checks
|
||||
http://localhost/ => ""
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
|
||||
! Check attempt 1/6 failed.
|
||||
! Check attempt 1/6 failed.
|
||||
-----> Attempt 2/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
|
||||
! Check attempt 2/6 failed.
|
||||
! Check attempt 2/6 failed.
|
||||
-----> Attempt 3/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
! Check attempt 3/6 failed.
|
||||
! Check attempt 3/6 failed.
|
||||
-----> Attempt 4/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
! Check attempt 4/6 failed.
|
||||
! Check attempt 4/6 failed.
|
||||
-----> Attempt 5/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
! Check attempt 5/6 failed.
|
||||
! Check attempt 5/6 failed.
|
||||
-----> Attempt 6/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
Could not start due to 1 failed checks.
|
||||
! Check attempt 6/6 failed.
|
||||
! Check attempt 6/6 failed.
|
||||
=====> myapp container output:
|
||||
=> Booting Thin
|
||||
=> Rails 4.2.0 application starting in production on http://0.0.0.0:5000
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Components
|
||||
|
||||
* [Docker](https://github.com/dotcloud/docker) - Container runtime and manager
|
||||
* [Buildstep](https://github.com/progrium/buildstep) - Buildpack builder
|
||||
* [pluginhook](https://github.com/progrium/pluginhook) - Shell based plugins and hooks
|
||||
* [Herokuish](https://github.com/gliderlabs/herokuish) - Buildpack builder
|
||||
* [plugn](https://github.com/progrium/plugn) - Shell based plugins and hooks
|
||||
* [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH
|
||||
|
||||
Looking to keep codebase as simple and hackable as possible, so try to keep your line count down.
|
||||
|
||||
91
docs/deployment/ssl-configuration.md
Normal file
91
docs/deployment/ssl-configuration.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# SSL Configuration
|
||||
|
||||
> New as of 0.4.0
|
||||
|
||||
Dokku supports SSL/TLS certificate inspection and CSR/Self-signed certificate generation via the `certs` plugin. Note that whenever SSL/TLS support is enabled SPDY is also enabled.
|
||||
|
||||
```
|
||||
certs:add <app> CRT KEY Add an ssl endpoint to an app. Can also import from a tarball on stdin.
|
||||
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:remove <app> Remove an SSL Endpoint from an app.
|
||||
certs:update <app> CRT KEY Update an SSL Endpoint on an app. Can also import from a tarball on stdin
|
||||
```
|
||||
|
||||
## Per-application certificate management
|
||||
|
||||
Dokku provides built-in support for managing SSL certificates on a per-application basis. SSL is managed via nginx outside of application containers, and as such can be updated on-the-fly without rebuilding containers. At this time, applications only support a single SSL certificate at a time. To support multiple domains for a single application, wildcard certificate usage is encouraged.
|
||||
|
||||
### Certificate setting
|
||||
|
||||
The `certs:add` command can be used to push a `tar` containing a certificate `.crt` and `.key` file to a single application. The command should correctly handle cases where the `.crt` and `.key` are not named properly or are nested in a subdirectory of said `tar` file. You can import it as follows:
|
||||
|
||||
```shell
|
||||
tar cvf cert-key.tar server.crt server.key
|
||||
# replace APP with your app name
|
||||
dokku certs:add < cert-key.tar
|
||||
```
|
||||
|
||||
### Certificate generation
|
||||
|
||||
> Note: Using this method will create a self-signed certificate, which is only recommended for development or staging use, not production environments.
|
||||
|
||||
The `certs:generate` command will walk you through the correct `openssl` commands to create a key, csr and a self-signed cert for a given app/domain. We automatically put the self-signed cert in place as well as add the specified domain to the application configuration.
|
||||
|
||||
If you decide to obtain a CA signed certficate, you can import that certificate using the aformentioned `dokku certs:add` command.
|
||||
|
||||
### Certificate information
|
||||
|
||||
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
|
||||
-----> Fetching SSL Endpoint info for node-js-app...
|
||||
-----> Certificate details:
|
||||
=====> Common Name(s):
|
||||
=====> test.dokku.me
|
||||
=====> Expires At: Aug 24 23:32:59 2016 GMT
|
||||
=====> Issuer: C=US, ST=California, L=San Francisco, O=dokku.me, CN=test.dokku.me
|
||||
=====> Starts At: Aug 25 23:32:59 2015 GMT
|
||||
=====> Subject: C=US; ST=California; L=San Francisco; O=dokku.me; CN=test.dokku.me
|
||||
=====> SSL certificate is self signed.
|
||||
```
|
||||
|
||||
### Certificate removal
|
||||
|
||||
The `certs:remove` command only works on app-specific certificates. It will `rm` the app-specific tls directory, rebuild the nginx configuration, and reload nginx.
|
||||
|
||||
## Global Certification
|
||||
|
||||
Global certificate management is a manual process. To enable TLS connections for all your applications at once you will need a wildcard TLS certificate.
|
||||
|
||||
To enable TLS across all apps, you can run the following commands:
|
||||
|
||||
```shell
|
||||
mkdir -p /home/dokku/tls
|
||||
cp server.crt /home/dokku/tls/server.crt
|
||||
cp server.key /home/dokku/tls/server.key
|
||||
```
|
||||
|
||||
Next, you will want to enable the certificates by editing `/etc/nginx/conf.d/dokku.conf` and uncommenting these two lines (remove the `#`):
|
||||
|
||||
```
|
||||
ssl_certificate /home/dokku/tls/server.crt;
|
||||
ssl_certificate_key /home/dokku/tls/server.key;
|
||||
```
|
||||
|
||||
The settings will take affect at the next deploy. If you would like to propagate the change to all apps immediately, you can also run the following command:
|
||||
|
||||
```shell
|
||||
dokku ps:restartall
|
||||
```
|
||||
|
||||
Once TLS is enabled, the application will be accessible by `https://` (redirection from `http://` is applied as well).
|
||||
|
||||
> Note: TLS will not be enabled unless the application's VHOST matches the certificate's name. (i.e. if you have a cert for `*.example.com` TLS won't be enabled for `something.example.org` or `example.net`)
|
||||
|
||||
## HSTS Header
|
||||
|
||||
The [HSTS header](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) is an HTTP header that can inform browsers that all requests to a given site should be made via HTTPS. dokku does not, by default, enable this header. It is thus left up to you, the user, to enable it for your site.
|
||||
|
||||
Beware that if you enable the header and a subsequent deploy of your application results in an HTTP deploy (for whatever reason), the way the header works means that a browser will not attempt to request the HTTP version of your site if the HTTPS version fails.
|
||||
@@ -3,7 +3,7 @@
|
||||
If you create your own plugin:
|
||||
|
||||
1. Take a look at the plugins shipped with dokku and hack away!
|
||||
2. Check out the [list of hooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) your plugin can implement.
|
||||
2. Check out the [list of triggers](http://progrium.viewdocs.io/dokku/development/plugin-triggers) your plugin can implement.
|
||||
3. Upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
|
||||
4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it.
|
||||
5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
|
||||
@@ -15,13 +15,13 @@ The below plugin is a dummy `dokku hello` plugin. If your plugin exposes command
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
case "$1" in
|
||||
hello)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2";
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP); IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
echo "Hello $APP"
|
||||
;;
|
||||
@@ -31,7 +31,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
hello <app>, Says "Hello <app>"
|
||||
hello:world, Says "Hello world"
|
||||
EOF
|
||||
@@ -44,6 +44,15 @@ EOF
|
||||
esac
|
||||
```
|
||||
|
||||
Each plugin requires a `plugin.toml` descriptor file with the following required fields:
|
||||
|
||||
```shell
|
||||
[plugin]
|
||||
description = "dokku hello plugin"
|
||||
version = "0.1.0"
|
||||
[plugin.config]
|
||||
```
|
||||
|
||||
A few notes:
|
||||
|
||||
- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin.
|
||||
@@ -56,8 +65,7 @@ A few notes:
|
||||
```shell
|
||||
IMAGE=$(docker images | grep "user/repo" | awk '{print $3}')
|
||||
if [[ -z $IMAGE ]]; then
|
||||
echo "user/repo image not found... Did you run 'dokku plugins-install'?"
|
||||
exit 1
|
||||
dokku_log_fail "user/repo image not found... Did you run 'dokku plugin:install'?"
|
||||
fi
|
||||
```
|
||||
|
||||
@@ -77,6 +85,8 @@ A few notes:
|
||||
- As some plugins require access to set app config settings and do not want/require the default Heroku-style behavior of a restart, we have the following "internal" commands that provide this functionality :
|
||||
|
||||
```shell
|
||||
dokku config:set-norestart APP KEY1=VALUE1 [KEY2=VALUE2 ...]
|
||||
dokku config:unset-norestart APP KEY1 [KEY2 ...]
|
||||
dokku config:set --no-restart APP KEY1=VALUE1 [KEY2=VALUE2 ...]
|
||||
dokku config:unset --no-restart APP KEY1 [KEY2 ...]
|
||||
```
|
||||
- From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files.
|
||||
- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](http://progrium.viewdocs.io/dokku/development/plugin-triggers) doc for examples.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# Pluginhooks
|
||||
# Plugin triggers
|
||||
|
||||
[Pluginhooks](https://github.com/progrium/pluginhook) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration.
|
||||
[Plugin triggers](https://github.com/progrium/plugn) (formerly [pluginhooks](https://github.com/progrium/pluginhook)) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration.
|
||||
|
||||
Pluginhooks are simply scripts that are executed by the system. You can use any language you want, so long as the script:
|
||||
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
|
||||
- Has the proper language requirements installed
|
||||
|
||||
For instance, if you wanted to write a pluginhook in PHP, you would need to have `php` installed and available on the CLI prior to pluginhook invocation.
|
||||
For instance, if you wanted to write a plugin trigger in PHP, you would need to have `php` installed and available on the CLI prior to plugin trigger invocation.
|
||||
|
||||
The following is an example for the `nginx-hostname` pluginhook. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin, it would be invoked by dokku during the normal app deployment process:
|
||||
The following is an example for the `nginx-hostname` plugin trigger. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin trigger, it would be invoked by dokku during the normal app deployment process:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
@@ -21,18 +21,18 @@ NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
|
||||
echo "$NEW_SUBDOMAIN.$VHOST"
|
||||
```
|
||||
|
||||
## Available Pluginhooks
|
||||
## Available plugin triggers
|
||||
|
||||
There are a number of plugin-related pluginhooks. These can be optionally implemented by plugins and allow integration into the standard dokku plugin setup/backup/teardown process.
|
||||
There are a number of plugin-related triggers. These can be optionally implemented by plugins and allow integration into the standard dokku setup/backup/teardown process.
|
||||
|
||||
The following pluginhooks describe those available to a dokku installation. As well, there is an example for each pluginhook that you can use as templates for your own plugin development.
|
||||
The following plugin triggers describe those available to a dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugin development.
|
||||
|
||||
> The example pluginhook code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples.
|
||||
> 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`
|
||||
|
||||
- Description: Used to setup any files/configuration for a plugin.
|
||||
- Invoked by: `dokku plugins-install`.
|
||||
- Invoked by: `dokku plugin:install`.
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
@@ -50,8 +50,8 @@ fi
|
||||
|
||||
### `dependencies`
|
||||
|
||||
- Description: Used to install system-level dependencies. Invoked by `plugins-install-dependencies`.
|
||||
- Invoked by: `dokku plugins-install-dependencies`
|
||||
- Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`.
|
||||
- Invoked by: `dokku plugin:install-dependencies`
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
@@ -77,13 +77,13 @@ esac
|
||||
### `update`
|
||||
|
||||
- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates.
|
||||
- Invoked by: `dokku plugins-update`.
|
||||
- Invoked by: `dokku plugin:update`.
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Update the buildstep image from git source
|
||||
# Update the herokuish image from git source
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
@@ -93,7 +93,7 @@ sudo BUILD_STACK=true make install
|
||||
|
||||
### `commands help`
|
||||
|
||||
- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this pluginhook. This must be implemented inside the `commands` pluginhook file.
|
||||
- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this plugin trigger. This must be implemented inside the `commands` plugin file.
|
||||
- Invoked by: `dokku help`
|
||||
- Arguments: None
|
||||
- Example:
|
||||
@@ -106,7 +106,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | derp:help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
derp:herp, Herps the derp
|
||||
derp:serp [file], Shows the file's serp
|
||||
EOF
|
||||
@@ -121,7 +121,7 @@ esac
|
||||
|
||||
### `backup-export`
|
||||
|
||||
- Description: Used to backup files for a given plugin. If your plugin writes files to disk, this pluginhook should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz.
|
||||
- Description: Used to backup files for a given plugin. If your plugin writes files to disk, this plugin trigger should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz.
|
||||
- Invoked by: `dokku backup:export`
|
||||
- Arguments: `$VERSION $DOKKU_ROOT`
|
||||
- Example:
|
||||
@@ -180,9 +180,9 @@ for file in */REDIRECT; do
|
||||
done
|
||||
```
|
||||
|
||||
### `pre-build-buildstep`
|
||||
### `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 buildstep.
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildpacks.
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
@@ -195,9 +195,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-build-buildstep`
|
||||
### `post-build-buildpack`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildstep.
|
||||
- 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`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
@@ -240,11 +240,11 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-release-buildstep`
|
||||
### `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 buildstep.
|
||||
- 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`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -252,8 +252,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# Installs the graphicsmagick package into the container
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
source "$(dirname $0)/../common/functions"
|
||||
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..."
|
||||
|
||||
@@ -266,11 +267,11 @@ test $(docker wait $ID) -eq 0
|
||||
docker commit $ID $IMAGE > /dev/null
|
||||
```
|
||||
|
||||
### `post-release-buildstep`
|
||||
### `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 buildstep.
|
||||
- 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`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -278,8 +279,9 @@ docker commit $ID $IMAGE > /dev/null
|
||||
# Installs a package specified by the `CONTAINER_PACKAGE` env var
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
source "$(dirname $0)/../common/functions"
|
||||
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..."
|
||||
|
||||
@@ -296,13 +298,16 @@ docker commit $ID $IMAGE > /dev/null
|
||||
|
||||
- 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`
|
||||
- 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
|
||||
```
|
||||
@@ -311,13 +316,16 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- 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`
|
||||
- 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
|
||||
```
|
||||
@@ -335,10 +343,11 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# `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}"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
eval "$(config_export app $APP)"
|
||||
DOKKU_DISABLE_DEPLOY="${DOKKU_DISABLE_DEPLOY:-false}"
|
||||
|
||||
if [[ "$DOKKU_DISABLE_DEPLOY" = "true" ]]; then
|
||||
@@ -351,7 +360,7 @@ fi
|
||||
|
||||
- Description: Allows the running of code before the container's process is started.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -359,11 +368,9 @@ fi
|
||||
# Runs gulp in our container
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
APP="$1"
|
||||
IMAGE="dokku/$APP"
|
||||
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 -d $IMAGE /bin/bash -c "cd /app && gulp default")
|
||||
@@ -392,7 +399,7 @@ curl "http://httpstat.us/200"
|
||||
|
||||
- Description: Can be used to run commands before an app is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -400,8 +407,10 @@ curl "http://httpstat.us/200"
|
||||
# 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"; IMAGE="dokku/$APP"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"
|
||||
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 --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
@@ -412,7 +421,7 @@ fi
|
||||
|
||||
- Description: Can be used to run commands after an application is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -446,13 +455,16 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- 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
|
||||
```
|
||||
@@ -461,13 +473,16 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku run`
|
||||
- Arguments: `$APP`
|
||||
- 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
|
||||
```
|
||||
@@ -611,5 +626,57 @@ if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
REFERENCE_REPO="$DOKKU_ROOT/$reference_app
|
||||
git clone --bare --shared --reference "$REFERENCE_REPO" "$REFERENCE_REPO" "$DOKKU_ROOT/$APP" > /dev/null
|
||||
fi
|
||||
pluginhook receive-app $APP $newrev
|
||||
plugn trigger receive-app $APP $newrev
|
||||
```
|
||||
|
||||
### `tags-create`
|
||||
|
||||
- Description: Allows you to run commands once a tag for an application image has been added
|
||||
- Invoked by: `dokku tags:create`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Upload an application image to docker hub
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
|
||||
IMAGE_ID=$(docker inspect --format '{{ .Id }}' $IMAGE)
|
||||
docker tag -f $IMAGE_ID $DOCKER_HUB_USER/$APP:$IMAGE_TAG
|
||||
docker push $DOCKER_HUB_USER/$APP:$IMAGE_TAG
|
||||
```
|
||||
|
||||
### `tags-destroy`
|
||||
|
||||
- Description: Allows you to run commands once a tag for an application image has been removed
|
||||
- Invoked by: `dokku tags:destroy`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Remove an image tag from docker hub
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; IMAGE_TAG="$2"
|
||||
|
||||
some code to remove a docker hub tag because it's not implemented in the CLI....
|
||||
```
|
||||
|
||||
### `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
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; HOSTNAME=$(hostname -s)
|
||||
|
||||
mail -s "$APP containers on $HOSTNAME failed to retire" ops@co.com
|
||||
```
|
||||
@@ -5,6 +5,8 @@ Dokku is released in intervals *at most* three weeks apart, though may be releas
|
||||
To propose a release, the following tasks need to be performed:
|
||||
|
||||
- The installable version must be changed in the `docs/installation.md` 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 `README.md` file.
|
||||
- The installable version must be changed in the `contrib/dokku-installer.rb` file.
|
||||
- A list of changes must be made in the `HISTORY.md`.
|
||||
|
||||
@@ -21,10 +21,10 @@ Enabling dokku events logger
|
||||
Dokku will then write log entries to ``/var/log/syslog`` as well as a Dokku-specific logs sub-directory ``/var/log/dokku/events.log``, which can be easily displayed with the command `dokku events`:
|
||||
|
||||
```
|
||||
Jul 3 16:09:48 dokku.me dokku[127630]: INVOKED: pre-release-buildstep( pythonapp )
|
||||
Jul 3 16:09:48 dokku.me dokku[127630]: INVOKED: pre-release-buildpack( pythonapp )
|
||||
Jul 3 16:10:02 dokku.me dokku[128095]: INVOKED: docker-args-run( rubyapp )
|
||||
Jul 3 16:10:02 dokku.me dokku[128114]: INVOKED: docker-args-run( nhl )
|
||||
Jul 3 16:10:03 dokku.me dokku[128136]: INVOKED: post-release-buildstep( pythonapp )
|
||||
Jul 3 16:10:03 dokku.me dokku[128136]: INVOKED: post-release-buildpack( pythonapp )
|
||||
Jul 3 16:10:03 dokku.me dokku[128195]: INVOKED: pre-deploy( pythonapp )
|
||||
Jul 3 16:10:23 dokku.me dokku[129253]: INVOKED: docker-args-deploy( pythonapp )
|
||||
Jul 3 16:10:24 dokku.me dokku[129337]: INVOKED: bind-external-ip( pythonapp )
|
||||
@@ -47,10 +47,10 @@ docker-args-build
|
||||
pre-delete
|
||||
post-deploy
|
||||
receive-app
|
||||
pre-release-buildstep
|
||||
pre-release-buildpack
|
||||
nginx-pre-reload
|
||||
docker-args-deploy
|
||||
post-build-buildstep
|
||||
post-build-buildpack
|
||||
post-domains-update
|
||||
post-release-dockerfile
|
||||
check-deploy
|
||||
@@ -63,10 +63,10 @@ bind-external-ip
|
||||
pre-deploy
|
||||
post-delete
|
||||
dependencies
|
||||
pre-build-buildstep
|
||||
pre-build-buildpack
|
||||
docker-args-run
|
||||
pre-build-dockerfile
|
||||
post-release-buildstep
|
||||
post-release-buildpack
|
||||
post-build-dockerfile
|
||||
pre-release-dockerfile
|
||||
update
|
||||
|
||||
@@ -3,15 +3,18 @@
|
||||
As of 0.3.18, dokku defaults to being installed via debian package. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script:
|
||||
|
||||
```shell
|
||||
curl -sL https://get.docker.io/gpg 2> /dev/null | sudo apt-key add - 2>&1 >/dev/null
|
||||
curl -sL https://packagecloud.io/gpg.key 2> /dev/null | sudo apt-key add - 2>&1 >/dev/null
|
||||
# install prerequisites
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install -qq -y apt-transport-https curl
|
||||
|
||||
echo "deb https://get.docker.io/ubuntu docker main" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/dokku.list >/dev/null
|
||||
# install docker
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -qq -y linux-image-extra-`uname -r` apt-transport-https
|
||||
sudo apt-get install -qq -y dokku
|
||||
# install dokku
|
||||
curl -sSL https://packagecloud.io/gpg.key | apt-key add -
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/dokku.list
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get install dokku
|
||||
```
|
||||
|
||||
## Unattended installation
|
||||
|
||||
@@ -1,36 +1,39 @@
|
||||
# Installing on Linode
|
||||
|
||||
Due to how Linode installs custom kernels, Linode instances *require* a reboot before they can fully work with Docker/Dokku. The Official Dokku StackScript should take care of this process for you, and will email notify you when the instance is running and you can proceed with installation.
|
||||
When installing Dokku on a Linode server, you'll likely see an error during Docker installation:
|
||||
|
||||
## Using StackScript
|
||||
> Warning: current kernel is not supported by the linux-image-extra-virtual package. We have no AUFS support. Consider installing the packages linux-image-virtual kernel and linux-image-extra-virtual for AUFS support.
|
||||
|
||||
Deploy using the following (experimental) Official StackScript:
|
||||
After 10 seconds, the installation will continue as normal.
|
||||
|
||||
- https://www.linode.com/stackscripts/view/11348
|
||||
This warning is the result of Linode using its own kernel, which does not support AUFS, instead of using the kernel supplied by Ubuntu. If you ignore the warning, Docker will fall back to using the DeviceMapper storage backend and Dokku will work normally. However, AUFS is better tested and will perform better.
|
||||
|
||||
## Without StackScript
|
||||
If you would like to use AUFS, follow the steps below to install Ubuntu's kernel and configure your server to boot it instead of Linode's.
|
||||
|
||||
* Build a Ubuntu 13.04 instance
|
||||
## Preparing your Linode for AUFS
|
||||
|
||||
* Follow these instructions: https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distributionsupplied-kernel-with-pvgrub#ubuntu-1304-raring
|
||||
__Warning__: These steps will delete *everything* on your Linode.
|
||||
|
||||
* If `apt-get update` no longer works:
|
||||
1. Open your server's dashboard in the [Linode Manager](https://manager.linode.com/).
|
||||
|
||||
* Verify if apt-get is trying to use ipv6 instead of ipv4 (e.g. you read something like "[Connecting to us.archive.ubuntu.com (2001:67c:1562::14)]" and apt-get would not proceed). In that case, follow these instructions: http://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method (append "precedence ::ffff:0:0/96 100" to /etc/gai.conf)
|
||||
2. Make sure your Linode is [using KVM](https://www.linode.com/docs/platform/kvm#how-to-enable-kvm), not Xen, for virtualization.
|
||||
|
||||
* OR: change `/etc/apt/sources.list` to one mentioned in http://mirrors.ubuntu.com/mirrors.txt
|
||||
3. In the "Rebuild" tab, select "Ubuntu 14.04 LTS", set a root password, and rebuild.
|
||||
|
||||
* Run the following commands:
|
||||
4. Once your Linode has been created, click "Boot" and wait for it to complete.
|
||||
|
||||
```shell
|
||||
apt-get update
|
||||
5. SSH into your Linode as root and run the following commands:
|
||||
|
||||
apt-get install lxc wget bsdtar linux-image-extra-$(uname -r)
|
||||
apt-get update
|
||||
apt-get -qq upgrade
|
||||
apt-get -qq install linux-image-virtual linux-image-extra-virtual
|
||||
|
||||
modprobe aufs
|
||||
```
|
||||
* After this, you can install dokku the default way:
|
||||
6. When prompted, install Grub onto the first hard drive.
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
```
|
||||
7. Back in your server's dashboard, click "Edit" on its Configuration Profile
|
||||
|
||||
8. Change the "Kernel" option to "GRUB 2" and save your changes.
|
||||
|
||||
9. Lastly, reboot the Linode.
|
||||
|
||||
Once your server comes back online, you'll be running Ubuntu's default kernel. You can now follow Dokku's [normal installation instructions](http://progrium.viewdocs.io/dokku/installation) and `bootstrap.sh` will take care of everything else.
|
||||
|
||||
@@ -18,8 +18,8 @@ If you’re stumped, give us a holler in the Dokku IRC channel. Someone from the
|
||||
|
||||
If [here](http://webchat.freenode.net/?channels=dokku) for a web-based client IRC client.
|
||||
|
||||
## Stackoverflow
|
||||
## Stack Overflow
|
||||
|
||||
http://stackoverflow.com/
|
||||
|
||||
Tag your questions with `dokku` to enable existing users of stackoverflow to find your questions.
|
||||
Tag your questions with `dokku` to enable existing users of Stack Overflow to find your questions.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
.header .heading{color:#fff;font-size:23px;margin:0;padding:0}
|
||||
.blurb{color:#424242;background-color:#ededed;background-image:url(./assets/gplaypattern.png);padding:45px 0;text-align:center}
|
||||
.blurb p{font-size:17px;font-weight:300;margin:18px 0;text-align:center}
|
||||
.quickstart-code{display:block;font-size:12px;line-height:1.3em;margin:45px auto;max-width:650px;padding:0}
|
||||
.quickstart-code{display:block;font-size:12px;line-height:1.3em;margin:45px auto;max-width:750px;padding:0}
|
||||
.quickstart-code .title{background-color:#dfdfdf;background-image:linear-gradient(top,#f7f7f7 0%,#dfdfdf 7%,#ccc 100%);border-bottom:1px solid #111;color:#444;display:block;font-weight:400;font-size:14px;margin:0 20px;padding:3px 0;text-align:center;text-shadow:0 1px 0 rgba(255,255,255,0.5);border-radius:5px 5px 0 0;box-shadow:0 3px 0 rgba(0,0,0,0.5)}
|
||||
.quickstart-code .shell{background-color:#171717;font-family:Menlo,Consolas,"Courier New",Courier,"Liberation Mono",monospace;margin:0 20px;padding:20px;text-shadow:none;border-radius:0 0 5px 5px;box-shadow:0 5px 30px rgba(0,0,0,0.3)}
|
||||
.quickstart-code .line{display:block;margin:0;padding:0}
|
||||
@@ -64,12 +64,12 @@
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">wget https://raw.github.com/progrium/dokku/v0.3.24/bootstrap.sh</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/progrium/dokku/v0.4.2/bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.3.24 bash bootstrap.sh</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.4.2 bash bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="output"># => Go to your server's IP and follow the web installer</span>
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">wget https://raw.github.com/progrium/dokku/v0.3.24/bootstrap.sh</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/progrium/dokku/v0.4.2/bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.3.24 bash bootstrap.sh</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.4.2 bash bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="output"># => Go to your server's IP and follow the web installer</span>
|
||||
|
||||
@@ -14,11 +14,11 @@ To install the latest stable version of dokku, you can run the following bootstr
|
||||
|
||||
```shell
|
||||
# installs dokku via apt-get
|
||||
wget https://raw.github.com/progrium/dokku/v0.3.24/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.3.24 bash bootstrap.sh
|
||||
wget https://raw.githubusercontent.com/progrium/dokku/v0.4.2/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.4.2 bash bootstrap.sh
|
||||
|
||||
# By default, this will do cli-based setup, though you may *also*
|
||||
# go to your server's IP and follow the web installer
|
||||
# By default, this will start the web-based installer on your server's IP
|
||||
# You may *instead* follow the debian packaging notes for a more automated installation
|
||||
```
|
||||
|
||||
For various reasons, certain hosting providers may have other steps that should be preferred to the above. If hosted on any of the following popular hosts, please follow the linked to instructions:
|
||||
|
||||
@@ -2,10 +2,22 @@
|
||||
|
||||
Dokku uses nginx as it's server for routing requests to specific applications. By default, access and error logs are written for each app to `/var/log/nginx/${APP}-access.log` and `/var/log/nginx/${APP}-error.log` respectively
|
||||
|
||||
```
|
||||
nginx:access-logs <app> [-t] Show the nginx access logs for an application (-t follows)
|
||||
nginx:build-config <app> (Re)builds nginx config for given app
|
||||
nginx:disable <app> disable nginx for an application (forces container binding to external interface)
|
||||
nginx:enable <app> enable nginx for an application
|
||||
nginx:error-logs <app> [-t] Show the nginx error logs for an application (-t follows)
|
||||
```
|
||||
|
||||
## TLS/SPDY support
|
||||
|
||||
Dokku provides easy TLS/SPDY support out of the box. This can be done app-by-app or for all subdomains at once. Note that whenever TLS support is enabled SPDY is also enabled.
|
||||
|
||||
### SSL Configuration
|
||||
|
||||
In 0.4.0, SSL Configuration has been replaced by the [`certs` plugin](http://progrium.viewdocs.io/dokku/deployment/ssl-configuration)). For users of dokku 0.3.x, please refer to the following sections.
|
||||
|
||||
### Per App
|
||||
|
||||
To enable TLS connections to to one of your applications, do the following:
|
||||
@@ -49,11 +61,33 @@ You can import ssl certificates via tarball using the following command:
|
||||
dokku nginx:import-ssl myapp < archive-of-certs.tar
|
||||
```
|
||||
|
||||
This archive should is expanded via `tar xvf`. It should contain `server.crt` and `server.key`.
|
||||
This archive is expanded via `tar xvf`. It should contain `server.crt` and `server.key`.
|
||||
|
||||
|
||||
## Running behind a load balancer
|
||||
|
||||
> New as of 0.3.17
|
||||
|
||||
Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarded-For` and `X-Forwarded-Port`. These headers indicate the protocol of the original request (HTTP or HTTPS), the port number, and the IP address of the client making the request, respectively. The default configuration is for Nginx to set these headers.
|
||||
|
||||
If your server runs behind an HTTP/S load balancer, then Nginx will see all requests as coming from the load balancer. If your load balancer sets the `X-Forwarded-` headers, you can tell Nginx to pass these headers from load balancer to your application by setting the `DOKKU_SSL_TERMINATED` environment variable:
|
||||
|
||||
```shell
|
||||
dokku config:set myapp DOKKU_SSL_TERMINATED=1
|
||||
```
|
||||
|
||||
Only use this option if:
|
||||
1. All requests are terminated at the load balancer, and forwarded to Nginx
|
||||
2. The load balancer is configured to send the `X-Forwarded-` headers (this may be off by default)
|
||||
|
||||
If it's possible to make HTTP/S requests directly to Nginx, bypassing the load balancer, or if the load balancer is not configured to set these headers, then it becomes possible for a client to set these headers to arbitrary values.
|
||||
|
||||
This could result in security issue, for example, if your application looks at the value of the `X-Forwarded-Proto` to determine if the request was made over HTTPS.
|
||||
|
||||
|
||||
## Customizing the nginx configuration
|
||||
|
||||
> New as of 0.3.17.
|
||||
> New as of 0.4.0.
|
||||
|
||||
Dokku currently templates out an nginx configuration that is included in the `nginx-vhosts` plugin. If you'd like to provide a custom template for your application, you should copy the existing template - ssl or non-ssl - into your application repository's root directory as the file `nginx.conf.template`. The next time you deploy, Nginx will use your template instead of the default.
|
||||
|
||||
@@ -122,7 +156,7 @@ scheme://subdomain.domain.tld
|
||||
|
||||
The `subdomain` is inferred from the pushed application name, while the `domain` is set during initial configuration in the `$DOKKU_ROOT/VHOST` file.
|
||||
|
||||
You can optionally override this in a plugin by implementing the `nginx-hostname` pluginhook. For example, you can reverse the subdomain with the following sample `nginx-hostname` pluginhook:
|
||||
You can optionally override this in a plugin by implementing the `nginx-hostname` plugin trigger. For example, you can reverse the subdomain with the following sample `nginx-hostname` plugin trigger:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
@@ -140,13 +174,13 @@ You can also use the built-in `domains` plugin to handle:
|
||||
|
||||
### Disabling VHOSTS
|
||||
|
||||
If desired, it is possible to disable vhosts by setting the `NO_VHOST` environment variable:
|
||||
If desired, it is possible to disable vhosts by setting the environment variable `NO_VHOST=1`:
|
||||
|
||||
```shell
|
||||
dokku config:set myapp NO_VHOST=1
|
||||
```
|
||||
|
||||
On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable.
|
||||
On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable. As of 0.4.0, nginx will still be configured to proxy your app on some random high port. This allows internal services to maintain the same port between deployments. You may change this port by setting `DOKKU_NGINX_PORT` and/or `DOKKU_NGINX_SSL_PORT` (for services configured to use SSL.)
|
||||
|
||||
### Domains plugin
|
||||
|
||||
|
||||
140
docs/plugins.md
140
docs/plugins.md
@@ -1,10 +1,11 @@
|
||||
# Plugins
|
||||
|
||||
Dokku itself is built out of plugins and uses [pluginhook](https://github.com/progrium/pluginhook) for its plugin system. In essence a plugin is a collection of scripts that will be run based on naming convention.
|
||||
Dokku itself is built out of plugins and uses [plugn](https://github.com/progrium/plugn) for its plugin system. In essence a plugin is a collection of scripts that will be run based on naming convention.
|
||||
|
||||
Let's take a quick look at the current dokku nginx plugin that's shipped with dokku by default.
|
||||
|
||||
nginx-vhosts/
|
||||
├── plugin.toml # plugin metadata
|
||||
├── commands # contains additional commands
|
||||
├── install # runs on dokku installation
|
||||
└── post-deploy # runs after an app is deployed
|
||||
@@ -12,14 +13,40 @@ Let's take a quick look at the current dokku nginx plugin that's shipped with do
|
||||
## Installing a plugin
|
||||
|
||||
```shell
|
||||
# This command requires `root` permissions as the `install` and `install-dependencies`
|
||||
# plugin triggers may utilize commands such as `apt-get`. For non-core plugins, please
|
||||
# inspect those plugins before running the following command as `root` user.
|
||||
sudo dokku plugin:install <git_url>
|
||||
|
||||
# previous versions (0.3.x and below) of dokku require a manual process to install plugins
|
||||
cd /var/lib/dokku/plugins
|
||||
git clone <git url>
|
||||
dokku plugins-install
|
||||
```
|
||||
|
||||
## Creating your own plugin
|
||||
|
||||
[See the full documentation](http://progrium.viewdocs.io/dokku/development/plugin-creation).
|
||||
|
||||
## Official Plugins (Beta)
|
||||
|
||||
The following plugins are available and provided by dokku maintainers. Where noted, these plugins should be considered beta software and may not have been used as thoroughly as community plugins. Please file issues against their respective issue trackers.
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [CouchDB (beta)](https://github.com/dokku/dokku-couchdb) | [dokku][] | 0.4.0+ |
|
||||
| [Elasticsearch (beta)](https://github.com/dokku/dokku-elasticsearch-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [MariaDB (beta)](https://github.com/dokku/dokku-mariadb-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Memcached (beta)](https://github.com/dokku/dokku-memcached-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Mongo (beta)](https://github.com/dokku/dokku-mongo-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [MySQL (beta)](https://github.com/dokku/dokku-mysql-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Postgres (beta)](https://github.com/dokku/dokku-postgres-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [RabbitMQ (beta)](https://github.com/dokku/dokku-rabbitmq-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Redis (beta)](https://github.com/dokku/dokku-redis-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [RethinkDB (beta)](https://github.com/dokku/dokku-rethinkdb-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Maintenance mode (beta)](https://github.com/dokku/dokku-maintenance) | [dokku][] | 0.4.0+ |
|
||||
| [HTTP Auth (beta)](https://github.com/dokku/dokku-http-auth) | [dokku][] | 0.4.0+ |
|
||||
|
||||
## Community plugins
|
||||
|
||||
Note: The following plugins have been supplied by our community and may not have been tested by dokku maintainers.
|
||||
@@ -82,6 +109,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[Maciej Łebkowski]: https://github.com/mlebkowski
|
||||
[abossard]: https://github.com/dudagroup
|
||||
[alexkruegger]: https://github.com/alexkruegger
|
||||
[dokku]: https://github.com/dokku
|
||||
|
||||
### Datastores
|
||||
|
||||
@@ -89,44 +117,33 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [MariaDB](https://github.com/Kloadut/dokku-md-plugin) | [Kloadut][] | Compatible with 0.2.0 |
|
||||
| [MariaDB (single container)](https://github.com/ohardy/dokku-mariadb) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [MySQL](https://github.com/hughfletcher/dokku-mysql-plugin) | [hughfletcher][] | |
|
||||
| [PostgreSQL](https://github.com/Kloadut/dokku-pg-plugin) | [Kloadut][] | Compatible with 0.2.0 |
|
||||
| [PostgreSQL](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). |
|
||||
| [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [PostgreSQL (single container)](https://github.com/Flink/dokku-psql-single-container) | [Flink][] | Single Postgresql container with official Postgresql docker image. Compatible with 0.3.16 |
|
||||
| [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | |
|
||||
| [MariaDB](https://github.com/Kloadut/dokku-md-plugin) | [Kloadut][] | 0.3.x |
|
||||
| [MariaDB (single container)](https://github.com/ohardy/dokku-mariadb) | [ohardy][] | 0.3.x |
|
||||
| [MariaDB (single container)](https://github.com/krisrang/dokku-mariadb) | [krisrang][] | 0.3.26+ |
|
||||
| [PostgreSQL](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | 0.3.x |
|
||||
| [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | 0.3.x |
|
||||
| [PostgreSQL (single container)](https://github.com/Flink/dokku-psql-single-container) | [Flink][] | 0.3.26+ |
|
||||
|
||||
#### Caching
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Memcached](https://github.com/jlachowski/dokku-memcached-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [Redis](https://github.com/luxifer/dokku-redis-plugin) | [luxifer][] | |
|
||||
| [Redis](https://github.com/sekjun9878/dokku-redis-plugin) | [sekjun9878][] | A better Redis plugin with automatic instance creation and Dokku Link support
|
||||
| [Redis (single container)](https://github.com/ohardy/dokku-redis) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [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|
|
||||
|
||||
#### Queuing
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [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 |
|
||||
|
||||
#### Other
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub][] | Compatible with 0.2.0 |
|
||||
| [Elasticsearch](https://github.com/robv/dokku-elasticsearch) | [robv][] | Not compatible with >= 0.3.0 (still uses /home/git) |
|
||||
| [Elasticsearch](https://github.com/blag/dokku-elasticsearch-plugin)<sup>1</sup> | [blag][] | Compatible with 0.2.0 |
|
||||
| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | |
|
||||
| [Neo4j](https://github.com/Aomitayo/dokku-neo4j-plugin) | [Aomitayo][] | |
|
||||
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 2014-02-22: targeting dokku @ [latest][217d00a]; will fail with Dokku earlier than [28de3ec][]. |
|
||||
| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) |
|
||||
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 0.3.x |
|
||||
|
||||
[dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709
|
||||
|
||||
@@ -136,10 +153,11 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Circus](https://github.com/apmorton/dokku-circus) | [apmorton][] | |
|
||||
| [Forego](https://github.com/iskandar/dokku-forego) | [iskandar][] | Compatible with 0.2.x |
|
||||
| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | Works with dokku @ [c77cbf1][] - no 0.2.0 compatibility |
|
||||
| [Monit](https://github.com/cjblomqvist/dokku-monit) | [cjblomqvist][] | |
|
||||
| [Shoreman ](https://github.com/statianzo/dokku-shoreman) | [statianzo][] | Compatible with 0.2.0 |
|
||||
| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | Compatible with 0.2.0 |
|
||||
| [Forego](https://github.com/Flink/dokku-forego) | [Flink][] | 0.4.0+ |
|
||||
| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | 0.4.0+ |
|
||||
| [Monit](https://github.com/cjblomqvist/dokku-monit) | [cjblomqvist][] | 0.3.x |
|
||||
| [Shoreman ](https://github.com/statianzo/dokku-shoreman) | [statianzo][] | 0.3.x |
|
||||
| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | 0.3.x |
|
||||
|
||||
[c77cbf1]: https://github.com/progrium/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147
|
||||
[28de3ec]: https://github.com/progrium/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40
|
||||
@@ -148,24 +166,22 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh][] | Works with 0.2.0 |
|
||||
| [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][] | |
|
||||
| [git rev-parse HEAD in env](https://github.com/cjblomqvist/dokku-git-rev) | [cjblomqvist][] | Compatible with 0.3.0 |
|
||||
| [Graduate (Environment Management)](https://github.com/glassechidna/dokku-graduate) | [Benjamin-Dobell][] | dokku >= v0.3.14 |
|
||||
| [HTTP Auth](https://github.com/Flink/dokku-http-auth) | [Flink][] | |
|
||||
| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 |
|
||||
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | |
|
||||
| [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | dokku >= [c77cbf1][] |
|
||||
| [Maintenance mode](https://github.com/Flink/dokku-maintenance) | [Flink][] | |
|
||||
| [Dokku Registry](https://github.com/agco-adm/dokku-registry)<sup>1</sup> | [agco-adm][] | 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+ |
|
||||
| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | 0.4.0+ |
|
||||
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | 0.4.0+ |
|
||||
| [Multi-Buildpack](https://github.com/pauldub/dokku-multi-buildpack) | [pauldub][] | |
|
||||
| [Ports](https://github.com/heichblatt/dokku-ports) | [heichblatt][] | |
|
||||
| [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | |
|
||||
| [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)<sup>2</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master |
|
||||
| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)<sup>3</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master |
|
||||
| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [App Configfiles](https://github.com/alexkruegger/dokku-app-configfiles) | [alexkruegger][] | Compatible with 0.3.17+ |
|
||||
| [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 |
|
||||
| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | 0.3.x |
|
||||
|
||||
[217d00a]: https://github.com/progrium/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7
|
||||
|
||||
@@ -179,22 +195,21 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Airbrake deploy](https://github.com/Flink/dokku-airbrake-deploy) | [Flink][] | |
|
||||
| [APT](https://github.com/F4-Group/dokku-apt) | [F4-Group][] | |
|
||||
| [Airbrake deploy](https://github.com/Flink/dokku-airbrake-deploy) | [Flink][] | 0.4.0+ |
|
||||
| [APT](https://github.com/F4-Group/dokku-apt) | [F4-Group][] | 0.2.0+ (tag 0.2.0), 0.3.0+ (tag 0.3.0), 0.4.0+ |
|
||||
| [Chef cookbooks](https://github.com/fgrehm/chef-dokku) | [fgrehm][] | |
|
||||
| [Bower install](https://github.com/alexanderbeletsky/dokku-bower-install) | [alexanderbeletsky][] | |
|
||||
| [Bower/Grunt](https://github.com/thrashr888/dokku-bower-grunt-build-plugin) | [thrashr888][] | |
|
||||
| [Bower/Gulp](https://github.com/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290][] | |
|
||||
| [Bower/Gulp](https://github.com/jagandecapri/dokku-bower-gulp-build-plugin) | [jagandecapri][] | |
|
||||
| [Docker auto volumes](https://github.com/Flink/dokku-docker-auto-volumes) | [Flink][] | 0.3.17+, auto-persist docker volumes |
|
||||
| [Docker auto persist volumes](https://github.com/Flink/dokku-docker-auto-volumes) | [Flink][] | 0.4.0+ |
|
||||
| [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | |
|
||||
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | |
|
||||
| [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | |
|
||||
| [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | 0.3.26+ |
|
||||
| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | |
|
||||
| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | |
|
||||
| [Rails logs](https://github.com/Flink/dokku-rails-logs) | [Flink][] | |
|
||||
| [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][] | |
|
||||
| [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | 0.4.0+ |
|
||||
| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | |
|
||||
| [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | |
|
||||
| [Wordpress](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | Dokku dev, mariadb, volume, domains |
|
||||
@@ -208,22 +223,45 @@ The following plugins have been removed as their functionality is now in Dokku C
|
||||
| Plugin | Author | In Dokku Since |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------- |
|
||||
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | v0.3.10 (domains plugin) |
|
||||
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | v0.3.9 (trace command) |
|
||||
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | v0.3.9 (trace command) |
|
||||
| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | v0.3.17 (docker-options plugin) |
|
||||
| [Events Logger](https://github.com/alessio/dokku-events) | [alessio][] | v0.3.21 (events plugin) |
|
||||
| [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | v0.3.17 (docker-options plugin) |
|
||||
| [List Containers](https://github.com/heichblatt/dokku-list) | [heichblatt][] | v0.3.14 (ps plugin |
|
||||
| [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | v0.3.17 (docker-options plugin) |
|
||||
| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>1</sup> | [wmluke][] | v0.3.10 (domains plugin) |
|
||||
| [Named-containers](https://github.com/Flink/dokku-named-containers) | [Flink][] | v0.4.2 (named-containers plugin) |
|
||||
| [Nginx-Alt](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | v0.3.10 (domains plugin) |
|
||||
| [Persistent Storage](https://github.com/dyson/dokku-persistent-storage) | [dyson][] | v0.3.17 (docker-options plugin) |
|
||||
| [PrimeCache](https://github.com/darkpixel/dokku-prime-cache) | [darkpixel][] | v0.3.0 (zero downtime deploys) |
|
||||
| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) |
|
||||
| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) |
|
||||
| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)<sup>2</sup> | [cameron-martin][] | v0.3.9 (build-env plugin) |
|
||||
| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>2</sup> | [musicglue][] | v0.3.9 (build-env plugin) |
|
||||
| [user-env-compile](https://github.com/motin/dokku-user-env-compile)<sup>2</sup> | [motin][] | v0.3.9 (build-env plugin) |
|
||||
| [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) | [motin][] | v0.3.10 (domains plugin) |
|
||||
|
||||
|
||||
<sup>1</sup> Conflicts with [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration)
|
||||
<sup>2</sup> Similar to the heroku-labs feature (see https://devcenter.heroku.com/articles/labs-user-env-compile)
|
||||
|
||||
[a043e98]: https://github.com/stuartpb/dokku-bind-port/commit/a043e9892f4815b6525c850131e09fd64db5c1fa
|
||||
|
||||
|
||||
### Unmaintained Plugins
|
||||
|
||||
The following plugins are no longer maintained by their developers.
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh][] | Works with 0.2.0 |
|
||||
| [CouchDB (multi containers)](https://github.com/Flink/dokku-couchdb-multi-containers) | [Flink][] | 0.4.0+ |
|
||||
| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub][] | Compatible with 0.2.0 |
|
||||
| [Elasticsearch](https://github.com/robv/dokku-elasticsearch) | [robv][] | Not compatible with >= 0.3.0 (still uses /home/git) |
|
||||
| [Elasticsearch](https://github.com/blag/dokku-elasticsearch-plugin)<sup>1</sup> | [blag][] | Compatible with 0.2.0 |
|
||||
| [Memcached](https://github.com/Flink/dokku-memcached-plugin) | [Flink][] | 0.4.0+ |
|
||||
| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | |
|
||||
| [MySQL](https://github.com/hughfletcher/dokku-mysql-plugin) | [hughfletcher][] | |
|
||||
| [Neo4j](https://github.com/Aomitayo/dokku-neo4j-plugin) | [Aomitayo][] | |
|
||||
| [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | |
|
||||
| [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). |
|
||||
| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) |
|
||||
| [Redis](https://github.com/luxifer/dokku-redis-plugin) | [luxifer][] | |
|
||||
|
||||
@@ -13,26 +13,28 @@ ps:start <app> Start app container(s)
|
||||
ps:stop <app> Stop app container(s)
|
||||
```
|
||||
|
||||
*NOTE*: As of v0.3.14, `dokku deploy:all` in now deprecated by `ps:restartall` and will be removed in a future version.
|
||||
|
||||
|
||||
## Scaling
|
||||
|
||||
Dokku allows you to run multiple process types at different container counts. For example, if you had an app that contained 1 web app listener and 1 background job processor, dokku can, spin up 1 container for each process type defined in the Procfile. By default we will only start the web process. However, if you wanted 2 job processors running simultaneously, you can modify this behavior in a few ways.
|
||||
Dokku allows you to run multiple process types at different container counts. For example, if you had an app that contained 1 web app listener and 1 background job processor, dokku can, spin up 1 container for each process type defined in the Procfile. *By default, dokku will only start a single web process (if defined.)* However, if you wanted, for example, 2 job processors running simultaneously, you can modify this behavior in one of the following ways.
|
||||
|
||||
## Include a DOKKU_SCALE file in your repo
|
||||
### DOKKU_SCALE file
|
||||
|
||||
Dokku expects this file to contain one line for every process defined in your Procfile. Example:
|
||||
You can optionally create a `DOKKU_SCALE` file in the root of your repository. Dokku expects this file to contain one line for every process defined in your Procfile.
|
||||
|
||||
Example:
|
||||
```
|
||||
web=1
|
||||
worker=2
|
||||
```
|
||||
|
||||
### `ps:scale` command
|
||||
|
||||
Dokku can also manage scaling itself via the `ps:scale` command. This command can be used to scale multiple process types at the same time.
|
||||
|
||||
## Use the ps:scale command. Example:
|
||||
```
|
||||
dokku ps:scale app_name web=1 worker=2
|
||||
```
|
||||
|
||||
*NOTE*: Dokku will always use the DOKKU_SCALE file that ships with the repo to override any local settings.
|
||||
|
||||
|
||||
|
||||
@@ -7,49 +7,32 @@
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
|
||||
<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 href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style type="text/css">
|
||||
body{padding-bottom:40px;color:#5a5a5a}
|
||||
h1{color:#5a5a5a;font-family:'montserrat',Optima,Segoe,"Segoe UI",Candara,Calibri,Arial,sans-serif;font-weight:700;line-height:1.1;margin-bottom:12px;margin-top:12px;text-rendering:optimizelegibility}
|
||||
.header{background-color:#2a8fbd;padding:22px 0}
|
||||
.header .heading{color:#fff;font-size:23px;margin:0;padding:0}
|
||||
.blurb{color:#424242;background-color:#ededed;background-image:url(gplaypattern.png);padding:45px 0;text-align:center}
|
||||
.blurb p{font-size:17px;font-weight:300;margin:18px 0;text-align:center}
|
||||
.quickstart-code{display:block;font-size:12px;line-height:1.3em;margin:45px auto;max-width:650px;padding:0}
|
||||
.quickstart-code .title{background-color:#dfdfdf;background-image:linear-gradient(top,#f7f7f7 0%,#dfdfdf 7%,#ccc 100%);border-bottom:1px solid #111;color:#444;display:block;font-weight:400;font-size:14px;margin:0 20px;padding:3px 0;text-align:center;text-shadow:0 1px 0 rgba(255,255,255,0.5);border-radius:5px 5px 0 0;box-shadow:0 3px 0 rgba(0,0,0,0.5)}
|
||||
.quickstart-code .shell{background-color:#171717;font-family:Menlo,Consolas,"Courier New",Courier,"Liberation Mono",monospace;margin:0 20px;padding:20px;text-shadow:none;border-radius:0 0 5px 5px;box-shadow:0 5px 30px rgba(0,0,0,0.3)}
|
||||
.quickstart-code .line{display:block;margin:0;padding:0}
|
||||
.quickstart-code .line span{display:inline-block}
|
||||
.quickstart-code .path{color:#2a8fbd;user-select:none}
|
||||
.quickstart-code .prompt{color:#f90;user-select:none}
|
||||
.quickstart-code .command{color:#ffc}
|
||||
.marketing .col-lg-4{margin-bottom:20px;text-align:center}
|
||||
.marketing .col-lg-4 p{margin-right:10px;margin-left:10px}
|
||||
.featurette-divider{margin:20px 0}
|
||||
.featurette-heading{font-weight:400;line-height:1;letter-spacing:-1px}
|
||||
.featurette-heading .text-muted{font-weight:300}
|
||||
@media (min-width: 768px) {
|
||||
.quickstart-code{font-size:14px;line-height:22px}
|
||||
.featurette-heading{font-size:50px}
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.featurette-heading{margin-top:120px}
|
||||
}
|
||||
</style>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.rawgit.com/progrium/dokku/0.4.2/docs/assets/style.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="container">
|
||||
<h1 class="heading">Dokku</h1>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-2">
|
||||
<h1 class="heading navbar-brand">
|
||||
<a href="http://progrium.viewdocs.io/dokku/">Dokku</a>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-md-2" style="padding-top:16px">
|
||||
<div class="col-xs-8 col-md-6 col-md-push-4 markdown-body" style="padding-top:16px">
|
||||
{{CONTENT}}
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-2 col-md-pull-6 col-md-offset-2" style="padding-top:16px">
|
||||
<div class="list-group">
|
||||
<a href="#" class="list-group-item disabled">Getting Started</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/installation" class="list-group-item">Installation</a>
|
||||
@@ -59,13 +42,14 @@
|
||||
|
||||
<a href="#" class="list-group-item disabled">Deployment</a>
|
||||
|
||||
<a href="http://progrium.viewdocs.io/dokku/application-deployment" class="list-group-item">Application Deployment</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/configuration-management" class="list-group-item">Configuration management</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/process-management" class="list-group-item">Process management</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/application-deployment" class="list-group-item">Deploying an Application</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/configuration-management" class="list-group-item">Environment Variables</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/process-management" class="list-group-item">Scaling Processes</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/dns" class="list-group-item">DNS Configuration</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/nginx" class="list-group-item">Nginx Configuration</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/remote-commands" class="list-group-item">Running Remote commands</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/docker-options" class="list-group-item">Container Options</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/deployment/ssl-configuration" class="list-group-item">SSL Configuration</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/remote-commands" class="list-group-item">Remote commands</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/docker-options" class="list-group-item">Docker Container Options</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/dokku-events-logs" class="list-group-item">Dokku Event Logs</a>
|
||||
|
||||
<a href="#" class="list-group-item disabled">Community Contributions</a>
|
||||
@@ -76,25 +60,20 @@
|
||||
<a href="#" class="list-group-item disabled">Development</a>
|
||||
|
||||
<a href="http://progrium.viewdocs.io/dokku/development/plugin-creation" class="list-group-item">Plugin Creation</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/development/pluginhooks" class="list-group-item">Pluginhooks</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/development/testing" class="list-group-item">Test Suite</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/development/plugin-triggers" class="list-group-item">Plugin Triggers</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/development/testing" class="list-group-item">Running Tests</a>
|
||||
<a href="http://progrium.viewdocs.io/dokku/development/release-process" class="list-group-item">Release Process</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-8 col-md-10">
|
||||
{{CONTENT}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<footer>
|
||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||
<p>© 2013 Dokku</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/1.3.0/anchor.js"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function (e) {
|
||||
anchors.options.visible = 'always';
|
||||
anchors.add('.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4');
|
||||
|
||||
var elements = document.querySelectorAll('table'),
|
||||
classNames = ['table', 'table-striped', 'table-hover', 'table-condensed'],
|
||||
addClass = function (el, className) {
|
||||
|
||||
@@ -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/buildstep# /etc/init.d/nginx stop
|
||||
root@dockerapps:~/dokku# /etc/init.d/nginx stop
|
||||
* Stopping nginx nginx [ OK ]
|
||||
root@dockerapps:~/dokku/buildstep# /etc/init.d/nginx start
|
||||
root@dockerapps:~/dokku# /etc/init.d/nginx start
|
||||
* Starting nginx nginx [ OK ]
|
||||
```
|
||||
|
||||
@@ -65,8 +65,8 @@ __Solution (Less solution, more helpful troubleshooting steps):__
|
||||
Find the failed phase's container image (*077581956a92* in this example)
|
||||
|
||||
```
|
||||
root@dokku:~# docker ps -a | grep builder
|
||||
94d9515e6d93 077581956a92 "/build/builder" 29 minutes ago Exited (0) 25 minutes ago cocky_bell
|
||||
root@dokku:~# 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)
|
||||
@@ -109,26 +109,6 @@ Also see [issue #116](https://github.com/progrium/dokku/issues/116)
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I want to deploy my nodejs app on dokku and use a postinstall script within the package.json but I keep getting this error:
|
||||
|
||||
npm WARN cannot run in wd app@1.0.0 echo blah (wd=/build/app)
|
||||
|
||||
__Solution:__
|
||||
|
||||
This is a permissions problem as dokku (buildstep) uses a root account for running the application. (This may change please see this thread: https://github.com/progrium/buildstep/pull/42).
|
||||
|
||||
To allow npm to work as root account one must set the configuration option of ```unsafe-perm``` to true. There are many ways to set this configuration option but the one I've found works most consistently with the heroku-nodejs-buildpack is as a .npmrc file. The file should contain
|
||||
|
||||
```
|
||||
unsafe-perm = true
|
||||
```
|
||||
|
||||
Note that this is NOT required on heroku as heroku does not use a root account for running the application.
|
||||
|
||||
Please see https://github.com/progrium/dokku/issues/420 and https://github.com/heroku/heroku-buildpack-nodejs/issues/92.
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I successfully deployed my application with no deployment errors and receiving Bad Gateway when attempting to access the application
|
||||
|
||||
__Solution:__
|
||||
|
||||
@@ -37,26 +37,26 @@ All changes will take effect upon next application deployment. To trigger a rebu
|
||||
dokku ps:rebuildall
|
||||
```
|
||||
|
||||
## Buildstep image
|
||||
## Herokuish image
|
||||
|
||||
If dokku was installed via a debian package, you can upgrade buildstep via the following command:
|
||||
If dokku was installed via a debian package, you can upgrade herokuish via the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install buildstep
|
||||
sudo apt-get install herokuish
|
||||
```
|
||||
|
||||
For unattended upgrades, you may run the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install -qq -y buildstep
|
||||
sudo apt-get install -qq -y herokuish
|
||||
```
|
||||
|
||||
In some cases, it may be desirable to run a specific version of buildstep. To install/upgrade buildstep from source, run the following commands:
|
||||
In some cases, it may be desirable to run a specific version of herokuish. To install/upgrade herokuish from source, run the following commands:
|
||||
|
||||
```shell
|
||||
cd /tmp
|
||||
git clone https://github.com/progrium/buildstep.git
|
||||
cd buildstep
|
||||
git clone https://github.com/gliderlabs/herokuish.git
|
||||
cd herokuish
|
||||
git pull origin master
|
||||
sudo make build
|
||||
IMAGE_NAME=gliderlabs/herokuish BUILD_TAG=latest VERSION=master make -e build-in-docker
|
||||
```
|
||||
|
||||
129
dokku
129
dokku
@@ -3,17 +3,25 @@ set -eo pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
|
||||
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
|
||||
export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"}
|
||||
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
|
||||
export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"}
|
||||
|
||||
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
||||
export PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"}
|
||||
export PLUGIN_AVAILABLE_PATH=${PLUGIN_AVAILABLE_PATH:="$PLUGIN_PATH/available"}
|
||||
export PLUGIN_ENABLED_PATH=${PLUGIN_ENABLED_PATH:="$PLUGIN_PATH/enabled"}
|
||||
export PLUGIN_CORE_PATH=${PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins"}
|
||||
export PLUGIN_CORE_AVAILABLE_PATH=${PLUGIN_CORE_AVAILABLE_PATH:="$PLUGIN_CORE_PATH/available"}
|
||||
export PLUGIN_CORE_ENABLED_PATH=${PLUGIN_CORE_ENABLED_PATH:="$PLUGIN_CORE_PATH/enabled"}
|
||||
|
||||
export DOKKU_API_VERSION=1
|
||||
export DOKKU_NOT_IMPLEMENTED_EXIT=10
|
||||
export DOKKU_VALID_EXIT=0
|
||||
|
||||
export DOKKU_LOGS_DIR=${DOKKU_LOGS_DIR:="/var/log/dokku"}
|
||||
export DOKKU_EVENTS_LOGFILE=${DOKKU_EVENTS_LOGFILE:="$DOKKU_LOGS_DIR/events.log"}
|
||||
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done
|
||||
@@ -24,7 +32,7 @@ parse_args "$@"
|
||||
args=("$@")
|
||||
if [[ "${args[0]}" =~ ^--.* ]]; then
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" =~ ^--.* ]];then
|
||||
if [[ "$arg" =~ ^--.* ]]; then
|
||||
shift 1
|
||||
else
|
||||
break
|
||||
@@ -33,14 +41,14 @@ if [[ "${args[0]}" =~ ^--.* ]]; then
|
||||
fi
|
||||
! has_tty && DOKKU_QUIET_OUTPUT=1
|
||||
|
||||
if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then
|
||||
if [[ $(id -un) != "dokku" && $1 != plugin:*install* && $1 != "plugin:update" && $1 != nginx:*-logs ]]; then
|
||||
sudo -u dokku -E -H $0 "$@"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
|
||||
export -n SSH_ORIGINAL_COMMAND
|
||||
if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]];then
|
||||
if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]]; then
|
||||
xargs $0 <<<$SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
else
|
||||
@@ -51,59 +59,66 @@ fi
|
||||
|
||||
case "$1" in
|
||||
receive)
|
||||
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
|
||||
APP="$2"; IMAGE=$(get_app_image_name $APP); IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
|
||||
dokku_log_info1 "Cleaning up..."
|
||||
dokku cleanup
|
||||
docker_cleanup
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
||||
dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||
dokku_log_info1 "Releasing $APP..."
|
||||
dokku release "$APP" "$IMAGE_SOURCE_TYPE"
|
||||
dokku_log_info1 "Deploying $APP..."
|
||||
dokku deploy "$APP"
|
||||
dokku_log_info2 "Application deployed:"
|
||||
dokku urls "$APP" | sed "s/^/ /"
|
||||
echo
|
||||
release_and_deploy "$APP"
|
||||
;;
|
||||
|
||||
deploy)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy"
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
APP="$2"; IMAGE_TAG="$3"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
plugn trigger pre-deploy $APP $IMAGE_TAG
|
||||
|
||||
pluginhook pre-deploy $APP
|
||||
|
||||
is_image_buildstep_based "$IMAGE" && DOKKU_BUILDSTEP=true
|
||||
is_image_herokuish_based "$IMAGE" && DOKKU_HEROKUISH=true
|
||||
DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
oldids=$(get_app_container_ids $APP)
|
||||
|
||||
while read line || [ -n "$line" ]
|
||||
do
|
||||
PROC_TYPE=${line%%=*}
|
||||
PROC_COUNT=${line#*=}
|
||||
DOKKU_RESTART_LIMIT=$(dokku config:get $APP DOKKU_RESTART_LIMIT || echo 10)
|
||||
DOKKU_RESTART_LIMIT=${DOKKU_RESTART_LIMIT:=10}
|
||||
|
||||
DOKKU_APP_SKIP_ALL_CHECKS=$(dokku config:get $APP DOKKU_SKIP_ALL_CHECKS || true)
|
||||
DOKKU_APP_SKIP_DEFAULT_CHECKS=$(dokku config:get $APP DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
DOKKU_GLOBAL_SKIP_ALL_CHECKS=$(dokku config:get --global DOKKU_SKIP_ALL_CHECKS || true)
|
||||
DOKKU_GLOBAL_SKIP_DEFAULT_CHECKS=$(dokku config:get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
|
||||
DOKKU_SKIP_ALL_CHECKS=${DOKKU_APP_SKIP_ALL_CHECKS:="$DOKKU_GLOBAL_SKIP_ALL_CHECKS"}
|
||||
DOKKU_SKIP_DEFAULT_CHECKS=${DOKKU_APP_SKIP_DEFAULT_CHECKS:="$DOKKU_GLOBAL_SKIP_DEFAULT_CHECKS"}
|
||||
|
||||
DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy $APP $IMAGE_TAG)
|
||||
|
||||
while read line || [[ -n "$line" ]]; do
|
||||
TRIM=${line%#*}
|
||||
PROC_TYPE=${TRIM%%=*}
|
||||
PROC_COUNT=${TRIM#*=}
|
||||
CONTAINER_INDEX=1
|
||||
|
||||
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]];do
|
||||
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
|
||||
id=""; port=""; ipaddr=""
|
||||
DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
|
||||
|
||||
# start the app
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy)
|
||||
DOCKER_ARGS+=" -e DYNO=$PROC_TYPE "
|
||||
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP)
|
||||
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
|
||||
DOCKER_ARGS="$DOKKU_DEFAULT_DOCKER_ARGS"
|
||||
DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' "
|
||||
DOCKER_ARGS+=" --restart=on-failure:$DOKKU_RESTART_LIMIT"
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||
BIND_EXTERNAL=$(plugn trigger bind-external-ip $APP)
|
||||
|
||||
[[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start $PROC_TYPE"
|
||||
[[ -n "$DOKKU_HEROKUISH" ]] && START_CMD="/start $PROC_TYPE"
|
||||
|
||||
if [[ -z "$DOKKU_BUILDSTEP" ]];then
|
||||
if [[ -z "$DOKKU_HEROKUISH" ]]; then
|
||||
DOKKU_DOCKERFILE_PORT=$(dokku config:get $APP DOKKU_DOCKERFILE_PORT || true)
|
||||
START_CMD=$(dokku config:get $APP DOKKU_DOCKERFILE_START_CMD || $START_CMD)
|
||||
fi
|
||||
|
||||
if [[ "$PROC_TYPE" == "web" ]]; then
|
||||
port=${DOKKU_DOCKERFILE_PORT:=5000}
|
||||
if [[ "$BIND_EXTERNAL" = "true" ]];then
|
||||
if [[ "$BIND_EXTERNAL" = "true" ]]; then
|
||||
id=$(docker run -d -p $port -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
port=$(docker port $id $port | sed 's/[0-9.]*://')
|
||||
ipaddr=127.0.0.1
|
||||
@@ -122,21 +137,13 @@ case "$1" in
|
||||
kill -9 $$
|
||||
}
|
||||
|
||||
DOKKU_APP_SKIP_ALL_CHECKS=$(dokku config:get $APP DOKKU_SKIP_ALL_CHECKS || true)
|
||||
DOKKU_APP_SKIP_DEFAULT_CHECKS=$(dokku config:get $APP DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
DOKKU_GLOBAL_SKIP_ALL_CHECKS=$(dokku config:get --global DOKKU_SKIP_ALL_CHECKS || true)
|
||||
DOKKU_GLOBAL_SKIP_DEFAULT_CHECKS=$(dokku config:get --global DOKKU_SKIP_DEFAULT_CHECKS || true)
|
||||
|
||||
DOKKU_SKIP_ALL_CHECKS=${DOKKU_APP_SKIP_ALL_CHECKS:="$DOKKU_GLOBAL_SKIP_ALL_CHECKS"}
|
||||
DOKKU_SKIP_DEFAULT_CHECKS=${DOKKU_APP_SKIP_DEFAULT_CHECKS:="$DOKKU_GLOBAL_SKIP_DEFAULT_CHECKS"}
|
||||
|
||||
# run checks first, then post-deploy hooks, which switches Nginx traffic
|
||||
if [[ "$DOKKU_SKIP_ALL_CHECKS" = "true" ]]; then
|
||||
dokku_log_info1 "Skipping pre-flight checks"
|
||||
else
|
||||
trap kill_new INT TERM EXIT
|
||||
dokku_log_info1 "Running pre-flight checks"
|
||||
pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr
|
||||
plugn trigger check-deploy $APP $id $PROC_TYPE $port $ipaddr
|
||||
trap - INT TERM EXIT
|
||||
fi
|
||||
|
||||
@@ -164,12 +171,12 @@ case "$1" in
|
||||
done < "$DOKKU_SCALE_FILE"
|
||||
|
||||
dokku_log_info1 "Running post-deploy"
|
||||
pluginhook post-deploy $APP $port $ipaddr
|
||||
plugn trigger post-deploy $APP $port $ipaddr
|
||||
|
||||
# kill the old container
|
||||
if [[ -n "$oldids" ]]; then
|
||||
|
||||
if [[ -z "$DOKKU_WAIT_TO_RETIRE" ]];then
|
||||
if [[ -z "$DOKKU_WAIT_TO_RETIRE" ]]; then
|
||||
DOKKU_APP_DOKKU_WAIT_TO_RETIRE=$(dokku config:get $APP DOKKU_WAIT_TO_RETIRE || true)
|
||||
DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE=$(dokku config:get --global DOKKU_WAIT_TO_RETIRE || true)
|
||||
DOKKU_WAIT_TO_RETIRE=${DOKKU_APP_DOKKU_WAIT_TO_RETIRE:="$DOKKU_GLOBAL_DOKKU_WAIT_TO_RETIRE"}
|
||||
@@ -186,8 +193,12 @@ case "$1" in
|
||||
trap '' INT HUP
|
||||
sleep $WAIT
|
||||
for oldid in $oldids; do
|
||||
docker stop $oldid &> /dev/null
|
||||
docker kill $oldid &> /dev/null # force a kill as docker seems to not send SIGKILL as the docs would indicate
|
||||
# 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
|
||||
@@ -197,28 +208,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
cleanup)
|
||||
# delete all non-running container
|
||||
# shellcheck disable=SC2046
|
||||
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true
|
||||
# delete unused images
|
||||
# shellcheck disable=SC2046
|
||||
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
|
||||
;;
|
||||
|
||||
plugins)
|
||||
ls -1 -d $PLUGIN_PATH/*/
|
||||
;;
|
||||
|
||||
plugins-install)
|
||||
pluginhook install
|
||||
;;
|
||||
|
||||
plugins-install-dependencies)
|
||||
pluginhook dependencies
|
||||
;;
|
||||
|
||||
plugins-update)
|
||||
pluginhook update
|
||||
docker_cleanup
|
||||
;;
|
||||
|
||||
# DEPRECATED as of v0.3.14
|
||||
@@ -232,17 +222,14 @@ case "$1" in
|
||||
echo ""
|
||||
echo "Options:"
|
||||
|
||||
cat<<EOF | pluginhook commands help | sort | column -c2 -t -s,
|
||||
cat<<EOF | plugn trigger commands help | sort | column -c2 -t -s,
|
||||
help, Print the list of commands
|
||||
plugins, Print active plugins
|
||||
plugins-install, Install active plugins
|
||||
plugins-update, Update active plugins
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
implemented=0
|
||||
for script in $PLUGIN_PATH/*/commands; do
|
||||
for script in $PLUGIN_ENABLED_PATH/*/commands; do
|
||||
set +e; $script "$@" ; exit_code=$? ; set -e
|
||||
if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then
|
||||
continue
|
||||
|
||||
@@ -1,51 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " build release trace delete ls run url urls version help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
case "$1" in
|
||||
build)
|
||||
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
|
||||
APP="$2"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"; IMAGE=$(get_app_image_name $APP)
|
||||
verify_app_name "$APP"
|
||||
|
||||
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source "$DOKKU_ROOT/$APP/ENV"
|
||||
eval "$(config_export app $APP)"
|
||||
pushd "$TMP_WORK_DIR" &> /dev/null
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
buildstep)
|
||||
herokuish)
|
||||
id=$(tar -c . | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook pre-build` will be removed in future releases
|
||||
pluginhook pre-build "$APP"
|
||||
pluginhook pre-build-buildstep "$APP"
|
||||
plugn trigger pre-build-buildpack "$APP"
|
||||
|
||||
# *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases
|
||||
# https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP build)
|
||||
DOCKER_ARGS+=$(: | pluginhook docker-args-build $APP)
|
||||
id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build/builder)
|
||||
DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP)
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||
id=$(docker run -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
|
||||
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook post-build` will be removed in future releases
|
||||
pluginhook post-build "$APP"
|
||||
pluginhook post-build-buildstep "$APP"
|
||||
plugn trigger post-build-buildpack "$APP"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# extract first port from Dockerfile
|
||||
DOCKERFILE_PORT=$(get_dockerfile_exposed_port Dockerfile)
|
||||
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
|
||||
|
||||
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
pluginhook pre-build-dockerfile "$APP"
|
||||
[[ -n "$DOCKERFILE_PORT" ]] && config_set --no-restart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
|
||||
plugn trigger pre-build-dockerfile "$APP"
|
||||
|
||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||
docker build $DOKKU_DOCKER_BUILD_OPTS -t "$IMAGE" .
|
||||
|
||||
pluginhook post-build-dockerfile "$APP"
|
||||
plugn trigger post-build-dockerfile "$APP"
|
||||
;;
|
||||
|
||||
*)
|
||||
@@ -55,31 +52,29 @@ case "$1" in
|
||||
;;
|
||||
|
||||
release)
|
||||
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"
|
||||
APP="$2"; IMAGE_SOURCE_TYPE="$3"; IMAGE_TAG="$4"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
buildstep)
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook pre-release` will be removed in future releases
|
||||
pluginhook pre-release "$APP"
|
||||
pluginhook pre-release-buildstep "$APP"
|
||||
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
|
||||
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV")
|
||||
herokuish)
|
||||
plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
if [[ -n $(config_export global) ]]; then
|
||||
id=$(config_export global | docker run -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 [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
||||
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh" < "$DOKKU_ROOT/$APP/ENV")
|
||||
if [[ -n $(config_export app $APP) ]]; then
|
||||
id=$(config_export app $APP | docker run -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
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook post-release` will be removed in future releases
|
||||
pluginhook post-release "$APP"
|
||||
pluginhook post-release-buildstep "$APP"
|
||||
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
pluginhook pre-release-dockerfile "$APP"
|
||||
pluginhook post-release-dockerfile "$APP"
|
||||
# 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"
|
||||
;;
|
||||
|
||||
*)
|
||||
@@ -91,8 +86,7 @@ case "$1" in
|
||||
trace)
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p $DOKKU_ROOT/.dokkurc
|
||||
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
|
||||
echo "Valid trace options are [on/off]"
|
||||
exit 1
|
||||
dokku_log_fail "Valid trace options are [on/off]"
|
||||
}
|
||||
|
||||
if [[ "$2" == "on" ]]; then
|
||||
@@ -111,7 +105,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
ls)
|
||||
dokku_apps=$(ls -d $DOKKU_ROOT/*/ 2>/dev/null) || (echo "You haven't deployed any applications yet" && exit 1)
|
||||
dokku_apps=$(ls -d $DOKKU_ROOT/*/ 2>/dev/null) || (dokku_log_fail "You haven't deployed any applications yet")
|
||||
|
||||
dokku_col_log_info1_quiet "App Name" "Container Type" "Container Id" "Status"
|
||||
|
||||
@@ -132,55 +126,26 @@ case "$1" in
|
||||
done
|
||||
;;
|
||||
|
||||
logs)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2";
|
||||
|
||||
if (is_deployed $APP); then
|
||||
CONTAINER_IDS=( $(get_app_container_ids $APP) )
|
||||
LAST_CONTAINER_ID=${CONTAINER_IDS[${#CONTAINER_IDS[@]} - 1]}
|
||||
|
||||
if [[ $3 == "-t" ]]; then
|
||||
DOKKU_LOGS_ARGS="--follow"
|
||||
else
|
||||
DOKKU_LOGS_ARGS="--tail 100"
|
||||
fi
|
||||
for CID in "${CONTAINER_IDS[@]}";do
|
||||
if [[ "$CID" != "$LAST_CONTAINER_ID" ]];then
|
||||
DOKKU_LOGS_CMD+="docker logs $DOKKU_LOGS_ARGS $CID& "
|
||||
else
|
||||
DOKKU_LOGS_CMD+="docker logs $DOKKU_LOGS_ARGS $CID; "
|
||||
fi
|
||||
done
|
||||
bash -c "($DOKKU_LOGS_CMD)"
|
||||
else
|
||||
echo "Application's container not found"
|
||||
fi
|
||||
;;
|
||||
|
||||
run)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP); IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
shift 2
|
||||
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP run)
|
||||
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP)
|
||||
DOCKER_ARGS=$(: | plugn trigger docker-args-run $APP $IMAGE_TAG)
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
|
||||
has_tty && DOKKU_RUN_OPTS+=" -i -t"
|
||||
is_image_buildstep_based "$IMAGE" && EXEC_CMD="/exec"
|
||||
is_image_herokuish_based "$IMAGE" && EXEC_CMD="/exec"
|
||||
|
||||
docker run $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
|
||||
;;
|
||||
|
||||
url | urls)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2";
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source "$DOKKU_ROOT/$APP/ENV"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; verify_app_name "$2"
|
||||
eval "$(config_export app $APP)"
|
||||
|
||||
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then
|
||||
case "$1" in
|
||||
@@ -200,26 +165,32 @@ case "$1" in
|
||||
SCHEME="https"
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]] && [[ "$NO_VHOST" != "1" ]]; then
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
|
||||
else
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "false" ]]; then
|
||||
for PORT_FILE in $DOKKU_ROOT/$APP/PORT.*; do
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$PORT_FILE")"
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$PORT_FILE") (container)"
|
||||
done
|
||||
|
||||
DOKKU_NGINX_PORT=$(config_get $APP DOKKU_NGINX_PORT || true)
|
||||
DOKKU_NGINX_SSL_PORT=$(config_get $APP DOKKU_NGINX_SSL_PORT || true)
|
||||
|
||||
if [[ -n "$DOKKU_NGINX_PORT" ]]; then
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_PORT (nginx)"
|
||||
fi
|
||||
if [[ -n "$DOKKU_NGINX_SSL_PORT" ]]; then
|
||||
echo "https://$(< "$DOKKU_ROOT/HOSTNAME"):$DOKKU_NGINX_SSL_PORT (nginx-ssl)"
|
||||
fi
|
||||
else
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
|
||||
fi
|
||||
;;
|
||||
|
||||
version)
|
||||
cat "$DOKKU_ROOT/VERSION" || {
|
||||
echo "Unable to determine dokku's version" 2>&1
|
||||
exit 1
|
||||
}
|
||||
cat "$DOKKU_ROOT/VERSION" || dokku_log_fail "Unable to determine dokku's version"
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
ls, Pretty listing of deployed applications and containers
|
||||
logs <app> [-t], Show the last logs for an application (-t follows)
|
||||
run <app> <cmd>, Run a command in the environment of an application
|
||||
url <app>, Show the first URL for an application (compatibility)
|
||||
urls <app>, Show all URLs for an application
|
||||
|
||||
4
plugins/00_dokku-standard/plugin.toml
Normal file
4
plugins/00_dokku-standard/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core standard plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " events events:on events:off events:list help events:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
PLUGIN_DIR="$(dirname $0)"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
case "$1" in
|
||||
events)
|
||||
if [[ -f $DOKKU_EVENTS_LOGFILE ]] ; then
|
||||
if [[ -f $DOKKU_EVENTS_LOGFILE ]]; then
|
||||
if [[ $2 == "-t" ]]; then
|
||||
tail -f $DOKKU_EVENTS_LOGFILE
|
||||
else
|
||||
@@ -27,10 +26,11 @@ case "$1" in
|
||||
;;
|
||||
|
||||
events:list)
|
||||
PLUGIN_DIR="$(dirname $0)"
|
||||
if [[ "$DOKKU_EVENTS" ]]; then
|
||||
logged="$(find $PLUGIN_DIR -type l -printf '%f ' | sort)"
|
||||
dokku_col_log_info2_quiet "Events currently logged"
|
||||
for hook in $logged ; do
|
||||
for hook in $logged; do
|
||||
dokku_col_log_msg "$hook"
|
||||
done
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_pluginhook_call "$(basename $0)" "$@"
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
DOKKU_RSYSLOG_FILTER=/etc/rsyslog.d/99-dokku.conf
|
||||
DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku
|
||||
@@ -49,6 +49,6 @@ if [[ "$flag_rsyslog_needs_restart" == "y" ]]; then
|
||||
service rsyslog restart
|
||||
fi
|
||||
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_pluginhook_call "$(basename $0)" "$@"
|
||||
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@"
|
||||
|
||||
exit 0
|
||||
|
||||
4
plugins/20_events/plugin.toml
Normal file
4
plugins/20_events/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core events logging plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
1
plugins/20_events/retire-container-failed
Symbolic link
1
plugins/20_events/retire-container-failed
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
Please note that the hooks in Dokku are experimental and are likely to change quite a bit.
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " apps apps:create apps:destroy help apps:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
case "$1" in
|
||||
apps)
|
||||
@@ -9,8 +10,8 @@ case "$1" in
|
||||
;;
|
||||
|
||||
apps:create)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -d "$DOKKU_ROOT/$2" ]] && dokku_log_warn "Name is already taken" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
[[ -d "$DOKKU_ROOT/$2" ]] && dokku_log_fail "Name is already taken"
|
||||
APP="$2"
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP"
|
||||
@@ -18,12 +19,12 @@ case "$1" in
|
||||
;;
|
||||
|
||||
apps:destroy)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
[[ "$2" == "tls" ]] && echo "Unable to destroy tls directory" && exit 1
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
[[ "$2" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
|
||||
[[ "$3" == "force" ]] && DOKKU_APPS_FORCE_DELETE=1
|
||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ -z "$DOKKU_APPS_FORCE_DELETE" ]]; then
|
||||
dokku_log_warn "WARNING: Potentially Destructive Action"
|
||||
dokku_log_warn "This command will destroy $APP (including all add-ons)."
|
||||
@@ -32,29 +33,26 @@ case "$1" in
|
||||
|
||||
read -p "> " app_name
|
||||
if [[ "$app_name" != "$APP" ]]; then
|
||||
dokku_log_warn "Confirmation did not match $APP. Aborted."
|
||||
exit 1
|
||||
dokku_log_fail "Confirmation did not match $APP. Aborted."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Destroying $APP (including all add-ons)"
|
||||
|
||||
pluginhook pre-delete $APP
|
||||
plugn trigger pre-delete $APP $IMAGE_TAG
|
||||
DOKKU_APP_CIDS=$(get_app_container_ids $APP)
|
||||
if [[ -n $DOKKU_APP_CIDS ]]; then
|
||||
for ID in $DOKKU_APP_CIDS;do
|
||||
for ID in $DOKKU_APP_CIDS; do
|
||||
docker stop $ID > /dev/null || true
|
||||
docker rm $ID > /dev/null || true
|
||||
done
|
||||
fi
|
||||
|
||||
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
|
||||
|
||||
pluginhook post-delete $APP
|
||||
plugn trigger post-delete $APP $IMAGE_TAG
|
||||
;;
|
||||
|
||||
help | apps:help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
apps, List your apps
|
||||
apps:create <app>, Create a new app
|
||||
apps:destroy <app>, Permanently destroy an app
|
||||
|
||||
4
plugins/apps/plugin.toml
Normal file
4
plugins/apps/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core apps plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,4 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
[[ -n $1 ]] && rm -r "$DOKKU_ROOT/$1" > /dev/null
|
||||
APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP)
|
||||
[[ -n $APP ]] && rm -rf "$DOKKU_ROOT/$APP" > /dev/null
|
||||
|
||||
# remove all application containers & images
|
||||
# shellcheck disable=SC2046
|
||||
docker rm -f $(docker ps -a --no-trunc | egrep "dokku/${APP}:" | awk '{ print $1 }' | xargs) &>/dev/null || true
|
||||
# shellcheck disable=SC2046
|
||||
docker rmi $(docker images -q $IMAGE_REPO | xargs) &>/dev/null || true
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#!/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); CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
verify_app_name "$APP"
|
||||
|
||||
APP="$1"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
if [[ -d $CACHE_DIR ]]; then
|
||||
docker run --rm -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
fi
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " backup:export backup:import help backup:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
CURRENT_BACKUP_VERSION=1
|
||||
|
||||
case "$1" in
|
||||
backup:export)
|
||||
CURRENT_BACKUP_VERSION=1
|
||||
OUTPUT_FILE="$2"
|
||||
BACKUP_DIR="$DOKKU_ROOT"
|
||||
|
||||
BACKUP_TMP_DIR=$(mktemp -d)
|
||||
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
|
||||
|
||||
: | pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
|
||||
: | plugn trigger backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
|
||||
|
||||
pushd $BACKUP_DIR > /dev/null
|
||||
find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
@@ -50,14 +50,12 @@ case "$1" in
|
||||
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
|
||||
|
||||
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
|
||||
echo "Unable to determine backup version"
|
||||
exit 1
|
||||
dokku_log_fail "Unable to determine backup version"
|
||||
fi
|
||||
|
||||
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
|
||||
if [[ $VERSION -ne 1 ]]; then
|
||||
echo "Unknown format version $VERSION"
|
||||
exit 1
|
||||
dokku_log_fail "Unknown format version $VERSION"
|
||||
fi
|
||||
|
||||
echo "Importing a version $VERSION backup..."
|
||||
@@ -65,12 +63,11 @@ case "$1" in
|
||||
BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
|
||||
TARGET_DIR="$DOKKU_ROOT"
|
||||
|
||||
if ! pluginhook backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then
|
||||
if ! plugn trigger backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then
|
||||
if $force; then
|
||||
echo "-f used. Ignoring warnings."
|
||||
else
|
||||
echo "Archive did not pass sanity checks. Use -f to import anyway" >&2
|
||||
exit 1
|
||||
dokku_log_fail "Archive did not pass sanity checks. Use -f to import anyway"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -78,7 +75,7 @@ case "$1" in
|
||||
while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps
|
||||
|
||||
# have the plugins import their stuff
|
||||
pluginhook backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
plugn trigger backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
|
||||
rm -rf $BACKUP_TMP_DIR
|
||||
|
||||
@@ -86,7 +83,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
help | backup:help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
backup:export [file], Export dokku configuration files
|
||||
backup:import [file], Import dokku configuration files
|
||||
EOF
|
||||
|
||||
4
plugins/backup/plugin.toml
Normal file
4
plugins/backup/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core backup plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
4
plugins/build-env/plugin.toml
Normal file
4
plugins/build-env/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core build-env plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,22 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV=""
|
||||
verify_app_name "$APP"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && rm "$DOKKU_ROOT/BUILD_ENV"
|
||||
[[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=5
|
||||
[[ -z $(config_get --global CURL_TIMEOUT) ]] && config_set --global CURL_TIMEOUT=30
|
||||
|
||||
! (grep -q CURL_CONNECT_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_CONNECT_TIMEOUT=5" >> "$DOKKU_ROOT/ENV"
|
||||
! (grep -q CURL_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_TIMEOUT=30" >> "$DOKKU_ROOT/ENV"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
|
||||
if [[ -n $(config_export global) ]]; then
|
||||
BUILD_ENV+=$'\n'
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
|
||||
BUILD_ENV+=$(config_export global)
|
||||
BUILD_ENV+=$'\n'
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
||||
if [[ -n $(config_export app $APP) ]]; then
|
||||
BUILD_ENV+=$'\n'
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
|
||||
BUILD_ENV+=$(config_export app $APP)
|
||||
BUILD_ENV+=$'\n'
|
||||
fi
|
||||
|
||||
176
plugins/certs/commands
Executable file
176
plugins/certs/commands
Executable file
@@ -0,0 +1,176 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " certs:add certs:generate certs:info certs:remove certs:update help certs:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
is_tar_import() {
|
||||
[[ -t 0 ]] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
is_file_import() {
|
||||
local CRT_FILE="$3"
|
||||
local KEY_FILE="$4"
|
||||
|
||||
if [[ -f $CRT_FILE ]] && [[ -f $KEY_FILE ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
certs_set() {
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"; CRT_FILE="$3"; KEY_FILE="$4"
|
||||
|
||||
is_file_import $CRT_FILE $KEY_FILE || is_tar_import || dokku_log_fail "Tar archive containing server.crt and server.key expected on stdin"
|
||||
|
||||
if is_tar_import; then
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
cd $TEMP_DIR
|
||||
tar xvf - <&0
|
||||
|
||||
CRT_FILE_SEARCH=$(find . -type f -name "*.crt")
|
||||
CRT_FILE_COUNT=$(printf "%s" "$CRT_FILE_SEARCH" | grep -c '^')
|
||||
if [[ $CRT_FILE_COUNT -lt 1 ]]; then
|
||||
dokku_log_fail "Tar archive is missing .crt file"
|
||||
elif [[ $CRT_FILE_COUNT -gt 1 ]]; then
|
||||
dokku_log_fail "Tar archive contains more than one .crt file"
|
||||
else
|
||||
CRT_FILE=$CRT_FILE_SEARCH
|
||||
fi
|
||||
|
||||
KEY_FILE_SEARCH=$(find . -type f -name "*.key")
|
||||
KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^')
|
||||
if [[ $KEY_FILE_COUNT -lt 1 ]]; then
|
||||
dokku_log_fail "Tar archive is missing .key file"
|
||||
elif [[ $KEY_FILE_COUNT -gt 1 ]]; then
|
||||
dokku_log_fail "Tar archive contains more than one .key file"
|
||||
else
|
||||
KEY_FILE=$KEY_FILE_SEARCH
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP/tls"
|
||||
mv "$CRT_FILE" "$DOKKU_ROOT/$APP/tls/server.crt"
|
||||
mv "$KEY_FILE" "$DOKKU_ROOT/$APP/tls/server.key"
|
||||
cd $DOKKU_ROOT
|
||||
rm -rf $TEMP_DIR
|
||||
nginx_build_config $APP
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
certs:add)
|
||||
certs_set "$@"
|
||||
;;
|
||||
|
||||
certs:generate)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"; DOMAIN="$3"; SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ ! -f "$SSL_PATH/server.key" ]] && [[ ! -f "$SSL_PATH/server.crt" ]]; then
|
||||
TMP_WORK_DIR=$(mktemp -d -t "dokku_certs.XXXXXXXXX")
|
||||
trap 'rm -rf "$TMP_WORK_DIR" > /dev/null' INT TERM EXIT
|
||||
|
||||
pushd $TMP_WORK_DIR > /dev/null
|
||||
|
||||
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
|
||||
openssl rsa -passin pass:x -in server.pass.key -out server.key
|
||||
openssl req -new -key server.key -out server.csr
|
||||
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP/tls"
|
||||
dokku_log_info1 "Installing certificate and key..."
|
||||
mv -f $TMP_WORK_DIR/server.key $TMP_WORK_DIR/server.crt $SSL_PATH
|
||||
[[ -n "$DOMAIN" ]] && (dokku domains:add $APP $DOMAIN || nginx_build_config $APP)
|
||||
dokku_log_info1 "The following is a certificate signing request that can be used"
|
||||
dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN"
|
||||
dokku_log_info1 "by a CA of your choosing."
|
||||
cat server.csr
|
||||
else
|
||||
dokku_log_info1 "$APP has an SSL endpoint already defined"
|
||||
fi
|
||||
;;
|
||||
|
||||
certs:info)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"; SSL_TYPE=$(is_ssl_enabled $APP)
|
||||
case "$SSL_TYPE" in
|
||||
app)
|
||||
SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
;;
|
||||
|
||||
global)
|
||||
SSL_PATH="$DOKKU_ROOT/tls"
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -n "$SSL_PATH" ]]; then
|
||||
dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
|
||||
dokku_log_info1 "Certificate details:"
|
||||
dokku_log_info2 "Common Name(s): "
|
||||
|
||||
for domain in $(get_ssl_hostnames $APP | xargs); do
|
||||
dokku_log_info2 " $domain"
|
||||
done
|
||||
|
||||
dokku_log_info2 "Expires At: $(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
|
||||
dokku_log_info2 "Issuer: $(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
|
||||
dokku_log_info2 "Starts At: $(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
|
||||
dokku_log_info2 "Subject: $(openssl x509 -in $SSL_PATH/server.crt -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
|
||||
SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver $SSL_PATH/server.crt | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
SSL_SELF_SIGNED="verified by a certificate authority."
|
||||
else
|
||||
SSL_SELF_SIGNED="self signed."
|
||||
fi
|
||||
dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
|
||||
else
|
||||
dokku_log_info1 "$APP does not have an SSL endpoint"
|
||||
fi
|
||||
;;
|
||||
|
||||
certs:remove)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"; APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ -d "$APP_SSL_PATH" ]]; then
|
||||
dokku_log_info1 "Removing SSL endpoint from $APP"
|
||||
rm -rf $APP_SSL_PATH
|
||||
plugn trigger post-domains-update $APP
|
||||
else
|
||||
dokku_log_info1 "An app-specific SSL endpoint is not defined"
|
||||
fi
|
||||
;;
|
||||
|
||||
certs:update)
|
||||
certs_set "$@"
|
||||
;;
|
||||
|
||||
help | certs:help)
|
||||
cat && cat<<EOF
|
||||
certs:add <app> CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin
|
||||
certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate.
|
||||
certs:generate <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
|
||||
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
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
44
plugins/certs/functions
Executable file
44
plugins/certs/functions
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
# returns 'global', 'app', 'false'
|
||||
# if both are configured, app trumps global
|
||||
is_ssl_enabled() {
|
||||
local APP=$1; verify_app_name $APP
|
||||
APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
WILDCARD_SSL_PATH="$DOKKU_ROOT/tls"
|
||||
|
||||
if [[ -e "$APP_SSL_PATH/server.crt" ]] && [[ -e "$APP_SSL_PATH/server.key" ]]; then
|
||||
echo app
|
||||
return 0
|
||||
elif [[ -e "$WILDCARD_SSL_PATH/server.crt" ]] && [[ -e "$WILDCARD_SSL_PATH/server.key" ]]; then
|
||||
echo global
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_ssl_hostnames() {
|
||||
local APP=$1; verify_app_name $APP
|
||||
case "$(is_ssl_enabled $APP)" in
|
||||
app)
|
||||
SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
;;
|
||||
|
||||
global)
|
||||
SSL_PATH="$DOKKU_ROOT/tls"
|
||||
;;
|
||||
esac
|
||||
|
||||
SSL_HOSTNAME=$(openssl x509 -in $SSL_PATH/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
|
||||
SSL_HOSTNAME_ALT=$(openssl x509 -in $SSL_PATH/server.crt -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
|
||||
if [[ -n "$SSL_HOSTNAME_ALT" ]]; then
|
||||
SSL_HOSTNAMES="${SSL_HOSTNAME}\n${SSL_HOSTNAME_ALT}"
|
||||
else
|
||||
SSL_HOSTNAMES=$SSL_HOSTNAME
|
||||
fi
|
||||
echo -e $SSL_HOSTNAMES
|
||||
return 0
|
||||
}
|
||||
4
plugins/certs/plugin.toml
Normal file
4
plugins/certs/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core certificate management plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -35,7 +35,8 @@
|
||||
#
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5"
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
@@ -51,8 +52,8 @@ fi
|
||||
|
||||
|
||||
# source global and in-app envs to get DOKKU_CHECKS_WAIT and any other necessary vars
|
||||
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
eval "$(config_export global)"
|
||||
eval "$(config_export app $APP)"
|
||||
|
||||
# Wait this many seconds (default 5) for server to start before running checks.
|
||||
WAIT="${DOKKU_CHECKS_WAIT:-5}"
|
||||
@@ -96,18 +97,24 @@ if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]];
|
||||
sleep $DOKKU_DEFAULT_CHECKS_WAIT
|
||||
|
||||
! (is_container_running $DOKKU_APP_CONTAINER_ID) && dokku_log_fail "App container failed to start!!"
|
||||
container_restarts=$(docker inspect -f "{{ .RestartCount }}" $DOKKU_APP_CONTAINER_ID)
|
||||
if [[ $container_restarts -ne 0 ]]; then
|
||||
docker stop "$DOKKU_APP_CONTAINER_ID" || true
|
||||
dokku_log_fail "App container failed to start!!"
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Default container check successful!" && exit 0
|
||||
fi
|
||||
|
||||
# Reads name/value pairs, sets the WAIT and TIMEOUT variables
|
||||
exec < "$FILENAME"
|
||||
while read LINE ; do
|
||||
while read LINE; do
|
||||
# Name/value pair
|
||||
if [[ "$LINE" =~ ^.+= ]] ; then
|
||||
if [[ "$LINE" =~ ^.+= ]]; then
|
||||
TRIM=${LINE%#*}
|
||||
NAME=${TRIM%=*}
|
||||
VALUE=${TRIM#*=}
|
||||
[[ "$NAME" = "WAIT" ]] && WAIT=$VALUE
|
||||
[[ "$NAME" = "WAIT" ]] && WAIT=$VALUE
|
||||
[[ "$NAME" = "TIMEOUT" ]] && TIMEOUT=$VALUE
|
||||
[[ "$NAME" = "ATTEMPTS" ]] && ATTEMPTS=$VALUE
|
||||
fi
|
||||
@@ -136,7 +143,7 @@ do
|
||||
fi
|
||||
|
||||
exec < "$FILENAME"
|
||||
while read CHECK_URL EXPECTED ; do
|
||||
while read CHECK_URL EXPECTED; do
|
||||
# Ignore empty lines and lines starting with #
|
||||
# shellcheck disable=SC1001
|
||||
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
|
||||
@@ -144,14 +151,14 @@ do
|
||||
# shellcheck disable=SC1001
|
||||
! [[ "$CHECK_URL" =~ ^(http(s)?:)?\/.* ]] && continue
|
||||
|
||||
if [[ "$CHECK_URL" =~ ^https?: ]] ; then
|
||||
if [[ "$CHECK_URL" =~ ^https?: ]]; then
|
||||
URL_PROTOCOL=${CHECK_URL%:*}
|
||||
CHECK_URL=${CHECK_URL#*:}
|
||||
else
|
||||
URL_PROTOCOL="http"
|
||||
fi
|
||||
|
||||
if [[ "$CHECK_URL" =~ ^//.+ ]] ; then
|
||||
if [[ "$CHECK_URL" =~ ^//.+ ]]; then
|
||||
# To test a URL with specific host name, we still make request to localhost,
|
||||
# but we set Host header to $SEND_HOST.
|
||||
#
|
||||
@@ -177,9 +184,9 @@ do
|
||||
[[ $DOKKU_TRACE ]] && dokku_log_verbose "$ curl $CURL_ARGS"
|
||||
|
||||
# Capture HTTP response or CURL error message
|
||||
if OUTPUT=$(curl -# $CURL_ARGS 2>&1) ; then
|
||||
if OUTPUT=$(curl -# $CURL_ARGS 2>&1); then
|
||||
# OUTPUT contains the HTTP response
|
||||
if [[ ! "$OUTPUT" =~ $EXPECTED ]] ; then
|
||||
if [[ ! "$OUTPUT" =~ $EXPECTED ]]; then
|
||||
dokku_log_warn "$LOG_URL: expected to but did not find: \"$EXPECTED\""
|
||||
FAILEDCHECKS=$(( FAILEDCHECKS + 1 ))
|
||||
fi
|
||||
@@ -190,7 +197,7 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILEDCHECKS -gt 0 ]; then
|
||||
if [[ $FAILEDCHECKS -gt 0 ]]; then
|
||||
dokku_log_warn "Check attempt $ATTEMPT/$ATTEMPTS failed."
|
||||
SUCCESS=0
|
||||
else
|
||||
@@ -198,7 +205,7 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILEDCHECKS -gt 0 ]; then
|
||||
if [[ $FAILEDCHECKS -gt 0 ]]; then
|
||||
dokku_log_fail "Could not start due to $FAILEDCHECKS failed checks."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
4
plugins/checks/plugin.toml
Normal file
4
plugins/checks/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core checks plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -18,7 +18,7 @@ dokku_log_info2() {
|
||||
}
|
||||
|
||||
dokku_log_info1_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||
echo "-----> $@"
|
||||
else
|
||||
return 0
|
||||
@@ -26,7 +26,7 @@ dokku_log_info1_quiet() {
|
||||
}
|
||||
|
||||
dokku_log_info2_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||
echo "=====> $@"
|
||||
else
|
||||
return 0
|
||||
@@ -38,7 +38,7 @@ dokku_col_log_info1() {
|
||||
}
|
||||
|
||||
dokku_col_log_info1_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||
printf "%-25s %-25s %-25s %-25s\n" "-----> $@"
|
||||
else
|
||||
return 0
|
||||
@@ -50,7 +50,7 @@ dokku_col_log_info2() {
|
||||
}
|
||||
|
||||
dokku_col_log_info2_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||
printf "%-25s %-25s %-25s %-25s\n" "=====> $@"
|
||||
else
|
||||
return 0
|
||||
@@ -62,7 +62,7 @@ dokku_col_log_msg() {
|
||||
}
|
||||
|
||||
dokku_col_log_msg_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||
printf "%-25s %-25s %-25s %-25s\n" "$@"
|
||||
else
|
||||
return 0
|
||||
@@ -70,7 +70,7 @@ dokku_col_log_msg_quiet() {
|
||||
}
|
||||
|
||||
dokku_log_verbose_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||
echo " $@"
|
||||
else
|
||||
return 0
|
||||
@@ -82,7 +82,7 @@ dokku_log_verbose() {
|
||||
}
|
||||
|
||||
dokku_log_warn() {
|
||||
echo " ! $@"
|
||||
echo " ! $@"
|
||||
}
|
||||
|
||||
dokku_log_fail() {
|
||||
@@ -94,15 +94,15 @@ dokku_log_event() {
|
||||
logger -t dokku -i -- "$@"
|
||||
}
|
||||
|
||||
dokku_log_pluginhook_call() {
|
||||
dokku_log_plugn_trigger_call() {
|
||||
local l_hook
|
||||
|
||||
l_hook="$1" ; shift
|
||||
dokku_log_event "INVOKED: ${l_hook}( $@ )"
|
||||
dokku_log_event "INVOKED: ${l_hook}( $@ ) NAME=$NAME FINGERPRINT=$FINGERPRINT"
|
||||
}
|
||||
|
||||
dokku_container_log_verbose_quiet() {
|
||||
CID=$1;
|
||||
local CID=$1;
|
||||
shift
|
||||
|
||||
OIFS=$IFS
|
||||
@@ -117,21 +117,52 @@ verify_app_name() {
|
||||
local APP="$1"
|
||||
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
||||
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
|
||||
IMAGE="dokku/$APP"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
verify_image() {
|
||||
local IMAGE="$1"
|
||||
DOKKU_APP_IMAGES=$(docker images -q $IMAGE)
|
||||
if [[ -n "$DOKKU_APP_IMAGES" ]]; then
|
||||
if (docker inspect "$IMAGE" &>/dev/null); then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_image_buildstep_based() {
|
||||
get_app_image_repo() {
|
||||
# central definition of our image repo pattern
|
||||
local APP="$1"; local IMAGE_REPO="dokku/$APP"
|
||||
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_repo) APP must not be null"
|
||||
echo $IMAGE_REPO
|
||||
}
|
||||
|
||||
get_app_image_name() {
|
||||
# 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)
|
||||
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null"
|
||||
|
||||
if [[ -n "$IMAGE_TAG" ]]; then
|
||||
IMAGE="$IMAGE_REPO:$IMAGE_TAG"
|
||||
verify_image "$IMAGE" || dokku_log_fail "app image ($IMAGE) not found"
|
||||
else
|
||||
IMAGE="$IMAGE_REPO:latest"
|
||||
fi
|
||||
echo $IMAGE
|
||||
}
|
||||
|
||||
get_running_image_tag() {
|
||||
# retrieve current image tag for a given app. returns empty string if no deployed containers are found
|
||||
local APP="$1"
|
||||
[[ ! -n "$APP" ]] && dokku_log_fail "(get_running_image_tag) APP must not be null"
|
||||
verify_app_name "$APP"
|
||||
|
||||
CIDS=( $(get_app_container_ids $APP) )
|
||||
RUNNING_IMAGE_TAG=$(docker ps -a --no-trunc | egrep ${CIDS[0]} 2>/dev/null | awk '{ print $2 }' | awk -F: '{ print $2 }' || echo '')
|
||||
echo $RUNNING_IMAGE_TAG
|
||||
}
|
||||
|
||||
is_image_herokuish_based() {
|
||||
# circleci can't support --rm as they run lxc in lxc
|
||||
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
|
||||
docker run --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec"
|
||||
@@ -139,7 +170,7 @@ is_image_buildstep_based() {
|
||||
|
||||
is_number() {
|
||||
local NUMBER=$1; local NUM_RE='^[0-9]+$'
|
||||
if [[ $NUMBER =~ $NUM_RE ]];then
|
||||
if [[ $NUMBER =~ $NUM_RE ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -167,7 +198,8 @@ parse_args() {
|
||||
}
|
||||
|
||||
copy_from_image() {
|
||||
local IMAGE="$1"; local SRC_FILE="$2"; local DST_DIR="$3"; verify_app_name $APP
|
||||
local IMAGE="$1"; local SRC_FILE="$2"; local DST_DIR="$3"
|
||||
verify_app_name $APP
|
||||
|
||||
if verify_image "$IMAGE"; then
|
||||
CID=$(docker run -d $IMAGE bash)
|
||||
@@ -179,12 +211,22 @@ copy_from_image() {
|
||||
}
|
||||
|
||||
get_app_container_ids() {
|
||||
APP="$1"
|
||||
local APP="$1"; local CONTAINER_TYPE="$2"
|
||||
verify_app_name $APP
|
||||
[[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(< $DOKKU_ROOT/$APP/CONTAINER)
|
||||
|
||||
if [[ -n "$CONTAINER_TYPE" ]]; then
|
||||
CONTAINER_PATTERN="$DOKKU_ROOT/$APP/CONTAINER.$CONTAINER_TYPE.*"
|
||||
if [[ $CONTAINER_TYPE == *.* ]]; then
|
||||
CONTAINER_PATTERN="$DOKKU_ROOT/$APP/CONTAINER.$CONTAINER_TYPE"
|
||||
[[ ! -f $CONTAINER_PATTERN ]] && echo "" && return 0
|
||||
fi
|
||||
else
|
||||
CONTAINER_PATTERN="$DOKKU_ROOT/$APP/CONTAINER.*"
|
||||
fi
|
||||
|
||||
shopt -s nullglob
|
||||
for DOKKU_CID_FILE in $DOKKU_ROOT/$APP/CONTAINER.*; do
|
||||
for DOKKU_CID_FILE in $CONTAINER_PATTERN; do
|
||||
DOKKU_CIDS+=" "
|
||||
DOKKU_CIDS+=$(< $DOKKU_CID_FILE)
|
||||
DOKKU_CIDS+=" "
|
||||
@@ -205,7 +247,7 @@ get_app_running_container_ids() {
|
||||
! (is_deployed $APP) && dokku_log_fail "App $APP has not been deployed"
|
||||
local CIDS=$(get_app_container_ids $APP)
|
||||
|
||||
for CID in $CIDS;do
|
||||
for CID in $CIDS; do
|
||||
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
|
||||
[[ "$APP_CONTAINER_STATUS" == "true" ]] && local APP_RUNNING_CONTAINER_IDS+="$CID "
|
||||
done
|
||||
@@ -214,8 +256,8 @@ get_app_running_container_ids() {
|
||||
}
|
||||
|
||||
is_deployed() {
|
||||
APP="$1"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(ls $DOKKU_ROOT/$APP/CONTAINER.* &> /dev/null; echo $?) -eq 0 ]];then
|
||||
local APP="$1"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] || [[ $(ls $DOKKU_ROOT/$APP/CONTAINER.* &> /dev/null; echo $?) -eq 0 ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -233,6 +275,18 @@ is_container_running () {
|
||||
fi
|
||||
}
|
||||
|
||||
is_container_status () {
|
||||
local CID=$1
|
||||
local TEMPLATE="{{.State.$2}}"
|
||||
local CONTAINER_STATUS=$(docker inspect -f "$TEMPLATE" "$CID" || true)
|
||||
|
||||
if [[ "$CONTAINER_STATUS" == "true" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_app_running() {
|
||||
local APP="$1"
|
||||
verify_app_name $APP
|
||||
@@ -245,3 +299,46 @@ is_app_running() {
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
release_and_deploy() {
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
if verify_image "$IMAGE"; then
|
||||
if is_image_herokuish_based "$IMAGE"; then
|
||||
IMAGE_SOURCE_TYPE="herokuish"
|
||||
else
|
||||
IMAGE_SOURCE_TYPE="dockerfile"
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Releasing $APP ($IMAGE)..."
|
||||
dokku release "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG"
|
||||
dokku_log_info1 "Deploying $APP ($IMAGE)..."
|
||||
dokku deploy "$APP" "$IMAGE_TAG"
|
||||
dokku_log_info2 "Application deployed:"
|
||||
dokku urls $APP | sed "s/^/ /"
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
docker_cleanup() {
|
||||
# delete all non-running containers
|
||||
# shellcheck disable=SC2046
|
||||
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true
|
||||
|
||||
# delete unused images
|
||||
# shellcheck disable=SC2046
|
||||
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
|
||||
}
|
||||
|
||||
get_available_port() {
|
||||
while true; do
|
||||
local port=$(shuf -i 1025-65535 -n 1)
|
||||
if ! nc -z 0.0.0.0 $port; then
|
||||
echo $port
|
||||
return 0
|
||||
else
|
||||
continue
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
4
plugins/common/plugin.toml
Normal file
4
plugins/common/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core common plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,216 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " config config:get config:set config:unset help config:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
config_create () {
|
||||
[ -f $ENV_FILE ] || {
|
||||
touch $ENV_FILE
|
||||
}
|
||||
}
|
||||
|
||||
config_styled_hash () {
|
||||
vars="$1"
|
||||
prefix="$2"
|
||||
|
||||
longest=""
|
||||
while read -r word; do
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
if [ ${#KEY} -gt ${#longest} ]; then
|
||||
longest=$KEY
|
||||
fi
|
||||
done <<< "$vars"
|
||||
|
||||
while read -r word; do
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" -e "s/\$$//g")
|
||||
|
||||
num_zeros=$((${#longest} - ${#KEY}))
|
||||
zeros=" "
|
||||
while [ $num_zeros -gt 0 ]; do
|
||||
zeros="$zeros "
|
||||
num_zeros=$((num_zeros - 1))
|
||||
done
|
||||
echo "$prefix$KEY:$zeros$VALUE"
|
||||
done <<< "$vars"
|
||||
}
|
||||
|
||||
config_write() {
|
||||
ENV_TEMP="$1"
|
||||
ENV_FILE_TEMP="${ENV_FILE}.tmp"
|
||||
|
||||
echo "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
|
||||
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
|
||||
cp -f $ENV_FILE_TEMP $ENV_FILE
|
||||
chmod 600 $ENV_FILE
|
||||
fi
|
||||
rm -f $ENV_FILE_TEMP
|
||||
}
|
||||
|
||||
parse_config_args() {
|
||||
case "$2" in
|
||||
--global)
|
||||
ENV_FILE="$DOKKU_ROOT/ENV"
|
||||
DOKKU_CONFIG_TYPE="global"
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
;;
|
||||
--no-restart)
|
||||
APP="$3"
|
||||
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
DOKKU_CONFIG_TYPE="app"
|
||||
set -- "${@:1:1}" "${@:3}"
|
||||
esac
|
||||
|
||||
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
|
||||
echo "Please specify an app to run the command on" >&2 && exit 1
|
||||
else
|
||||
verify_app_name "$2"
|
||||
fi
|
||||
fi
|
||||
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
|
||||
}
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
case "$1" in
|
||||
config)
|
||||
parse_config_args "$@"
|
||||
config_create
|
||||
|
||||
[[ "$APP" ]] && DOKKU_CONFIG_TYPE=$APP
|
||||
[[ ! -s $ENV_FILE ]] && echo "no config vars for $DOKKU_CONFIG_TYPE" && exit 1
|
||||
|
||||
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
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
dokku_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars"
|
||||
config_styled_hash "$VARS"
|
||||
config_all "$@"
|
||||
;;
|
||||
|
||||
config:get)
|
||||
parse_config_args "$@"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:get APP KEY"
|
||||
echo "Must specify KEY."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_create
|
||||
if [[ ! -s $ENV_FILE ]] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
KEY="$3"
|
||||
|
||||
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
|
||||
config_get "$@"
|
||||
;;
|
||||
|
||||
config:set)
|
||||
parse_config_args "$@"
|
||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_create
|
||||
ENV_ADD=""
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
RESTART_APP=false
|
||||
shift 2
|
||||
|
||||
for var; do
|
||||
if [[ $var != *"="* ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for var; do
|
||||
KEY=$(echo ${var} | cut -d"=" -f1)
|
||||
VALUE=$(echo ${var} | cut -d"=" -f2-)
|
||||
|
||||
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
|
||||
RESTART_APP=true
|
||||
ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $KEY=/ d")
|
||||
ENV_TEMP="${ENV_TEMP}
|
||||
export $KEY='$VALUE'"
|
||||
ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
|
||||
ENV_ADD="${ENV_ADD}$
|
||||
${var}"
|
||||
fi
|
||||
done
|
||||
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
|
||||
|
||||
if [ $RESTART_APP ]; then
|
||||
dokku_log_info1 "Setting config vars"
|
||||
config_styled_hash "$ENV_ADD" " "
|
||||
|
||||
config_write "$ENV_TEMP"
|
||||
fi
|
||||
|
||||
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart $APP
|
||||
fi
|
||||
config_set "$@"
|
||||
;;
|
||||
|
||||
config:unset)
|
||||
parse_config_args "$@"
|
||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
|
||||
echo "Must specify KEY to unset."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_create
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
VARS="${*:3}"
|
||||
|
||||
for var in $VARS; do
|
||||
dokku_log_info1 "Unsetting $var"
|
||||
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
|
||||
|
||||
config_write "$ENV_TEMP"
|
||||
done
|
||||
|
||||
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart $APP
|
||||
fi
|
||||
;;
|
||||
|
||||
config:set-norestart)
|
||||
dokku_log_info2 "$1 is deprecated as of v0.3.22"
|
||||
shift 1
|
||||
dokku config:set --no-restart "$@"
|
||||
;;
|
||||
|
||||
config:unset-norestart)
|
||||
dokku_log_info2 "$1 is deprecated as of v0.3.22"
|
||||
shift 1
|
||||
dokku config:unset --no-restart "$@"
|
||||
config_unset "$@"
|
||||
;;
|
||||
|
||||
help | config:help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
config (<app>|--global), Display all global or app-specific config vars
|
||||
config:get (<app>|--global) KEY, Display a global or app-specific config value
|
||||
config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...], Set one or more config vars
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
STDIN=$(cat); APP="$1"; IMAGE="dokku/$APP"
|
||||
STDIN=$(cat); APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
|
||||
verify_app_name "$APP"
|
||||
|
||||
if ! is_image_buildstep_based "$IMAGE"; then
|
||||
if ! is_image_herokuish_based "$IMAGE"; then
|
||||
> "$DOCKERFILE_ENV_FILE"
|
||||
[[ -f "$DOKKU_ROOT/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/ENV" > "$DOCKERFILE_ENV_FILE"
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/$APP/ENV" >> "$DOCKERFILE_ENV_FILE"
|
||||
config_export global | sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" > "$DOCKERFILE_ENV_FILE"
|
||||
config_export app $APP | sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" >> "$DOCKERFILE_ENV_FILE"
|
||||
|
||||
echo "$STDIN --env-file=$DOCKERFILE_ENV_FILE"
|
||||
else
|
||||
|
||||
227
plugins/config/functions
Normal file
227
plugins/config/functions
Normal file
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
config_export() {
|
||||
local CONFIG_TYPE="$1"
|
||||
local APP="$2"
|
||||
local ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
|
||||
[[ $CONFIG_TYPE == "global" ]] && ENV_FILE="$DOKKU_ROOT/ENV"
|
||||
[[ ! -f $ENV_FILE ]] && return 0
|
||||
[[ ! -s $ENV_FILE ]] && return 0
|
||||
|
||||
VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
|
||||
echo "$VARS" | awk '{print "export " $0}'
|
||||
return 0
|
||||
}
|
||||
|
||||
config_parse_args() {
|
||||
case "$2" in
|
||||
--global)
|
||||
ENV_FILE="$DOKKU_ROOT/ENV"
|
||||
DOKKU_CONFIG_TYPE="global"
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
;;
|
||||
--no-restart)
|
||||
APP="$3"
|
||||
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
DOKKU_CONFIG_RESTART=false
|
||||
DOKKU_CONFIG_TYPE="app"
|
||||
set -- "${@:1:1}" "${@:3}"
|
||||
esac
|
||||
|
||||
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
|
||||
dokku_log_fail "Please specify an app to run the command on"
|
||||
else
|
||||
verify_app_name "$2"
|
||||
fi
|
||||
fi
|
||||
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART
|
||||
}
|
||||
|
||||
config_create () {
|
||||
local ENV_FILE=$1
|
||||
[[ -f $ENV_FILE ]] || touch $ENV_FILE
|
||||
}
|
||||
|
||||
config_styled_hash () {
|
||||
local vars="$1"
|
||||
local prefix="$2"
|
||||
local longest=""
|
||||
|
||||
while read -r word; do
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
if [[ ${#KEY} -gt ${#longest} ]]; then
|
||||
longest=$KEY
|
||||
fi
|
||||
done <<< "$vars"
|
||||
|
||||
while read -r word; do
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" -e "s/\$$//g")
|
||||
|
||||
num_zeros=$((${#longest} - ${#KEY}))
|
||||
zeros=" "
|
||||
while [[ $num_zeros -gt 0 ]]; do
|
||||
zeros="$zeros "
|
||||
num_zeros=$((num_zeros - 1))
|
||||
done
|
||||
echo "$prefix$KEY:$zeros$VALUE"
|
||||
done <<< "$vars"
|
||||
}
|
||||
|
||||
config_write() {
|
||||
local ENV_TEMP="$1"
|
||||
local ENV_FILE_TEMP="${ENV_FILE}.tmp"
|
||||
|
||||
echo "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
|
||||
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
|
||||
cp -f $ENV_FILE_TEMP $ENV_FILE
|
||||
chmod 600 $ENV_FILE
|
||||
fi
|
||||
rm -f $ENV_FILE_TEMP
|
||||
}
|
||||
|
||||
is_config_export() {
|
||||
for var in "$@"; do
|
||||
if [[ "$var" == "--export" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
config_all() {
|
||||
[[ "$1" == "config" ]] || set -- "config" "$@"
|
||||
config_parse_args "$@"
|
||||
config_create "$ENV_FILE"
|
||||
is_config_export "$@" && config_export "$DOKKU_CONFIG_TYPE" "$APP" && return 0
|
||||
|
||||
[[ "$APP" ]] && DOKKU_CONFIG_TYPE=$APP
|
||||
[[ ! -s $ENV_FILE ]] && dokku_log_fail "no config vars for $DOKKU_CONFIG_TYPE"
|
||||
|
||||
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_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars"
|
||||
config_styled_hash "$VARS"
|
||||
}
|
||||
|
||||
config_get() {
|
||||
[[ "$1" == "config:get" ]] || set -- "config:get" "$@"
|
||||
config_parse_args "$@"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:get APP KEY"
|
||||
echo "Must specify KEY."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_create "$ENV_FILE"
|
||||
if [[ ! -s $ENV_FILE ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
KEY="$3"
|
||||
|
||||
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() {
|
||||
[[ "$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 ...]"
|
||||
echo "Whitespaces need to be escaped, i.e. KEY=\"VAL\ WITH\ SPACES\""
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_create "$ENV_FILE"
|
||||
ENV_ADD=""
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
RESTART_APP=false
|
||||
shift 2
|
||||
|
||||
for var; do
|
||||
if [[ $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."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for var; do
|
||||
KEY=$(echo ${var} | cut -d"=" -f1)
|
||||
VALUE=$(echo ${var} | cut -d"=" -f2-)
|
||||
|
||||
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
|
||||
RESTART_APP=true
|
||||
ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $KEY=/ d")
|
||||
ENV_TEMP="${ENV_TEMP}
|
||||
export $KEY='$VALUE'"
|
||||
ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
|
||||
ENV_ADD="${ENV_ADD}$
|
||||
${var}"
|
||||
fi
|
||||
done
|
||||
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
|
||||
|
||||
if [[ $RESTART_APP ]]; then
|
||||
dokku_log_info1 "Setting config vars"
|
||||
config_styled_hash "$ENV_ADD" " "
|
||||
|
||||
config_write "$ENV_TEMP"
|
||||
fi
|
||||
|
||||
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart $APP
|
||||
fi
|
||||
}
|
||||
|
||||
config_unset() {
|
||||
[[ "$1" == "config:unset" ]] || set -- "config:unset" "$@"
|
||||
config_parse_args "$@"
|
||||
[[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
|
||||
echo "Must specify KEY to unset."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_create "$ENV_FILE"
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
VARS="${*:3}"
|
||||
|
||||
for var in $VARS; do
|
||||
dokku_log_info1 "Unsetting $var"
|
||||
ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $var=/ d")
|
||||
|
||||
config_write "$ENV_TEMP"
|
||||
[[ "$var" == "NO_VHOST" ]] && config_set --no-restart $APP NO_VHOST=0 && DOKKU_CONFIG_RESTART=true
|
||||
done
|
||||
|
||||
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart $APP
|
||||
fi
|
||||
|
||||
}
|
||||
4
plugins/config/plugin.toml
Normal file
4
plugins/config/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core config plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,10 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " docker-options docker-options:add docker-options:remove help docker-options:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
PHASES=(build deploy run)
|
||||
|
||||
FILE_PREFIX="DOCKER_OPTIONS_"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
get_app() {
|
||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
@@ -25,17 +22,19 @@ get_phases() {
|
||||
|
||||
verify_phase() {
|
||||
local phase
|
||||
for phase in "${PHASES[@]}"; do
|
||||
local phases=(build deploy run)
|
||||
for phase in "${phases[@]}"; do
|
||||
if [[ "$phase" = "$1" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
dokku_log_fail "Phase(s) must be one of [${PHASES[@]}]"
|
||||
dokku_log_fail "Phase(s) must be one of [${phases[@]}]"
|
||||
}
|
||||
|
||||
get_phase_file_path() {
|
||||
local phase=$1
|
||||
phase_file_path="${DOKKU_ROOT}/${APP}/${FILE_PREFIX}${phase^^}"
|
||||
local prefix="DOCKER_OPTIONS_"
|
||||
phase_file_path="${DOKKU_ROOT}/${APP}/${prefix}${phase^^}"
|
||||
}
|
||||
|
||||
create_phase_file_if_required() {
|
||||
@@ -53,9 +52,10 @@ display_phase_options() {
|
||||
}
|
||||
|
||||
display_all_phases_options() {
|
||||
for phase in "${PHASES[@]}"; do
|
||||
local phases=(build deploy run)
|
||||
for phase in "${phases[@]}"; do
|
||||
get_phase_file_path $phase
|
||||
if [[ -s $phase_file_path ]] ; then
|
||||
if [[ -s $phase_file_path ]]; then
|
||||
display_phase_options $phase $phase_file_path
|
||||
fi
|
||||
done
|
||||
@@ -66,7 +66,7 @@ display_passed_phases_options() {
|
||||
local phase
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
get_phase_file_path $phase
|
||||
if [ ! -s $phase_file_path ] ; then
|
||||
if [[ ! -s $phase_file_path ]]; then
|
||||
echo "${phase^} options: none"
|
||||
else
|
||||
display_phase_options $phase $phase_file_path
|
||||
@@ -139,8 +139,8 @@ case "$1" in
|
||||
;;
|
||||
|
||||
# Display usage help
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
help | docker-options:help)
|
||||
cat<<EOF
|
||||
docker-options <app>, Display apps docker options for all phases
|
||||
docker-options <app> <phase(s)>, Display apps docker options for phase (comma separated phase list)
|
||||
docker-options:add <app> <phase(s)> OPTION, Add docker option to app for phase (comma separated phase list)
|
||||
|
||||
4
plugins/docker-options/plugin.toml
Normal file
4
plugins/docker-options/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core docker-options plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,57 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " domains domains:setup domains:add domains:clear domains:remove help domains:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
|
||||
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
RE_IPV4="${RE_IPV4}\$"
|
||||
RE_IPV6="${RE_IPV6}\$"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
case "$1" in
|
||||
domains)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
dokku domains:setup $APP
|
||||
dokku_log_info2_quiet "$APP Domain Names"
|
||||
cat "$DOKKU_ROOT/$APP/VHOST"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
dokku_log_info2_quiet "$APP Domain Names"
|
||||
get_app_domains "$APP"
|
||||
else
|
||||
dokku_log_fail "No domain names set for $APP"
|
||||
fi
|
||||
;;
|
||||
|
||||
domains:setup)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"; VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
RE_IPV4="$(get_ipv4_regex)"; RE_IPV6="$(get_ipv6_regex)"
|
||||
|
||||
if [[ ! -f $VHOST_PATH ]]; then
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]];then
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
VHOST=$(< "$DOKKU_ROOT/VHOST")
|
||||
else
|
||||
VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
fi
|
||||
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
|
||||
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]]; then
|
||||
dokku_log_info2 "unsupported vhost config found. disabling vhost support"
|
||||
dokku config:set-norestart $APP NO_VHOST=1
|
||||
disable_app_vhost $APP --no-restart $APP
|
||||
else
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
dokku_log_info1 "Creating new $VHOST_PATH..."
|
||||
SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
|
||||
hostname=$(: | plugn trigger nginx-hostname $APP $SUBDOMAIN $VHOST)
|
||||
if [[ ! -n $hostname ]]; then
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
@@ -67,7 +55,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
domains:add)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
@@ -84,32 +72,32 @@ case "$1" in
|
||||
|
||||
shift 2
|
||||
dokku domains:setup $APP
|
||||
for DOMAIN in "$@";do
|
||||
for DOMAIN in "$@"; do
|
||||
echo "$DOMAIN" >> "$DOKKU_ROOT/$APP/VHOST"
|
||||
done
|
||||
# we need to restart the app to make sure we're binding to the appropriate network interface
|
||||
dokku nginx:build-config $APP
|
||||
pluginhook post-domains-update $APP
|
||||
for DOMAIN in "$@";do
|
||||
nginx_build_config $APP
|
||||
plugn trigger post-domains-update $APP
|
||||
for DOMAIN in "$@"; do
|
||||
dokku_log_info1 "Added $DOMAIN to $APP"
|
||||
done
|
||||
|
||||
;;
|
||||
|
||||
domains:clear)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
rm -f "$DOKKU_ROOT/$APP/VHOST"
|
||||
dokku domains:setup $APP
|
||||
pluginhook post-domains-update $APP
|
||||
plugn trigger post-domains-update $APP
|
||||
dokku_log_info1 "Cleared domains in $APP"
|
||||
|
||||
;;
|
||||
|
||||
domains:remove)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
@@ -121,18 +109,18 @@ case "$1" in
|
||||
|
||||
shift 2
|
||||
dokku domains:setup $APP
|
||||
for DOMAIN in "$@";do
|
||||
for DOMAIN in "$@"; do
|
||||
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
|
||||
done
|
||||
pluginhook post-domains-update $APP
|
||||
for DOMAIN in "$@";do
|
||||
plugn trigger post-domains-update $APP
|
||||
for DOMAIN in "$@"; do
|
||||
dokku_log_info1 "Removed $DOMAIN from $APP"
|
||||
done
|
||||
|
||||
;;
|
||||
|
||||
help | domains:help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
domains <app>, List custom domains for app
|
||||
domains:add <app> DOMAIN, Add a custom domain to app
|
||||
domains:clear <app>, Clear all custom domains for app
|
||||
|
||||
11
plugins/domains/functions
Executable file
11
plugins/domains/functions
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
get_app_domains() {
|
||||
local APP=$1; local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
verify_app_name $APP
|
||||
if [[ -f "$APP_VHOST_FILE" ]];then
|
||||
cat "$APP_VHOST_FILE"
|
||||
fi
|
||||
}
|
||||
4
plugins/domains/plugin.toml
Normal file
4
plugins/domains/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core domains plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
45
plugins/enter/commands
Executable file
45
plugins/enter/commands
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " enter help enter:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
case "$1" in
|
||||
enter)
|
||||
APP="$2"; CONTAINER_TYPE="$3"; IMAGE_TAG=$(get_running_image_tag $APP); IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
[[ ! -n "$3" ]] && dokku_log_fail "No container id specified"
|
||||
|
||||
if [[ "$3" == "--container-id" ]]; then
|
||||
[[ ! -n "$4" ]] && dokku_log_fail "No container id specified"
|
||||
|
||||
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"
|
||||
ID=$(printf -- '%s\n' "${DOKKU_APP_CIDS[@]}" | grep -e "^$4")
|
||||
shift 4
|
||||
else
|
||||
DOKKU_APP_CIDS=( $(get_app_container_ids "$APP" "$CONTAINER_TYPE") )
|
||||
ID=${DOKKU_APP_CIDS[0]}
|
||||
[[ ! -n $ID ]] && dokku_log_fail "No containers found for type '$CONTAINER_TYPE'"
|
||||
shift 3
|
||||
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"
|
||||
|
||||
EXEC_CMD=""
|
||||
is_image_herokuish_based "$IMAGE" && EXEC_CMD="/exec"
|
||||
docker exec -it $ID $EXEC_CMD "${@:-/bin/bash}"
|
||||
;;
|
||||
|
||||
help | enter:help)
|
||||
cat && cat<<EOF
|
||||
enter <app> [<container-type> || --container-id <container-id>], Connect to a specific app container
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
;;
|
||||
|
||||
esac
|
||||
4
plugins/enter/plugin.toml
Normal file
4
plugins/enter/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core enter plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
git_build_app_repo() {
|
||||
verify_app_name "$1"
|
||||
@@ -23,7 +23,7 @@ git_build_app_repo() {
|
||||
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then
|
||||
dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
else
|
||||
dokku receive "$APP" "buildstep" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
dokku receive "$APP" "herokuish" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -31,16 +31,15 @@ case "$1" in
|
||||
git-hook)
|
||||
APP=$2
|
||||
|
||||
while read oldrev newrev refname
|
||||
do
|
||||
while read 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 pluginhook so we might support other methods to receive an app
|
||||
pluginhook receive-app $APP $newrev
|
||||
if [[ $refname = "refs/heads/master" ]]; then
|
||||
# broken out into plugin so we might support other methods to receive an app
|
||||
plugn trigger receive-app $APP $newrev
|
||||
else
|
||||
if test -f "$PLUGIN_PATH"/enabled/*/receive-branch; then
|
||||
pluginhook receive-branch $APP $newrev $refname
|
||||
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'"
|
||||
@@ -51,9 +50,9 @@ case "$1" in
|
||||
|
||||
git-upload-pack)
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
pluginhook git-pre-pull $APP
|
||||
plugn trigger git-pre-pull $APP
|
||||
cat | git-upload-pack "$DOKKU_ROOT/$APP"
|
||||
pluginhook git-post-pull $APP
|
||||
plugn trigger git-post-pull $APP
|
||||
;;
|
||||
|
||||
git-build)
|
||||
@@ -67,7 +66,7 @@ case "$1" in
|
||||
|
||||
git-build-locked)
|
||||
APP="$2"
|
||||
if [[ $# -ge 3 ]];then
|
||||
if [[ $# -ge 3 ]]; then
|
||||
REF="$3"
|
||||
else
|
||||
REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
|
||||
@@ -100,7 +99,7 @@ EOF
|
||||
;;
|
||||
|
||||
help | git:help)
|
||||
cat
|
||||
echo -n ""
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
4
plugins/git/plugin.toml
Normal file
4
plugins/git/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core git plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,7 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
APP="$1"; REV="$2"
|
||||
|
||||
dokku git-build $APP $REV
|
||||
# Don't trigger git build if there is no git repository.
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP/refs" ]]; then
|
||||
true
|
||||
else
|
||||
dokku git-build $APP $REV
|
||||
fi
|
||||
|
||||
49
plugins/logs/commands
Executable file
49
plugins/logs/commands
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
case "$1" in
|
||||
logs)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; verify_app_name "$2"
|
||||
APP_ROOT="$DOKKU_ROOT/$APP"
|
||||
COLORS=(36 33 32 35 31)
|
||||
|
||||
if (is_deployed "$APP"); then
|
||||
CONTAINERS=("$APP_ROOT"/CONTAINER.*)
|
||||
if [[ $3 == "-t" ]]; then
|
||||
DOKKU_LOGS_ARGS="--follow --tail 100"
|
||||
else
|
||||
DOKKU_LOGS_ARGS="--tail 100"
|
||||
fi
|
||||
((MAX_INDEX=${#CONTAINERS[*]} - 1)) || true
|
||||
for i in ${!CONTAINERS[*]}; do
|
||||
DYNO=$(echo "${CONTAINERS[i]}" | sed -r 's/.*CONTAINER\.(.*)/\1/')
|
||||
CID=$(< "${CONTAINERS[i]}")
|
||||
COLOR=${COLORS[i % ${#COLORS[*]}]}
|
||||
DOKKU_LOGS_CMD+="(docker logs -t $DOKKU_LOGS_ARGS $CID 2>&1 | sed -r 's/^([^Z]+Z )/\x1b[${COLOR}m\1$APP[$DYNO]:\x1b[0m /gm')"
|
||||
if [[ $i != "$MAX_INDEX" ]]; then
|
||||
DOKKU_LOGS_CMD+="& "
|
||||
else
|
||||
DOKKU_LOGS_CMD+="; "
|
||||
fi
|
||||
done
|
||||
bash -c "($DOKKU_LOGS_CMD)"
|
||||
else
|
||||
echo "Application's container not found"
|
||||
fi
|
||||
;;
|
||||
|
||||
help)
|
||||
cat<<EOF
|
||||
logs <app> [-t], Show the last logs for an application (-t follows)
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
4
plugins/logs/plugin.toml
Normal file
4
plugins/logs/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core logs plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
4
plugins/named-containers/plugin.toml
Normal file
4
plugins/named-containers/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core named containers plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
16
plugins/named-containers/post-deploy
Executable file
16
plugins/named-containers/post-deploy
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; APP_ROOT="$DOKKU_ROOT/$APP"
|
||||
[[ -z $(stat -t "$APP_ROOT"/CONTAINER.* 2>/dev/null) ]] && exit 0
|
||||
for container in "$APP_ROOT"/CONTAINER.*; do
|
||||
DYNO=$(echo "$container" | sed -r 's/.*CONTAINER\.(.*)/\1/') || true
|
||||
NAME="$APP.$DYNO"
|
||||
PREVIOUS=$(docker ps -a -q -f name="$NAME") || true
|
||||
if [[ -n $PREVIOUS ]]; then
|
||||
docker rename "$NAME" "$NAME.$(date +%s)" > /dev/null
|
||||
fi
|
||||
ID=$(cat "$container")
|
||||
CURRENT_NAME=$(docker inspect -f '{{.Name}}' "$ID" | tr -d /)
|
||||
docker rename "$CURRENT_NAME" "$NAME" > /dev/null
|
||||
done
|
||||
@@ -1,40 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
APP="$1"
|
||||
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
|
||||
|
||||
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
|
||||
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
|
||||
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
RE_IPV4="${RE_IPV4}\$"
|
||||
RE_IPV6="${RE_IPV6}\$"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/VHOST" ]] && GLOBAL_VHOST=$(< "$DOKKU_ROOT/VHOST")
|
||||
|
||||
if [[ -n "$NO_VHOST" ]]; then
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "false" ]]; then
|
||||
echo true # bind to external ip. VHOST is disabled
|
||||
elif [[ "$GLOBAL_VHOST" =~ $RE_IPV4 ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV6 ]]; then
|
||||
echo true # bind to external ip. GLOBAL_VHOST is somehow an IPv4 or IPv6 address
|
||||
elif [[ -z "$GLOBAL_VHOST" ]] && [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo true # bind to external ip. no GLOBAL_VHOST and no app vhost
|
||||
elif [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo false # bind to docker ip. this app has a vhost defined
|
||||
elif [[ "$(is_global_vhost_enabled $APP)" == "false" ]] && [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo true # bind to external ip. no global vhost or global vhost is an ip
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
|
||||
@@ -1,186 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " nginx:build-config nginx:access-logs nginx:error-logs nginx:disable nginx:enable help nginx:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
validate_nginx () {
|
||||
set +e
|
||||
sudo /usr/sbin/nginx -t > /dev/null 2>&1
|
||||
exit_code=$?
|
||||
set -e
|
||||
if [[ "$exit_code" -ne "0" ]]; then
|
||||
sudo /usr/sbin/nginx -t
|
||||
exit "$exit_code"
|
||||
fi
|
||||
}
|
||||
|
||||
restart_nginx () {
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
sudo /sbin/service nginx reload > /dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
case "$1" in
|
||||
nginx:build-config)
|
||||
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="${4}"
|
||||
verify_app_name "$APP"
|
||||
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
URLS_PATH="$DOKKU_ROOT/$APP/URLS"
|
||||
WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||
SSL="$DOKKU_ROOT/$APP/tls"
|
||||
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
|
||||
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="$4"
|
||||
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -z "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
shopt -s nullglob
|
||||
for DOKKU_APP_IP_FILE in $DOKKU_ROOT/$APP/IP.web.*;do
|
||||
DOKKU_APP_PORT_FILE=$(echo $DOKKU_APP_IP_FILE | sed -e "s:IP:PORT:g")
|
||||
DOKKU_APP_LISTENER_IP=$(< $DOKKU_APP_IP_FILE)
|
||||
DOKKU_APP_LISTENER_PORT=$(< $DOKKU_APP_PORT_FILE)
|
||||
nginx_build_config $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
|
||||
|
||||
DOKKU_APP_LISTENERS+=" "
|
||||
DOKKU_APP_LISTENERS+="$DOKKU_APP_LISTENER_IP:$DOKKU_APP_LISTENER_PORT"
|
||||
DOKKU_APP_LISTENERS+=" "
|
||||
done
|
||||
shopt -u nullglob
|
||||
fi
|
||||
;;
|
||||
|
||||
DOKKU_APP_CIDS=($(get_app_container_ids $APP))
|
||||
docker cp "${DOKKU_APP_CIDS[0]}:/app/nginx.conf.template" "$DOKKU_ROOT/$APP/" 2> /dev/null || true
|
||||
|
||||
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
[[ -f "$APP_NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$APP_NGINX_TEMPLATE" && NGINX_CUSTOM_TEMPLATE="true" && dokku_log_info1 'Overriding default nginx.conf with detected nginx.conf.template'
|
||||
|
||||
if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
NONSSL_VHOSTS=$(cat $VHOST_PATH)
|
||||
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
|
||||
SSL_INUSE="$SSL"
|
||||
SSL_DIRECTIVES=$(cat <<EOF
|
||||
ssl_certificate $SSL_INUSE/server.crt;
|
||||
ssl_certificate_key $SSL_INUSE/server.key;
|
||||
EOF
|
||||
)
|
||||
elif [[ -e "$WILDCARD_SSL/server.crt" ]] && [[ -e "$WILDCARD_SSL/server.key" ]]; then
|
||||
SSL_INUSE="$WILDCARD_SSL"
|
||||
SSL_DIRECTIVES=""
|
||||
fi
|
||||
|
||||
NGINX_CONF=$(mktemp -t "nginx.conf.XXXXXX")
|
||||
SCHEME="http"
|
||||
if [[ -n "$SSL_INUSE" ]]; then
|
||||
SCHEME="https"
|
||||
|
||||
[[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
|
||||
SSL_HOSTNAME=$(openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
|
||||
if [[ -n "$SSL_HOSTNAME" ]]; then
|
||||
SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g')
|
||||
[[ -z "$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH)" ]] && [[ ! "$SSL_HOSTNAME" =~ ^\*.* ]] && echo "$SSL_HOSTNAME" >> $VHOST_PATH
|
||||
fi
|
||||
|
||||
SSL_HOSTNAME_ALT=$(openssl x509 -in $SSL_INUSE/server.crt -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
|
||||
if [[ -n "$SSL_HOSTNAME_ALT" ]]; then
|
||||
SSL_HOSTNAME_ALT_REGEX=$(echo "$SSL_HOSTNAME_ALT" | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g')
|
||||
[[ -z "$(egrep "^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH)" ]] && [[ ! "$SSL_HOSTNAME_ALT" =~ ^\*.* ]] && echo "$SSL_HOSTNAME_ALT" >> $VHOST_PATH
|
||||
fi
|
||||
|
||||
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
|
||||
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
|
||||
|
||||
while read line; do
|
||||
[[ -z "$line" ]] && continue
|
||||
dokku_log_info1 "Configuring SSL for $line..."
|
||||
SSL_SERVER_NAME=$line
|
||||
NOSSL_SERVER_NAME=$line
|
||||
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
|
||||
done <<< "$SSL_VHOSTS"
|
||||
fi
|
||||
|
||||
if [[ -n "$NONSSL_VHOSTS" ]]; then
|
||||
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
|
||||
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
|
||||
[[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template"
|
||||
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
|
||||
fi
|
||||
|
||||
if [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
echo "upstream $APP { server $DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT; }" >> $NGINX_CONF
|
||||
elif [[ -n "$DOKKU_APP_LISTENERS" ]]; then
|
||||
echo "upstream $APP { " >> $NGINX_CONF
|
||||
for listener in $DOKKU_APP_LISTENERS;do
|
||||
echo " server $listener;" >> $NGINX_CONF
|
||||
done
|
||||
echo "}" >> $NGINX_CONF
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Creating $SCHEME nginx.conf"
|
||||
mv $NGINX_CONF "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
if is_deployed "$APP"; then
|
||||
dokku_log_info1 "Running nginx-pre-reload"
|
||||
pluginhook nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
|
||||
|
||||
dokku_log_verbose "Reloading nginx"
|
||||
validate_nginx && restart_nginx
|
||||
fi
|
||||
|
||||
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" > $URLS_PATH
|
||||
xargs -i echo "https://{}" <<< "${SSL_VHOSTS}" >> $URLS_PATH
|
||||
xargs -i echo "http://{}" <<< "${NONSSL_VHOSTS}" >> $URLS_PATH
|
||||
else
|
||||
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
|
||||
rm "$DOKKU_ROOT/$APP/VHOST"
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/URLS" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled, deleting $APP/URLS"
|
||||
rm "$DOKKU_ROOT/$APP/URLS"
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled, deleting nginx.conf"
|
||||
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
if is_deployed "$APP"; then
|
||||
dokku_log_info1 "VHOST support disabled, reloading nginx after nginx.conf deletion"
|
||||
validate_nginx && restart_nginx
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
nginx:import-ssl)
|
||||
nginx:access-logs|nginx:error-logs)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
[[ -t 0 ]] && echo "Tar archive containing server.crt and server.key expected on stdin" && exit 1
|
||||
APP="$2"
|
||||
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
cd $TEMP_DIR
|
||||
tar xvf - <&0
|
||||
[[ ! -f "$TEMP_DIR/server.crt" ]] && echo "Tar archive missing server.crt" && exit 1
|
||||
[[ ! -f "$TEMP_DIR/server.key" ]] && echo "Tar archive missing server.key" && exit 1
|
||||
NGINX_LOGS_TYPE=${1#nginx:}
|
||||
NGINX_LOGS_TYPE=${NGINX_LOGS_TYPE%-logs}
|
||||
NGINX_LOGS_PATH="/var/log/nginx/$APP-$NGINX_LOGS_TYPE.log"
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP/tls"
|
||||
mv "$TEMP_DIR/server.crt" "$DOKKU_ROOT/$APP/tls/server.crt"
|
||||
mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key"
|
||||
cd $DOKKU_ROOT
|
||||
rm -rf $TEMP_DIR
|
||||
dokku nginx:build-config $APP
|
||||
;;
|
||||
if [[ $3 == "-t" ]]; then
|
||||
NGINX_LOGS_ARGS="-F"
|
||||
else
|
||||
NGINX_LOGS_ARGS="-n 20"
|
||||
fi
|
||||
|
||||
tail "$NGINX_LOGS_ARGS" "$NGINX_LOGS_PATH"
|
||||
;;
|
||||
|
||||
nginx:disable)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "true" ]]; then
|
||||
config_set --no-restart $APP DOKKU_NO_NGINX=1
|
||||
disable_app_vhost $APP
|
||||
elif [[ "$(is_app_nginx_enabled $APP)" == "true" ]]; then
|
||||
config_set --no-restart $APP DOKKU_NO_NGINX=1
|
||||
nginx_build_config $APP
|
||||
else
|
||||
dokku_log_info1 "nginx is already disable for app ($APP)"
|
||||
fi
|
||||
;;
|
||||
|
||||
nginx:enable)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ "$(is_app_nginx_enabled $APP)" == "true" ]]; then
|
||||
config_unset --no-restart $APP DOKKU_NO_NGINX
|
||||
unset DOKKU_NO_NGINX
|
||||
nginx_build_config $APP
|
||||
else
|
||||
dokku_log_info1 "nginx is already enabled for app ($APP)"
|
||||
fi
|
||||
;;
|
||||
|
||||
help | nginx:help)
|
||||
cat && cat<<EOF
|
||||
nginx:import-ssl <app>, Imports a tarball from stdin; should contain server.crt and server.key
|
||||
cat<<EOF
|
||||
nginx:build-config <app>, (Re)builds nginx config for given app
|
||||
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
|
||||
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
|
||||
nginx:disable <app>, disable nginx for an application (forces container binding to external interface)
|
||||
nginx:enable <app>, enable nginx for an application
|
||||
EOF
|
||||
;;
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -7,7 +7,7 @@ case "$DOKKU_DISTRO" in
|
||||
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
|
||||
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
|
||||
add-apt-repository -y ppa:nginx/stable
|
||||
apt-get update
|
||||
apt-get update -qq > /dev/null
|
||||
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
|
||||
;;
|
||||
|
||||
|
||||
293
plugins/nginx-vhosts/functions
Executable file
293
plugins/nginx-vhosts/functions
Executable file
@@ -0,0 +1,293 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
_ipv4_regex() {
|
||||
echo "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
}
|
||||
|
||||
_ipv6_regex() {
|
||||
local RE_IPV4="$(_ipv4_regex)"
|
||||
local RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
echo "$RE_IPV6"
|
||||
}
|
||||
|
||||
get_ipv4_regex() {
|
||||
local RE_IPV4="$(_ipv4_regex)"
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
echo "${RE_IPV4}\$"
|
||||
}
|
||||
|
||||
get_ipv6_regex() {
|
||||
local RE_IPV6="$(_ipv4_regex)"
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
echo "${RE_IPV6}\$"
|
||||
}
|
||||
|
||||
is_app_nginx_enabled() {
|
||||
local APP="$1"
|
||||
verify_app_name "$APP"
|
||||
|
||||
local DOKKU_NO_NGINX=$(config_get $APP DOKKU_NO_NGINX)
|
||||
if [[ -z "$DOKKU_NO_NGINX" ]]; then
|
||||
echo true
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
}
|
||||
|
||||
is_global_vhost_enabled() {
|
||||
local GLOBAL_VHOST_FILE="$DOKKU_ROOT/VHOST"
|
||||
local GLOBAL_VHOST_ENABLED=true
|
||||
[[ -f "$GLOBAL_VHOST_FILE" ]] && local GLOBAL_VHOST=$(< "$GLOBAL_VHOST_FILE")
|
||||
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
local RE_IPV4="$(get_ipv4_regex)"
|
||||
local RE_IPV6="$(get_ipv6_regex)"
|
||||
|
||||
if [[ -z "$GLOBAL_VHOST" ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV4 ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV6 ]]; then
|
||||
local GLOBAL_VHOST_ENABLED=false
|
||||
fi
|
||||
echo $GLOBAL_VHOST_ENABLED
|
||||
}
|
||||
|
||||
is_app_vhost_enabled() {
|
||||
local APP=$1; local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
verify_app_name $APP
|
||||
|
||||
local NO_VHOST=$(config_get $APP NO_VHOST)
|
||||
local APP_VHOST_ENABLED=true
|
||||
|
||||
if [[ "$NO_VHOST" == "1" ]]; then
|
||||
local APP_VHOST_ENABLED=false
|
||||
elif [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]] && [[ ! -f "$APP_VHOST_FILE" ]] && [[ "$NO_VHOST" != "0" ]]; then
|
||||
local APP_VHOST_ENABLED=false
|
||||
fi
|
||||
|
||||
echo $APP_VHOST_ENABLED
|
||||
}
|
||||
|
||||
disable_app_vhost() {
|
||||
local APP=$1; local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST"
|
||||
verify_app_name $APP
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
|
||||
rm "$DOKKU_ROOT/$APP/VHOST"
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/URLS" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled, deleting $APP/URLS"
|
||||
rm "$DOKKU_ROOT/$APP/URLS"
|
||||
fi
|
||||
|
||||
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
|
||||
config_set $CONFIG_SET_ARGS $APP NO_VHOST=1
|
||||
}
|
||||
|
||||
validate_nginx() {
|
||||
set +e
|
||||
sudo /usr/sbin/nginx -t > /dev/null 2>&1
|
||||
exit_code=$?
|
||||
set -e
|
||||
if [[ "$exit_code" -ne "0" ]]; then
|
||||
sudo /usr/sbin/nginx -t
|
||||
exit "$exit_code"
|
||||
fi
|
||||
}
|
||||
|
||||
restart_nginx() {
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
sudo /sbin/service nginx reload > /dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
nginx_build_config() {
|
||||
local APP="$1"; local DOKKU_APP_LISTEN_PORT="$2"; local DOKKU_APP_LISTEN_IP="$3"
|
||||
verify_app_name "$APP"
|
||||
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
URLS_PATH="$DOKKU_ROOT/$APP/URLS"
|
||||
WILDCARD_SSL_PATH="$DOKKU_ROOT/tls"
|
||||
APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
|
||||
|
||||
eval "$(config_export global)"
|
||||
eval "$(config_export app $APP)"
|
||||
|
||||
if [[ ! -n "$DOKKU_NO_NGINX" ]]; then
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -z "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
shopt -s nullglob
|
||||
for DOKKU_APP_IP_FILE in $DOKKU_ROOT/$APP/IP.web.*; do
|
||||
DOKKU_APP_PORT_FILE=$(echo $DOKKU_APP_IP_FILE | sed -e "s:IP:PORT:g")
|
||||
DOKKU_APP_LISTENER_IP=$(< $DOKKU_APP_IP_FILE)
|
||||
DOKKU_APP_LISTENER_PORT=$(< $DOKKU_APP_PORT_FILE)
|
||||
|
||||
DOKKU_APP_LISTENERS+=" "
|
||||
DOKKU_APP_LISTENERS+="$DOKKU_APP_LISTENER_IP:$DOKKU_APP_LISTENER_PORT"
|
||||
DOKKU_APP_LISTENERS+=" "
|
||||
done
|
||||
shopt -u nullglob
|
||||
fi
|
||||
|
||||
DOKKU_APP_CIDS=($(get_app_container_ids $APP))
|
||||
docker cp "${DOKKU_APP_CIDS[0]}:/app/nginx.conf.template" "$DOKKU_ROOT/$APP/" 2> /dev/null || true
|
||||
|
||||
[[ -f "$APP_NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$APP_NGINX_TEMPLATE" && NGINX_CUSTOM_TEMPLATE="true" && dokku_log_info1 'Overriding default nginx.conf with detected nginx.conf.template'
|
||||
|
||||
NGINX_CONF=$(mktemp -t "nginx.conf.XXXXXX")
|
||||
SCHEME="http"
|
||||
|
||||
# if the app has is not vhost enabled then, let's make sure we're cleaned up
|
||||
[[ "$(is_app_vhost_enabled $APP)" == "false" ]] && disable_app_vhost $APP --no-restart
|
||||
|
||||
if [[ -z "$DOKKU_NGINX_PORT" ]]; then
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "false" ]]; then
|
||||
dokku_log_info1 "no nginx port set. setting to random open high port"
|
||||
local NGINX_PORT=$(get_available_port)
|
||||
else
|
||||
local NGINX_PORT=80
|
||||
fi
|
||||
config_set --no-restart $APP DOKKU_NGINX_PORT=${NGINX_PORT}
|
||||
else
|
||||
NGINX_PORT=$DOKKU_NGINX_PORT
|
||||
fi
|
||||
|
||||
NONSSL_VHOSTS=$(get_app_domains $APP)
|
||||
if [[ -n "$(is_ssl_enabled $APP)" ]]; then
|
||||
SSL_HOSTNAME=$(get_ssl_hostnames $APP)
|
||||
SSL_INUSE=true
|
||||
|
||||
[[ -n "$SSL_HOSTNAME" ]] && SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | xargs | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g' | sed 's/ /|/g')
|
||||
if ! (egrep -q "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH &> /dev/null); then
|
||||
dokku_log_info1 "No matching configured domains for $APP found in SSL certificate. Your app will show as insecure in a browser if accessed via SSL"
|
||||
dokku_log_info1 "Please add appropriate domains via the dokku domains command"
|
||||
[[ -n "$NONSSL_VHOSTS" ]] && dokku_log_info1 "Configured domains for app:"
|
||||
for domain in $(echo $NONSSL_VHOSTS| xargs); do
|
||||
dokku_log_info2 "$domain"
|
||||
done
|
||||
[[ -n "$SSL_HOSTNAME" ]] && dokku_log_info1 "Domains found in SSL certificate:"
|
||||
for domain in $(echo $SSL_HOSTNAME | xargs); do
|
||||
dokku_log_info2 "$domain"
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$(is_ssl_enabled $APP)" == "app" ]]; then
|
||||
SSL_DIRECTIVES=$(cat <<EOF
|
||||
ssl_certificate $APP_SSL_PATH/server.crt;
|
||||
ssl_certificate_key $APP_SSL_PATH/server.key;
|
||||
EOF
|
||||
)
|
||||
elif [[ "$(is_ssl_enabled $APP)" == "global" ]]; then
|
||||
SSL_DIRECTIVES=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$SSL_INUSE" ]]; then
|
||||
SCHEME="https"
|
||||
|
||||
[[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_AVAILABLE_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "true" ]]; then
|
||||
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true)
|
||||
else
|
||||
SSL_VHOSTS=$(< $DOKKU_ROOT/HOSTNAME)
|
||||
fi
|
||||
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH 2> /dev/null || true)
|
||||
|
||||
if [[ -z "$DOKKU_NGINX_SSL_PORT" ]]; then
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "false" ]]; then
|
||||
dokku_log_info1 "no nginx ssl port set. setting to random open high port"
|
||||
local NGINX_SSL_PORT=$(get_available_port)
|
||||
else
|
||||
NGINX_SSL_PORT=443
|
||||
fi
|
||||
config_set --no-restart $APP DOKKU_NGINX_SSL_PORT=${NGINX_SSL_PORT}
|
||||
else
|
||||
local NGINX_SSL_PORT=$DOKKU_NGINX_SSL_PORT
|
||||
fi
|
||||
|
||||
while read line; do
|
||||
[[ -z "$line" ]] && continue
|
||||
dokku_log_info1 "Configuring SSL for $line..."
|
||||
SSL_SERVER_NAME=$line
|
||||
NOSSL_SERVER_NAME=$line
|
||||
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
|
||||
done <<< "$SSL_VHOSTS"
|
||||
fi
|
||||
|
||||
if [[ -n "$DOKKU_SSL_TERMINATED" ]] && [[ -z "$NGINX_CUSTOM_TEMPLATE" ]]; then
|
||||
NGINX_TEMPLATE="$PLUGIN_AVAILABLE_PATH/nginx-vhosts/templates/nginx.conf.ssl_terminated.template"
|
||||
elif [[ -z "$NGINX_CUSTOM_TEMPLATE" ]]; then
|
||||
NGINX_TEMPLATE="$PLUGIN_AVAILABLE_PATH/nginx-vhosts/templates/nginx.conf.template"
|
||||
fi
|
||||
|
||||
if [[ -n "$NONSSL_VHOSTS" ]]; then
|
||||
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
|
||||
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
|
||||
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
|
||||
fi
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "false" ]] || ([[ -z "$NONSSL_VHOSTS" ]] && [[ -z "$SSL_VHOSTS" ]]); then
|
||||
sed --in-place -n -e '/^.*server_name.*$/!p' $NGINX_CONF
|
||||
fi
|
||||
|
||||
if [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
echo "upstream $APP { server $DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT; }" >> $NGINX_CONF
|
||||
elif [[ -n "$DOKKU_APP_LISTENERS" ]]; then
|
||||
echo "upstream $APP { " >> $NGINX_CONF
|
||||
for listener in $DOKKU_APP_LISTENERS; do
|
||||
echo " server $listener;" >> $NGINX_CONF
|
||||
done
|
||||
echo "}" >> $NGINX_CONF
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Creating $SCHEME nginx.conf"
|
||||
mv $NGINX_CONF "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
if is_deployed "$APP"; then
|
||||
dokku_log_info1 "Running nginx-pre-reload"
|
||||
plugn trigger nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
|
||||
|
||||
dokku_log_verbose "Reloading nginx"
|
||||
validate_nginx && restart_nginx
|
||||
fi
|
||||
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "true" ]]; then
|
||||
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" > $URLS_PATH
|
||||
xargs -i echo "https://{}" <<< "${SSL_VHOSTS}" >> $URLS_PATH
|
||||
xargs -i echo "http://{}" <<< "${NONSSL_VHOSTS}" >> $URLS_PATH
|
||||
fi
|
||||
else
|
||||
# note because this clause is long. if $DOKKU_NO_NGINX is set:
|
||||
dokku_log_info1 "nginx support is disabled for app ($APP)."
|
||||
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
dokku_log_info1 "deleting nginx.conf"
|
||||
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
if is_deployed "$APP"; then
|
||||
dokku_log_info1 "reloading nginx after nginx.conf deletion"
|
||||
validate_nginx && restart_nginx
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -18,49 +18,18 @@ if [[ ! -f /etc/nginx/conf.d/dokku.conf ]]; then
|
||||
cat<<EOF > /etc/nginx/conf.d/dokku.conf
|
||||
include $DOKKU_ROOT/*/nginx.conf;
|
||||
|
||||
server_tokens off;
|
||||
|
||||
ssl_session_cache shared:SSL:20m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
|
||||
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# ssl_certificate $DOKKU_ROOT/tls/server.crt;
|
||||
# ssl_certificate_key $DOKKU_ROOT/tls/server.key;
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat<<EOF > /etc/nginx/nginx.conf
|
||||
user www-data;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
}
|
||||
|
||||
http {
|
||||
server_tokens off;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
echo 'server_names_hash_bucket_size 512;' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
|
||||
4
plugins/nginx-vhosts/plugin.toml
Normal file
4
plugins/nginx-vhosts/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core nginx-vhosts plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,16 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
APP="$1"
|
||||
if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then
|
||||
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
|
||||
|
||||
if [[ -n "$NO_VHOST" ]]; then
|
||||
dokku_log_info1 "NO_VHOST config detected"
|
||||
if [[ "$(is_app_vhost_enabled $APP)" == "false" ]]; then
|
||||
dokku_log_info1 "VHOST support disabled. Skipping domains setup"
|
||||
elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
dokku domains:setup $APP
|
||||
fi
|
||||
|
||||
dokku nginx:build-config $APP
|
||||
nginx_build_config $APP
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
APP="$1"
|
||||
|
||||
dokku nginx:build-config $APP
|
||||
nginx_build_config $APP
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Nginx configuration when running behind a load balancer that terminates SSL
|
||||
# connections (e.g. AWS ELB)
|
||||
server {
|
||||
listen [::]:$NGINX_PORT;
|
||||
listen $NGINX_PORT;
|
||||
server_name $NOSSL_SERVER_NAME;
|
||||
location / {
|
||||
proxy_pass http://$APP;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host \$http_host;
|
||||
proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto;
|
||||
proxy_set_header X-Forwarded-For \$http_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Port \$http_x_forwarded_port;
|
||||
proxy_set_header X-Request-Start \$msec;
|
||||
}
|
||||
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
server {
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
listen [::]:$NGINX_PORT;
|
||||
listen $NGINX_PORT;
|
||||
server_name $NOSSL_SERVER_NAME;
|
||||
access_log /var/log/nginx/${APP}-access.log;
|
||||
error_log /var/log/nginx/${APP}-error.log;
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
server {
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
listen [::]:$NGINX_PORT;
|
||||
listen $NGINX_PORT;
|
||||
server_name $NOSSL_SERVER_NAME;
|
||||
access_log /var/log/nginx/${APP}-access.log;
|
||||
error_log /var/log/nginx/${APP}-error.log;
|
||||
return 301 https://\$host\$request_uri;
|
||||
return 301 https://\$host:$NGINX_SSL_PORT\$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:443 ssl spdy;
|
||||
listen 443 ssl spdy;
|
||||
listen [::]:$NGINX_SSL_PORT ssl spdy;
|
||||
listen $NGINX_SSL_PORT ssl spdy;
|
||||
server_name $SSL_SERVER_NAME;
|
||||
access_log /var/log/nginx/${APP}-access.log;
|
||||
error_log /var/log/nginx/${APP}-error.log;
|
||||
$SSL_DIRECTIVES
|
||||
|
||||
keepalive_timeout 70;
|
||||
add_header Alternate-Protocol 443:npn-spdy/2;
|
||||
add_header Alternate-Protocol $NGINX_SSL_PORT:npn-spdy/2;
|
||||
location / {
|
||||
|
||||
gzip on;
|
||||
|
||||
85
plugins/plugin/commands
Executable file
85
plugins/plugin/commands
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " plugin plugin:install plugin:install-dependencies plugin:update plugin:disable plugin:enable plugin:uninstall help plugin:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
|
||||
|
||||
case "$1" in
|
||||
plugin)
|
||||
plugn list
|
||||
;;
|
||||
|
||||
plugin:install)
|
||||
case "$2" in
|
||||
--core)
|
||||
[[ "$#" -gt 2 ]] && dokku_log_info1_quiet "Cannot install additional core plugins, running core plugin install trigger"
|
||||
PLUGIN_PATH="$PLUGIN_CORE_PATH" plugn trigger install
|
||||
;;
|
||||
https:*|git:*)
|
||||
PLUGIN_GIT_URL="$2"
|
||||
download_and_enable_plugin "$PLUGIN_GIT_URL" "$3"
|
||||
plugn trigger install
|
||||
;;
|
||||
*)
|
||||
plugn trigger install
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
plugin:install-dependencies)
|
||||
if [[ $2 == "--core" ]]; then
|
||||
export PLUGIN_PATH="$PLUGIN_CORE_PATH"
|
||||
fi
|
||||
plugn trigger dependencies
|
||||
;;
|
||||
|
||||
plugin:update)
|
||||
case "$2" in
|
||||
https:*|git:*)
|
||||
PLUGIN_GIT_URL="$2"
|
||||
download_and_enable_plugin "$PLUGIN_GIT_URL" "$3"
|
||||
plugn trigger update
|
||||
;;
|
||||
*)
|
||||
plugn trigger update
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
plugin:disable)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to disable"
|
||||
PLUGIN="$2"
|
||||
disable_plugin "$PLUGIN"
|
||||
;;
|
||||
|
||||
plugin:enable)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
|
||||
PLUGIN="$2"
|
||||
enable_plugin "$PLUGIN"
|
||||
;;
|
||||
|
||||
plugin:uninstall)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
|
||||
PLUGIN="$2"
|
||||
uninstall_plugin "$PLUGIN"
|
||||
;;
|
||||
|
||||
help | plugin:help)
|
||||
cat<<EOF
|
||||
plugin, Print active plugins
|
||||
plugin:install [--core|git-url], Optionally download git-url & run install trigger for active plugins (or only core ones)
|
||||
plugin:install-dependencies [--core], Run install-dependencies trigger for active plugins (or only core ones)
|
||||
plugin:update [git-url], Optionally download git-url & run update trigger for active plugins
|
||||
plugin:enable <name>, Enable a previously disabled plugin
|
||||
plugin:disable <name>, Disable an installed plugin (third-party only)
|
||||
plugin:uninstall <name>, Uninstall a plugin (third-party only)
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
48
plugins/plugin/functions
Executable file
48
plugins/plugin/functions
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
disable_plugin() {
|
||||
local PLUGIN="$1"
|
||||
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot disable a core plugin"
|
||||
[[ ! -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already disabled"
|
||||
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
|
||||
plugn disable $PLUGIN
|
||||
dokku_log_info1_quiet "Plugin $PLUGIN disabled"
|
||||
}
|
||||
|
||||
enable_plugin() {
|
||||
local PLUGIN="$1"
|
||||
[[ -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already enabled"
|
||||
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
|
||||
plugn enable $PLUGIN
|
||||
dokku_log_info1_quiet "Plugin $PLUGIN enabled"
|
||||
}
|
||||
|
||||
download_plugin() {
|
||||
local PLUGIN_GIT_URL="$1"
|
||||
local PLUGIN_NAME="$2"
|
||||
plugn install "$PLUGIN_GIT_URL" "$PLUGIN_NAME"
|
||||
}
|
||||
|
||||
download_and_enable_plugin() {
|
||||
local PLUGIN_GIT_URL="$1"
|
||||
local CUSTOM_NAME="$2"
|
||||
local PLUGIN_NAME=${CUSTOM_NAME:-$(plugin_name "$PLUGIN_GIT_URL")}
|
||||
dokku_log_info1_quiet "Cloning plugin repo $PLUGIN_GIT_URL to $PLUGIN_AVAILABLE_PATH/$PLUGIN_NAME"
|
||||
download_plugin "$PLUGIN_GIT_URL" "$PLUGIN_NAME"
|
||||
enable_plugin "$PLUGIN_NAME"
|
||||
}
|
||||
|
||||
uninstall_plugin() {
|
||||
local PLUGIN_NAME="$1"
|
||||
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot uninstall a core plugin"
|
||||
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
|
||||
plugn uninstall $PLUGIN_NAME
|
||||
dokku_log_info1_quiet "Plugin $PLUGIN uninstalled"
|
||||
}
|
||||
|
||||
plugin_name() {
|
||||
local PLUGIN_GIT_URL="$1"
|
||||
echo "$PLUGIN_GIT_URL" | awk -F '/' '{ print $NF }' | sed -e "s:.git::g" | sed 's:^dokku-::'
|
||||
}
|
||||
4
plugins/plugin/plugin.toml
Normal file
4
plugins/plugin/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core plugin plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,56 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " ps ps:start ps:stop ps:rebuild ps:rebuildall ps:restart ps:restartall ps:scale help ps:help " == *" $1 "* ]] || exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$(dirname $0)/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
case "$1" in
|
||||
ps)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"; CONTAINER_IDS=$(get_app_container_ids $APP)
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; verify_app_name "$APP"; DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids $APP)
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
for CID in $CONTAINER_IDS; do
|
||||
docker exec -ti "$CID" /bin/sh -c "ps auxwww"
|
||||
for CID in $DOKKU_APP_RUNNING_CONTAINER_IDS; do
|
||||
has_tty && DOKKU_RUN_OPTS="-i -t"
|
||||
dokku_log_info1_quiet "running processes in container: $CID"
|
||||
docker exec $DOKKU_RUN_OPTS $CID /bin/sh -c "ps auxwww"
|
||||
done
|
||||
;;
|
||||
;;
|
||||
|
||||
ps:start)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"; APP="$2"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP);
|
||||
verify_app_name "$APP"
|
||||
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
if ! (is_app_running $APP); then
|
||||
release_and_deploy $APP
|
||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
||||
else
|
||||
echo "App $APP already running"
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
|
||||
ps:stop)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids $APP)
|
||||
verify_app_name "$APP"
|
||||
|
||||
APP="$2"; CONTAINER_IDS=$(get_app_container_ids $APP)
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids $APP)
|
||||
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
|
||||
echo "Stopping $APP ..."
|
||||
docker stop $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true
|
||||
else
|
||||
echo "App $APP already stopped"
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
|
||||
ps:rebuild)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; verify_app_name "$APP"
|
||||
|
||||
pluginhook receive-app $APP
|
||||
;;
|
||||
plugn trigger receive-app $APP
|
||||
;;
|
||||
|
||||
ps:rebuildall)
|
||||
shopt -s nullglob
|
||||
@@ -60,17 +61,17 @@ case "$1" in
|
||||
is_deployed $APP && dokku ps:rebuild $APP
|
||||
done
|
||||
shopt -u nullglob
|
||||
;;
|
||||
;;
|
||||
|
||||
ps:restart)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP"
|
||||
|
||||
APP="$2"
|
||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
release_and_deploy $APP
|
||||
;;
|
||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
||||
;;
|
||||
|
||||
ps:restartall)
|
||||
shopt -s nullglob
|
||||
@@ -80,29 +81,37 @@ case "$1" in
|
||||
dokku ps:restart $APP
|
||||
done
|
||||
shopt -u nullglob
|
||||
;;
|
||||
;;
|
||||
|
||||
ps:scale)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP"
|
||||
|
||||
APP="$2"; DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
shift 2
|
||||
|
||||
generate_scale_file "$APP"
|
||||
[[ ! -e $DOKKU_SCALE_FILE ]] && generate_scale_file "$APP" "$IMAGE_TAG"
|
||||
if [[ -z "$@" ]];then
|
||||
dokku_log_info1 "Scaling for $APP"
|
||||
dokku_log_info2 "$(< $DOKKU_SCALE_FILE)"
|
||||
dokku_log_info1_quiet "Scaling for $APP"
|
||||
dokku_col_log_info1_quiet "proctype" "qty"
|
||||
dokku_col_log_info1_quiet "--------" "---"
|
||||
while read line || [[ -n "$line" ]]; do
|
||||
[[ -z "$line" ]] && continue
|
||||
PROC_NAME=${line%%=*}
|
||||
PROC_COUNT=${line#*=}
|
||||
dokku_col_log_info1 "$PROC_NAME" "$PROC_COUNT"
|
||||
done < "$DOKKU_SCALE_FILE"
|
||||
else
|
||||
set_scale "$APP" "$@"
|
||||
release_and_deploy "$APP"
|
||||
release_and_deploy "$APP" "$IMAGE_TAG"
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
|
||||
help | ps:help)
|
||||
cat && cat<<EOF
|
||||
cat<<EOF
|
||||
ps <app>, List processes running in app container(s)
|
||||
ps:scale <app> <proc>=<count> [<proc>=<count>], Set how many instances of a given process to run
|
||||
ps:scale [<app> <proc>=<count> [<proc>=<count>]], Get/Set how many instances of a given process to run
|
||||
ps:start <app>, Start app container(s)
|
||||
ps:stop <app>, Stop app container(s)
|
||||
ps:rebuild <app>, Rebuild an app
|
||||
|
||||
@@ -1,41 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
release_and_deploy() {
|
||||
source "$(dirname $0)/../common/functions"
|
||||
local APP="$1"; local IMAGE="dokku/$APP"
|
||||
|
||||
if verify_image "$IMAGE"; then
|
||||
if is_image_buildstep_based "$IMAGE"; then
|
||||
IMAGE_SOURCE_TYPE="buildstep"
|
||||
else
|
||||
IMAGE_SOURCE_TYPE="dockerfile"
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Releasing $APP ..."
|
||||
dokku release "$APP" "$IMAGE_SOURCE_TYPE"
|
||||
dokku_log_info1 "Deploying $APP ..."
|
||||
dokku deploy "$APP"
|
||||
dokku_log_info2 "Application deployed:"
|
||||
dokku urls $APP | sed "s/^/ /"
|
||||
echo
|
||||
fi
|
||||
print_dokku_scale_file() {
|
||||
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
while read line || [[ -n "$line" ]]; do
|
||||
dokku_log_info2_quiet "$line"
|
||||
done < "$DOKKU_SCALE_FILE"
|
||||
}
|
||||
|
||||
generate_scale_file() {
|
||||
local APP="$1"; local IMAGE="dokku/$APP"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
local APP="$1"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name $APP $IMAGE_TAG); local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
|
||||
verify_app_name "$APP"
|
||||
|
||||
copy_from_image "$IMAGE" "/app/DOKKU_SCALE" "$DOKKU_ROOT/$APP" 2>/dev/null || true
|
||||
if [[ ! -f $DOKKU_SCALE_FILE ]]; then
|
||||
dokku_log_info1_quiet "DOKKU_SCALE not found in app image. Defaulting to a single web process"
|
||||
echo "web=1" >> $DOKKU_SCALE_FILE
|
||||
dokku_log_info1_quiet "DOKKU_SCALE file not found in app image. Generating one based on Procfile..."
|
||||
|
||||
TMP_WORK_DIR=$(mktemp -d)
|
||||
trap 'rm -rf "$TMP_WORK_DIR" > /dev/null' RETURN
|
||||
|
||||
copy_from_image "$IMAGE" "/app/Procfile" "$TMP_WORK_DIR" 2>/dev/null || true
|
||||
local PROCFILE="$TMP_WORK_DIR/Procfile"
|
||||
if [[ ! -e "$PROCFILE" ]]; then
|
||||
echo "web=1" >> $DOKKU_SCALE_FILE
|
||||
else
|
||||
while read line || [[ -n "$line" ]]; do
|
||||
[[ -z "$line" ]] && continue
|
||||
NAME=${line%%:*}
|
||||
NUM_PROCS=0
|
||||
[[ "$NAME" == "web" ]] && NUM_PROCS=1
|
||||
echo "$NAME=$NUM_PROCS" >> $DOKKU_SCALE_FILE
|
||||
done < "$PROCFILE"
|
||||
fi
|
||||
dokku_log_info1_quiet "New DOKKU_SCALE file generated"
|
||||
while read line || [ -n "$line" ]
|
||||
do
|
||||
dokku_log_info2_quiet "$line"
|
||||
done < "$DOKKU_SCALE_FILE"
|
||||
else
|
||||
dokku_log_info1_quiet "DOKKU_SCALE file found"
|
||||
fi
|
||||
print_dokku_scale_file $APP
|
||||
}
|
||||
|
||||
set_scale() {
|
||||
@@ -47,11 +49,10 @@ set_scale() {
|
||||
PROC_COUNT=${procscale#*=}
|
||||
is_number $PROC_COUNT || dokku_log_fail "ps:scale $PROC_COUNT is not a number"
|
||||
dokku_log_info1_quiet "Scaling $APP:$PROC_NAME to $PROC_COUNT"
|
||||
if (egrep -q ^${PROC_NAME}= $DOKKU_SCALE_FILE > /dev/null 2>&1);then
|
||||
if (egrep -q ^${PROC_NAME}= $DOKKU_SCALE_FILE > /dev/null 2>&1); then
|
||||
sed --in-place "s:^${PROC_NAME}=.*:$PROC_NAME=$PROC_COUNT:g" $DOKKU_SCALE_FILE
|
||||
else
|
||||
echo "$PROC_NAME=$PROC_COUNT" >> $DOKKU_SCALE_FILE
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user