Compare commits
330 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d10d4cc55c | ||
|
|
2301efa460 | ||
|
|
d00284166f | ||
|
|
f279ce44b2 | ||
|
|
36215828f1 | ||
|
|
0623af86d6 | ||
|
|
c6976499ad | ||
|
|
01bd69100c | ||
|
|
541d73ad93 | ||
|
|
6b159c32cf | ||
|
|
5f2968d1b0 | ||
|
|
0e768d107a | ||
|
|
3557ff16dc | ||
|
|
30131ef363 | ||
|
|
946c424734 | ||
|
|
f42b293836 | ||
|
|
b691c0affc | ||
|
|
48fa04a05b | ||
|
|
8c14bb9aeb | ||
|
|
ca2de6a4a3 | ||
|
|
755499797e | ||
|
|
f2a3cfc0b4 | ||
|
|
a42786a465 | ||
|
|
de0a467c97 | ||
|
|
ab23a4b6f1 | ||
|
|
87aed0eadf | ||
|
|
9a86549359 | ||
|
|
2eeb0069d5 | ||
|
|
f536a05e06 | ||
|
|
26b95854d4 | ||
|
|
775432c73f | ||
|
|
84ee5995f4 | ||
|
|
91e9bb9670 | ||
|
|
c6a8bd669f | ||
|
|
d9d0a932b0 | ||
|
|
a91d45c397 | ||
|
|
98c81513aa | ||
|
|
a7e5f2abdc | ||
|
|
0aa0c884d3 | ||
|
|
dfa39fc590 | ||
|
|
cbd442fc2e | ||
|
|
ebd2778f5b | ||
|
|
5887d4ddfa | ||
|
|
36e9b4b2ae | ||
|
|
81d31c9934 | ||
|
|
4aaefb0c4c | ||
|
|
6aac1ea0d1 | ||
|
|
bd275d9b5d | ||
|
|
8c0dbc7d6a | ||
|
|
07194ca17f | ||
|
|
325c6d44dd | ||
|
|
168ed1716c | ||
|
|
3de8c3002a | ||
|
|
1cbbfb195f | ||
|
|
dceaef20ed | ||
|
|
ebbbcb99f2 | ||
|
|
3e70dbb836 | ||
|
|
f1c74b08cb | ||
|
|
451abcf8f3 | ||
|
|
98f03c249b | ||
|
|
4c4248d65b | ||
|
|
889c11d84b | ||
|
|
c0581a0e37 | ||
|
|
7e45f1173f | ||
|
|
21a94b6dca | ||
|
|
6cd50cb372 | ||
|
|
bde77dbf78 | ||
|
|
bd261e6847 | ||
|
|
f7863c8391 | ||
|
|
e8a532645f | ||
|
|
af0d2e6f7a | ||
|
|
0786954d34 | ||
|
|
a662046f95 | ||
|
|
77d7f63857 | ||
|
|
73814a5b65 | ||
|
|
4ba7d4ea10 | ||
|
|
c343316864 | ||
|
|
aa6abe0fd3 | ||
|
|
bf17023639 | ||
|
|
97513dee91 | ||
|
|
fceb412fb1 | ||
|
|
ef490f0a05 | ||
|
|
e0127250ae | ||
|
|
fcebbd67df | ||
|
|
d97fc1cfb8 | ||
|
|
9dba48fc19 | ||
|
|
b6db484393 | ||
|
|
7cdc68a007 | ||
|
|
1d93246af8 | ||
|
|
abce952d0f | ||
|
|
0b30bc8034 | ||
|
|
9882c94eec | ||
|
|
9a02f3f1dc | ||
|
|
5f1dc46392 | ||
|
|
c4462c4da4 | ||
|
|
f708964c5f | ||
|
|
d514ca0bb5 | ||
|
|
5b21cabff3 | ||
|
|
6e36f95bab | ||
|
|
ae1b1c7274 | ||
|
|
53a76b1353 | ||
|
|
5fd1772c3a | ||
|
|
ab0cc6c444 | ||
|
|
8ae597ad1d | ||
|
|
024ff6e489 | ||
|
|
246a50a592 | ||
|
|
6d514e72fa | ||
|
|
e6e5ede436 | ||
|
|
a19efc1cfa | ||
|
|
28a36c4908 | ||
|
|
ef083e6289 | ||
|
|
6e0c376b62 | ||
|
|
c9a0f88bf1 | ||
|
|
f558008574 | ||
|
|
b44bc686a1 | ||
|
|
037b99865d | ||
|
|
72ed9dbcce | ||
|
|
5d7b2a84f4 | ||
|
|
1b50b4ab0a | ||
|
|
bc9a60f696 | ||
|
|
44ce5c76ae | ||
|
|
702e9cf66c | ||
|
|
be26f45b5a | ||
|
|
f13ee16ab8 | ||
|
|
36dc98452d | ||
|
|
82f13af166 | ||
|
|
23ad4bb230 | ||
|
|
a8ccc7d2a7 | ||
|
|
0a533c754f | ||
|
|
f6efb53491 | ||
|
|
cf4a533f2f | ||
|
|
b4552237b6 | ||
|
|
e8d0965a33 | ||
|
|
bb9f764b9f | ||
|
|
9193b68854 | ||
|
|
db435c40e5 | ||
|
|
bf84405b43 | ||
|
|
833a64cc0e | ||
|
|
54fb2b5d75 | ||
|
|
85fafcf170 | ||
|
|
815cd530c8 | ||
|
|
ebdf38e136 | ||
|
|
a93f504d45 | ||
|
|
cae561f7b9 | ||
|
|
f9969a0e61 | ||
|
|
06ce3dfadb | ||
|
|
ab1d15216c | ||
|
|
e8cfbfad36 | ||
|
|
70de587f6c | ||
|
|
e7ee7a1781 | ||
|
|
c72bbf41ea | ||
|
|
34343a846d | ||
|
|
e0a70411dd | ||
|
|
947b2d4db6 | ||
|
|
3714a231a9 | ||
|
|
39984980fb | ||
|
|
c7becc6cad | ||
|
|
74f27480fc | ||
|
|
33d3722060 | ||
|
|
696df45306 | ||
|
|
1b4559c4a4 | ||
|
|
bd132ed7c6 | ||
|
|
66696d0b46 | ||
|
|
943e032d12 | ||
|
|
ff7429fd00 | ||
|
|
236a279793 | ||
|
|
7e206b3ba0 | ||
|
|
f612709d7d | ||
|
|
76412f6ade | ||
|
|
45c7cd6e8b | ||
|
|
67192cf664 | ||
|
|
3a77c38a2d | ||
|
|
810892bf40 | ||
|
|
4b7384fc98 | ||
|
|
1bdcdc397e | ||
|
|
61855fd14b | ||
|
|
4a9ac117e0 | ||
|
|
0d06903b89 | ||
|
|
a70217b791 | ||
|
|
71c698f6b1 | ||
|
|
eec0e5df01 | ||
|
|
f5020659f3 | ||
|
|
e26c5a7970 | ||
|
|
8b697920e2 | ||
|
|
415b38bd64 | ||
|
|
5eb69d33d1 | ||
|
|
7c44fb8d50 | ||
|
|
9a9aec31b7 | ||
|
|
26e77a693a | ||
|
|
29ff230084 | ||
|
|
21ed81d39e | ||
|
|
77d53b1009 | ||
|
|
664683c6e4 | ||
|
|
361ee01ab0 | ||
|
|
6889e65077 | ||
|
|
bd9d9fb5b9 | ||
|
|
231435001c | ||
|
|
05bf72e0d8 | ||
|
|
4b70aaa038 | ||
|
|
d52f676a84 | ||
|
|
4a1717e837 | ||
|
|
5aaa88f41e | ||
|
|
8300f433e9 | ||
|
|
bd2867b846 | ||
|
|
da1a47b57d | ||
|
|
75bb83bdec | ||
|
|
5bca600894 | ||
|
|
607b11ab6b | ||
|
|
6543647b3c | ||
|
|
57b317b0a4 | ||
|
|
d5cc136df2 | ||
|
|
0731616ebf | ||
|
|
6957a33ec7 | ||
|
|
46c274dcf2 | ||
|
|
ae21056401 | ||
|
|
30414cbd0c | ||
|
|
87574f7d76 | ||
|
|
30d8ebffb9 | ||
|
|
71876756a4 | ||
|
|
b1b85b4106 | ||
|
|
196b5d08eb | ||
|
|
2026a2731d | ||
|
|
c8d932f768 | ||
|
|
752a0cacd9 | ||
|
|
ecc6c9e01d | ||
|
|
7e9f98b513 | ||
|
|
0f514f300e | ||
|
|
017cfef6a2 | ||
|
|
81512504a7 | ||
|
|
becf7c1f86 | ||
|
|
9e6c89428e | ||
|
|
8d96be73b7 | ||
|
|
21c8639397 | ||
|
|
1699c6f3a3 | ||
|
|
70c947289f | ||
|
|
a4e54b6d00 | ||
|
|
ab9780d971 | ||
|
|
f5ba843cf3 | ||
|
|
052f2a5868 | ||
|
|
893df14c3e | ||
|
|
43c521c193 | ||
|
|
2a1d3877f1 | ||
|
|
4d735b4d88 | ||
|
|
b8b6d64f75 | ||
|
|
2b65def123 | ||
|
|
7fe69fa269 | ||
|
|
84367e1c16 | ||
|
|
0faf305f28 | ||
|
|
e64f7b34ff | ||
|
|
5ea4c9a73d | ||
|
|
7e7931f1ce | ||
|
|
428beb3413 | ||
|
|
9aab7dce7d | ||
|
|
2478556df1 | ||
|
|
a2d4ba4689 | ||
|
|
4ab9632526 | ||
|
|
baa819c2a5 | ||
|
|
aaf8bc811a | ||
|
|
53dabf7fd0 | ||
|
|
7ca4cba8ec | ||
|
|
5965b70b39 | ||
|
|
23db07ed4e | ||
|
|
53e75e7898 | ||
|
|
16d15ae9bf | ||
|
|
3def0ae036 | ||
|
|
31ab2f97f6 | ||
|
|
8126c63d6e | ||
|
|
beb42b53b2 | ||
|
|
6df38a56d1 | ||
|
|
68debb44f7 | ||
|
|
f27096f235 | ||
|
|
f2a623fde0 | ||
|
|
7ee26d41f7 | ||
|
|
55c77773ab | ||
|
|
147abc5c6b | ||
|
|
e6f2ee6499 | ||
|
|
8f671b43ae | ||
|
|
617ca885f1 | ||
|
|
1813317e86 | ||
|
|
9bf7ddc258 | ||
|
|
77f211c372 | ||
|
|
939cb67daa | ||
|
|
1ea60a16e5 | ||
|
|
98bc513336 | ||
|
|
b6d5d291b0 | ||
|
|
6f6fa709ec | ||
|
|
82a6dbf887 | ||
|
|
dee879538c | ||
|
|
0351bf73b0 | ||
|
|
5d08964699 | ||
|
|
96b4ffbf5b | ||
|
|
7ad723f23d | ||
|
|
a97f1d02cf | ||
|
|
fe8e97b7cb | ||
|
|
b13de85477 | ||
|
|
ced920eb74 | ||
|
|
eded6cffe0 | ||
|
|
9d7a67ae7f | ||
|
|
638807685a | ||
|
|
529289f364 | ||
|
|
2fdd261961 | ||
|
|
0bce73d690 | ||
|
|
0107909a85 | ||
|
|
d41a53d9db | ||
|
|
af0fb558f6 | ||
|
|
1452e88248 | ||
|
|
d1b848e3eb | ||
|
|
d6273b4751 | ||
|
|
5bd5e6249b | ||
|
|
4033266664 | ||
|
|
9cbe771123 | ||
|
|
a545585ea1 | ||
|
|
2efa8483e2 | ||
|
|
a3961e40ee | ||
|
|
f9b1a74edf | ||
|
|
e1753bbac4 | ||
|
|
13392dcf5b | ||
|
|
879d47b30d | ||
|
|
bb61aaa85c | ||
|
|
d5b2d0d98e | ||
|
|
1b7761ce8d | ||
|
|
8ab1342110 | ||
|
|
7c0eb20de8 | ||
|
|
c26258bd2b | ||
|
|
d04c04ac17 | ||
|
|
c5b53afd8b | ||
|
|
9ac7b00718 | ||
|
|
59f815962d | ||
|
|
bb33a2fe27 | ||
|
|
914f695eab |
68
.github/workflows/codeql-analysis.yml
vendored
Normal file
68
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
# ******** NOTE ********
|
||||
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '18 22 * * 2'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'go' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
201
HISTORY.md
201
HISTORY.md
@@ -1,5 +1,206 @@
|
||||
# History
|
||||
|
||||
## 0.22.2
|
||||
|
||||
Install/update via the bootstrap script:
|
||||
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.2/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.22.2 bash bootstrap.sh
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #4243: @josegonzalez Do not delete app when the app name is invalid
|
||||
|
||||
### New Features
|
||||
|
||||
- #4141: @josegonzalez Always initialize git repository
|
||||
|
||||
### Other
|
||||
|
||||
- #4244: @dependabot-preview[bot] chore(deps): bump monolog/monolog from 1.25.5 to 1.26.0 in /tests/apps/php
|
||||
|
||||
## 0.22.1
|
||||
|
||||
Install/update via the bootstrap script:
|
||||
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.1/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.22.1 bash bootstrap.sh
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #4238: @josegonzalez Ensure dead files are created for docker object retirement
|
||||
- #4239: @josegonzalez Ensure all byte output is trimmed of whitespace
|
||||
- #4228: @Cellane Fix tags:deploy command for images that contain ONBUILD directive
|
||||
- #4233: @josegonzalez Properly parse releease command when there is an entrypoint
|
||||
- #4215: @josegonzalez Implement missing cleanup routines
|
||||
- #4212: @josegonzalez Cleanup docker options during post-delete
|
||||
- #4211: @ml-milan-vit Make the dokku-update command compatible with Dokku 0.22+
|
||||
|
||||
### New Features
|
||||
|
||||
- #4242: @josegonzalez Remove reference to 'whitelist'
|
||||
- #4220: @josegonzalez Update plugn from 0.5.0 to 0.5.1
|
||||
- #4241: @josegonzalez Properly handle stdout when capturing plugn output
|
||||
- #4237: @josegonzalez Release dokku-update 0.2.0
|
||||
- #4225: @znz Accept first pushed branch as deploy-branch
|
||||
|
||||
### Documentation
|
||||
|
||||
- #4236: @josegonzalez Remove note regarding not having an official client
|
||||
- #4234: @josegonzalez Switch to bats --filter for running a single test
|
||||
- #4222: @leopolicastro Fix typo in deployment tasks documentation
|
||||
- #4221: @srr013 Updating readme for clarity on git push step
|
||||
- #4214: @josegonzalez Expand backup and restore documentation
|
||||
- #4213: @josegonzalez Enhance the 'plugin' plugin documentation
|
||||
|
||||
### Tests
|
||||
|
||||
- #4218: @josegonzalez Enable compilation cache
|
||||
|
||||
### Other
|
||||
|
||||
- #4230: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 186 to 187 in /tests/apps/php
|
||||
- #4223: @dependabot-preview[bot] chore(deps): bump jetty-servlet from 9.4.35.v20201120 to 11.0.0 in /tests/apps/java
|
||||
- #4224: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 185 to 186 in /tests/apps/php
|
||||
|
||||
## 0.22.0
|
||||
|
||||
Install/update via the bootstrap script:
|
||||
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.0/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.22.0 bash bootstrap.sh
|
||||
```
|
||||
|
||||
See the [0.22.0 migration guide](/docs/appendices/0.22.0-migration-guide.md) for more information on migrating to 0.22.0.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #4204: @josegonzalez Ensure the image is not an empty string
|
||||
- #4198: @josegonzalez Reference extracted Procfile
|
||||
- #4194: @josegonzalez Drop appName check in apps:report
|
||||
- #4183: @josegonzalez Embed pb.UnimplementedGreeterServer to avoid linting issues
|
||||
- #4182: @josegonzalez Upgrade herokuish to fix nodejs tests
|
||||
- #4173: @karimsan Add build-essential to Vagrant provision
|
||||
- #4181: @josegonzalez Conditionally mount the dokku-arch folder if it exists
|
||||
- #4130: @josegonzalez Clear proxy configs on boot
|
||||
- #4131: @josegonzalez Bump minimum docker version
|
||||
- #4123: @fomojola Support for expected CHECKS text with special characters
|
||||
- #4115: @josegonzalez Add missing labels to built images
|
||||
- #4116: @Schlepptop Ensure config:clear an be called
|
||||
|
||||
### New Features
|
||||
|
||||
- #4209: @josegonzalez Add experimental support for Cloud Native Buildpacks (CNB)
|
||||
- #4210: @josegonzalez Add migration guide link to release notes
|
||||
- #4203: @josegonzalez Cleanup log output for failure case
|
||||
- #4208: @ankane Add ability to change the access log format
|
||||
- #4202: @josegonzalez Schedule related images for cleanup when retiring containers
|
||||
- #4197: @josegonzalez Retire intermediate containers after use
|
||||
- #4128: @fomojola Added the container index to the network-compute-ports trigger
|
||||
- #4191: @josegonzalez Create codeql-analysis.yml
|
||||
- #4139: @Yihao-G Allow controlling Nginx proxy-buffer-size, proxy-buffering, proxy-buffers, proxy-busy-buffers-size
|
||||
- #4156: @ltalirz When `cert:add` remove previous cert before copying the new cert
|
||||
- #4129: @josegonzalez Prohibit non-dns names for apps and process types
|
||||
- #4125: @josegonzalez Allow customizing the various nginx templates
|
||||
- #4121: @josegonzalez Add ability to disable custom ninx.conf.sigil extraction
|
||||
|
||||
### Refactors
|
||||
|
||||
- #4160: @nerg4l Rewrite logs plugin in Go
|
||||
- #4149: @josegonzalez Rewrite ps plugin in golang
|
||||
- #4080: @hugopeixoto Stop using VHOST when listing app domains and urls
|
||||
- #4117: @josegonzalez Rewrite app-json plugin in golang
|
||||
- #4113: @josegonzalez Drop herokuish release code
|
||||
|
||||
### Documentation
|
||||
|
||||
- #4196: @josegonzalez Correctly doc apps:report output
|
||||
- #4195: @luizpicolo Fix whitespace in process-management docs
|
||||
- #4184: @badsyntax Add note regarding using plugin triggers instead of sourcing functions
|
||||
- #4188: @fomojola Added the autosync community plugin
|
||||
- #4187: @nahtnam Add `-p` flag to "Run on External Volume" tutorial
|
||||
- #4186: @badsyntax Add dokku-discourse to community plugins list
|
||||
- #4170: @chrisjsimpson Add note on how to enable buildkit usage
|
||||
- #4168: @josegonzalez Revert "The default branch for ruby-getting-started is 'main', not 'master"
|
||||
- #4167: @nateww The default branch for ruby-getting-started is 'main', not 'master
|
||||
- #4135: @znz Fix broken table
|
||||
- #4140: @swrobel Note Ubuntu 20.04 support in README
|
||||
- #4136: @hugopeixoto Update push command for sample app in docs
|
||||
- #4124: @josegonzalez Note that docker options require app rebuilds
|
||||
- #4098: @carlosgeos Add a note on how nginx handles load balancing
|
||||
- #4111: @josegonzalez Add large version of dokku image
|
||||
- #4100: @turicas Fix markdown syntax in nginx docs
|
||||
|
||||
### Other
|
||||
|
||||
- #4201: @dependabot-preview[bot] chore(deps): bump jetty-servlet from 9.4.34.v20201102 to 9.4.35.v20201120 in /tests/apps/java
|
||||
- #4200: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 183 to 185 in /tests/apps/php
|
||||
- #4189: @dependabot-preview[bot] chore(deps): bump thin from 1.7.2 to 1.8.0 in /tests/apps/ruby
|
||||
- #4175: @dependabot-preview[bot] chore(deps): bump jetty-servlet from 9.4.33.v20201020 to 9.4.34.v20201102 in /tests/apps/java
|
||||
- #4172: @dependabot-preview[bot] chore(deps): bump github.com/golang/protobuf from 1.4.2 to 1.4.3 in /tests/apps/gogrpc
|
||||
- #4185: @dependabot-preview[bot] chore(deps): bump socket.io from 2.3.0 to 3.0.1 in /tests/apps/.websocket.disabled
|
||||
- #4190: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 182 to 183 in /tests/apps/php
|
||||
- #4165: @dependabot-preview[bot] chore(deps): bump jetty-servlet from 9.4.31.v20200723 to 9.4.33.v20201020 in /tests/apps/java
|
||||
- #4153: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 181 to 182 in /tests/apps/php
|
||||
- #4144: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 180 to 181 in /tests/apps/php
|
||||
- #4137: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 179 to 180 in /tests/apps/php
|
||||
- #4118: @dependabot[bot] chore(deps): bump django from 3.0.2 to 3.0.7 in /tests/apps/dockerfile-release
|
||||
- #4103: @dependabot-preview[bot] chore(deps-dev): bump heroku/heroku-buildpack-php from 178 to 179 in /tests/apps/php
|
||||
- #4091: @dependabot-preview[bot] chore(deps): bump jetty-servlet from 9.4.30.v20200611 to 9.4.31.v20200723 in /tests/apps/java
|
||||
|
||||
## 0.21.4
|
||||
|
||||
Install/update via the bootstrap script:
|
||||
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.21.4/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.21.4 bash bootstrap.sh
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #4092: @Yihao-G Fix nginx proxy-read-timeout not set for HTTPS
|
||||
- #4095: @GennadySpb Fix application removal during uninstallation
|
||||
|
||||
### New Features
|
||||
|
||||
- #4097: @josegonzalez Update herokuish
|
||||
|
||||
### Documentation
|
||||
|
||||
- #4096: @josegonzalez Clarify that special config variables are not exposed to applications
|
||||
- #4007: @turicas Clarify nginx.conf.sigil path in image when deploying non-buildpack apps
|
||||
- #4078: @gurpreetatwal Add more details to `nginx-dokku-template-source` trigger
|
||||
- #4090: @ankane Official plugins no longer in beta
|
||||
- #4085: @josegonzalez Set warning on resource type as an actual warning
|
||||
|
||||
### Other
|
||||
|
||||
- #4082: @dependabot-preview[bot] chore(deps): bump monolog/monolog from 1.25.4 to 1.25.5 in /tests/apps/php
|
||||
|
||||
## 0.21.3
|
||||
|
||||
Install/update via the bootstrap script:
|
||||
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.21.3/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.21.3 bash bootstrap.sh
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #4077: @Schlepptop Fix config_all bug introduced in 0.21.2
|
||||
- #4074: @josegonzalez Force set all plugin permissions on plugin:install/update
|
||||
|
||||
### Documentation
|
||||
|
||||
- #4073: @josegonzalez Document the official shell client
|
||||
|
||||
## 0.21.2
|
||||
|
||||
Install/update via the bootstrap script:
|
||||
|
||||
5
Makefile
5
Makefile
@@ -1,7 +1,8 @@
|
||||
DOKKU_VERSION ?= master
|
||||
|
||||
PROCFILE_VERSION ?= 0.8.2
|
||||
PLUGN_VERSION ?= 0.5.0
|
||||
HEROKUISH_VERSION ?= 0.5.19
|
||||
PROCFILE_VERSION ?= 0.11.0
|
||||
PLUGN_VERSION ?= 0.5.1
|
||||
SIGIL_VERSION ?= 0.6.0
|
||||
SSHCOMMAND_VERSION ?= 0.11.0
|
||||
SSHCOMMAND_URL ?= https://github.com/dokku/sshcommand/releases/download/v${SSHCOMMAND_VERSION}/sshcommand_${SSHCOMMAND_VERSION}_linux_x86_64.tgz
|
||||
|
||||
@@ -86,7 +86,7 @@ Support us with a monthly donation and help us continue our activities. [[Become
|
||||
|
||||
A fresh VM running any of the following operating systems:
|
||||
|
||||
- Ubuntu 16.04/18.04 x64 - Any currently supported release
|
||||
- Ubuntu 16.04/18.04/20.04 x64 - Any currently supported release
|
||||
- Debian 9+ x64
|
||||
- CentOS 7 x64 *(experimental)*
|
||||
- Arch Linux x64 *(experimental)*
|
||||
@@ -99,8 +99,8 @@ Otherwise, you will need to import the keypair manually after installation using
|
||||
To install the latest stable release, run the following commands as a user who has access to `sudo`:
|
||||
|
||||
```shell
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.21.2/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.21.2 bash bootstrap.sh
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.2/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.22.2 bash bootstrap.sh
|
||||
```
|
||||
|
||||
You can then proceed to the ip address or domain name associated with your server to complete the web-based installation.
|
||||
|
||||
6
Vagrantfile
vendored
6
Vagrantfile
vendored
@@ -53,7 +53,7 @@ Vagrant::configure("2") do |config|
|
||||
vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
|
||||
end
|
||||
|
||||
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update >/dev/null && apt-get -qq -y install git >/dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update >/dev/null && apt-get -qq -y install git build-essential >/dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
|
||||
vm.vm.provision :shell do |s|
|
||||
s.inline = <<-EOT
|
||||
@@ -103,7 +103,9 @@ Vagrant::configure("2") do |config|
|
||||
config.vm.define "build-arch", autostart: false do |vm|
|
||||
vm.vm.box = "bugyt/archlinux"
|
||||
vm.vm.synced_folder File.dirname(__FILE__), "/dokku"
|
||||
vm.vm.synced_folder "#{File.dirname(__FILE__)}/../dokku-arch", "/dokku-arch"
|
||||
if Pathname.new("#{File.dirname(__FILE__)}/../dokku-arch").exist?
|
||||
vm.vm.synced_folder "#{File.dirname(__FILE__)}/../dokku-arch", "/dokku-arch"
|
||||
end
|
||||
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
|
||||
vm.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
vm.vm.network :private_network, ip: DOKKU_IP
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
GO_ARGS ?= -a
|
||||
GO_ARGS ?=
|
||||
GO_PLUGIN_MAKE_TARGET ?= build
|
||||
GO_REPO_ROOT := /go/src/github.com/dokku/dokku
|
||||
BUILD_IMAGE := golang:1.14.4
|
||||
|
||||
@@ -15,10 +16,10 @@ build-in-docker: clean
|
||||
-e GO111MODULE=on \
|
||||
-w $(GO_REPO_ROOT)/plugins/$(PLUGIN_NAME) \
|
||||
$(BUILD_IMAGE) \
|
||||
bash -c "GO_ARGS='$(GO_ARGS)' make -j4 build" || exit $$?
|
||||
bash -c "GO_ARGS='$(GO_ARGS)' make -j4 $(GO_PLUGIN_MAKE_TARGET)" || exit $$?
|
||||
|
||||
clean:
|
||||
rm -rf commands subcommands triggers prop
|
||||
rm -rf $(BUILD)
|
||||
find . -xtype l -delete
|
||||
|
||||
commands: **/**/commands.go
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
FROM dokku/build-base:0.0.1
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get -y install gcc git build-essential wget ruby-dev ruby1.9.1 lintian rpm help2man man-db
|
||||
RUN command -v fpm >/dev/null || sudo gem install fpm --no-ri --no-rdoc
|
||||
|
||||
ARG WORKDIR=/go/src/github.com/dokku/dokku
|
||||
|
||||
WORKDIR ${WORKDIR}
|
||||
|
||||
COPY . ${WORKDIR}
|
||||
|
||||
RUN make deb-herokuish rpm-herokuish
|
||||
|
||||
RUN ls -lha /tmp/
|
||||
@@ -15,7 +15,7 @@ import subprocess
|
||||
import sys
|
||||
import threading
|
||||
|
||||
VERSION = 'v0.21.2'
|
||||
VERSION = 'v0.22.2'
|
||||
|
||||
def bytes_to_string(b):
|
||||
if type(b) == bytes:
|
||||
|
||||
@@ -101,7 +101,7 @@ main() {
|
||||
|
||||
# rebuild all applications
|
||||
dokku-log-info "Rebuilding all applications"
|
||||
dokku ps:rebuildall
|
||||
dokku ps:rebuild --all
|
||||
|
||||
dokku-log-info "Waiting for old containers to stop"
|
||||
sleep 120
|
||||
|
||||
@@ -140,7 +140,7 @@ main() {
|
||||
esac
|
||||
|
||||
[[ " apps certs help ls nginx shell storage trace version " == *" $CMD "* ]] && unset APP
|
||||
[[ " certs:chain domains:add-global domains:remove-global domains:set-global ps:rebuildall ps:restartall ps:restore ps:startall ps:stopall " == *" $CMD "* ]] && unset APP
|
||||
[[ " certs:chain domains:add-global domains:remove-global domains:set-global ps:restore " == *" $CMD "* ]] && unset APP
|
||||
[[ "$CMD" =~ events*|plugin*|ssh-keys* ]] && unset APP
|
||||
[[ -n "$APP_ARG" ]] && [[ "$APP_ARG" == "--global" ]] && unset APP
|
||||
[[ -n "$@" ]] && [[ -n "$APP" ]] && app_arg="--app $APP"
|
||||
|
||||
@@ -281,6 +281,10 @@ fn-repo-update-history-and-commit() {
|
||||
HISTORY="${HISTORY}"$'\n'"sudo DOKKU_TAG=v${NEXT_VERSION} bash bootstrap.sh"
|
||||
HISTORY="${HISTORY}"$'\n'"\`\`\`"
|
||||
|
||||
if [[ -f "docs/appendices/${NEXT_VERSION}-migration-guide.md" ]]; then
|
||||
HISTORY="${HISTORY}"$'\n\n'"See the [${NEXT_VERSION} migration guide](/docs/appendices/${NEXT_VERSION}-migration-guide.md) for more information on migrating to ${NEXT_VERSION}."
|
||||
fi
|
||||
|
||||
if [[ "$HISTORY_BC_BREAK" ]]; then
|
||||
HISTORY="${HISTORY}"$'\n\n'"### Backwards Compatibility Breaks"
|
||||
HISTORY="${HISTORY}"$'\n'"$HISTORY_BC_BREAK"
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
readonly ROOT_DIR="$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" && pwd)"
|
||||
readonly TMP_WORK_DIR="$(mktemp -d "/tmp/dokku-release.XXXXXX")"
|
||||
readonly DOKKU_GIT_REV="$(git rev-parse HEAD)"
|
||||
|
||||
trap 'rm -rf "$TMP_WORK_DIR" >/dev/null' RETURN INT TERM EXIT
|
||||
|
||||
log-info() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log info formatter"
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
log-error() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log error formatter"
|
||||
echo "! $*" 1>&2
|
||||
}
|
||||
|
||||
log-fail() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log fail formatter"
|
||||
log-error "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
fn-build-dokku() {
|
||||
declare desc="Builds dokku packages within a docker container"
|
||||
|
||||
pushd "$ROOT_DIR" >/dev/null
|
||||
docker build \
|
||||
-f "contrib/build-herokuish.Dockerfile" \
|
||||
-t herokuish:build .
|
||||
return "$?"
|
||||
}
|
||||
|
||||
fn-extract-package() {
|
||||
declare desc="Extract packages from a docker container to the root directory"
|
||||
declare PACKAGE_NAME="$1"
|
||||
|
||||
if [[ -z "$PACKAGE_NAME" ]]; then
|
||||
log-error "Invalid deb file specified"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log-info "(extract-package) writing ${PACKAGE_NAME} to correct path"
|
||||
docker run --rm --entrypoint cat herokuish:build "/tmp/${PACKAGE_NAME}" >"${ROOT_DIR}/build/${PACKAGE_NAME}"
|
||||
return "$?"
|
||||
}
|
||||
|
||||
fn-publish-package() {
|
||||
declare desc="Publishes a package to packagecloud"
|
||||
declare IS_RELEASE="$1" RELEASE_TYPE="$2" PACKAGE_NAME="$3"
|
||||
local REPOSITORY=dokku/dokku-betafish DIST=ubuntu
|
||||
local OS_ID ex EXIT_CODE=0
|
||||
|
||||
[[ "$IS_RELEASE" == "true" ]] && REPOSITORY=dokku/dokku
|
||||
[[ "$RELEASE_TYPE" == "rpm" ]] && DIST=el/7
|
||||
|
||||
if [[ "$DIST" == "ubuntu" ]]; then
|
||||
OS_IDS=("xenial" "bionic" "focal")
|
||||
for OS_ID in "${OS_IDS[@]}"; do
|
||||
log-info "(release-herokuish) pushing ${RELEASE_TYPE} to packagecloud.com/${REPOSITORY}/${DIST}"
|
||||
package_cloud push "${REPOSITORY}/${DIST}/${OS_ID}" "$PACKAGE_NAME"
|
||||
ex="$?"
|
||||
if [[ "$ex" -ne "0" ]]; then
|
||||
EXIT_CODE="$ex"
|
||||
fi
|
||||
done
|
||||
|
||||
DIST=debian
|
||||
OS_IDS=("stretch" "buster")
|
||||
for OS_ID in "${OS_IDS[@]}"; do
|
||||
log-info "(release-herokuish) pushing ${RELEASE_TYPE} to packagecloud.com/${REPOSITORY}/${DIST}"
|
||||
package_cloud push "${REPOSITORY}/${DIST}/${OS_ID}" "$PACKAGE_NAME"
|
||||
ex="$?"
|
||||
if [[ "$ex" -ne "0" ]]; then
|
||||
EXIT_CODE="$ex"
|
||||
fi
|
||||
done
|
||||
else
|
||||
log-info "(release-herokuish) pushing ${RELEASE_TYPE} to packagecloud.com/${REPOSITORY}/${DIST}"
|
||||
package_cloud push "${REPOSITORY}/${DIST}" "$PACKAGE_NAME"
|
||||
EXIT_CODE="$?"
|
||||
fi
|
||||
return "$EXIT_CODE"
|
||||
}
|
||||
|
||||
fn-in-array() {
|
||||
declare desc="return true if value ($1) is in list (all other arguments)"
|
||||
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
fn-is-release() {
|
||||
declare desc="Checks if a given run is a release run"
|
||||
declare RELEASE="$1"
|
||||
local IS_RELEASE=false
|
||||
if [[ "$RELEASE" == "major" ]] || [[ "$RELEASE" == "minor" ]] || [[ "$RELEASE" == "patch" ]]; then
|
||||
IS_RELEASE=true
|
||||
fi
|
||||
|
||||
echo "$IS_RELEASE"
|
||||
}
|
||||
|
||||
fn-require-bin() {
|
||||
declare desc="Checks that a binary exists"
|
||||
declare BINARY="$1"
|
||||
if ! command -v "$BINARY" &>/dev/null; then
|
||||
log-fail "Missing ${BINARY}, please install it"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
declare RELEASE="$1"
|
||||
local NEXT_VERSION
|
||||
local VALID_RELEASE_LEVELS=("major" "minor" "patch" "betafish" "build")
|
||||
|
||||
if [[ "$RELEASE" == '--trace' ]]; then
|
||||
shift 1
|
||||
RELEASE="$1"
|
||||
TRACE=1 && set -x
|
||||
fi
|
||||
|
||||
if [[ -z "$RELEASE" ]]; then
|
||||
log-fail "Argument 1 must be one of [major, minor, patch, betafish, build], none given"
|
||||
fi
|
||||
|
||||
if ! fn-in-array "$RELEASE" "${VALID_RELEASE_LEVELS[@]}"; then
|
||||
log-fail "Argument 1 must be one of [major, minor, patch, betafish, build], '${RELEASE}' given"
|
||||
fi
|
||||
|
||||
mkdir -p "build"
|
||||
fn-require-bin "docker"
|
||||
if [[ "$RELEASE" != "build" ]]; then
|
||||
fn-require-bin "package_cloud"
|
||||
[[ -n "$PACKAGECLOUD_TOKEN" ]] || log-fail "Missing PACKAGECLOUD_TOKEN environment variable"
|
||||
fi
|
||||
|
||||
NEXT_VERSION="$(grep HEROKUISH_VERSION deb.mk | head -n1 | cut -d'=' -f2 | xargs)"
|
||||
IS_RELEASE="$(fn-is-release "$RELEASE")"
|
||||
|
||||
fn-build-dokku || log-fail "Error building package"
|
||||
fn-extract-package "herokuish_${NEXT_VERSION}_amd64.deb" || log-fail "Error extracting deb package"
|
||||
fn-extract-package "herokuish-${NEXT_VERSION}-1.x86_64.rpm" || log-fail "Error extracting rpm package"
|
||||
|
||||
if [[ "$RELEASE" != "build" ]]; then
|
||||
fn-publish-package "$IS_RELEASE" "deb" "build/herokuish_${NEXT_VERSION}_amd64.deb" || log-fail "Error publishing deb package"
|
||||
fn-publish-package "$IS_RELEASE" "rpm" "build/herokuish-${NEXT_VERSION}-1.x86_64.rpm" || log-fail "Error publishing rpm package"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
38
deb.mk
38
deb.mk
@@ -1,18 +1,12 @@
|
||||
BUILD_DIRECTORY ?= /tmp
|
||||
|
||||
HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
|
||||
HEROKUISH_REPO_NAME ?= gliderlabs/herokuish
|
||||
HEROKUISH_VERSION ?= 0.5.14
|
||||
HEROKUISH_ARCHITECTURE = amd64
|
||||
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
|
||||
|
||||
DOKKU_DESCRIPTION = 'Docker powered PaaS that helps you build and manage the lifecycle of applications'
|
||||
DOKKU_REPO_NAME ?= dokku/dokku
|
||||
DOKKU_ARCHITECTURE = amd64
|
||||
|
||||
DOKKU_UPDATE_DESCRIPTION = 'Binary that handles updating Dokku and related systems'
|
||||
DOKKU_UPDATE_REPO_NAME ?= dokku/dokku
|
||||
DOKKU_UPDATE_VERSION ?= 0.1.0
|
||||
DOKKU_UPDATE_VERSION ?= 0.2.0
|
||||
DOKKU_UPDATE_ARCHITECTURE = amd64
|
||||
DOKKU_UPDATE_PACKAGE_NAME = dokku-update_$(DOKKU_UPDATE_VERSION)_$(DOKKU_UPDATE_ARCHITECTURE).deb
|
||||
|
||||
@@ -35,7 +29,7 @@ endif
|
||||
|
||||
export SIGIL_DESCRIPTION
|
||||
|
||||
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-dokku-update deb-setup deb-sigil
|
||||
.PHONY: install-from-deb deb-all deb-dokku deb-dokku-update deb-setup deb-sigil
|
||||
|
||||
install-from-deb:
|
||||
@echo "--> Initial apt-get update"
|
||||
@@ -51,7 +45,7 @@ install-from-deb:
|
||||
sudo apt-get update -qq >/dev/null
|
||||
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -yy dokku
|
||||
|
||||
deb-all: deb-setup deb-herokuish deb-dokku deb-sigil deb-dokku-update
|
||||
deb-all: deb-setup deb-dokku deb-sigil deb-dokku-update
|
||||
mv $(BUILD_DIRECTORY)/*.deb .
|
||||
@echo "Done"
|
||||
|
||||
@@ -62,32 +56,6 @@ deb-setup:
|
||||
@command -v fpm >/dev/null || sudo gem install fpm --no-ri --no-rdoc
|
||||
@ssh -o StrictHostKeyChecking=no git@github.com || true
|
||||
|
||||
deb-herokuish:
|
||||
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 "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install
|
||||
@echo 'if [[ -n $${http_proxy+x} ]]; then echo "See the docker pull docs for proxy configuration"; fi' >> /tmp/tmp/post-install
|
||||
@echo 'if [[ -n $${https_proxy+x} ]]; then echo "See the docker pull docs for proxy configuration"; fi' >> /tmp/tmp/post-install
|
||||
@echo 'if [[ -n $${BUILDARGS+x} ]]; then echo "See the docker pull docs for proxy configuration"; fi' >> /tmp/tmp/post-install
|
||||
@echo "sudo docker pull gliderlabs/herokuish:v${HEROKUISH_VERSION} && sudo docker tag gliderlabs/herokuish:v${HEROKUISH_VERSION} gliderlabs/herokuish:latest" >> /tmp/tmp/post-install
|
||||
|
||||
@echo "-> Creating $(HEROKUISH_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n herokuish \
|
||||
--version $(HEROKUISH_VERSION) \
|
||||
--architecture $(HEROKUISH_ARCHITECTURE) \
|
||||
--package $(BUILD_DIRECTORY)/$(HEROKUISH_PACKAGE_NAME) \
|
||||
--deb-pre-depends 'docker-engine-cs (>= 1.13.0) | docker-engine (>= 1.13.0) | docker-io (>= 1.13.0) | docker.io (>= 1.13.0) | docker-ce (>= 1.13.0) | docker-ee (>= 1.13.0) | moby-engine' \
|
||||
--deb-pre-depends sudo \
|
||||
--after-install /tmp/tmp/post-install \
|
||||
--url "https://github.com/$(HEROKUISH_REPO_NAME)" \
|
||||
--description $(HEROKUISH_DESCRIPTION) \
|
||||
--license 'MIT License' \
|
||||
.
|
||||
|
||||
deb-dokku: /tmp/build-dokku/var/lib/dokku/GIT_REV
|
||||
rm -f $(BUILD_DIRECTORY)/dokku_*_$(DOKKU_ARCHITECTURE).deb
|
||||
|
||||
|
||||
4
debian/control
vendored
4
debian/control
vendored
@@ -1,9 +1,9 @@
|
||||
Package: dokku
|
||||
Version: 0.21.2
|
||||
Version: 0.22.2
|
||||
Section: web
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: locales, git, cpio, curl, man-db, netcat, sshcommand (>= 0.10.0), docker-engine-cs (>= 1.13.0) | docker-engine (>= 1.13.0) | docker-io (>= 1.13.0) | docker.io (>= 1.13.0) | docker-ce (>= 1.13.0) | docker-ee (>= 1.13.0) | moby-engine, net-tools, software-properties-common, procfile-util, python-software-properties | python3-software-properties, rsyslog, dos2unix, jq
|
||||
Depends: locales, git, cpio, curl, man-db, netcat, sshcommand (>= 0.10.0), docker-engine-cs (>= 17.05.0) | docker-engine (>= 17.05.0) | docker-io (>= 17.05.0) | docker.io (>= 17.05.0) | docker-ce (>= 17.05.0) | docker-ee (>= 17.05.0) | moby-engine, net-tools, software-properties-common, procfile-util (>= 0.11.0), python-software-properties | python3-software-properties, rsyslog, dos2unix, jq
|
||||
Recommends: herokuish (>= 0.3.4), parallel, dokku-update, dokku-event-listener
|
||||
Pre-Depends: gliderlabs-sigil, nginx (>= 1.8.0) | openresty, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.3.0), sudo, python3, debconf
|
||||
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
|
||||
2
debian/prerm
vendored
2
debian/prerm
vendored
@@ -33,7 +33,7 @@ main() {
|
||||
echo "Processing purge"
|
||||
|
||||
echo "Destroying deployed applications"
|
||||
for app in $(DOKKU_QUIET_OUTPUT=1 dokku apps); do
|
||||
for app in $(DOKKU_QUIET_OUTPUT=1 dokku apps:list); do
|
||||
dokku --force apps:destroy $app
|
||||
done
|
||||
|
||||
|
||||
@@ -2,7 +2,51 @@
|
||||
|
||||
> The backup plugin was deprecated in 0.4.x, below are backup recommendations for 0.5.x and later.
|
||||
|
||||
## Backup and Migration Tutorial
|
||||
The best plan for disaster recovery is to always keep multiple (remote) copies of your local repo, static assets and periodic database dumps. Backups should be regularly tested for data integrity and completeness.
|
||||
|
||||
## TLDR
|
||||
|
||||
> Warning: This method has many caveats. Please read this entire document before assuming these backups work as expected, and test your backups on a regular basis.
|
||||
|
||||
### Creating a backup
|
||||
|
||||
To create a backup, run the following command at a time when not executing any Dokku commands or app deployments:
|
||||
|
||||
```shell
|
||||
export BACKUP_TIME=$(date +%Y-%m-%d-%H-%M)
|
||||
sudo mkdir -p /var/lib/dokku/services
|
||||
sudo chown dokku:dokku /var/lib/dokku/services
|
||||
mkdir -p /tmp/dokku-backups/
|
||||
sudo tar -czvf "/tmp/dokku-backups/${BACKUP_TIME}.tar.gz" /home/dokku /var/lib/dokku/config /var/lib/dokku/data /var/lib/dokku/services /var/lib/dokku/plugins
|
||||
```
|
||||
|
||||
This will create a point-in-time backup of your entire Dokku installation in the `/tmp/dokku-backups` directory. This backup may be moved offsite to another location via rsync, sftp, or some other protocol.
|
||||
|
||||
It is recommended that backups are regularly cleaned from the originating server and tested as necessary.
|
||||
|
||||
### Restoring a backup
|
||||
|
||||
To extract the backup onto another server, copy the backup to the server and extract it using the following command.
|
||||
|
||||
```shell
|
||||
sudo tar -xzvf path/to/dokku/backup.tar.gz -C /
|
||||
```
|
||||
|
||||
At this point, all datastores should be individually started and checked for data integrity. Once this is complete, individual applications can be rebuilt. Please consult the [process management documentation](/docs/deployment/process-management.md#rebuilding-apps) for more information on how to rebuild applications.
|
||||
|
||||
## Caveats
|
||||
|
||||
### App config
|
||||
|
||||
Application config is largely held in a small number of places:
|
||||
|
||||
- `/var/lib/dokku/config`: Properties set and managed by plugins
|
||||
- `/var/lib/dokku/data`: Files generated or extracted by various plugins
|
||||
- `/home/dokku`: Certain parts of Dokku core store data in this location
|
||||
|
||||
Compressing these directories when no Dokku commands are running is enough to ensure a complete backup of the system.
|
||||
|
||||
### Code Repositories
|
||||
|
||||
Because Dokku is git based, rebuilding a deployed app is as easy as pushing from git. You can push to a new server by updating the `dokku` remote in you local app's repo.
|
||||
|
||||
@@ -11,7 +55,14 @@ git remote rm dokku
|
||||
git remote add dokku dokku@[dokku.me:dokku.me]
|
||||
git push dokku [master]
|
||||
```
|
||||
## Databases
|
||||
|
||||
### Docker Image and Tar-based Apps
|
||||
|
||||
These applications may fail to rebuild via the normal `ps:rebuild` method. Redeploy these apps by running the original commands used to deploy them
|
||||
|
||||
### Datastores
|
||||
|
||||
> Please note that point-in-time backups of the `/var/lib/dokku/services` directory may contain partially written data due to how various datastores work. Consult the official datastore documentation for the best documentation surrounding proper backup and restore procedures.
|
||||
|
||||
Some plugins, like the official [dokku-postgres](https://github.com/dokku/dokku-postgres) plugin, have built-in commands that allow non-volatile data be exported and imported.
|
||||
|
||||
@@ -22,15 +73,26 @@ dokku postgres:export [db_name] > [db_name].dump
|
||||
dokku postgres:import [db_name] < [db_name].dump
|
||||
```
|
||||
|
||||
## Volumes and Static Assets
|
||||
Additionally, data for official datastores is located in the `/var/lib/dokku/services` directory. If the directory is restored and the plugin is available, a `dokku $SERVICE:start` may be enough to restart the service with the underlying data, so long as the datastore version does not change and the underlying data is not corrupt. If this is the case, it may be necessary to re-import all the data onto a fresh version of the datastore service.
|
||||
|
||||
### Plugins
|
||||
|
||||
The plugin directory is contained at the `/var/lib/dokku/plugins` directory. Core plugins will automatically be included in new installs, but custom plugins may not. The aforementioned `tar` creation command will back all plugins up, and the `tar` extract command will restore the plugins.
|
||||
|
||||
Note that restoring a plugin will not trigger any `install` or `dependencies` triggers. You will need to run these manually. See the [plugin management documentation](/docs/advanced-usage/plugin-management.md#installing-a-plugin) for more information on how to trigger these two hooks.
|
||||
|
||||
|
||||
### Volumes and Static Assets
|
||||
|
||||
Dokku doesn't enforce a [300mb](https://devcenter.heroku.com/articles/slug-compiler#slug-size) limit on apps, but it's best practice to keep binary assets outside of git. Since containers are considered volatile in Dokku, external stores like s3 or storage mounts should be used for non-volatile items like user uploads. The Dokku storage core plugin can be used to mount local directories / volumes inside the docker container.
|
||||
|
||||
System administrators are highly encouraged to store persistent data in app-specific subdirectories of the path `/var/lib/dokku/data/storage`. This will help ensure restores of the aforementioned primary Dokku directories will restore service to all apps.
|
||||
|
||||
See the [persistent storage documentation](/docs/advanced-usage/persistent-storage.md) for more information on how to attach persistent storage to your application.
|
||||
|
||||
## Disaster Recovery
|
||||
## Recovering app code
|
||||
|
||||
The best plan for disaster recovery is to always keep multiple (remote) copies of your local repo, static assets and periodic database dumps. In case of an emergency when your git repo and backups are completely lost, you can recover the last pushed copy from your remote Dokku server (assuming you still have the ssh key).
|
||||
In case of an emergency when your git repo and backups are completely lost, you can recover the last pushed copy from your remote Dokku server (assuming you still have the ssh key).
|
||||
|
||||
```shell
|
||||
mkdir [app-name] ; cd !$
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> New as of 0.5.0
|
||||
|
||||
Sometimes you need to run a command on at deployment time, but before an app is completely deployed. Common use cases include:
|
||||
Sometimes you need to run a command on deployment time, but before an app is completely deployed. Common use cases include:
|
||||
|
||||
* Checking a database is initialized
|
||||
* Running database migrations
|
||||
@@ -32,6 +32,8 @@ Each "phase" has different expectations and limitations:
|
||||
- Priming or invalidating cache stores
|
||||
- Running database migrations
|
||||
|
||||
Additionally, if using a Dockerfile with an `ENTRYPOINT`, the deployment task is passed to that entrypoint as is.
|
||||
|
||||
Please keep the above in mind when utilizing deployment tasks.
|
||||
|
||||
> To execute commands on the host during a release phase, see the [plugin creation documentation](/docs/development/plugin-creation.md) docs for more information on building your own custom plugin.
|
||||
|
||||
@@ -25,6 +25,10 @@ Dokku deploys your application in multiple "phases" and the `docker-options` plu
|
||||
- `deploy`: the container that executes your running/deployed application
|
||||
- `run`: the container that executes any arbitrary command via `dokku run`
|
||||
|
||||
Manipulation of docker options will not restart running containers. This enables multiple options to be set/unset before final application. As such, changing an app's docker options must be followed by a `dokku ps:rebuild` in order to take effect.
|
||||
|
||||
More information on supported Docker options can be found here: https://docs.docker.com/engine/reference/commandline/run/.
|
||||
|
||||
## Examples
|
||||
|
||||
### Add Docker options
|
||||
@@ -119,25 +123,3 @@ You can pass flags which will output only the value of the specific information
|
||||
```shell
|
||||
dokku docker-options:report node-js-app --docker-options-build
|
||||
```
|
||||
|
||||
## Advanced usage
|
||||
|
||||
In your applications folder `/home/dokku/app_name` create a file called `DOCKER_OPTIONS_RUN` (or `DOCKER_OPTIONS_BUILD` or `DOCKER_OPTIONS_DEPLOY`).
|
||||
|
||||
Inside this file list one Docker option per line. For example:
|
||||
|
||||
```shell
|
||||
--link container_name:alias
|
||||
-v /host/path:/container/path
|
||||
-v /another/container/path
|
||||
```
|
||||
|
||||
The above example will result in the following options being passed to Docker during `dokku run`:
|
||||
|
||||
```shell
|
||||
--link container_name:alias -v /host/path:/container/path -v /another/container/path
|
||||
```
|
||||
|
||||
You may also include comments (lines beginning with a #) and blank lines in the DOCKER_OPTIONS file.
|
||||
|
||||
More information on Docker options can be found here: https://docs.docker.com/engine/reference/commandline/run/.
|
||||
|
||||
@@ -25,7 +25,9 @@ dokku plugins-install
|
||||
|
||||
## Usage
|
||||
|
||||
You can list all installed plugins using the `plugin:list` command:
|
||||
### Listing Plugins
|
||||
|
||||
Installed plugins can be listed via the `plugin:list` command:
|
||||
|
||||
```shell
|
||||
dokku plugin:list
|
||||
@@ -33,45 +35,60 @@ dokku plugin:list
|
||||
|
||||
```
|
||||
plugn: dev
|
||||
00_dokku-standard 0.21.2 enabled dokku core standard plugin
|
||||
20_events 0.21.2 enabled dokku core events logging plugin
|
||||
app-json 0.21.2 enabled dokku core app-json plugin
|
||||
apps 0.21.2 enabled dokku core apps plugin
|
||||
build-env 0.21.2 enabled dokku core build-env plugin
|
||||
buildpacks 0.21.2 enabled dokku core buildpacks plugin
|
||||
certs 0.21.2 enabled dokku core certificate management plugin
|
||||
checks 0.21.2 enabled dokku core checks plugin
|
||||
common 0.21.2 enabled dokku core common plugin
|
||||
config 0.21.2 enabled dokku core config plugin
|
||||
docker-options 0.21.2 enabled dokku core docker-options plugin
|
||||
domains 0.21.2 enabled dokku core domains plugin
|
||||
enter 0.21.2 enabled dokku core enter plugin
|
||||
git 0.21.2 enabled dokku core git plugin
|
||||
logs 0.21.2 enabled dokku core logs plugin
|
||||
network 0.21.2 enabled dokku core network plugin
|
||||
nginx-vhosts 0.21.2 enabled dokku core nginx-vhosts plugin
|
||||
plugin 0.21.2 enabled dokku core plugin plugin
|
||||
proxy 0.21.2 enabled dokku core proxy plugin
|
||||
ps 0.21.2 enabled dokku core ps plugin
|
||||
repo 0.21.2 enabled dokku core repo plugin
|
||||
resource 0.21.2 enabled dokku core resource plugin
|
||||
scheduler-docker-local 0.21.2 enabled dokku core scheduler-docker-local plugin
|
||||
shell 0.21.2 enabled dokku core shell plugin
|
||||
ssh-keys 0.21.2 enabled dokku core ssh-keys plugin
|
||||
storage 0.21.2 enabled dokku core storage plugin
|
||||
tags 0.21.2 enabled dokku core tags plugin
|
||||
tar 0.21.2 enabled dokku core tar plugin
|
||||
trace 0.21.2 enabled dokku core trace plugin
|
||||
00_dokku-standard 0.22.2 enabled dokku core standard plugin
|
||||
20_events 0.22.2 enabled dokku core events logging plugin
|
||||
app-json 0.22.2 enabled dokku core app-json plugin
|
||||
apps 0.22.2 enabled dokku core apps plugin
|
||||
build-env 0.22.2 enabled dokku core build-env plugin
|
||||
buildpacks 0.22.2 enabled dokku core buildpacks plugin
|
||||
certs 0.22.2 enabled dokku core certificate management plugin
|
||||
checks 0.22.2 enabled dokku core checks plugin
|
||||
common 0.22.2 enabled dokku core common plugin
|
||||
config 0.22.2 enabled dokku core config plugin
|
||||
docker-options 0.22.2 enabled dokku core docker-options plugin
|
||||
domains 0.22.2 enabled dokku core domains plugin
|
||||
enter 0.22.2 enabled dokku core enter plugin
|
||||
git 0.22.2 enabled dokku core git plugin
|
||||
logs 0.22.2 enabled dokku core logs plugin
|
||||
network 0.22.2 enabled dokku core network plugin
|
||||
nginx-vhosts 0.22.2 enabled dokku core nginx-vhosts plugin
|
||||
plugin 0.22.2 enabled dokku core plugin plugin
|
||||
proxy 0.22.2 enabled dokku core proxy plugin
|
||||
ps 0.22.2 enabled dokku core ps plugin
|
||||
repo 0.22.2 enabled dokku core repo plugin
|
||||
resource 0.22.2 enabled dokku core resource plugin
|
||||
scheduler-docker-local 0.22.2 enabled dokku core scheduler-docker-local plugin
|
||||
shell 0.22.2 enabled dokku core shell plugin
|
||||
ssh-keys 0.22.2 enabled dokku core ssh-keys plugin
|
||||
storage 0.22.2 enabled dokku core storage plugin
|
||||
tags 0.22.2 enabled dokku core tags plugin
|
||||
tar 0.22.2 enabled dokku core tar plugin
|
||||
trace 0.22.2 enabled dokku core trace plugin
|
||||
```
|
||||
|
||||
> Warning: All plugin commands other than `plugin:list` and `plugin:help` require sudo access and must be run directly from the Dokku server.
|
||||
|
||||
### Checking if a plugin is installed
|
||||
|
||||
You can check if a plugin has been installed via the `plugin:installed` command:
|
||||
|
||||
```shell
|
||||
dokku plugin:installed postgres
|
||||
```
|
||||
|
||||
### Installing a plugin
|
||||
|
||||
Installing a plugin is easy as well using the `plugin:install` command. This command will also trigger the `install` pluginhook on all existing plugins.
|
||||
|
||||
The most common usage is to install a plugin from a url. This url may be any of the following:
|
||||
|
||||
- `git`: For git+ssh based plugin repository clones.
|
||||
- `ssh`: For git+ssh based plugin repository clones.
|
||||
- `file`: For copying plugins from a path on disk.
|
||||
- `https`: For http based plugin repository clones.
|
||||
|
||||
Additionally, any urls with the extensions `.tar.gz` or `.tgz` are treated as Gzipped Tarballs for installation purposes and will be downloaded and extracted into place.
|
||||
|
||||
```shell
|
||||
dokku plugin:install https://github.com/dokku/dokku-postgres.git
|
||||
```
|
||||
@@ -87,7 +104,68 @@ Checking connectivity... done.
|
||||
-----> Plugin postgres enabled
|
||||
```
|
||||
|
||||
You can also uninstall a third-party plugin using the `plugin:uninstall` command:
|
||||
For git-based plugin installation, a commit SHA-like object may be specified (tag/branch/commit sha) via the `--committish` argument and Dokku will attempt to install the specified commit object.
|
||||
|
||||
```shell
|
||||
# where 2.0.0 is a potential git tag
|
||||
dokku plugin:install https://github.com/dokku/dokku-postgres.git --committish 2.0.0
|
||||
```
|
||||
|
||||
Plugin names are interpolated based on the repository name minus the `dokku-` prefix. If the plugin being installed has a name other than what matches the repository name - or another name is desired - the `--name` flag can be used to override this interpolation.
|
||||
|
||||
```shell
|
||||
dokku plugin:install https://github.com/dokku/smoke-test-plugin.git --name smoke-test-plugin
|
||||
```
|
||||
|
||||
The `--core` flag may also be indicated as the sole argument, though it is only for installation of core plugins, and thus not useful for end-user installations.
|
||||
|
||||
```shell
|
||||
dokku plugin:install --core
|
||||
```
|
||||
|
||||
Finally, all flags may be omitted to trigger the `install` procedures for both core and third-party plugins:
|
||||
|
||||
```shell
|
||||
dokku plugin:install
|
||||
```
|
||||
|
||||
### Installing plugin dependencies
|
||||
|
||||
In some cases, plugins will have system-level dependencies. These are not automatically installed via `plugin:install`, and must be separately via the `plugin:install-dependencies` command. This will run through all the `dependencies` trigger for all plugins.
|
||||
|
||||
```shell
|
||||
dokku plugin:install-dependencies
|
||||
```
|
||||
|
||||
This command may also target _just_ core plugins via the `--core` flag. This is usually only useful for source-based installs of Dokku.
|
||||
|
||||
```shell
|
||||
dokku plugin:install-dependencies --core
|
||||
```
|
||||
|
||||
### Updating a plugin
|
||||
|
||||
An installed, third-party plugin can be updated can updated via the `plugin:update` command. This should be done after any upgrades of Dokku as there may be changes in the internal api that require an update of how the plugin interfaces with Dokku.
|
||||
|
||||
Please note that this command is only valid for plugin installs that were backed by a git-repository.
|
||||
|
||||
```shell
|
||||
dokku plugin:update postgres
|
||||
```
|
||||
|
||||
```
|
||||
Plugin (postgres) updated
|
||||
```
|
||||
|
||||
An optional commit SHA-like object may be specified.
|
||||
|
||||
```shell
|
||||
dokku plugin:update postgres 2.0.0
|
||||
```
|
||||
|
||||
### Uninstalling a plugin
|
||||
|
||||
Third party plugins can be uninstalled using the `plugin:uninstall` command:
|
||||
|
||||
```shell
|
||||
dokku plugin:uninstall postgres
|
||||
@@ -97,7 +175,9 @@ dokku plugin:uninstall postgres
|
||||
-----> Plugin postgres uninstalled
|
||||
```
|
||||
|
||||
Enabling or disabling a plugin can also be useful in cases where you are debugging whether a third-party plugin is causing issues in your Dokku installation:
|
||||
### Disabling a plugin
|
||||
|
||||
Disabling a plugin can also be useful for debugging whether a third-party plugin is causing issues in a Dokku installation. Another common use case is for disabling core functionality for replacement with a third-party plugin.
|
||||
|
||||
```shell
|
||||
dokku plugin:disable postgres
|
||||
@@ -107,6 +187,10 @@ dokku plugin:disable postgres
|
||||
-----> Plugin postgres disabled
|
||||
```
|
||||
|
||||
### Enabling a plugin
|
||||
|
||||
Disabled plugins can be re-enabled via the `plugin:enable` command.
|
||||
|
||||
```shell
|
||||
dokku plugin:enable postgres
|
||||
```
|
||||
@@ -115,12 +199,10 @@ dokku plugin:enable postgres
|
||||
-----> Plugin postgres enabled
|
||||
```
|
||||
|
||||
Finally, you can update an installed third-party plugin. This should be done after any upgrades of Dokku as there may be changes in the internal api that require an update of how the plugin interfaces with Dokku.
|
||||
### Triggering a plugin trigger
|
||||
|
||||
The `plugin:trigger` can be used to call any internal plugin trigger. This may have unintended consequences, and thus should only be called for development or debugging purposes.
|
||||
|
||||
```shell
|
||||
dokku plugin:update postgres
|
||||
```
|
||||
|
||||
```
|
||||
Plugin (postgres) updated
|
||||
dokku plugin:trigger some-internal-trigger args-go-here
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@ The resource plugin is meant to allow users to limit or reserve resources for a
|
||||
|
||||
By default, Dokku allows unlimited resource access to apps deployed on a server. In some cases, it may be desirable to limit this on a per-app or per-process-type basis. The `resource` plugin allows management of both resource "limits" and resource "reservations", where each resource request type has specific meaning to the scheduler in use for a given app.
|
||||
|
||||
> The meaning of a values and it's units are specific to the scheduler in use for a given app. If a scheduler does not support a given resource type combination, it will be ignored. All resource commands require an app rebuild or deploy in order to take effect.
|
||||
> Warning: The meaning of a values and it's units are specific to the scheduler in use for a given app. If a value is incorrect for a scheduler, this may result in containers failing to start correctly. If a scheduler does not support a given resource type combination, it will be ignored. All resource commands require an app rebuild or deploy in order to take effect.
|
||||
|
||||
Valid resource options include:
|
||||
|
||||
|
||||
@@ -54,6 +54,10 @@ Dokku will no longer distribute packages for Debian versions that are not `stabl
|
||||
|
||||
The `--git-sha` flag was moved from the `apps:report` command to the `git:report` command.
|
||||
|
||||
## App report output
|
||||
|
||||
When an app is not deployed, the `apps:report` command no longer shows the message `not deployed`. Please use the `--deployed` flag on `ps:report` instead to see if the app has been deployed.
|
||||
|
||||
## Changes
|
||||
|
||||
### App report flags
|
||||
|
||||
27
docs/appendices/0.22.0-migration-guide.md
Normal file
27
docs/appendices/0.22.0-migration-guide.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# 0.22.0 Migration Guide
|
||||
|
||||
## Deprecations
|
||||
|
||||
- Calling `logs:failed` without either a `<name>` or the `--all` flag is deprecated.
|
||||
|
||||
## Changes
|
||||
|
||||
- Underscores are no longer valid characters in app names. Please rename applications before upgrading.
|
||||
- Process type names specified in Procfile may no longer use characters not valid in DNS Label Names ([RFC 1123](https://tools.ietf.org/html/rfc1123)).
|
||||
- The minimum Docker version is now 17.05.0.
|
||||
- The `common.GetDeployingAppImageName()` function now returns an `error` as the second return argument instead of calling `common.LogFail()` internally.
|
||||
- Setting `DOKKU_DISABLE_ANSI_PREFIX_REMOVAL` is deprecated; Dokku 0.23.0 will avoid removing the `remote:` ansi prefix entirely. No warning will be added in this release.
|
||||
|
||||
## Removals
|
||||
|
||||
The `ps` command has had a few removals as a result of a rewrite to Golang:
|
||||
|
||||
- The `ps:set-restart-policy` command has been removed in favor the `ps:set` command.
|
||||
- The `ps:restart-policy` command has been removed in favor of the `ps:report` command.
|
||||
- The `ps:rebuildall` command has been removed in favor of calling the `ps:rebuild` with the `--all` flag instead of an app name.
|
||||
- The `ps:restartall` command has been removed in favor of calling the `ps:restart` with the `--all` flag instead of an app name.
|
||||
- The `ps:stopall` command has been removed in favor of calling the `ps:stop` with the `--all` flag instead of an app name.
|
||||
- The `ps:startall` command has been removed in favor of calling the `ps:start` with the `--all` flag instead of an app name.
|
||||
- The `DOKKU_PROCFILE` file is no longer located in the git directory for a given app on the server. It's location is currently not exposed.
|
||||
- The `procfile-get-command` plugin trigger no longer takes a `procfile path` as the final argument.
|
||||
- All `ps` functions have been removed. Please us a trigger as appropriate or file a PR to have a new trigger/wrapper function added.
|
||||
BIN
docs/assets/dokku-large.png
Normal file
BIN
docs/assets/dokku-large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
@@ -2,10 +2,10 @@
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/mstile-70x70.png"/>
|
||||
<square150x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/mstile-150x150.png"/>
|
||||
<square310x310logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/mstile-310x310.png"/>
|
||||
<wide310x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/mstile-310x150.png"/>
|
||||
<square70x70logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/mstile-70x70.png"/>
|
||||
<square150x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/mstile-150x150.png"/>
|
||||
<square310x310logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/mstile-310x310.png"/>
|
||||
<wide310x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/mstile-310x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
|
||||
@@ -2,37 +2,37 @@
|
||||
"name": "Dokku",
|
||||
"icons": [
|
||||
{
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.21.2\/docs\/assets\/favicons\/android-chrome-36x36.png",
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.2\/docs\/assets\/favicons\/android-chrome-36x36.png",
|
||||
"sizes": "36x36",
|
||||
"type": "image\/png",
|
||||
"density": "0.75"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.21.2\/docs\/assets\/favicons\/android-chrome-48x48.png",
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.2\/docs\/assets\/favicons\/android-chrome-48x48.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image\/png",
|
||||
"density": "1.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.21.2\/docs\/assets\/favicons\/android-chrome-72x72.png",
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.2\/docs\/assets\/favicons\/android-chrome-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image\/png",
|
||||
"density": "1.5"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.21.2\/docs\/assets\/favicons\/android-chrome-96x96.png",
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.2\/docs\/assets\/favicons\/android-chrome-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image\/png",
|
||||
"density": "2.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.21.2\/docs\/assets\/favicons\/android-chrome-144x144.png",
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.2\/docs\/assets\/favicons\/android-chrome-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image\/png",
|
||||
"density": "3.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.21.2\/docs\/assets\/favicons\/android-chrome-192x192.png",
|
||||
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.2\/docs\/assets\/favicons\/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image\/png",
|
||||
"density": "4.0"
|
||||
|
||||
@@ -39,13 +39,13 @@ h1 {
|
||||
font-size: 1.6em;
|
||||
}
|
||||
.header .navbar-brand a {
|
||||
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/dokku.png);
|
||||
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/dokku.png);
|
||||
text-indent: 40px;
|
||||
}
|
||||
.blurb {
|
||||
color: #424242;
|
||||
background-color: #ededed;
|
||||
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/gplaypattern.png);
|
||||
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/gplaypattern.png);
|
||||
padding: 45px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"0.18.5",
|
||||
"0.19.13",
|
||||
"0.20.4",
|
||||
"0.21.2"
|
||||
"0.21.4",
|
||||
"0.22.2"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,56 +2,11 @@
|
||||
|
||||
Given the constraints, running Dokku commands remotely via SSH is fine. For certain configurations, the extra complication of manually invoking ssh can be a burden.
|
||||
|
||||
While Dokku does not yet have an official client, there are a multitude of ways in which you can interact with your Dokku installation. The easiest is to use the **bash** client, though you may wish to use another.
|
||||
The easiest way to interact with Dokku remotely is by using the official client. Documented below are the various clients that you may wish to use.
|
||||
|
||||
## (bash, zsh, etc.) `dokku_client.sh`
|
||||
## Official Client
|
||||
|
||||
Of all methods, this is the *most* official method of interacting with your Dokku installation. It is a bash script that interacts with a remote Dokku installation via `ssh`. It is available in `contrib/dokku_client.sh` in the root of the Dokku repository.
|
||||
|
||||
It can be installed either via the [Homebrew](https://brew.sh) package manager (macOS only), or manually.
|
||||
|
||||
### Installation via Homebrew
|
||||
|
||||
To install, simply run the following command:
|
||||
|
||||
```shell
|
||||
brew install dokku/repo/dokku
|
||||
```
|
||||
|
||||
### Manual installation
|
||||
|
||||
To install manually, simply clone the Dokku repository down and add the `dokku` alias pointing at the script:
|
||||
|
||||
```shell
|
||||
git clone git@github.com:dokku/dokku.git ~/.dokku
|
||||
|
||||
# optional: make sure that the dokku_client.sh version matches your Dokku version
|
||||
cd ~/.dokku
|
||||
git checkout <tag/branch>
|
||||
|
||||
# add the following to either your
|
||||
# .bashrc, .bash_profile, or .profile file
|
||||
alias dokku='$HOME/.dokku/contrib/dokku_client.sh'
|
||||
```
|
||||
|
||||
Alternatively, if using another shell such as **zsh**, create an alias command which invokes the script using **bash**:
|
||||
|
||||
```shell
|
||||
# zsh: add the following to either .zshenv or .zshrc
|
||||
alias dokku='bash $HOME/.dokku/contrib/dokku_client.sh'
|
||||
|
||||
# fish: add the following to ~/.config/fish/config.fish
|
||||
alias dokku 'bash $HOME/.dokku/contrib/dokku_client.sh'
|
||||
|
||||
# csh: add the following to .cshrc
|
||||
alias dokku 'bash $HOME/.dokku/contrib/dokku_client.sh'
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Configure the `DOKKU_HOST` environment variable or run `dokku` from a repository with a git remote named `dokku` pointed at your Dokku host in order to use the script as normal.
|
||||
|
||||
You can also configure a `DOKKU_PORT` environment variable if you are running ssh on a non-standard port. This defaults to `22`.
|
||||
See the [remote commands documentation](/docs/deployment/remote-commands.md) for more information on how to install and use the official client.
|
||||
|
||||
## (nodejs) dokku-toolbelt
|
||||
|
||||
|
||||
@@ -24,23 +24,23 @@ The following plugins are available and provided by Dokku maintainers. Please f
|
||||
|
||||
| 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+ |
|
||||
| [Grafana/Graphite/Statsd (beta)](https://github.com/dokku/dokku-graphite-grafana) | [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+ |
|
||||
| [Nats (beta)](https://github.com/dokku/dokku-nats) | [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+ |
|
||||
| [CouchDB](https://github.com/dokku/dokku-couchdb) | [dokku][] | 0.4.0+ |
|
||||
| [Elasticsearch](https://github.com/dokku/dokku-elasticsearch-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Grafana/Graphite/Statsd](https://github.com/dokku/dokku-graphite-grafana) | [dokku][] | 0.4.0+ |
|
||||
| [MariaDB](https://github.com/dokku/dokku-mariadb-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Memcached](https://github.com/dokku/dokku-memcached-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Mongo](https://github.com/dokku/dokku-mongo-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [MySQL](https://github.com/dokku/dokku-mysql-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Nats](https://github.com/dokku/dokku-nats) | [dokku][] | 0.4.0+ |
|
||||
| [Postgres](https://github.com/dokku/dokku-postgres-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [RabbitMQ](https://github.com/dokku/dokku-rabbitmq-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Redis](https://github.com/dokku/dokku-redis-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [RethinkDB](https://github.com/dokku/dokku-rethinkdb-plugin) | [dokku][] | 0.4.0+ |
|
||||
| [Copy Files to Image](https://github.com/dokku/dokku-copyfiles-to-image) | [dokku][] | 0.4.0+ |
|
||||
| [HTTP Auth (beta)](https://github.com/dokku/dokku-http-auth) | [dokku][] | 0.4.0+ |
|
||||
| [Let's Encrypt (beta)](https://github.com/dokku/dokku-letsencrypt) | [dokku][] | 0.4.0+ |
|
||||
| [Maintenance mode (beta)](https://github.com/dokku/dokku-maintenance) | [dokku][] | 0.4.0+ |
|
||||
| [Redirect (beta)](https://github.com/dokku/dokku-redirect) | [dokku][] | 0.4.0+ |
|
||||
| [HTTP Auth](https://github.com/dokku/dokku-http-auth) | [dokku][] | 0.4.0+ |
|
||||
| [Let's Encrypt](https://github.com/dokku/dokku-letsencrypt) | [dokku][] | 0.4.0+ |
|
||||
| [Maintenance mode](https://github.com/dokku/dokku-maintenance) | [dokku][] | 0.4.0+ |
|
||||
| [Redirect](https://github.com/dokku/dokku-redirect) | [dokku][] | 0.4.0+ |
|
||||
| [Registry](https://github.com/dokku/dokku-registry) | [dokku][] | 0.12.0+
|
||||
|
||||
## Community plugins
|
||||
@@ -59,6 +59,7 @@ The following plugins are available and provided by Dokku maintainers. Please f
|
||||
[Aomitayo]: https://github.com/Aomitayo
|
||||
[apmorton]: https://github.com/apmorton
|
||||
[artofrawr]: https://github.com/artofrawr
|
||||
[badsyntax]: https://github.com/badsyntax
|
||||
[basgys]: https://github.com/basgys
|
||||
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell
|
||||
[blag]: https://github.com/blag
|
||||
@@ -76,6 +77,7 @@ The following plugins are available and provided by Dokku maintainers. Please f
|
||||
[fermuch]: https://github.com/fermuch
|
||||
[fgrehm]: https://github.com/fgrehm
|
||||
[Flink]: https://github.com/Flink
|
||||
[fomojola]: https://github.com/fomojola
|
||||
[gdi2290]: https://github.com/gdi2290
|
||||
[hughfletcher]: https://github.com/hughfletcher
|
||||
[iamale]: https://github.com/iamale
|
||||
@@ -199,6 +201,7 @@ The following plugins are available and provided by Dokku maintainers. Please f
|
||||
| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)<sup>3</sup> | [cedricziel][] | 0.3.x |
|
||||
| [Application build hook](https://github.com/fteychene/dokku-build-hook) | [fteychene][] | 0.4.0+ |
|
||||
| [Post Deploy Script](https://github.com/baikunz/dokku-post-deploy-script) | [baikunz][] | 0.4.0+ |
|
||||
| [Auto Sync](https://github.com/IdeaSynthesis/dokku-autosync)<sup>4</sup> | [fomojola][] | 0.8.1+ |
|
||||
|
||||
[217d00a]: https://github.com/dokku/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7
|
||||
|
||||
@@ -208,6 +211,8 @@ The following plugins are available and provided by Dokku maintainers. Please f
|
||||
|
||||
<sup>3</sup> Adds the ability to add custom hosts to the containers known_hosts file to be able to ssh them easily (useful with deployment keys)
|
||||
|
||||
<sup>4</sup> Adds the ability to sync an application repo with a remote Github repo (useful for automated rebuilds without needing a git push from an external system).
|
||||
|
||||
### Other Plugins
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
@@ -242,6 +247,7 @@ The following plugins are available and provided by Dokku maintainers. Please f
|
||||
| [Access](https://github.com/mainto/dokku-access) | [mainto](https://github.com/mainto) | 0.4.0+ |
|
||||
| [Dokku Nginx Trust Proxy](https://github.com/kingsquare/dokku-nginx-vhost-trustproxy) | [kingsquare](https://github.com/kingsquare) | 0.4.0+ |
|
||||
| [Fonts](https://github.com/ollej/dokku-fonts) | [ollej] | 0.19.11+ |
|
||||
| [Discourse](https://github.com/badsyntax/dokku-discourse) | [badsyntax][] | 0.21.4+ |
|
||||
|
||||
|
||||
### Deprecated Plugins
|
||||
@@ -298,9 +304,7 @@ The following plugins are no longer maintained by their developers.
|
||||
| [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 |
|
||||
| [Dokku Copy App Config Files](https://github.com/alexkruegger/dokku-app-configfiles) | [alexkruegger][] | Compatible with 0.3.17+ |
|
||||
|
|
||||
| [Dokku Registry](https://github.com/agco-adm/dokku-registry) | [agco-adm][] | 0.4.0+
|
||||
|
|
||||
| [Dokku Registry](https://github.com/agco-adm/dokku-registry) | [agco-adm][] | 0.4.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 |
|
||||
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | < 0.4.0 |
|
||||
|
||||
@@ -36,7 +36,7 @@ Move the data on the volume
|
||||
|
||||
```shell
|
||||
mkdir /mnt/volume/home/
|
||||
mkdir /mnt/volume/var/lib/
|
||||
mkdir -p /mnt/volume/var/lib/
|
||||
mv /home/dokku.OLD /mnt/volume/home/dokku
|
||||
mv /var/lib/dokku.OLD /mnt/volume/var/lib/dokku
|
||||
mv /var/lib/docker.OLD /mnt/volume/var/lib/docker
|
||||
|
||||
@@ -71,7 +71,7 @@ dokku config:export --format shell node-js-app
|
||||
|
||||
## Special Config Variables
|
||||
|
||||
The following config variables have special meanings and can be set in a variety of ways.
|
||||
The following config variables have special meanings and can be set in a variety of ways. Unless specified via global app config, the values may not be passed into applications. Usage of these values within applications should be considered unsafe, as they are an internal configuration values that may be moved to the internal properties system in the future.
|
||||
|
||||
> Warning: This list is not exhaustive, and may vary from version to version.
|
||||
|
||||
@@ -110,9 +110,7 @@ The following config variables have special meanings and can be set in a variety
|
||||
| `DOKKU_DISABLE_ANSI_PREFIX_REMOVAL` | none | `dokku config:set` <br /> `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | Disables removal of the ANSI prefix during deploys. Can be used in cases where the client deployer does not understand ansi escape codes. |
|
||||
| `DOKKU_DISABLE_APP_AUTOCREATION` | none | `dokku config:set` | Disables automatic creation of a non-existent app on deploy. |
|
||||
| `DOKKU_DOCKER_STOP_TIMEOUT` | `10` | `dokku config:set` | Configurable grace period given to the `docker stop` command. If a container has not stopped by this time, a `kill -9` signal or equivalent is sent in order to force-terminate the container. Both the `ps:stop` and `apps:destroy` commands _also_ respect this value. If not specified, the docker defaults for the [docker stop command](https://docs.docker.com/engine/reference/commandline/stop/) will be used.|
|
||||
| `DOKKU_DOCKERFILE_CMD` | dockerfile cmd | `dokku config:set` | |
|
||||
| `DOKKU_DOCKERFILE_CACHE_BUILD` | none | `dokku config:set` | |
|
||||
| `DOKKU_DOCKERFILE_ENTRYPOINT` | dockerfile entrypoint | `dokku config:set` | |
|
||||
| `DOKKU_DOCKERFILE_PORTS` | dockerfile ports | `dokku config:set` | |
|
||||
| `DOKKU_DOCKERFILE_START_CMD` | none | `dokku config:set` | |
|
||||
| `DOKKU_PARALLEL_ARGUMENTS`. | none | `dokku config:set` | Allows passing custom arguments to parallel for `ps:*all` commands |
|
||||
|
||||
@@ -11,7 +11,15 @@ nginx:show-config <app> # Display app nginx config
|
||||
nginx:validate-config [<app>] [--clean] # Validates and optionally cleans up invalid nginx configurations
|
||||
```
|
||||
|
||||
## Binding to specific addresses
|
||||
## Usage
|
||||
|
||||
### Request Proxying
|
||||
|
||||
By default, the `web` process is the only process proxied by the nginx proxy implementation. Proxying to other process types may be handled by a custom `nginx.conf.sigil` file, as generally described [below](/docs/configuration/nginx.md#customizing-the-nginx-configuration)
|
||||
|
||||
Nginx will proxy the requests in a [round-robin balancing fashion](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream) to the different deployed (scaled) containers running the `web` proctype. This way, the host's resources can be fully leveraged for single-threaded applications (e.g. `dokku ps:scale node-js-app web=4` on a 4-core machine)
|
||||
|
||||
### Binding to specific addresses
|
||||
|
||||
> New as of 0.19.2
|
||||
|
||||
@@ -33,7 +41,7 @@ dokku nginx:set node-js-app bind-address-ipv6
|
||||
|
||||
Users with apps that contain a custom `nginx.conf.sigil` file will need to modify the files to respect the new `NGINX_BIND_ADDRESS_IPV4` and `NGINX_BIND_ADDRESS_IPV6` variables.
|
||||
|
||||
## HSTS Header
|
||||
### HSTS Header
|
||||
|
||||
> New as of 0.20.0
|
||||
|
||||
@@ -53,7 +61,7 @@ The following options are also available via the `nginx:set` command:
|
||||
|
||||
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 until the max-age is reached.
|
||||
|
||||
## Checking access logs
|
||||
### Checking access logs
|
||||
|
||||
You may check nginx access logs via the `nginx:access-logs` command. This assumes that app access logs are being stored in `/var/log/nginx/$APP-access.log`, as is the default in the generated `nginx.conf`.
|
||||
|
||||
@@ -67,7 +75,7 @@ You may also follow the logs by specifying the `-t` flag.
|
||||
dokku nginx:access-logs node-js-app -t
|
||||
```
|
||||
|
||||
## Checking error logs
|
||||
### Checking error logs
|
||||
|
||||
You may check nginx error logs via the `nginx:access-logs` command. This assumes that app error logs are being stored in `/var/log/nginx/$APP-error.log`, as is the default in the generated `nginx.conf`.
|
||||
|
||||
@@ -81,7 +89,7 @@ You may also follow the logs by specifying the `-t` flag.
|
||||
dokku nginx:error-logs node-js-app -t
|
||||
```
|
||||
|
||||
## Changing log path
|
||||
### Changing log path
|
||||
|
||||
> New as of 0.20.1
|
||||
|
||||
@@ -106,7 +114,17 @@ dokku nginx:set node-js-app error-log-path
|
||||
|
||||
In all cases, the nginx config must be regenerated after setting the above values.
|
||||
|
||||
## Specifying a read timeout
|
||||
### Changing log format
|
||||
|
||||
> New as of 0.22.0
|
||||
|
||||
The format of the access log can be changed by calling the `nginx:set` command as follows:
|
||||
|
||||
```shell
|
||||
dokku nginx:set node-js-app access-log-format custom
|
||||
```
|
||||
|
||||
### Specifying a read timeout
|
||||
|
||||
> New as of 0.21.0
|
||||
|
||||
@@ -126,7 +144,7 @@ dokku nginx:set node-js-app proxy-read-timeout
|
||||
|
||||
In all cases, the nginx config must be regenerated after setting the above value.
|
||||
|
||||
## Showing the nginx config
|
||||
### Showing the nginx config
|
||||
|
||||
For debugging purposes, it may be useful to show the nginx config. This can be achieved via the `nginx:show-config` command.
|
||||
|
||||
@@ -134,7 +152,7 @@ For debugging purposes, it may be useful to show the nginx config. This can be a
|
||||
dokku nginx:show-config node-js-app
|
||||
```
|
||||
|
||||
## Validating nginx configs
|
||||
### Validating nginx configs
|
||||
|
||||
It may be desired to validate an nginx config outside of the deployment process. To do so, run the `nginx:validate-config` command. With no arguments, this will validate all app nginx configs, one at a time. A minimal wrapper nginx config is generated for each app's nginx config, upon which `nginx -t` will be run.
|
||||
|
||||
@@ -158,7 +176,7 @@ The `--clean` flag may also be specified for a given app:
|
||||
dokku nginx:validate-config node-js-app --clean
|
||||
```
|
||||
|
||||
## Customizing the nginx configuration
|
||||
### Customizing the nginx configuration
|
||||
|
||||
> New as of 0.5.0
|
||||
|
||||
@@ -166,14 +184,28 @@ Dokku uses a templating library by the name of [sigil](https://github.com/glider
|
||||
|
||||
- Copy the following example template to a file named `nginx.conf.sigil` and either:
|
||||
- If using a buildpack application, you __must__ check it into the root of your app repo.
|
||||
- `ADD` it to your dockerfile `WORKDIR`
|
||||
- if your dockerfile has no `WORKDIR`, `ADD` it to the `/app` folder
|
||||
- If using a dockerfile or docker image for deploys, either:
|
||||
- If `WORKDIR` is specified, add the file to the `WORKDIR` specified in the last Dockerfile stage (example: `WORKDIR /app` and `ADD nginx.conf.sigil /app`).
|
||||
- If no `WORKDIR` is specified, add the file to the root (`/`) of the docker image (example: `ADD nginx.conf.sigil /`).
|
||||
|
||||
> When using a custom `nginx.conf.sigil` file, depending upon your application configuration, you *may* be exposing the file externally. As this file is extracted before the container is run, you can, safely delete it in a custom `entrypoint.sh` configured in a Dockerfile `ENTRYPOINT`.
|
||||
|
||||
> The default template is available [here](https://github.com/dokku/dokku/blob/master/plugins/nginx-vhosts/templates/nginx.conf.sigil), and can be used as a guide for your own, custom `nginx.conf.sigil` file. Please refer to the appropriate template file version for your Dokku version.
|
||||
|
||||
### Available template variables
|
||||
While enabled by default, using a custom nginx config can be disabled via `nginx:set`. This may be useful in cases where you do not want to allow users to override any higher-level customization of app nginx config.
|
||||
|
||||
```shell
|
||||
# enable fetching custom config (default)
|
||||
dokku nginx:set node-js-app disable-custom-config false
|
||||
|
||||
# disable fetching custom config
|
||||
dokku nginx:set node-js-app disable-custom-config true
|
||||
```
|
||||
|
||||
Unsetting this value is the same as enabling custom nginx config usage.
|
||||
|
||||
|
||||
#### Available template variables
|
||||
|
||||
```
|
||||
{{ .APP }} Application name
|
||||
@@ -193,7 +225,7 @@ Finally, each process type has it's network listeners - a list of IP:PORT pairs
|
||||
|
||||
> Note: Application config variables are available for use in custom templates. To do so, use the form of `{{ var "FOO" }}` to access a variable named `FOO`.
|
||||
|
||||
### Customizing via configuration files included by the default templates
|
||||
#### Customizing via configuration files included by the default templates
|
||||
|
||||
The default nginx.conf template will include everything from your apps `nginx.conf.d/` subdirectory in the main `server {}` block (see above):
|
||||
|
||||
@@ -215,7 +247,7 @@ The example above uses additional configuration files directly on the Dokku host
|
||||
For PHP Buildpack users, you will also need to provide a `Procfile` and an accompanying `nginx.conf` file to customize the nginx config *within* the container. The following are example contents for your `Procfile`
|
||||
|
||||
web: vendor/bin/heroku-php-nginx -C nginx.conf -i php.ini php/
|
||||
|
||||
|
||||
Your `nginx.conf` file - not to be confused with Dokku's `nginx.conf.sigil` - would also need to be configured as shown in this example:
|
||||
|
||||
client_max_body_size 50m;
|
||||
@@ -226,7 +258,7 @@ Your `nginx.conf` file - not to be confused with Dokku's `nginx.conf.sigil` - wo
|
||||
|
||||
Please adjust the `Procfile` and `nginx.conf` file as appropriate.
|
||||
|
||||
## Custom Error Pages
|
||||
### Custom Error Pages
|
||||
|
||||
By default, Dokku provides custom error pages for the following three categories of errors:
|
||||
|
||||
@@ -236,7 +268,7 @@ By default, Dokku provides custom error pages for the following three categories
|
||||
|
||||
These are provided as an alternative to the generic Nginx error page, are shared for _all_ applications, and their contents are located on disk at `/var/lib/dokku/data/nginx-vhosts/dokku-errors`. To customize them for a specific app, create a custom `nginx.conf.sigil` as described above and change the paths to point elsewhere.
|
||||
|
||||
## Default site
|
||||
### Default site
|
||||
|
||||
By default, Dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to the global nginx configuration.
|
||||
|
||||
@@ -280,34 +312,36 @@ The configuration file must be loaded before `/etc/nginx/conf.d/dokku.conf`, so
|
||||
|
||||
Alternatively, you may push an app to your Dokku host with a name like "00-default". As long as it lists first in `ls /home/dokku/*/nginx.conf | head`, it will be used as the default nginx vhost.
|
||||
|
||||
## Domains plugin
|
||||
## Other
|
||||
|
||||
### Domains plugin
|
||||
|
||||
See the [domain configuration documentation](/docs/configuration/domains.md) for more information on how to configure domains for your app.
|
||||
|
||||
## Customizing hostnames
|
||||
### Customizing hostnames
|
||||
|
||||
See the [customizing hostnames documentation](/docs/configuration/domains.md#customizing-hostnames) for more information on how to configure domains for your app.
|
||||
|
||||
## Disabling VHOSTS
|
||||
### Disabling VHOSTS
|
||||
|
||||
See the [disabling vhosts documentation](/docs/configuration/domains.md#disabling-vhosts) for more information on how to disable domain usage for your app.
|
||||
|
||||
## Running behind a load balancer
|
||||
### Running behind a load balancer
|
||||
|
||||
See the [load balancer documentation](/docs/configuration/ssl.md#running-behind-a-load-balancer) for more information on how to configure your nginx config for running behind a network load balancer.
|
||||
|
||||
## SSL Configuration
|
||||
### SSL Configuration
|
||||
|
||||
See the [ssl documentation](/docs/configuration/ssl.md) for more information on how to configure SSL certificates for your application.
|
||||
|
||||
## Disabling Nginx
|
||||
### Disabling Nginx
|
||||
|
||||
See the [proxy documentation](/docs/advanced-usage/proxy-management.md) for more information on how to disable nginx as the proxy implementation for your app.
|
||||
|
||||
## Managing Proxy Port mappings
|
||||
### Managing Proxy Port mappings
|
||||
|
||||
See the [proxy documentation](/docs/advanced-usage/proxy-management.md#proxy-port-mapping) for more information on how to manage ports proxied for your app.
|
||||
|
||||
## Regenerating nginx config
|
||||
### Regenerating nginx config
|
||||
|
||||
See the [proxy documentation](/docs/advanced-usage/proxy-management.md#regenerating-proxy-config) for more information on how to rebuild the nginx proxy configuration for your app.
|
||||
|
||||
@@ -62,7 +62,7 @@ Now you can deploy the `ruby-getting-started` app to your Dokku server. All you
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
cd ruby-getting-started
|
||||
git remote add dokku dokku@dokku.me:ruby-getting-started
|
||||
git push dokku master
|
||||
git push dokku main:master
|
||||
```
|
||||
|
||||
> Note: Some tools may not support the short-upstream syntax referenced above, and you may need to prefix
|
||||
@@ -71,7 +71,7 @@ git push dokku master
|
||||
|
||||
> Note: Your private key should be registered with `ssh-agent` in your local development environment. If you get a `permission denied` error when pushing, you can register your private key as follows: `ssh-add -k ~/<your private key>`.
|
||||
|
||||
After running `git push dokku master`, you should have output similar to this in your terminal:
|
||||
After running `git push dokku main:master`, you should have output similar to this in your terminal:
|
||||
|
||||
```
|
||||
Counting objects: 231, done.
|
||||
@@ -102,7 +102,7 @@ Once the deploy is complete, the application's web URL will be generated as abov
|
||||
|
||||
Dokku supports deploying applications in a few ways:
|
||||
|
||||
- [Heroku buildpacks](https://devcenter.heroku.com/articles/buildpacks) via [Herokuish](https://github.com/gliderlabs/herokuish#buildpacks): See the [buildpacks documentation](/docs/deployment/methods/buildpacks.md) to learn about the different ways to specify a buildpack.
|
||||
- [Heroku buildpacks](https://devcenter.heroku.com/articles/buildpacks) via [Herokuish](https://github.com/gliderlabs/herokuish#buildpacks): See the [herokuish buildpacks documentation](/docs/deployment/methods/herokuish-buildpacks.md) to learn about the different ways to specify a buildpack.
|
||||
- [Dockerfile](https://docs.docker.com/reference/builder/): See the [dockerfile documentation](/docs/deployment/methods/dockerfiles.md) to learn about the different ways to configure Dockerfile-based deploys.
|
||||
- [Docker Image](https://docs.docker.com/get-started/overview/#docker-objects): See the [docker image documentation](/docs/deployment/methods/images.md) to learn about how to deploy a Docker Image.
|
||||
|
||||
@@ -146,8 +146,9 @@ If you do not enter a fully qualified domain name when pushing your app, Dokku d
|
||||
```shell
|
||||
# from your local machine
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
# the below example assumes your app server domain or IP is dokku.me. Push in the form of: dokku@{serveripordomain}:{dokkuappname}
|
||||
git remote add dokku dokku@dokku.me:ruby-getting-started
|
||||
git push dokku master
|
||||
git push dokku main:master
|
||||
```
|
||||
|
||||
```
|
||||
@@ -161,7 +162,7 @@ You can also specify the fully qualified name as follows:
|
||||
# from your local machine
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
git remote add dokku dokku@dokku.me:app.dokku.me
|
||||
git push dokku master
|
||||
git push dokku main:master
|
||||
```
|
||||
|
||||
```
|
||||
@@ -175,7 +176,7 @@ This is useful when you want to deploy to the root domain:
|
||||
# from your local machine
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
git remote add dokku dokku@dokku.me:dokku.me
|
||||
git push dokku master
|
||||
git push dokku main:master
|
||||
```
|
||||
|
||||
... deployment ...
|
||||
@@ -211,7 +212,7 @@ See the [image tagging documentation](/docs/deployment/methods/images.md) for mo
|
||||
|
||||
## Specifying a custom buildpack
|
||||
|
||||
See the [buildpack documentation](/docs/deployment/methods/buildpacks.md) for more information on how to specify a set of custom buildpacks for your application.
|
||||
See the [herokuish buildpack documentation](/docs/deployment/methods/herokuish-buildpacks.md) for more information on how to specify a set of custom buildpacks for your application.
|
||||
|
||||
## Removing a deployed app
|
||||
|
||||
|
||||
@@ -244,13 +244,15 @@ dokku apps:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app
|
||||
=====> node-js-app app information
|
||||
App dir: /home/dokku/node-js-app
|
||||
App deploy source: git
|
||||
App locked: false
|
||||
=====> python-sample
|
||||
not deployed
|
||||
=====> ruby-sample
|
||||
=====> python-sample app information
|
||||
App dir: /home/dokku/python-sample
|
||||
App deploy source:
|
||||
App locked: false
|
||||
=====> ruby-sample app information
|
||||
App dir: /home/dokku/ruby-sample
|
||||
App deploy source: git
|
||||
App locked: false
|
||||
@@ -263,7 +265,7 @@ dokku apps:report node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app
|
||||
=====> node-js-app app information
|
||||
App dir: /home/dokku/node-js-app
|
||||
App deploy source: git
|
||||
App locked: false
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
```
|
||||
logs <app> [-h] [-t] [-n num] [-q] [-p process] # Display recent log output
|
||||
logs:failed [<app>] # Shows the last failed deploy logs
|
||||
logs:failed [--parallel count] [--all|<app>] # Shows the last failed deploy logs
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -46,8 +46,8 @@ You can retrieve these logs by using the `logs:failed` command
|
||||
dokku logs:failed node-js-app
|
||||
```
|
||||
|
||||
You can also retrieve the failed logs for each app:
|
||||
You may also fetch all failed app logs by using the `--all` flag.
|
||||
|
||||
```shell
|
||||
dokku logs:failed node-js-app
|
||||
dokku logs:failed --all
|
||||
```
|
||||
|
||||
35
docs/deployment/methods/cloud-native-buildpacks.md
Normal file
35
docs/deployment/methods/cloud-native-buildpacks.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Cloud Native Buildpacks (Experimental)
|
||||
|
||||
> New as of 0.22.0
|
||||
|
||||
Cloud Native Buildpacks are an evolution over the Buildpacks technology provided by the Herokuish builder. See the [herokuish buildpacks documentation](/docs/deployment/methods/herokuish.md) for more information on how to clear buildpack build cache for an application.
|
||||
|
||||
> Warning: This functionality uses the `pack` cli from the [Cloud Native Buildpacks](https://buildpacks.io) project to build apps. As the integration is experimental in Dokku, it is likely to change over time.
|
||||
|
||||
## Usage
|
||||
|
||||
To use this builder instead of either `Dockerfile` or `herokuish`, you must set the `DOKKU_CNB_EXPERIMENTAL` environment variable for your app to `1`.
|
||||
|
||||
```shell
|
||||
dokku config:set --no-restart node-js-app DOKKU_CNB_EXPERIMENTAL=1
|
||||
```
|
||||
|
||||
The `pack` cli tool is not included by default with Dokku or as a dependency. It must also be installed as shown on [this page](https://buildpacks.io/docs/tools/pack/).
|
||||
|
||||
Builds will proceed with the `pack` cli for the app from then on.
|
||||
|
||||
## Caveats
|
||||
|
||||
As this functionality is highly experimental, there are a number of caveats. Please note that not all issuesare listed below.
|
||||
|
||||
- The `heroku/buildpacks:latest` CNB builder is currently enforced. Specifying specific builders is not currently possible.
|
||||
- A future release will allow modifying the chosen builder.
|
||||
- Specifying specific buildpacks is not currently possible.
|
||||
- A future release will add support for the `buildpacks` plugin.
|
||||
- There is currently no way to specify extra arguments for `pack` cli invocations.
|
||||
- A future release will add support for injecting extra arguments during the build process.
|
||||
- The default process type is `web`.
|
||||
- Build cache is stored in Docker volumes instead of on disk. As such, `repo:purge-cache` currently has no effect.
|
||||
- A future version will add integration with the `repo` plugin.
|
||||
- `pack` is not currently included with Dokku, nor is it added as a package dependency.
|
||||
- A future version will include it as a package dependency.
|
||||
@@ -65,6 +65,10 @@ ENV NODE_ENV ${NODE_ENV}
|
||||
RUN echo $NODE_ENV
|
||||
```
|
||||
|
||||
## Building images with Docker Buildkit
|
||||
|
||||
If your Dockerfile is using Docker engine's [buildkit](https://docs.docker.com/develop/develop-images/build_enhancements/) (not to be confused with buildpacks), then the `DOCKER_BUILDKIT=1` environment variable needs to be set. One way to do this is to edit `/etc/environment` on your dokku host and reboot your instance. Note, for complete build log output, you should also set `BUILDKIT_PROGRESS=plain` in the same file.
|
||||
|
||||
## Customizing the run command
|
||||
|
||||
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 Node.js image, with the following `ENTRYPOINT`:
|
||||
|
||||
@@ -8,7 +8,11 @@ git:report [<app>] [<flag>] # Displays a git report for one or more
|
||||
git:set <app> <key> (<value>) # Set or clear a git property for an app
|
||||
```
|
||||
|
||||
Git-based deployment has been the traditional method of deploying applications in Dokku. As of v0.12.0, Dokku introduces a few ways to customize the experience of deploying via `git push`. A Git-based deployment currently supports building applications via both [Buildpack](/docs/deployment/methods/buildpacks.md) and [Dockerfile](/docs/deployment/methods/dockerfiles.md).
|
||||
Git-based deployment has been the traditional method of deploying applications in Dokku. As of v0.12.0, Dokku introduces a few ways to customize the experience of deploying via `git push`. A Git-based deployment currently supports building applications via:
|
||||
|
||||
- [Cloud Native Buildpacks](/docs/deployment/methods/cloud-native-buildpacks.md)
|
||||
- [Herokuish Buildpack](/docs/deployment/methods/herokuish-buildpacks.md)
|
||||
- [Dockerfiles](/docs/deployment/methods/dockerfiles.md)
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Buildpack Deployment
|
||||
# Herokuish Buildpack Deployment
|
||||
|
||||
> Subcommands new as of 0.15.0
|
||||
|
||||
@@ -164,7 +164,7 @@ dokku buildpacks:report node-js-app --buildpacks-list
|
||||
If an application was previously deployed via Dockerfile, the following commands should be run before a buildpack deploy will succeed:
|
||||
|
||||
```shell
|
||||
dokku config:unset --no-restart node-js-app DOKKU_DOCKERFILE_CMD DOKKU_DOCKERFILE_ENTRYPOINT DOKKU_PROXY_PORT_MAP
|
||||
dokku config:unset --no-restart node-js-app DOKKU_PROXY_PORT_MAP
|
||||
```
|
||||
|
||||
### Using a specific buildpack version
|
||||
@@ -3,73 +3,110 @@
|
||||
> New as of 0.3.14, Enhanced in 0.7.0
|
||||
|
||||
```
|
||||
ps:inspect <app> # Displays a sanitized version of docker inspect for an app
|
||||
ps:rebuild <app> # Rebuild an app from source
|
||||
ps:rebuildall # Rebuild all apps from source
|
||||
ps:report [<app>] [<flag>] # Displays a process report for one or more apps
|
||||
ps:restart <app> # Restart app container(s)
|
||||
ps:restart-policy <app> # Shows the restart-policy for an app
|
||||
ps:restartall # Restart all deployed app containers
|
||||
ps:scale <app> <proc>=<count> [<proc>=<count>] # Get/Set how many instances of a given process to run
|
||||
ps:set-restart-policy <app> <policy> # Sets app restart-policy
|
||||
ps:start <app> # Start app container(s)
|
||||
ps:startall # Start all deployed app containers
|
||||
ps:stop <app> # Stop app container(s)
|
||||
ps:stopall # Stop all app container(s)
|
||||
ps:inspect <app> # Displays a sanitized version of docker inspect for an app
|
||||
ps:rebuild [--parallel count] [--all|<app>] # Rebuilds an app from source
|
||||
ps:report [<app>] [<flag>] # Displays a process report for one or more apps
|
||||
ps:restart [--parallel count] [--all|<app>] # Restart an app
|
||||
ps:restore [<app>] # Start previously running apps e.g. after reboot
|
||||
ps:scale [--skip-deploy] <app> <proc>=<count> [<proc>=<count>...] # Get/Set how many instances of a given process to run
|
||||
ps:set <app> <key> <value> # Set or clear a ps property for an app
|
||||
ps:start [--parallel count] [--all|<app>] # Start an app
|
||||
ps:stop [--parallel count] [--all|<app>] # Stop an app
|
||||
```
|
||||
|
||||
By default, Dokku will only start a single `web` process - if defined - though process scaling can be managed by the `ps` plugin or [via a custom `DOKKU_SCALE` file](/docs/deployment/process-management.md#manually-managing-process-scaling).
|
||||
|
||||
> The `web` proctype is the only proctype that will invoke custom checks as defined by a `CHECKS` file. It is also the only process type that will be launched in a container that is either proxied via nginx or bound to an external port.
|
||||
|
||||
## Usage
|
||||
|
||||
### Inspecting app containers
|
||||
|
||||
> New as of 0.13.0
|
||||
|
||||
A common administrative task to perform is calling `docker inspect` on the containers that are running for an application. This can be an error-prone task to perform, and may also reveal sensitive environment variables if not done correctly. Dokku provides a wrapper around this command via the `ps:inspect` command:
|
||||
A common administrative task to perform is calling `docker inspect` on the containers that are running for an app. This can be an error-prone task to perform, and may also reveal sensitive environment variables if not done correctly. Dokku provides a wrapper around this command via the `ps:inspect` command:
|
||||
|
||||
```shell
|
||||
dokku ps:inspect node-js-app
|
||||
```
|
||||
|
||||
This command will gather all the running container IDs for your application and call `docker inspect`, sanitizing the output data so it can be copy-pasted elsewhere safely.
|
||||
This command will gather all the running container IDs for your app and call `docker inspect`, sanitizing the output data so it can be copy-pasted elsewhere safely.
|
||||
|
||||
### Rebuilding applications
|
||||
### Rebuilding apps
|
||||
|
||||
There are some Dokku commands which will not automatically rebuild an application's environment, or which can be told to skip a rebuild. For instance, you may wish to run multiple `config:set` commands without a restart so as to speed up configuration. In these cases, you can ultimately trigger an application rebuild using `ps:rebuild`
|
||||
> Warning: This section applies only to git-based deploys, and only works deterministically for these apps. Please see the [images documentation](/docs/deployment/methods/images.md) and [tar documentation](/docs/deployment/methods/tar.md)
|
||||
> in for more information concerning rebuilding those apps.
|
||||
|
||||
It may be useful to rebuild an app at will, such as for commands that do not rebuild an app or when skipping a rebuild after setting multiple config values. For these use cases, the `ps:rebuild` function can be used.
|
||||
|
||||
```shell
|
||||
dokku ps:rebuild node-js-app
|
||||
```
|
||||
|
||||
You may also rebuild all applications at once, which is useful when enabling/disabling a plugin that modifies all applications:
|
||||
All apps may be rebuilt by using the `--all` flag.
|
||||
|
||||
```shell
|
||||
dokku ps:rebuildall
|
||||
dokku ps:rebuild --all
|
||||
```
|
||||
|
||||
> The `ps:rebuild` and `ps:rebuildall` commands only work for applications for which there is a source, and thus
|
||||
> will only always work deterministically for Git-deployed application. Please see
|
||||
> the [images documentation](/docs/deployment/methods/images.md) and [tar documentation](/docs/deployment/methods/tar.md)
|
||||
> in for more information concerning rebuilding those applications.
|
||||
By default, rebuilding all apps happens serially. The parallelism may be controlled by the `--parallel` flag.
|
||||
|
||||
### Restarting applications
|
||||
```shell
|
||||
dokku ps:rebuild --all --parallel 2
|
||||
```
|
||||
|
||||
Applications can be restarted, which is functionally identical to calling the `release_and_deploy` function on an application. Please note that any linked containers *must* be started before the application in order to have a successful boot.
|
||||
Finally, the number of parallel workers may be automatically set to the number of CPUs available by setting the `--parallel` flag to `-1`
|
||||
|
||||
```shell
|
||||
dokku ps:rebuild --all --parallel -1
|
||||
```
|
||||
|
||||
A missing linked container will result in failure to boot apps. Services should all be started for apps being rebuilt.
|
||||
|
||||
### Restarting apps
|
||||
|
||||
An app may be restarted using the `ps:restart` command.
|
||||
|
||||
```shell
|
||||
dokku ps:restart node-js-app
|
||||
```
|
||||
|
||||
You may also trigger a restart on all applications at one time:
|
||||
All apps may be restarted by using the `--all` flag.
|
||||
|
||||
```shell
|
||||
dokku ps:restartall
|
||||
dokku ps:restart --all
|
||||
```
|
||||
|
||||
### `ps:scale` command
|
||||
By default, restarting all apps happens serially. The parallelism may be controlled by the `--parallel` flag.
|
||||
|
||||
```shell
|
||||
dokku ps:restart --all --parallel 2
|
||||
```
|
||||
|
||||
Finally, the number of parallel workers may be automatically set to the number of CPUs available by setting the `--parallel` flag to `-1`
|
||||
|
||||
```shell
|
||||
dokku ps:restart --all --parallel -1
|
||||
```
|
||||
|
||||
A missing linked container will result in failure to boot apps. Services should all be started for apps being rebuilt.
|
||||
|
||||
### Displaying existing scale properties
|
||||
|
||||
Issuing the `ps:scale` command with no arguments will output the current scaling properties for an app.
|
||||
|
||||
```shell
|
||||
dokku ps:scale node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
-----> Scaling for python
|
||||
proctype: qty
|
||||
--------: ---
|
||||
web: 1
|
||||
```
|
||||
|
||||
### Scaling apps
|
||||
|
||||
#### Via CLI
|
||||
|
||||
> This functionality is disabled if the formation is managed via a file such as `DOKKU_SCALE`.
|
||||
|
||||
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.
|
||||
|
||||
@@ -83,133 +120,178 @@ Multiple process types can be scaled at once:
|
||||
dokku ps:scale node-js-app web=1 worker=1
|
||||
```
|
||||
|
||||
Issuing the `ps:scale` command with no process type argument will output the current scaling settings for an application:
|
||||
If desired, the corresponding deploy will be skipped by using the `--skip-deploy` flag:
|
||||
|
||||
```shell
|
||||
dokku ps:scale node-js-app
|
||||
dokku ps:scale --skip-deploy node-js-app web=1
|
||||
```
|
||||
|
||||
```
|
||||
-----> Scaling for node-js-app
|
||||
-----> proctype qty
|
||||
-----> -------- ---
|
||||
-----> web 1
|
||||
-----> worker 1
|
||||
```
|
||||
#### Manually managing process scaling
|
||||
|
||||
### Stopping applications
|
||||
> Using a `DOKKU_SCALE` formation file disables the ability to use `ps:scale` for scaling.
|
||||
|
||||
Deployed applications can be stopped using the `ps:stop` command. This turns off all running containers for an application, and will result in a **502 Bad Gateway** response for the default nginx proxy implementation.
|
||||
A `DOKKU_SCALE` file can be committed to the root of the pushed app repository, and must be within the built image artifact in the image's working directory as shown below.
|
||||
|
||||
```shell
|
||||
dokku ps:stop node-js-app
|
||||
```
|
||||
- Buildpacks: `/app/DOKKU_SCALE`
|
||||
- Dockerfile: `WORKDIR/DOKKU_SCALE` or `/DOKKU_SCALE`
|
||||
- Docker Image: `WORKDIR/DOKKU_SCALE` or `/DOKKU_SCALE`
|
||||
|
||||
You may also stop all applications at once:
|
||||
|
||||
```shell
|
||||
dokku ps:stopall
|
||||
```
|
||||
|
||||
### Starting applications
|
||||
|
||||
All stopped containers can be started using the `ps:start` command. This is similar to running `ps:restart`, except no action will be taken if the application containers are running.
|
||||
|
||||
```shell
|
||||
dokku ps:start node-js-app
|
||||
```
|
||||
|
||||
### Starting all applications
|
||||
|
||||
In some cases, it may be necessary to start all applications from scratch - e.g. if all Docker containers have been manually stopped. This can be executed via the `ps:startall` command, which supports parallelism in the same manner `ps:rebuildall`, `ps:restartall`, and `ps:stopall` do.
|
||||
|
||||
Be aware that no action will be taken if the application containers are running.
|
||||
|
||||
```shell
|
||||
dokku ps:startall
|
||||
```
|
||||
|
||||
## Restart policies
|
||||
|
||||
> New as of 0.7.0
|
||||
|
||||
By default, Dokku will automatically restart containers that exit with a non-zero status up to 10 times via the [on-failure Docker restart policy](https://docs.docker.com/engine/reference/run/#restart-policies-restart).
|
||||
|
||||
### Showing the current restart policy
|
||||
|
||||
The `ps:restart-policy` command will show the currently configured restart policy for an application. The default policy is `on-failure:10`
|
||||
|
||||
```shell
|
||||
dokku ps:restart-policy node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app restart-policy:
|
||||
on-failure:10
|
||||
```
|
||||
|
||||
### Setting the restart policy
|
||||
|
||||
You can configure this via the `ps:set-restart-policy` command:
|
||||
|
||||
```shell
|
||||
# always restart an exited container
|
||||
dokku ps:set-restart-policy node-js-app always
|
||||
```
|
||||
|
||||
```
|
||||
-----> Setting restart policy: always
|
||||
```
|
||||
|
||||
```shell
|
||||
# never restart an exited container
|
||||
dokku ps:set-restart-policy node-js-app no
|
||||
```
|
||||
|
||||
```
|
||||
-----> Setting restart policy: no
|
||||
```
|
||||
|
||||
```shell
|
||||
# only restart it on Docker restart if it was not manually stopped
|
||||
dokku ps:set-restart-policy node-js-app unless-stopped
|
||||
```
|
||||
|
||||
```
|
||||
-----> Setting restart policy: unless-stopped
|
||||
```
|
||||
|
||||
```shell
|
||||
# restart only on non-zero exit status
|
||||
dokku ps:set-restart-policy node-js-app on-failure
|
||||
```
|
||||
|
||||
```
|
||||
-----> Setting restart policy: on-failure
|
||||
```
|
||||
|
||||
```shell
|
||||
# restart only on non-zero exit status up to 20 times
|
||||
dokku ps:set-restart-policy node-js-app on-failure:20
|
||||
```
|
||||
|
||||
```
|
||||
-----> Setting restart policy: on-failure:20
|
||||
```
|
||||
|
||||
Restart policies have no bearing on server reboot, and Dokku will always attempt to restart your applications at that point unless they were manually stopped.
|
||||
|
||||
## Manually managing process scaling
|
||||
|
||||
You can optionally *commit* a `DOKKU_SCALE` file to the root of your repository - *not* to the `/home/dokku/APP` directory. Dokku expects this file to contain one line for every process defined in your Procfile.
|
||||
|
||||
Example:
|
||||
The `DOKKU_SCALE` file format is as follows:
|
||||
|
||||
```Procfile
|
||||
web=1
|
||||
worker=2
|
||||
```
|
||||
|
||||
If it is not committed to the repository, the `DOKKU_SCALE` file will otherwise be automatically generated based on your `ps:scale` settings.
|
||||
Removing the file will result in Dokku respecting the `ps:scale` command for setting scale values.
|
||||
|
||||
> *NOTE*: Dokku will always use the `DOKKU_SCALE` file that ships with the repo to override any local settings.
|
||||
#### The `web` process
|
||||
|
||||
For initial app deploys, Dokku will default to starting a single `web` process for each app. This process may be defined within the `Procfile` or as the `CMD` (for Dockerfile or Docker image deploys). Scaling of the `web` process - and others - may be managed via `ps:scale` or a `DOKKU_SCALE` formation file either before or after the initial deploy.
|
||||
|
||||
There are also a few other exceptions for the `web` process.
|
||||
|
||||
- Custom checks defined by a `CHECKS` file only apply to the `web` process type.
|
||||
- By default, the built-in nginx proxy implementation only proxies the `web` process (others may be handled via a custom `nginx.conf.sigil`).
|
||||
- See the [nginx request proxying documentation](/docs/configuration/nginx.md#request-proxying) for more information on how nginx handles proxied requests.
|
||||
- Only the `web` process may be bound to an external port.
|
||||
|
||||
### Stopping apps
|
||||
|
||||
Deployed apps can be stopped using the `ps:stop` command. This turns off all running containers for an app, and will result in a **502 Bad Gateway** response for the default nginx proxy implementation.
|
||||
|
||||
```shell
|
||||
dokku ps:stop node-js-app
|
||||
```
|
||||
|
||||
All apps may be stopped by using the `--all` flag.
|
||||
|
||||
```shell
|
||||
dokku ps:stop --all
|
||||
```
|
||||
|
||||
By default, stopping all apps happens serially. The parallelism may be controlled by the `--parallel` flag.
|
||||
|
||||
```shell
|
||||
dokku ps:stop --all --parallel 2
|
||||
```
|
||||
|
||||
Finally, the number of parallel workers may be automatically set to the number of CPUs available by setting the `--parallel` flag to `-1`
|
||||
|
||||
```shell
|
||||
dokku ps:stop --all --parallel -1
|
||||
```
|
||||
|
||||
### Starting apps
|
||||
|
||||
All stopped containers can be started using the `ps:start` command. This is similar to running `ps:restart`, except no action will be taken if the app containers are running.
|
||||
|
||||
```shell
|
||||
dokku ps:start node-js-app
|
||||
```
|
||||
|
||||
All apps may be started by using the `--all` flag.
|
||||
|
||||
```shell
|
||||
dokku ps:start --all
|
||||
```
|
||||
|
||||
By default, starting all apps happens serially. The parallelism may be controlled by the `--parallel` flag.
|
||||
|
||||
```shell
|
||||
dokku ps:start --all --parallel 2
|
||||
```
|
||||
|
||||
Finally, the number of parallel workers may be automatically set to the number of CPUs available by setting the `--parallel` flag to `-1`
|
||||
|
||||
```shell
|
||||
dokku ps:start --all --parallel -1
|
||||
```
|
||||
|
||||
### Restart policies
|
||||
|
||||
> New as of 0.7.0, Command Changed in 0.22.0
|
||||
|
||||
By default, Dokku will automatically restart containers that exit with a non-zero status up to 10 times via the [on-failure Docker restart policy](https://docs.docker.com/engine/reference/run/#restart-policies---restart).
|
||||
|
||||
#### Setting the restart policy
|
||||
|
||||
> A change in the restart policy must be followed by a `ps:rebuild` call.
|
||||
|
||||
You can configure this via the `ps:set` command:
|
||||
|
||||
```shell
|
||||
# always restart an exited container
|
||||
dokku ps:set node-js-app restart-policy always
|
||||
|
||||
# never restart an exited container
|
||||
dokku ps:set node-js-app restart-policy no
|
||||
|
||||
# only restart it on Docker restart if it was not manually stopped
|
||||
dokku ps:set node-js-app restart-policy unless-stopped
|
||||
|
||||
# restart only on non-zero exit status
|
||||
dokku ps:set node-js-app restart-policy on-failure
|
||||
|
||||
# restart only on non-zero exit status up to 20 times
|
||||
dokku ps:set node-js-app restart-policy on-failure:20
|
||||
```
|
||||
|
||||
Restart policies have no bearing on server reboot, and Dokku will always attempt to restart your apps at that point unless they were manually stopped.
|
||||
|
||||
|
||||
### Displaying reports for an app
|
||||
|
||||
> New as of 0.12.0
|
||||
|
||||
You can get a report about the deployed apps using the `ps:report` command:
|
||||
|
||||
```shell
|
||||
dokku ps:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app ps information
|
||||
Deployed: false
|
||||
Processes: 0
|
||||
Ps can scale: true
|
||||
Ps restart policy: on-failure:10
|
||||
Restore: true
|
||||
Running: false
|
||||
=====> python-sample ps information
|
||||
Deployed: false
|
||||
Processes: 0
|
||||
Ps can scale: true
|
||||
Ps restart policy: on-failure:10
|
||||
Restore: true
|
||||
Running: false
|
||||
=====> ruby-sample ps information
|
||||
Deployed: false
|
||||
Processes: 0
|
||||
Ps can scale: true
|
||||
Ps restart policy: on-failure:10
|
||||
Restore: true
|
||||
Running: false
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku ps:report node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app ps information
|
||||
Deployed: false
|
||||
Processes: 0
|
||||
Ps can scale: true
|
||||
Ps restart policy: on-failure:10
|
||||
Restore: true
|
||||
Running: false
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku ps:report node-js-app --deployed
|
||||
```
|
||||
|
||||
@@ -21,8 +21,75 @@ in order to avoid SSH interpretting Dokku arguments for itself.
|
||||
--force force flag. currently used in apps:destroy and other ":destroy" commands
|
||||
```
|
||||
|
||||
## Clients
|
||||
## Official Client
|
||||
|
||||
You may optionally use a client to connect to your Dokku server. Most clients use the configured `git remote` to locate the Dokku server, though some allow for overriding this via an environment variable or flag.
|
||||
You may optionally use the official client when connecting to the Dokku server.
|
||||
|
||||
Please refer to the [clients](/docs/community/clients.md) list for more details.
|
||||
Of all methods, this is the *most* official method of interacting with your Dokku installation. It is a bash script that interacts with a remote Dokku installation via `ssh`. It is available in `contrib/dokku_client.sh` in the root of the Dokku repository.
|
||||
|
||||
It can be installed either via the [Homebrew](https://brew.sh) package manager (macOS only), or manually.
|
||||
|
||||
### Installation via Homebrew
|
||||
|
||||
To install, simply run the following command:
|
||||
|
||||
```shell
|
||||
brew install dokku/repo/dokku
|
||||
```
|
||||
|
||||
### Manual installation
|
||||
|
||||
To install manually, simply clone the Dokku repository down and add the `dokku` alias pointing at the script:
|
||||
|
||||
```shell
|
||||
git clone git@github.com:dokku/dokku.git ~/.dokku
|
||||
|
||||
# optional: make sure that the dokku_client.sh version matches your Dokku version
|
||||
cd ~/.dokku
|
||||
git checkout <tag/branch>
|
||||
|
||||
# add the following to either your
|
||||
# .bashrc, .bash_profile, or .profile file
|
||||
alias dokku='$HOME/.dokku/contrib/dokku_client.sh'
|
||||
```
|
||||
|
||||
Alternatively, if using another shell such as **zsh**, create an alias command which invokes the script using **bash**:
|
||||
|
||||
```shell
|
||||
# zsh: add the following to either .zshenv or .zshrc
|
||||
alias dokku='bash $HOME/.dokku/contrib/dokku_client.sh'
|
||||
|
||||
# fish: add the following to ~/.config/fish/config.fish
|
||||
alias dokku 'bash $HOME/.dokku/contrib/dokku_client.sh'
|
||||
|
||||
# csh: add the following to .cshrc
|
||||
alias dokku 'bash $HOME/.dokku/contrib/dokku_client.sh'
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
All commands have the application name automatically set via the `--app` flag on the remote server, and thus the app name does not need to be specified manually for core plugins.
|
||||
|
||||
The client supports several environment variables:
|
||||
|
||||
- `DOKKU_HOST` (default: `dokku` git remote): Used to interact with a specific remote server. Can be overriden via `--remote` flag.
|
||||
- `DOKKU_PORT` (default: `22`): Used to specify a port to connect to the Dokku server on.
|
||||
|
||||
It also supports several flags (all flags unspecified here are passed as is to the server):
|
||||
|
||||
- `--app`: Override the remote app in use.
|
||||
- `--trace`: Enable trace mode.
|
||||
- `--remote`: Override the remote server.
|
||||
- `--global`: Unsets the "app" value. May not be supported for the specified command.
|
||||
|
||||
In addition, the following commands have special local side-effects:
|
||||
|
||||
- `apps:create`:
|
||||
- If no local `--app` flag is specified or detected from a `dokku` git remote, a random name is generated and used for the app.
|
||||
- The `dokku` git remote is set if not already set.
|
||||
- `apps:destroy`:
|
||||
- Removes the local `dokku` git remote if set.
|
||||
|
||||
## Unofficial Clients
|
||||
|
||||
Please refer to the [community clients](/docs/community/clients.md) list for more details.
|
||||
|
||||
@@ -97,12 +97,12 @@ If a plugin depends on a specific command-line tool, check whether that tool exi
|
||||
```shell
|
||||
# `command -v` example
|
||||
if ! command -v "nginx" &>/dev/null; then
|
||||
log-fail "Missing nginx, install it"
|
||||
dokku_log_fail "Missing nginx, install it"
|
||||
fi
|
||||
|
||||
# `which` example
|
||||
if ! which nginx >/dev/null 2>&1; then
|
||||
log-fail "Missing nginx, install it"
|
||||
dokku_log_fail "Missing nginx, install it"
|
||||
fi
|
||||
```
|
||||
|
||||
@@ -210,7 +210,7 @@ Files are copied from the `/app` directory - for images built via buildpacks - o
|
||||
|
||||
Plugins should **not** call the `dokku` binary directly from within plugins because clients using the `--app` argument are potentially broken when doing so.
|
||||
|
||||
Plugins should instead source the `functions` file for a given plugin when attempting to call Dokku internal functions.
|
||||
Plugins should instead source the `functions` file for a given plugin when attempting to call Dokku internal functions. In cases where plugin functions cannot be sourced (eg if a plugin is implemented in Golang), then call the relevant [plugin triggers](/docs/development/plugin-triggers.md) instead.
|
||||
|
||||
# Sample plugin
|
||||
|
||||
|
||||
@@ -738,7 +738,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description: Computes the ports for a given app container
|
||||
- Invoked by: `internally triggered by proxy-build-config within proxy implementations`
|
||||
- Arguments: `$APP`
|
||||
- Arguments: `$APP $PROC_TYPE $IS_HEROKUISH_CONTAINER $CONTAINER_INDEX`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -854,11 +854,41 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `nginx-app-template-source`
|
||||
|
||||
- Description: Return the path to a `sigil` template that should be used to generate a given nginx configuration file.
|
||||
- Invoked by: `nginx-vhosts#build-config`
|
||||
- Arguments: `$APP $TEMPLATE_TYPE`
|
||||
- The `TEMPLATE_TYPE` argument can be one of: `[app-config, hsts-config, validate-config]`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
APP="$1"
|
||||
TEMPLATE_TYPE="$2"
|
||||
case "$TEMPLATE_TYPE" in
|
||||
app-config)
|
||||
echo "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/app.conf.sigil";;
|
||||
hsts-config)
|
||||
echo "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hsts.conf.sigil";;
|
||||
validate-config)
|
||||
echo "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/validate.conf.sigil";;
|
||||
*)
|
||||
dokku_log_fail "Invalid template type: ${TEMPLATE_TYPE}"
|
||||
esac
|
||||
```
|
||||
|
||||
The default templates are viewable here: [plugins/nginx-vhosts/templates/](https://github.com/dokku/dokku/tree/master/plugins/nginx-vhosts/templates)
|
||||
|
||||
### `nginx-dokku-template-source`
|
||||
|
||||
- Description: Customize the source location of the `dokku.conf` nginx configuration file
|
||||
- Description: Return the path to a `sigil` template that should be used to generate the `dokku.conf` nginx configuration file.
|
||||
- Invoked by: `nginx-vhosts#install`
|
||||
- Arguments:
|
||||
- Arguments: None, however the `sigil` template can make use of the following variables: `$.DOKKU_ROOT $.NGINX_ROOT`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -866,9 +896,11 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
echo "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/dokku.conf.sigil"
|
||||
```
|
||||
|
||||
The default template is viewable here: [plugins/nginx-vhosts/templates/dokku.conf.sigil](https://github.com/dokku/dokku/blob/master/plugins/nginx-vhosts/templates/dokku.conf.sigil)
|
||||
|
||||
### `nginx-hostname`
|
||||
|
||||
- Description: Allows you to customize the hostname for a given app
|
||||
@@ -983,6 +1015,24 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-build-cnb`
|
||||
|
||||
> Warning: The cnb plugin trigger apis are under development and may change
|
||||
> between minor releases until the 1.0 release.
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to apps using cnb.
|
||||
- Invoked by: `internal function dokku_build() (build phase)`
|
||||
- Arguments: `$APP` `$SOURCECODE_WORK_DIR`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to apps using a dockerfile.
|
||||
@@ -1199,6 +1249,29 @@ verify_app_name "$APP"
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-release-cnb`
|
||||
|
||||
> Warning: The cnb plugin trigger apis are under development and may change
|
||||
> between minor releases until the 1.0 release.
|
||||
|
||||
> Warning: Image mutation in this trigger may result in an invalid run state, and is heavily discouraged.
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to apps using cnb.
|
||||
- Invoked by: `internal function dokku_release() (release phase)`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-release-dockerfile`
|
||||
|
||||
> Warning: Image mutation in this trigger may result in an invalid run state, and is heavily discouraged.
|
||||
@@ -1222,7 +1295,7 @@ verify_app_name "$APP"
|
||||
### `post-stop`
|
||||
|
||||
- Description: Can be used to run commands after an app is manually stopped
|
||||
- Invoked by: `dokku ps:stop` and `dokku ps:stopall`
|
||||
- Invoked by: `dokku ps:stop`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
@@ -1252,6 +1325,24 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-build-cnb`
|
||||
|
||||
> Warning: The cnb plugin trigger apis are under development and may change
|
||||
> between minor releases until the 1.0 release.
|
||||
|
||||
- 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 apps using cnb.
|
||||
- Invoked by: `internal function dokku_build() (build phase)`
|
||||
- Arguments: `$APP` `$SOURCECODE_WORK_DIR`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to apps using a dockerfile.
|
||||
@@ -1393,6 +1484,27 @@ DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0"
|
||||
docker commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" $CID $IMAGE >/dev/null
|
||||
```
|
||||
|
||||
|
||||
### `pre-release-cnb`
|
||||
|
||||
> Warning: The cnb plugin trigger apis are under development and may change
|
||||
> between minor releases until the 1.0 release.
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to apps using cnb.
|
||||
- Invoked by: `internal function dokku_release() (release phase)`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
APP="$1"; IMAGE_TAG="$2";
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-release-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to apps using a dockerfile.
|
||||
@@ -1445,6 +1557,51 @@ APP="$1";
|
||||
curl "https://dokku.me/starting/${APP}" || true
|
||||
```
|
||||
|
||||
### `procfile-extract`
|
||||
|
||||
- Description: Extracts a Procfile from a given image to a path
|
||||
- Invoked by: `internally`
|
||||
- Arguments: `$APP $IMAGE`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `procfile-get-command`
|
||||
|
||||
- Description: Fetches the command for a specific process type
|
||||
- Invoked by: `internally`
|
||||
- Arguments: `$APP $PROCESS_TYPE $PORT`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `procfile-remove`
|
||||
|
||||
- Description: Removes the extracted Procfile
|
||||
- Invoked by: `internally`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `proxy-build-config`
|
||||
|
||||
- Description: Builds the proxy implementation configuration for a given app
|
||||
@@ -1577,6 +1734,22 @@ fi
|
||||
plugn trigger receive-app $APP $newrev
|
||||
```
|
||||
|
||||
### `release-and-deploy`
|
||||
|
||||
- Description: Triggers a release of the image tag and a subsequent deploy
|
||||
- Invoked by:
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1";
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `report`
|
||||
|
||||
- Description: Allows you to report on any custom configuration in use by your application
|
||||
@@ -1816,6 +1989,26 @@ DOKKU_SCHEDULER="$1"; APP="$2"; CONTAINER_ID="$3";
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `scheduler-register-retired`
|
||||
|
||||
> Warning: The scheduler plugin trigger apis are under development and may change
|
||||
> between minor releases until the 1.0 release.
|
||||
|
||||
- Description: Allows scheduling retiring a local container and any related images
|
||||
- Invoked by: `internally`
|
||||
- Arguments: `$APP $CONTAINER_ID`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1";
|
||||
CONTAINER_ID="$2";
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `scheduler-retire`
|
||||
|
||||
> Warning: The scheduler plugin trigger apis are under development and may change
|
||||
|
||||
@@ -29,7 +29,7 @@ The workflow looks like this:
|
||||
```shell
|
||||
# having dokku-arch in ../dokku-arch
|
||||
vagrant up build-arch
|
||||
# wait for "==> build-arch: ==> Finished making: dokku 0.21.2-2 (Mon Feb 22 23:20:37 CET 2016)"
|
||||
# wait for "==> build-arch: ==> Finished making: dokku 0.22.2-2 (Mon Feb 22 23:20:37 CET 2016)"
|
||||
cd ../dokku-arch
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m 'Update to dokku 0.9.9'
|
||||
|
||||
@@ -75,20 +75,14 @@ bats tests/unit/10_apps.bats tests/unit/10_certs.bats
|
||||
|
||||
In order to increase testing velocity, a wrapper script around Bats is available that can be used to run a single test case within a suite.
|
||||
|
||||
Tests within a suite may be listed by specifying the suite as a parameter to the `tests/bats-exec-test-single` script.
|
||||
Tests within a suite may be listed by specifying the suite as a parameter to `bats`.
|
||||
|
||||
```shell
|
||||
tests/bats-exec-test-single tests/unit/10_apps.bats
|
||||
bats tests/unit/10_apps.bats
|
||||
```
|
||||
|
||||
A single test can be specified as a second parameter. The test is selected by fuzzy-match, and only the first match is executed.
|
||||
A single test can be specified via the `--filter` argument. The tests are selected via regex match, and all matches are executed.
|
||||
|
||||
```shell
|
||||
tests/bats-exec-test-single tests/unit/10_apps.bats clone
|
||||
```
|
||||
|
||||
Some special characters are translated in the test listing, specifically the characters `( ) :`, while others are not. The fuzzy matching happens on test names as listed by this script, so executing a test with a more specific name will work as expected.
|
||||
|
||||
```shell
|
||||
tests/bats-exec-test-single tests/unit/10_apps.bats clone_-2d-2dskip-2ddeploy
|
||||
bats --filter clone tests/unit/10_apps.bats
|
||||
```
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Pull the dokku/dokku image:
|
||||
|
||||
```shell
|
||||
docker pull dokku/dokku:0.21.2
|
||||
docker pull dokku/dokku:0.22.2
|
||||
```
|
||||
|
||||
Next, run the image.
|
||||
@@ -17,7 +17,7 @@ docker run \
|
||||
--publish 8443:443 \
|
||||
--volume /var/lib/dokku:/mnt/dokku \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
dokku/dokku:0.21.2
|
||||
dokku/dokku:0.22.2
|
||||
```
|
||||
|
||||
Dokku is run in the following configuration:
|
||||
|
||||
@@ -21,8 +21,8 @@ To install the latest stable version of Dokku, you can run the following shell c
|
||||
|
||||
```shell
|
||||
# for debian systems, installs Dokku via apt-get
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.21.2/bootstrap.sh;
|
||||
sudo DOKKU_TAG=v0.21.2 bash bootstrap.sh
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.2/bootstrap.sh;
|
||||
sudo DOKKU_TAG=v0.22.2 bash bootstrap.sh
|
||||
```
|
||||
|
||||
The installation process takes about 5-10 minutes, depending upon internet connection speed.
|
||||
|
||||
@@ -36,7 +36,7 @@ All applications should be stopped, and all docker containers and images deleted
|
||||
|
||||
```shell
|
||||
# stop all applications
|
||||
dokku ps:stopall
|
||||
dokku ps:stop --all
|
||||
|
||||
# cleanup containers and images
|
||||
dokku cleanup
|
||||
|
||||
@@ -19,6 +19,7 @@ Docker releases updates periodically to their engine. We recommend reading their
|
||||
|
||||
Before upgrading, check the migration guides to get comfortable with new features and prepare your deployment to be upgraded.
|
||||
|
||||
- [Upgrading to 0.22](/docs/appendices/0.22.0-migration-guide.md)
|
||||
- [Upgrading to 0.21](/docs/appendices/0.21.0-migration-guide.md)
|
||||
- [Upgrading to 0.20](/docs/appendices/0.20.0-migration-guide.md)
|
||||
- [Upgrading to 0.10](/docs/appendices/0.10.0-migration-guide.md)
|
||||
@@ -39,10 +40,14 @@ Why do we recommend stopping all apps?
|
||||
- `docker`: Containers may be randomly reset during the upgrade process, resulting in
|
||||
requests being sent to the wrong containers. Acknowledging and scheduling downtime
|
||||
thus becomes much more important.
|
||||
- `herokuish`: While not required, it may be useful to take advantage of the
|
||||
- `herokuish`: While not required, it may be useful to take advantage of the latest
|
||||
base image. Herokuish changes do not cause issues unless the base OS changes, which
|
||||
may happen in minor or major releases.
|
||||
|
||||
```shell
|
||||
# for 0.11.4 and newer versions, use:
|
||||
# for 0.22.0 and newer versions, use
|
||||
|
||||
# for versions between 0.11.4 and 0.21.4, use
|
||||
dokku ps:stopall
|
||||
|
||||
# for versions between 0.8.1 and 0.11.3, use
|
||||
@@ -58,10 +63,10 @@ After upgrading, you should rebuild the applications to take advantage of any
|
||||
new buildpacks that were released:
|
||||
|
||||
```shell
|
||||
dokku ps:rebuildall
|
||||
dokku ps:rebuild --all
|
||||
```
|
||||
|
||||
> If you have any applications deployed via the `tags` or `tar` commands, do not run the `ps:rebuildall` command,
|
||||
> If you have any applications deployed via the `tags` or `tar` commands, do not run the `ps:rebuild --all` command,
|
||||
> and instead trigger `ps:rebuild` manually for each `git`-deployed application:
|
||||
>
|
||||
> ```
|
||||
|
||||
@@ -10,30 +10,30 @@
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
|
||||
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-title" content="Dokku">
|
||||
<meta name="application-name" content="Dokku">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/style.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/style.css" rel="stylesheet">
|
||||
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
|
||||
<style>
|
||||
.sponsors {
|
||||
@@ -127,12 +127,12 @@
|
||||
<p class="line">
|
||||
<span class="path"></span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.21.2/bootstrap.sh</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.22.2/bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path"></span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.21.2 bash bootstrap.sh</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.22.2 bash bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="output"> # go to your server's IP and follow the web installer</span>
|
||||
|
||||
@@ -9,26 +9,26 @@
|
||||
<meta name="author" content="">
|
||||
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-title" content="Dokku">
|
||||
<meta name="application-name" content="Dokku">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<script>
|
||||
@@ -42,7 +42,7 @@
|
||||
</script>
|
||||
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.21.2/docs/assets/style.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.2/docs/assets/style.css" rel="stylesheet">
|
||||
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
|
||||
<style>
|
||||
@@ -128,7 +128,8 @@
|
||||
|
||||
<a href="#" class="list-group-item disabled">Deployment Methods</a>
|
||||
|
||||
<a href="/{{NAME}}/deployment/methods/buildpacks/" class="list-group-item">Buildpack Deployment</a>
|
||||
<a href="/{{NAME}}/deployment/methods/cloud-native-buildpacks/" class="list-group-item">Cloud Native Buildpacks</a>
|
||||
<a href="/{{NAME}}/deployment/methods/herokuish-buildpacks/" class="list-group-item">Herokuish Buildpacks</a>
|
||||
<a href="/{{NAME}}/deployment/methods/dockerfiles/" class="list-group-item">Dockerfile Deployment</a>
|
||||
<a href="/{{NAME}}/deployment/methods/images/" class="list-group-item">Docker Image Deployment</a>
|
||||
<a href="/{{NAME}}/deployment/methods/git/" class="list-group-item">Git Deployment</a>
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"process-management": "deployment/process-management/",
|
||||
"remote-commands": "deployment/remote-commands/",
|
||||
|
||||
"deployment/buildpacks": "deployment/methods/buildpacks/",
|
||||
"deployment/buildpacks": "deployment/methods/herokuish-buildpacks/",
|
||||
"deployment/methods/buildpacks": "deployment/methods/herokuish-buildpacks/",
|
||||
"deployment/dockerfiles": "deployment/methods/dockerfiles/",
|
||||
"deployment/images": "deployment/methods/images/",
|
||||
"configuration-management": "configuration/environment-variables/",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core standard plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
1
plugins/20_events/nginx-app-template-source
Symbolic link
1
plugins/20_events/nginx-app-template-source
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core events logging plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
1
plugins/20_events/post-build-cnb
Symbolic link
1
plugins/20_events/post-build-cnb
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/post-release-cnb
Symbolic link
1
plugins/20_events/post-release-cnb
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/pre-build-cnb
Symbolic link
1
plugins/20_events/pre-build-cnb
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/pre-release-cnb
Symbolic link
1
plugins/20_events/pre-release-cnb
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/procfile-extract
Symbolic link
1
plugins/20_events/procfile-extract
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/procfile-get-command
Symbolic link
1
plugins/20_events/procfile-get-command
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/procfile-remove
Symbolic link
1
plugins/20_events/procfile-remove
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/profile-get-command
Symbolic link
1
plugins/20_events/profile-get-command
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
1
plugins/20_events/release-and-deploy
Symbolic link
1
plugins/20_events/release-and-deploy
Symbolic link
@@ -0,0 +1 @@
|
||||
hook
|
||||
4
plugins/app-json/.gitignore
vendored
Normal file
4
plugins/app-json/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/triggers/*
|
||||
/triggers
|
||||
/pre-*
|
||||
/post-*
|
||||
5
plugins/app-json/Makefile
Normal file
5
plugins/app-json/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
TRIGGERS = triggers/post-deploy triggers/pre-deploy
|
||||
BUILD = triggers
|
||||
PLUGIN_NAME = app-json
|
||||
|
||||
include ../../common.mk
|
||||
389
plugins/app-json/appjson.go
Normal file
389
plugins/app-json/appjson.go
Normal file
@@ -0,0 +1,389 @@
|
||||
package appjson
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
shellquote "github.com/kballard/go-shellquote"
|
||||
)
|
||||
|
||||
// AppJSON is a struct that represents an app.json file as understood by Dokku
|
||||
type AppJSON struct {
|
||||
Scripts struct {
|
||||
Dokku struct {
|
||||
Predeploy string `json:"predeploy"`
|
||||
Postdeploy string `json:"postdeploy"`
|
||||
} `json:"dokku"`
|
||||
} `json:"scripts"`
|
||||
}
|
||||
|
||||
func constructScript(command string, shell string, isHerokuishImage bool, hasEntrypoint bool) []string {
|
||||
if hasEntrypoint {
|
||||
words, err := shellquote.Split(strings.TrimSpace(command))
|
||||
if err != nil {
|
||||
common.LogWarn(fmt.Sprintf("Skipping command construction for app with ENTRYPOINT: %v", err.Error()))
|
||||
return nil
|
||||
}
|
||||
return words
|
||||
}
|
||||
|
||||
script := []string{"set -eo pipefail;"}
|
||||
if os.Getenv("DOKKU_TRACE") == "1" {
|
||||
script = append(script, "set -x;")
|
||||
}
|
||||
|
||||
if isHerokuishImage {
|
||||
script = append(script, []string{
|
||||
"if [[ -d '/app' ]]; then",
|
||||
" export HOME=/app;",
|
||||
" cd $HOME;",
|
||||
"fi;",
|
||||
"if [[ -d '/app/.profile.d' ]]; then",
|
||||
" for file in /app/.profile.d/*; do source $file; done;",
|
||||
"fi;",
|
||||
|
||||
"if [[ -d '/cache' ]]; then",
|
||||
" rm -rf /tmp/cache ;",
|
||||
" ln -sf /cache /tmp/cache;",
|
||||
"fi;",
|
||||
}...)
|
||||
}
|
||||
|
||||
if strings.HasPrefix(command, "/") {
|
||||
commandBin := strings.Split(command, " ")[0]
|
||||
script = append(script, []string{
|
||||
fmt.Sprintf("if [[ ! -x \"%s\" ]]; then", commandBin),
|
||||
" echo specified binary is not executable;",
|
||||
" exit 1;",
|
||||
"fi;",
|
||||
}...)
|
||||
}
|
||||
|
||||
script = append(script, fmt.Sprintf("%s || exit 1;", command))
|
||||
|
||||
if isHerokuishImage {
|
||||
script = append(script, []string{
|
||||
"if [[ -d '/cache' ]]; then",
|
||||
" rm -f /tmp/cache;",
|
||||
"fi;",
|
||||
}...)
|
||||
}
|
||||
|
||||
return []string{shell, "-c", strings.Join(script, " ")}
|
||||
}
|
||||
|
||||
// getPhaseScript extracts app.json from app image and returns the appropriate json key/value
|
||||
func getPhaseScript(appName string, image string, phase string) (string, error) {
|
||||
appJSONFile, err := ioutil.TempFile(os.TempDir(), fmt.Sprintf("dokku-%s-%s", common.MustGetEnv("DOKKU_PID"), "getPhaseScript"))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Cannot create temporary file: %v", err)
|
||||
}
|
||||
|
||||
defer os.Remove(appJSONFile.Name())
|
||||
|
||||
common.CopyFromImage(appName, image, "app.json", appJSONFile.Name())
|
||||
if !common.FileExists(appJSONFile.Name()) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadFile(appJSONFile.Name())
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Cannot read app.json file: %v", err)
|
||||
}
|
||||
|
||||
if strings.TrimSpace(string(b)) == "" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
var appJSON AppJSON
|
||||
if err = json.Unmarshal(b, &appJSON); err != nil {
|
||||
return "", fmt.Errorf("Cannot parse app.json: %v", err)
|
||||
}
|
||||
|
||||
if phase == "predeploy" {
|
||||
return appJSON.Scripts.Dokku.Predeploy, nil
|
||||
}
|
||||
|
||||
return appJSON.Scripts.Dokku.Postdeploy, nil
|
||||
}
|
||||
|
||||
// getReleaseCommand extracts the release command from a given app's procfile
|
||||
func getReleaseCommand(appName string, image string) string {
|
||||
err := common.SuppressOutput(func() error {
|
||||
return common.PlugnTrigger("procfile-extract", []string{appName, image}...)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
processType := "release"
|
||||
port := "5000"
|
||||
b, _ := common.PlugnTriggerOutput("procfile-get-command", []string{appName, processType, port}...)
|
||||
return strings.TrimSpace(string(b[:]))
|
||||
}
|
||||
|
||||
func getDokkuAppShell(appName string) string {
|
||||
dokkuAppShell := "/bin/bash"
|
||||
if b, _ := common.PlugnTriggerOutput("config-get-global", []string{"DOKKU_APP_SHELL"}...); strings.TrimSpace(string(b[:])) != "" {
|
||||
dokkuAppShell = strings.TrimSpace(string(b[:]))
|
||||
}
|
||||
|
||||
if b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_SHELL"}...); strings.TrimSpace(string(b[:])) != "" {
|
||||
dokkuAppShell = strings.TrimSpace(string(b[:]))
|
||||
}
|
||||
|
||||
return dokkuAppShell
|
||||
}
|
||||
|
||||
func executeScript(appName string, imageTag string, phase string) error {
|
||||
common.LogInfo1(fmt.Sprintf("Checking for %s task", phase))
|
||||
image, err := common.GetDeployingAppImageName(appName, imageTag, "")
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
}
|
||||
command := ""
|
||||
phaseSource := ""
|
||||
if phase == "release" {
|
||||
command = getReleaseCommand(appName, image)
|
||||
phaseSource = "Procfile"
|
||||
} else {
|
||||
var err error
|
||||
phaseSource = "app.json"
|
||||
if command, err = getPhaseScript(appName, image, phase); err != nil {
|
||||
common.LogExclaim(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
if command == "" {
|
||||
common.LogVerbose(fmt.Sprintf("No %s task found, skipping", phase))
|
||||
return nil
|
||||
}
|
||||
|
||||
common.LogInfo1(fmt.Sprintf("Executing %s task from %s: %s", phase, phaseSource, command))
|
||||
isHerokuishImage := common.IsImageHerokuishBased(image, appName)
|
||||
dockerfileEntrypoint := ""
|
||||
dockerfileCommand := ""
|
||||
if !isHerokuishImage {
|
||||
dockerfileEntrypoint, _ = getEntrypointFromImage(image)
|
||||
dockerfileCommand, _ = getCommandFromImage(image)
|
||||
}
|
||||
|
||||
hasEntrypoint := dockerfileEntrypoint != ""
|
||||
dokkuAppShell := getDokkuAppShell(appName)
|
||||
script := constructScript(command, dokkuAppShell, isHerokuishImage, hasEntrypoint)
|
||||
|
||||
imageSourceType := "dockerfile"
|
||||
if isHerokuishImage {
|
||||
imageSourceType = "herokuish"
|
||||
}
|
||||
|
||||
cacheDir := fmt.Sprintf("%s/cache", common.AppRoot(appName))
|
||||
cacheHostDir := fmt.Sprintf("%s/cache", common.AppHostRoot(appName))
|
||||
if !common.DirectoryExists(cacheDir) {
|
||||
os.MkdirAll(cacheDir, 0755)
|
||||
}
|
||||
|
||||
var dockerArgs []string
|
||||
if b, err := common.PlugnTriggerSetup("docker-args-deploy", []string{appName, imageTag}...).SetInput("").Output(); err == nil {
|
||||
words, err := shellquote.Split(strings.TrimSpace(string(b[:])))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dockerArgs = append(dockerArgs, words...)
|
||||
}
|
||||
|
||||
if b, err := common.PlugnTriggerSetup("docker-args-process-deploy", []string{appName, imageSourceType, imageTag}...).SetInput("").Output(); err == nil {
|
||||
words, err := shellquote.Split(strings.TrimSpace(string(b[:])))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dockerArgs = append(dockerArgs, words...)
|
||||
}
|
||||
|
||||
filteredArgs := []string{"restart", "cpus", "memory", "memory-swap", "memory-reservation", "gpus"}
|
||||
for _, filteredArg := range filteredArgs {
|
||||
// re := regexp.MustCompile("--" + filteredArg + "=[0-9A-Za-z!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~]+ ")
|
||||
|
||||
var filteredDockerArgs []string
|
||||
for _, dockerArg := range dockerArgs {
|
||||
if !strings.HasPrefix(dockerArg, "--"+filteredArg+"=") {
|
||||
filteredDockerArgs = append(filteredDockerArgs, dockerArg)
|
||||
}
|
||||
}
|
||||
|
||||
dockerArgs = filteredDockerArgs
|
||||
}
|
||||
|
||||
dockerArgs = append(dockerArgs, "--label=dokku_phase_script="+phase)
|
||||
dockerArgs = append(dockerArgs, "-v", cacheHostDir+":/cache")
|
||||
if os.Getenv("DOKKU_TRACE") != "" {
|
||||
dockerArgs = append(dockerArgs, "--env", "DOKKU_TRACE="+os.Getenv("DOKKU_TRACE"))
|
||||
}
|
||||
|
||||
containerID, err := createdContainerID(appName, dockerArgs, image, script, phase)
|
||||
if err != nil {
|
||||
common.LogFail(fmt.Sprintf("Failed to create %s execution container: %s", phase, err.Error()))
|
||||
}
|
||||
|
||||
if !waitForExecution(containerID) {
|
||||
common.LogInfo2Quiet(fmt.Sprintf("Start of %s %s task (%s) output", appName, phase, containerID[0:9]))
|
||||
common.LogVerboseQuietContainerLogs(containerID)
|
||||
common.LogInfo2Quiet(fmt.Sprintf("End of %s %s task (%s) output", appName, phase, containerID[0:9]))
|
||||
common.LogFail(fmt.Sprintf("Execution of %s task failed: %s", phase, command))
|
||||
}
|
||||
|
||||
common.LogInfo2Quiet(fmt.Sprintf("Start of %s %s task (%s) output", appName, phase, containerID[0:9]))
|
||||
common.LogVerboseQuietContainerLogs(containerID)
|
||||
common.LogInfo2Quiet(fmt.Sprintf("End of %s %s task (%s) output", appName, phase, containerID[0:9]))
|
||||
|
||||
if phase != "predeploy" {
|
||||
return nil
|
||||
}
|
||||
|
||||
commitArgs := []string{"container", "commit"}
|
||||
if !isHerokuishImage {
|
||||
if dockerfileEntrypoint != "" {
|
||||
commitArgs = append(commitArgs, "--change", dockerfileEntrypoint)
|
||||
}
|
||||
|
||||
if dockerfileCommand != "" {
|
||||
commitArgs = append(commitArgs, "--change", dockerfileCommand)
|
||||
}
|
||||
}
|
||||
|
||||
commitArgs = append(commitArgs, []string{
|
||||
"--change",
|
||||
"LABEL org.label-schema.schema-version=1.0",
|
||||
"--change",
|
||||
"LABEL org.label-schema.vendor=dokku",
|
||||
"--change",
|
||||
fmt.Sprintf("LABEL com.dokku.app-name=%s", appName),
|
||||
"--change",
|
||||
fmt.Sprintf("LABEL com.dokku.%s-phase=true", phase),
|
||||
}...)
|
||||
commitArgs = append(commitArgs, containerID, image)
|
||||
containerCommitCmd := common.NewShellCmdWithArgs(
|
||||
common.DockerBin(),
|
||||
commitArgs...,
|
||||
)
|
||||
containerCommitCmd.ShowOutput = false
|
||||
containerCommitCmd.Command.Stderr = os.Stderr
|
||||
if !containerCommitCmd.Execute() {
|
||||
common.LogFail(fmt.Sprintf("Commiting of '%s' to image failed: %s", phase, command))
|
||||
}
|
||||
|
||||
return common.PlugnTrigger("scheduler-register-retired", []string{appName, containerID}...)
|
||||
}
|
||||
|
||||
func getEntrypointFromImage(image string) (string, error) {
|
||||
output, err := common.DockerInspect(image, "{{json .Config.Entrypoint}}")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if output == "null" {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var entrypoint []string
|
||||
if err = json.Unmarshal([]byte(output), &entrypoint); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if len(entrypoint) == 3 && entrypoint[0] == "/bin/sh" && entrypoint[1] == "-c" {
|
||||
return fmt.Sprintf("ENTRYPOINT %s", entrypoint[2]), nil
|
||||
}
|
||||
|
||||
serializedEntrypoint, err := json.Marshal(entrypoint)
|
||||
return fmt.Sprintf("ENTRYPOINT %s", string(serializedEntrypoint)), err
|
||||
}
|
||||
|
||||
func getCommandFromImage(image string) (string, error) {
|
||||
output, err := common.DockerInspect(image, "{{json .Config.Cmd}}")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if output == "null" {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var command []string
|
||||
if err = json.Unmarshal([]byte(output), &command); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if len(command) == 3 && command[0] == "/bin/sh" && command[1] == "-c" {
|
||||
return fmt.Sprintf("CMD %s", command[2]), nil
|
||||
}
|
||||
|
||||
serializedEntrypoint, err := json.Marshal(command)
|
||||
return fmt.Sprintf("CMD %s", string(serializedEntrypoint)), err
|
||||
}
|
||||
|
||||
func waitForExecution(containerID string) bool {
|
||||
containerStartCmd := common.NewShellCmdWithArgs(
|
||||
common.DockerBin(),
|
||||
"container",
|
||||
"start",
|
||||
containerID,
|
||||
)
|
||||
containerStartCmd.ShowOutput = false
|
||||
containerStartCmd.Command.Stderr = os.Stderr
|
||||
if !containerStartCmd.Execute() {
|
||||
return false
|
||||
}
|
||||
|
||||
containerWaitCmd := common.NewShellCmdWithArgs(
|
||||
common.DockerBin(),
|
||||
"container",
|
||||
"wait",
|
||||
containerID,
|
||||
)
|
||||
|
||||
containerWaitCmd.ShowOutput = false
|
||||
containerWaitCmd.Command.Stderr = os.Stderr
|
||||
b, err := containerWaitCmd.Output()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
containerExitCode := strings.TrimSpace(string(b[:]))
|
||||
return containerExitCode == "0"
|
||||
}
|
||||
|
||||
func createdContainerID(appName string, dockerArgs []string, image string, command []string, phase string) (string, error) {
|
||||
runLabelArgs := fmt.Sprintf("--label=com.dokku.app-name=%s", appName)
|
||||
|
||||
arguments := strings.Split(common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS"), " ")
|
||||
arguments = append(arguments, runLabelArgs)
|
||||
arguments = append(arguments, dockerArgs...)
|
||||
|
||||
arguments = append([]string{"container", "create"}, arguments...)
|
||||
arguments = append(arguments, image)
|
||||
arguments = append(arguments, command...)
|
||||
|
||||
containerCreateCmd := common.NewShellCmdWithArgs(
|
||||
common.DockerBin(),
|
||||
arguments...,
|
||||
)
|
||||
var stderr bytes.Buffer
|
||||
containerCreateCmd.ShowOutput = false
|
||||
containerCreateCmd.Command.Stderr = &stderr
|
||||
|
||||
b, err := containerCreateCmd.Output()
|
||||
if err != nil {
|
||||
return "", errors.New(stderr.String())
|
||||
}
|
||||
|
||||
containerID := strings.TrimSpace(string(b))
|
||||
err = common.PlugnTrigger("post-container-create", []string{"app", appName, containerID, phase}...)
|
||||
return containerID, err
|
||||
}
|
||||
12
plugins/app-json/go.mod
Normal file
12
plugins/app-json/go.mod
Normal file
@@ -0,0 +1,12 @@
|
||||
module github.com/dokku/dokku/plugins/app-json
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
|
||||
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect
|
||||
)
|
||||
|
||||
replace github.com/dokku/dokku/plugins/common => ../common
|
||||
8
plugins/app-json/go.sum
Normal file
8
plugins/app-json/go.sum
Normal file
@@ -0,0 +1,8 @@
|
||||
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q=
|
||||
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
|
||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4quafGxDT9LDasjGdlGkzLbfmmrlng3kA=
|
||||
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
|
||||
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
@@ -1,133 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
get_phase_script() {
|
||||
declare desc="extracts app.json from app image and returns the appropriate json key/value"
|
||||
declare IMAGE_TAG="$1" PHASE_SCRIPT_KEY="$2"
|
||||
local APP_JSON_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
|
||||
trap "rm -rf '$APP_JSON_FILE' >/dev/null" RETURN INT TERM
|
||||
|
||||
copy_from_image "$IMAGE" "app.json" "$APP_JSON_FILE" 2>/dev/null || true
|
||||
|
||||
if [[ ! -f "$APP_JSON_FILE" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
get_json_value ".scripts.dokku.${PHASE_SCRIPT_KEY}" <"$APP_JSON_FILE"
|
||||
}
|
||||
|
||||
get_release_cmd() {
|
||||
declare desc="extracts the release command from a given app's procfile"
|
||||
declare APP="$1" IMAGE_TAG="$2"
|
||||
|
||||
extract_procfile "$APP" "$IMAGE_TAG" >/dev/null
|
||||
trap "remove_procfile $APP" RETURN INT TERM EXIT
|
||||
|
||||
get_cmd_from_procfile "$APP" "release" "5000"
|
||||
}
|
||||
|
||||
execute_script() {
|
||||
declare desc="executes appropriate phase script key from app.json"
|
||||
declare APP="$1" IMAGE_TAG="$2" PHASE_SCRIPT_KEY="$3"
|
||||
local IMAGE id SCRIPT_CMD
|
||||
|
||||
local DOCKER_COMMIT_LABEL_ARGS=("--change" "\"LABEL org.label-schema.schema-version=1.0\"" "--change" "\"LABEL org.label-schema.vendor=dokku\"" "--change" "\"LABEL com.dokku.app-name=$APP\"")
|
||||
local DOCKER_RUN_LABEL_ARGS="--label=com.dokku.app-name=$APP"
|
||||
|
||||
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
|
||||
if [[ "$PHASE_SCRIPT_KEY" == "release" ]]; then
|
||||
SCRIPT_CMD=$(get_release_cmd "$APP" "$IMAGE_TAG" 2>/dev/null || true)
|
||||
else
|
||||
SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY" 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
if [[ -z "$SCRIPT_CMD" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
dokku_log_exclaim "${PHASE_SCRIPT_KEY^} command declared: '$SCRIPT_CMD'"
|
||||
local COMMAND
|
||||
COMMAND="set -eo pipefail; [[ \$DOKKU_TRACE ]] && set -x ; "
|
||||
COMMAND+=" if [[ -d '/app' ]]; then "
|
||||
COMMAND+=" export HOME=/app ; "
|
||||
COMMAND+=" cd \$HOME ; "
|
||||
COMMAND+=" fi ; "
|
||||
COMMAND+=" if [[ -d '/app/.profile.d' ]]; then "
|
||||
COMMAND+=" for file in /app/.profile.d/*; do source \$file; done ; "
|
||||
COMMAND+=" fi ; "
|
||||
COMMAND+=" if [[ -d '/cache' ]]; then "
|
||||
COMMAND+=" rm -rf /tmp/cache ; "
|
||||
COMMAND+=" ln -sf /cache /tmp/cache ; "
|
||||
COMMAND+=" fi ; "
|
||||
|
||||
if [[ "$SCRIPT_CMD" == /* ]]; then
|
||||
local SCRIPT_BIN="$(echo "$SCRIPT_CMD" | cut -d' ' -f1)"
|
||||
COMMAND+=" if [[ ! -x \"$SCRIPT_BIN\" ]]; then "
|
||||
COMMAND+=" echo specified binary is not executable ; "
|
||||
COMMAND+=" exit 1 ; "
|
||||
COMMAND+=" fi ; "
|
||||
fi
|
||||
|
||||
COMMAND+=" $SCRIPT_CMD || exit 1;"
|
||||
COMMAND+=" if [[ -d '/cache' ]]; then "
|
||||
COMMAND+=" rm -f /tmp/cache ; "
|
||||
COMMAND+=" fi ; "
|
||||
|
||||
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
local CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$APP/cache"
|
||||
[[ -d $CACHE_DIR ]] || mkdir -p "$CACHE_DIR"
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
|
||||
local IMAGE_SOURCE_TYPE="dockerfile"
|
||||
is_image_herokuish_based "$IMAGE" "$APP" && IMAGE_SOURCE_TYPE="herokuish"
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG")
|
||||
|
||||
# strip certain args from DOCKER_ARGS
|
||||
local filtered_args=("restart" "cpus" "memory" "memory-swap" "memory-reservation" "gpus")
|
||||
for filtered_arg in "${filtered_args[@]}"; do
|
||||
DOCKER_ARGS=$(sed -e "s/--${filtered_arg}=[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
|
||||
done
|
||||
|
||||
# eval args as array to respect escapes
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
local DOKKU_APP_SHELL="/bin/bash"
|
||||
DOKKU_APP_SHELL="$(config_get --global DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"
|
||||
DOKKU_APP_SHELL="$(config_get "$APP" DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"
|
||||
[[ -z "$DOKKU_APP_SHELL" ]] && DOKKU_APP_SHELL="/bin/bash"
|
||||
|
||||
local DOKKU_CONTAINER_EXIT_CODE=0
|
||||
id=$("$DOCKER_BIN" container create "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --env DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -v "$CACHE_HOST_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" "$DOKKU_APP_SHELL" -c "$COMMAND")
|
||||
plugn trigger post-container-create "app" "$id" "$APP" "$PHASE_SCRIPT_KEY"
|
||||
"$DOCKER_BIN" container start "$id" >/dev/null || DOKKU_CONTAINER_EXIT_CODE=$?
|
||||
DOKKU_CONTAINER_EXIT_CODE="$("$DOCKER_BIN" container wait "$id" 2>/dev/null || echo "$DOKKU_CONTAINER_EXIT_CODE")"
|
||||
|
||||
if [[ "$DOKKU_CONTAINER_EXIT_CODE" -ne 0 ]]; then
|
||||
dokku_container_log_verbose_quiet "$id"
|
||||
dokku_log_fail "execution of '$SCRIPT_CMD' failed!"
|
||||
fi
|
||||
|
||||
dokku_container_log_verbose_quiet "$id"
|
||||
if [[ "$PHASE_SCRIPT_KEY" != "predeploy" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if ! is_image_herokuish_based "$IMAGE" "$APP"; then
|
||||
local DOKKU_DOCKERFILE_ENTRYPOINT=$(config_get "$APP" DOKKU_DOCKERFILE_ENTRYPOINT)
|
||||
local DOKKU_DOCKERFILE_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_CMD)
|
||||
[[ -z "$DOKKU_DOCKERFILE_ENTRYPOINT" ]] && DOKKU_DOCKERFILE_ENTRYPOINT="$(get_entrypoint_from_image "$IMAGE")"
|
||||
[[ -z "$DOKKU_DOCKERFILE_CMD" ]] && DOKKU_DOCKERFILE_CMD="$(get_cmd_from_image "$IMAGE")"
|
||||
|
||||
[[ -n "$DOKKU_DOCKERFILE_ENTRYPOINT" ]] && local DOCKER_COMMIT_ENTRYPOINT_CHANGE_ARG="--change='$DOKKU_DOCKERFILE_ENTRYPOINT'"
|
||||
[[ -n "$DOKKU_DOCKERFILE_CMD" ]] && local DOCKER_COMMIT_CMD_CHANGE_ARG="--change='$DOKKU_DOCKERFILE_CMD'"
|
||||
|
||||
local DOCKER_COMMIT_ARGS="$DOCKER_COMMIT_ENTRYPOINT_CHANGE_ARG $DOCKER_COMMIT_CMD_CHANGE_ARG"
|
||||
fi
|
||||
|
||||
eval "$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "${DOCKER_COMMIT_ARGS[@]}" "$id" "$IMAGE" >/dev/null
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core app-json plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/app-json/internal-functions"
|
||||
|
||||
trigger-app-json-post-deploy() {
|
||||
declare desc="app-json scripts execution"
|
||||
declare trigger="post-deploy"
|
||||
declare APP="$1" IMAGE_TAG="$4"
|
||||
local PHASE_SCRIPT_KEY="postdeploy"
|
||||
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
}
|
||||
|
||||
trigger-app-json-post-deploy "$@"
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/app-json/internal-functions"
|
||||
|
||||
trigger-app-json-pre-deploy() {
|
||||
declare desc="app-json scripts execution"
|
||||
declare trigger="pre-deploy"
|
||||
declare APP="$1" IMAGE_TAG="$2"
|
||||
local PHASE_SCRIPT_KEY="predeploy"
|
||||
|
||||
execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY"
|
||||
execute_script "$APP" "$IMAGE_TAG" "release"
|
||||
}
|
||||
|
||||
trigger-app-json-pre-deploy "$@"
|
||||
36
plugins/app-json/src/triggers/triggers.go
Normal file
36
plugins/app-json/src/triggers/triggers.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/app-json"
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
// main entrypoint to all triggers
|
||||
func main() {
|
||||
parts := strings.Split(os.Args[0], "/")
|
||||
trigger := parts[len(parts)-1]
|
||||
flag.Parse()
|
||||
|
||||
var err error
|
||||
switch trigger {
|
||||
case "post-deploy":
|
||||
appName := flag.Arg(0)
|
||||
imageTag := flag.Arg(3)
|
||||
err = appjson.TriggerPostDeploy(appName, imageTag)
|
||||
case "pre-deploy":
|
||||
appName := flag.Arg(0)
|
||||
imageTag := flag.Arg(1)
|
||||
err = appjson.TriggerPreDeploy(appName, imageTag)
|
||||
default:
|
||||
common.LogFail(fmt.Sprintf("Invalid plugin trigger call: %s", trigger))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
}
|
||||
}
|
||||
21
plugins/app-json/triggers.go
Normal file
21
plugins/app-json/triggers.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package appjson
|
||||
|
||||
// TriggerPostDeploy is a trigger to execute the postdeploy deployment task
|
||||
func TriggerPostDeploy(appName string, imageTag string) error {
|
||||
if err := executeScript(appName, imageTag, "postdeploy"); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TriggerPreDeploy is a trigger to execute predeploy and release deployment tasks
|
||||
func TriggerPreDeploy(appName string, imageTag string) error {
|
||||
if err := executeScript(appName, imageTag, "predeploy"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := executeScript(appName, imageTag, "release"); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package apps
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
@@ -12,7 +14,7 @@ func ReportSingleApp(appName, infoFlag string) error {
|
||||
|
||||
deploySource := ""
|
||||
if b, err := common.PlugnTriggerSetup("deploy-source", []string{appName}...).SetInput("").Output(); err != nil {
|
||||
deploySource = string(b[:])
|
||||
deploySource = strings.TrimSpace(string(b[:]))
|
||||
}
|
||||
|
||||
locked := "false"
|
||||
|
||||
@@ -140,7 +140,7 @@ func maybeCreateApp(appName string) error {
|
||||
}
|
||||
|
||||
b, _ := common.PlugnTriggerOutput("config-get-global", []string{"DOKKU_DISABLE_APP_AUTOCREATION"}...)
|
||||
disableAutocreate := string(b[:])
|
||||
disableAutocreate := strings.TrimSpace(string(b[:]))
|
||||
if disableAutocreate == "true" {
|
||||
common.LogWarn("App auto-creation disabled.")
|
||||
return fmt.Errorf("Re-enable app auto-creation or create an app with 'dokku apps:create %s'", appName)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core apps plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
@@ -197,10 +197,6 @@ func CommandRename(oldAppName string, newAppName string, skipDeploy bool) error
|
||||
|
||||
// CommandReport displays an app report for one or more apps
|
||||
func CommandReport(appName string, infoFlag string) error {
|
||||
if appName == "" {
|
||||
return errors.New("Please specify an app to run the command on")
|
||||
}
|
||||
|
||||
if strings.HasPrefix(appName, "--") {
|
||||
infoFlag = appName
|
||||
appName = ""
|
||||
|
||||
38
plugins/builder-cnb/builder-build
Executable file
38
plugins/builder-cnb/builder-build
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
trigger-builder-cnb-builder-build() {
|
||||
declare desc="builder-cnb builder-build plugin trigger"
|
||||
declare trigger="builder-build"
|
||||
declare BUILDER_TYPE="$1" APP="$2" SOURCECODE_WORK_DIR="$3"
|
||||
|
||||
if [[ "$BUILDER_TYPE" != "cnb" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if ! command -v "pack" &>/dev/null; then
|
||||
dokku_log_fail "Missing pack, install it"
|
||||
fi
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP")
|
||||
|
||||
pushd "$SOURCECODE_WORK_DIR" &>/dev/null
|
||||
|
||||
local TMP_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX")
|
||||
trap "rm -rf '$TMP_FILE' >/dev/null" RETURN INT TERM
|
||||
|
||||
config_export app "$APP" --format envfile --merged > "$TMP_FILE"
|
||||
|
||||
plugn trigger pre-build-cnb "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
pack build "$IMAGE" --builder heroku/buildpacks --path "$SOURCECODE_WORK_DIR" --default-process web
|
||||
|
||||
echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=build --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP --label=dokku -t "$IMAGE" -
|
||||
|
||||
plugn trigger post-build-cnb "$APP" "$SOURCECODE_WORK_DIR"
|
||||
}
|
||||
|
||||
trigger-builder-cnb-builder-build "$@"
|
||||
22
plugins/builder-cnb/builder-release
Executable file
22
plugins/builder-cnb/builder-release
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-builder-cnb-builder-release() {
|
||||
declare desc="builder-cnb builder-release plugin trigger"
|
||||
declare trigger="builder-release"
|
||||
declare BUILDER_TYPE="$1" APP="$2" IMAGE_TAG="$3"
|
||||
|
||||
if [[ "$BUILDER_TYPE" != "cnb" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
plugn trigger pre-release-cnb "$APP" "$IMAGE_TAG"
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=release --label=com.dokku.app-name=$APP --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku -t "$IMAGE" -
|
||||
plugn trigger post-release-cnb "$APP" "$IMAGE_TAG"
|
||||
}
|
||||
|
||||
trigger-builder-cnb-builder-release "$@"
|
||||
4
plugins/builder-cnb/plugin.toml
Normal file
4
plugins/builder-cnb/plugin.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core builder-cnb plugin"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
@@ -20,12 +20,6 @@ trigger-builder-dockerfile-builder-build() {
|
||||
# extract first port from Dockerfile
|
||||
local DOCKERFILE_PORTS=$(get_dockerfile_exposed_ports Dockerfile)
|
||||
[[ -n "$DOCKERFILE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKERFILE_PORTS"
|
||||
|
||||
# extract ENTRYPOINT/CMD from Dockerfile
|
||||
local DOCKERFILE_ENTRYPOINT=$(extract_directive_from_dockerfile Dockerfile ENTRYPOINT)
|
||||
[[ -n "$DOCKERFILE_ENTRYPOINT" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_ENTRYPOINT="$DOCKERFILE_ENTRYPOINT"
|
||||
local DOCKERFILE_CMD=$(extract_directive_from_dockerfile Dockerfile CMD)
|
||||
[[ -n "$DOCKERFILE_CMD" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_CMD="$DOCKERFILE_CMD"
|
||||
plugn trigger pre-build-dockerfile "$APP"
|
||||
|
||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||
|
||||
@@ -12,11 +12,14 @@ trigger-builder-dockerfile-builder-release() {
|
||||
return
|
||||
fi
|
||||
|
||||
# buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=release -t "$IMAGE" -
|
||||
if "$DOCKER_BIN" image history --format "{{ json . }}" "$IMAGE" | grep -q "ONBUILD"; then
|
||||
dokku_log_warn "Image contains one or more ONBUILD directives, skipping label injection"
|
||||
else
|
||||
echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=release --label=com.dokku.app-name=$APP --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku -t "$IMAGE" -
|
||||
fi
|
||||
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core builder-dockerfile plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
@@ -35,6 +35,8 @@ trigger-builder-herokuish-builder-build() {
|
||||
fi
|
||||
|
||||
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID"
|
||||
|
||||
[[ -d $DOKKU_APP_CACHE_DIR ]] || mkdir -p "$DOKKU_APP_CACHE_DIR"
|
||||
plugn trigger pre-build-buildpack "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
@@ -58,6 +60,7 @@ trigger-builder-herokuish-builder-build() {
|
||||
fi
|
||||
|
||||
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID"
|
||||
|
||||
plugn trigger post-build-buildpack "$APP" "$SOURCECODE_WORK_DIR"
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ trigger-builder-herokuish-builder-release() {
|
||||
fi
|
||||
|
||||
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID"
|
||||
fi
|
||||
if [[ -n $(config_export app "$APP") ]]; then
|
||||
CID=$(config_export app "$APP" | "$DOCKER_BIN" container run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
|
||||
@@ -36,9 +37,10 @@ trigger-builder-herokuish-builder-release() {
|
||||
fi
|
||||
|
||||
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID"
|
||||
fi
|
||||
|
||||
echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=release -t "$IMAGE" -
|
||||
echo "FROM $IMAGE" | suppress_output "$DOCKER_BIN" image build --label=com.dokku.image-stage=release --label=com.dokku.app-name=$APP --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku -t "$IMAGE" -
|
||||
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core builder-herokuish plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
@@ -29,6 +29,7 @@ trigger-builder-herokuish-pre-build-buildpack() {
|
||||
fi
|
||||
|
||||
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID"
|
||||
|
||||
# create build env for 'old style' buildpacks and dokku plugins
|
||||
CID=$(config_export app "$APP" --format envfile --merged | "$DOCKER_BIN" container run "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env")
|
||||
@@ -38,6 +39,7 @@ trigger-builder-herokuish-pre-build-buildpack() {
|
||||
fi
|
||||
|
||||
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID"
|
||||
}
|
||||
|
||||
trigger-builder-herokuish-pre-build-buildpack "$@"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core buildpacks plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
@@ -58,7 +58,7 @@ func TriggerPostExtract(appName string, sourceWorkDir string) {
|
||||
return
|
||||
}
|
||||
|
||||
buildpacksPath := path.Join(sourceWorkDir, ".buildpacks")
|
||||
buildpacksPath := filepath.Join(sourceWorkDir, ".buildpacks")
|
||||
file, err := os.OpenFile(buildpacksPath, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
common.LogFail(fmt.Sprintf("Error writing .buildpacks file: %s", err.Error()))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core certificate management plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
@@ -71,6 +71,7 @@ cmd-certs-set() {
|
||||
fi
|
||||
|
||||
mkdir -p "$APP_SSL_PATH"
|
||||
rm -f "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key"
|
||||
cp "$CRT_FILE" "$APP_SSL_PATH/server.crt"
|
||||
cp "$KEY_FILE" "$APP_SSL_PATH/server.key"
|
||||
chmod 750 "$APP_SSL_PATH"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core checks plugin"
|
||||
version = "0.21.2"
|
||||
version = "0.22.2"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,85 +1,35 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
sh "github.com/codeskyblue/go-sh"
|
||||
columnize "github.com/ryanuber/columnize"
|
||||
"github.com/ryanuber/columnize"
|
||||
)
|
||||
|
||||
type errfunc func() error
|
||||
|
||||
// ShellCmd represents a shell command to be run for dokku
|
||||
type ShellCmd struct {
|
||||
Env map[string]string
|
||||
Command *exec.Cmd
|
||||
CommandString string
|
||||
Args []string
|
||||
ShowOutput bool
|
||||
}
|
||||
|
||||
// NewShellCmd returns a new ShellCmd struct
|
||||
func NewShellCmd(command string) *ShellCmd {
|
||||
items := strings.Split(command, " ")
|
||||
cmd := items[0]
|
||||
args := items[1:]
|
||||
return &ShellCmd{
|
||||
Command: exec.Command(cmd, args...),
|
||||
CommandString: command,
|
||||
Args: args,
|
||||
ShowOutput: true,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute is a lightweight wrapper around exec.Command
|
||||
func (sc *ShellCmd) Execute() bool {
|
||||
env := os.Environ()
|
||||
for k, v := range sc.Env {
|
||||
env = append(env, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
sc.Command.Env = env
|
||||
if sc.ShowOutput {
|
||||
sc.Command.Stdout = os.Stdout
|
||||
sc.Command.Stderr = os.Stderr
|
||||
}
|
||||
if err := sc.Command.Run(); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Output is a lightweight wrapper around exec.Command.Output()
|
||||
func (sc *ShellCmd) Output() ([]byte, error) {
|
||||
env := os.Environ()
|
||||
for k, v := range sc.Env {
|
||||
env = append(env, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
sc.Command.Env = env
|
||||
if sc.ShowOutput {
|
||||
sc.Command.Stdout = os.Stdout
|
||||
sc.Command.Stderr = os.Stderr
|
||||
}
|
||||
return sc.Command.Output()
|
||||
}
|
||||
|
||||
// AppRoot returns the app root path
|
||||
func AppRoot(appName string) string {
|
||||
dokkuRoot := MustGetEnv("DOKKU_ROOT")
|
||||
return fmt.Sprintf("%v/%v", dokkuRoot, appName)
|
||||
}
|
||||
|
||||
// AppHostRoot returns the app root path
|
||||
func AppHostRoot(appName string) string {
|
||||
dokkuHostRoot := MustGetEnv("DOKKU_HOST_ROOT")
|
||||
return fmt.Sprintf("%v/%v", dokkuHostRoot, appName)
|
||||
}
|
||||
|
||||
// AskForDestructiveConfirmation checks for confirmation on destructive actions
|
||||
func AskForDestructiveConfirmation(name string, objectType string) error {
|
||||
LogWarn("WARNING: Potentially Destructive Action")
|
||||
@@ -112,62 +62,6 @@ func CommandUsage(helpHeader string, helpContent string) {
|
||||
fmt.Println(columnize.Format(content, config))
|
||||
}
|
||||
|
||||
// DockerCleanup cleans up all exited/dead containers and removes all dangling images
|
||||
func DockerCleanup(appName string, forceCleanup bool) error {
|
||||
if !forceCleanup {
|
||||
skipCleanup := false
|
||||
if appName != "" {
|
||||
b, _ := PlugnTriggerOutput("config-get", []string{appName, "DOKKU_SKIP_CLEANUP"}...)
|
||||
output := string(b[:])
|
||||
if output == "true" {
|
||||
skipCleanup = true
|
||||
}
|
||||
}
|
||||
|
||||
if skipCleanup || os.Getenv("DOKKU_SKIP_CLEANUP") == "true" {
|
||||
LogInfo1("DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo1("Cleaning up...")
|
||||
scheduler := GetAppScheduler(appName)
|
||||
if appName == "--global" {
|
||||
appName = ""
|
||||
}
|
||||
|
||||
forceCleanupArg := "false"
|
||||
if forceCleanup {
|
||||
forceCleanupArg = "true"
|
||||
}
|
||||
|
||||
if err := PlugnTrigger("scheduler-docker-cleanup", []string{scheduler, appName, forceCleanupArg}...); err != nil {
|
||||
return fmt.Errorf("Failure while cleaning up app: %s", err)
|
||||
}
|
||||
|
||||
// delete all non-running and dead containers
|
||||
exitedContainerIDs, _ := listContainers("exited", appName)
|
||||
deadContainerIDs, _ := listContainers("dead", appName)
|
||||
containerIDs := append(exitedContainerIDs, deadContainerIDs...)
|
||||
|
||||
if len(containerIDs) > 0 {
|
||||
removeContainers(containerIDs)
|
||||
}
|
||||
|
||||
// delete dangling images
|
||||
imageIDs, _ := listDanglingImages(appName)
|
||||
if len(imageIDs) > 0 {
|
||||
RemoveImages(imageIDs)
|
||||
}
|
||||
|
||||
if appName != "" {
|
||||
// delete unused images
|
||||
pruneUnusedImages(appName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAppScheduler fetches the scheduler for a given application
|
||||
func GetAppScheduler(appName string) string {
|
||||
if appName == "--global" {
|
||||
@@ -175,13 +69,18 @@ func GetAppScheduler(appName string) string {
|
||||
}
|
||||
|
||||
b, _ := PlugnTriggerOutput("config-get", []string{appName, "DOKKU_SCHEDULER"}...)
|
||||
value := string(b[:])
|
||||
value := strings.TrimSpace(string(b[:]))
|
||||
if value != "" {
|
||||
return value
|
||||
}
|
||||
|
||||
b, _ = PlugnTriggerOutput("config-get-global", []string{"DOKKU_SCHEDULER"}...)
|
||||
value = string(b[:])
|
||||
return GetGlobalScheduler()
|
||||
}
|
||||
|
||||
// GetGlobalScheduler fetchs the global scheduler
|
||||
func GetGlobalScheduler() string {
|
||||
b, _ := PlugnTriggerOutput("config-get-global", []string{"DOKKU_SCHEDULER"}...)
|
||||
value := strings.TrimSpace(string(b[:]))
|
||||
if value != "" {
|
||||
return value
|
||||
}
|
||||
@@ -190,28 +89,28 @@ func GetAppScheduler(appName string) string {
|
||||
}
|
||||
|
||||
// GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
|
||||
func GetDeployingAppImageName(appName, imageTag, imageRepo string) (imageName string) {
|
||||
func GetDeployingAppImageName(appName, imageTag, imageRepo string) (string, error) {
|
||||
if appName == "" {
|
||||
LogFail("(GetDeployingAppImageName) APP must not be empty")
|
||||
}
|
||||
|
||||
b, err := PlugnTriggerOutput("deployed-app-repository", []string{appName}...)
|
||||
if err != nil {
|
||||
LogFail(err.Error())
|
||||
return "", err
|
||||
}
|
||||
imageRemoteRepository := string(b[:])
|
||||
imageRemoteRepository := strings.TrimSpace(string(b[:]))
|
||||
|
||||
b, err = PlugnTriggerOutput("deployed-app-image-tag", []string{appName}...)
|
||||
if err != nil {
|
||||
LogFail(err.Error())
|
||||
return "", err
|
||||
}
|
||||
newImageTag := string(b[:])
|
||||
newImageTag := strings.TrimSpace(string(b[:]))
|
||||
|
||||
b, err = PlugnTriggerOutput("deployed-app-image-repo", []string{appName}...)
|
||||
if err != nil {
|
||||
LogFail(err.Error())
|
||||
return "", err
|
||||
}
|
||||
newImageRepo := string(b[:])
|
||||
newImageRepo := strings.TrimSpace(string(b[:]))
|
||||
|
||||
if newImageRepo != "" {
|
||||
imageRepo = newImageRepo
|
||||
@@ -226,11 +125,11 @@ func GetDeployingAppImageName(appName, imageTag, imageRepo string) (imageName st
|
||||
imageTag = "latest"
|
||||
}
|
||||
|
||||
imageName = fmt.Sprintf("%s%s:%s", imageRemoteRepository, imageRepo, imageTag)
|
||||
imageName := fmt.Sprintf("%s%s:%s", imageRemoteRepository, imageRepo, imageTag)
|
||||
if !VerifyImage(imageName) {
|
||||
LogFail(fmt.Sprintf("App image (%s) not found", imageName))
|
||||
return "", fmt.Errorf("App image (%s) not found", imageName)
|
||||
}
|
||||
return
|
||||
return imageName, nil
|
||||
}
|
||||
|
||||
// GetAppImageRepo is the central definition of a dokku image repo pattern
|
||||
@@ -312,38 +211,6 @@ func GetRunningImageTag(appName string) (string, error) {
|
||||
return "", errors.New("No image tag found")
|
||||
}
|
||||
|
||||
// ContainerIsRunning checks to see if a container is running
|
||||
func ContainerIsRunning(containerID string) bool {
|
||||
b, err := DockerInspect(containerID, "'{{.State.Running}}'")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return strings.TrimSpace(string(b[:])) == "true"
|
||||
}
|
||||
|
||||
// DirectoryExists returns if a path exists and is a directory
|
||||
func DirectoryExists(filePath string) bool {
|
||||
fi, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return fi.IsDir()
|
||||
}
|
||||
|
||||
// DockerInspect runs an inspect command with a given format against a container id
|
||||
func DockerInspect(containerOrImageID, format string) (output string, err error) {
|
||||
b, err := sh.Command(DockerBin(), "inspect", "--format", format, containerOrImageID).Output()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
output = strings.TrimSpace(string(b[:]))
|
||||
if strings.HasPrefix(output, "'") && strings.HasSuffix(output, "'") {
|
||||
output = strings.TrimSuffix(strings.TrimPrefix(output, "'"), "'")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DokkuApps returns a list of all local apps
|
||||
func DokkuApps() (apps []string, err error) {
|
||||
dokkuRoot := MustGetEnv("DOKKU_ROOT")
|
||||
@@ -372,36 +239,6 @@ func DokkuApps() (apps []string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// FileToSlice reads in all the lines from a file into a string slice
|
||||
func FileToSlice(filePath string) (lines []string, err error) {
|
||||
f, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
text := strings.TrimSpace(scanner.Text())
|
||||
if text == "" {
|
||||
continue
|
||||
}
|
||||
lines = append(lines, text)
|
||||
}
|
||||
err = scanner.Err()
|
||||
return
|
||||
}
|
||||
|
||||
// FileExists returns if a path exists and is a file
|
||||
func FileExists(filePath string) bool {
|
||||
fi, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return fi.Mode().IsRegular()
|
||||
}
|
||||
|
||||
// GetAppImageName returns image identifier for a given app, tag tuple. validate if tag is presented
|
||||
func GetAppImageName(appName, imageTag, imageRepo string) (imageName string) {
|
||||
err := VerifyAppName(appName)
|
||||
@@ -426,26 +263,9 @@ func GetAppImageName(appName, imageTag, imageRepo string) (imageName string) {
|
||||
|
||||
// IsDeployed returns true if given app has a running container
|
||||
func IsDeployed(appName string) bool {
|
||||
files, err := ioutil.ReadDir(AppRoot(appName))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, f := range files {
|
||||
if f.Name() == "CONTAINER" || strings.HasPrefix(f.Name(), "CONTAINER.") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsImageHerokuishBased returns true if app image is based on herokuish
|
||||
func IsImageHerokuishBased(image string, appName string) bool {
|
||||
output, err := DockerInspect(image, "{{range .Config.Env}}{{if eq . \"USER=herokuishuser\" }}{{println .}}{{end}}{{end}}")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return output != ""
|
||||
scheduler := GetAppScheduler(appName)
|
||||
_, err := PlugnTriggerOutput("scheduler-is-deployed", []string{scheduler, appName}...)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// MustGetEnv returns env variable or fails if it's not set
|
||||
@@ -466,29 +286,6 @@ func GetenvWithDefault(key string, defaultValue string) (val string) {
|
||||
return
|
||||
}
|
||||
|
||||
// ReadFirstLine gets the first line of a file that has contents and returns it
|
||||
// if there are no contents, an empty string is returned
|
||||
// will also return an empty string if the file does not exist
|
||||
func ReadFirstLine(filename string) (text string) {
|
||||
if !FileExists(filename) {
|
||||
return
|
||||
}
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
if text = strings.TrimSpace(scanner.Text()); text == "" {
|
||||
continue
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ReportSingleApp is an internal function that displays a report for an app
|
||||
func ReportSingleApp(reportType string, appName string, infoFlag string, infoFlags map[string]string, trimPrefix bool, uppercaseFirstCharacter bool) error {
|
||||
flags := []string{}
|
||||
@@ -550,10 +347,10 @@ func ShiftString(a []string) (string, []string) {
|
||||
|
||||
// StripInlineComments removes bash-style comment from input line
|
||||
func StripInlineComments(text string) string {
|
||||
bytes := []byte(text)
|
||||
b := []byte(text)
|
||||
re := regexp.MustCompile("(?s)#.*")
|
||||
bytes = re.ReplaceAll(bytes, nil)
|
||||
return strings.TrimSpace(string(bytes))
|
||||
b = re.ReplaceAll(b, nil)
|
||||
return strings.TrimSpace(string(b))
|
||||
}
|
||||
|
||||
// SuppressOutput suppresses the output of a function unless there is an error
|
||||
@@ -580,6 +377,16 @@ func ToBool(s string) bool {
|
||||
return s == "true"
|
||||
}
|
||||
|
||||
// ToInt returns an int value for a given string
|
||||
func ToInt(s string, defaultValue int) int {
|
||||
i, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
// UcFirst uppercases the first character in a string
|
||||
func UcFirst(str string) string {
|
||||
for i, v := range str {
|
||||
@@ -594,17 +401,12 @@ func IsValidAppName(appName string) error {
|
||||
return fmt.Errorf("APP must not be null")
|
||||
}
|
||||
|
||||
r, _ := regexp.Compile("^[a-z0-9][^/:A-Z]*$")
|
||||
r, _ := regexp.Compile("^[a-z0-9][^/:_A-Z]*$")
|
||||
if r.MatchString(appName) {
|
||||
return nil
|
||||
}
|
||||
|
||||
appRoot := AppRoot(appName)
|
||||
if DirectoryExists(appRoot) {
|
||||
os.RemoveAll(appRoot)
|
||||
}
|
||||
|
||||
return errors.New("App name must begin with lowercase alphanumeric character, and cannot include uppercase characters or colons")
|
||||
return errors.New("App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, colons, or underscores")
|
||||
}
|
||||
|
||||
// VerifyAppName verifies app name format and app existence"
|
||||
@@ -621,157 +423,9 @@ func VerifyAppName(appName string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// VerifyImage returns true if docker image exists in local repo
|
||||
func VerifyImage(image string) bool {
|
||||
imageCmd := NewShellCmd(strings.Join([]string{DockerBin(), "image", "inspect", image}, " "))
|
||||
imageCmd.ShowOutput = false
|
||||
return imageCmd.Execute()
|
||||
}
|
||||
|
||||
// DockerBin returns a string which contains a path to the current docker binary
|
||||
func DockerBin() string {
|
||||
dockerBin := os.Getenv("DOCKER_BIN")
|
||||
if dockerBin == "" {
|
||||
dockerBin = "docker"
|
||||
}
|
||||
|
||||
return dockerBin
|
||||
}
|
||||
|
||||
// PlugnTrigger fire the given plugn trigger with the given args
|
||||
func PlugnTrigger(triggerName string, args ...string) error {
|
||||
return PlugnTriggerSetup(triggerName, args...).Run()
|
||||
}
|
||||
|
||||
// PlugnTriggerOutput fire the given plugn trigger with the given args
|
||||
func PlugnTriggerOutput(triggerName string, args ...string) ([]byte, error) {
|
||||
return PlugnTriggerSetup(triggerName, args...).Output()
|
||||
}
|
||||
|
||||
// PlugnTriggerSetup sets up a plugn trigger call
|
||||
func PlugnTriggerSetup(triggerName string, args ...string) *sh.Session {
|
||||
shellArgs := make([]interface{}, len(args)+2)
|
||||
shellArgs[0] = "trigger"
|
||||
shellArgs[1] = triggerName
|
||||
for i, arg := range args {
|
||||
shellArgs[i+2] = arg
|
||||
}
|
||||
return sh.Command("plugn", shellArgs...)
|
||||
}
|
||||
|
||||
func times(str string, n int) (out string) {
|
||||
for i := 0; i < n; i++ {
|
||||
out += str
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func listContainers(status string, appName string) ([]string, error) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"container",
|
||||
"list",
|
||||
"--quiet",
|
||||
"--all",
|
||||
"--filter",
|
||||
fmt.Sprintf("status=%v", status),
|
||||
"--filter",
|
||||
fmt.Sprintf("label=%v", os.Getenv("DOKKU_CONTAINER_LABEL")),
|
||||
}
|
||||
|
||||
if appName != "" {
|
||||
command = append(command, []string{"--filter", fmt.Sprintf("label=com.dokku.app-name=%v", appName)}...)
|
||||
}
|
||||
|
||||
var stderr bytes.Buffer
|
||||
listCmd := NewShellCmd(strings.Join(command, " "))
|
||||
listCmd.ShowOutput = false
|
||||
listCmd.Command.Stderr = &stderr
|
||||
b, err := listCmd.Output()
|
||||
|
||||
if err != nil {
|
||||
return []string{}, errors.New(strings.TrimSpace(stderr.String()))
|
||||
}
|
||||
|
||||
output := strings.Split(strings.TrimSpace(string(b[:])), "\n")
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func listDanglingImages(appName string) ([]string, error) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"image",
|
||||
"list",
|
||||
"--quiet",
|
||||
"--filter",
|
||||
"dangling=true",
|
||||
}
|
||||
|
||||
if appName != "" {
|
||||
command = append(command, []string{"--filter", fmt.Sprintf("label=com.dokku.app-name=%v", appName)}...)
|
||||
}
|
||||
|
||||
var stderr bytes.Buffer
|
||||
listCmd := NewShellCmd(strings.Join(command, " "))
|
||||
listCmd.ShowOutput = false
|
||||
listCmd.Command.Stderr = &stderr
|
||||
b, err := listCmd.Output()
|
||||
|
||||
if err != nil {
|
||||
return []string{}, errors.New(strings.TrimSpace(stderr.String()))
|
||||
}
|
||||
|
||||
output := strings.Split(strings.TrimSpace(string(b[:])), "\n")
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func removeContainers(containerIDs []string) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"container",
|
||||
"rm",
|
||||
}
|
||||
|
||||
command = append(command, containerIDs...)
|
||||
|
||||
var stderr bytes.Buffer
|
||||
rmCmd := NewShellCmd(strings.Join(command, " "))
|
||||
rmCmd.ShowOutput = false
|
||||
rmCmd.Command.Stderr = &stderr
|
||||
rmCmd.Execute()
|
||||
}
|
||||
|
||||
// RemoveImages removes images by ID
|
||||
func RemoveImages(imageIDs []string) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"image",
|
||||
"rm",
|
||||
}
|
||||
|
||||
command = append(command, imageIDs...)
|
||||
|
||||
var stderr bytes.Buffer
|
||||
rmCmd := NewShellCmd(strings.Join(command, " "))
|
||||
rmCmd.ShowOutput = false
|
||||
rmCmd.Command.Stderr = &stderr
|
||||
rmCmd.Execute()
|
||||
}
|
||||
|
||||
func pruneUnusedImages(appName string) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"image",
|
||||
"prune",
|
||||
"--all",
|
||||
"--force",
|
||||
"--filter",
|
||||
fmt.Sprintf("label=com.dokku.app-name=%v", appName),
|
||||
}
|
||||
|
||||
var stderr bytes.Buffer
|
||||
pruneCmd := NewShellCmd(strings.Join(command, " "))
|
||||
pruneCmd.ShowOutput = false
|
||||
pruneCmd.Command.Stderr = &stderr
|
||||
pruneCmd.Execute()
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
testAppName = "test-app-1"
|
||||
testAppDir = strings.Join([]string{"/home/dokku/", testAppName}, "")
|
||||
testEnvFile = strings.Join([]string{testAppDir, "/ENV"}, "")
|
||||
testEnvLine = "export testKey=TESTING"
|
||||
testAppName = "test-app-1"
|
||||
testAppDir = strings.Join([]string{"/home/dokku/", testAppName}, "")
|
||||
testEnvFile = strings.Join([]string{testAppDir, "/ENV"}, "")
|
||||
testEnvLine = "export testKey=TESTING"
|
||||
testAppName2 = "01-test-app-1"
|
||||
testAppDir2 = strings.Join([]string{"/home/dokku/", testAppName2}, "")
|
||||
testEnvFile2 = strings.Join([]string{testAppDir2, "/ENV"}, "")
|
||||
@@ -95,32 +95,6 @@ func TestCommonDokkuApps(t *testing.T) {
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonFileToSlice(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
lines, err := FileToSlice(testEnvFile)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(lines).To(Equal([]string{testEnvLine}))
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonFileExists(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
Expect(FileExists(testEnvFile)).To(BeTrue())
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonReadFirstLine(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
line := ReadFirstLine(testEnvFile)
|
||||
Expect(line).To(Equal(""))
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
line = ReadFirstLine(testEnvFile)
|
||||
Expect(line).To(Equal(testEnvLine))
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonStripInlineComments(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
text := StripInlineComments(strings.Join([]string{testEnvLine, "# testing comment"}, " "))
|
||||
|
||||
350
plugins/common/docker.go
Normal file
350
plugins/common/docker.go
Normal file
@@ -0,0 +1,350 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/codeskyblue/go-sh"
|
||||
)
|
||||
|
||||
// ContainerIsRunning checks to see if a container is running
|
||||
func ContainerIsRunning(containerID string) bool {
|
||||
b, err := DockerInspect(containerID, "'{{.State.Running}}'")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return strings.TrimSpace(string(b[:])) == "true"
|
||||
}
|
||||
|
||||
// CopyFromImage copies a file from named image to destination
|
||||
func CopyFromImage(appName string, image string, source string, destination string) error {
|
||||
if err := VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !VerifyImage(image) {
|
||||
return fmt.Errorf("Invalid docker image for copying content")
|
||||
}
|
||||
|
||||
workDir := ""
|
||||
if !IsAbsPath(source) {
|
||||
if IsImageHerokuishBased(image, appName) {
|
||||
workDir = "/app"
|
||||
} else {
|
||||
workDir, _ = DockerInspect(image, "{{.Config.WorkingDir}}")
|
||||
}
|
||||
|
||||
if workDir != "" {
|
||||
source = fmt.Sprintf("%s/%s", workDir, source)
|
||||
}
|
||||
}
|
||||
|
||||
tmpFile, err := ioutil.TempFile(os.TempDir(), fmt.Sprintf("dokku-%s-%s", MustGetEnv("DOKKU_PID"), "CopyFromImage"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cannot create temporary file: %v", err)
|
||||
}
|
||||
|
||||
defer tmpFile.Close()
|
||||
defer os.Remove(tmpFile.Name())
|
||||
|
||||
globalRunArgs := MustGetEnv("DOKKU_GLOBAL_RUN_ARGS")
|
||||
createLabelArgs := []string{"--label", fmt.Sprintf("com.dokku.app-name=%s", appName), globalRunArgs}
|
||||
containerID, err := DockerContainerCreate(image, createLabelArgs)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to create temporary container: %v", err)
|
||||
}
|
||||
|
||||
// docker cp exits with status 1 when run as non-root user when it tries to chown the file
|
||||
// after successfully copying the file. Thus, we suppress stderr.
|
||||
// ref: https://github.com/dotcloud/docker/issues/3986
|
||||
containerCopyCmd := NewShellCmd(strings.Join([]string{
|
||||
DockerBin(),
|
||||
"container",
|
||||
"cp",
|
||||
fmt.Sprintf("%s:%s", containerID, source),
|
||||
tmpFile.Name(),
|
||||
}, " "))
|
||||
containerCopyCmd.ShowOutput = false
|
||||
fileCopied := containerCopyCmd.Execute()
|
||||
|
||||
containerRemoveCmd := NewShellCmd(strings.Join([]string{
|
||||
DockerBin(),
|
||||
"container",
|
||||
"rm",
|
||||
"--force",
|
||||
containerID,
|
||||
}, " "))
|
||||
containerRemoveCmd.ShowOutput = false
|
||||
containerRemoveCmd.Execute()
|
||||
|
||||
if !fileCopied {
|
||||
return fmt.Errorf("Unable to copy file %s from image", source)
|
||||
}
|
||||
|
||||
fi, err := os.Stat(tmpFile.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if fi.Size() == 0 {
|
||||
return fmt.Errorf("Unable to copy file %s from image", source)
|
||||
}
|
||||
|
||||
// workaround for CHECKS file when owner is root. seems to only happen when running inside docker
|
||||
dos2unixCmd := NewShellCmd(strings.Join([]string{
|
||||
"dos2unix",
|
||||
"-l",
|
||||
"-n",
|
||||
tmpFile.Name(),
|
||||
destination,
|
||||
}, " "))
|
||||
dos2unixCmd.ShowOutput = false
|
||||
dos2unixCmd.Execute()
|
||||
|
||||
// add trailing newline for certain places where file parsing depends on it
|
||||
b, err := sh.Command("tail", "-c1", destination).Output()
|
||||
if string(b) != "" {
|
||||
f, err := os.OpenFile(destination, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
if _, err := f.WriteString("\n"); err != nil {
|
||||
return fmt.Errorf("Unable to append trailing newline to copied file: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DockerBin returns a string which contains a path to the current docker binary
|
||||
func DockerBin() string {
|
||||
dockerBin := os.Getenv("DOCKER_BIN")
|
||||
if dockerBin == "" {
|
||||
dockerBin = "docker"
|
||||
}
|
||||
|
||||
return dockerBin
|
||||
}
|
||||
|
||||
// DockerCleanup cleans up all exited/dead containers and removes all dangling images
|
||||
func DockerCleanup(appName string, forceCleanup bool) error {
|
||||
if !forceCleanup {
|
||||
skipCleanup := false
|
||||
if appName != "" {
|
||||
b, _ := PlugnTriggerOutput("config-get", []string{appName, "DOKKU_SKIP_CLEANUP"}...)
|
||||
output := strings.TrimSpace(string(b[:]))
|
||||
if output == "true" {
|
||||
skipCleanup = true
|
||||
}
|
||||
}
|
||||
|
||||
if skipCleanup || os.Getenv("DOKKU_SKIP_CLEANUP") == "true" {
|
||||
LogInfo1("DOKKU_SKIP_CLEANUP set. Skipping dokku cleanup")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo1("Cleaning up...")
|
||||
scheduler := GetAppScheduler(appName)
|
||||
if appName == "--global" {
|
||||
appName = ""
|
||||
}
|
||||
|
||||
forceCleanupArg := "false"
|
||||
if forceCleanup {
|
||||
forceCleanupArg = "true"
|
||||
}
|
||||
|
||||
if err := PlugnTrigger("scheduler-docker-cleanup", []string{scheduler, appName, forceCleanupArg}...); err != nil {
|
||||
return fmt.Errorf("Failure while cleaning up app: %s", err)
|
||||
}
|
||||
|
||||
// delete all non-running and dead containers
|
||||
exitedContainerIDs, _ := listContainers("exited", appName)
|
||||
deadContainerIDs, _ := listContainers("dead", appName)
|
||||
containerIDs := append(exitedContainerIDs, deadContainerIDs...)
|
||||
|
||||
if len(containerIDs) > 0 {
|
||||
removeContainers(containerIDs)
|
||||
}
|
||||
|
||||
// delete dangling images
|
||||
imageIDs, _ := listDanglingImages(appName)
|
||||
if len(imageIDs) > 0 {
|
||||
RemoveImages(imageIDs)
|
||||
}
|
||||
|
||||
if appName != "" {
|
||||
// delete unused images
|
||||
pruneUnusedImages(appName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DockerContainerCreate creates a new container and returns the container ID
|
||||
func DockerContainerCreate(image string, containerCreateArgs []string) (string, error) {
|
||||
cmd := []string{
|
||||
DockerBin(),
|
||||
"container",
|
||||
"create",
|
||||
}
|
||||
|
||||
cmd = append(cmd, containerCreateArgs...)
|
||||
cmd = append(cmd, image)
|
||||
|
||||
var stderr bytes.Buffer
|
||||
containerCreateCmd := NewShellCmd(strings.Join(cmd, " "))
|
||||
containerCreateCmd.ShowOutput = false
|
||||
containerCreateCmd.Command.Stderr = &stderr
|
||||
b, err := containerCreateCmd.Output()
|
||||
if err != nil {
|
||||
return "", errors.New(strings.TrimSpace(stderr.String()))
|
||||
}
|
||||
|
||||
return strings.TrimSpace(string(b[:])), nil
|
||||
}
|
||||
|
||||
// DockerInspect runs an inspect command with a given format against a container or image ID
|
||||
func DockerInspect(containerOrImageID, format string) (output string, err error) {
|
||||
b, err := sh.Command(DockerBin(), "inspect", "--format", format, containerOrImageID).Output()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
output = strings.TrimSpace(string(b[:]))
|
||||
if strings.HasPrefix(output, "'") && strings.HasSuffix(output, "'") {
|
||||
output = strings.TrimSuffix(strings.TrimPrefix(output, "'"), "'")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IsImageHerokuishBased returns true if app image is based on herokuish
|
||||
func IsImageHerokuishBased(image string, appName string) bool {
|
||||
output, err := DockerInspect(image, "{{range .Config.Env}}{{if eq . \"USER=herokuishuser\" }}{{println .}}{{end}}{{end}}")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return output != ""
|
||||
}
|
||||
|
||||
// RemoveImages removes images by ID
|
||||
func RemoveImages(imageIDs []string) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"image",
|
||||
"rm",
|
||||
}
|
||||
|
||||
command = append(command, imageIDs...)
|
||||
|
||||
var stderr bytes.Buffer
|
||||
rmCmd := NewShellCmd(strings.Join(command, " "))
|
||||
rmCmd.ShowOutput = false
|
||||
rmCmd.Command.Stderr = &stderr
|
||||
rmCmd.Execute()
|
||||
}
|
||||
|
||||
// VerifyImage returns true if docker image exists in local repo
|
||||
func VerifyImage(image string) bool {
|
||||
imageCmd := NewShellCmd(strings.Join([]string{DockerBin(), "image", "inspect", image}, " "))
|
||||
imageCmd.ShowOutput = false
|
||||
return imageCmd.Execute()
|
||||
}
|
||||
|
||||
func listContainers(status string, appName string) ([]string, error) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"container",
|
||||
"list",
|
||||
"--quiet",
|
||||
"--all",
|
||||
"--filter",
|
||||
fmt.Sprintf("status=%v", status),
|
||||
"--filter",
|
||||
fmt.Sprintf("label=%v", os.Getenv("DOKKU_CONTAINER_LABEL")),
|
||||
}
|
||||
|
||||
if appName != "" {
|
||||
command = append(command, []string{"--filter", fmt.Sprintf("label=com.dokku.app-name=%v", appName)}...)
|
||||
}
|
||||
|
||||
var stderr bytes.Buffer
|
||||
listCmd := NewShellCmd(strings.Join(command, " "))
|
||||
listCmd.ShowOutput = false
|
||||
listCmd.Command.Stderr = &stderr
|
||||
b, err := listCmd.Output()
|
||||
|
||||
if err != nil {
|
||||
return []string{}, errors.New(strings.TrimSpace(stderr.String()))
|
||||
}
|
||||
|
||||
output := strings.Split(strings.TrimSpace(string(b[:])), "\n")
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func listDanglingImages(appName string) ([]string, error) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"image",
|
||||
"list",
|
||||
"--quiet",
|
||||
"--filter",
|
||||
"dangling=true",
|
||||
}
|
||||
|
||||
if appName != "" {
|
||||
command = append(command, []string{"--filter", fmt.Sprintf("label=com.dokku.app-name=%v", appName)}...)
|
||||
}
|
||||
|
||||
var stderr bytes.Buffer
|
||||
listCmd := NewShellCmd(strings.Join(command, " "))
|
||||
listCmd.ShowOutput = false
|
||||
listCmd.Command.Stderr = &stderr
|
||||
b, err := listCmd.Output()
|
||||
|
||||
if err != nil {
|
||||
return []string{}, errors.New(strings.TrimSpace(stderr.String()))
|
||||
}
|
||||
|
||||
output := strings.Split(strings.TrimSpace(string(b[:])), "\n")
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func pruneUnusedImages(appName string) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"image",
|
||||
"prune",
|
||||
"--all",
|
||||
"--force",
|
||||
"--filter",
|
||||
fmt.Sprintf("label=com.dokku.app-name=%v", appName),
|
||||
}
|
||||
|
||||
var stderr bytes.Buffer
|
||||
pruneCmd := NewShellCmd(strings.Join(command, " "))
|
||||
pruneCmd.ShowOutput = false
|
||||
pruneCmd.Command.Stderr = &stderr
|
||||
pruneCmd.Execute()
|
||||
}
|
||||
|
||||
func removeContainers(containerIDs []string) {
|
||||
command := []string{
|
||||
DockerBin(),
|
||||
"container",
|
||||
"rm",
|
||||
}
|
||||
|
||||
command = append(command, containerIDs...)
|
||||
|
||||
var stderr bytes.Buffer
|
||||
rmCmd := NewShellCmd(strings.Join(command, " "))
|
||||
rmCmd.ShowOutput = false
|
||||
rmCmd.Command.Stderr = &stderr
|
||||
rmCmd.Execute()
|
||||
}
|
||||
@@ -137,14 +137,14 @@ dokku_log_exit() {
|
||||
dokku_log_fail_quiet() {
|
||||
declare desc="log fail formatter"
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
|
||||
echo "$@" 1>&2
|
||||
echo " ! $@" 1>&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
dokku_log_fail() {
|
||||
declare desc="log fail formatter"
|
||||
echo "$@" 1>&2
|
||||
echo " ! $@" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -185,13 +185,12 @@ is_valid_app_name() {
|
||||
local APP="$1"
|
||||
[[ -z "$APP" ]] && dokku_log_fail "APP must not be null"
|
||||
if [[ "$APP" =~ ^[a-z].* ]] || [[ "$APP" =~ ^[0-9].* ]]; then
|
||||
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]]; then
|
||||
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]] && [[ ! $APP =~ [_] ]]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "${DOKKU_ROOT:?}/$APP"
|
||||
dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
||||
dokku_log_fail "App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, colons, or underscores"
|
||||
}
|
||||
|
||||
verify_app_name() {
|
||||
@@ -293,20 +292,41 @@ get_running_image_tag() {
|
||||
echo "$RUNNING_IMAGE_TAG"
|
||||
}
|
||||
|
||||
is_image_cnb_based() {
|
||||
declare desc="returns true if app image is based on cnb"
|
||||
declare IMAGE="$1"
|
||||
|
||||
if [[ -z "$IMAGE" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
CNB_STACK_ID="$("$DOCKER_BIN" image inspect --format '{{ index .Config.Labels "io.buildpacks.stack.id" }}' "$IMAGE")"
|
||||
if [[ -n "$CNB_STACK_ID" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
is_image_herokuish_based() {
|
||||
declare desc="returns true if app image is based on herokuish"
|
||||
declare desc="returns true if app image is based on herokuish or a buildpack-like env"
|
||||
declare IMAGE="$1" APP="$2"
|
||||
local DOKKU_APP_USER
|
||||
if [[ -n "$APP" ]]; then
|
||||
DOKKU_APP_USER=$(config_get "$APP" DOKKU_APP_USER || true)
|
||||
fi
|
||||
DOKKU_APP_USER=${DOKKU_APP_USER:="herokuishuser"}
|
||||
local USER_VALUE
|
||||
|
||||
if [[ -z "$IMAGE" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if is_image_cnb_based "$IMAGE"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ -n "$APP" ]]; then
|
||||
DOKKU_APP_USER=$(config_get "$APP" DOKKU_APP_USER || true)
|
||||
fi
|
||||
DOKKU_APP_USER=${DOKKU_APP_USER:="herokuishuser"}
|
||||
|
||||
# due to how the build process works, all herokuish images have the Environment variable USER=$DOKKU_APP_USER
|
||||
USER_VALUE="$("$DOCKER_BIN" image inspect --format '{{range .Config.Env}}{{if eq . "USER='"$DOKKU_APP_USER"'"}}{{println .}}{{end}}{{end}}' "$IMAGE")"
|
||||
[[ "$USER_VALUE" == "" ]] && return 1
|
||||
@@ -420,6 +440,7 @@ copy_from_image() {
|
||||
local CID=$("$DOCKER_BIN" container create "${DOCKER_CREATE_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS "$IMAGE")
|
||||
"$DOCKER_BIN" container cp "$CID:$SRC_FILE" "$TMP_FILE_COMMAND_OUTPUT" 2>/dev/null || true
|
||||
"$DOCKER_BIN" container rm --force "$CID" &>/dev/null
|
||||
plugn trigger scheduler-register-retired "$APP" "$CID"
|
||||
|
||||
# docker cp exits with status 1 when run as non-root user when it tries to chown the file
|
||||
# after successfully copying the file. Thus, we suppress stderr.
|
||||
@@ -541,7 +562,7 @@ is_app_running() {
|
||||
declare deprecated=true
|
||||
local APP="$1"
|
||||
|
||||
dokku_log_warn "Deprecated: ps#fn-is-app-running"
|
||||
dokku_log_warn "Deprecated: ps#fn-ps-is-app-running"
|
||||
verify_app_name "$APP"
|
||||
|
||||
local APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP" 2>/dev/null)
|
||||
@@ -565,6 +586,11 @@ dokku_release() {
|
||||
declare desc="release phase"
|
||||
declare APP="$1" IMAGE_SOURCE_TYPE="$2" IMAGE_TAG="$3"
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
if is_image_cnb_based "$IMAGE"; then
|
||||
IMAGE_SOURCE_TYPE="cnb"
|
||||
fi
|
||||
|
||||
plugn trigger builder-release "$IMAGE_SOURCE_TYPE" "$APP" "$IMAGE_TAG"
|
||||
}
|
||||
|
||||
@@ -629,12 +655,20 @@ dokku_receive() {
|
||||
local IMAGE=$(get_app_image_name "$APP")
|
||||
local IMAGE_SOURCE_TYPE="$2"
|
||||
local TMP_WORK_DIR="$3"
|
||||
local DOKKU_SKIP_CLEANUP="$(config_get "$APP" DOKKU_SKIP_CLEANUP || true)"
|
||||
|
||||
docker_cleanup "$APP"
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
||||
|
||||
local DOKKU_CNB_EXPERIMENTAL="$(config_get "$APP" DOKKU_CNB_EXPERIMENTAL || true)"
|
||||
if [[ "$DOKKU_CNB_EXPERIMENTAL" == "1" ]]; then
|
||||
IMAGE_SOURCE_TYPE="cnb"
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE (experimental)..."
|
||||
else
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
||||
fi
|
||||
|
||||
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE"
|
||||
dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||
release_and_deploy "$APP"
|
||||
plugn trigger release-and-deploy "$APP"
|
||||
}
|
||||
|
||||
docker_cleanup() {
|
||||
@@ -919,7 +953,7 @@ internal_get_app_urls() {
|
||||
echo "http://$(<"$DOKKU_ROOT/HOSTNAME"):$p"
|
||||
done
|
||||
else
|
||||
echo "$SCHEME://$(<"$DOKKU_ROOT/VHOST")"
|
||||
echo "$SCHEME://$(<"$DOKKU_ROOT/HOSTNAME")"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
227
plugins/common/io.go
Normal file
227
plugins/common/io.go
Normal file
@@ -0,0 +1,227 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CatFile cats the contents of a file (if it exists)
|
||||
func CatFile(filename string) {
|
||||
slice, err := FileToSlice(filename)
|
||||
if err != nil {
|
||||
LogDebug(fmt.Sprintf("Error cat'ing file %s: %s", filename, err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
for _, line := range slice {
|
||||
LogDebug(fmt.Sprintf("line: '%s'", line))
|
||||
}
|
||||
}
|
||||
|
||||
// CopyFile copies a file from src to dst. If src and dst files exist, and are
|
||||
// the same, then return success. Otherise, attempt to create a hard link
|
||||
// between the two files. If that fail, copy the file contents from src to dst.
|
||||
// FROM: https://stackoverflow.com/a/21067803/1515875
|
||||
func CopyFile(src, dst string) (err error) {
|
||||
sfi, err := os.Stat(src)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !sfi.Mode().IsRegular() {
|
||||
// cannot copy non-regular files (e.g., directories,
|
||||
// symlinks, devices, etc.)
|
||||
return fmt.Errorf("CopyFile: non-regular source file %s (%q)", sfi.Name(), sfi.Mode().String())
|
||||
}
|
||||
dfi, err := os.Stat(dst)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if !(dfi.Mode().IsRegular()) {
|
||||
return fmt.Errorf("CopyFile: non-regular destination file %s (%q)", dfi.Name(), dfi.Mode().String())
|
||||
}
|
||||
if os.SameFile(sfi, dfi) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if err = os.Link(src, dst); err == nil {
|
||||
return
|
||||
}
|
||||
err = copyFileContents(src, dst)
|
||||
return
|
||||
}
|
||||
|
||||
// copyFileContents copies the contents of the file named src to the file named
|
||||
// by dst. The file will be created if it does not already exist. If the
|
||||
// destination file exists, all it's contents will be replaced by the contents
|
||||
// of the source file.
|
||||
// FROM: https://stackoverflow.com/a/21067803/1515875
|
||||
func copyFileContents(src, dst string) (err error) {
|
||||
in, err := os.Open(src)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer in.Close()
|
||||
out, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
cerr := out.Close()
|
||||
if err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
if _, err = io.Copy(out, in); err != nil {
|
||||
return
|
||||
}
|
||||
err = out.Sync()
|
||||
return
|
||||
}
|
||||
|
||||
// DirectoryExists returns if a path exists and is a directory
|
||||
func DirectoryExists(filename string) bool {
|
||||
fi, err := os.Stat(filename)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return fi.IsDir()
|
||||
}
|
||||
|
||||
// FileToSlice reads in all the lines from a file into a string slice
|
||||
func FileToSlice(filename string) (lines []string, err error) {
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
text := strings.TrimSpace(scanner.Text())
|
||||
if text == "" {
|
||||
continue
|
||||
}
|
||||
lines = append(lines, text)
|
||||
}
|
||||
err = scanner.Err()
|
||||
return
|
||||
}
|
||||
|
||||
// FileExists returns if a path exists and is a file
|
||||
func FileExists(filename string) bool {
|
||||
fi, err := os.Stat(filename)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return fi.Mode().IsRegular()
|
||||
}
|
||||
|
||||
// IsAbsPath returns 0 if input path is absolute
|
||||
func IsAbsPath(path string) bool {
|
||||
return strings.HasPrefix(path, "/")
|
||||
}
|
||||
|
||||
// ListFilesWithPrefix lists files within a given path that have a given prefix
|
||||
func ListFilesWithPrefix(path string, prefix string) []string {
|
||||
names, err := ioutil.ReadDir(path)
|
||||
if err != nil {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
files := []string{}
|
||||
for _, f := range names {
|
||||
if prefix != "" && !strings.HasPrefix(f.Name(), prefix) {
|
||||
continue
|
||||
}
|
||||
|
||||
if f.Mode().IsRegular() {
|
||||
files = append(files, fmt.Sprintf("%s/%s", path, f.Name()))
|
||||
}
|
||||
}
|
||||
|
||||
return files
|
||||
}
|
||||
|
||||
// ReadFirstLine gets the first line of a file that has contents and returns it
|
||||
// if there are no contents, an empty string is returned
|
||||
// will also return an empty string if the file does not exist
|
||||
func ReadFirstLine(filename string) (text string) {
|
||||
if !FileExists(filename) {
|
||||
return
|
||||
}
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for scanner.Scan() {
|
||||
if text = strings.TrimSpace(scanner.Text()); text == "" {
|
||||
continue
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// SetPermissions sets the proper owner and filemode for a given file
|
||||
func SetPermissions(path string, fileMode os.FileMode) error {
|
||||
if err := os.Chmod(path, fileMode); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
systemGroup := GetenvWithDefault("DOKKU_SYSTEM_GROUP", "dokku")
|
||||
systemUser := GetenvWithDefault("DOKKU_SYSTEM_USER", "dokku")
|
||||
|
||||
group, err := user.LookupGroup(systemGroup)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user, err := user.Lookup(systemUser)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
uid, err := strconv.Atoi(user.Uid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
gid, err := strconv.Atoi(group.Gid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Chown(path, uid, gid)
|
||||
}
|
||||
|
||||
// WriteSliceToFile writes a slice of strings to a file
|
||||
func WriteSliceToFile(filename string, lines []string) error {
|
||||
file, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
w := bufio.NewWriter(file)
|
||||
for _, line := range lines {
|
||||
fmt.Fprintln(w, line)
|
||||
}
|
||||
if err = w.Flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
file.Chmod(0600)
|
||||
SetPermissions(filename, 0600)
|
||||
|
||||
return nil
|
||||
}
|
||||
33
plugins/common/io_test.go
Normal file
33
plugins/common/io_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestCommonFileToSlice(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
lines, err := FileToSlice(testEnvFile)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(lines).To(Equal([]string{testEnvLine}))
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonFileExists(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
Expect(FileExists(testEnvFile)).To(BeTrue())
|
||||
teardownTestApp()
|
||||
}
|
||||
|
||||
func TestCommonReadFirstLine(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
line := ReadFirstLine(testEnvFile)
|
||||
Expect(line).To(Equal(""))
|
||||
Expect(setupTestApp()).To(Succeed())
|
||||
line = ReadFirstLine(testEnvFile)
|
||||
Expect(line).To(Equal(testEnvLine))
|
||||
teardownTestApp()
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user