Compare commits

...

341 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
e10e62b1e9 Release 0.11.2
# History

## 0.11.2

### Bug Fixes

- #3014: @josegonzalez fix: handle case where DOKKU_DOCKERFILE_PORTS is an empty string
- #3013: @alexquick Fix some issues with config/network/repo help output
- #3012: @alexquick Fail when setting/unsetting invalid keys
- #3011: @alexquick Forward output from plugn triggers to user
- #3004: @josegonzalez Return/Exit 1 when an image being deployed is invalid

### Documentation

- #3015: @elia Tiny fixes to triggers documentation
2017-12-18 20:10:09 -05:00
Jose Diaz-Gonzalez
f425e23bdf Merge pull request #3015 from elia/patch-5
Tiny fixes to triggers documentation
2017-12-18 14:25:45 -05:00
Elia Schito
4c86c7bd26 Tiny fixes to triggers documentation
[ci skip]
2017-12-18 19:15:49 +01:00
Jose Diaz-Gonzalez
fa605b6a83 Merge pull request #3014 from dokku/dockerfile-network-ports
fix: handle case where DOKKU_DOCKERFILE_PORTS is an empty string
2017-12-17 00:56:48 -05:00
Jose Diaz-Gonzalez
1f08853fc7 fix: handle case where DOKKU_DOCKERFILE_PORTS is an empty string 2017-12-17 00:20:04 -05:00
Jose Diaz-Gonzalez
40421b32a4 Merge pull request #3013 from alexquick/fix-help
Fix some issues with config/network/repo help output
2017-12-16 23:50:09 -05:00
Jose Diaz-Gonzalez
f3d6190e18 Merge pull request #3012 from alexquick/fix-config-invalid-keys
Fail when setting/unsetting invalid keys
2017-12-16 23:49:53 -05:00
Jose Diaz-Gonzalez
46377071ea Merge pull request #3011 from alexquick/fix-config-restart-output
[config] forward output from plugn triggers to user
2017-12-16 19:35:26 -05:00
Alex Quick
5fbe28f672 [config] stream output of app-restart & post-config-update plugn triggers to stdout/err 2017-12-16 11:32:06 -05:00
Alex Quick
302d82a192 fix indentation for network/repo help 2017-12-15 10:06:45 -05:00
Alex Quick
061ea9bfd7 [config] fix help output
* `dokku:help --all` was getting mangled
* `dokku config:help` wasn't working
2017-12-15 10:06:19 -05:00
Alex Quick
f8e3bdc56b [config] forward output from plugn triggers to user 2017-12-15 09:37:28 -05:00
Alex Quick
92d7e8ce65 [config] let user know if they are unsetting a non-existent config key 2017-12-15 09:22:56 -05:00
Alex Quick
e7faec3e26 [config] fail on setting/unsetting invalid keys 2017-12-15 09:20:18 -05:00
Jose Diaz-Gonzalez
72a847a6f1 Merge pull request #3004 from dokku/2916-fail-on-invalid-image
fix: return/exit 1 when an image being deployed is invalid
2017-12-14 00:21:13 -05:00
Jose Diaz-Gonzalez
0e007a1196 fix: declare and set variables separately 2017-12-13 23:39:04 -05:00
Jose Diaz-Gonzalez
af626a51cc fix: set IMAGE variable correctly 2017-12-13 23:37:14 -05:00
Jose Diaz-Gonzalez
4bb221d89a Release 0.11.1
# History

## 0.11.1

### Bug Fixes

- #3010: @josegonzalez fix: route config_all to the `config` command to fix datastore plugin usage
- #3009: @josegonzalez fix: correct the guard around the config_export call in config_sub
- #3006: @josegonzalez fix: do not allow shadowing of the CACHE_DIR variable
- #3005: @josegonzalez fix: persist users in the dokku group through installations
- #3003: @josegonzalez Fix issues in apps:clone calls
- #3001: @josegonzalez fix: allow applications to begin with numeric values

### New Features

- #3002: @josegonzalez fix: omit redirection of docker build output
- #3000: @josegonzalez fix: remove golang files and triggers directory for packaging
2017-12-13 19:26:46 -05:00
Jose Diaz-Gonzalez
984388d191 Merge pull request #3010 from dokku/josegonzalez-patch-1
fix: route config_all to the `config` command to fix datastore plugin usage
2017-12-13 17:37:56 -05:00
Jose Diaz-Gonzalez
f0ef1daa15 fix: route config_all to the config command 2017-12-13 17:37:29 -05:00
Jose Diaz-Gonzalez
3d065bf35c Update functions 2017-12-13 17:17:10 -05:00
Jose Diaz-Gonzalez
f1c0432375 fix: revert always returning 1 on error in release_and_deploy 2017-12-13 15:54:43 -05:00
Jose Diaz-Gonzalez
21645247fb fix: scope non-zero return on invalid image to just the deploy command 2017-12-13 15:54:19 -05:00
Jose Diaz-Gonzalez
1a350796e5 Merge pull request #3009 from dokku/josegonzalez-patch-1
fix: correct the guard around the config_export call in config_sub
2017-12-13 15:52:16 -05:00
Jose Diaz-Gonzalez
5522cf63f7 fix: revert guard and pass app arg to config_export 2017-12-13 15:46:53 -05:00
Jose Diaz-Gonzalez
52d6143d97 fix: correct the guard around the config_export call in config_sub 2017-12-13 15:39:42 -05:00
Jose Diaz-Gonzalez
0fe5c645d6 Merge pull request #3002 from dokku/josegonzalez-patch-1
fix: omit redirection of docker build output
2017-12-13 10:42:00 -05:00
Jose Diaz-Gonzalez
85d04ee11a Merge pull request #3006 from dokku/2901-cache-dir-shadowing
fix: do not allow shadowing of the CACHE_DIR variable
2017-12-13 10:39:39 -05:00
Jose Diaz-Gonzalez
343c5fb5ca Merge pull request #3005 from dokku/2908-persist-dokku-group
fix: persist users in the dokku group through installations
2017-12-13 10:39:26 -05:00
Jose Diaz-Gonzalez
4ae56cf01c fix: call tags:deploy 2017-12-13 03:16:10 -05:00
Jose Diaz-Gonzalez
8336247cc1 Merge pull request #3003 from dokku/2978-clone-fixes
Fix issues in apps:clone calls
2017-12-13 01:47:57 -05:00
Jose Diaz-Gonzalez
3fe0b56fb8 feat: add test 2017-12-13 01:31:23 -05:00
Jose Diaz-Gonzalez
329e849894 fix: do not allow shadowing of the CACHE_DIR variable
Closes #2901
2017-12-13 01:27:29 -05:00
Jose Diaz-Gonzalez
70cee2df86 fix: persist users in the dokku group through installations
Closes #2908
2017-12-13 01:24:39 -05:00
Jose Diaz-Gonzalez
2a30f45177 fix: return/exit 1 when an image being deployed is invalid
Closes #2916
2017-12-13 01:02:24 -05:00
Jose Diaz-Gonzalez
6528c4511a fix: handle case in ubuntu 16.04 where popd may fail if the dokku user does not have rights to execute in the executing user's $PWD.
Closes #2978
2017-12-13 00:44:27 -05:00
Jose Diaz-Gonzalez
fe6f339890 feat: silence cpio 2017-12-13 00:43:18 -05:00
Jose Diaz-Gonzalez
c46efa54b4 fix: do not copy the cache directory to cloned applications 2017-12-13 00:42:45 -05:00
Jose Diaz-Gonzalez
3ef3f0218f fix: omit redirection of docker build output
[ci skip]
2017-12-12 17:28:50 -05:00
Jose Diaz-Gonzalez
59414fe231 Merge pull request #3001 from dokku/josegonzalez-patch-1
fix: allow applications to begin with numeric values
2017-12-12 13:13:57 -05:00
Jose Diaz-Gonzalez
052a14f13c fix: actually reference second app 2017-12-12 11:25:46 -05:00
Jose Diaz-Gonzalez
050fa7edf3 feat: add test for apps starting with numeric characters 2017-12-12 11:25:16 -05:00
Jose Diaz-Gonzalez
e9db130b38 Merge pull request #3000 from dokku/src-clean
fix: remove golang files and triggers directory for packaging
2017-12-12 11:13:00 -05:00
Jose Diaz-Gonzalez
39aefb95c2 fix: allow applications to begin with numeric values 2017-12-12 11:12:23 -05:00
Jose Diaz-Gonzalez
f1baa1f6a5 fix: remove golang files and triggers directory for packaging 2017-12-12 03:13:07 -05:00
Jose Diaz-Gonzalez
cd9c2d7dbe Release 0.11.0
# History

## 0.11.0

### Bug Fixes

- #2998: @josegonzalez Fix issues in release process
- #2993: @josegonzalez Add config_all alias for plugin usage
- #2972: @buckle2000 Correct typo in docker-options:remove error output
- #2964: @znz Remove unused variable
- #2967: @znz Fix indentation in test file
- #2963: @znz Correct typos in config plugin and remove potential infinite recursion issue
- #2951: @josegonzalez Handle case where the app directory is a symlink
- #2939: @znz Remove unnecessary lines
- #2945: @znz Fix network plugin version
- #2937: @michaelshobbs Strip restart flag from app_user_pre_deploy_trigger
- #2931: @josegonzalez Upgrade git package for CI
- #2928: @silverfix Do not overwrite the VHOST file during installation if it exists
- #2926: @vtavernier Remove leading forward slash from app name in git-upload-pack

### New Features

- #2985: @bitmand Build a custom dhparam file once for nginx and include it as default
- #2974: @josegonzalez Upgrade to herokuish 0.3.33
- #2973: @josegonzalez Allow usage of git 2.13.0+ by unsetting GIT_QUARANTINE_PATH during git worktree usage
- #2971: @miraculixx Add support for older virtualbox versions in official Dokku Vagrantfile
- #2966: @znz Simplify internal config functions to reduce duplication
- #2751: @alexquick Move config plugin to golang
- #2938: @michaelshobbs Upgrade to golang 1.9.1
- #2736: @josegonzalez Implement Network Plugin
- #2929: @michaelshobbs Add codacy config and coverage targets

### Documentation

- #2935: @jcrben Document how to make herokuish optional during the bootstrap installation
- #2982: @agorf Correct typo in user management docs
- #2981: @agorf Correct typos in process management docs
- #2969: @znz Correct comments on network triggers
- #2965: @znz Remove spaces from config subcommand help output to mirror help output of other subcommands
- #2954: @mrname Add vernemq community datastore plugin to docs
- #2944: @axilleas Fix syntax typo in debian installation docs
- #2932: @znz Update code comment to match documentation
- #2933: @znz Fix version number for network binding documentation
2017-12-12 02:52:29 -05:00
Jose Diaz-Gonzalez
2e0939702a fix: properly copy triggers into place 2017-12-12 02:52:22 -05:00
Jose Diaz-Gonzalez
fc4903c1c9 fix: set GOPATH globally 2017-12-12 02:14:19 -05:00
Jose Diaz-Gonzalez
3f408f1304 feat: copy golang binaries into place before usage 2017-12-12 01:49:44 -05:00
Jose Diaz-Gonzalez
e3eab48e4a Merge pull request #2998 from dokku/release-cleanup
Release cleanup
2017-12-12 01:16:14 -05:00
Jose Diaz-Gonzalez
39abbdc5dd fix: ensure the trigger is moved into the correct directory 2017-12-12 00:22:18 -05:00
Jose Diaz-Gonzalez
5d5ede2b85 revert: drop reference to CGO_ENABLED completely 2017-12-12 00:09:36 -05:00
Jose Diaz-Gonzalez
64252b282a hack: ignore libc dependency 2017-12-11 23:58:50 -05:00
Jose Diaz-Gonzalez
b449227467 revert: re-enable system net usage 2017-12-11 23:46:08 -05:00
Jose Diaz-Gonzalez
228eb9ed7a revert: re-enable CGO_ENABLED=0 2017-12-11 23:44:08 -05:00
Jose Diaz-Gonzalez
a999f9d4e5 fix: set the TRIGGERS make variable properly 2017-12-11 23:26:33 -05:00
Jose Diaz-Gonzalez
9b431321fa feat: use the built-in net package instead of linking to system 2017-12-11 23:22:27 -05:00
Jose Diaz-Gonzalez
a96c1d644a fix: turn off CGO for all go builds 2017-12-11 23:22:11 -05:00
Jose Diaz-Gonzalez
6bd6cad8fd refactor: simplify triggers targets 2017-12-11 23:21:14 -05:00
Jose Diaz-Gonzalez
58cc088445 feat: converge upon a more standard Makefile for golang plugins 2017-12-11 23:16:03 -05:00
Jose Diaz-Gonzalez
1d46208ac2 fix: ensure we have a src-clean make target for the config plugin 2017-12-11 23:00:25 -05:00
Jose Diaz-Gonzalez
465c6e9a62 fix: allow lintian to pass on hardening-no-relro 2017-12-11 22:59:38 -05:00
Jose Diaz-Gonzalez
7a8cc2687d fix: ensure we call apt-get update when calling apt-get install 2017-12-11 22:56:34 -05:00
Jose Diaz-Gonzalez
96ad5e8e5d fix: update SSHCOMMAND_URL to v0.7.0 2017-12-11 22:56:12 -05:00
Jose Diaz-Gonzalez
4cc215ea02 Merge pull request #2993 from dokku/josegonzalez-patch-1
fix: add config_all alias for plugin usage
2017-12-02 14:33:10 -05:00
Jose Diaz-Gonzalez
c10c58a1cd Merge pull request #2985 from bitmand/custom_nginx_dhparams
Build a custom dhparam file once for nginx and include it as default
2017-12-02 13:57:06 -05:00
Jose Diaz-Gonzalez
099653ca02 fix: add config_all alias for plugin usage 2017-12-02 13:55:34 -05:00
Lasse Brandt
84a6c6017d Build a custom dhparam file once for nginx and include it as default 2017-11-14 12:55:52 +01:00
Jose Diaz-Gonzalez
9fcd9b0065 Merge pull request #2935 from jcrben/no-herokuish-option
docs: WIP on explaining optional herokuish
2017-11-12 13:33:05 -05:00
Jose Diaz-Gonzalez
dc9ebf867c docs: revise herokuish installation
[ci skio]
2017-11-12 13:28:36 -05:00
Jose Diaz-Gonzalez
3684c10a78 Merge pull request #2974 from dokku/josegonzalez-patch-1
feat: upgrade to herokuish 0.3.33
2017-11-11 14:28:39 -05:00
Jose Diaz-Gonzalez
10492587c2 Merge pull request #2982 from agorf/patch-2
Correct typo in user management docs
2017-11-11 13:51:15 -05:00
Jose Diaz-Gonzalez
bc93007c74 Merge pull request #2981 from agorf/patch-1
Correct typos in process management docs
2017-11-11 13:50:45 -05:00
Angelos Orfanakos
0e91a5bd0b Fix typo in user management docs 2017-11-11 13:35:52 +02:00
Angelos Orfanakos
75c7c2ebf0 Fix typos 2017-11-11 13:21:40 +02:00
Ben Creasy
6c57f1a08b docs: WIP on optional herokuish
[ci skip]
2017-11-09 22:38:22 -08:00
Jose Diaz-Gonzalez
59e5036456 feat: upgrade to herokuish 0.3.33 2017-11-05 16:09:11 -05:00
Jose Diaz-Gonzalez
158f10d321 Merge pull request #2973 from dokku/2796-git-quarantine
feat: allow usage of git 2.13.0+ by unsetting GIT_QUARANTINE_PATH during git worktree usage
2017-11-05 16:07:59 -05:00
Jose Diaz-Gonzalez
4a3047b170 feat: drop pinning of git version 2017-11-05 12:37:42 -05:00
Jose Diaz-Gonzalez
64a1c91b76 feat: allow usage of git 2.13.0+ by unsetting GIT_QUARANTINE_PATH during git worktree usage
Closes #2796
2017-11-05 12:34:47 -05:00
Jose Diaz-Gonzalez
39b879058d Merge pull request #2972 from buckle2000/patch-1
Correct typo in docker-options:remove error output
2017-11-05 12:26:36 -05:00
buckle2000
5ae9067750 Fix typo 2017-11-06 00:48:29 +08:00
Jose Diaz-Gonzalez
2af312ac03 Merge pull request #2971 from miraculixx/fix-2955
Add support for older virtualbox versions in official Dokku Vagrantfile
2017-11-04 13:04:24 -04:00
miraculixx
172bc87f32 resolve #2955 2017-11-04 14:14:02 +01:00
Jose Diaz-Gonzalez
83ef992155 Merge pull request #2969 from znz/fix-comments
Fix comments [ci skip]
2017-11-04 01:25:57 -04:00
Jose Diaz-Gonzalez
0df3f8d12d Merge pull request #2964 from znz/remove-unused
Remove unused variable
2017-11-03 18:08:00 -04:00
Jose Diaz-Gonzalez
23ee740c04 Merge pull request #2968 from znz/use-special-name
Use special name for global
2017-11-03 18:07:31 -04:00
Jose Diaz-Gonzalez
54d731aeee Merge pull request #2965 from znz/remove-spaces
Remove spaces like helps of other subcommands
2017-11-03 18:07:12 -04:00
Jose Diaz-Gonzalez
9481e7031d Merge pull request #2966 from znz/refactoring
Refactoring some codes
2017-11-03 18:07:01 -04:00
Jose Diaz-Gonzalez
70ba60e9e8 Merge pull request #2967 from znz/fix-indent
Fix indent
2017-11-03 18:05:38 -04:00
Jose Diaz-Gonzalez
04a5e8bedf Merge pull request #2963 from znz/fix-typos
Fix typos
2017-11-03 11:26:55 -04:00
Kazuhiro NISHIYAMA
9706f7a298 Fix comments [ci skip]
fix comments of `func main()`
closes #2946
2017-11-03 15:55:18 +09:00
Kazuhiro NISHIYAMA
cdd2b2028e Use special name for global
Use name with `<>` like `<unknown>` to distinguish global env and env of app named global
2017-11-03 13:41:49 +09:00
Kazuhiro NISHIYAMA
3eb7a13006 Fix indent 2017-11-03 13:30:18 +09:00
Kazuhiro NISHIYAMA
71763e18f6 Reduce copying args when global 2017-11-03 13:28:08 +09:00
Kazuhiro NISHIYAMA
e9506e80cb Reduce loading global env 2017-11-03 13:27:23 +09:00
Kazuhiro NISHIYAMA
33a540502a Remove spaces like helps of other subcommands 2017-11-03 12:51:40 +09:00
Kazuhiro NISHIYAMA
b8575a33f5 Remove unused variable 2017-11-03 12:47:30 +09:00
Kazuhiro NISHIYAMA
a3cd6f6e63 Fix typos 2017-11-03 12:42:00 +09:00
Jose Diaz-Gonzalez
85fa7a5bb0 Merge pull request #2751 from alexquick/feature-config-golang
Move config plugin to golang
2017-10-28 20:40:06 -04:00
Alex Quick
90ee5d58c5 [config] use field names in struct literals 2017-10-24 09:12:20 -04:00
Jose Diaz-Gonzalez
ffac858566 Merge pull request #2954 from mrname/adding_vernemq_to_docs
adding vernemq plugin to docs
2017-10-23 16:06:35 -04:00
Justin Crown
0f10c94839 adding vernemq plugin to docs 2017-10-23 11:51:12 -07:00
Jose Diaz-Gonzalez
0581b38adf Merge pull request #2951 from dokku/josegonzalez-patch-1
fix: handle case where the app directory is a symlink
2017-10-22 14:06:15 -04:00
Jose Diaz-Gonzalez
576ec05a9e fix: handle case where the app directory is a symlink
Closes #2943
2017-10-21 13:52:08 -04:00
Jose Diaz-Gonzalez
6f4720adca Merge pull request #2939 from znz/remove-unnecessary-line
Remove unnecessary lines
2017-10-19 10:28:14 -04:00
Jose Diaz-Gonzalez
ab3249c76b Merge pull request #2945 from znz/fix-network-plugin-version
Fix network plugin version
2017-10-19 10:27:55 -04:00
Alex
2f7daad200 fix: typo on declare 2017-10-16 20:23:30 -04:00
Alex
6780d53c77 Merge branch 'master' of github.com:dokku/dokku into feature-config-golang 2017-10-16 20:22:28 -04:00
Kazuhiro NISHIYAMA
36fc689a5d Fix network plugin version
[ci skip]
2017-10-16 21:15:36 +09:00
Alex Quick
98c45b55b7 fix: newlines at eof 2017-10-16 02:21:38 -04:00
Alex Quick
1be66bd1bc [config] don't alias import 2017-10-16 02:09:26 -04:00
Alex Quick
91c2164e49 [config] refactor package structure 2017-10-15 20:10:46 -04:00
Jose Diaz-Gonzalez
9876b9e588 Merge pull request #2944 from axilleas/patch-1
Fix syntax typo in debian.md
2017-10-15 14:08:07 -04:00
Achilleas Pipinellis
58e36fee10 Fix syntax typo in debian.md
[ci skip]
2017-10-15 13:54:13 +03:00
Alex Quick
03830562c2 move around the members of configenv to make more sense 2017-10-12 23:49:22 -04:00
Alex Quick
430cc2b4ca [config] move PrettyPrintEnvEntries 2017-10-12 23:42:14 -04:00
Alex Quick
3f497908b5 [config] use named returns where applicable 2017-10-12 23:41:42 -04:00
Alex Quick
3422866909 [config] remove spurious newlines 2017-10-12 22:50:29 -04:00
Alex Quick
b84635baf7 [config] remove old code 2017-10-12 22:49:44 -04:00
Alex Quick
ad8bcecb5b [config] clean up PlugnTrigger and NewShellCmd 2017-10-12 22:38:18 -04:00
Alex Quick
c896ca700c [config] remove vestige of old test 2017-10-12 21:42:18 -04:00
Alex Quick
ecf67d3cdd [config] add eof newlines where needed 2017-10-12 21:40:26 -04:00
Alex Quick
e9b9091de5 [config] remove extra test targets 2017-10-12 21:35:33 -04:00
Kazuhiro NISHIYAMA
62b27d4007 Remove unnecessary lines
Because never reached when `VHOST` is regular file.
(reachable when `VHOST` is fifo, etc.)

[ci skip]
2017-10-11 20:58:26 +09:00
Michael Hobbs
cc3ccda90a Merge pull request #2938 from dokku/mh/chore/upgrade-golang
upgrade to golang 1.9.1
2017-10-10 10:11:52 -07:00
Michael Hobbs
dc79152fe0 upgrade to golang 1.9.1 2017-10-10 08:13:59 -07:00
Michael Hobbs
6b340c69b5 Merge pull request #2937 from dokku/mh/fix/strip-restart-flag
strip restart flag from app_user_pre_deploy_trigger
2017-10-09 16:03:04 -07:00
Michael Hobbs
f2ec959598 strip restart flag from app_user_pre_deploy_trigger 2017-10-09 15:33:09 -07:00
Jose Diaz-Gonzalez
b16c2876c4 Merge branch 'master' into feature-config-golang 2017-10-06 11:13:15 -04:00
Jose Diaz-Gonzalez
3f50097619 Merge pull request #2932 from znz/fix-comment
Fix comment
2017-10-06 11:12:58 -04:00
Jose Diaz-Gonzalez
28ca39266c Merge pull request #2933 from znz/fix-typo
Fix version number [ci skip]
2017-10-06 11:12:07 -04:00
Kazuhiro NISHIYAMA
6dcf695822 Fix version number [ci skip]
in document of Container network interface binding
2017-10-06 20:07:18 +09:00
Kazuhiro NISHIYAMA
aeba3f2269 Fix comment
[ci skip]
2017-10-06 20:01:35 +09:00
Jose Diaz-Gonzalez
1fb0e737c3 Merge pull request #2931 from dokku/josegonzalez-patch-1
fix: upgrade git package for CI
2017-10-05 23:15:55 -04:00
Jose Diaz-Gonzalez
462a648ac8 Merge pull request #2928 from silverfix/patch-1
fix: do not overwrite the VHOST file during installation if it exists
2017-10-05 22:32:58 -04:00
Jose Diaz-Gonzalez
6523163701 fix: upgrade git package for CI 2017-10-05 22:28:24 -04:00
Jose Diaz-Gonzalez
a9a9d0a898 Merge pull request #2926 from vtavernier/issue-2915
Fix #2915
2017-10-05 22:05:55 -04:00
Jose Diaz-Gonzalez
2851f2c63f fix: remove duplicate logging functions 2017-10-05 13:26:20 -04:00
Jose Diaz-Gonzalez
5e82b37147 Merge branch 'master' into feature-config-golang 2017-10-04 19:04:31 -04:00
Jose Diaz-Gonzalez
810ebffceb Merge pull request #2736 from dokku/2403-network-plugin
Implement Network Plugin
2017-10-04 18:55:41 -04:00
Jose Diaz-Gonzalez
adedd3af5d fix: avoid Hash Sum mismatch errors 2017-10-04 01:11:09 -04:00
Jose Diaz-Gonzalez
722f22e7f0 fix: avoid old gpg key error 2017-10-04 01:06:17 -04:00
Jose Diaz-Gonzalez
ad732bd42b feat: add network:report command 2017-10-04 00:58:29 -04:00
Michael Hobbs
fdbab2c291 fix test coverage deps 2017-10-02 16:57:45 -07:00
Michael Hobbs
8654783131 style tweaks 2017-10-02 16:50:05 -07:00
Michael Hobbs
b099d2c389 add more tests 2017-10-02 16:49:54 -07:00
Michael Hobbs
c9ea884e5d move coverage command to only run on ci 2017-10-02 16:36:12 -07:00
Michael Hobbs
fbf9077075 make test more flexible 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
5e32f9a89d refactor: go back to the old regex 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
690c32ceb8 fix: use the same method to trigger the client 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
7d73577952 refactor: use grep -E instead of egrep 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
edfec35177 feat: add symlinks to all network and proxy hooks 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
c2ee6e99c6 fix: update unconfigured client test regex 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
419d687c50 fix: remove proxy enabled checks when retrieving a container's ip and port 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
3ca5503b74 fix: actually echo the property 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
acde3d60a7 feat: allow users to bind to all interfaces when a proxy is enabled
- use a plugin trigger to see whether we should bind to all interfaces
- create a generic way of setting properties for a plugin
- migrate proxy-enabled to the new network property "bind-all-interfaces"
- add network:set subcommand
2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
7a4464a8ae feat: more loggers 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
096ba83f41 refactor: alphabetize more functions 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
04cd5eeb91 refactor: move all logging functions to their own file 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
9d287d0a5d refactor: alphabetize functions 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
af13d1247f refactor: consolidate DOKKU_DISABLE_PROXY usage into the proxy plugin 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
81ddef04ff refactor: drop direct access to PORT files 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
9ef7c385d4 refactor: drop extra sub-shell 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
dc00542b6f refactor: remove use of IP and PORT files from core-post-deploy plugin 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
7fe2f8593c refactor: remove unused IS_HEROKUISH_CONTAINER argument 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
20dca9fd46 fix: convert the containerIndex to a string to ensure it is properly passed to the plugn trigger 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
647efab2dd fix: ensure we always call proxy-build-config when calling ps_start 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
44282fd857 fix: Declare and assign separately to avoid masking return values. 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
1372522258 fix: Declare and assign separately to avoid masking return values. 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
27f247eabd fix: do not shadow id variable 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
a3abf8016b fix: correct lint errors 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
3b9f4ba63f fix: correct lint errors 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
92d6e76ea4 fix: ignore vendor directories 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
350efd8d53 chore: remove use of deprecated method 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
6f008d6643 fix: use correct conditional check for isHerokuishContainer 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
6e76831b5d fix: use correct flag parameter for app name 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
31333452c8 fix: refactor retrieval of network and docker inspect information 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
25759bcbb4 fix: use correct flag positional argument 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
72eb8a06f0 fix: respond to all review comments 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
1e8831d9a0 chore: remove unused nullglob 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
c788659b63 refactor: rewrite network plugin in golang 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
e74346f0dc fix: call correct command 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
5b592575e7 fix: call correct command 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
c43a3edfc6 fix: ensure ports are set to an array 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
94149c8445 fix: properly pass PROC_TYPE 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
7fd32fb3e8 fix: properly retrieve ports list 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
006eb452f1 fix: do not generate network config if there is no generated scale file 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
2c5190bf63 fix: set IS_HEROKUISH_CONTAINER=false to false by default 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
0cc9e42c59 fix: check IS_HEROKUISH_CONTAINER value check 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
b409af602a fix: call network-get-ipaddr correctly 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
b0afa778fb chore: minor cleanup 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
b8a4152e10 fix: call the correct method in the proxy-build-config hook 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
4949d1e33e fix: always pass in IS_HEROKUISH_CONTAINER 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
06a7cb2a3d fix: check correct variable 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
aee88d081d fix: add missing proxy/functions source call 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
f71d147a8f fix: add missing argument 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
dfad37ba23 fix: cleanup issues retrieving the port and ipaddr for a container 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
1a2ed28e5b docs: add documentation for all new triggers 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
054a1328f7 fix: thren => then 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
901ec7c213 refactor: retrieve ip and port for checks from the network plugin triggers 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
6fbd148597 fix: properly name variable to avoid reference issues 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
d7d5d373c9 feat: refactor to retrieve listeners from network plugin 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
a9e0f8b7be fix: ensure we write the ipaddr and port 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
f668bec210 docs: move dns and proxy management to new networking section 2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
1835b04809 feat: refactor to use network plugin
- Add proxy-build-config hook to rebuild network and proxy settings for an application
- Scope nginx:build-config to work only when it is the configured proxy for an application
- Refactor deploy code to interact with network plugin for computed and actual ipaddr/port settings
- Ensure the proxy-build-config plugin trigger is called on ps:restore
- Expose a few plugin triggers for retrieving networking information for a given APP/PROC_TYPE/CONTAINER_ID combination
2017-10-02 15:05:13 -07:00
Jose Diaz-Gonzalez
ec9b8be5f8 feat: implement first-pass at networking plugin
Implements help, `rebuild`, and `rebuildall` command.

Refs #2403
2017-10-02 15:05:13 -07:00
Michael Hobbs
8be92d9739 Merge pull request #2929 from dokku/mh/chore/codacy
add codacy config and coverage targets
2017-10-02 15:04:38 -07:00
Michael Hobbs
bbb38031f0 add codacy config and coverage targets 2017-10-02 14:41:03 -07:00
Jose Diaz-Gonzalez
c25ef5dc4c fix: Declare and assign separately to avoid masking return values 2017-10-02 11:57:50 -04:00
Jose Diaz-Gonzalez
093414b846 feat: add logging 2017-10-02 11:48:29 -04:00
Jose Diaz-Gonzalez
f664ad1cde fix: remove extra whitespace 2017-10-02 11:40:31 -04:00
Andrea Rabbaglietti
5e9306ad40 Fix #2927
Fix to prevent dokku upgrade on debian systems overwrites ${DOKKU_ROOT}/VHOST
2017-10-02 17:37:17 +02:00
Vincent Tavernier
c9af7e4cfa Fix #2915
Add forward slash cleanup of the app name for the git-upload-pack
command. Prevents is_valid_app_name from removing the application folder
on `git fetch`.
2017-10-02 09:29:30 +02:00
Alex Quick
5d72f145df [config] restore dokku config functionality and fix docs 2017-10-01 22:50:01 -04:00
Jose Diaz-Gonzalez
5b3506584a Release 0.10.5
# History

## 0.10.5

### Bug Fixes

- #2912: @josegonzalez Add missing depends statement for rsyslog
- #2906: @manuel-colmenero Check the location of nginx in a central way
- #2895: @josegonzalez cd to app directory when calling git worktree add

### Documentation

- #2922: @axilleas Clarify the minimum Nginx version for HTTP/2 support
- #2919: @wootwoot1234 Update nginx documentation surrounding file uploading for php buildpack users
- #2913: @znz Fix a typo in the rpm release script
- #2910: @buckle2000 Add a note about using the full git url for non-compliant toolchains
2017-10-01 15:12:30 -04:00
Jose Diaz-Gonzalez
27748f9576 Merge pull request #2922 from axilleas/docs/nginx-http2
Clarify the minimum Nginx version for HTTP/2 support
2017-10-01 14:46:34 -04:00
Jose Diaz-Gonzalez
e6f7d4a732 docs: remove unnecessary doc explanation
[ci skip]
2017-10-01 14:46:20 -04:00
Jose Diaz-Gonzalez
32b18a8a5c Merge pull request #2924 from dokku/josegonzalez-patch-1
fix: use a colon instead of a slash for remotes
2017-10-01 14:42:32 -04:00
Jose Diaz-Gonzalez
160a5c9760 fix: use a colon instead of a slash for remotes
Using a slash is broken as it will assume that is part of the remote name.

[ci skip]
2017-10-01 14:42:07 -04:00
Achilleas Pipinellis
dde1531f42 Clarify the minimum Nginx version for HTTP/2 support
Add docs for https://github.com/dokku/dokku/pull/2496

[ci skip]
2017-10-01 12:12:14 +02:00
Alex Quick
60e3b37d39 [config] trigger app restart through plugn rather than exec 2017-09-27 23:56:43 -04:00
Alex Quick
a8563489e7 [common] fix PlugnTrigger 2017-09-27 23:56:42 -04:00
Alex Quick
a86c037a91 [config] upgrade to godotenv 1.2.0 2017-09-27 23:56:42 -04:00
Jose Diaz-Gonzalez
523429b47f fix: ignore vendor directories 2017-09-27 23:56:42 -04:00
Alex Quick
a13722eec1 [config] update glide dependencies 2017-09-27 23:56:42 -04:00
Alex Quick
8e8b6d60f0 fix: Declare and assign separately to avoid masking return values. 2017-09-27 23:56:42 -04:00
Alex Quick
4808c047ee [config] make HasKey more idiomatic 2017-09-27 23:56:42 -04:00
Alex Quick
be5e81b246 [config] config:get exit with status 1 if key is not set in env 2017-09-27 23:56:42 -04:00
Jose Diaz-Gonzalez
a137ed64dc fix: Declare and assign separately to avoid masking return values. 2017-09-27 23:56:42 -04:00
Jose Diaz-Gonzalez
fc1129c728 fix: correct flake8 issues 2017-09-27 23:56:42 -04:00
Alex Quick
a22594b891 [config] update docs 2017-09-27 23:56:41 -04:00
Alex Quick
4f5c747c99 [config] add config:export --format shell 2017-09-27 23:56:41 -04:00
Alex Quick
e7a81a8f8b [config] error message when no key is given for config:get 2017-09-27 23:56:41 -04:00
Alex Quick
32414b343a [config] show empty config when ENV file doesn't exist yet 2017-09-27 23:56:41 -04:00
Alex Quick
eeb6e78fa4 [config] move to godotenv 2017-09-27 23:56:41 -04:00
Alex Quick
08aa2b9fa4 [config] improve logging and default command 2017-09-27 23:56:41 -04:00
Alex Quick
8b90d4ebf9 [config] move vendor to right place 2017-09-27 23:56:41 -04:00
Alex Quick
133fdc1f0a [config] support for old export-style config files 2017-09-27 23:56:41 -04:00
Alex Quick
e7e01ee838 [config] fix shellcheck 2017-09-27 23:56:40 -04:00
Alex Quick
12c9536a7b [config] test python buildpack too 2017-09-27 23:56:40 -04:00
Alex Quick
c20fbfccf6 [config] support for env bundles 2017-09-27 23:56:40 -04:00
Alex Quick
fd27d90303 [config] config:export --merge, --prefix, & --suffix 2017-09-27 23:56:40 -04:00
Alex Quick
686428a41a [config] lint fixes 2017-09-27 23:56:40 -04:00
Alex Quick
73e85b7df5 [config] preliminary Dockerfile support 2017-09-27 23:56:40 -04:00
Alex Quick
dfa241d6a9 [dockerfile] test new config stuff 2017-09-27 23:56:40 -04:00
Alex Quick
dd8e1fdf45 [config] no longer reenter dokku in config/functions 2017-09-27 23:56:40 -04:00
Alex Quick
21b091ab14 [config] update test-deploy-config to include odd characters 2017-09-27 23:56:40 -04:00
Alex Quick
416b499670 [nginx-proxy] remove trailing spaces from PROXY_PORT_MAP
this plugin used to rely on the fact that config
supressed trailing spaces
2017-09-27 23:56:39 -04:00
Alex Quick
dc90a889d7 [config] add config:set --encoded (base64)
You can now set b64encoded values. They are
stored decoded, this is so dokku over ssh can set
odd config values
```
config:set --encoded KEY=BASE_64_VALUE
```
2017-09-27 23:56:39 -04:00
Alex Quick
14757ca925 [config] change file format to match bash exports
got rid of nonstandard escaping/quoting so that
the disk file is a strict subset of valid bash exports
2017-09-27 23:56:39 -04:00
Alex Quick
7d865ccb1f [config] refactor makefile 2017-09-27 23:56:39 -04:00
Alex Quick
294d4b1f29 [config] first cut of config rewritten in golang
still to do:
* Rework disk format to be okay with quotes
* Fix Dockerfile deployments
* Dedup code in the subcommands
* Add --encode
* Add deploytests for the new stuff
* Restore some log messages (should I make some helpers in common?)
* Restore some functions that may be used by 3d-party plugins
2017-09-27 23:56:39 -04:00
Alex Quick
5e3184b61d [common] helper for go trigger plugn events 2017-09-27 23:56:39 -04:00
Alex Quick
e57e1408b2 [common] add NewTokenizedShellCmd to ShellCmd 2017-09-27 23:56:39 -04:00
Alex Quick
ef95d2bcd4 [config] test some config oddities 2017-09-27 23:56:39 -04:00
Jose Diaz-Gonzalez
d8602c52af Merge pull request #2919 from wootwoot1234/patch-1
Update nginx.md
2017-09-27 23:14:38 -04:00
Jose Diaz-Gonzalez
657bb1d2a1 docs: clarify Procfile/nginx.conf usage
[ci skip]
2017-09-27 23:14:23 -04:00
Tom
0bd6b041c8 Update nginx.md
Added an explanation of how to add additional nginx configuration to the `nginx.conf` file imported in a Procfile. Here's a related issue: https://github.com/dokku/dokku/issues/2917#issuecomment-332704867
2017-09-27 21:50:14 -05:00
Jose Diaz-Gonzalez
28077dff67 Merge pull request #2913 from znz/fix-typo
Fix a typo [ci skip]
2017-09-26 12:51:24 -04:00
Kazuhiro NISHIYAMA
68917f12fb Fix a typo [ci skip] 2017-09-26 20:55:15 +09:00
Jose Diaz-Gonzalez
bb1b657ac9 Merge pull request #2912 from dokku/josegonzalez-patch-1
fix: add depends statement for rsyslog
2017-09-25 14:55:37 -04:00
Jose Diaz-Gonzalez
07c83d4d32 fix: add depends statement for rsyslog
Refs #2911
2017-09-25 13:43:07 -04:00
Jose Diaz-Gonzalez
264109360b Merge pull request #2910 from buckle2000/master
Mention full git URL
2017-09-23 02:58:34 -04:00
Jose Diaz-Gonzalez
2278290b91 docs: reword note.
[ci skip]
2017-09-23 02:58:25 -04:00
buckle2000
23bcb4127a Update application-deployment.md
Well, please add a yellow "warning" background to the added backquote.
2017-09-23 14:53:35 +08:00
Jose Diaz-Gonzalez
8004f0962c Merge pull request #2906 from manuel-colmenero/master
fix: Check the location of nginx in a central way
2017-09-19 13:53:21 -04:00
Jose Diaz-Gonzalez
689f0443f3 chore: remove unnecessary dokku_log_fail
[ci skip]
2017-09-19 13:53:00 -04:00
Manuel Colmenero
441e864ea1 fix: Declare and assign separately to avoid masking return values
Fixes the introduced CI warnings.
2017-09-19 19:14:48 +02:00
Manuel Colmenero
4f17392bf1 fix: Move operator inside the brackets 2017-09-19 08:27:21 +02:00
Manuel Colmenero
deace7a03a fix: Remove unnecessary nesting 2017-09-19 08:26:55 +02:00
Manuel Colmenero
c49f81cd8b fix: Check first in $PATH for nginx, use sbin location as backup 2017-09-18 21:19:30 +02:00
Manuel Colmenero
bada02a122 Use double brackets instead of single ones 2017-09-18 21:09:03 +02:00
Manuel Colmenero
3d785360e1 fix: Check the location of nginx in a central way
- Now there's only a "single source of truth" for the location of the nginx
  binary.
- It is checked if it's there before it's needed.
2017-09-18 20:19:27 +02:00
Jose Diaz-Gonzalez
3a81c8f279 Merge pull request #2895 from dokku/2864-git-rebuild-in-dir
fix: Change to app directory when calling git worktree add
2017-09-02 14:33:08 -04:00
Jose Diaz-Gonzalez
9f64fdb9b6 fix: Change to app directory when calling git worktree add
Closes #2864
2017-09-02 14:10:47 -04:00
Jose Diaz-Gonzalez
e9873c58a8 Release 0.10.4
# History

## 0.10.4

### Bug Fixes

- #2894: @josegonzalez fix: bail if any step in the release process fails
- #2880: @josegonzalez fix: properly detect empty subcommands
- #2881: @josegonzalez Verify app name on git push
- #2858: @cstroe Use correct port number for the upstream.
- #2848: @josegonzalez Ensure https applications return an https url from `dokku url`
- #2839: @josegonzalez fix: skip clearing cache if we are not building a herokuish image

### New Features

- #2890: @michaelshobbs use circleci 2.0
- #2847: @scjody Add nginx ppa before installing Dokku
- #2850: @michaelshobbs add optional PROC_TYPE and CONTAINER_INDEX to docker-args-deploy plugn trigger
- #2840: @josegonzalez Add DYNO environment variable to run containers
- #2824: @josegonzalez Upgrade herokuish to version 0.3.31

### Documentation

- #2861: @adelq Use non-deprecated apps command
- #2878: @m0rth1um Add telegram notifications plugin
- #2876: @josegonzalez docs: clarify storage documentation caveats
- #2873: @josegonzalez docs: add a note on which docs to look at for customizing nginx docs
- #2867: @josegonzalez docs: cleanup help output for dokku shell
- #2859: @josegonzalez docs: use relative link for application deployment doc
- #2866: @josegonzalez Add missing migration guides
- #2863: @josegonzalez docs: fix syntax on getting started docs
- #2836: @fishnux Add a note regarding nginx dependency to installation docs
- #2834: @iansu Clarify port exposure in Dockerfile documentation
2017-09-02 13:15:23 -04:00
Jose Diaz-Gonzalez
a4a3bfc556 Merge pull request #2894 from dokku/release-error-catching
fix: bail if any step in the release process fails
2017-09-02 02:44:41 -04:00
Jose Diaz-Gonzalez
235115af9c Merge pull request #2880 from dokku/2849-empty-subcommand
fix: properly detect empty subcommands
2017-09-02 02:44:30 -04:00
Jose Diaz-Gonzalez
aa82042db2 fix: bail if any step in the release process fails 2017-09-01 23:51:15 -04:00
Jose Diaz-Gonzalez
e8f1ce501a fix: check that subcommand is non-zero in length 2017-09-01 23:43:58 -04:00
Jose Diaz-Gonzalez
a4f4bef1f6 fix: remove syntax error 2017-09-01 23:16:10 -04:00
Jose Diaz-Gonzalez
6aa315f815 fix: properly detect empty subcommands
Closes #2849
2017-09-01 23:16:10 -04:00
Jose Diaz-Gonzalez
15494d85a9 Merge pull request #2881 from dokku/2807-bad-app-name
Verify app name on git push
2017-09-01 11:59:49 -04:00
Michael Hobbs
787e2f106a Merge pull request #2890 from dokku/mh/chore/circle-2.0-machine-exec
use circleci 2.0
2017-08-29 13:53:21 -07:00
Michael Hobbs
4db991c891 use circleci 2.0 2017-08-29 13:12:03 -07:00
Jose Diaz-Gonzalez
ab11453fc8 feat: validate app name when running git functions 2017-08-19 19:16:40 -04:00
Jose Diaz-Gonzalez
1a5bea6dde refactor: extract app name validation 2017-08-19 19:16:16 -04:00
Jose Diaz-Gonzalez
5e0ea9c734 Merge pull request #2858 from cstroe/issue-2857-nginx-conf-with-multiple-expose-ports
Use correct port number for the upstream.
2017-08-19 19:08:13 -04:00
Jose Diaz-Gonzalez
68e628d384 Merge pull request #2861 from adelq/patch-1
Use non-deprecated apps command
2017-08-19 19:05:29 -04:00
Jose Diaz-Gonzalez
0babde74f3 docs: update uninstallation docs to clarify which subcommand to use for listing applications
[ci skip]
2017-08-19 19:03:20 -04:00
Jose Diaz-Gonzalez
42cee30187 Merge pull request #2878 from m0rth1um/patch-1
Add telegram notifications plugin
2017-08-19 18:31:36 -04:00
Moritz Mackiewicz
c50f1c8830 Update plugins.md 2017-08-19 19:01:41 +02:00
Jose Diaz-Gonzalez
1db9e16006 Merge pull request #2876 from dokku/josegonzalez-patch-1
docs: clarify storage documentation caveats
2017-08-17 15:05:49 -04:00
Jose Diaz-Gonzalez
3bf3bb433b docs: clarify user/group id
[ci skip]
2017-08-17 14:43:56 -04:00
Jose Diaz-Gonzalez
fa0b4b26ac docs: clarify storage documentation caveats
[ci skip]
2017-08-17 14:36:23 -04:00
Jose Diaz-Gonzalez
ec9f81b323 Merge pull request #2873 from dokku/jdg-customization-notes
docs: add a note on which docs to look at for customizing nginx docs
2017-08-15 11:26:08 -04:00
Jose Diaz-Gonzalez
c400bc8f03 docs: add a note on which docs to look at for customizing nginx docs
[ci skip]
2017-08-15 11:25:50 -04:00
Dmitry
fc2fb71396 docs: fix vertical scroll for the slack-channel section (#2869) 2017-08-14 06:36:55 -05:00
Jose Diaz-Gonzalez
e8287b839f Merge pull request #2867 from dokku/josegonzalez-patch-1
docs: cleanup help output for dokku shell
2017-08-10 17:30:00 -04:00
Jose Diaz-Gonzalez
fcd713b23c docs: cleanup help output for dokku shell
[ci skip]
2017-08-10 17:28:47 -04:00
Jose Diaz-Gonzalez
294f82c327 Merge pull request #2859 from dokku/josegonzalez-patch-1
docs: use relative link for application deployment doc
2017-08-09 17:25:57 -04:00
Jose Diaz-Gonzalez
0cc8ee6669 Merge pull request #2866 from dokku/josegonzalez-patch-2
Add missing migration guides
2017-08-09 17:25:46 -04:00
Jose Diaz-Gonzalez
e7a2284226 Create 0.10.0-migration-guide.md
[ci skip]
2017-08-09 17:23:51 -04:00
Jose Diaz-Gonzalez
64162a0bfd Create 0.9.0-migration-guide.md 2017-08-09 17:19:53 -04:00
Jose Diaz-Gonzalez
c2f92e07d9 Create 0.8.0-migration-guide.md 2017-08-09 17:15:30 -04:00
Jose Diaz-Gonzalez
29e44260a0 docs: add links to migration guides
[ci skip]
2017-08-09 17:07:06 -04:00
Jose Diaz-Gonzalez
e2bebe078a Merge pull request #2863 from dokku/josegonzalez-patch-2
docs: fix syntax on getting started docs
2017-08-08 01:10:18 -04:00
Jose Diaz-Gonzalez
d025a00d18 docs: fix syntax on getting started docs
[ci skip]
2017-08-08 01:09:49 -04:00
Adel Qalieh
db0b2bc93e Use non-deprecated apps command 2017-08-04 14:48:07 -04:00
Cosmin Stroe
0b2bea3fa9 Use upstream port in nginx.conf template 2017-08-04 12:26:35 -05:00
Cosmin Stroe
9156dea8b7 Revert "Fix upstream ports configuration."
This reverts commit 1f93169c43.
2017-08-04 12:20:35 -05:00
Cosmin Stroe
1f93169c43 Fix upstream ports configuration. 2017-08-04 02:21:31 -05:00
Cosmin Stroe
65990068cb Revert "Use correct port number for the upstream."
This reverts commit 52b45d74cb.
2017-08-04 00:24:12 -05:00
Jose Diaz-Gonzalez
4008919a3c docs: use relative link for application deployment doc
[ci skip]
2017-08-04 00:54:51 -04:00
Cosmin Stroe
52b45d74cb Use correct port number for the upstream. 2017-08-03 22:24:14 -05:00
Jose Diaz-Gonzalez
ee27ea76a6 Merge pull request #2847 from plotly/add-ppa-before-apt
Add nginx ppa before installing Dokku
2017-07-30 14:09:52 -04:00
Josh Manders
a85159425b Merge branch 'master' into add-ppa-before-apt 2017-07-26 22:19:25 -05:00
Michael Hobbs
ab69be6665 Merge pull request #2850 from dokku/mh/chore/optional-docker-args-deploy
add optional PROC_TYPE and CONTAINER_INDEX to docker-args-deploy plugn trigger
2017-07-26 10:36:02 -07:00
Michael Hobbs
68ca119ae0 add syslog plugin 2017-07-26 10:35:41 -07:00
Michael Hobbs
a0e05eaef0 add optional PROC_TYPE and CONTAINER_INDEX to docker-args-deploy plugn trigger 2017-07-26 09:04:14 -07:00
Jody McIntyre
34d80a18dc Merge branch 'master' into add-ppa-before-apt 2017-07-24 11:46:53 -04:00
Jose Diaz-Gonzalez
1a38b5533d Merge pull request #2848 from dokku/fix_app_url_with_https
Ensure https applications return an https url from `dokku url`
2017-07-23 14:34:17 -06:00
Jose Diaz-Gonzalez
7df06fb2f6 fix: ensure tests pass 2017-07-22 15:17:40 -06:00
Domonkos Czinke
0efb690992 Fix URL error and add test 2017-07-22 15:15:54 -06:00
Domonkos Czinke
5af42dc678 url command should return https if it's configured 2017-07-22 15:15:54 -06:00
Jose Diaz-Gonzalez
2b929a98e7 Merge pull request #2839 from dokku/2771-dockerfile-cache
fix: skip clearing cache if we are not building a herokuish image
2017-07-22 15:07:35 -06:00
Josh Manders
9aa3721aa3 Merge branch 'master' into add-ppa-before-apt 2017-07-22 13:11:22 -05:00
Jose Diaz-Gonzalez
5ee257304a Merge pull request #2840 from dokku/2837-dyno-run-env-var
Add DYNO environment variable to run containers
2017-07-21 13:49:15 -06:00
Jody McIntyre
4497a54b12 Add nginx ppa before installing Dokku
Fixes #2845
2017-07-21 15:41:33 -04:00
Jose Diaz-Gonzalez
13ff7f7b96 feat: add DYNO environment variable to run containers. Closes #2837 2017-07-17 03:53:42 -06:00
Jose Diaz-Gonzalez
0147d55302 fix: skip clearing cache if we are not building a herokuish image
Closes #2771
2017-07-17 00:30:35 -06:00
Josh Manders
2169fb3859 Merge pull request #2836 from fishnux/patch-1
Added a note on documentation (issue #2835)
2017-07-13 10:37:35 -05:00
fishnux
8f9e23a59d Reworded some bits on installation.md 2017-07-13 12:24:32 +01:00
fishnux
9735f73c38 Clarified nginx installation issue 2017-07-13 12:20:35 +01:00
fishnux
a8d60e13e1 Added a note on documentation (issue #2835)
Added a small note that points to issue #2835, since some Linux distros appear to install an old nginx version by default
2017-07-12 23:00:20 +01:00
Jose Diaz-Gonzalez
b843716113 Merge pull request #2834 from iansu/patch-1
Update dockerfiles.md
2017-07-10 15:26:03 -06:00
Jose Diaz-Gonzalez
f442e6fabf docs: clarify port exposing
[ci skip]
2017-07-10 15:24:35 -06:00
Ian Sutherland
e8e6660b2a Update dockerfiles.md
Added a note about port ordering in Dockerfile.
2017-07-10 14:32:12 -06:00
Jose Diaz-Gonzalez
6dd4e61e04 Merge pull request #2824 from dokku/josegonzalez-patch-1
Upgrade herokuish to version 0.3.31
2017-07-09 14:28:21 -06:00
Jose Diaz-Gonzalez
0bdc6e443e feat: Upgrade herokuish to version 0.3.31 2017-07-02 23:21:27 -06:00
239 changed files with 8253 additions and 887 deletions

28
.circleci/config.yml Normal file
View File

@@ -0,0 +1,28 @@
version: 2
jobs:
build:
machine: true
parallelism: 4
steps:
- checkout
- run: |
make ci-dependencies
- run: |
./tests/ci/setup.sh
- run: |
echo 'export DOKKU_SKIP_CLEANUP=true' | sudo tee /home/dokku/.dokkurc/dokku_skip_cleanup
- run: |
# dokku.me now resolves to 10.0.0.2. add 10.0.0.2/24 to eth0
sudo ip a a 10.0.0.2/24 broadcast 10.0.0.255 dev eth0
- run: |
case $CIRCLE_NODE_INDEX in
0) sudo -E make -e lint ;;
1) sudo -E make -e go-tests ci-go-coverage;;
2) sudo -E make -e deploy-test-checks-root deploy-test-config deploy-test-multi deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy ;;
esac
- run:
shell: /bin/bash
command: sudo -E make -e test-ci
no_output_timeout: 60m
- store_artifacts:
path: ./coverage.out

5
.codacy.yml Normal file
View File

@@ -0,0 +1,5 @@
exclude_paths:
- vendor/**/*
- tests/**/*
- "**_test.go"
- contrib/*

View File

@@ -17,5 +17,5 @@ indent_size = 4
[*.go]
insert_final_newline = true
indent_style = space
indent_style = tab
indent_size = 4

2
.gitignore vendored
View File

@@ -2,7 +2,9 @@
*.rpm
.DS_Store
.ruby-version
.idea/
.vagrant
data/
stack.tgz
tmp
coverage.out

View File

@@ -7,3 +7,4 @@ linters:
files:
ignore:
- './debian/*'
- '*/vendor/*'

View File

@@ -1,5 +1,124 @@
# History
## 0.11.2
### Bug Fixes
- #3014: @josegonzalez fix: handle case where DOKKU_DOCKERFILE_PORTS is an empty string
- #3013: @alexquick Fix some issues with config/network/repo help output
- #3012: @alexquick Fail when setting/unsetting invalid keys
- #3011: @alexquick Forward output from plugn triggers to user
- #3004: @josegonzalez Return/Exit 1 when an image being deployed is invalid
### Documentation
- #3015: @elia Tiny fixes to triggers documentation
## 0.11.1
### Bug Fixes
- #3010: @josegonzalez fix: route config_all to the `config` command to fix datastore plugin usage
- #3009: @josegonzalez fix: correct the guard around the config_export call in config_sub
- #3006: @josegonzalez fix: do not allow shadowing of the CACHE_DIR variable
- #3005: @josegonzalez fix: persist users in the dokku group through installations
- #3003: @josegonzalez Fix issues in apps:clone calls
- #3001: @josegonzalez fix: allow applications to begin with numeric values
### New Features
- #3002: @josegonzalez fix: omit redirection of docker build output
- #3000: @josegonzalez fix: remove golang files and triggers directory for packaging
## 0.11.0
### Bug Fixes
- #2998: @josegonzalez Fix issues in release process
- #2993: @josegonzalez Add config_all alias for plugin usage
- #2972: @buckle2000 Correct typo in docker-options:remove error output
- #2964: @znz Remove unused variable
- #2967: @znz Fix indentation in test file
- #2963: @znz Correct typos in config plugin and remove potential infinite recursion issue
- #2951: @josegonzalez Handle case where the app directory is a symlink
- #2939: @znz Remove unnecessary lines
- #2945: @znz Fix network plugin version
- #2937: @michaelshobbs Strip restart flag from app_user_pre_deploy_trigger
- #2931: @josegonzalez Upgrade git package for CI
- #2928: @silverfix Do not overwrite the VHOST file during installation if it exists
- #2926: @vtavernier Remove leading forward slash from app name in git-upload-pack
### New Features
- #2985: @bitmand Build a custom dhparam file once for nginx and include it as default
- #2974: @josegonzalez Upgrade to herokuish 0.3.33
- #2973: @josegonzalez Allow usage of git 2.13.0+ by unsetting GIT_QUARANTINE_PATH during git worktree usage
- #2971: @miraculixx Add support for older virtualbox versions in official Dokku Vagrantfile
- #2966: @znz Simplify internal config functions to reduce duplication
- #2751: @alexquick Move config plugin to golang
- #2938: @michaelshobbs Upgrade to golang 1.9.1
- #2736: @josegonzalez Implement Network Plugin
- #2929: @michaelshobbs Add codacy config and coverage targets
### Documentation
- #2935: @jcrben Document how to make herokuish optional during the bootstrap installation
- #2982: @agorf Correct typo in user management docs
- #2981: @agorf Correct typos in process management docs
- #2969: @znz Correct comments on network triggers
- #2965: @znz Remove spaces from config subcommand help output to mirror help output of other subcommands
- #2954: @mrname Add vernemq community datastore plugin to docs
- #2944: @axilleas Fix syntax typo in debian installation docs
- #2932: @znz Update code comment to match documentation
- #2933: @znz Fix version number for network binding documentation
## 0.10.5
### Bug Fixes
- #2912: @josegonzalez Add missing depends statement for rsyslog
- #2906: @manuel-colmenero Check the location of nginx in a central way
- #2895: @josegonzalez cd to app directory when calling git worktree add
### Documentation
- #2922: @axilleas Clarify the minimum Nginx version for HTTP/2 support
- #2919: @wootwoot1234 Update nginx documentation surrounding file uploading for php buildpack users
- #2913: @znz Fix a typo in the rpm release script
- #2910: @buckle2000 Add a note about using the full git url for non-compliant toolchains
## 0.10.4
### Bug Fixes
- #2894: @josegonzalez fix: bail if any step in the release process fails
- #2880: @josegonzalez fix: properly detect empty subcommands
- #2881: @josegonzalez Verify app name on git push
- #2858: @cstroe Use correct port number for the upstream.
- #2848: @josegonzalez Ensure https applications return an https url from `dokku url`
- #2839: @josegonzalez fix: skip clearing cache if we are not building a herokuish image
### New Features
- #2890: @michaelshobbs use circleci 2.0
- #2847: @scjody Add nginx ppa before installing Dokku
- #2850: @michaelshobbs add optional PROC_TYPE and CONTAINER_INDEX to docker-args-deploy plugn trigger
- #2840: @josegonzalez Add DYNO environment variable to run containers
- #2824: @josegonzalez Upgrade herokuish to version 0.3.31
### Documentation
- #2861: @adelq Use non-deprecated apps command
- #2878: @m0rth1um Add telegram notifications plugin
- #2876: @josegonzalez docs: clarify storage documentation caveats
- #2873: @josegonzalez docs: add a note on which docs to look at for customizing nginx docs
- #2867: @josegonzalez docs: cleanup help output for dokku shell
- #2859: @josegonzalez docs: use relative link for application deployment doc
- #2866: @josegonzalez Add missing migration guides
- #2863: @josegonzalez docs: fix syntax on getting started docs
- #2836: @fishnux Add a note regarding nginx dependency to installation docs
- #2834: @iansu Clarify port exposure in Dockerfile documentation
## 0.10.3
### Bug Fixes

View File

@@ -1,6 +1,6 @@
DOKKU_VERSION ?= master
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v0.6.0/sshcommand
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v0.7.0/sshcommand
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v0.3.0/plugn_0.3.0_linux_x86_64.tgz
SIGIL_URL ?= https://github.com/gliderlabs/sigil/releases/download/v0.4.0/sigil_0.4.0_Linux_x86_64.tgz
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
@@ -116,7 +116,7 @@ dependencies: apt-update sshcommand plugn docker help2man man-db sigil
$(MAKE) -e stack
apt-update:
apt-get update
apt-get update -qq
help2man:
apt-get install -qq -y help2man

View File

@@ -99,8 +99,8 @@ A fresh VM running any of the following operating systems:
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.10.3/bootstrap.sh
sudo DOKKU_TAG=v0.10.3 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.11.2/bootstrap.sh
sudo DOKKU_TAG=v0.11.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.

2
Vagrantfile vendored
View File

@@ -45,6 +45,8 @@ Vagrant::configure("2") do |config|
vm.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
# enable NAT adapter cable https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838999
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}"

View File

@@ -122,6 +122,11 @@ install-dokku-from-deb-package() {
fi
wget -nv -O - https://get.docker.com/ | sh
if [[ "$DOKKU_DISTRO_VERSION" == "14.04" ]]; then
echo "--> Adding nginx PPA"
add-apt-repository -y ppa:nginx/stable
fi
echo "--> Installing dokku"
wget -nv -O - https://packagecloud.io/gpg.key | apt-key add -
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" | tee /etc/apt/sources.list.d/dokku.list

View File

@@ -1,20 +0,0 @@
machine:
pre:
- echo 'DOCKER_OPTS="-s btrfs -e lxc --userland-proxy=false"' | sudo tee -a /etc/default/docker
- sudo curl -L -o /usr/bin/docker 'https://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.1-circleci-cp-workaround'
- sudo chmod 0755 /usr/bin/docker
services:
- docker
dependencies:
cache_directories:
- "~/docker"
override:
- ./tests/ci/parallel_runner.sh setup: { timeout: 300 }
- echo "export DOKKU_SKIP_CLEANUP=true" > /home/dokku/.dokkurc/dokku_skip_cleanup
# dokku.me now resolves to 10.0.0.2. add 10.0.0.2/24 to eth0
- sudo ip a a 10.0.0.2/24 broadcast 10.0.0.255 dev eth0
post:
- sudo -E make -e lint
test:
override:
- ./tests/ci/parallel_runner.sh testing: { parallel: true, timeout: 3600 }

View File

@@ -1,4 +1,4 @@
GO_REPO_ROOT := /go/src/github.com/dokku/dokku
BUILD_IMAGE := golang:1.7.5
BUILD_IMAGE := golang:1.9.1
.PHONY: build-in-docker build clean src-clean

View File

@@ -2,14 +2,14 @@ FROM ubuntu:14.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y install gcc git build-essential wget ruby-dev ruby1.9.1 lintian rpm help2man man-db
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 GOLANG_VERSION
RUN wget -qO /tmp/go${GOLANG_VERSION}.linux-amd64.tar.gz https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf /tmp/go${GOLANG_VERSION}.linux-amd64.tar.gz
&& tar -C /usr/local -xzf /tmp/go${GOLANG_VERSION}.linux-amd64.tar.gz \
&& cp /usr/local/go/bin/* /usr/local/bin
ARG WORKDIR=/go/src/github.com/dokku/dokku
@@ -27,8 +27,9 @@ ARG DOKKU_VERSION=master
ARG DOKKU_GIT_REV
ARG IS_RELEASE=false
RUN PATH=$PATH:/usr/local/go/bin GOPATH=/go \
PLUGIN_MAKE_TARGET=${PLUGIN_MAKE_TARGET} \
ENV GOPATH=/go
RUN PLUGIN_MAKE_TARGET=${PLUGIN_MAKE_TARGET} \
DOKKU_VERSION=${DOKKU_VERSION} \
DOKKU_GIT_REV=${DOKKU_GIT_REV} \
IS_RELEASE=${IS_RELEASE} \

View File

@@ -10,7 +10,7 @@ import subprocess
import sys
import threading
VERSION = 'v0.10.3'
VERSION = 'v0.11.2'
hostname = ''
try:

View File

@@ -51,6 +51,7 @@ fn-build-dokku() {
--build-arg GOLANG_VERSION="$GOLANG_VERSION" \
-f "contrib/build.Dockerfile" \
-t "$NAME" .
return "$?"
}
fn-extract-package() {
@@ -68,6 +69,7 @@ fn-extract-package() {
log-info "(extract-package) writing ${PACKAGE_NAME} to correct path"
docker run --rm --entrypoint cat "$NAME" "/data/${PACKAGE_NAME}" > "${ROOT_DIR}/${PACKAGE_NAME}"
return "$?"
}
fn-in-array() {
@@ -133,6 +135,7 @@ fn-publish-package() {
[[ "$RELEASE_TYPE" == "rpm" ]] && DIST=el/7
log-info "(release-dokku) pushing ${RELEASE_TYPE} to packagecloud.com/${REPOSITORY}/${DIST}"
package_cloud push "${REPOSITORY}/${DIST}" "$PACKAGE_NAME"
return "$?"
}
fn-replace-version() {
@@ -300,12 +303,19 @@ main() {
fn-repo-update "$IS_RELEASE" "$CURRENT_VERSION" "$NEXT_VERSION"
fn-build-dokku "$IS_RELEASE" "$NEXT_VERSION"
[[ "$?" == 0 ]] || log-fail "Error building package"
fn-extract-package "$IS_RELEASE" "dokku_${NEXT_VERSION}_amd64.deb"
[[ "$?" == 0 ]] || log-fail "Error extracting deb package"
fn-extract-package "$IS_RELEASE" "dokku-${NEXT_VERSION}-1.x86_64.rpm"
[[ "$?" == 0 ]] || log-fail "Error extracting rpm package"
fn-publish-package "$IS_RELEASE" "deb" "dokku_${NEXT_VERSION}_amd64.deb"
[[ "$?" == 0 ]] || log-fail "Error publishing deb package"
fn-publish-package "$IS_RELEASE" "rpm" "dokku-${NEXT_VERSION}-1.x86_64.rpm"
[[ "$?" == 0 ]] || log-fail "Error publishing rpm package"
fn-repo-push-tags "$IS_RELEASE"
}

4
deb.mk
View File

@@ -1,6 +1,6 @@
HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
HEROKUISH_REPO_NAME ?= gliderlabs/herokuish
HEROKUISH_VERSION ?= 0.3.29
HEROKUISH_VERSION ?= 0.3.33
HEROKUISH_ARCHITECTURE = amd64
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
@@ -90,7 +90,7 @@ deb-herokuish:
@echo 'if [[ ! -z $${http_proxy+x} ]]; then BUILDARGS="--build-arg http_proxy=$$http_proxy"; fi' >> /tmp/tmp/post-install
@echo 'if [[ ! -z $${https_proxy+x} ]]; then BUILDARGS="$$BUILDARGS --build-arg https_proxy=$$https_proxy"; fi' >> /tmp/tmp/post-install
@echo 'if [[ ! -z $${BUILDARGS+x} ]]; then echo Adding proxy settings to docker build: $$BUILDARGS; fi' >> /tmp/tmp/post-install
@echo 'sudo docker build --pull $$BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null' >> /tmp/tmp/post-install
@echo 'sudo docker build --pull $$BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish' >> /tmp/tmp/post-install
@echo "-> Cloning repository"
git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" --branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null

4
debian/control vendored
View File

@@ -1,9 +1,9 @@
Package: dokku
Version: 0.10.3
Version: 0.11.2
Section: web
Priority: optional
Architecture: amd64
Depends: locales, git, make, curl, gcc, man-db, netcat, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1) | docker-io (>= 1.9.1) | docker-ce | docker-ee, software-properties-common, python-software-properties | python3-software-properties
Depends: locales, git, make, curl, gcc, man-db, netcat, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1) | docker-io (>= 1.9.1) | docker-ce | docker-ee, software-properties-common, python-software-properties | python3-software-properties, rsyslog
Recommends: herokuish (>= 0.3.4), parallel
Pre-Depends: nginx (>= 1.8.0) | openresty, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.3.0), sudo, python2.7, debconf
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>

View File

@@ -3,3 +3,10 @@ dokku: maintainer-script-calls-systemctl postinst:87
dokku: changelog-file-missing-in-native-package
dokku: statically-linked-binary
dokku: unstripped-binary-or-object
# The Go compiler is currently unable to produce read-only relocations
# (it produces static binaries).
dokku: hardening-no-relro
# Built golang binaries link to libc
dokku: missing-dependency-on-libc

13
debian/postinst vendored
View File

@@ -100,12 +100,15 @@ case "$1" in
exit 0
fi
db_get "dokku/vhost_enable"
if [ "$RET" = "true" ]; then
db_get "dokku/hostname"
echo "$RET" > "${DOKKU_ROOT}/VHOST"
if [ -f "${DOKKU_ROOT}/VHOST" ]; then
echo "VHOST file detected, skipping modification"
else
rm -f "${DOKKU_ROOT}/VHOST"
db_get "dokku/vhost_enable"
if [ "$RET" = "true" ]; then
db_get "dokku/hostname"
echo "Setting VHOST contents to $RET"
echo "$RET" > "${DOKKU_ROOT}/VHOST"
fi
fi
db_get "dokku/hostname"

View File

@@ -14,9 +14,19 @@ storage:unmount <app> <host-dir:container-dir> # Remove an existing bind mount
> The storage plugin is compatible with storage mounts created with the docker-options. The storage plugin will only list mounts from the deploy/run phase.
## Ideology and Background
The storage plugin supports the following mount points:
The storage plugin requires explicit paths on the host side. This is intentional to ensure that new users avoid running into unexpected results with implicit paths that may not exist (a feature deprecated in [Docker 1.9.0](https://github.com/docker/docker/releases/tag/v1.9.0])). The container directory is created for the mount point in the container. Any existing directory contents are not accessible after a mount is added to the container. Dokku creates a new directory `/var/lib/dokku/data/storage` during installation, it's the general consensus that new users should use this directory. Mounts are only available at run and deploy times, you must redeploy (restart) an app to mount or unmount to an existing app's container.
- explicit paths that exist on the host
- docker volumes
There are a few caveats to using the persistent storage plugin:
- Using implicit paths that do not exist are no longer supported, and actually deprecated in [Docker 1.9.0](https://github.com/docker/docker/releases/tag/v1.9.0). When you specify a persistent storage mount, the host directory is **not** autocreated by either Dokku or Docker.
- We recommend using the directory `/var/lib/dokku/data/storage` directory as the root host path for mounts, and we create this on Dokku installation.
- Mounts are only available at run and deploy times, and you **must** redeploy (restart) an app to mount or unmount to an existing app's container.
- When a directory is mounted, any existing files within the container will be overwritten. If you are writing assets during the build process and then replace the directory with a mount, those files will no longer exist. This is a Docker limitation.
- Paths are mounted within the container at the root of the disk - `/` - and are **not** relative to `/app` (for buildpacks deploys) or the `WORKDIR` (for Dockerfile/Docker images).
- For applications using buildpack deploys, the host directory should be owned by the user and group id `32767`. This is due to how permissions within Herokuish - which builds the Docker images - works. For Dockerfile or Docker image deployments, please use the user and group id which corresponds to the one running the process within the container.
## Usage
@@ -45,7 +55,8 @@ mkdir -p /var/lib/dokku/data/storage/node-js-app
# ensure the proper user has access to this directory
chown -R dokku:dokku /var/lib/dokku/data/storage/node-js-app
# as of 0.7.x, you should chown using the `32767` user and group id
# as of 0.7.x, you should chown using the `32767` user and group id for buildpack deploys
# For dockerfile deploys, substitute the user and group id in use within the image
chown -R 32767:32767 /var/lib/dokku/data/storage/node-js-app
# mount the directory into your container's /app/storage directory, relative to root

View File

@@ -31,30 +31,30 @@ dokku plugin
```
plugn: dev
00_dokku-standard 0.10.3 enabled dokku core standard plugin
20_events 0.10.3 enabled dokku core events logging plugin
apps 0.10.3 enabled dokku core apps plugin
build-env 0.10.3 enabled dokku core build-env plugin
certs 0.10.3 enabled dokku core certificate management plugin
checks 0.10.3 enabled dokku core checks plugin
common 0.10.3 enabled dokku core common plugin
config 0.10.3 enabled dokku core config plugin
docker-options 0.10.3 enabled dokku core docker-options plugin
domains 0.10.3 enabled dokku core domains plugin
enter 0.10.3 enabled dokku core enter plugin
git 0.10.3 enabled dokku core git plugin
logs 0.10.3 enabled dokku core logs plugin
named-containers 0.10.3 enabled dokku core named containers plugin
nginx-vhosts 0.10.3 enabled dokku core nginx-vhosts plugin
plugin 0.10.3 enabled dokku core plugin plugin
proxy 0.10.3 enabled dokku core proxy plugin
ps 0.10.3 enabled dokku core ps plugin
repo 0.10.3 enabled dokku core repo plugin
shell 0.10.3 enabled dokku core shell plugin
ssh-keys 0.10.3 enabled dokku core ssh-keys plugin
storage 0.10.3 enabled dokku core storage plugin
tags 0.10.3 enabled dokku core tags plugin
tar 0.10.3 enabled dokku core tar plugin
00_dokku-standard 0.11.2 enabled dokku core standard plugin
20_events 0.11.2 enabled dokku core events logging plugin
apps 0.11.2 enabled dokku core apps plugin
build-env 0.11.2 enabled dokku core build-env plugin
certs 0.11.2 enabled dokku core certificate management plugin
checks 0.11.2 enabled dokku core checks plugin
common 0.11.2 enabled dokku core common plugin
config 0.11.2 enabled dokku core config plugin
docker-options 0.11.2 enabled dokku core docker-options plugin
domains 0.11.2 enabled dokku core domains plugin
enter 0.11.2 enabled dokku core enter plugin
git 0.11.2 enabled dokku core git plugin
logs 0.11.2 enabled dokku core logs plugin
named-containers 0.11.2 enabled dokku core named containers plugin
nginx-vhosts 0.11.2 enabled dokku core nginx-vhosts plugin
plugin 0.11.2 enabled dokku core plugin plugin
proxy 0.11.2 enabled dokku core proxy plugin
ps 0.11.2 enabled dokku core ps plugin
repo 0.11.2 enabled dokku core repo plugin
shell 0.11.2 enabled dokku core shell plugin
ssh-keys 0.11.2 enabled dokku core ssh-keys plugin
storage 0.11.2 enabled dokku core storage plugin
tags 0.11.2 enabled dokku core tags plugin
tar 0.11.2 enabled dokku core tar 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.

View File

@@ -0,0 +1,13 @@
# 0.10.0 Migration Guide
## PCI Compliance
By default, Dokku will ship a PCI Compliant nginx configuration. For developers whose users are on older browsers or mobile devices, you may need to ship a custom `nginx.conf.sigil` to enable ciphers for older browsers.
See the [nginx customization](/docs/configuration/nginx/#customizing-the-nginx-configuration) docs for more details.
## Nginx Error Pages
We now ship with nicer error pages by default. You are free to customize your Dokku installation via a custom `nginx.conf.sigil` to change what error pages are displayed in different circumstances.
See the [nginx customization](/docs/configuration/nginx/#customizing-the-nginx-configuration) docs for more details.

View File

@@ -0,0 +1,19 @@
# 0.8.0 Migration Guide
## Domain Management
You can now set global and app domains via `domains:set` and `domains:set-global`. See the [domains documentation](/docs/configuration/domains/) for more details.
## Plugin Uninstallation
A new `uninstall` plugin trigger was introduced. This functionality may be in use for newer plugins, so be aware that older Dokku versions may require manual cleanup.
See the [uninstall trigger documentation](/docs/development/plugin-triggers/#uninstall) for implementation instructions.
## Deployment Tasks
Should a pre or post deployment task fail, we now fail the entire deploy.
## Nginx HTTP2 Support
Due to bugs in Nginx, the minimum version for HTTP2 is now 1.11.5.

View File

@@ -0,0 +1,12 @@
# 0.9.0 Migration Guide
## Golang Migration
There is an ongoing migration to rewrite Dokku in Golang. The reasons are beyond the scope of this document, but this may impact any patches you have for Dokku. As of 0.9.0, only the `repo` plugin is in Golang.
The following shall remain true, regardless of the state of our rewrite:
- You will be able to write custom plugins in any language.
- You will be able to enable or disable core plugins.
- `plugn` will continue to be used for executing plugin triggers.
- We will provide bash wrappers that can be sourced to execute core functionality that is implemented in golang.

View File

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

View File

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

View File

@@ -35,13 +35,13 @@ h1 {
background-repeat: no-repeat;
}
.header .navbar-brand a {
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/dokku.png);
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/dokku.png);
text-indent: 40px;
}
.blurb {
color: #424242;
background-color: #ededed;
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/gplaypattern.png);
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/gplaypattern.png);
padding: 45px 0;
text-align: center;
}
@@ -169,7 +169,8 @@ h1 {
font-size: 16px;
font-weight: 300;
margin-bottom: 2.5em;
padding: 2.5em 0;
padding-top: 2.5em;
padding-bottom: 2.5em;
text-align: center
}
.slack-channel .inline-container {

View File

@@ -7,6 +7,7 @@
"0.7.2",
"0.8.2",
"0.9.4",
"0.10.3"
"0.10.5",
"0.11.2"
]
}

View File

@@ -89,6 +89,7 @@ Note: The following plugins have been supplied by our community and may not have
[Kloadut]: https://github.com/Kloadut
[krisrang]: https://github.com/krisrang
[luxifer]: https://github.com/luxifer
[m0rth1um]: https://github.com/m0rth1um
[Maciej Łebkowski]: https://github.com/mlebkowski
[matto1990]: https://github.com/matto1990
[mbreit]: https://github.com/mbreit
@@ -99,6 +100,7 @@ Note: The following plugins have been supplied by our community and may not have
[mixxorz]: https://github.com/mixxorz
[mlebkowski]: https://github.com/mlebkowski
[motin]: https://github.com/motin
[mrname]: https://github.com/mrname
[musicglue]: https://github.com/musicglue
[neam]: https://github.com/neam
[nickcharlton]: https://github.com/nickcharlton
@@ -151,6 +153,7 @@ Note: The following plugins have been supplied by our community and may not have
| [RabbitMQ](https://github.com/jlachowski/dokku-rabbitmq-plugin) | [jlachowski][] | 0.3.x |
| [RabbitMQ (single container)](https://github.com/jlachowski/dokku-rabbitmq-single-plugin) | [jlachowski][] | 0.3.x |
| [ElasticMQ (SQS compatible)](https://github.com/cu12/dokku-elasticmq) | [cu12][] | 0.5.0+ |
| [VerneMQ (MQTT Broker)](https://github.com/SpinifexGroup/dokku-vernemq) | [mrname][] | 0.4.0+ |
#### Other
@@ -215,6 +218,7 @@ Note: The following plugins have been supplied by our community and may not have
| [Docker auto persist volumes](https://github.com/Flink/dokku-docker-auto-volumes) | [Flink][] | 0.4.0+ |
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | 0.4.0+ |
| [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | 0.4.0+ |
| [Syslog](https://github.com/michaelshobbs/dokku-syslog) | [michaelshobbs][] | 0.10.4+ |
| [Long Timeout](https://github.com/investtools/dokku-long-timeout-plugin) | [investtools][] | 0.4.0+ |
| [Monit](https://github.com/cjblomqvist/dokku-monit) | [cjblomqvist][] | 0.3.x |
| [Monorepo](https://github.com/iamale/dokku-monorepo) | [iamale][] | 0.4.0+ |
@@ -222,6 +226,7 @@ Note: The following plugins have been supplied by our community and may not have
| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | 0.3.x |
| [Rollbar](https://github.com/iloveitaly/dokku-rollbar) | [iloveitaly][] | 0.5.0+ |
| [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | 0.4.0+ |
| [Telegram Notifications](https://github.com/m0rth1um/dokku-telegram) | [m0rth1um][] | 0.4.0+ |
| [Tor](https://github.com/michaelshobbs/dokku-tor) | [michaelshobbs][] | 0.4.0+ |
| [User ACL](https://github.com/dokku-community/dokku-acl) | [Maciej Łebkowski][] | 0.4.0+ |
| [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | 0.3.x |

View File

@@ -5,10 +5,11 @@ Typically an application will require some configuration to run properly. Dokku
The `config` plugin provides the following commands to manage your variables:
```
config (<app>|--global) Display all global or app-specific config vars
config:get (<app>|--global) KEY Display a global or app-specific config value
config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars
config:unset (<app>|--global) KEY1 [KEY2 ...] Unset one or more config vars
config (<app>|--global) Display all global or app-specific config vars
config:get (<app>|--global) KEY Display a global or app-specific config value
config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars
config:unset (<app>|--global) KEY1 [KEY2 ...] Unset one or more config vars
config:export [--format=FORMAT] [--merged] (<app>|--global) Export all global or app-specific configuration
```
The variables are available both at run time and during the application build/compilation step for buildpack-based deploys. For security reasons - and as per [docker recommendations](https://github.com/docker/docker/issues/13490) - Dockerfile-based deploys have variables available *only* during runtime, as noted in [this issue](https://github.com/dokku/dokku/issues/1860).
@@ -23,10 +24,15 @@ You can set multiple environment variables at once:
dokku config:set node-js-app ENV=prod COMPILE_ASSETS=1
```
When setting variables with whitespaces, you need to escape them:
> Note: Whitespace and special characters get tricky. If you are using dokku locally you don't need to do any special escaping. If you are using dokku over ssh you will need to backslash-escape spaces:
```shell
dokku config:set node-js-app KEY="VAL\ WITH\ SPACES"
```
Dokku can also read base64 encoded values. That's the easiest way to set a value with newlines or spaces. To set a value with newlines you need to base64 encode it first and pass the `--encoded` flag:
```shell
dokku config:set node-js-app KEY=\"VAL\ WITH\ SPACES\"
dokku config:set --encoded node-js-app KEY="$(base64 ~/.ssh/id_rsa)"
```
When setting or unsetting environment variables, you may wish to avoid an application restart. This is useful when developing plugins or when setting multiple environment variables in a scripted manner. To do so, use the `--no-restart` flag:
@@ -35,23 +41,24 @@ When setting or unsetting environment variables, you may wish to avoid an applic
dokku config:set --no-restart node-js-app ENV=prod
```
If you wish to have the variables output in an `eval`-compatible form, you can use the `--export` flag:
If you wish to have the variables output in an `eval`-compatible form, you can use the `config:export` command
```shell
dokku config node-js-app --export
dokku config:export node-js-app
# outputs variables in the form:
#
# export ENV='prod'
# export COMPILE_ASSETS='1'
# source in all the node-js-app app environment variables
eval $(dokku config node-js-app --export)
eval $(dokku config:export node-js-app)
```
You can also output the variables in a single-line for usage in command-line utilities with the `--shell` flag:
You can control the format of the exported variables with the `--format` flag.
`--format=shell` will output the variables in a single-line for usage in command-line utilities:
```shell
dokku config node-js-app --shell
dokku config:export --format shell node-js-app
# outputs variables in the form:
#

View File

@@ -177,8 +177,7 @@ upstream {{ $.APP }}-{{ $upstream_port }} {
{{ range $listeners := $.DOKKU_APP_LISTENERS | split " " }}
{{ $listener_list := $listeners | split ":" }}
{{ $listener_ip := index $listener_list 0 }}
{{ $listener_port := index $listener_list 1 }}
server {{ $listener_ip }}:{{ $listener_port }};{{ end }}
server {{ $listener_ip }}:{{ $upstream_port }};{{ end }}
}
{{ end }}
```
@@ -195,13 +194,27 @@ That means you can put additional configuration in separate files, for example t
```shell
mkdir /home/dokku/myapp/nginx.conf.d/
echo 'client_max_body_size 50M;' > /home/dokku/myapp/nginx.conf.d/upload.conf
echo 'client_max_body_size 50m;' > /home/dokku/myapp/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/myapp/nginx.conf.d/upload.conf
service nginx reload
```
The example above uses additional configuration files directly on the Dokku host. Unlike the `nginx.conf.sigil` file, these additional files will not be copied over from your application repo, and thus need to be placed in the `/home/dokku/myapp/nginx.conf.d/` directory manually.
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;
location / {
index index.php;
try_files $uri $uri/ /index.php$is_args$args;
}
Please adjust the `Procfile` and `nginx.conf` file as appropriate.
## Domains plugin
See the [domain configuration documentation](/docs/configuration/domains.md).

View File

@@ -117,6 +117,10 @@ The [HSTS header](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security)
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.
## HTTP/2 support
Certain versions of nginx have bugs that prevent [HTTP/2](https://nginx.org/en/docs/http/ngx_http_v2_module.html) from properly responding to all clients, thus causing applications to be unavailable. For HTTP/2 to be enabled in your applications' nginx configs, you need to have installed nginx 1.11.5 or higher. See [issue 2435](https://github.com/dokku/dokku/issues/2435) for more details.
## Running behind a load balancer
Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarded-Port` and `X-Forwarded-For`. These headers indicate the protocol of the original request (HTTP or HTTPS), the port number, and the IP address of the client making the request, respectively. The default configuration is for Nginx to set these headers.
@@ -162,4 +166,4 @@ This could result in security issue, for example, if your application looks at t
### SSL Port Exposure
When your app is served from port `80` then the `/home/dokku/APP/nginx.conf` file will automatically be updated to instruct nginx to respond to ssl on port 443 as a new cert is added. If your app uses a non-standard port (perhaps you have a dockerfile deploy exposing port `99999`) you may need to manually expose an ssl port via `dokku proxy:ports-add <APP> https:443:99999`.
When your app is served from port `80` then the `/home/dokku/APP/nginx.conf` file will automatically be updated to instruct nginx to respond to ssl on port 443 as a new cert is added. If your app uses a non-standard port (perhaps you have a dockerfile deploy exposing port `99999`) you may need to manually expose an ssl port via `dokku proxy:ports-add <APP> https:443:99999`.

View File

@@ -59,6 +59,10 @@ git remote add dokku dokku@dokku.me:ruby-rails-sample
git push dokku master
```
> Note: Some tools may not support the short-upstream syntax referenced above, and you may need to prefix
> the upstream with the scheme `ssh://` like so: `ssh://dokku@dokku.me:ruby-rails-sample`
> Please see the [Git](https://git-scm.com/docs/git-clone#_git_urls_a_id_urls_a) documentation for more details.
```
Counting objects: 231, done.
Delta compression using up to 8 threads.

View File

@@ -17,11 +17,11 @@ To use a dockerfile for deployment, commit a valid `Dockerfile` to the root of y
Dokku will extract all tcp ports exposed using the `EXPOSE` directive (one port per line) and setup nginx to proxy the same port numbers to listen publicly. If you would like to change the exposed port, you should do so within your `Dockerfile` and app.
> Note: Nginx does not support proxying UDP. UDP ports can be exposed by disabling the nginx proxy with `dokku proxy:disable myapp`
> Note: If ports are specified via `EXPOSE` in your `Dockerfile`, we will proxy requests to the first port specified. Your application must be configured to listen on that port.
If you do not explicitly `EXPOSE` a port in your `Dockerfile`, Dokku will configure the nginx proxy to listen on port 80 (and 443 for TLS) and forward traffic to your app listening on port 5000 inside the container. Just like buildpack apps, you can also use the `$PORT` environment variable in your app to maintain portability.
When ports are exposed through the default nginx proxy, they are proxied externally as HTTP ports. At this time, in no case do we proxy plain TCP or UDP ports. If you would like to investigate alternative proxy methods, please refer to our [proxy management documentation](/docs/advanced-usage/proxy-management.md).
When ports are exposed through the default nginx proxy, they are proxied externally as HTTP ports. At this time, in no case do we proxy plain TCP or UDP ports. Nginx does not support proxying UDP. UDP ports can be exposed by disabling the nginx proxy with `dokku proxy:disable myapp`. If you would like to investigate alternative proxy methods, please refer to our [proxy management documentation](/docs/advanced-usage/proxy-management.md).
## Build-time Configuration Variables

View File

@@ -93,7 +93,7 @@ dokku ps:scale node-js-app
### Stopping applications
Deployed applications can be stopped using the `ps:stop` command. This turns all running containers for an application, and will result in a `502 Bad Gateway` response for the default nginx proxy implementation.
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.
```shell
dokku ps:stop node-js-app
@@ -115,7 +115,7 @@ By default, Dokku will automatically restart containers that exit with a non-zer
### 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`
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

View File

@@ -46,7 +46,7 @@ dokku ssh-keys:add KEY_NAME path/to/id_rsa.pub
b7:76:27:4f:30:90:21:ae:d4:1e:70:20:35:3f:06:d6
```
`KEY_NAME` is the username prefer to use to refer to this particular key. Including the word `admin` in the name will grant the user privileges to add additional keys remotely.
`KEY_NAME` is the name you want to use to refer to this particular key. Including the word `admin` in the name will grant the user privileges to add additional keys remotely.
> `KEY_NAME` is a unique name which is used to identify public keys. Attempting to re-use a key name will result in an error. The ssh (git) user is *always* `dokku`, as this is the system user that the `dokku` binary uses to perform all it's actions.

View File

@@ -259,7 +259,7 @@ cache-bust-build-arg "$@"
- Description:
- Invoked by: `dokku deploy`
- Arguments: `$APP $IMAGE_TAG`
- Arguments: `$APP $IMAGE_TAG [$PROC_TYPE $CONTAINER_INDEX]`
- Example:
```shell
@@ -344,6 +344,141 @@ if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
fi
```
### `network-build-config`
- Description: Rebuilds network configuration
- Invoked by: `internally triggered by proxy-build-config within proxy implementations`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-compute-ports`
- Description: Computes the ports for a given app container
- Invoked by: `internally triggered by proxy-build-config within proxy implementations`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-config-exists`
- Description: Returns whether the network configuration for a given app exists
- Invoked by: `internally triggered by core-post-deploy within proxy implementations`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-get-ipaddr`
- Description: Return the ipaddr for a given app container
- Invoked by: `internally triggered by a deploy`
- Arguments: `$APP $PROC_TYPE $CONTAINER_ID`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-get-listeners`
- Description: Return the listeners (host:port combinations) for a given app container
- Invoked by: `internally triggered by a deploy`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-get-property`
- Description: Return the network value for an application's property
- Invoked by: `internally triggered by a deploy`
- Arguments: `$APP $KEY`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-get-port`
- Description: Return the port for a given app container
- Invoked by: `internally triggered by a deploy`
- Arguments: `$APP $PROC_TYPE $CONTAINER_ID $IS_HEROKUISH_CONTAINER`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-write-ipaddr`
- Description: Write the ipaddr for a given app index
- Invoked by: `internally triggered by a deploy`
- Arguments: `$APP $PROC_TYPE $CONTAINER_INDEX $IP_ADDRESS`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-write-port`
- Description: Write the port for a given app index
- Invoked by: `internally triggered by a deploy`
- Arguments: `$APP $PROC_TYPE $CONTAINER_INDEX $PORT`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `nginx-hostname`
- Description: Allows you to customize the hostname for a given application.
@@ -410,6 +545,40 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `post-certs-remove`
- Description: Allows you to run commands after a cert is removed
- Invoked by: `dokku certs:remove`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
### `post-certs-update`
- Description: Allows you to run commands after a cert is added/updated
- Invoked by: `dokku certs:add`, `dokku certs:update`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
### `post-create`
- Description: Can be used to run commands after an application is created.
@@ -763,10 +932,10 @@ APP="$1"; verify_app_name "$APP"
# TODO
```
### `post-certs-update`
### `proxy-build-config`
- Description: Allows you to run commands after a cert is added/updated
- Invoked by: `dokku certs:add`, `dokku certs:update`
- Description: Builds the proxy implementation configuration for a given app
- Invoked by: `internally triggered by ps:restore`
- Arguments: `$APP`
- Example:
@@ -774,16 +943,29 @@ APP="$1"; verify_app_name "$APP"
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
### `post-certs-remove`
### `proxy-enable`
- Description: Allows you to run commands after a cert is removed
- Invoked by: `dokku certs:remove`
- Description: Enables the configured proxy implementation for an app
- Invoked by: `internally triggered by ps:restore`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `proxy-disable`
- Description: Disables the configured proxy implementation for an app
- Invoked by: `internally triggered by ps:restore`
- Arguments: `$APP`
- Example:
@@ -791,8 +973,6 @@ APP="$1"; verify_app_name "$APP"
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; verify_app_name "$APP"
# TODO
```
@@ -833,7 +1013,7 @@ newrev=$2
APP=${refname/*\//}.$reference_app
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
REFERENCE_REPO="$DOKKU_ROOT/$reference_app
REFERENCE_REPO="$DOKKU_ROOT/$reference_app"
git clone --bare --shared --reference "$REFERENCE_REPO" "$REFERENCE_REPO" "$DOKKU_ROOT/$APP" > /dev/null
fi
plugn trigger receive-app $APP $newrev
@@ -889,7 +1069,7 @@ docker push $DOCKER_HUB_USER/$APP:$IMAGE_TAG
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE_TAG="$2"
some code to remove a docker hub tag because it's not implemented in the CLI....
# some code to remove a docker hub tag because it's not implemented in the CLI...
```
### `uninstall`
@@ -899,16 +1079,16 @@ some code to remove a docker hub tag because it's not implemented in the CLI....
- Arguments: `$PLUGIN`
- Example:
```shell
#!/usr/bin/env bash
# Cleanup up extra containers created
```shell
#!/usr/bin/env bash
# Cleanup up extra containers created
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
PLUGIN="$1"
PLUGIN="$1"
[[ "$PLUGIN" = "my-plugin" ]] && docker rmi -f "${PLUGIN_IMAGE_DEPENDENCY}"
```
[[ "$PLUGIN" = "my-plugin" ]] && docker rmi -f "${PLUGIN_IMAGE_DEPENDENCY}"
```
> To avoid uninstalling other plugins make sure to check the plugin name like shown in the example.

View File

@@ -67,7 +67,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.10.3-2 (Mon Feb 22 23:20:37 CET 2016)"
# wait for "==> build-arch: ==> Finished making: dokku 0.11.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'

View File

@@ -44,6 +44,10 @@ cd dokku
sudo BUILD_STACK=true STACK_URL=https://github.com/gliderlabs/herokuish.git make install
```
## Skipping herokuish installation
The `herokuish` package is recommended but not required if not using Heroku Buildpacks for deployment. Debian-based OS users can run the bootstrap installer via `sudo DOKKU_NO_INSTALL_RECOMMENDS=true bash bootstrap.sh` to skip the dependency. Please note that this will _also_ skip installation of other recommended dependencies.
## Configuring
Once Dokku is installed, if you are not using the web-installer, you'll want to configure a the virtualhost setup as well as the push user. If you do not, your installation will be considered incomplete and you will not be able to deploy applications.

View File

@@ -35,7 +35,7 @@ After setting the desired options, proceed with the installation as described ab
| Name | Type | Default | Description |
| ------------------ | ------- | --------------------- | ------------------------------------------------------------------------ |
| dokku/web_config | boolean | true | Use web-based config for below options |
| dokku/vhost_enable | boolean | false | Use vhost-based deployments (e.g. <app>.dokku.me) |
| dokku/vhost_enable | boolean | false | Use vhost-based deployments (e.g., <app>.dokku.me) |
| dokku/hostname | string | dokku.me | Hostname, used as vhost domain and for showing app URL after deploy |
| dokku/skip_key_file| boolean | false | Don't check for the existence of the dokku/key_file. Warning: This setting this to true, will require you to manually add an SSH key later on. |
| dokku/skip_key_file| boolean | false | Don't check for the existence of the dokku/key_file. Warning: Setting this to true, will require you to manually add an SSH key later on. |
| dokku/key_file | string | /root/.ssh/id_rsa.pub | Path on disk to an SSH key to add to the Dokku user (Will be ignored on `dpkg-reconfigure`) |

View File

@@ -19,4 +19,4 @@
7. Under **Finalize and create**, give your droplet a hostname _(not required)_ and click **Create**.
8. Once created, copy the IP address to your clipboard.
9. In a browser, go to the IP address you copied above and fill out the presented form to complete configuration. **Failure to do so may allow others to reconfigure SSH access on your server.**
10. Once the web ui has been submitted, you will be redirected to our [application deployment tutorial](http://dokku.viewdocs.io/dokku/deployment/application-deployment/), which will guide you through deploying a sample application to your Dokku server.
10. Once the web ui has been submitted, you will be redirected to our [application deployment tutorial](/docs/deployment/application-deployment.md), which will guide you through deploying a sample application to your Dokku server.

View File

@@ -21,21 +21,24 @@ 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.10.3/bootstrap.sh;
sudo DOKKU_TAG=v0.10.3 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.11.2/bootstrap.sh;
sudo DOKKU_TAG=v0.11.2 bash bootstrap.sh
```
The installation process takes about 5-10 minutes, depending upon internet connection speed.
If you're using Debian 8 or Ubuntu 14.04, make sure your package manager is configured to install a sufficiently recent version of nginx<sup>[3]</sup>, otherwise, the installation may fail due to "unmet dependencies" relating nginx.
#### 2. Setup SSH key and Virtualhost Settings
Once the installation is complete, you can open a browser to setup your SSH key and virtualhost settings. Open your browser of choice and navigate to the host's IP address - or the domain you assigned to that IP previously - and configure Dokku via the web admin.
>**Warning:** If you don't complete setup via the web installer (even if you set up SSH keys and virtual hosts otherwise) your Dokku installation will remain vulnerable to anyone finding the setup page and inserting their key.
> **Warning:** If you don't complete setup via the web installer (even if you set up SSH keys and virtual hosts otherwise) your Dokku installation will remain vulnerable to anyone finding the setup page and inserting their key.
>**Warning:** Web installer is not available on CentOS and Arch Linux. You will need to configure [SSH keys](/docs/deployment/user-management.md#adding-ssh-keys) and [virtual hosts](/docs/configuration/domains.md#customizing-hostnames) using dokku command line interface.
> **Warning:** Web installer is not available on CentOS and Arch Linux. You will need to configure [SSH keys](/docs/deployment/user-management.md#adding-ssh-keys) and [virtual hosts](/docs/configuration/domains.md#customizing-hostnames) using dokku command line interface.
#### 3. Deploy your first application
Once you save your settings, the web admin will self-terminate and you should be able to run or deploy to the Dokku installation.
### Installing via other methods
@@ -57,3 +60,4 @@ As well, you may wish to customize your installation in some other fashion. or e
- <sup>[1]: To check whether your system has an fqdn set, run `sudo hostname -f`</sup>
- <sup>[2]: If your system has less than 1GB of memory, you can use [this workaround](/docs/getting-started/advanced-installation.md#vms-with-less-than-1gb-of-memory).</sup>
- <sup>[3]: nginx >= 1.8.0 can be installed via the [nginx repositories](https://www.nginx.com/resources/admin-guide/installing-nginx-open-source/), or by adding [this PPA](https://launchpad.net/~nginx/+archive/ubuntu/stable) if you're using Ubuntu. nginx >= 1.11.5 is necessary for HTTP/2 support</sup>

View File

@@ -18,14 +18,36 @@ Before upgrading, check the migration guides to get comfortable with new feature
- [0.7 Migration Guide](/docs/appendices/0.7.0-migration-guide.md)
### 0.8 Migration Guide
- [0.8 Migration Guide](/docs/appendices/0.8.0-migration-guide.md)
### 0.9 Migration Guide
- [0.9 Migration Guide](/docs/appendices/0.9.0-migration-guide.md)
### 0.10 Migration Guide
- [0.10 Migration Guide](/docs/appendices/0.10.0-migration-guide.md)
## Upgrade Instructions
If Dokku was installed via `apt-get install dokku` or `bootstrap.sh` (most common), upgrade with:
```shell
# update your local apt cache
sudo apt-get update
dokku --quiet apps | xargs -L1 dokku ps:stop # stops each running app
# stop each running app
# for 0.8.1 and newer versions, use
dokku --quiet apps:list | xargs -L1 dokku ps:stop
# for older versions, use
dokku --quiet apps | xargs -L1 dokku ps:stop
# update dokku and it's dependencies
sudo apt-get install -qq -y dokku herokuish sshcommand plugn
# rebuild all of your applications
dokku ps:rebuildall # rebuilds all applications
```

View File

@@ -10,30 +10,30 @@
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.11.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.rawgit.com/dokku/dokku/v0.10.3/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<style>
</style>
@@ -98,12 +98,12 @@
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.10.3/bootstrap.sh</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.11.2/bootstrap.sh</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.10.3 bash bootstrap.sh</span>
<span class="command">sudo DOKKU_TAG=v0.11.2 bash bootstrap.sh</span>
</p>
<p class="line">
<span class="output">&nbsp;# go to your server's IP and follow the web installer</span>

124
docs/networking/network.md Normal file
View File

@@ -0,0 +1,124 @@
# Network Management
> New as of 0.11.0
```
network:report [<app>] [<flag>] # Displays a network report for one or more apps
network:rebuild <app> # Rebuilds network settings for an app
network:rebuildall # Rebuild network settings for all apps
network:set <app> <key> (<value>) # Set or clear a network property for an app
```
The Network plugin allows developers to abstract the concept of container network management, allowing developers to both change what networks a given container is attached to as well as rebuild the configuration on the fly.
## Usage
### Rebuilding network settings
There are cases where you may need to rebuild the network configuration for an app, such as on app boot or container restart. In these cases, you can use the `network:rebuild` command:
```shell
dokku network:rebuild node-js-app
```
> This command will exit a non-zero number that depends on the number of containers for which configuration could not be built
### Rebuilding all network settings
In some cases, a docker upgrade may reset container IPs or Ports. In both cases, you can quickly rewrite those files by using the `network:rebuildall` command:
```shell
dokku network:rebuildall
```
> This command will exit a non-zero number that depends on the number of containers for which configuration could not be built
### Container network interface binding
> This functionality does not control the `--network` docker flag. Please use the [docker-options plugin](docs/advanced-usage/docker-options.md) to manage this flag.
By default, an application will only bind to the internal interface. This behavior can be modified per app by changing the `bind-all-interfaces` network property.
```shell
# bind to the default docker interface (`docker0`) with a random internal ip
# this is the default behavior
dokku network:set node-js-app bind-all-interfaces false
# bind to all interfaces (`0.0.0.0`) on a random port for each upstream port
# this will make the app container directly accessible by other hosts on your network
# ports are randomized for every deploy, e.g. `0.0.0.0:32771->5000/tcp`.
dokku network:set node-js-app bind-all-interfaces true
```
By way of example, in the default case, each container is bound to the docker interface:
```shell
docker ps
```
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute node-js-app.web.1
```
As such, the container's IP address will be an internal IP, and thus it is only accessible on the host itself:
```
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' node-js-app.web.1
```
```
172.17.0.6
```
However, you can disable the internal proxying via the `network:set` command so that it will listen on the host's IP address:
```shell
dokku network:set node-js-app bind-all-interfaces true
# container bound to all interfaces
docker ps
```
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1
```
### Displaying network reports about an app
You can get a report about the app's network status using the `network:report` command:
```shell
dokku network:report
```
```
=====> node-js-app network information
Network bind all interfaces: false
Network listeners: 172.17.0.1:5000
=====> python-sample network information
Network bind all interfaces: false
Network listeners: 172.17.0.2:5000
=====> ruby-sample network information
Network bind all interfaces: true
Network listeners:
```
You can run the command for a specific app also.
```shell
dokku network:report node-js-app
```
```
=====> node-js-app network information
Network bind all interfaces: false
Network listeners: 172.17.0.1:5000
```
You can pass flags which will output only the value of the specific information you want. For example:
```shell
dokku network:report node-js-app --network-bind-all-interfaces
```

View File

@@ -19,46 +19,9 @@ In Dokku 0.5.0, port proxying was decoupled from the `nginx-vhosts` plugin into
### Container network interface binding
> New as of 0.5.0
> Changed as of 0.11.0
By default, the deployed docker container running your app's web process will bind to the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`). This behavior can be modified per app by disabling the proxy (i.e. `dokku proxy:disable <app>`). In this case, the container will bind to an external interface (i.e. `0.0.0.0`) and your app container will be directly accessible by other hosts on your network.
> If a proxy is disabled, Dokku will bind your container's port to a random port on the host for every deploy, e.g. `0.0.0.0:32771->5000/tcp`.
By way of example, in the default case, each container is bound to the docker interface:
```shell
docker ps
```
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute node-js-app.web.1
```
As such, the container's IP address will be an internal IP, and thus it is only accessible on the host itself:
```
docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
```
```
172.17.0.6
```
However, you can disable the internal proxying via the `proxy:disable` command so that it will listen on the host's IP address:
```shell
dokku proxy:disable node-js-app
# container bound to all interfaces
docker ps
```
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1
```
From Dokku versions `0.5.0` until `0.11.0`, enabling or disabling an application's proxy would **also** control whether or not the application was bound to all interfaces - e.g. `0.0.0.0`. As of `0.11.0`, this is now controlled by the network plugin. Please see the [network documentation](/docs/networking/network.md#container-network-interface-binding) for more information.
### Displaying proxy reports about an app

View File

@@ -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.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.10.3/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.11.2/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.11.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.rawgit.com/dokku/dokku/v0.10.3/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.11.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>
@@ -136,11 +136,16 @@
<a href="#" class="list-group-item disabled">Configuration</a>
<a href="/{{NAME}}/configuration/environment-variables/" class="list-group-item">Environment Variables</a>
<a href="/{{NAME}}/configuration/dns/" class="list-group-item">DNS Configuration</a>
<a href="/{{NAME}}/configuration/domains/" class="list-group-item">Domain Configuration</a>
<a href="/{{NAME}}/configuration/nginx/" class="list-group-item">Nginx Configuration</a>
<a href="/{{NAME}}/configuration/ssl/" class="list-group-item">SSL Configuration</a>
<a href="#" class="list-group-item disabled">Network Management</a>
<a href="/{{NAME}}/networking/dns/" class="list-group-item">DNS Configuration</a>
<a href="/{{NAME}}/networking/network/" class="list-group-item">Network Management</a>
<a href="/{{NAME}}/networking/proxy-management/" class="list-group-item">Proxy and Port Management</a>
<a href="#" class="list-group-item disabled">Advanced Usage</a>
<a href="/{{NAME}}/advanced-usage/backup-recovery/" class="list-group-item">Backup and Recovery</a>
@@ -149,7 +154,6 @@
<a href="/{{NAME}}/advanced-usage/event-logs/" class="list-group-item">Event Logs</a>
<a href="/{{NAME}}/advanced-usage/persistent-storage/" class="list-group-item">Persistent Storage</a>
<a href="/{{NAME}}/advanced-usage/plugin-management/" class="list-group-item">Plugin Management</a>
<a href="/{{NAME}}/advanced-usage/proxy-management/" class="list-group-item">Proxy and Port Management</a>
<a href="/{{NAME}}/advanced-usage/repository-management/" class="list-group-item">Repository Management</a>
<a href="#" class="list-group-item disabled">Community Contributions</a>

View File

@@ -15,16 +15,19 @@
"deployment/images": "deployment/methods/images/",
"configuration-management": "configuration/environment-variables/",
"deployment/ssl-configuration": "configuration/ssl/",
"dns": "configuration/dns/",
"nginx": "configuration/nginx/",
"dns": "networking/dns/",
"configuration/dns": "networking/dns/",
"proxy": "networking/proxy-management/",
"advanced-usage/proxy-management": "networking/proxy-management/",
"backup-recovery": "advanced-usage/backup-recovery/",
"deployment-tasks": "advanced-usage/deployment-tasks/",
"deployment/deployment-tasks": "advanced-usage/deployment-tasks/",
"docker-options": "advanced-usage/docker-options/",
"dokku-events-logs": "advanced-usage/event-logs/",
"dokku-storage": "advanced-usage/persistent-storage/",
"proxy": "advanced-usage/proxy-management/",
"plugins": "community/plugins/"
}

2
dokku
View File

@@ -125,7 +125,7 @@ execute_dokku_cmd() {
elif [[ -x $PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD ]]; then
"$PLUGIN_ENABLED_PATH/$PLUGIN_NAME/subcommands/$PLUGIN_CMD" "$@"
implemented=1
elif [[ -x $PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:} ]]; then
elif [[ -x $PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:} ]] && [[ -n "${1#*:}" ]]; then
"$PLUGIN_ENABLED_PATH/${PLUGIN_NAME%%:*}/subcommands/${1#*:}" "$@"
implemented=1
fi

View File

@@ -23,8 +23,10 @@ get_phase_script() {
execute_script() {
declare desc="executes appropriate phase script key from app.json"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
local PHASE_SCRIPT_KEY="$3"
local APP="$1"; local IMAGE_TAG="$2"; local PHASE_SCRIPT_KEY="$3"
local IMAGE id
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
local SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY" 2>/dev/null)
if [[ -n "$SCRIPT_CMD" ]];then
dokku_log_info1 "Running '$SCRIPT_CMD' in app container"
@@ -55,8 +57,11 @@ execute_script() {
# strip --restart args from DOCKER_ARGS
local DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
# shellcheck disable=SC2086
local id=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_DIR:/cache" $DOCKER_ARGS "$IMAGE" /bin/bash -c "$COMMAND")
# eval args as array to respect escapes
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
id=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" /bin/bash -c "$COMMAND")
if test "$(docker wait "$id")" -eq 0; then
dokku_container_log_verbose_quiet "$id"
if [[ "$PHASE_SCRIPT_KEY" != "postdeploy" ]];then

View File

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

View File

@@ -17,6 +17,7 @@ app_user_pre_deploy_trigger() {
local desc="app user pre-deploy trigger"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE; local DOCKER_ARGS
local DOKKU_APP_TYPE DOKKU_APP_USER APP_PATHS CONTAINER_PATHS
declare -a ARG_ARRAY
IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
@@ -27,12 +28,15 @@ app_user_pre_deploy_trigger() {
if [[ -n "$APP_PATHS" ]]; then
CONTAINER_PATHS=$(echo "$APP_PATHS" | awk -F ':' '{ print $2 }' | xargs)
DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG" | xargs)
DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
# strip --restart args from DOCKER_ARGS
DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
eval "ARG_ARRAY=($DOCKER_ARGS)"
fi
if [[ "$DOKKU_APP_TYPE" == "herokuish" ]] && [[ -n "$CONTAINER_PATHS" ]]; then
# shellcheck disable=SC2086
docker run $DOKKU_GLOBAL_RUN_ARGS $DOCKER_ARGS $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
docker run $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
fi
}

View File

@@ -22,7 +22,10 @@ dokku_run_cmd() {
local DOCKER_ARGS=$(: | plugn trigger docker-args-run "$APP" "$IMAGE_TAG")
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
local DOKKU_RUN_OPTS=""
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
local DOKKU_RUN_OPTS=" -e DYNO=run.$RANDOM"
if [[ "$DOKKU_RM_CONTAINER" ]]; then
DOKKU_RUN_OPTS+=" --rm"
elif [[ "$DOKKU_DETACH_CONTAINER" ]]; then
@@ -44,7 +47,7 @@ dokku_run_cmd() {
fi
# shellcheck disable=SC2086
docker run $DOKKU_GLOBAL_RUN_ARGS $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
docker run $DOKKU_GLOBAL_RUN_ARGS $DOKKU_RUN_OPTS "${ARG_ARRAY[@]}" $IMAGE $EXEC_CMD "$@"
}
dokku_run_cmd "$@"

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

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

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

@@ -0,0 +1 @@
hook

View File

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

View File

@@ -6,7 +6,12 @@ app_post_delete() {
declare desc="apps post-delete plugin trigger"
local trigger="app_post_delete"
local APP="$1"; local IMAGE_REPO=$(get_app_image_repo "$APP")
[[ -n $APP ]] && rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
if [[ -n $APP ]]; then
# remove contents for apps that are symlinks to other folders
rm -rf "${DOKKU_ROOT:?}/$APP/" > /dev/null
# then remove the folder and/or the symlink
rm -rf "${DOKKU_ROOT:?}/$APP" > /dev/null
fi
# remove all application containers & images
# shellcheck disable=SC2046

View File

@@ -8,6 +8,10 @@ apps_pre_delete() {
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG"); local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
verify_app_name "$APP"
if ! is_image_herokuish_based "$IMAGE"; then
return
fi
if [[ -d $CACHE_DIR ]]; then
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
fi

View File

@@ -22,8 +22,8 @@ apps_clone_cmd() {
apps_create "$NEW_APP"
pushd "$DOKKU_ROOT/$OLD_APP/." > /dev/null
find ./* -not \( -name .cache \) | cpio -pvdmu "$DOKKU_ROOT/$NEW_APP"
popd > /dev/null
find ./* -not \( -name .cache \) | grep -v "./cache" | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
popd > /dev/null 2>&1 || pushd "/tmp" > /dev/null
if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$NEW_CACHE_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache

View File

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

View File

@@ -6,36 +6,26 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
build_env_pre_build_buildpack() {
declare desc="build-env pre-build-buildpack plugin trigger"
local trigger="build_env_pre_build_buildpack"
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local BUILD_ENV=""
local APP="$1"
local IMAGE id
verify_app_name "$APP"
IMAGE=$(get_app_image_name "$APP");
[[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=90
[[ -z $(config_get --global CURL_TIMEOUT) ]] && config_set --global CURL_TIMEOUT=60
if [[ -n $(config_export global) ]]; then
local BUILD_ENV+=$'\n'
local BUILD_ENV+=$(config_export global)
local BUILD_ENV+=$'\n'
fi
if [[ -n $(config_export app "$APP") ]]; then
local BUILD_ENV+=$'\n'
local BUILD_ENV+=$(config_export app "$APP")
local BUILD_ENV+=$'\n'
fi
dokku_log_info1 "Adding BUILD_ENV to build environment..."
# create build env files for use in buildpacks like this:
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
id=$(config_bundle --merged "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /tmp/env; cat | tar -x -C /tmp/env")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
if [[ ! -z "$BUILD_ENV" ]]; then
dokku_log_info1 "Adding BUILD_ENV to build environment..."
# create build env files for use in buildpacks like this:
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
local id=$(echo $BUILD_ENV | sed -e 's@export @@g' -e 's@\\n@ @g' | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /tmp/env; for ENV_VAR in $(cat); do echo \$ENV_VAR | cut -d'=' -f2- > /tmp/env/\$(echo \$ENV_VAR | cut -d'=' -f1); done " )
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
# create build env for 'old style' buildpacks and dokku plugins
local id=$(echo -e "$BUILD_ENV" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
fi
# create build env for 'old style' buildpacks and dokku plugins
id=$(config_export app "$APP" --format envfile --merged | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
}
build_env_pre_build_buildpack "$@"

View File

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

View File

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

View File

@@ -45,18 +45,21 @@ check_process_type() {
check_process() {
local APP="$1" PROC_TYPE="$2" CONTAINER_INDEX="$3"
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
local CONTAINER_ID DOKKU_CONTAINER_ID_FILE IMAGE IP IS_HEROKUISH_CONTAINER PORT
DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
if [[ ! -f "$DOKKU_CONTAINER_ID_FILE" ]]; then
dokku_log_fail "Invalid container index specified ($APP.$PROC_TYPE.$CONTAINER_INDEX)"
fi
IS_HEROKUISH_CONTAINER=false
IMAGE=$(get_app_image_name "$APP")
is_image_herokuish_based "$IMAGE" && IS_HEROKUISH_CONTAINER=true
dokku_log_info1 "Running checks for app ($APP.$PROC_TYPE.$CONTAINER_INDEX)"
local CONTAINER_ID=$(< "$DOKKU_CONTAINER_ID_FILE")
local IP=$(< "$DOKKU_IP_FILE")
local PORT=$(< "$DOKKU_PORT_FILE")
CONTAINER_ID=$(< "$DOKKU_CONTAINER_ID_FILE")
IP="$(plugn trigger network-get-ipaddr "$APP" "$PROC_TYPE" "$CONTAINER_ID")"
PORT="$(plugn trigger network-get-port "$APP" "$PROC_TYPE" "$IS_HEROKUISH_CONTAINER" "$CONTAINER_ID")"
plugn trigger check-deploy "$APP" "$CONTAINER_ID" "$PROC_TYPE" "$PORT" "$IP"
}

View File

@@ -1,11 +1,14 @@
package common
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"os/exec"
"regexp"
"strings"
"unicode"
sh "github.com/codeskyblue/go-sh"
)
@@ -43,42 +46,24 @@ func (sc *ShellCmd) Execute() bool {
sc.Command.Stdout = os.Stdout
sc.Command.Stderr = os.Stderr
}
err := sc.Command.Run()
if err != nil {
if err := sc.Command.Run(); err != nil {
return false
}
return true
}
// VerifyAppName verifies app name format and app existence"
func VerifyAppName(appName string) (err error) {
dokkuRoot := MustGetEnv("DOKKU_ROOT")
appRoot := strings.Join([]string{dokkuRoot, appName}, "/")
_, err = os.Stat(appRoot)
if os.IsNotExist(err) {
return fmt.Errorf("App %s does not exist: %v\n", appName, err)
// 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))
}
r, _ := regexp.Compile("^[a-z].*")
if !r.MatchString(appName) {
return fmt.Errorf("App name (%s) must begin with lowercase alphanumeric character\n", appName)
sc.Command.Env = env
if sc.ShowOutput {
sc.Command.Stdout = os.Stdout
sc.Command.Stderr = os.Stderr
}
return err
}
// MustGetEnv returns env variable or fails if it's not set
func MustGetEnv(key string) string {
value := os.Getenv(key)
if value == "" {
LogFail(fmt.Sprintf("%s not set!", key))
}
return value
}
// LogFail is the failure log formatter
// prints text to stderr and exits with status 1
func LogFail(text string) {
fmt.Fprintln(os.Stderr, fmt.Sprintf("FAILED: %s", text))
os.Exit(1)
return sc.Command.Output()
}
// GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
@@ -130,12 +115,242 @@ func GetAppImageRepo(appName string) string {
return strings.Join([]string{"dokku", appName}, "/")
}
// 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(containerID, format string) (output string, err error) {
b, err := sh.Command("docker", "inspect", "--format", format, containerID).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")
files, err := ioutil.ReadDir(dokkuRoot)
if err != nil {
err = fmt.Errorf("You haven't deployed any applications yet")
return
}
for _, f := range files {
appRoot := strings.Join([]string{dokkuRoot, f.Name()}, "/")
if !DirectoryExists(appRoot) {
continue
}
if f.Name() == "tls" || strings.HasPrefix(f.Name(), ".") {
continue
}
apps = append(apps, f.Name())
}
if len(apps) == 0 {
err = fmt.Errorf("You haven't deployed any applications yet")
return
}
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)
if err != nil {
LogFail(err.Error())
}
if imageRepo == "" {
imageRepo = GetAppImageRepo(appName)
}
if imageTag == "" {
imageName = fmt.Sprintf("%v:latest", imageRepo)
} else {
imageName = fmt.Sprintf("%v:%v", imageRepo, imageTag)
if !VerifyImage(imageName) {
LogFail(fmt.Sprintf("app image (%s) not found", imageName))
}
}
return
}
// IsDeployed returns true if given app has a running container
func IsDeployed(appName string) bool {
dokkuRoot := MustGetEnv("DOKKU_ROOT")
appRoot := strings.Join([]string{dokkuRoot, appName}, "/")
files, err := ioutil.ReadDir(appRoot)
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) bool {
// circleci can't support --rm as they run lxc in lxc
dockerArgs := ""
if !FileExists("/home/ubuntu/.circlerc") {
dockerArgs = "--rm"
}
dockerGlobalArgs := os.Getenv("DOKKU_GLOBAL_RUN_ARGS")
parts := []string{"docker", "run", dockerGlobalArgs, "--entrypoint=\"/bin/sh\"", dockerArgs, image, "-c", "\"test -f /exec\""}
var dockerCmdParts []string
for _, str := range parts {
if str != "" {
dockerCmdParts = append(dockerCmdParts, str)
}
}
dockerCmd := NewShellCmd(strings.Join(dockerCmdParts, " "))
dockerCmd.ShowOutput = false
return dockerCmd.Execute()
}
// MustGetEnv returns env variable or fails if it's not set
func MustGetEnv(key string) (val string) {
val = os.Getenv(key)
if val == "" {
LogFail(fmt.Sprintf("%s not set!", key))
}
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
}
// StripInlineComments removes bash-style comment from input line
func StripInlineComments(text string) string {
bytes := []byte(text)
re := regexp.MustCompile("(?s)#.*")
bytes = re.ReplaceAll(bytes, nil)
return strings.TrimSpace(string(bytes))
}
// ToBool returns a bool value for a given string
func ToBool(s string) bool {
return s == "true"
}
// UcFirst uppercases the first character in a string
func UcFirst(str string) string {
for i, v := range str {
return string(unicode.ToUpper(v)) + str[i+1:]
}
return ""
}
// VerifyAppName verifies app name format and app existence"
func VerifyAppName(appName string) (err error) {
if appName == "" {
return fmt.Errorf("App name must not be null")
}
dokkuRoot := MustGetEnv("DOKKU_ROOT")
appRoot := strings.Join([]string{dokkuRoot, appName}, "/")
if !DirectoryExists(appRoot) {
return fmt.Errorf("app %s does not exist: %v", appName, err)
}
r, _ := regexp.Compile("^[a-z0-9].*")
if !r.MatchString(appName) {
return fmt.Errorf("app name (%s) must begin with lowercase alphanumeric character", appName)
}
return err
}
// VerifyImage returns true if docker image exists in local repo
func VerifyImage(image string) bool {
imageCmd := NewShellCmd(strings.Join([]string{"docker inspect", image}, " "))
imageCmd.ShowOutput = false
if imageCmd.Execute() {
return true
}
return false
return imageCmd.Execute()
}
//PlugnTrigger fire the given plugn trigger with the given args
func PlugnTrigger(triggerName string, args ...string) error {
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...).Run()
}

View File

@@ -1,38 +1,128 @@
package common
import (
"io/ioutil"
"os"
"strings"
"testing"
. "github.com/onsi/gomega"
)
func TestGetEnv(t *testing.T) {
var (
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"}, "")
testEnvLine2 = "export testKey=TESTING"
)
func setupTestApp() (err error) {
Expect(os.MkdirAll(testAppDir, 0644)).To(Succeed())
b := []byte(testEnvLine + "\n")
if err = ioutil.WriteFile(testEnvFile, b, 0644); err != nil {
return
}
return
}
func setupTestApp2() (err error) {
Expect(os.MkdirAll(testAppDir2, 0644)).To(Succeed())
b := []byte(testEnvLine2 + "\n")
if err = ioutil.WriteFile(testEnvFile2, b, 0644); err != nil {
return
}
return
}
func teardownTestApp() {
os.RemoveAll(testAppDir)
}
func teardownTestApp2() {
os.RemoveAll(testAppDir2)
}
func TestCommonGetEnv(t *testing.T) {
RegisterTestingT(t)
Expect(MustGetEnv("DOKKU_ROOT")).To(Equal("/home/dokku"))
}
func TestGetAppImageRepo(t *testing.T) {
func TestCommonGetAppImageRepo(t *testing.T) {
RegisterTestingT(t)
Expect(GetAppImageRepo("testapp")).To(Equal("dokku/testapp"))
}
func TestVerifyImageInvalid(t *testing.T) {
func TestCommonVerifyImageInvalid(t *testing.T) {
RegisterTestingT(t)
Expect(VerifyImage("testapp")).To(Equal(false))
}
func TestVerifyAppNameInvalid(t *testing.T) {
func TestCommonVerifyAppNameInvalid(t *testing.T) {
RegisterTestingT(t)
err := VerifyAppName("1994testApp")
Expect(err).To(HaveOccurred())
}
func TestVerifyAppName(t *testing.T) {
func TestCommonVerifyAppName(t *testing.T) {
RegisterTestingT(t)
dir := "/home/dokku/testApp"
os.MkdirAll(dir, 0644)
err := VerifyAppName("testApp")
Expect(err).NotTo(HaveOccurred())
os.RemoveAll(dir)
Expect(setupTestApp()).To(Succeed())
Expect(VerifyAppName(testAppName)).To(Succeed())
teardownTestApp()
RegisterTestingT(t)
Expect(setupTestApp2()).To(Succeed())
Expect(VerifyAppName(testAppName2)).To(Succeed())
teardownTestApp2()
}
func TestCommonDokkuAppsError(t *testing.T) {
RegisterTestingT(t)
_, err := DokkuApps()
Expect(err).To(HaveOccurred())
}
func TestCommonDokkuApps(t *testing.T) {
RegisterTestingT(t)
Expect(setupTestApp()).To(Succeed())
apps, err := DokkuApps()
Expect(err).NotTo(HaveOccurred())
Expect(apps).To(HaveLen(1))
Expect(apps[0]).To(Equal(testAppName))
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"}, " "))
Expect(text).To(Equal(testEnvLine))
}

View File

@@ -137,14 +137,21 @@ dokku_container_log_verbose_quiet() {
IFS=$OIFS
}
verify_app_name() {
declare desc="verify app name format and app existence"
is_valid_app_name() {
declare desc="verify app name format"
local APP="$1"
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
[[ ! -n "$APP" ]] && dokku_log_fail "APP must not be null"
if [[ ! "$APP" =~ ^[a-z].* && ! "$APP" =~ ^[0-9].* ]]; then
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "${DOKKU_ROOT:?}/$APP"
dokku_log_fail "App name must begin with lowercase alphanumeric character"
fi
return 0
}
verify_app_name() {
declare desc="verify app name format and app existence"
local APP="$1"
is_valid_app_name "$APP"
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
return 0
@@ -163,14 +170,14 @@ verify_image() {
get_app_image_repo() {
declare desc="central definition of image repo pattern"
local APP="$1"; local IMAGE_REPO="dokku/$APP"
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_repo) APP must not be null"
is_valid_app_name "$APP"
echo "$IMAGE_REPO"
}
get_deploying_app_image_name() {
declare desc="return deploying image identifier for a given app, tag tuple. validate if tag is presented"
local APP="$1"; local IMAGE_TAG="$2"; IMAGE_REPO="$3"
[[ -z "$APP" ]] && dokku_log_fail "(get_deploying_app_image_name) APP must not be null"
is_valid_app_name "$APP"
local IMAGE_REMOTE_REPOSITORY=$(plugn trigger deployed-app-repository "$APP")
local NEW_IMAGE_TAG=$(plugn trigger deployed-app-image-tag "$APP")
@@ -189,7 +196,7 @@ get_deploying_app_image_name() {
get_app_image_name() {
declare desc="return image identifier for a given app, tag tuple. validate if tag is presented"
local APP="$1"; local IMAGE_TAG="$2"; IMAGE_REPO="$3"
[[ -z "$APP" ]] && dokku_log_fail "(get_app_image_name) APP must not be null"
is_valid_app_name "$APP"
if [[ -z "$IMAGE_REPO" ]]; then
IMAGE_REPO=$(get_app_image_repo "$APP")
@@ -207,7 +214,6 @@ get_app_image_name() {
get_running_image_tag() {
declare desc="retrieve current image tag for a given app. returns empty string if no deployed containers are found"
local APP="$1"
[[ ! -n "$APP" ]] && dokku_log_fail "(get_running_image_tag) APP must not be null"
verify_app_name "$APP"
local CIDS=( $(get_app_container_ids "$APP") )
@@ -434,9 +440,10 @@ dokku_build() {
source "$PLUGIN_AVAILABLE_PATH/config/functions"
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local TMP_WORK_DIR="$3"; local IMAGE=$(get_app_image_name "$APP")
local cid
verify_app_name "$APP"
local CACHE_DIR="$DOKKU_ROOT/$APP/cache"
local DOKKU_APP_CACHE_DIR="$DOKKU_ROOT/$APP/cache"
eval "$(config_export app "$APP")"
pushd "$TMP_WORK_DIR" &> /dev/null
@@ -444,19 +451,21 @@ dokku_build() {
case "$IMAGE_SOURCE_TYPE" in
herokuish)
DOKKU_IMAGE="$(config_get "$APP" DOKKU_IMAGE || echo "$DOKKU_IMAGE")"
local id=$(tar -c . | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
[[ -d $CACHE_DIR ]] || mkdir -p "$CACHE_DIR"
cid=$(tar -c . | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app")
test "$(docker wait "$cid")" -eq 0
docker commit "$cid" "$IMAGE" > /dev/null
[[ -d $DOKKU_APP_CACHE_DIR ]] || mkdir -p "$DOKKU_APP_CACHE_DIR"
plugn trigger pre-build-buildpack "$APP"
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
docker attach "$id"
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -v $DOKKU_APP_CACHE_DIR:/cache -e CACHE_PATH=/cache "${ARG_ARRAY[@]}" $IMAGE /build)
docker attach "$cid"
test "$(docker wait "$cid")" -eq 0
docker commit "$cid" "$IMAGE" > /dev/null
plugn trigger post-build-buildpack "$APP"
;;
@@ -477,9 +486,11 @@ dokku_build() {
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
# strip --volume and -v args from DOCKER_ARGS
local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<< "$DOCKER_ARGS")
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
# shellcheck disable=SC2086
docker build $DOCKER_ARGS $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE .
docker build "${ARG_ARRAY[@]}" $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE .
plugn trigger post-build-dockerfile "$APP"
;;
@@ -495,20 +506,21 @@ dokku_release() {
source "$PLUGIN_AVAILABLE_PATH/config/functions"
local APP="$1"; local IMAGE_SOURCE_TYPE="$2"; local IMAGE_TAG="$3"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
local cid
verify_app_name "$APP"
case "$IMAGE_SOURCE_TYPE" in
herokuish)
plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG"
if [[ -n $(config_export global) ]]; then
local id=$(config_export global | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
cid=$(config_export global | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait "$cid")" -eq 0
docker commit "$cid" "$IMAGE" > /dev/null
fi
if [[ -n $(config_export app "$APP") ]]; then
local id=$(config_export app "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
test "$(docker wait "$id")" -eq 0
docker commit "$id" "$IMAGE" > /dev/null
cid=$(config_export app "$APP" | docker run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh")
test "$(docker wait "$cid")" -eq 0
docker commit "$cid" "$IMAGE" > /dev/null
fi
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
;;
@@ -530,20 +542,21 @@ dokku_deploy_cmd() {
local cmd="deploy"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
local APP="$1" IMAGE_TAG="$2"
local DOKKU_DOCKER_STOP_TIMEOUT DOKKU_HEROKUISH DOKKU_NETWORK_BIND_ALL IMAGE
DOKKU_HEROKUISH=false
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
is_image_herokuish_based "$IMAGE" && local DOKKU_HEROKUISH=true
is_image_herokuish_based "$IMAGE" && DOKKU_HEROKUISH=true
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
local oldids=$(get_app_container_ids "$APP")
local DOKKU_DEFAULT_DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG")
local DOKKU_IS_APP_PROXY_ENABLED="$(is_app_proxy_enabled "$APP")"
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
DOKKU_NETWORK_BIND_ALL="$(plugn trigger network-get-property "$APP" bind-all-interfaces)"
DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
local line; local PROC_TYPE; local PROC_COUNT; local CONTAINER_INDEX
@@ -567,79 +580,72 @@ dokku_deploy_cmd() {
fi
while [[ $CONTAINER_INDEX -le $PROC_COUNT ]]; do
local id=""; local port=""; local ipaddr=""
local cid=""; local port=""; local ipaddr=""
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_IP_FILE="$DOKKU_ROOT/$APP/IP.$PROC_TYPE.$CONTAINER_INDEX"
local DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
# start the app
local DOCKER_ARGS="$DOKKU_DEFAULT_DOCKER_ARGS"
local DOCKER_ARGS+=" -e DYNO=$PROC_TYPE.$CONTAINER_INDEX "
[[ "$DOKKU_TRACE" ]] && local DOCKER_ARGS+=" -e TRACE=true "
local DOCKER_ARGS
DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")
DOCKER_ARGS+=" -e DYNO=$PROC_TYPE.$CONTAINER_INDEX "
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
[[ -n "$DOKKU_HEROKUISH" ]] && local START_CMD="/start $PROC_TYPE"
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
if [[ -z "$DOKKU_HEROKUISH" ]]; then
local DOKKU_DOCKERFILE_PORTS=($(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true))
[[ "$DOKKU_HEROKUISH" == "true" ]] && local START_CMD="/start $PROC_TYPE"
if [[ "$DOKKU_HEROKUISH" == "false" ]]; then
local DOKKU_DOCKERFILE_START_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_START_CMD || true)
local DOKKU_PROCFILE_START_CMD=$(get_cmd_from_procfile "$APP" "$PROC_TYPE")
local START_CMD=${DOKKU_DOCKERFILE_START_CMD:-$DOKKU_PROCFILE_START_CMD}
fi
if [[ "$PROC_TYPE" == "web" ]]; then
if [[ -z "${DOKKU_DOCKERFILE_PORTS[*]}" ]]; then
local port=5000
local DOKKU_DOCKER_PORT_ARGS+="-p $port"
else
local p
for p in ${DOKKU_DOCKERFILE_PORTS[*]};do
if [[ ! "$p" =~ .*udp.* ]]; then
# set port to first non-udp port
local p=${p//\/tcp}
local port=${port:="$p"}
fi
local DOKKU_DOCKER_PORT_ARGS+=" -p $p "
done
fi
if [[ "$DOKKU_IS_APP_PROXY_ENABLED" == "true" ]]; then
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
local ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$id")
# Docker < 1.9 compatibility
if [[ -z $ipaddr ]]; then
local ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$id")
ports=($(plugn trigger network-compute-ports "$APP" "$PROC_TYPE" "$DOKKU_HEROKUISH"))
local DOKKU_DOCKER_PORT_ARGS=""
local DOKKU_PORT=""
for p in "${ports[@]}"; do
if [[ ! "$p" =~ .*udp.* ]]; then
DOKKU_PORT=${DOKKU_PORT:="$p"}
fi
DOKKU_DOCKER_PORT_ARGS+=" -p $p "
done
if [[ "$DOKKU_NETWORK_BIND_ALL" == "false" ]]; then
# shellcheck disable=SC2086
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
else
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
local port=$(docker port "$id" "$port" | sed 's/[0-9.]*://')
local ipaddr=127.0.0.1
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
fi
else
# shellcheck disable=SC2086
local id=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOCKER_ARGS $IMAGE $START_CMD)
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
fi
ipaddr=$(plugn trigger network-get-ipaddr "$APP" "$PROC_TYPE" "$cid")
port=$(plugn trigger network-get-port "$APP" "$PROC_TYPE" "$DOKKU_HEROKUISH" "$cid")
kill_new() {
declare desc="wrapper function to kill newly started app container"
local id="$1"
docker inspect "$id" &> /dev/null && docker stop "$id" > /dev/null && docker kill "$id" &> /dev/null
local cid="$1"
docker inspect "$cid" &> /dev/null && docker stop "$cid" > /dev/null && docker kill "$cid" &> /dev/null
trap - INT TERM EXIT
kill -9 $$
}
# run checks first, then post-deploy hooks, which switches proxy traffic
trap 'kill_new $id' INT TERM EXIT
trap 'kill_new $cid' INT TERM EXIT
if [[ "$(is_app_proctype_checks_disabled "$APP" "$PROC_TYPE")" == "false" ]]; then
dokku_log_info1 "Attempting pre-flight checks"
plugn trigger check-deploy "$APP" "$id" "$PROC_TYPE" "$port" "$ipaddr"
plugn trigger check-deploy "$APP" "$cid" "$PROC_TYPE" "$port" "$ipaddr"
fi
trap - INT TERM EXIT
# now using the new container
[[ -n "$id" ]] && echo "$id" > "$DOKKU_CONTAINER_ID_FILE"
[[ -n "$ipaddr" ]] && echo "$ipaddr" > "$DOKKU_IP_FILE"
[[ -n "$port" ]] && echo "$port" > "$DOKKU_PORT_FILE"
[[ -n "$cid" ]] && echo "$cid" > "$DOKKU_CONTAINER_ID_FILE"
[[ -n "$ipaddr" ]] && plugn trigger network-write-ipaddr "$APP" "$PROC_TYPE" "$CONTAINER_INDEX" "$ipaddr"
[[ -n "$port" ]] && plugn trigger network-write-port "$APP" "$PROC_TYPE" "$CONTAINER_INDEX" "$port"
# cleanup pre-migration files
rm -f "$DOKKU_ROOT/$APP/CONTAINER" "$DOKKU_ROOT/$APP/IP" "$DOKKU_ROOT/$APP/PORT"
@@ -985,6 +991,7 @@ get_container_ports() {
get_app_urls() {
declare desc="print an app's available urls"
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
@@ -1015,7 +1022,11 @@ get_app_urls() {
local URLS="$(merge_dedupe_list "$port_urls $app_urls" " ")"
case "$1" in
url)
echo "$URLS" | tr ' ' '\n' | head -n1
if is_ssl_enabled "$APP"; then
echo "$URLS" | tr ' ' '\n' | grep https | head -n1
else
echo "$URLS" | tr ' ' '\n' | head -n1
fi
;;
urls)
echo "$URLS" | tr ' ' '\n' | sort
@@ -1035,9 +1046,11 @@ get_app_urls() {
echo "$(< "$DOKKU_ROOT/HOSTNAME"):$app_port (container)"
done
else
shopt -s nullglob
for PORT_FILE in $DOKKU_ROOT/$APP/PORT.*; do
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$PORT_FILE") (container)"
local DOKKU_APP_LISTENERS PORT
DOKKU_APP_LISTENERS="$(plugn trigger network-get-listeners "$APP" | xargs)"
for DOKKU_APP_LISTENER in $DOKKU_APP_LISTENERS; do
PORT="$(echo "$DOKKU_APP_LISTENER" | cut -d ':' -f2)"
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$PORT (container)"
done
shopt -u nullglob
fi

56
plugins/common/log.go Normal file
View File

@@ -0,0 +1,56 @@
package common
import (
"fmt"
"os"
)
// LogFail is the failure log formatter
// prints text to stderr and exits with status 1
func LogFail(text string) {
fmt.Fprintln(os.Stderr, fmt.Sprintf("FAILED: %s", text))
os.Exit(1)
}
// LogInfo1 is the info1 header formatter
func LogInfo1(text string) {
fmt.Fprintln(os.Stdout, fmt.Sprintf("-----> %s", text))
}
// LogInfo1Quiet is the info1 header formatter (with quiet option)
func LogInfo1Quiet(text string) {
if os.Getenv("DOKKU_QUIET_OUTPUT") != "" {
LogInfo1(text)
}
}
// LogInfo2 is the info2 header formatter
func LogInfo2(text string) {
fmt.Fprintln(os.Stdout, fmt.Sprintf("=====> %s", text))
}
// LogInfo2Quiet is the info2 header formatter (with quiet option)
func LogInfo2Quiet(text string) {
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
LogInfo2(text)
}
}
// LogVerbose is the verbose log formatter
// prints indented text to stdout
func LogVerbose(text string) {
fmt.Fprintln(os.Stdout, fmt.Sprintf(" %s", text))
}
// LogVerboseQuiet is the verbose log formatter
// prints indented text to stdout (with quiet option)
func LogVerboseQuiet(text string) {
if os.Getenv("DOKKU_QUIET_OUTPUT") != "" {
LogVerbose(text)
}
}
// LogWarn is the warning log formatter
func LogWarn(text string) {
fmt.Fprintln(os.Stderr, fmt.Sprintf(" ! %s", text))
}

View File

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

View File

@@ -0,0 +1,164 @@
package common
import (
"fmt"
"io/ioutil"
"os"
"os/user"
"reflect"
"strconv"
"strings"
)
// CommandPropertySet is a generic function that will set a property for a given plugin/app combination
func CommandPropertySet(pluginName, appName, property, value string, properties map[string]string) {
if err := VerifyAppName(appName); err != nil {
LogFail(err.Error())
}
if property == "" {
LogFail("No property specified")
}
if _, ok := properties[property]; !ok {
properties := reflect.ValueOf(properties).MapKeys()
validPropertyList := make([]string, len(properties))
for i := 0; i < len(properties); i++ {
validPropertyList[i] = properties[i].String()
}
LogFail(fmt.Sprintf("Invalid property specified, valid properties include: %s", strings.Join(validPropertyList, ", ")))
}
if value != "" {
LogInfo2Quiet(fmt.Sprintf("Setting %s to %s", property, value))
PropertyWrite(pluginName, appName, property, value)
} else {
LogInfo2Quiet(fmt.Sprintf("Unsetting %s", property))
PropertyDelete(pluginName, appName, property)
}
}
// PropertyDelete deletes a property from the plugin properties for an app
func PropertyDelete(pluginName string, appName string, property string) {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
if err := os.Remove(propertyPath); err != nil {
LogFail(fmt.Sprintf("Unable to remove %s property %s.%s", pluginName, appName, property))
}
}
// PropertyDestroy destroys the plugin properties for an app
func PropertyDestroy(pluginName string, appName string) {
if appName == "_all_" {
pluginConfigPath := getPluginConfigPath(pluginName)
os.RemoveAll(pluginConfigPath)
} else {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
os.RemoveAll(pluginAppConfigRoot)
}
}
// PropertyExists returns whether a property exists or not
func PropertyExists(pluginName string, appName string, property string) bool {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
_, err := os.Stat(propertyPath)
return !os.IsNotExist(err)
}
// PropertyGet returns the value for a given property
func PropertyGet(pluginName string, appName string, property string) string {
return PropertyGetDefault(pluginName, appName, property, "")
}
// PropertyGetDefault returns the value for a given property with a specified default value
func PropertyGetDefault(pluginName, appName, property, defaultValue string) (val string) {
if !PropertyExists(pluginName, appName, property) {
return
}
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
b, err := ioutil.ReadFile(propertyPath)
if err != nil {
LogWarn(fmt.Sprintf("Unable to read %s property %s.%s", pluginName, appName, property))
return
}
val = string(b)
return
}
// PropertyWrite writes a value for a given application property
func PropertyWrite(pluginName string, appName string, property string, value string) {
if err := makePropertyPath(pluginName, appName); err != nil {
LogFail(fmt.Sprintf("Unable to create %s config directory for %s: %s", pluginName, appName, err.Error()))
}
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
file, err := os.Create(propertyPath)
if err != nil {
LogFail(fmt.Sprintf("Unable to write %s config value %s.%s: %s", pluginName, appName, property, err.Error()))
}
defer file.Close()
fmt.Fprintf(file, value)
file.Chmod(0600)
setPermissions(propertyPath, 0600)
}
// PropertySetup creates the plugin config root
func PropertySetup(pluginName string) (err error) {
pluginConfigRoot := getPluginConfigPath(pluginName)
if err = os.MkdirAll(pluginConfigRoot, 0755); err != nil {
return
}
return setPermissions(pluginConfigRoot, 0755)
}
// getPluginAppPropertyPath returns the plugin property path for a given plugin/app combination
func getPluginAppPropertyPath(pluginName string, appName string) string {
return strings.Join([]string{getPluginConfigPath(pluginName), appName}, "/")
}
// getPluginConfigPath returns the plugin property path for a given plugin
func getPluginConfigPath(pluginName string) string {
return strings.Join([]string{MustGetEnv("DOKKU_LIB_ROOT"), "config", pluginName}, "/")
}
// makePropertyPath ensures that a property path exists
func makePropertyPath(pluginName string, appName string) (err error) {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
if err = os.MkdirAll(pluginAppConfigRoot, 0755); err != nil {
return
}
return setPermissions(pluginAppConfigRoot, 0755)
}
// setPermissions sets the proper owner and filemode for a given file
func setPermissions(path string, fileMode os.FileMode) (err error) {
if err = os.Chmod(path, fileMode); err != nil {
return err
}
group, err := user.LookupGroup("dokku")
if err != nil {
return
}
user, err := user.Lookup("dokku")
if err != nil {
return
}
uid, err := strconv.Atoi(user.Uid)
if err != nil {
return
}
gid, err := strconv.Atoi(group.Gid)
if err != nil {
return
}
return os.Chown(path, uid, gid)
}

2
plugins/config/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/commands
/subcommands/*

28
plugins/config/Makefile Normal file
View File

@@ -0,0 +1,28 @@
include ../../common.mk
GO_ARGS ?= -a
SUBCOMMANDS = subcommands/export subcommands/get subcommands/set subcommands/unset subcommands/keys subcommands/bundle
build-in-docker: clean
docker run --rm \
-v $$PWD/../..:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT)/plugins/config \
$(BUILD_IMAGE) \
bash -c "GO_ARGS='$(GO_ARGS)' make build" || exit $$?
build: commands subcommands
commands: **/**/commands.go
go build $(GO_ARGS) -o commands src/commands/commands.go
subcommands: $(SUBCOMMANDS)
subcommands/%: src/subcommands/*/%.go
go build $(GO_ARGS) -o $@ $<
clean:
rm -rf commands subcommands
src-clean:
rm -rf .gitignore src triggers vendor Makefile *.go

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bash
[[ " help config:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | config:help)
help_content_func () {
declare desc="return config plugin help content"
cat<<help_content
config (<app>|--global), Display all global or app-specific config vars
config:get (<app>|--global) KEY, Display a global or app-specific config value
config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...], Set one or more config vars
config:unset (<app>|--global) KEY1 [KEY2 ...], Unset one or more config vars
help_content
}
if [[ $1 = "config:help" ]] ; then
echo -e 'Usage: dokku config[:COMMAND] (<app>|--global)'
echo ''
echo 'Manage global or app-specific config vars.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
;;
*)
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

119
plugins/config/config.go Normal file
View File

@@ -0,0 +1,119 @@
package config
import (
"fmt"
"regexp"
"github.com/dokku/dokku/plugins/common"
)
//Get retreives a value from a config. If appName is empty the global config is used.
func Get(appName string, key string) (value string, ok bool) {
env, err := loadAppOrGlobalEnv(appName)
if err != nil {
return "", false
}
if err = validateKey(key); err != nil {
return "", false
}
return env.Get(key)
}
//GetWithDefault gets a value from a config. If appName is empty the global config is used. If the appName or key do not exist defaultValue is returned.
func GetWithDefault(appName string, key string, defaultValue string) (value string) {
value, ok := Get(appName, key)
if !ok {
return defaultValue
}
return value
}
//SetMany variables in the environment. If appName is empty the global config is used. If restart is true the app is restarted.
func SetMany(appName string, entries map[string]string, restart bool) (err error) {
global := appName == ""
env, err := loadAppOrGlobalEnv(appName)
if err != nil {
return
}
keys := make([]string, 0, len(entries))
for k := range entries {
if err = validateKey(k); err != nil {
return
}
}
for k, v := range entries {
env.Set(k, v)
keys = append(keys, k)
}
if len(entries) != 0 {
common.LogInfo1("Setting config vars")
fmt.Println(prettyPrintEnvEntries(" ", entries))
env.Write()
triggerUpdate(appName, "set", keys)
}
if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) {
triggerRestart(appName)
}
return
}
//UnsetMany a value in a config. If appName is empty the global config is used. If restart is true the app is restarted.
func UnsetMany(appName string, keys []string, restart bool) (err error) {
global := appName == ""
env, err := loadAppOrGlobalEnv(appName)
if err != nil {
return
}
var changed = false
for _, k := range keys {
if err = validateKey(k); err != nil {
return
}
}
for _, k := range keys {
if _, hasKey := env.Map()[k]; hasKey {
common.LogInfo1(fmt.Sprintf("Unsetting %s", k))
env.Unset(k)
changed = true
} else {
common.LogInfo1(fmt.Sprintf("Skipping %s, it is not set in the environment", k))
}
}
if changed {
env.Write()
triggerUpdate(appName, "unset", keys)
}
if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) {
triggerRestart(appName)
}
return
}
func triggerRestart(appName string) {
common.LogInfo1(fmt.Sprintf("Restarting app %s", appName))
if err := common.PlugnTrigger("app-restart", appName); err != nil {
common.LogWarn(fmt.Sprintf("Failure while restarting app: %s", err))
}
}
func triggerUpdate(appName string, operation string, args []string) {
args = append([]string{appName, operation}, args...)
if err := common.PlugnTrigger("post-config-update", args...); err != nil {
common.LogWarn(fmt.Sprintf("Failure while triggering post-config-update: %s", err))
}
}
func loadAppOrGlobalEnv(appName string) (env *Env, err error) {
if appName == "" || appName == "--global" {
return LoadGlobalEnv()
}
return LoadAppEnv(appName)
}
func validateKey(key string) error {
r, _ := regexp.Compile("^[a-zA-Z_][a-zA-Z0-9_]*$")
if !r.MatchString(key) {
return fmt.Errorf("Invalid key name: '%s'", key)
}
return nil
}

View File

@@ -0,0 +1,152 @@
package config
import (
"io/ioutil"
"os"
"strings"
"testing"
"github.com/dokku/dokku/plugins/common"
. "github.com/onsi/gomega"
)
var (
testAppName = "test-app-1"
dokkuRoot = common.MustGetEnv("DOKKU_ROOT")
testAppDir = strings.Join([]string{dokkuRoot, testAppName}, "/")
globalConfigFile = strings.Join([]string{dokkuRoot, "ENV"}, "/")
)
func setupTestApp() (err error) {
Expect(os.MkdirAll(testAppDir, 0766)).To(Succeed())
b := []byte("export testKey=TESTING\n")
if err = ioutil.WriteFile(strings.Join([]string{testAppDir, "/ENV"}, ""), b, 0644); err != nil {
return
}
b = []byte("export testKey=GLOBAL_TESTING\nexport globalKey=GLOBAL_VALUE")
if err = ioutil.WriteFile(globalConfigFile, b, 0644); err != nil {
return
}
return
}
func teardownTestApp() {
os.RemoveAll(testAppDir)
}
func TestConfigGetWithDefault(t *testing.T) {
RegisterTestingT(t)
Expect(setupTestApp()).To(Succeed())
Expect(GetWithDefault(testAppName, "unknownKey", "UNKNOWN")).To(Equal("UNKNOWN"))
Expect(GetWithDefault(testAppName, "testKey", "testKey")).To(Equal("TESTING"))
Expect(GetWithDefault(testAppName+"-nonexistent", "testKey", "default")).To(Equal("default"))
teardownTestApp()
}
func TestConfigGet(t *testing.T) {
RegisterTestingT(t)
Expect(setupTestApp()).To(Succeed())
defer teardownTestApp()
expectValue(testAppName, "testKey", "TESTING")
expectValue("", "testKey", "GLOBAL_TESTING")
expectNoValue(testAppName, "testKey2")
expectNoValue("", "testKey2")
}
func TestConfigSetMany(t *testing.T) {
RegisterTestingT(t)
Expect(setupTestApp()).To(Succeed())
defer teardownTestApp()
expectValue(testAppName, "testKey", "TESTING")
vals := map[string]string{"testKey": "updated", "testKey2": "new"}
Expect(SetMany(testAppName, vals, false)).To(Succeed())
expectValue(testAppName, "testKey", "updated")
expectValue(testAppName, "testKey2", "new")
vals = map[string]string{"testKey": "updated_global", "testKey2": "new_global"}
Expect(SetMany("", vals, false)).To(Succeed())
expectValue("", "testKey", "updated_global")
expectValue("", "testKey2", "new_global")
expectValue("", "globalKey", "GLOBAL_VALUE")
expectValue(testAppName, "testKey", "updated")
expectValue(testAppName, "testKey2", "new")
Expect(SetMany(testAppName+"does_not_exist", vals, false)).ToNot(Succeed())
}
func TestConfigUnsetMany(t *testing.T) {
RegisterTestingT(t)
Expect(setupTestApp()).To(Succeed())
defer teardownTestApp()
expectValue(testAppName, "testKey", "TESTING")
expectValue("", "testKey", "GLOBAL_TESTING")
keys := []string{"testKey", "noKey"}
Expect(UnsetMany(testAppName, keys, false)).To(Succeed())
expectNoValue(testAppName, "testKey")
expectValue("", "testKey", "GLOBAL_TESTING")
Expect(UnsetMany(testAppName, keys, false)).To(Succeed())
expectNoValue(testAppName, "testKey")
expectNoValue(testAppName, "globalKey")
Expect(UnsetMany(testAppName+"does-not-exist", keys, false)).ToNot(Succeed())
}
func TestEnvironmentLoading(t *testing.T) {
RegisterTestingT(t)
Expect(setupTestApp()).To(Succeed())
defer teardownTestApp()
env, err := LoadMergedAppEnv(testAppName)
Expect(err).To(Succeed())
v, _ := env.Get("testKey")
Expect(v).To(Equal("TESTING"))
v, _ = env.Get("globalKey")
Expect(v).To(Equal("GLOBAL_VALUE"))
Expect(env.Write()).ToNot(Succeed())
env, err = LoadAppEnv(testAppName)
env.Set("testKey", "TESTING-updated")
env.Set("testKey2", "TESTING-'\n'-updated")
env.Write()
expectValue(testAppName, "testKey", "TESTING-updated")
expectValue(testAppName, "testKey2", "TESTING-'\n'-updated")
expectValue("", "testKey", "GLOBAL_TESTING")
Expect(err).To(Succeed())
}
func TestInvalidKeys(t *testing.T) {
RegisterTestingT(t)
Expect(setupTestApp()).To(Succeed())
defer teardownTestApp()
invalidKeys := []string{"0invalidKey", "invalid:key", "invalid=Key", "!invalidKey"}
for _, key := range invalidKeys {
Expect(SetMany(testAppName, map[string]string{key: "value"}, false)).NotTo(Succeed())
Expect(UnsetMany(testAppName, []string{key}, false)).NotTo(Succeed())
value, ok := Get(testAppName, key)
Expect(ok).To(Equal(false))
value = GetWithDefault(testAppName, key, "default")
Expect(value).To(Equal("default"))
}
}
func expectValue(appName string, key string, expected string) {
v, ok := Get(appName, key)
Expect(ok).To(Equal(true))
Expect(v).To(Equal(expected))
}
func expectNoValue(appName string, key string) {
_, ok := Get(appName, key)
Expect(ok).To(Equal(false))
}

View File

@@ -5,17 +5,17 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
config_docker_args() {
declare desc="config docker-args plugin trigger"
local trigger="$0 config_docker_args"
local STDIN=$(cat); local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
local DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
declare APP="$1" IMAGE_TAG="$2"
local ENV_ARGS IMAGE STDIN trigger
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
STDIN=$(cat);
trigger="$0 config_docker_args"
verify_app_name "$APP"
if ! is_image_herokuish_based "$IMAGE"; then
> "$DOCKERFILE_ENV_FILE"
config_export global | sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" > "$DOCKERFILE_ENV_FILE"
config_export app "$APP" | sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" >> "$DOCKERFILE_ENV_FILE"
echo -n "$STDIN --env-file=$DOCKERFILE_ENV_FILE"
ENV_ARGS="$(config_export app "$APP" --format docker-args --merged)"
echo -n "$STDIN $ENV_ARGS"
else
echo -n "$STDIN"
fi

View File

@@ -0,0 +1,274 @@
package config
import (
"errors"
"fmt"
"io"
"path/filepath"
"sort"
"strings"
"archive/tar"
"os"
"github.com/dokku/dokku/plugins/common"
"github.com/joho/godotenv"
"github.com/ryanuber/columnize"
)
//ExportFormat types of possible exports
type ExportFormat int
const (
//ExportFormatExports format: Sourceable exports
ExportFormatExports ExportFormat = iota
//ExportFormatEnvfile format: dotenv file
ExportFormatEnvfile
//ExportFormatDockerArgs format: --env args for docker
ExportFormatDockerArgs
//ExportFormatShell format: env arguments for shell
ExportFormatShell
//ExportFormatPretty format: pretty-printed in columns
ExportFormatPretty
)
//Env is a representation for global or app environment
type Env struct {
name string
filename string
env map[string]string
}
//newEnvFromString creates an env from the given ENVFILE contents representation
func newEnvFromString(rep string) (env *Env, err error) {
envMap, err := godotenv.Unmarshal(rep)
env = &Env{
name: "<unknown>",
filename: "",
env: envMap,
}
return
}
//LoadAppEnv loads an environment for the given app
func LoadAppEnv(appName string) (env *Env, err error) {
appfile, err := getAppFile(appName)
if err != nil {
return
}
return loadFromFile(appName, appfile)
}
//LoadMergedAppEnv loads an app environment merged with the global environment
func LoadMergedAppEnv(appName string) (env *Env, err error) {
env, err = LoadAppEnv(appName)
if err != nil {
return
}
global, err := LoadGlobalEnv()
if err != nil {
common.LogFail(err.Error())
}
global.Merge(env)
global.filename = ""
global.name = env.name
return global, err
}
//LoadGlobalEnv loads the global environment
func LoadGlobalEnv() (*Env, error) {
return loadFromFile("<global>", getGlobalFile())
}
//Get an environment variable
func (e *Env) Get(key string) (value string, ok bool) {
value, ok = e.env[key]
return
}
//GetDefault an environment variable or a default if it doesn't exist
func (e *Env) GetDefault(key string, defaultValue string) string {
v, ok := e.env[key]
if !ok {
return defaultValue
}
return v
}
//GetBoolDefault gets the bool value of the given key with the given default
//right now that is evaluated as `value != "0"`
func (e *Env) GetBoolDefault(key string, defaultValue bool) bool {
v, ok := e.Get(key)
if !ok {
return defaultValue
}
return v != "0"
}
//Set an environment variable
func (e *Env) Set(key string, value string) {
e.env[key] = value
}
//Unset an environment variable
func (e *Env) Unset(key string) {
delete(e.env, key)
}
//Keys gets the keys in this environment
func (e *Env) Keys() (keys []string) {
keys = make([]string, 0, len(e.env))
for k := range e.env {
keys = append(keys, k)
}
sort.Strings(keys)
return
}
//Len returns the number of items in this environment
func (e *Env) Len() int {
return len(e.env)
}
//Map returns the Env as a map
func (e *Env) Map() map[string]string {
return e.env
}
func (e *Env) String() string {
return e.EnvfileString()
}
//Merge merges the given environment on top of the receiver
func (e *Env) Merge(other *Env) {
for _, k := range other.Keys() {
e.Set(k, other.GetDefault(k, ""))
}
}
//Write an Env back to the file it was read from as an exportfile
func (e *Env) Write() error {
if e.filename == "" {
return errors.New("this Env was created unbound to a file")
}
return godotenv.Write(e.Map(), e.filename)
}
//Export the Env in the given format
func (e *Env) Export(format ExportFormat) string {
switch format {
case ExportFormatExports:
return e.ExportfileString()
case ExportFormatEnvfile:
return e.EnvfileString()
case ExportFormatDockerArgs:
return e.DockerArgsString()
case ExportFormatShell:
return e.ShellString()
case ExportFormatPretty:
return prettyPrintEnvEntries("", e.Map())
default:
common.LogFail(fmt.Sprintf("Unknown export format: %v", format))
return ""
}
}
//EnvfileString returns the contents of this Env in dotenv format
func (e *Env) EnvfileString() string {
rep, _ := godotenv.Marshal(e.Map())
return rep
}
//ExportfileString returns the contents of this Env as bash exports
func (e *Env) ExportfileString() string {
return e.stringWithPrefixAndSeparator("export ", "\n")
}
//DockerArgsString gets the contents of this Env in the form -env=KEY=VALUE --env...
func (e *Env) DockerArgsString() string {
return e.stringWithPrefixAndSeparator("--env=", " ")
}
//ShellString gets the contents of this Env in the form "KEY='value' KEY2='value'"
// for passing the environment in the shell
func (e *Env) ShellString() string {
return e.stringWithPrefixAndSeparator("", " ")
}
//ExportBundle writes a tarfile of the environment to the given io.Writer.
// for every environment variable there is a file with the variable's key
// with its content set to the variable's value
func (e *Env) ExportBundle(dest io.Writer) error {
tarfile := tar.NewWriter(dest)
defer tarfile.Close()
for _, k := range e.Keys() {
val, _ := e.Get(k)
valbin := []byte(val)
header := &tar.Header{
Name: k,
Mode: 0600,
Size: int64(len(valbin)),
}
tarfile.WriteHeader(header)
tarfile.Write(valbin)
}
return nil
}
//stringWithPrefixAndSeparator makes a string of the environment
// with the given prefix and separator for each entry
func (e *Env) stringWithPrefixAndSeparator(prefix string, separator string) string {
keys := e.Keys()
entries := make([]string, len(keys))
for i, k := range keys {
v := singleQuoteEscape(e.env[k])
entries[i] = fmt.Sprintf("%s%s='%s'", prefix, k, v)
}
return strings.Join(entries, separator)
}
//singleQuoteEscape escapes the value as if it were shell-quoted in single quotes
func singleQuoteEscape(value string) string { // so that 'esc'aped' -> 'esc'\''aped'
return strings.Replace(value, "'", "'\\''", -1)
}
//prettyPrintEnvEntries in columns
func prettyPrintEnvEntries(prefix string, entries map[string]string) string {
colConfig := columnize.DefaultConfig()
colConfig.Prefix = prefix
colConfig.Delim = "\x00"
lines := make([]string, 0, len(entries))
for k, v := range entries {
lines = append(lines, fmt.Sprintf("%s:\x00%s", k, v))
}
return columnize.Format(lines, colConfig)
}
func loadFromFile(name string, filename string) (env *Env, err error) {
envMap := make(map[string]string)
if _, err := os.Stat(filename); err == nil {
envMap, err = godotenv.Read(filename)
}
env = &Env{
name: name,
filename: filename,
env: envMap,
}
return
}
func getAppFile(appName string) (string, error) {
err := common.VerifyAppName(appName)
if err != nil {
return "", err
}
return filepath.Join(common.MustGetEnv("DOKKU_ROOT"), appName, "ENV"), nil
}
func getGlobalFile() string {
return filepath.Join(common.MustGetEnv("DOKKU_ROOT"), "ENV")
}

View File

@@ -0,0 +1,102 @@
package config
import (
"testing"
. "github.com/onsi/gomega"
)
func TestExportfileRoundtrip(t *testing.T) {
RegisterTestingT(t)
env, err := newEnvFromString("HI='ho'\nFoo='Bar'\n\nBaz='BOFF'")
Expect(err).NotTo(HaveOccurred())
Expect(env.Map()).To(Equal(pairs("Baz", "BOFF", "Foo", "Bar", "HI", "ho")))
Expect(env.String()).To(Equal("Baz=\"BOFF\"\nFoo=\"Bar\"\nHI=\"ho\""))
env, err = newEnvFromString(`export HI="h\no"`)
Expect(err).NotTo(HaveOccurred())
Expect(env.Map()).To(Equal(pairs("HI", "h\no")))
Expect(env.String()).To(Equal(`HI="h\no"`))
env, err = newEnvFromString("HI='ho'\nFOO=\"'\\nBAR=''\"")
Expect(err).NotTo(HaveOccurred())
Expect(env.Map()).To(Equal(pairs("HI", "ho", "FOO", "'\nBAR=''")))
Expect(env.String()).To(Equal("FOO=\"'\\nBAR=''\"\nHI=\"ho\""))
env, err = newEnvFromString("FOO='bar' ")
Expect(err).NotTo(HaveOccurred())
Expect(env.Map()).To(Equal(pairs("FOO", "bar")))
Expect(env.String()).To(Equal(`FOO="bar"`))
}
func TestExportfileErrors(t *testing.T) {
RegisterTestingT(t)
_, err := newEnvFromString("F\nOO='bar'") //keys cannot have embedded newlines
Expect(err).To(HaveOccurred())
}
func TestMerge(t *testing.T) {
RegisterTestingT(t)
e, _ := newEnvFromString("FOO='bar'")
e2, _ := newEnvFromString("BAR='baz'")
e.Merge(e2)
Expect(e.Map()).To(Equal(pairs("BAR", "baz", "FOO", "bar")))
e3, _ := newEnvFromString("FOO='ba \\nz'")
e.Merge(e3)
Expect(e.Map()).To(Equal(pairs("BAR", "baz", "FOO", "ba \nz")))
}
func TestExport(t *testing.T) {
RegisterTestingT(t)
e, _ := newEnvFromString("BAR='BAZ'\nFOO='b'ar '\nBAZ='a\\nb'")
Expect(e.Export(ExportFormatEnvfile)).To(Equal("BAR=\"BAZ\"\nBAZ=\"a\\nb\"\nFOO=\"b'ar \""))
Expect(e.Export(ExportFormatDockerArgs)).To(Equal("--env=BAR='BAZ' --env=BAZ='a\nb' --env=FOO='b'\\''ar '"))
Expect(e.Export(ExportFormatShell)).To(Equal("BAR='BAZ' BAZ='a\nb' FOO='b'\\''ar '"))
Expect(e.Export(ExportFormatExports)).To(Equal("export BAR='BAZ'\nexport BAZ='a\nb'\nexport FOO='b'\\''ar '"))
}
func TestGet(t *testing.T) {
RegisterTestingT(t)
e, err := newEnvFromString("BAR='BAZ'\nFOO='ba\\nr '\nGO='1'\nNOGO='0'")
Expect(err).To(Succeed())
v, ok := e.Get("GO")
Expect(ok).To(Equal(true))
Expect(v).To(Equal("1"))
v = e.GetDefault("GO", "default")
Expect(v).To(Equal("1"))
v = e.GetDefault("dne", "default")
Expect(v).To(Equal("default"))
b := e.GetBoolDefault("dne", true)
Expect(b).To(Equal(true))
b = e.GetBoolDefault("dne", false)
Expect(b).To(Equal(false))
b = e.GetBoolDefault("GO", false)
Expect(b).To(Equal(true))
b = e.GetBoolDefault("NOGO", true)
Expect(b).To(Equal(false))
b = e.GetBoolDefault("BAR", false)
Expect(b).To(Equal(true)) //anything but "0" is true
}
func pairs(vars ...string) map[string]string {
res := map[string]string{}
var i = 0
for i < len(vars)-1 {
key := vars[i]
value := vars[i+1]
res[key] = value
i += 2
}
return res
}

View File

@@ -2,255 +2,61 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
config_sub() {
declare desc="executes a config subcommand"
local name="$1"
shift
"$PLUGIN_AVAILABLE_PATH/config/subcommands/$name" "config:$name" "$@"
}
config_export() {
declare desc="returns export command for config variable of specified type (app/global)"
local CONFIG_TYPE="$1"
local APP="$2"
local ENV_FILE="$DOKKU_ROOT/$APP/ENV"
[[ $CONFIG_TYPE == "global" ]] && local ENV_FILE="$DOKKU_ROOT/ENV"
[[ ! -f $ENV_FILE ]] && return 0
[[ ! -s $ENV_FILE ]] && return 0
local VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" "$ENV_FILE" | cut -d" " -f2-)
echo "$VARS" | awk '{print "export " $0}'
shift
local APP="$1"
if [[ $CONFIG_TYPE == "global" ]]; then
APP="--global"
else
shift
fi
config_sub export "$@" "$APP"
return 0
}
get_sanitized_config_args() {
local desc="return sanitized arguments for config plugin"
local SANITIZED_ARGS=("$@")
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--global/}")
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--no-restart/}")
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--export/}")
SANITIZED_ARGS=("${SANITIZED_ARGS[@]//--shell/}")
echo "${SANITIZED_ARGS[@]}"
}
config_parse_args() {
declare desc="parse config plugin args"
unset APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
for var; do
if [[ "$var" == "--global" ]]; then
ENV_FILE="$DOKKU_ROOT/ENV"
DOKKU_CONFIG_TYPE="global"
DOKKU_CONFIG_RESTART=false
fi
if [[ "$var" == "--no-restart" ]]; then
DOKKU_CONFIG_RESTART=false
fi
if [[ "$var" == "--export" ]]; then
DOKKU_CONFIG_EXPORT=true
fi
if [[ "$var" == "--shell" ]]; then
DOKKU_CONFIG_SHELL=true
fi
done
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
set -- "${SANITIZED_ARGS[@]}"
DOKKU_CONFIG_TYPE=${DOKKU_CONFIG_TYPE:="app"}
DOKKU_CONFIG_RESTART=${DOKKU_CONFIG_RESTART:=true}
if [[ "$DOKKU_CONFIG_TYPE" == "app" ]]; then
if [[ -z $2 ]]; then
dokku_log_fail "Please specify an app to run the command on"
else
verify_app_name "$2"
APP=${APP:="$2"}
ENV_FILE=${ENV_FILE:="$DOKKU_ROOT/$APP/ENV"}
fi
fi
export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART DOKKU_CONFIG_EXPORT
}
config_create () {
declare desc="create config env file"
local ENV_FILE=$1
[[ -f $ENV_FILE ]] || touch "$ENV_FILE"
}
config_styled_hash () {
declare desc="internal config hash"
local vars="$1"
local prefix="$2"
local longest=""
while read -r word; do
local KEY=$(echo "$word" | cut -d"=" -f1)
if [[ ${#KEY} -gt ${#longest} ]]; then
local longest=$KEY
fi
done <<< "$vars"
while read -r word; do
local KEY=$(echo "$word" | cut -d"=" -f1)
local VALUE=$(echo "$word" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" -e "s/\$$//g")
local num_zeros=$((${#longest} - ${#KEY}))
local zeros=" "
while [[ $num_zeros -gt 0 ]]; do
local zeros="$zeros "
local num_zeros=$((num_zeros - 1))
done
echo "$prefix$KEY:$zeros$VALUE"
done <<< "$vars"
}
config_write() {
declare desc="writes config vars out to appropriate file path"
local ENV_TEMP="$1"
local ENV_FILE_TEMP="${ENV_FILE}.tmp"
echo "$ENV_TEMP" | sed '/^$/d' | sort > "$ENV_FILE_TEMP"
if ! cmp -s "$ENV_FILE" "$ENV_FILE_TEMP"; then
cp -f "$ENV_FILE_TEMP" "$ENV_FILE"
chmod 600 "$ENV_FILE"
fi
rm -f "$ENV_FILE_TEMP"
}
config_all() {
declare desc="print or export config vars"
declare desc="Backwards compatible function for plugin use"
[[ "$1" == "config" ]] || set -- "config" "$@"
config_parse_args "$@"
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
set -- "${SANITIZED_ARGS[@]}"
if [[ -n "$DOKKU_CONFIG_EXPORT" ]]; then
config_export app "$@"
return 0
fi
config_create "$ENV_FILE"
[[ $DOKKU_CONFIG_EXPORT ]] && config_export "$DOKKU_CONFIG_TYPE" "$APP" && return 0
"$PLUGIN_AVAILABLE_PATH/config/commands" "$@"
}
[[ $APP ]] && local DOKKU_CONFIG_TYPE=$APP
[[ ! -s $ENV_FILE ]] && dokku_log_fail "no config vars for $DOKKU_CONFIG_TYPE"
local VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" "$ENV_FILE" | cut -d" " -f2-)
[[ $DOKKU_CONFIG_SHELL ]] && echo "$VARS" && return 0
dokku_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars"
config_styled_hash "$VARS"
config_keys() {
declare desc="returns keys for app or global"
config_sub keys "$@"
return 0
}
config_get() {
declare desc="get value of given config var"
[[ "$1" == "config:get" ]] || set -- "config:get" "$@"
config_parse_args "$@"
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
set -- "${SANITIZED_ARGS[@]}"
if [[ -z $2 ]]; then
echo "Usage: dokku config:get APP KEY"
echo "Must specify KEY."
exit 1
fi
config_create "$ENV_FILE"
if [[ ! -s $ENV_FILE ]]; then
return 1
fi
local KEY="${*: -1}"
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" "$ENV_FILE" | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
config_sub get "$@"
}
config_set() {
declare desc="set value of given config var"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
[[ "$1" == "config:set" ]] || set -- "config:set" "$@"
config_parse_args "$@"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Whitespaces need to be escaped, i.e. KEY=\"VAL\ WITH\ SPACES\""
echo "Must specify KEY and VALUE to set."
exit 1
fi
config_create "$ENV_FILE"
local ENV_ADD=""
local ENV_TEMP=$(cat "${ENV_FILE}")
local RESTART_APP=false
shift 2
for var; do
if [[ $var == "--global" ]] || [[ $var == "--no-restart" ]] || ([[ $APP ]] && [[ $var == "$APP" ]]); then
shift 1
elif [[ $var != *"="* ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Whitespaces need to be escaped, i.e. KEY=\"VAL\ WITH\ SPACES\""
echo "Must specify KEY and VALUE to set."
exit 1
fi
done
for var; do
local KEY=$(echo ${var} | cut -d"=" -f1)
local VALUE=$(echo ${var} | cut -d"=" -f2-)
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
local RESTART_APP=true
local ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $KEY=/ d")
local ENV_TEMP="${ENV_TEMP}
export $KEY='$VALUE'"
local ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
local ENV_ADD="${ENV_ADD}$
${var}"
fi
done
local ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
if [[ $RESTART_APP ]]; then
dokku_log_info1 "Setting config vars"
config_styled_hash "$ENV_ADD" " "
config_write "$ENV_TEMP"
plugn trigger post-config-update "$APP" "set" "$@"
fi
[[ $APP ]] && local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]] && [[ "$DOKKU_APP_RESTORE" != 0 ]]; then
dokku_log_info1 "Restarting app $APP"
ps_restart "$APP"
fi
config_sub set "$@"
}
config_unset() {
declare desc="unset given config var"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
[[ "$1" == "config:unset" ]] || set -- "config:unset" "$@"
config_parse_args "$@"
local SANITIZED_ARGS=($(get_sanitized_config_args "$@"))
set -- "${SANITIZED_ARGS[@]}"
if [[ -z $2 ]]; then
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
echo "Must specify KEY to unset."
exit 1
fi
config_create "$ENV_FILE"
local ENV_TEMP=$(cat "${ENV_FILE}")
local VARS="${*:2}"
for var in $VARS; do
dokku_log_info1 "Unsetting $var"
local ENV_TEMP=$(echo "${ENV_TEMP}" | sed "/^export $var=/ d")
config_write "$ENV_TEMP"
done
plugn trigger post-config-update "$APP" "unset" "$@"
[[ $APP ]] && local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true)
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]] && [[ "$DOKKU_APP_RESTORE" != 0 ]]; then
dokku_log_info1 "Restarting app $APP"
ps_restart "$APP"
fi
declare desc="unset value of given config var"
config_sub unset "$@"
}
config_bundle() {
declare desc="export tar bundle of config"
config_sub bundle "$@"
}

8
plugins/config/glide.lock generated Normal file
View File

@@ -0,0 +1,8 @@
hash: dd48defef474bdf5c6e47281a256ca941d71fe1e637d11443fb49acf3e4b5326
updated: 2017-09-23T16:25:15.559883959-04:00
imports:
- name: github.com/joho/godotenv
version: a79fa1e548e2c689c241d10173efd51e5d689d5b
- name: github.com/ryanuber/columnize
version: abc90934186a77966e2beeac62ed966aac0561d5
testImports: []

View File

@@ -0,0 +1,8 @@
package: github.com/dokku/dokku/plugins/config
ignore:
- github.com/dokku/dokku/plugins/common
- github.com/onsi/gomega
import:
- package: github.com/ryanuber/columnize
- package: github.com/joho/godotenv
version: ^1.2.0

View File

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

View File

@@ -0,0 +1,68 @@
package main
import (
"flag"
"fmt"
"os"
"strconv"
"strings"
"github.com/dokku/dokku/plugins/config"
columnize "github.com/ryanuber/columnize"
)
const (
helpHeader = `Usage: dokku config [<app>|--global]
Display all global or app-specific config vars
Additional commands:`
helpContent = `
config (<app>|--global), Pretty-print an app or global environment
config:get (<app>|--global) KEY, Display a global or app-specific config value
config:set (<app>|--global) [--encoded] [--no-restart] KEY1=VALUE1 [KEY2=VALUE2 ...], Set one or more config vars
config:unset (<app>|--global) KEY1 [KEY2 ...], Unset one or more config vars
config:export (<app>|--global) [--envfile], Export a global or app environment
config:keys (<app>|--global) [--merged], Show keys set in environment
config:bundle (<app>|--global) [--merged], Bundle environment into tarfile
`
)
func main() {
flag.Usage = usage
flag.Parse()
cmd := flag.Arg(0)
switch cmd {
case "config", "config:show":
args := flag.NewFlagSet("config:show", flag.ExitOnError)
global := args.Bool("global", false, "--global: use the global environment")
shell := args.Bool("shell", false, "--shell: in a single-line for usage in command-line utilities [deprecated]")
export := args.Bool("export", false, "--export: print the env as eval-compatible exports [deprecated]")
merged := args.Bool("merged", false, "--merged: display the app's envionment merged with the global environment")
args.Parse(os.Args[2:])
config.CommandShow(args.Args(), *global, *shell, *export, *merged)
case "help":
fmt.Print(helpContent)
case "config:help":
usage()
default:
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
if err != nil {
fmt.Println("failed to retrieve DOKKU_NOT_IMPLEMENTED_EXIT environment variable")
dokkuNotImplementExitCode = 10
}
os.Exit(dokkuNotImplementExitCode)
}
}
func usage() {
config := columnize.DefaultConfig()
config.Delim = ","
config.Prefix = " "
config.Empty = ""
content := strings.Split(helpContent, "\n")[1:]
fmt.Println(helpHeader)
fmt.Println(columnize.Format(content, config))
}

View File

@@ -0,0 +1,16 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/config"
)
func main() {
args := flag.NewFlagSet("config:bundle", flag.ExitOnError)
global := args.Bool("global", false, "--global: use the global environment")
merged := args.Bool("merged", false, "--merged: merge app environment and global environment")
args.Parse(os.Args[2:])
config.CommandBundle(args.Args(), *global, *merged)
}

View File

@@ -0,0 +1,20 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/config"
)
// print the environment to stdout
func main() {
const defaultPrefix = "export "
const defaultSeparator = "\n"
args := flag.NewFlagSet("config:export", flag.ExitOnError)
global := args.Bool("global", false, "--global: use the global environment")
merged := args.Bool("merged", false, "--merged: merge app environment and global environment")
format := args.String("format", "exports", "--format: [ exports | envfile | docker-args | shell ] which format to export as)")
args.Parse(os.Args[2:])
config.CommandExport(args.Args(), *global, *merged, *format)
}

View File

@@ -0,0 +1,17 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/config"
)
// get the given entries from the specified environment
func main() {
args := flag.NewFlagSet("config:get", flag.ExitOnError)
global := args.Bool("global", false, "--global: use the global environment")
quoted := args.Bool("quoted", false, "--quoted: get the value quoted")
args.Parse(os.Args[2:])
config.CommandGet(args.Args(), *global, *quoted)
}

View File

@@ -0,0 +1,16 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/config"
)
func main() {
args := flag.NewFlagSet("config:keys", flag.ExitOnError)
global := args.Bool("global", false, "--global: use the global environment")
merged := args.Bool("merged", false, "--merged: merge app environment and global environment")
args.Parse(os.Args[2:])
config.CommandKeys(args.Args(), *global, *merged)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/config"
)
// set the given entries to the specified environment
func main() {
args := flag.NewFlagSet("config:set", flag.ExitOnError)
global := args.Bool("global", false, "--global: use the global environment")
encoded := args.Bool("encoded", false, "--encoded: interpret VALUEs as base64")
noRestart := args.Bool("no-restart", false, "--no-restart: no restart")
args.Parse(os.Args[2:])
config.CommandSet(args.Args(), *global, *noRestart, *encoded)
}

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