Compare commits
299 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b21f4b6470 | ||
|
|
c52f60f9d7 | ||
|
|
c815d732eb | ||
|
|
18849c085a | ||
|
|
cb62958095 | ||
|
|
4fcfad5df5 | ||
|
|
5101096518 | ||
|
|
afef3b94d5 | ||
|
|
73a84f90c5 | ||
|
|
918bc9efe8 | ||
|
|
98619733b2 | ||
|
|
2fb712c3a2 | ||
|
|
0fa6503034 | ||
|
|
fab97a377f | ||
|
|
811bf2f9c4 | ||
|
|
20497dabb4 | ||
|
|
0b430af077 | ||
|
|
e42e7c3694 | ||
|
|
eeef120433 | ||
|
|
8950571acb | ||
|
|
a72a82e29b | ||
|
|
b6adc23bdd | ||
|
|
8677aadad7 | ||
|
|
a4b8e59c3f | ||
|
|
3a5d0716d4 | ||
|
|
b54a5b3f67 | ||
|
|
5b33bd5eda | ||
|
|
6d55dd8884 | ||
|
|
0fae350256 | ||
|
|
90015ab594 | ||
|
|
28281ae4d4 | ||
|
|
4723b27f2c | ||
|
|
de338f4da5 | ||
|
|
d52eac7b35 | ||
|
|
4d01e677ee | ||
|
|
33daa88197 | ||
|
|
607a3d88ae | ||
|
|
be082e2fe0 | ||
|
|
27bd578405 | ||
|
|
0962ebeadb | ||
|
|
95d9ca8945 | ||
|
|
e71cd7a939 | ||
|
|
4bf301c913 | ||
|
|
0ea9e398bb | ||
|
|
2a6ea5d979 | ||
|
|
b8cde503c2 | ||
|
|
89c8e1c6a5 | ||
|
|
6c66e9850c | ||
|
|
fbcc8d8d6c | ||
|
|
e2bbdc968d | ||
|
|
ed7d5623ad | ||
|
|
217e491e59 | ||
|
|
101414dcd3 | ||
|
|
edda1e6567 | ||
|
|
dd7439095a | ||
|
|
9e3ae9c37c | ||
|
|
b1bd2c17a0 | ||
|
|
a939296981 | ||
|
|
23cfccf424 | ||
|
|
eae2876187 | ||
|
|
8730bbf0a9 | ||
|
|
1f5e5e5c14 | ||
|
|
e8b6e33934 | ||
|
|
9ee6c7aab6 | ||
|
|
22a8b914d2 | ||
|
|
dfab96c72e | ||
|
|
7c8fba8fc1 | ||
|
|
85f4023965 | ||
|
|
e9ee47a7c7 | ||
|
|
a7c6127f2b | ||
|
|
4e6a699140 | ||
|
|
f71644faf6 | ||
|
|
9a6306c53b | ||
|
|
83d98fb6fb | ||
|
|
c501574753 | ||
|
|
f0efdd2ed4 | ||
|
|
177b45c49b | ||
|
|
fc31b28ab6 | ||
|
|
e61475c7ea | ||
|
|
c92c0fce37 | ||
|
|
1a0c308b65 | ||
|
|
dffbad49b4 | ||
|
|
b6dffaabee | ||
|
|
8d83803763 | ||
|
|
85e5bd7c86 | ||
|
|
6e4f023a7b | ||
|
|
8fb817f93c | ||
|
|
49abdb1b5c | ||
|
|
bba368a32d | ||
|
|
eaccd8087c | ||
|
|
3c1fc4a7df | ||
|
|
c0027e5107 | ||
|
|
ed6a4426c7 | ||
|
|
e5a6cf48f7 | ||
|
|
dace6873df | ||
|
|
d01460f19a | ||
|
|
97e35e796c | ||
|
|
4de0e693ca | ||
|
|
01b30e083f | ||
|
|
7ba063c6bb | ||
|
|
0215e3ec91 | ||
|
|
91aa5255ec | ||
|
|
0d1c8deb57 | ||
|
|
06d2ffaa14 | ||
|
|
6ae948523b | ||
|
|
9aaf289fb8 | ||
|
|
367f6bd5e8 | ||
|
|
d9ff7c218d | ||
|
|
f5cce3c3a3 | ||
|
|
f1897c7a86 | ||
|
|
25e44b5492 | ||
|
|
b7dca68375 | ||
|
|
9bad0795e2 | ||
|
|
b7da215ab5 | ||
|
|
35acce84ea | ||
|
|
a7f32197f3 | ||
|
|
ac8aff1f00 | ||
|
|
e99e0b02d4 | ||
|
|
621b31839e | ||
|
|
3c5335056c | ||
|
|
30bf228dc9 | ||
|
|
e78a05d6fe | ||
|
|
4930003008 | ||
|
|
0153bc49bc | ||
|
|
48503e9f40 | ||
|
|
ef9b453aa8 | ||
|
|
f5552da8ac | ||
|
|
6124f2693b | ||
|
|
2bcad2014b | ||
|
|
7bbad9f074 | ||
|
|
a5ac4bb08b | ||
|
|
3b2bb2ebc6 | ||
|
|
40e4df7e78 | ||
|
|
41d3b258bb | ||
|
|
df6f7803d0 | ||
|
|
e870f844c6 | ||
|
|
68192dcdbf | ||
|
|
926cb51906 | ||
|
|
e518571f83 | ||
|
|
7586575cf8 | ||
|
|
31c9775ef4 | ||
|
|
30de268da7 | ||
|
|
1e387b3b42 | ||
|
|
94af35b3b9 | ||
|
|
a3989aafaa | ||
|
|
87feed08f5 | ||
|
|
86eca5af3a | ||
|
|
246e54a293 | ||
|
|
16ff22b457 | ||
|
|
f7a25eb480 | ||
|
|
51f5dbcf26 | ||
|
|
d79a79084e | ||
|
|
fe54718073 | ||
|
|
c1cef4f99e | ||
|
|
d36f874d0e | ||
|
|
b0c577ddd7 | ||
|
|
56b018b4c5 | ||
|
|
8bc7cdaaeb | ||
|
|
adf0a9ee74 | ||
|
|
ba7f9b8f87 | ||
|
|
a3ff9b53a8 | ||
|
|
0b897df462 | ||
|
|
b4899cdb21 | ||
|
|
2fbe5a418f | ||
|
|
8a6bce3745 | ||
|
|
b0777a44cb | ||
|
|
0c98a34094 | ||
|
|
088b7f360e | ||
|
|
54429a095c | ||
|
|
282979eef4 | ||
|
|
48653e5663 | ||
|
|
ec2e2bc4cc | ||
|
|
885aa47b18 | ||
|
|
225840b79d | ||
|
|
0e899cdd13 | ||
|
|
6906ead6ae | ||
|
|
e441594981 | ||
|
|
448b6e9ac1 | ||
|
|
a09560542b | ||
|
|
adc3b24ed7 | ||
|
|
4026291572 | ||
|
|
59f6ad9479 | ||
|
|
dd4960f1ce | ||
|
|
3b3eefcb73 | ||
|
|
cbcb720228 | ||
|
|
d73c07de68 | ||
|
|
cd3e637387 | ||
|
|
9614f7dca2 | ||
|
|
84fab30c09 | ||
|
|
cb71d8a0be | ||
|
|
507ae1de33 | ||
|
|
dcb88226b5 | ||
|
|
51217521e3 | ||
|
|
05bf33805f | ||
|
|
3506c100c7 | ||
|
|
8639d1768c | ||
|
|
779d281c57 | ||
|
|
815630ffe1 | ||
|
|
189366097e | ||
|
|
7c30babdec | ||
|
|
618395df5e | ||
|
|
ef7d913cd7 | ||
|
|
daa8faa3aa | ||
|
|
336ffc9b09 | ||
|
|
44b48a55a5 | ||
|
|
0de2c28c92 | ||
|
|
4f8bea8f35 | ||
|
|
aae7401888 | ||
|
|
96a0c2531d | ||
|
|
99378af668 | ||
|
|
9f9b3374bd | ||
|
|
2efcbcc9bb | ||
|
|
7cac755c98 | ||
|
|
0aeee7ea28 | ||
|
|
f393fa0442 | ||
|
|
f24e777921 | ||
|
|
c82c9562b6 | ||
|
|
d473c1635f | ||
|
|
33a7619eac | ||
|
|
dd517a3dd1 | ||
|
|
143b4802c3 | ||
|
|
a564eae9f1 | ||
|
|
83bf99c8d0 | ||
|
|
5173145653 | ||
|
|
1f0173ad7b | ||
|
|
bdb38ceaa8 | ||
|
|
bb0c587fff | ||
|
|
fec2f8e38e | ||
|
|
b0afcee389 | ||
|
|
33c9bc9908 | ||
|
|
e233e916aa | ||
|
|
eb5d4d0708 | ||
|
|
3a8e80c530 | ||
|
|
c72d7e0686 | ||
|
|
5b92085c29 | ||
|
|
4e7b1c77e3 | ||
|
|
e83f3e0011 | ||
|
|
b874692d06 | ||
|
|
b7511829ad | ||
|
|
f5f2a5f171 | ||
|
|
12500d7d3c | ||
|
|
927d569db5 | ||
|
|
eec41bf4e7 | ||
|
|
f0ecac5998 | ||
|
|
feaaf4f4b0 | ||
|
|
e09d093239 | ||
|
|
fc4b7ce0ee | ||
|
|
dbf0de9e65 | ||
|
|
8497bd6d70 | ||
|
|
67f05b8eed | ||
|
|
0f5dec1797 | ||
|
|
24c4f25dd0 | ||
|
|
ab93fefd5b | ||
|
|
e726bb1df8 | ||
|
|
a8abd40abe | ||
|
|
06fa58ff47 | ||
|
|
0de746da4e | ||
|
|
24552f2b9b | ||
|
|
90510378c8 | ||
|
|
a22f6596dc | ||
|
|
c216b3be7f | ||
|
|
6e00064cb3 | ||
|
|
594b41cc70 | ||
|
|
9272e40178 | ||
|
|
e107c19dbf | ||
|
|
13c78e8e9a | ||
|
|
5ddcf06ce9 | ||
|
|
70f3e3407f | ||
|
|
332c429e31 | ||
|
|
b23c602079 | ||
|
|
13ef76127d | ||
|
|
0e0012cca1 | ||
|
|
37a2edc558 | ||
|
|
2629be5651 | ||
|
|
815c612261 | ||
|
|
831fdeb030 | ||
|
|
bcfa60ae98 | ||
|
|
82c11a2b2c | ||
|
|
a967990be7 | ||
|
|
49b01143a0 | ||
|
|
eae3d463df | ||
|
|
58d774a316 | ||
|
|
f2a4f61920 | ||
|
|
1f47803324 | ||
|
|
0062227c57 | ||
|
|
010c89e810 | ||
|
|
0fed122a99 | ||
|
|
a574a6db1c | ||
|
|
45f8b8ccc8 | ||
|
|
d04b0f7cca | ||
|
|
4294793452 | ||
|
|
810ba72879 | ||
|
|
74db5b9d3b | ||
|
|
80e0bcc743 | ||
|
|
d001fcc896 | ||
|
|
8d60d071df | ||
|
|
608cdcf3c1 | ||
|
|
2e1d8def40 | ||
|
|
efa88d0087 |
@@ -14,3 +14,8 @@ indent_size = 4
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.go]
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
132
HISTORY.md
132
HISTORY.md
@@ -1,5 +1,133 @@
|
||||
# History
|
||||
|
||||
## 0.9.3
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2706: @josegonzalez fix: ensure nginx conf.d directory exists when running nginx install hook
|
||||
- #2701: @scjody Set SSH_USER for root commands
|
||||
|
||||
### New Features
|
||||
|
||||
- #2708: @josegonzalez Document that we will not do buildpack support in the issue tracker
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2709: @michaelshobbs increase CURL_TIMEOUT and CURL_CONNECT_TIMEOUT defaults
|
||||
- #2699: @mbreit Add support for git >= 2.11
|
||||
|
||||
## 0.9.2
|
||||
|
||||
### New Features
|
||||
|
||||
- #2698: @josegonzalez docs: Document that we only care about specific sections
|
||||
- #2697: @callahad Restore installer note regarding AUFS on Linode
|
||||
- #2694: @scjody Add documentation note re: git-pre-pull vs. auth
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2695: @michaelshobbs add tests for pre/post deploy tasks
|
||||
|
||||
## 0.9.1
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2693: @josegonzalez fix: explicitly chown data and data/storage directories
|
||||
|
||||
## 0.9.0
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2691: @josegonzalez Fix package building when golang binaries are available
|
||||
- #2671: @znz Fix variable name
|
||||
- #2672: @callahad Fix logrotate on Debian
|
||||
- #2666: @josegonzalez Use correct flag for build arguments when installing herokuish
|
||||
- #2664: @pvalentim Fix remote name when using --remote option with apps:create
|
||||
|
||||
### New Features
|
||||
|
||||
- #2689: @mbreit Add dokku-monit to community plugin list
|
||||
- #2683: @josegonzalez Ensure we have an example for adding keys as another user
|
||||
- #2682: @josegonzalez Clarify supported stanzas in app.json
|
||||
- #2679: @callahad Remove unnecessary Linode-specific instructions
|
||||
- #2670: @znz Remove duplicated `(i.e. `
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2685: @josegonzalez Pass shellcheck on os x
|
||||
- #2677: @callahad Prefer HTTP2 to SPDY in nginx-vhosts
|
||||
- #2673: @michaelshobbs Update to herokuish 0.3.27
|
||||
- #2674: @michaelshobbs Update sshcommand to 0.7.0
|
||||
- #2654: @ebeigarts Enable nginx and docker on system startup when using bootstrap.sh on CentOS
|
||||
- #2546: @michaelshobbs Convert repo plugin to golang
|
||||
|
||||
## 0.8.2
|
||||
|
||||
### New Features
|
||||
|
||||
- #2660: @josegonzalez allow installation of plugins via tarball
|
||||
- #2661: @josegonzalez Do not run builds in quiet mode
|
||||
|
||||
## 0.8.1
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- #2519: @tkalus Further guard against duplicate ssl server names
|
||||
- #2554: @josegonzalez Add ssl ports when generating a self-signed certificate
|
||||
- #2555: @josegonzalez Skip failing applications when running ps:restore on boot
|
||||
- #2576: @znz Remove unused variable
|
||||
- #2592: @josegonzalez always set a default ssl port for apps with ssl enabled
|
||||
- #2612: @josegonzalez Ensure VHOST files exist before executing commands against them
|
||||
- #2647: @josegonzalez Properly escape post-install variables
|
||||
- #2650: @josegonzalez Fix help output for nginx and ssh-keys
|
||||
- #2656: @josegonzalez ensure we can call the report subcommand without an app while specifying flags
|
||||
- d79a79: @josegonzalez bail early when checking ps output for an undeployed app
|
||||
|
||||
### New Features
|
||||
|
||||
- #2500: @josegonzalez Suppress output unless the `git submodule update` call fails
|
||||
- #2504: @mbtamuli Implement apps:report and storage:report
|
||||
- #2508: @OmarShehata Add default functions for all commands
|
||||
- #2557: @josegonzalez Dokku cli improvements
|
||||
- #2573: @ebeigarts Recommend parallel package for faster ps:restore
|
||||
- #2578: @josegonzalez Require specific versions for dokku-maintained packages
|
||||
- #2583: @josegonzalez Implement apps:clone subcommand
|
||||
- #2586: @bevand10 Add http-proxy support for deb-herokuish installs
|
||||
- #2587: @josegonzalez Allow specifying the deploy branch via DOKKU_DEPLOY_BRANCH
|
||||
- #2594: @michaelshobbs Upgrade to herokuish v0.3.25
|
||||
- #2615: @josegonzalez Implement certs:report
|
||||
- #2616: @josegonzalez Replace apps:default subcommand with apps:list
|
||||
- #2617: @josegonzalez Implement checks:report
|
||||
- #2618: @josegonzalez Implement docker-options:report and storage:report
|
||||
- #2619: @josegonzalez Call ssh-keys:help from ssh-keys:default
|
||||
- #2620: @josegonzalez Implement domains:report and proxy:report
|
||||
- #2622: @raphaklaus Allow file names with multiple dots in certs:add command
|
||||
- #2634: @michaelshobbs Update herokuish to 0.3.26
|
||||
- #2657: @josegonzalez Add post-extract plugin trigger
|
||||
|
||||
### Documentation
|
||||
|
||||
- #2475: @pranavgoel25 Minor readme and sponsor changes
|
||||
- #2556: @josegonzalez Use slightly better font style for docs
|
||||
- #2560: @ebeigarts Improve install documentation on CentOS
|
||||
- #2564: @ka7 Fix spelling mistakes
|
||||
- #2565: @josegonzalez Update persistent storage to reference the sample app as normal
|
||||
- #2566: @josegonzalez Move "new as of" note in storage docs to correct section
|
||||
- #2569: @OmgImAlexis Reload nginx after adding default vhost file
|
||||
- #2570: @OmgImAlexis Update ISSUE_TEMPLATE.md to reference `dokku report` command
|
||||
- #2580: @znz Fix font URL
|
||||
- #2588: @josegonzalez Clarify when the `~/.ssh/config` settings need to match `vagrant ssh-config output`
|
||||
- #2605: @andyjeffries Documented build failures when using SSL_CERT_FILE environment variable
|
||||
- #2613: @emveeoh Update Linode installation instructions for new GRUB 2 Linode boot option
|
||||
- #2626: @znz Update apps:help example command
|
||||
- #2629: @znz Update certs:help output for certs:default subcommand
|
||||
- #2633: @drpoggi Reference the x-forwarded headers in correct order
|
||||
- #2637: @josegonzalez Add documentation surrounding flags that ps:report accepts
|
||||
- #2638: @fwolfst Improve README links
|
||||
- #2639: @joshco Add documentation for how to grant other Unix accounts Dokku access
|
||||
- #2648: @josegonzalez Note that the remote username is important
|
||||
- #2659: @jfw Minor clarifications to application deployment tutorial
|
||||
|
||||
## 0.8.0
|
||||
|
||||
The big kahuna. Lots of documentation changes, and a few bug fixes to make Dokku development a bit easier.
|
||||
@@ -1024,7 +1152,7 @@ Thanks to the *many* contributors for making this release our best release so fa
|
||||
- #1473: @josegonzalez Handle crashing containers by using restart=on-failure policy
|
||||
- #1476: @michaelshobbs Support static nginx port when deploying without an application VHOST
|
||||
- #1476: nginx proxy without VHOST
|
||||
- #1477: @arthurschreiber Support removing config variables that contain `\n`.
|
||||
- #1477: @arthurschreiber Support removing config variables containing newlines.
|
||||
|
||||
### Documentation
|
||||
|
||||
@@ -1170,7 +1298,7 @@ This release pegs Dokku to Docker 1.6.2. Docker 1.7.0 introduced changes in `doc
|
||||
|
||||
### New Features
|
||||
|
||||
- #1245: @arthurschreiber Support config variables containing `\n`
|
||||
- #1245: @arthurschreiber Support config variables containing newlines
|
||||
- #1257: @josegonzalez Split nginx ssl logs by $APP
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
> If you need help figuring out how to use a specific buildpack, or are having issues using multiple buildpacks, please see our [irc or slack channels](http://dokku.viewdocs.io/dokku/getting-started/where-to-get-help/#the-irc-and-slack-channels). Issues pertaining to buildpacks may be closed and locked.
|
||||
|
||||
Description of problem:
|
||||
|
||||
|
||||
Output of the following commands
|
||||
|
||||
<!-- If you're running 0.4.10+ just use dokku report-->
|
||||
|
||||
- `uname -a`:
|
||||
- `free -m`:
|
||||
- `docker version`:
|
||||
|
||||
30
Makefile
30
Makefile
@@ -1,13 +1,14 @@
|
||||
DOKKU_VERSION ?= master
|
||||
|
||||
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v0.6.0/sshcommand
|
||||
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v0.2.2/plugn_0.2.2_linux_x86_64.tgz
|
||||
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
|
||||
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
|
||||
DOKKU_LIB_ROOT ?= /var/lib/dokku
|
||||
PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/plugins
|
||||
CORE_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/core-plugins
|
||||
PLUGIN_MAKE_TARGET ?= build-in-docker
|
||||
|
||||
# If the first argument is "vagrant-dokku"...
|
||||
ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
||||
@@ -23,7 +24,9 @@ else
|
||||
BUILD_STACK_TARGETS = build-in-docker
|
||||
endif
|
||||
|
||||
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
include common.mk
|
||||
|
||||
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku go-build
|
||||
|
||||
include tests.mk
|
||||
include deb.mk
|
||||
@@ -50,7 +53,24 @@ package_cloud:
|
||||
packer:
|
||||
packer build contrib/packer.json
|
||||
|
||||
go-build:
|
||||
basedir=$(PWD); \
|
||||
for dir in plugins/*; do \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -e -C $$dir $(PLUGIN_MAKE_TARGET) || exit $$? ;\
|
||||
fi ;\
|
||||
done
|
||||
|
||||
go-clean:
|
||||
basedir=$(PWD); \
|
||||
for dir in plugins/*; do \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -e -C $$dir clean ;\
|
||||
fi ;\
|
||||
done
|
||||
|
||||
copyfiles:
|
||||
$(MAKE) go-build || exit 1
|
||||
cp dokku /usr/local/bin/dokku
|
||||
mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH}
|
||||
rm -rf ${CORE_PLUGINS_PATH}/*
|
||||
@@ -62,11 +82,15 @@ copyfiles:
|
||||
rm -rf ${CORE_PLUGINS_PATH}/$$plugin && \
|
||||
rm -rf ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${CORE_PLUGINS_PATH}/available && \
|
||||
rm -rf ${CORE_PLUGINS_PATH}/available/$$plugin/src && \
|
||||
ln -s ${CORE_PLUGINS_PATH}/available/$$plugin ${PLUGINS_PATH}/available; \
|
||||
find /var/lib/dokku/ -xtype l -delete;\
|
||||
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\
|
||||
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\
|
||||
done
|
||||
done
|
||||
ifndef SKIP_GO_CLEAN
|
||||
$(MAKE) go-clean
|
||||
endif
|
||||
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true
|
||||
$(MAKE) addman
|
||||
|
||||
|
||||
82
README.md
82
README.md
@@ -1,43 +1,16 @@
|
||||
# Dokku [](https://circleci.com/gh/dokku/dokku/tree/master) [](https://packagecloud.io/dokku/dokku) [](https://aur.archlinux.org/packages/dokku/) [](https://webchat.freenode.net/?channels=dokku) [](https://glider-slackin.herokuapp.com/) [](http://dokku.viewdocs.io/dokku/)
|
||||
# Dokku
|
||||
[](https://circleci.com/gh/dokku/dokku/tree/master)
|
||||
[](https://packagecloud.io/dokku/dokku)
|
||||
[](https://aur.archlinux.org/packages/dokku/)
|
||||
[](https://webchat.freenode.net/?channels=dokku)
|
||||
[](https://glider-slackin.herokuapp.com/)
|
||||
[](http://dokku.viewdocs.io/dokku/)
|
||||
[](#sponsors)
|
||||
[](#backers)
|
||||
[](https://gratipay.com/dokku/)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
|
||||
|
||||
## Requirements
|
||||
|
||||
- A fresh VM running `Debian 8.2 x64`, `Ubuntu 14.04 x64`, or `Ubuntu 16.04 x64`
|
||||
|
||||
## Installing
|
||||
|
||||
To install the latest stable release, you can run the following commands as a user that has access to `sudo`:
|
||||
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh;
|
||||
sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh
|
||||
|
||||
You can then proceed to the ip address or domain name associated with your server to complete the web-based installation.
|
||||
|
||||
If you wish for a more unattended installation method, see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs.
|
||||
|
||||
### Upgrading
|
||||
|
||||
[View the docs for upgrading](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) from an older version of Dokku.
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation - including advanced installation docs - are available online at [docs](http://dokku.viewdocs.io/dokku/)
|
||||
|
||||
## Support
|
||||
|
||||
You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku)
|
||||
|
||||
## Contribution
|
||||
|
||||
After checking [Github Issues](https://github.com/dokku/dokku/issues), the [Troubleshooting Guide](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request.
|
||||
|
||||
While we may not merge your PR as is, they serve to start conversations and improve the general Dokku experience for all users.
|
||||
|
||||
## Sponsors
|
||||
|
||||
See our list of past sponsors in the [SPONSORS](https://github.com/dokku/dokku/blob/master/SPONSORS.md) file.
|
||||
@@ -111,6 +84,47 @@ Support us with a monthly donation and help us continue our activities. [[Become
|
||||
<a href="https://opencollective.com/dokku/backer/28/website" target="_blank"><img src="https://opencollective.com/dokku/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/dokku/backer/29/website" target="_blank"><img src="https://opencollective.com/dokku/backer/29/avatar.svg"></a>
|
||||
|
||||
## Requirements
|
||||
|
||||
A fresh VM running any of the following operating systems:
|
||||
|
||||
- Ubuntu 16.04 x64
|
||||
- Ubuntu 14.04 x64
|
||||
- Debian 8.2 x64
|
||||
- CentOS 7 x64 *(experimental)*
|
||||
- Arch Linux x64 *(experimental)*
|
||||
|
||||
## Installation
|
||||
|
||||
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.9.3/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.9.3 bash bootstrap.sh
|
||||
```
|
||||
|
||||
You can then proceed to the ip address or domain name associated with your server to complete the web-based installation.
|
||||
|
||||
If you wish for a more unattended installation method, see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs.
|
||||
|
||||
### Upgrade
|
||||
|
||||
[View the docs](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) for upgrading from an older version of Dokku.
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation - including advanced installation docs - are available online at [http://dokku.viewdocs.io/dokku/](http://dokku.viewdocs.io/dokku/).
|
||||
|
||||
## Support
|
||||
|
||||
You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku).
|
||||
|
||||
## Contribution
|
||||
|
||||
After checking [Github Issues](https://github.com/dokku/dokku/issues), the [Troubleshooting Guide](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request.
|
||||
|
||||
While we may not merge your PR as is, they serve to start conversations and improve the general Dokku experience for all users.
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](https://github.com/dokku/dokku/blob/master/LICENSE) © Jeff Lindsay
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#Sponsors
|
||||
|
||||
[Deis](http://deis.io)
|
||||
|
||||
[DigitalOcean](https://www.digitalocean.com/)
|
||||
|
||||
@@ -118,8 +118,8 @@ install-dokku-from-deb-package() {
|
||||
|
||||
echo "--> Installing docker"
|
||||
if uname -r | grep -q linode; then
|
||||
echo "--> NOTE: Using Linode? Docker might complain about missing AUFS support."
|
||||
echo " See http://dokku.viewdocs.io/dokku/getting-started/install/linode/"
|
||||
echo "--> NOTE: Using Linode? Docker may complain about missing AUFS support."
|
||||
echo " You can safely ignore this warning."
|
||||
echo " Installation will continue in 10 seconds."
|
||||
sleep 10
|
||||
fi
|
||||
@@ -167,6 +167,10 @@ install-dokku-from-rpm-package() {
|
||||
yum -y install herokuish dokku
|
||||
fi
|
||||
|
||||
echo "--> Enabling docker and nginx on system startup"
|
||||
systemctl enable docker
|
||||
systemctl enable nginx
|
||||
|
||||
echo "--> Starting nginx"
|
||||
systemctl start nginx
|
||||
}
|
||||
|
||||
4
common.mk
Normal file
4
common.mk
Normal file
@@ -0,0 +1,4 @@
|
||||
GO_REPO_ROOT := /go/src/github.com/dokku/dokku
|
||||
BUILD_IMAGE := golang:1.7.5
|
||||
|
||||
.PHONY: build-in-docker build clean src-clean
|
||||
@@ -1,34 +0,0 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get -qq -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
|
||||
|
||||
WORKDIR /dokku
|
||||
|
||||
COPY Makefile /dokku/
|
||||
|
||||
COPY *.mk /dokku/
|
||||
|
||||
RUN make deb-setup rpm-setup
|
||||
|
||||
COPY . /dokku
|
||||
|
||||
RUN make sshcommand plugn version copyfiles
|
||||
|
||||
ARG DOKKU_VERSION=master
|
||||
ENV DOKKU_VERSION ${DOKKU_VERSION}
|
||||
|
||||
ARG DOKKU_GIT_REV
|
||||
ENV DOKKU_GIT_REV ${DOKKU_GIT_REV}
|
||||
|
||||
ARG IS_RELEASE=false
|
||||
ENV IS_RELEASE ${IS_RELEASE}
|
||||
|
||||
RUN make rpm-herokuish rpm-dokku rpm-plugn rpm-sshcommand rpm-sigil
|
||||
|
||||
RUN mkdir -p /data && cp /tmp/*.rpm /data && ls /data/
|
||||
@@ -1,34 +0,0 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get -qq -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
|
||||
|
||||
WORKDIR /dokku
|
||||
|
||||
COPY Makefile /dokku/
|
||||
|
||||
COPY *.mk /dokku/
|
||||
|
||||
RUN make deb-setup rpm-setup
|
||||
|
||||
COPY . /dokku
|
||||
|
||||
RUN make sshcommand plugn version copyfiles
|
||||
|
||||
ARG DOKKU_VERSION=master
|
||||
ENV DOKKU_VERSION ${DOKKU_VERSION}
|
||||
|
||||
ARG DOKKU_GIT_REV
|
||||
ENV DOKKU_GIT_REV ${DOKKU_GIT_REV}
|
||||
|
||||
ARG IS_RELEASE=false
|
||||
ENV IS_RELEASE ${IS_RELEASE}
|
||||
|
||||
RUN make deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil
|
||||
|
||||
RUN mkdir -p /data && cp /tmp/*.deb /data && ls /data/
|
||||
44
contrib/build.Dockerfile
Normal file
44
contrib/build.Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
||||
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 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
|
||||
|
||||
ARG WORKDIR=/go/src/github.com/dokku/dokku
|
||||
|
||||
WORKDIR ${WORKDIR}
|
||||
|
||||
COPY Makefile ${WORKDIR}/
|
||||
COPY *.mk ${WORKDIR}/
|
||||
|
||||
RUN make deb-setup rpm-setup sshcommand plugn
|
||||
|
||||
COPY . ${WORKDIR}
|
||||
|
||||
ARG PLUGIN_MAKE_TARGET
|
||||
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} \
|
||||
DOKKU_VERSION=${DOKKU_VERSION} \
|
||||
DOKKU_GIT_REV=${DOKKU_GIT_REV} \
|
||||
IS_RELEASE=${IS_RELEASE} \
|
||||
SKIP_GO_CLEAN=true \
|
||||
make version copyfiles \
|
||||
&& rm -rf plugins/common/*.go plugins/common/glide* plugins/common/vendor/ \
|
||||
&& make deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil \
|
||||
rpm-herokuish rpm-dokku rpm-plugn rpm-sshcommand rpm-sigil
|
||||
|
||||
RUN mkdir -p /data \
|
||||
&& cp /tmp/*.deb /data \
|
||||
&& cp /tmp/*.rpm /data \
|
||||
&& ls -lha /data/
|
||||
@@ -10,7 +10,7 @@ import subprocess
|
||||
import sys
|
||||
import threading
|
||||
|
||||
VERSION = 'v0.8.0'
|
||||
VERSION = 'v0.9.3'
|
||||
|
||||
hostname = ''
|
||||
try:
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
export DOKKU_PORT=${DOKKU_PORT:=22}
|
||||
export DOKKU_HOST=${DOKKU_HOST:=}
|
||||
|
||||
MOVES=(ABLE ABNORMA AGAIN AIREXPL ANG ANGER ASAIL ATTACK AURORA AWL BAN BAND BARE BEAT BEATED BELLY BIND BITE BLOC BLOOD BODY BOOK BREATH BUMP CAST CHAM CLAMP CLAP CLAW CLEAR CLI CLIP CLOUD CONTRO CONVY COOLHIT CRASH CRY CUT DESCRI D-FIGHT DIG DITCH DIV DOZ DRE DUL DU-PIN DYE EARTH EDU EG-BOMB EGG ELEGY ELE-HIT EMBODY EMPLI ENGL ERUPT EVENS EXPLOR EYES FALL FAST F-CAR F-DANCE FEARS F-FIGHT FIGHT FIR FIRE FIREHIT FLAME FLAP FLASH FLEW FORCE FRA FREEZE FROG G-BIRD GENKISS GIFT G-KISS G-MOUSE GRADE GROW HAMMER HARD HAT HATE H-BOMB HELL-R HEMP HINT HIT HU HUNT HYPNOSI INHA IRO IRONBAR IR-WING J-GUN KEE KICK KNIF KNIFE KNOCK LEVEL LIGH LIGHHIT LIGHT LIVE L-WALL MAD MAJUS MEL MELO MESS MILK MIMI MISS MIXING MOVE MUD NI-BED NOISY NOONLI NULL N-WAVE PAT PEACE PIN PLAN PLANE POIS POL POWDE POWE POWER PRIZE PROTECT PROUD RAGE RECOR REFLAC REFREC REGR RELIV RENEW R-FIGHT RING RKICK ROCK ROUND RUS RUSH SAND SAW SCISSOR SCRA SCRIPT SEEN SERVER SHADOW SHELL SHINE SHO SIGHT SIN SMALL SMELT SMOK SNAKE SNO SNOW SOU SO-WAVE SPAR SPEC SPID S-PIN SPRA STAM STARE STEA STONE STORM STRU STRUG STUDEN SUBS SUCID SUN-LIG SUNRIS SUPLY S-WAVE TAILS TANGL TASTE TELLI THANK TONKICK TOOTH TORL TRAIN TRIKICK TUNGE VOLT WA-GUN WATCH WAVE W-BOMB WFALL WFING WHIP WHIRL WIND WOLF WOOD WOR YUJA)
|
||||
NAMES=(SEED GRASS FLOWE SHAD CABR SNAKE GOLD COW GUIKI PEDAL DELAN B-FLY BIDE KEYU FORK LAP PIGE PIJIA CAML LAT BIRD BABOO VIV ABOKE PIKAQ RYE SAN BREAD LIDEL LIDE PIP PIKEX ROK JUGEN PUD BUDE ZHIB GELU GRAS FLOW LAFUL ATH BALA CORN MOLUF DESP DAKED MIMI BOLUX KODA GELUD MONK SUMOY GEDI WENDI NILEM NILE NILEC KEZI YONGL HUDE WANLI GELI GUAIL MADAQ WUCI WUCI MUJEF JELLY SICIB GELU NELUO BOLI JIALE YED YEDE CLO SCARE AOCO DEDE DEDEI BAWU JIUG BADEB BADEB HOLE BALUX GES FANT QUAR YIHE SWAB SLIPP CLU DEPOS BILIY YUANO SOME NO YELA EMPT ZECUN XIAHE BOLEL DEJI MACID XIHON XITO LUCK MENJI GELU DECI XIDE DASAJ DONGN RICUL MINXI BALIY ZENDA LUZEL HELE5 0FENB KAIL JIAND CARP JINDE LAPU MUDE YIFU LINLI SANDI HUSI JINC OUMU OUMUX CAP KUIZA PUD TIAO FRMAN CLAU SPARK DRAGO BOLIU GUAIL MIYOU MIY QIAOK BEIL MUKEI RIDED MADAM BAGEP CROC ALIGE OUDAL OUD DADA HEHE YEDEA NUXI NUXIN ROUY ALIAD STICK QIANG LAAND PIQI PI PUPI DEKE DEKEJ NADI NADIO MALI PEA ELECT FLOWE MAL MALI HUSHU NILEE YUZI POPOZ DUZI HEBA XIAN SHAN YEYEA WUY LUO KEFE HULA CROW YADEH MOW ANNAN SUONI KYLI HULU HUDEL YEHE GULAE YEHE BLU GELAN BOAT NIP POIT HELAK XINL BEAR LINB MAGEH MAGEJ WULI YIDE RIVE FISH AOGU DELIE MANTE KONMU DELU HELU HUAN HUMA DONGF JINCA HEDE DEFU LIBY JIAPA MEJI HELE BUHU MILK HABI THUN GARD DON YANGQ SANAQ BANQ LUJ PHIX SIEI EGG)
|
||||
|
||||
random_number() {
|
||||
fn-random-number() {
|
||||
[[ -n "$1" ]] && RANGE="$1"
|
||||
if [[ -n "$RANGE" ]]; then
|
||||
number=$RANDOM
|
||||
@@ -15,94 +14,141 @@ random_number() {
|
||||
echo $number
|
||||
}
|
||||
|
||||
random_name() {
|
||||
NUM1=$(random_number ${#MOVES[@]})
|
||||
NUM2=$(random_number ${#MOVES[@]})
|
||||
NUM3=$(random_number ${#NAMES[@]})
|
||||
fn-random-name() {
|
||||
local NUM1 NUM2 NUM3 UPPER_APPNAME lower_appname
|
||||
local MOVES=(ABLE ABNORMA AGAIN AIREXPL ANG ANGER ASAIL ATTACK AURORA AWL BAN BAND BARE BEAT BEATED BELLY BIND BITE BLOC BLOOD BODY BOOK BREATH BUMP CAST CHAM CLAMP CLAP CLAW CLEAR CLI CLIP CLOUD CONTRO CONVY COOLHIT CRASH CRY CUT DESCRI D-FIGHT DIG DITCH DIV DOZ DRE DUL DU-PIN DYE EARTH EDU EG-BOMB EGG ELEGY ELE-HIT EMBODY EMPLI ENGL ERUPT EVENS EXPLOR EYES FALL FAST F-CAR F-DANCE FEARS F-FIGHT FIGHT FIR FIRE FIREHIT FLAME FLAP FLASH FLEW FORCE FRA FREEZE FROG G-BIRD GENKISS GIFT G-KISS G-MOUSE GRADE GROW HAMMER HARD HAT HATE H-BOMB HELL-R HEMP HINT HIT HU HUNT HYPNOSI INHA IRO IRONBAR IR-WING J-GUN KEE KICK KNIF KNIFE KNOCK LEVEL LIGH LIGHHIT LIGHT LIVE L-WALL MAD MAJUS MEL MELO MESS MILK MIMI MISS MIXING MOVE MUD NI-BED NOISY NOONLI NULL N-WAVE PAT PEACE PIN PLAN PLANE POIS POL POWDE POWE POWER PRIZE PROTECT PROUD RAGE RECOR REFLAC REFREC REGR RELIV RENEW R-FIGHT RING RKICK ROCK ROUND RUS RUSH SAND SAW SCISSOR SCRA SCRIPT SEEN SERVER SHADOW SHELL SHINE SHO SIGHT SIN SMALL SMELT SMOK SNAKE SNO SNOW SOU SO-WAVE SPAR SPEC SPID S-PIN SPRA STAM STARE STEA STONE STORM STRU STRUG STUDEN SUBS SUCID SUN-LIG SUNRIS SUPLY S-WAVE TAILS TANGL TASTE TELLI THANK TONKICK TOOTH TORL TRAIN TRIKICK TUNGE VOLT WA-GUN WATCH WAVE W-BOMB WFALL WFING WHIP WHIRL WIND WOLF WOOD WOR YUJA)
|
||||
local NAMES=(SEED GRASS FLOWE SHAD CABR SNAKE GOLD COW GUIKI PEDAL DELAN B-FLY BIDE KEYU FORK LAP PIGE PIJIA CAML LAT BIRD BABOO VIV ABOKE PIKAQ RYE SAN BREAD LIDEL LIDE PIP PIKEX ROK JUGEN PUD BUDE ZHIB GELU GRAS FLOW LAFUL ATH BALA CORN MOLUF DESP DAKED MIMI BOLUX KODA GELUD MONK SUMOY GEDI WENDI NILEM NILE NILEC KEZI YONGL HUDE WANLI GELI GUAIL MADAQ WUCI WUCI MUJEF JELLY SICIB GELU NELUO BOLI JIALE YED YEDE CLO SCARE AOCO DEDE DEDEI BAWU JIUG BADEB BADEB HOLE BALUX GES FANT QUAR YIHE SWAB SLIPP CLU DEPOS BILIY YUANO SOME NO YELA EMPT ZECUN XIAHE BOLEL DEJI MACID XIHON XITO LUCK MENJI GELU DECI XIDE DASAJ DONGN RICUL MINXI BALIY ZENDA LUZEL HELE5 0FENB KAIL JIAND CARP JINDE LAPU MUDE YIFU LINLI SANDI HUSI JINC OUMU OUMUX CAP KUIZA PUD TIAO FRMAN CLAU SPARK DRAGO BOLIU GUAIL MIYOU MIY QIAOK BEIL MUKEI RIDED MADAM BAGEP CROC ALIGE OUDAL OUD DADA HEHE YEDEA NUXI NUXIN ROUY ALIAD STICK QIANG LAAND PIQI PI PUPI DEKE DEKEJ NADI NADIO MALI PEA ELECT FLOWE MAL MALI HUSHU NILEE YUZI POPOZ DUZI HEBA XIAN SHAN YEYEA WUY LUO KEFE HULA CROW YADEH MOW ANNAN SUONI KYLI HULU HUDEL YEHE GULAE YEHE BLU GELAN BOAT NIP POIT HELAK XINL BEAR LINB MAGEH MAGEJ WULI YIDE RIVE FISH AOGU DELIE MANTE KONMU DELU HELU HUAN HUMA DONGF JINCA HEDE DEFU LIBY JIAPA MEJI HELE BUHU MILK HABI THUN GARD DON YANGQ SANAQ BANQ LUJ PHIX SIEI EGG)
|
||||
|
||||
UPPER_APPNAME="${MOVES[${NUM1}]}-${MOVES[${NUM2}]}-${NAMES[${NUM3}]}"
|
||||
NUM1=$(fn-random-number ${#MOVES[@]})
|
||||
NUM2=$(fn-random-number ${#MOVES[@]})
|
||||
NUM3=$(fn-random-number ${#NAMES[@]})
|
||||
|
||||
[[ "$BASH_VERSION" =~ 4.* ]] && lower_appname=${UPPER_APPNAME,,}
|
||||
[[ -z "$lower_appname" ]] && lower_appname=$(echo "$UPPER_APPNAME" | tr '[:upper:]' '[:lower:]')
|
||||
echo "$lower_appname"
|
||||
UPPER_APPNAME="${MOVES[${NUM1}]}-${MOVES[${NUM2}]}-${NAMES[${NUM3}]}"
|
||||
|
||||
[[ "$BASH_VERSION" =~ 4.* ]] && lower_appname=${UPPER_APPNAME,,}
|
||||
[[ -z "$lower_appname" ]] && lower_appname=$(echo "$UPPER_APPNAME" | tr '[:upper:]' '[:lower:]')
|
||||
echo "$lower_appname"
|
||||
}
|
||||
|
||||
client_help_msg() {
|
||||
echo "==> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku"
|
||||
echo "--> i.e. git remote add dokku dokku@<dokku-host>:<app-name>"
|
||||
fn-client-help-msg() {
|
||||
echo "==> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku" 1>&2
|
||||
echo "--> i.e. git remote add dokku dokku@<dokku-host>:<app-name>" 1>&2
|
||||
exit 20 # exit with specific status. only used in units tests for now
|
||||
}
|
||||
|
||||
is_git_repo() {
|
||||
git rev-parse &>/dev/null
|
||||
fn-is-git-repo() {
|
||||
git rev-parse &>/dev/null
|
||||
}
|
||||
|
||||
has_dokku_remote() {
|
||||
git remote show | grep dokku
|
||||
fn-has-dokku-remote() {
|
||||
git remote show | grep -E "^${DOKKU_GIT_REMOTE}\s"
|
||||
}
|
||||
|
||||
if [[ -z $DOKKU_HOST ]]; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
|
||||
else
|
||||
client_help_msg
|
||||
fn-dokku-host() {
|
||||
declare DOKKU_GIT_REMOTE="$1" DOKKU_HOST="$2"
|
||||
|
||||
if [[ -z "$DOKKU_HOST" ]]; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
export DOKKU_PORT=${DOKKU_PORT:=22}
|
||||
if [[ -z "$DOKKU_HOST" ]]; then
|
||||
fn-client-help-msg
|
||||
fi
|
||||
|
||||
if [[ ! -z $DOKKU_HOST ]]; then
|
||||
_dokku() {
|
||||
appname=""
|
||||
echo "$DOKKU_HOST"
|
||||
}
|
||||
|
||||
main() {
|
||||
declare CMD="$1" APP_ARG="$2"
|
||||
local APP="" DOKKU_GIT_REMOTE="dokku" DOKKU_REMOTE_HOST=""
|
||||
local cmd_set=false next_index=1 skip=false args=("$@")
|
||||
|
||||
for arg in "$@"; do
|
||||
if [[ "$skip" == "true" ]]; then
|
||||
next_index=$(( next_index + 1 ))
|
||||
skip=false
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ "$arg" == "--app" ]]; then
|
||||
APP=${args[$next_index]}
|
||||
skip=true
|
||||
shift 2
|
||||
elif [[ "$arg" == "--remote" ]]; then
|
||||
DOKKU_GIT_REMOTE=${args[$next_index]}
|
||||
skip=true
|
||||
shift 2
|
||||
elif [[ "$arg" =~ ^--.* ]]; then
|
||||
[[ "$cmd_set" == "true" ]] && APP_ARG="$arg" && break
|
||||
[[ "$arg" == "--trace" ]] && export DOKKU_TRACE=1 && set -x
|
||||
else
|
||||
if [[ "$cmd_set" == "true" ]]; then
|
||||
APP_ARG="$arg"
|
||||
break
|
||||
else
|
||||
CMD="$arg"
|
||||
cmd_set=true
|
||||
fi
|
||||
fi
|
||||
next_index=$(( next_index + 1 ))
|
||||
done
|
||||
|
||||
DOKKU_REMOTE_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")"
|
||||
|
||||
if [[ -z "$APP" ]]; then
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
set +e
|
||||
appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
APP=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_REMOTE_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
set -e
|
||||
else
|
||||
echo "This is not a git repository"
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
apps:create)
|
||||
if [[ -z "$2" ]]; then
|
||||
appname=$(random_name)
|
||||
counter=0
|
||||
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do
|
||||
if [[ $counter -ge 100 ]]; then
|
||||
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
|
||||
ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps
|
||||
exit 1
|
||||
else
|
||||
appname=$(random_name)
|
||||
counter=$((counter+1))
|
||||
fi
|
||||
done
|
||||
else
|
||||
appname="$2"
|
||||
fi
|
||||
if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then
|
||||
echo "-----> Dokku remote added at $DOKKU_HOST"
|
||||
echo "-----> Application name is $appname"
|
||||
else
|
||||
echo "! Dokku remote not added! Do you already have a dokku remote?"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
apps:destroy)
|
||||
is_git_repo && has_dokku_remote && git remote remove dokku
|
||||
;;
|
||||
esac
|
||||
|
||||
[[ -n "$@" ]] && [[ -n "$appname" ]] && app_arg="--app $appname"
|
||||
# echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@"
|
||||
# shellcheck disable=SC2068,SC2086
|
||||
ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@
|
||||
}
|
||||
|
||||
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then
|
||||
_dokku "$@"
|
||||
exit $?
|
||||
fi
|
||||
else
|
||||
client_help_msg
|
||||
|
||||
case "$CMD" in
|
||||
apps:create)
|
||||
if [[ -z "$APP_ARG" ]]; then
|
||||
APP=$(fn-random-name)
|
||||
counter=0
|
||||
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps 2>/dev/null| grep -q "$APP"; do
|
||||
if [[ $counter -ge 100 ]]; then
|
||||
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
|
||||
ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps
|
||||
exit 1
|
||||
else
|
||||
APP=$(random_name)
|
||||
counter=$((counter+1))
|
||||
fi
|
||||
done
|
||||
else
|
||||
APP="$APP_ARG"
|
||||
fi
|
||||
if git remote add "$DOKKU_GIT_REMOTE" "dokku@$DOKKU_REMOTE_HOST:$APP"; then
|
||||
echo "-----> Dokku remote added at ${DOKKU_REMOTE_HOST} called ${DOKKU_GIT_REMOTE}"
|
||||
echo "-----> Application name is ${APP}"
|
||||
else
|
||||
echo "! Dokku remote not added! Do you already have a dokku remote?"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
apps:destroy)
|
||||
fn-is-git-repo && fn-has-dokku-remote && git remote remove "$DOKKU_GIT_REMOTE"
|
||||
;;
|
||||
esac
|
||||
|
||||
[[ " apps certs help ls nginx shell storage trace version " == *" $CMD "* ]] && unset APP
|
||||
[[ " certs:chain domains:add-global domains:remove-global domains:set-global ps:rebuildall ps:restartall ps:restore " == *" $CMD "* ]] && unset APP
|
||||
[[ "$CMD" =~ events*|plugin*|ssh-keys* ]] && unset APP
|
||||
[[ -n "$APP_ARG" ]] && [[ "$APP_ARG" == "--global" ]] && unset APP
|
||||
[[ -n "$@" ]] && [[ -n "$APP" ]] && app_arg="--app $APP"
|
||||
# echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@"
|
||||
# shellcheck disable=SC2068,SC2086
|
||||
ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@
|
||||
}
|
||||
|
||||
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then
|
||||
main "$@"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
313
contrib/release
Executable file
313
contrib/release
Executable file
@@ -0,0 +1,313 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $TRACE ]] && set -x
|
||||
|
||||
readonly ROOT_DIR="$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" && pwd)"
|
||||
readonly TMP_WORK_DIR="$(mktemp -d "/tmp/dokku-release.XXXX")"
|
||||
readonly DOKKU_GIT_REV="$(git rev-parse HEAD)"
|
||||
|
||||
trap 'rm -rf "$TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
|
||||
|
||||
log-info() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log info formatter"
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
log-error() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log error formatter"
|
||||
echo "! $*" 1>&2
|
||||
}
|
||||
|
||||
log-fail() {
|
||||
# shellcheck disable=SC2034
|
||||
declare desc="Log fail formatter"
|
||||
log-error "$*"
|
||||
exit -1
|
||||
}
|
||||
|
||||
fn-build-dokku() {
|
||||
declare desc="Builds dokku packages within a docker container"
|
||||
declare IS_RELEASE="$1" DOKKU_VERSION="$2"
|
||||
local NAME GOLANG_VERSION
|
||||
|
||||
if [[ -z "$DOKKU_VERSION" ]]; then
|
||||
log-error "Invalid deb file specified"
|
||||
return 1
|
||||
fi
|
||||
|
||||
NAME="dokku:build"
|
||||
[[ "$IS_RELEASE" == "true" ]] && NAME="dokku:build-release"
|
||||
[[ -n "$DOKKU_VERSION" ]] || DOKKU_VERSION="master"
|
||||
|
||||
pushd "$ROOT_DIR" >/dev/null
|
||||
GOLANG_VERSION="$(grep BUILD_IMAGE common.mk | cut -d' ' -f3 | cut -d':' -f2)"
|
||||
docker build \
|
||||
--build-arg DOKKU_VERSION="$DOKKU_VERSION" \
|
||||
--build-arg DOKKU_GIT_REV="$DOKKU_GIT_REV" \
|
||||
--build-arg IS_RELEASE="$IS_RELEASE" \
|
||||
--build-arg PLUGIN_MAKE_TARGET="build" \
|
||||
--build-arg GOLANG_VERSION="$GOLANG_VERSION" \
|
||||
-f "contrib/build.Dockerfile" \
|
||||
-t "$NAME" .
|
||||
}
|
||||
|
||||
fn-extract-package() {
|
||||
declare desc="Extract packages from a docker container to the root directory"
|
||||
declare IS_RELEASE="$1" PACKAGE_NAME="$2"
|
||||
local NAME
|
||||
|
||||
if [[ -z "$PACKAGE_NAME" ]]; then
|
||||
log-error "Invalid deb file specified"
|
||||
return 1
|
||||
fi
|
||||
|
||||
NAME="dokku:build"
|
||||
[[ "$IS_RELEASE" == "true" ]] && NAME="dokku:build-release"
|
||||
|
||||
log-info "(extract-package) writing ${PACKAGE_NAME} to correct path"
|
||||
docker run --rm --entrypoint cat "$NAME" "/data/${PACKAGE_NAME}" > "${ROOT_DIR}/${PACKAGE_NAME}"
|
||||
}
|
||||
|
||||
fn-in-array() {
|
||||
declare desc="return true if value ($1) is in list (all other arguments)"
|
||||
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
fn-is-release() {
|
||||
declare desc="Checks if a given run is a release run"
|
||||
declare RELEASE="$1"
|
||||
local IS_RELEASE=false
|
||||
if [[ "$RELEASE" == "major" ]] || [[ "$RELEASE" == "minor" ]] || [[ "$RELEASE" == "patch" ]]; then
|
||||
IS_RELEASE=true
|
||||
fi
|
||||
|
||||
echo "$IS_RELEASE"
|
||||
}
|
||||
|
||||
fn-version-current() {
|
||||
declare desc="Retrieves the current version of dokku"
|
||||
pushd "$ROOT_DIR" >/dev/null
|
||||
grep Version debian/control | cut -d' ' -f2
|
||||
}
|
||||
|
||||
fn-version-next() {
|
||||
declare desc="Calculates the next version name of dokku"
|
||||
declare CURRENT_VERSION="$1" RELEASE="$2"
|
||||
local major minor patch short_object
|
||||
|
||||
major=$(echo "$CURRENT_VERSION" | awk '{split($0,a,"."); print a[1]}')
|
||||
minor=$(echo "$CURRENT_VERSION" | awk '{split($0,a,"."); print a[2]}')
|
||||
patch=$(echo "$CURRENT_VERSION" | awk '{split($0,a,"."); print a[3]}')
|
||||
|
||||
if [[ "$RELEASE" == "major" ]]; then
|
||||
major=$((major + 1))
|
||||
minor="0"
|
||||
patch="0"
|
||||
elif [[ "$RELEASE" == "minor" ]]; then
|
||||
minor=$((minor + 1))
|
||||
patch="0"
|
||||
elif [[ "$RELEASE" == "patch" ]]; then
|
||||
patch=$((patch + 1))
|
||||
else
|
||||
short_object=$(git log --oneline | tail -n 1 | cut -d' ' -f1)
|
||||
echo "${CURRENT_VERSION}build+$(echo "$DOKKU_GIT_REV" | cut -c1-${#short_object})"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "${major}.${minor}.${patch}"
|
||||
}
|
||||
|
||||
fn-publish-package() {
|
||||
declare desc="Publishes a package to packagecloud"
|
||||
declare IS_RELEASE="$1" RELEASE_TYPE="$2" PACKAGE_NAME="$3"
|
||||
local REPOSITORY=dokku/dokku-betafish DIST=ubuntu/trusty
|
||||
|
||||
[[ "$IS_RELEASE" == "true" ]] && REPOSITORY=dokku/dokku
|
||||
[[ "$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"
|
||||
}
|
||||
|
||||
fn-replace-version() {
|
||||
declare desc="Replaces the version within a file"
|
||||
local CURRENT_VERSION="$1"
|
||||
local NEXT_VERSION="$2"
|
||||
local FILENAME="$3"
|
||||
sed -i.bak "s/${CURRENT_VERSION//./\.}/$NEXT_VERSION/g" "$FILENAME" && rm "$FILENAME.bak"
|
||||
git add "$FILENAME"
|
||||
}
|
||||
|
||||
fn-repo-merged-requests() {
|
||||
declare desc="Retrieves all pull request ids since a given release of dokku"
|
||||
declare TAG="$1"
|
||||
git log "v${TAG}..HEAD" --oneline | grep "Merge pull request" | cut -d' ' -f 5 | cut -d '#' -f2
|
||||
}
|
||||
|
||||
fn-repo-push-tags() {
|
||||
declare desc="Pushes tags and the repository to github"
|
||||
declare IS_RELEASE="$1"
|
||||
|
||||
if [[ "$IS_RELEASE" == "false" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
pushd "$ROOT_DIR" >/dev/null
|
||||
git push --tags origin master
|
||||
}
|
||||
|
||||
fn-repo-update() {
|
||||
declare desc="Updates files within the repository for a given release"
|
||||
declare IS_RELEASE="$1" CURRENT_VERSION="$2" NEXT_VERSION="$3"
|
||||
|
||||
log-info "(release-dokku) Replacing ${CURRENT_VERSION} with ${NEXT_VERSION}"
|
||||
for f in plugins/*/plugin.toml; do
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" "$f"
|
||||
done
|
||||
|
||||
if [[ "$IS_RELEASE" == "false" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" contrib/dokku-installer.py
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" debian/control
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/advanced-usage/plugin-management.md
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/assets/favicons/browserconfig.xml
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/assets/favicons/manifest.json
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/assets/style.css
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/development/release-process.md
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/home.html
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/getting-started/installation.md
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/template.html
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" README.md
|
||||
|
||||
if [[ "$RELEASE" == 'patch' ]]; then
|
||||
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/assets/versions.json
|
||||
else
|
||||
versions=$(python -c 'import json,sys;d=json.load(sys.stdin);d["max-versions"].append("'"${NEXT_VERSION}"'"); print json.dumps(d, indent=2, sort_keys=True)' <docs/assets/versions.json)
|
||||
echo "$versions" >docs/assets/versions.json
|
||||
git add docs/assets/versions.json
|
||||
fi
|
||||
|
||||
if [[ "$IS_RELEASE" == "false" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
log-info "(release-dokku) Adding HISTORY.md, committing and tagging"
|
||||
fn-repo-update-history-and-commit "$CURRENT_VERSION" "$NEXT_VERSION"
|
||||
git tag "v${NEXT_VERSION}"
|
||||
}
|
||||
|
||||
fn-repo-update-history-and-commit() {
|
||||
declare desc="Updates the history file and commits the changes"
|
||||
declare CURRENT_VERSION="$1" NEXT_VERSION="$2"
|
||||
local PULL_REQUEST_ID TITLE AUTHOR TYPE CHANGELOG_TEXT
|
||||
local COMMIT_MESSAGE HISTORY HISTORY_CONTENTS HISTORY_DOCUMENTATION HISTORY_ENHANCEMENT HISTORY_BUG ISSUE_FILE
|
||||
|
||||
pushd "$ROOT_DIR" >/dev/null
|
||||
|
||||
mkdir -p /tmp/github-data
|
||||
|
||||
for PULL_REQUEST_ID in $(fn-repo-merged-requests "$CURRENT_VERSION"); do
|
||||
ISSUE_FILE="/tmp/github-data/${PULL_REQUEST_ID}.json"
|
||||
if [[ ! -f "$ISSUE_FILE" ]]; then
|
||||
curl -sS "https://api.github.com/repos/dokku/dokku/issues/${PULL_REQUEST_ID}" >"$ISSUE_FILE"
|
||||
fi
|
||||
|
||||
TITLE="$(jq -r '.title' "$ISSUE_FILE")"
|
||||
AUTHOR="$(jq -r '.user.login' "$ISSUE_FILE")"
|
||||
TYPE="$(jq -r '.labels[] | select( .name | contains("type") ) | .name' "$ISSUE_FILE" | cut -d' ' -f2)"
|
||||
CHANGELOG_TEXT="- #${PULL_REQUEST_ID}: @${AUTHOR} ${TITLE}"
|
||||
|
||||
if [[ "$TYPE" == "bug" ]]; then
|
||||
HISTORY_BUG="${HISTORY_BUG}"$'\n'"$CHANGELOG_TEXT"
|
||||
elif [[ "$TYPE" == "documentation" ]]; then
|
||||
HISTORY_DOCUMENTATION="${HISTORY_DOCUMENTATION}"$'\n'"$CHANGELOG_TEXT"
|
||||
elif [[ "$TYPE" == "enhancement" ]]; then
|
||||
HISTORY_ENHANCEMENT="${HISTORY_ENHANCEMENT}"$'\n'"$CHANGELOG_TEXT"
|
||||
fi
|
||||
done
|
||||
|
||||
HISTORY="# History"
|
||||
HISTORY="${HISTORY}"$'\n\n'"## ${NEXT_VERSION}"
|
||||
|
||||
if [[ "$HISTORY_BUG" ]]; then
|
||||
HISTORY="${HISTORY}"$'\n\n'"### Bug Fixes"
|
||||
HISTORY="${HISTORY}"$'\n'"$HISTORY_BUG"
|
||||
fi
|
||||
|
||||
if [[ "$HISTORY_DOCUMENTATION" ]]; then
|
||||
HISTORY="${HISTORY}"$'\n\n'"### New Features"
|
||||
HISTORY="${HISTORY}"$'\n'"$HISTORY_DOCUMENTATION"
|
||||
fi
|
||||
|
||||
if [[ "$HISTORY_ENHANCEMENT" ]]; then
|
||||
HISTORY="${HISTORY}"$'\n\n'"### Documentation"
|
||||
HISTORY="${HISTORY}"$'\n'"$HISTORY_ENHANCEMENT"
|
||||
fi
|
||||
|
||||
sed -i.bak '1d' HISTORY.md && rm HISTORY.md.bak
|
||||
HISTORY_CONTENTS="$(cat HISTORY.md)"
|
||||
echo -e "$HISTORY\n$HISTORY_CONTENTS" >HISTORY.md
|
||||
git add HISTORY.md
|
||||
|
||||
COMMIT_MESSAGE="Release ${NEXT_VERSION}"$'\n\n'"${HISTORY}"
|
||||
git commit -m "${COMMIT_MESSAGE}"
|
||||
}
|
||||
|
||||
fn-require-bin() {
|
||||
declare desc="Checks that a binary exists"
|
||||
declare BINARY="$1"
|
||||
if ! command -v "$BINARY" &>/dev/null; then
|
||||
log-fail "Missing ${BINARY}, please install it"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
declare RELEASE="$1"
|
||||
local CURRENT_VERSION NEXT_VERSION IS_RELEASE major minor patch versions
|
||||
local VALID_RELEASE_LEVELS=("major" "minor" "patch" "betafish")
|
||||
|
||||
if [[ "$RELEASE" == '--trace' ]]; then
|
||||
shift 1
|
||||
RELEASE="$1"
|
||||
TRACE=1 && set -x
|
||||
fi
|
||||
|
||||
if [[ -z "$RELEASE" ]]; then
|
||||
log-fail "Argument 1 must be one of [major, minor, patch, betafish], none given"
|
||||
fi
|
||||
|
||||
if ! fn-in-array "$RELEASE" "${VALID_RELEASE_LEVELS[@]}"; then
|
||||
log-fail "Argument 1 must be one of [major, minor, patch, betafish], '${RELEASE}' given"
|
||||
fi
|
||||
|
||||
fn-require-bin "docker"
|
||||
fn-require-bin "git"
|
||||
fn-require-bin "package_cloud"
|
||||
[[ -n "$PACKAGECLOUD_API_TOKEN" ]] || log-fail "Missing PACKAGECLOUD_API_TOKEN environment variable"
|
||||
|
||||
CURRENT_VERSION="$(fn-version-current)"
|
||||
NEXT_VERSION="$(fn-version-next "$CURRENT_VERSION" "$RELEASE")"
|
||||
IS_RELEASE="$(fn-is-release "$RELEASE")"
|
||||
|
||||
fn-repo-update "$IS_RELEASE" "$CURRENT_VERSION" "$NEXT_VERSION"
|
||||
|
||||
fn-build-dokku "$IS_RELEASE" "$NEXT_VERSION"
|
||||
|
||||
fn-extract-package "$IS_RELEASE" "dokku_${NEXT_VERSION}_amd64.deb"
|
||||
fn-extract-package "$IS_RELEASE" "dokku-${NEXT_VERSION}-1.x86_64.rpm"
|
||||
|
||||
fn-publish-package "$IS_RELEASE" "deb" "dokku_${NEXT_VERSION}_amd64.deb"
|
||||
fn-publish-package "$IS_RELEASE" "rpm" "dokku-${NEXT_VERSION}-1.x86_64.rpm"
|
||||
|
||||
fn-repo-push-tags "$IS_RELEASE"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
25
deb.mk
25
deb.mk
@@ -1,6 +1,6 @@
|
||||
HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
|
||||
HEROKUISH_REPO_NAME ?= gliderlabs/herokuish
|
||||
HEROKUISH_VERSION ?= 0.3.24
|
||||
HEROKUISH_VERSION ?= 0.3.27
|
||||
HEROKUISH_ARCHITECTURE = amd64
|
||||
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
|
||||
|
||||
@@ -15,7 +15,7 @@ You can use any language you want, so long as the script is
|
||||
executable and has the proper language requirements installed
|
||||
endef
|
||||
PLUGN_REPO_NAME ?= dokku/plugn
|
||||
PLUGN_VERSION ?= 0.2.2
|
||||
PLUGN_VERSION ?= 0.3.0
|
||||
PLUGN_ARCHITECTURE = amd64
|
||||
PLUGN_PACKAGE_NAME = plugn_$(PLUGN_VERSION)_$(PLUGN_ARCHITECTURE).deb
|
||||
PLUGN_URL = https://github.com/dokku/plugn/releases/download/v$(PLUGN_VERSION)/plugn_$(PLUGN_VERSION)_linux_x86_64.tgz
|
||||
@@ -26,7 +26,7 @@ Simplifies running a single command over SSH, and
|
||||
manages authorized keys (ACL) and users in order to do so.
|
||||
endef
|
||||
SSHCOMMAND_REPO_NAME ?= dokku/sshcommand
|
||||
SSHCOMMAND_VERSION ?= 0.6.0
|
||||
SSHCOMMAND_VERSION ?= 0.7.0
|
||||
SSHCOMMAND_ARCHITECTURE = amd64
|
||||
SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb
|
||||
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v$(SSHCOMMAND_VERSION)/sshcommand
|
||||
@@ -92,7 +92,10 @@ deb-herokuish:
|
||||
@echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install
|
||||
@echo "fi" >> /tmp/tmp/post-install
|
||||
@echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install
|
||||
@echo "sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install
|
||||
@echo '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 $$BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null' >> /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
|
||||
@@ -121,8 +124,12 @@ deb-dokku:
|
||||
cp dokku /tmp/build/usr/bin
|
||||
cp LICENSE /tmp/build/usr/share/doc/dokku/copyright
|
||||
find . -name ".DS_Store" -depth -exec rm {} \;
|
||||
$(MAKE) go-build
|
||||
cp common.mk /tmp/build/var/lib/dokku/core-plugins/common.mk
|
||||
cp -r plugins/* /tmp/build/var/lib/dokku/core-plugins/available
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do cd /tmp/build/var/lib/dokku/core-plugins/available/$$plugin && if [ -e Makefile ]; then $(MAKE) src-clean; fi; done
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/core-plugins/available/$$plugin/.core; done
|
||||
rm /tmp/build/var/lib/dokku/core-plugins/common.mk
|
||||
$(MAKE) help2man
|
||||
$(MAKE) addman
|
||||
cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1
|
||||
@@ -137,16 +144,16 @@ endif
|
||||
ifneq (,$(findstring false,$(IS_RELEASE)))
|
||||
sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
|
||||
endif
|
||||
rm /tmp/build/DEBIAN/lintian-overrides
|
||||
mv debian/lintian-overrides /tmp/build/usr/share/lintian/overrides/dokku
|
||||
rm -f /tmp/build/DEBIAN/lintian-overrides
|
||||
cp debian/lintian-overrides /tmp/build/usr/share/lintian/overrides/dokku
|
||||
ifdef DOKKU_GIT_REV
|
||||
echo "$(DOKKU_GIT_REV)" > /tmp/build/var/lib/dokku/GIT_REV
|
||||
else
|
||||
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
|
||||
endif
|
||||
sed -i "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control
|
||||
dpkg-deb --build /tmp/build "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
lintian "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
sed -i.bak "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control && rm /tmp/build/DEBIAN/control.bak
|
||||
dpkg-deb --build /tmp/build "/tmp/dokku_`cat /tmp/build/var/lib/dokku/VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
lintian "/tmp/dokku_`cat /tmp/build/var/lib/dokku/VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
|
||||
deb-plugn:
|
||||
rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME)
|
||||
|
||||
8
debian/control
vendored
8
debian/control
vendored
@@ -1,11 +1,11 @@
|
||||
Package: dokku
|
||||
Version: 0.8.0
|
||||
Version: 0.9.3
|
||||
Section: web
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: locales, git, make, curl, gcc, man-db, sshcommand, gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties
|
||||
Recommends: herokuish
|
||||
Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf
|
||||
Depends: locales, git, make, curl, gcc, man-db, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1) | docker-ce | docker-ee, software-properties-common, python-software-properties
|
||||
Recommends: herokuish (>= 0.3.4), parallel
|
||||
Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.3.0), sudo, python2.7, debconf
|
||||
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
Description: Docker-powered PaaS that helps build and manage the lifecycle of applications
|
||||
Dokku is an extensible, open source Platform as a Service
|
||||
|
||||
2
debian/lintian-overrides
vendored
2
debian/lintian-overrides
vendored
@@ -1,3 +1,5 @@
|
||||
dokku: command-with-path-in-maintainer-script postinst:16 /usr/bin/sshcommand
|
||||
dokku: maintainer-script-calls-systemctl postinst:87
|
||||
dokku: changelog-file-missing-in-native-package
|
||||
dokku: statically-linked-binary
|
||||
dokku: unstripped-binary-or-object
|
||||
|
||||
2
debian/postinst
vendored
2
debian/postinst
vendored
@@ -35,7 +35,7 @@ case "$1" in
|
||||
|
||||
echo "Setting up storage directories"
|
||||
mkdir -p ${DOKKU_LIB_ROOT}/data ${DOKKU_LIB_ROOT}/data/storage
|
||||
chown dokku:dokku -R ${DOKKU_LIB_ROOT}/data
|
||||
chown dokku:dokku ${DOKKU_LIB_ROOT}/data ${DOKKU_LIB_ROOT}/data/storage
|
||||
|
||||
echo "Setting up plugin directories"
|
||||
# should be replaced by `plugn init`
|
||||
|
||||
@@ -20,40 +20,15 @@ For dockerfile apps, place `app.json` in the configured `WORKDIR` directory; oth
|
||||
|
||||
### Example app.json
|
||||
|
||||
> NOTE: Only the `scripts.dokku.predeploy` and `scripts.dokku.postdeploy` tasks are supported by Dokku at this time. All other fields will be ignored and can be omitted.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "barebones nodejs",
|
||||
"description": "A barebones Node.js app using Express 4.",
|
||||
"keywords": [
|
||||
"nodejs",
|
||||
"express"
|
||||
],
|
||||
"repository": "https://github.com/michaelshobbs/node-js-sample",
|
||||
"scripts": {
|
||||
"dokku": {
|
||||
"predeploy": "touch /app/predeploy.test",
|
||||
"postdeploy": "curl https://some.external.api.service.com/deployment?state=success"
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"SECRET_TOKEN": {
|
||||
"description": "A secret key for verifying the integrity of signed cookies.",
|
||||
"value": "secret"
|
||||
},
|
||||
"WEB_CONCURRENCY": {
|
||||
"description": "The number of processes to run.",
|
||||
"generator": "echo 5"
|
||||
}
|
||||
},
|
||||
"image": "gliderlabs/herokuish",
|
||||
"addons": [
|
||||
"dokku-postgres",
|
||||
"dokku-redis"
|
||||
],
|
||||
"buildpacks": [
|
||||
{
|
||||
"url": "https://github.com/heroku/heroku-buildpack-nodejs"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
Pass [options](https://docs.docker.com/engine/reference/run/) to Docker during Dokku's `build`, `deploy` and `run` phases
|
||||
|
||||
```
|
||||
docker-options <app> [phase(s)] # Display app's Docker options for all phases (or comma separated phase list)
|
||||
docker-options:add <app> <phase(s)> OPTION # Add Docker option to app for phase (comma-separated phase list)
|
||||
docker-options:remove <app> <phase(s)> OPTION # Remove Docker option from app for phase (comma-separated phase list)
|
||||
docker-options:report [<app>] [<flag>] # Displays a docker options report for one or more apps
|
||||
```
|
||||
|
||||
> When specifying multiple phases, they **must** be comma-separated _without_ spaces in between each phase, like so:
|
||||
>
|
||||
> ```shell
|
||||
> dokku docker-options:add myapp deploy,run "-v /home/dokku/logs/myapp:/app/logs"
|
||||
> dokku docker-options:add node-js-app deploy,run "-v /var/log/node-js-app:/app/logs"
|
||||
> ```
|
||||
|
||||
## About Dokku phases
|
||||
@@ -22,7 +22,7 @@ Dokku deploys your application in multiple "phases" and the `docker-options` plu
|
||||
|
||||
- `build`: the container that executes the appropriate buildpack
|
||||
- `deploy`: the container that executes your running/deployed application
|
||||
- `run`: the container that executes any arbitrary command via `dokku run myapp`
|
||||
- `run`: the container that executes any arbitrary command via `dokku run`
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -32,31 +32,63 @@ Add some options for the deployed/running app and when executing [`dokku run`](/
|
||||
|
||||
```shell
|
||||
# Mount a host volume in a Docker container: "-v /host/path:/container/path"
|
||||
dokku docker-options:add myapp deploy "-v /home/dokku/logs/myapp:/app/logs"
|
||||
dokku docker-options:add myapp run "-v /home/dokku/logs/myapp:/app/logs"
|
||||
dokku docker-options:add node-js-app deploy "-v /var/log/node-js-app:/app/logs"
|
||||
dokku docker-options:add node-js-app run "-v /var/log/node-js-app:/app/logs"
|
||||
```
|
||||
|
||||
> Note: When [mounting a host directory](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) in a Dokku app you should first create that directory as user `dokku` and then mount the directory under `/app` in the container using `docker-options` as above. Otherwise the app will lack write permission in the directory.
|
||||
|
||||
### Output Docker options
|
||||
|
||||
```shell
|
||||
dokku docker-options myapp
|
||||
```
|
||||
|
||||
```
|
||||
Deploy options:
|
||||
-v /home/dokku/logs/myapp:/app/logs
|
||||
Run options:
|
||||
-v /home/dokku/logs/myapp:/app/logs
|
||||
```
|
||||
|
||||
### Remove a Docker option
|
||||
|
||||
```shell
|
||||
dokku docker-options:remove myapp run "-v /home/dokku/logs/myapp:/app/logs"
|
||||
dokku docker-options:remove node-js-app run "-v /var/log/node-js-app:/app/logs"
|
||||
```
|
||||
|
||||
### Displaying docker-options reports about an app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can get a report about the app's docker-options status using the `docker-options:report` command:
|
||||
|
||||
```shell
|
||||
dokku docker-options:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app docker options information
|
||||
Docker options build:
|
||||
Docker options deploy: -v /var/log/node-js-app:/app/logs
|
||||
Docker options run: -v /var/log/node-js-app:/app/logs
|
||||
=====> python-sample docker options information
|
||||
Docker options build:
|
||||
Docker options deploy:
|
||||
Docker options run:
|
||||
=====> ruby-sample docker options information
|
||||
Docker options build:
|
||||
Docker options deploy:
|
||||
Docker options run:
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku docker-options:report node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app docker options information
|
||||
Storage build mounts:
|
||||
Storage deploy mounts: -v /var/log/node-js-app:/app/logs
|
||||
Storage run mounts: -v /var/log/node-js-app:/app/logs
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku docker-options:report node-js-app --docker-options-build
|
||||
```
|
||||
|
||||
|
||||
## Advanced usage
|
||||
|
||||
In your applications folder `/home/dokku/app_name` create a file called `DOCKER_OPTIONS_RUN` (or `DOCKER_OPTIONS_BUILD` or `DOCKER_OPTIONS_DEPLOY`).
|
||||
|
||||
@@ -8,19 +8,23 @@ The preferred method to mount external containers to a Dokku managed container,
|
||||
```
|
||||
storage:list <app> # List bind mounts for app's container(s) (host:container)
|
||||
storage:mount <app> <host-dir:container-dir> # Create a new bind mount
|
||||
storage:report [<app>] [<flag>] # Displays a checks report for one or more apps
|
||||
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 requires explicit paths on the host side. This is intentional to ensure that new users avoid running into unexpected results with implicit paths that may not exist (a feature deprecate in [Docker 1.9.0](https://github.com/docker/docker/releases/tag/v1.9.0])). The container directory is created for the mount point in the container. Any existing directory contents are not accessible after a mount is added to the container. Dokku creates a new directory `/var/lib/dokku/data/storage` during installation, it's the general consensus that new users should use this directory. Mounts are only available at run and deploy times, you must redeploy (restart) an app to mount or unmount to an existing app's container.
|
||||
|
||||
## Usage
|
||||
|
||||
This example demonstrates how to mount the recommended directory to `/storage` inside the container:
|
||||
This example demonstrates how to mount the recommended directory to `/storage` inside an application called `node-js-app`:
|
||||
|
||||
```shell
|
||||
dokku storage:mount app-name /var/lib/dokku/data/storage:/storage
|
||||
# we use a subdirectory inside of the host directory to scope it to just the app
|
||||
dokku storage:mount node-js-app /var/lib/dokku/data/storage/node-js-app:/storage
|
||||
```
|
||||
|
||||
Dokku will then mount the shared contents of `/var/lib/dokku/data/storage` to `/storage` inside the container.
|
||||
@@ -35,21 +39,65 @@ dokku ps:rebuild app-name
|
||||
A more complete workflow may require making a custom directory for your application and mounting it within your `/app/storage` directory instead. The mount point is *not* relative to your application's working directory, and is instead relative to the root of the container.
|
||||
|
||||
```shell
|
||||
# creating storage for the app 'ruby-rails-sample'
|
||||
mkdir -p /var/lib/dokku/data/storage/ruby-rails-sample
|
||||
# creating storage for the app 'node-js-app'
|
||||
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/ruby-rails-sample
|
||||
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
|
||||
chown -R 32767:32767 /var/lib/dokku/data/storage/ruby-rails-sample
|
||||
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
|
||||
dokku storage:mount app-name /var/lib/dokku/data/storage/app-name:/app/storage
|
||||
dokku storage:mount app-name /var/lib/dokku/data/storage/node-js-app:/app/storage
|
||||
```
|
||||
|
||||
You can mount one or more directories as desired by following the above pattern.
|
||||
|
||||
### Displaying storage reports about an app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can get a report about the app's storage status using the `storage:report` command:
|
||||
|
||||
```shell
|
||||
dokku storage:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app storage information
|
||||
Storage build mounts:
|
||||
Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage
|
||||
Storage run mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage
|
||||
=====> python-sample storage information
|
||||
Storage build mounts:
|
||||
Storage deploy mounts:
|
||||
Storage run mounts:
|
||||
=====> ruby-sample storage information
|
||||
Storage build mounts:
|
||||
Storage deploy mounts:
|
||||
Storage run mounts:
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku storage:report node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app storage information
|
||||
Storage build mounts:
|
||||
Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage
|
||||
Storage run mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku storage:report node-js-app --storage-deploy-mounts
|
||||
```
|
||||
|
||||
## Use Cases
|
||||
|
||||
### Persistent storage
|
||||
@@ -80,15 +128,10 @@ You cannot use mounted volumes during the build phase of a Dockerfile deploy. Th
|
||||
|
||||
> Note: **This can cause data loss** if you bind a mount under `/app` in buildpack apps as herokuish will attempt to remove the original app path during the build phase.
|
||||
|
||||
## Docker-Options Note
|
||||
|
||||
The storage plugin is compatible with storage mounts created with the docker-options. The storage plugin will only list mounts from the deploy phase.
|
||||
|
||||
## Application User and Persistent Storage file ownership (buildpack apps only)
|
||||
|
||||
> New as of 0.7.1
|
||||
|
||||
## Application User and Persistent Storage file ownership (buildpack apps only)
|
||||
|
||||
By default, Dokku will execute your buildpack application processes as the `herokuishuser` user. You may override this by setting the `DOKKU_APP_USER` config variable.
|
||||
|
||||
> NOTE: this user must exist in your herokuish image.
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
> New as of 0.4.0
|
||||
|
||||
```
|
||||
plugin # Print active plugins
|
||||
plugin:disable <name> # Disable an installed plugin (third-party only)
|
||||
plugin:enable <name> # Enable a previously disabled plugin
|
||||
plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]] # Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones)
|
||||
plugin:install-dependencies [--core] # Run install-dependencies trigger for active plugins (or only core ones)
|
||||
plugin:list # Print active plugins
|
||||
plugin:uninstall <name> # Uninstall a plugin (third-party only)
|
||||
plugin:update [name [committish]] # Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins
|
||||
```
|
||||
@@ -31,30 +31,30 @@ dokku plugin
|
||||
|
||||
```
|
||||
plugn: dev
|
||||
00_dokku-standard 0.8.0 enabled dokku core standard plugin
|
||||
20_events 0.8.0 enabled dokku core events logging plugin
|
||||
apps 0.8.0 enabled dokku core apps plugin
|
||||
build-env 0.8.0 enabled dokku core build-env plugin
|
||||
certs 0.8.0 enabled dokku core certificate management plugin
|
||||
checks 0.8.0 enabled dokku core checks plugin
|
||||
common 0.8.0 enabled dokku core common plugin
|
||||
config 0.8.0 enabled dokku core config plugin
|
||||
docker-options 0.8.0 enabled dokku core docker-options plugin
|
||||
domains 0.8.0 enabled dokku core domains plugin
|
||||
enter 0.8.0 enabled dokku core enter plugin
|
||||
git 0.8.0 enabled dokku core git plugin
|
||||
logs 0.8.0 enabled dokku core logs plugin
|
||||
named-containers 0.8.0 enabled dokku core named containers plugin
|
||||
nginx-vhosts 0.8.0 enabled dokku core nginx-vhosts plugin
|
||||
plugin 0.8.0 enabled dokku core plugin plugin
|
||||
proxy 0.8.0 enabled dokku core proxy plugin
|
||||
ps 0.8.0 enabled dokku core ps plugin
|
||||
repo 0.8.0 enabled dokku core repo plugin
|
||||
shell 0.8.0 enabled dokku core shell plugin
|
||||
ssh-keys 0.8.0 enabled dokku core ssh-keys plugin
|
||||
storage 0.8.0 enabled dokku core storage plugin
|
||||
tags 0.8.0 enabled dokku core tags plugin
|
||||
tar 0.8.0 enabled dokku core tar plugin
|
||||
00_dokku-standard 0.9.3 enabled dokku core standard plugin
|
||||
20_events 0.9.3 enabled dokku core events logging plugin
|
||||
apps 0.9.3 enabled dokku core apps plugin
|
||||
build-env 0.9.3 enabled dokku core build-env plugin
|
||||
certs 0.9.3 enabled dokku core certificate management plugin
|
||||
checks 0.9.3 enabled dokku core checks plugin
|
||||
common 0.9.3 enabled dokku core common plugin
|
||||
config 0.9.3 enabled dokku core config plugin
|
||||
docker-options 0.9.3 enabled dokku core docker-options plugin
|
||||
domains 0.9.3 enabled dokku core domains plugin
|
||||
enter 0.9.3 enabled dokku core enter plugin
|
||||
git 0.9.3 enabled dokku core git plugin
|
||||
logs 0.9.3 enabled dokku core logs plugin
|
||||
named-containers 0.9.3 enabled dokku core named containers plugin
|
||||
nginx-vhosts 0.9.3 enabled dokku core nginx-vhosts plugin
|
||||
plugin 0.9.3 enabled dokku core plugin plugin
|
||||
proxy 0.9.3 enabled dokku core proxy plugin
|
||||
ps 0.9.3 enabled dokku core ps plugin
|
||||
repo 0.9.3 enabled dokku core repo plugin
|
||||
shell 0.9.3 enabled dokku core shell plugin
|
||||
ssh-keys 0.9.3 enabled dokku core ssh-keys plugin
|
||||
storage 0.9.3 enabled dokku core storage plugin
|
||||
tags 0.9.3 enabled dokku core tags plugin
|
||||
tar 0.9.3 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.
|
||||
|
||||
@@ -3,19 +3,21 @@
|
||||
> New as of 0.5.0, Enhanced in 0.6.0
|
||||
|
||||
```
|
||||
proxy <app> # Show proxy settings for app
|
||||
proxy:disable <app> # Disable proxy for app
|
||||
proxy:enable <app> # Enable proxy for app
|
||||
proxy:ports <app> # List proxy port mappings for app
|
||||
proxy:ports-add <app> <scheme>:<host-port>:<container-port> [<scheme>:<host-port>:<container-port>...] # Set proxy port mappings for app
|
||||
proxy:ports-clear <app> # Clear all proxy port mappings for app
|
||||
proxy:ports-remove <app> <host-port> [<host-port>|<scheme>:<host-port>:<container-port>...] # Unset proxy port mappings for app
|
||||
proxy:report [<app>] [<flag>] # Displays a proxy report for one or more apps
|
||||
proxy:set <app> <proxy-type> # Set proxy type for app
|
||||
```
|
||||
|
||||
In Dokku 0.5.0, port proxying was decoupled from the `nginx-vhosts` plugin into the proxy plugin. Dokku 0.6.0 introduced the ability to map host ports to specific container ports. In the future this will allow other proxy software - such as HAProxy or Caddy - to be used in place of nginx.
|
||||
|
||||
## Container network interface binding
|
||||
## Usage
|
||||
|
||||
### Container network interface binding
|
||||
|
||||
> New as of 0.5.0
|
||||
|
||||
@@ -58,7 +60,51 @@ CONTAINER ID IMAGE COMMAND CREATED
|
||||
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1
|
||||
```
|
||||
|
||||
## Proxy port mapping
|
||||
### Displaying proxy reports about an app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can get a report about the app's proxy status using the `proxy:report` command:
|
||||
|
||||
```shell
|
||||
dokku proxy:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app proxy information
|
||||
Proxy enabled: true
|
||||
Proxy type: nginx
|
||||
Proxy port map: http:80:5000 https:443:5000
|
||||
=====> python-sample proxy information
|
||||
Proxy enabled: true
|
||||
Proxy type: nginx
|
||||
Proxy port map: http:80:5000
|
||||
=====> ruby-sample proxy information
|
||||
Proxy enabled: true
|
||||
Proxy type: nginx
|
||||
Proxy port map: http:80:5000
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku proxy:report node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app proxy information
|
||||
Proxy enabled: true
|
||||
Proxy type: nginx
|
||||
Proxy port map: http:80:5000 https:443:5000
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku proxy:report node-js-app --proxy-type
|
||||
```
|
||||
|
||||
### Proxy port mapping
|
||||
|
||||
> New as of 0.6.0
|
||||
|
||||
@@ -141,7 +187,7 @@ By default, buildpack apps and dockerfile apps **without** explicitly exposed po
|
||||
|
||||
> Note: This default behavior **will not** be automatically changed on subsequent pushes and must be manipulated with the `proxy:ports-*` syntax detailed above.
|
||||
|
||||
## Proxy Port Scheme
|
||||
#### Proxy Port Scheme
|
||||
|
||||
The proxy port scheme is as follows:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
> New as of 0.6.0
|
||||
|
||||
```
|
||||
repo:gc <app> # Runs 'git gc --agressive' against the application's repo
|
||||
repo:gc <app> # Runs 'git gc --aggressive' against the application's repo
|
||||
repo:purge-cache <app> # Deletes the contents of the build cache stored in the repository
|
||||
```
|
||||
|
||||
@@ -13,7 +13,7 @@ The repository plugin is meant to allow users to perform management commands aga
|
||||
|
||||
### Git Garbage Collection
|
||||
|
||||
This will run a git gc --agressive against the applications repo. This is performed on the Dokku host, and not within an application container.
|
||||
This will run a git gc --aggressive against the applications repo. This is performed on the Dokku host, and not within an application container.
|
||||
|
||||
```shell
|
||||
dokku repo:gc node-js-app
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/mstile-70x70.png"/>
|
||||
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/mstile-150x150.png"/>
|
||||
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/mstile-310x310.png"/>
|
||||
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/mstile-310x150.png"/>
|
||||
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/mstile-70x70.png"/>
|
||||
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/mstile-150x150.png"/>
|
||||
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/mstile-310x310.png"/>
|
||||
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/mstile-310x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
|
||||
@@ -2,37 +2,37 @@
|
||||
"name": "Dokku",
|
||||
"icons": [
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-36x36.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.9.3\/docs\/assets\/favicons\/android-chrome-36x36.png",
|
||||
"sizes": "36x36",
|
||||
"type": "image\/png",
|
||||
"density": "0.75"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-48x48.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.9.3\/docs\/assets\/favicons\/android-chrome-48x48.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image\/png",
|
||||
"density": "1.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-72x72.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.9.3\/docs\/assets\/favicons\/android-chrome-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image\/png",
|
||||
"density": "1.5"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-96x96.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.9.3\/docs\/assets\/favicons\/android-chrome-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image\/png",
|
||||
"density": "2.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-144x144.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.9.3\/docs\/assets\/favicons\/android-chrome-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image\/png",
|
||||
"density": "3.0"
|
||||
},
|
||||
{
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-192x192.png",
|
||||
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.9.3\/docs\/assets\/favicons\/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image\/png",
|
||||
"density": "4.0"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
body {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-weight: 400;
|
||||
padding-bottom: 40px;
|
||||
color: #5a5a5a;
|
||||
@@ -35,13 +35,13 @@ h1 {
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.header .navbar-brand a {
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/dokku.png);
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/dokku.png);
|
||||
text-indent: 40px;
|
||||
}
|
||||
.blurb {
|
||||
color: #424242;
|
||||
background-color: #ededed;
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/gplaypattern.png);
|
||||
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/gplaypattern.png);
|
||||
padding: 45px 0;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -209,6 +209,7 @@ h1 {
|
||||
|
||||
.list-group-item {
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
padding: .2rem .5rem;
|
||||
color: #157577;
|
||||
@@ -246,7 +247,7 @@ a.list-group-item {
|
||||
color: rgb(71, 74, 84);
|
||||
font-weight: normal;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
}
|
||||
.markdown-body h1 {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"0.5.8",
|
||||
"0.6.5",
|
||||
"0.7.2",
|
||||
"0.8.0"
|
||||
"0.8.2",
|
||||
"0.9.3"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[luxifer]: https://github.com/luxifer
|
||||
[Maciej Łebkowski]: https://github.com/mlebkowski
|
||||
[matto1990]: https://github.com/matto1990
|
||||
[mbreit]: https://github.com/mbreit
|
||||
[mbriskar]: https://github.com/mbriskar
|
||||
[michaelshobbs]: https://github.com/michaelshobbs
|
||||
[mikecsh]: https://github.com/mikecsh
|
||||
@@ -180,6 +181,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| [Haproxy tcp load balancer](https://github.com/256dpi/dokku-haproxy) | [256dpi][] | 0.4.0+ |
|
||||
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | 0.4.0+ |
|
||||
| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | 0.4.0+ |
|
||||
| [Monit (Health Checks)](https://github.com/mbreit/dokku-monit) | [mbreit][] | 0.8.0+ |
|
||||
| [Nuke Containers](https://github.com/josegonzalez/dokku-nuke) | [josegonzalez][] | 0.4.0+ |
|
||||
| [Open App Ports](https://github.com/josegonzalez/dokku-ports) | [josegonzalez][] | 0.3.x |
|
||||
| [Proctype Filter](https://github.com/michaelshobbs/dokku-proctype-filter) | [michaelshobbs][] | 0.4.0+ |
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
> New as of 0.3.10
|
||||
|
||||
```
|
||||
domains [<app>] # List domains
|
||||
domains:add <app> <domain> [<domain> ...] # Add domains to app
|
||||
domains:add-global <domain> [<domain> ...] # Add global domain names
|
||||
domains:clear <app> # Clear all domains for app
|
||||
@@ -11,6 +10,7 @@ domains:disable <app> # Disable VHOST support
|
||||
domains:enable <app> # Enable VHOST support
|
||||
domains:remove <app> <domain> [<domain> ...] # Remove domains from app
|
||||
domains:remove-global <domain> [<domain> ...] # Remove global domain names
|
||||
domains:report [<app>] [<flag>] # Displays a domains report for one or more apps
|
||||
domains:set <app> <domain> [<domain> ...] # Set domains for app
|
||||
domains:set-global <domain> [<domain> ...] # Set global domain names
|
||||
```
|
||||
@@ -41,7 +41,7 @@ NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
|
||||
echo "$NEW_SUBDOMAIN.$VHOST"
|
||||
```
|
||||
|
||||
If the `nginx-hostname` has no output, the normal hostname algorithm will be executed.
|
||||
If the `nginx-hostname` plugin has no output, the normal hostname algorithm will be executed.
|
||||
|
||||
## Disabling VHOSTS
|
||||
|
||||
@@ -75,6 +75,54 @@ dokku domains:remove myapp example.com
|
||||
dokku domains:set myapp example.com example.org
|
||||
```
|
||||
|
||||
## Displaying domains reports about an app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can get a report about the app's domains status using the `domains:report` command:
|
||||
|
||||
```shell
|
||||
dokku domains:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app domains information
|
||||
Domains app enabled: true
|
||||
Domains app vhosts: ruby-sample.example.org
|
||||
Domains global enabled: true
|
||||
Domains global vhosts: example.org
|
||||
=====> python-sample domains information
|
||||
Domains app enabled: true
|
||||
Domains app vhosts: ruby-sample.example.org
|
||||
Domains global enabled: true
|
||||
Domains global vhosts: example.org
|
||||
=====> ruby-sample domains information
|
||||
Domains app enabled: true
|
||||
Domains app vhosts: ruby-sample.example.org
|
||||
Domains global enabled: true
|
||||
Domains global vhosts: example.org
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku domains:report node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app domains information
|
||||
Domains app enabled: true
|
||||
Domains app vhosts: node-js-app.example.org
|
||||
Domains global enabled: true
|
||||
Domains global vhosts: example.org
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku domains:report node-js-app --domains-app-enabled
|
||||
```
|
||||
|
||||
## Default site
|
||||
|
||||
By default, Dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to the global nginx configuration.
|
||||
@@ -92,6 +140,8 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
Make sure to reload nginx after creating this file by running `service nginx reload`.
|
||||
|
||||
This will catch all unknown HOST header values and return a `410 Gone` response. You can replace the `return 410;` with `return 444;` which will cause nginx to not respond to requests that do not match known domains (connection refused).
|
||||
|
||||
The configuration file must be loaded before `/etc/nginx/conf.d/dokku.conf`, so it can not be arranged as a vhost in `/etc/nginx/sites-enabled` that is only processed afterwards.
|
||||
|
||||
@@ -7,8 +7,8 @@ Dokku supports SSL/TLS certificate inspection and CSR/Self-signed certificate ge
|
||||
```
|
||||
certs:add <app> CRT KEY # Add an ssl endpoint to an app. Can also import from a tarball on stdin.
|
||||
certs:generate <app> DOMAIN # Generate a key and certificate signing request (and self-signed certificate)
|
||||
certs:info <app> # Show certificate information for an ssl endpoint.
|
||||
certs:remove <app> # Remove an SSL Endpoint from an app.
|
||||
certs:report [<app>] [<flag>] # Displays an ssl report for one or more apps
|
||||
certs:update <app> CRT KEY # Update an SSL Endpoint on an app. Can also import from a tarball on stdin
|
||||
```
|
||||
|
||||
@@ -50,32 +50,66 @@ Note that with the default nginx template, requests will be redirected to the `h
|
||||
|
||||
The `certs:generate` command will walk you through the correct `openssl` commands to create a key, csr and a self-signed cert for a given app/domain. We automatically put the self-signed cert in place as well as add the specified domain to the application configuration.
|
||||
|
||||
If you decide to obtain a CA signed certficate, you can import that certificate using the aformentioned `dokku certs:add` command.
|
||||
|
||||
### Certificate information
|
||||
|
||||
The `certs:info` command will simply inspect the install SSL cert and print out details. NOTE: The server-wide certificate will be inspect if installed and no app-specific certificate exists.
|
||||
|
||||
```shell
|
||||
dokku certs:info node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
-----> Fetching SSL Endpoint info for node-js-app...
|
||||
-----> Certificate details:
|
||||
=====> Common Name(s):
|
||||
=====> test.dokku.me
|
||||
=====> Expires At: Aug 24 23:32:59 2016 GMT
|
||||
=====> Issuer: C=US, ST=California, L=San Francisco, O=dokku.me, CN=test.dokku.me
|
||||
=====> Starts At: Aug 25 23:32:59 2015 GMT
|
||||
=====> Subject: C=US; ST=California; L=San Francisco; O=dokku.me; CN=test.dokku.me
|
||||
=====> SSL certificate is self signed.
|
||||
```
|
||||
If you decide to obtain a CA signed certificate, you can import that certificate using the aforementioned `dokku certs:add` command.
|
||||
|
||||
### Certificate removal
|
||||
|
||||
The `certs:remove` command only works on app-specific certificates. It will `rm` the app-specific tls directory, rebuild the nginx configuration, and reload nginx.
|
||||
|
||||
### Displaying certificate reports about an app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can get a report about the apps ssl status using the `certs:report` command:
|
||||
|
||||
```shell
|
||||
dokku certs:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-sample
|
||||
Ssl dir: /home/dokku/node-js-sample/tls
|
||||
Ssl enabled: true
|
||||
Ssl hostnames: *.node-js-sample.org node-js-sample.org
|
||||
Ssl expires at: Oct 5 23:59:59 2019 GMT
|
||||
Ssl issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA
|
||||
Ssl starts at: Oct 5 00:00:00 2016 GMT
|
||||
Ssl subject: OU=Domain Control Validated; OU=PositiveSSL Wildcard; CN=*.node-js-sample.org
|
||||
Ssl verified: self signed.
|
||||
=====> python-sample
|
||||
Ssl dir: /home/dokku/python-sample/tls
|
||||
Ssl enabled: false
|
||||
Ssl hostnames:
|
||||
Ssl expires at:
|
||||
Ssl issuer:
|
||||
Ssl starts at:
|
||||
Ssl subject:
|
||||
Ssl verified:
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku certs:report node-js-sample
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-sample ssl information
|
||||
Ssl dir: /home/dokku/node-js-sample/tls
|
||||
Ssl enabled: true
|
||||
Ssl hostnames: *.example.org example.org
|
||||
Ssl expires at: Oct 5 23:59:59 2019 GMT
|
||||
Ssl issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA
|
||||
Ssl starts at: Oct 5 00:00:00 2016 GMT
|
||||
Ssl subject: OU=Domain Control Validated; OU=PositiveSSL Wildcard; CN=*.example.org
|
||||
Ssl verified: self signed.
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku certs:report node-js-sample --ssl-enabled
|
||||
```
|
||||
|
||||
## HSTS Header
|
||||
|
||||
@@ -85,7 +119,7 @@ Beware that if you enable the header and a subsequent deploy of your application
|
||||
|
||||
## Running behind a load balancer
|
||||
|
||||
Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarded-For` and `X-Forwarded-Port`. These headers indicate the protocol of the original request (HTTP or HTTPS), the port number, and the IP address of the client making the request, respectively. The default configuration is for Nginx to set these headers.
|
||||
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.
|
||||
|
||||
If your server runs behind an HTTP/S load balancer, then Nginx will see all requests as coming from the load balancer. If your load balancer sets the `X-Forwarded-` headers, you can tell Nginx to pass these headers from load balancer to your application by using the following [nginx custom template](/dokku/configuration/nginx/#customizing-the-nginx-configuration)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ Once Dokku has been configured with at least one user, applications can be deplo
|
||||
|
||||
```shell
|
||||
# from your local machine
|
||||
# SSH access to github must be enabled on this host
|
||||
git clone git@github.com:heroku/ruby-rails-sample.git
|
||||
```
|
||||
|
||||
@@ -52,6 +53,8 @@ Now you can deploy the `ruby-rails-sample` app to your Dokku server. All you hav
|
||||
|
||||
```shell
|
||||
# from your local machine
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
cd ruby-rails-sample
|
||||
git remote add dokku dokku@dokku.me:ruby-rails-sample
|
||||
git push dokku master
|
||||
```
|
||||
@@ -90,6 +93,18 @@ Dokku supports deploying applications via [Heroku buildpacks](https://devcenter.
|
||||
|
||||
Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku <local branch>:master```
|
||||
|
||||
An alternative is to use the `DOKKU_DEPLOY_BRANCH` application config value to specify a branch that should be deployed. The implicit default is master, and this can be modified both at the app and global level:
|
||||
|
||||
```shell
|
||||
# on your Dokku host
|
||||
|
||||
# set it globally
|
||||
dokku config:set --global DOKKU_DEPLOY_BRANCH=some-branch
|
||||
|
||||
# override for a specific app
|
||||
dokku config:set ruby-rails-sample DOKKU_DEPLOY_BRANCH=some-branch
|
||||
```
|
||||
|
||||
You can also support pushing multiple branches using the [receive-branch](/dokku/development/plugin-triggers/#receive-branch) plugin trigger in a custom plugin.
|
||||
|
||||
### Skipping deployment
|
||||
@@ -130,6 +145,8 @@ Note that if the buildpack or dockerfile build process require ssh key access fo
|
||||
The name of remote repository is used as the name of application to be deployed, as for example above:
|
||||
|
||||
```shell
|
||||
# from your local machine
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
git remote add dokku dokku@dokku.me:ruby-rails-sample
|
||||
git push dokku master
|
||||
```
|
||||
@@ -142,6 +159,8 @@ remote: http://ruby-rails-sample.dokku.me
|
||||
You can also specify fully qualified names, say `app.dokku.me`, as
|
||||
|
||||
```shell
|
||||
# from your local machine
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
git remote add dokku dokku@dokku.me:app.dokku.me
|
||||
git push dokku master
|
||||
```
|
||||
@@ -154,6 +173,8 @@ remote: http://app.dokku.me
|
||||
This is in particular useful, then you want to deploy to root domain, as
|
||||
|
||||
```shell
|
||||
# from your local machine
|
||||
# the remote username *must* be dokku or pushes will fail
|
||||
git remote add dokku dokku@dokku.me:dokku.me
|
||||
git push dokku master
|
||||
```
|
||||
|
||||
@@ -3,20 +3,24 @@
|
||||
> New as of 0.3.1
|
||||
|
||||
```
|
||||
apps # List your apps
|
||||
apps:clone <old-app> <new-app> # Clones an app
|
||||
apps:create <app> # Create a new app
|
||||
apps:destroy <app> # Permanently destroy an app
|
||||
apps:list # List your apps
|
||||
apps:rename <old-app> <new-app> # Rename an app
|
||||
apps:report [<app>] [<flag>] # Display report about an app
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Listing Applications
|
||||
|
||||
You can easily list all available applications using the `apps` command:
|
||||
> New as of 0.8.1. Use the `apps` command for older versions.
|
||||
|
||||
You can easily list all available applications using the `apps:list` command:
|
||||
|
||||
```shell
|
||||
dokku apps
|
||||
dokku apps:list
|
||||
```
|
||||
|
||||
```
|
||||
@@ -28,7 +32,7 @@ python-app
|
||||
Note that you can easily hide extra output from Dokku commands by using the `--quiet` flag, which makes it easier to parse on the command-line.
|
||||
|
||||
```shell
|
||||
dokku --quiet apps
|
||||
dokku --quiet apps:list
|
||||
```
|
||||
|
||||
```
|
||||
@@ -112,3 +116,72 @@ Renaming node-js-app to io-js-app... done
|
||||
```
|
||||
|
||||
This will copy all of your app's contents into a new app directory with the name of your choice, delete your old app, then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved.
|
||||
|
||||
### Cloning an existing app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can clone an existing app using the `apps:clone` command. Note that the application *must* have been deployed at least once, or the rename will not complete successfully:
|
||||
|
||||
```shell
|
||||
dokku apps:clone node-js-app io-js-app
|
||||
```
|
||||
|
||||
```
|
||||
Cloning node-js-app to io-js-app... done
|
||||
```
|
||||
|
||||
This will copy all of your app's contents into a new app directory with the name of your choice and then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved.
|
||||
|
||||
> Warning: If you have exposed specific ports via docker-options, added generic domains, or performed anything that cannot be done against multiple applications, `apps:clone` may result in errors.
|
||||
|
||||
By default, Dokku will deploy this new application, though you can skip the deploy by using the `--skip-deploy` flag:
|
||||
|
||||
```shell
|
||||
dokku apps:clone --skip-deploy node-js-app io-js-app
|
||||
```
|
||||
|
||||
### Displaying reports about an app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can get a report about the deployed apps using the `apps:report` command:
|
||||
|
||||
```shell
|
||||
dokku apps:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app
|
||||
App dir: /home/dokku/node-js-app
|
||||
Git sha: dbddc3f
|
||||
App cid: 7b18489c98be
|
||||
Status: running
|
||||
=====> python-sample
|
||||
not deployed
|
||||
=====> ruby-sample
|
||||
App dir: /home/dokku/ruby-sample
|
||||
Git sha: a2d477c
|
||||
App cid: 78a44d71012a
|
||||
Status: running
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku apps:report node-js-app
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-app
|
||||
App dir: /home/dokku/node-js-app
|
||||
Git sha: dbddc3f
|
||||
App cid: 7b18489c98be
|
||||
Status: running
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku apps:report node-js-app --git-sha
|
||||
```
|
||||
|
||||
@@ -4,15 +4,16 @@
|
||||
|
||||
```
|
||||
ps <app> # List processes running in app container(s)
|
||||
ps:rebuildall # Rebuild all apps from source
|
||||
ps:rebuild <app> # Rebuild an app from source
|
||||
ps:restartall # Restart all deployed app containers
|
||||
ps:rebuildall # Rebuild all apps from source
|
||||
ps:report [<app>] [<flag>] # Displays a process report for one or more apps
|
||||
ps:restart <app> # Restart app container(s)
|
||||
ps:scale <app> <proc>=<count> [<proc>=<count>] # Set how many processes of a given process to run
|
||||
ps:restart-policy <app> # Shows the restart-policy for an app
|
||||
ps:restartall # Restart all deployed app containers
|
||||
ps:scale <app> <proc>=<count> [<proc>=<count>] # Get/Set how many instances of a given process to run
|
||||
ps:set-restart-policy <app> <policy> # Sets app restart-policy
|
||||
ps:start <app> # Start app container(s)
|
||||
ps:stop <app> # Stop app container(s)
|
||||
ps:restart-policy <app> # Shows the restart-policy for an app
|
||||
ps:set-restart-policy <app> <policy> # Sets app restart-policy
|
||||
```
|
||||
|
||||
By default, Dokku will only start a single `web` process - if defined - though process scaling can be managed by the `ps` plugin or [via a custom `DOKKU_SCALE` file](/dokku/deployment/process-management/#manually-managing-process-scaling).
|
||||
@@ -31,7 +32,7 @@ dokku ps node-js-app
|
||||
|
||||
### Rebuilding applications
|
||||
|
||||
There are some Dokku commands which will not automatically rebuild an application's environment, or which can be told to skip a rebuild. For instance, you may wish to run mulitple `config:set` commands without a restart so as to speed up configuration. In these cases, you can ultimately trigger an application rebuild using `ps:rebuild`
|
||||
There are some Dokku commands which will not automatically rebuild an application's environment, or which can be told to skip a rebuild. For instance, you may wish to run multiple `config:set` commands without a restart so as to speed up configuration. In these cases, you can ultimately trigger an application rebuild using `ps:rebuild`
|
||||
|
||||
```shell
|
||||
dokku ps:rebuild node-js-app
|
||||
@@ -92,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` reponse for the default nginx proxy implementation.
|
||||
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.
|
||||
|
||||
```shell
|
||||
dokku ps:stop node-js-app
|
||||
|
||||
@@ -56,6 +56,13 @@ Admin users and root can also add keys remotely:
|
||||
cat ~/.ssh/id_rsa.pub | ssh dokku@dokku.me ssh-keys:add KEY_NAME
|
||||
```
|
||||
|
||||
If you are using an ssh user other than `dokku`, then you'll also need to specify the `dokku` bin:
|
||||
|
||||
```shell
|
||||
cat ~/.ssh/id_rsa.pub | ssh root@dokku.me dokku ssh-keys:add KEY_NAME
|
||||
```
|
||||
|
||||
|
||||
Finally, if you are using the vagrant installation, you can also use the `make vagrant-acl-add` target to add your public key to Dokku (it will use your host username as the `USER`):
|
||||
|
||||
```shell
|
||||
@@ -73,3 +80,16 @@ dokku ssh-keys:remove KEY_NAME
|
||||
## Scoping commands to specific users
|
||||
|
||||
Keys are given unique names, which can be used in conjunction with the [user-auth](/dokku/development/plugin-triggers/#user-auth) plugin trigger to handle command authorization. Please see the documentation on that trigger for more information.
|
||||
|
||||
## Granting other Unix user accounts Dokku access
|
||||
|
||||
Any Unix user account which belongs to the 'sudo' Unix group can run Dokku. However, you may want to give them Dokku access but not full sudo privileges.
|
||||
|
||||
To allow other Unix user accounts to be able to run Dokku commands, without giving them full sudo access, modify your sudoers configuration.
|
||||
|
||||
Use `visudo /etc/sudoers.d/dokku-users`, or `visudo /etc/sudoers` to add the following line:
|
||||
|
||||
```
|
||||
%dokku ALL=(ALL:ALL) NOPASSWD:SETENV: /usr/bin/dokku
|
||||
```
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
checks <app> Show zero-downtime status
|
||||
checks:disable <app> [process-type(s)] Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)] Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
checks:report [<app>] [<flag>] Displays a checks report for one or more apps
|
||||
checks:run <app> [process-type(s)] Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
checks:skip <app> [process-type(s)] Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
```
|
||||
@@ -61,6 +62,46 @@ dokku checks:disable node-js-app worker
|
||||
DOKKU_CHECKS_SKIPPED: web
|
||||
```
|
||||
|
||||
### Displaying checks reports about an app
|
||||
|
||||
> New as of 0.8.1
|
||||
|
||||
You can get a report about the app's checks status using the `checks:report` command:
|
||||
|
||||
```shell
|
||||
dokku checks:report
|
||||
```
|
||||
|
||||
```
|
||||
=====> search checks information
|
||||
Checks disabled list: none
|
||||
Checks skipped list: none
|
||||
=====> python-sample checks information
|
||||
Checks disabled list: none
|
||||
Checks skipped list: none
|
||||
=====> ruby-sample checks information
|
||||
Checks disabled list: _all_
|
||||
Checks skipped list: none
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
|
||||
```shell
|
||||
dokku checks:report node-js-sample
|
||||
```
|
||||
|
||||
```
|
||||
=====> node-js-sample checks information
|
||||
Checks disabled list: none
|
||||
Checks skipped list: none
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku checks:report node-js-sample --checks-disabled-list
|
||||
```
|
||||
|
||||
## Customizing Checks
|
||||
|
||||
If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Plugin Creation
|
||||
|
||||
Plugins can simply be implementations of [triggers](/dokku/development/plugin-triggers) or they may implement a command structure of their own. Dokku has no restrictions on the language in which a plugin is implemented, it only cares that the plugin implements the appropriate [commands](/dokku/development/plugin-creation#command-api) or [triggers](/dokku/development/plugin-triggers) API. NOTE: all files that implement the triggers or commands API must be executable.
|
||||
|
||||
If you create your own plugin:
|
||||
|
||||
1. Take a look at the plugins shipped with Dokku and hack away!
|
||||
@@ -9,6 +11,23 @@ If you create your own plugin:
|
||||
5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
|
||||
|
||||
|
||||
### Compilable Plugins (i.e. golang, java(?), c, etc.)
|
||||
The plugin developer is required to implement the `install` trigger such that it will output your built executable(s) in the correct directory structure to implement the plugin's desired command and/or trigger API. See [smoke-test-plugin](https://github.com/dokku/smoke-test-plugin) for an example.
|
||||
|
||||
|
||||
### Command API
|
||||
There are 3 main implementation points: `commands`, `subcommands/default`, and `subcommands/<command-name>`
|
||||
|
||||
#### commands
|
||||
Primarily used to supply the plugin's usage/help output. (i.e. [plugin help](https://github.com/dokku/dokku/tree/master/plugins/plugin/commands))
|
||||
|
||||
#### subcommands/default
|
||||
Implements the plugin's default command behavior. (i.e. [`dokku plugin`](https://github.com/dokku/dokku/tree/master/plugins/plugin/subcommands/default))
|
||||
|
||||
#### subcommands/<command-name>
|
||||
Implements the additional command interface and will translate to `dokku plugin:cmd` on the command line. (i.e. [`dokku plugin:install`](https://github.com/dokku/dokku/tree/master/plugins/plugin/subcommands/install))
|
||||
|
||||
|
||||
### Sample plugin
|
||||
The below plugin is a dummy `dokku hello` plugin.
|
||||
|
||||
@@ -30,7 +49,7 @@ hello_main_cmd() {
|
||||
set -- $cmd $@
|
||||
##
|
||||
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2";
|
||||
|
||||
@@ -58,7 +77,7 @@ hello_world_cmd() {
|
||||
set -- $cmd $@
|
||||
##
|
||||
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2";
|
||||
|
||||
|
||||
@@ -321,6 +321,10 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
> WARNING: The `git-pre-pull` trigger should _not_ be used for authentication
|
||||
since it does not get called for commands that use `git-upload-archive` such
|
||||
as `git archive`. Instead, use the [`user-auth`](#user-auth) trigger.
|
||||
|
||||
### `install`
|
||||
|
||||
- Description: Used to setup any files/configuration for a plugin.
|
||||
@@ -481,6 +485,28 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
sudo service haproxy reload
|
||||
```
|
||||
|
||||
### `post-extract`
|
||||
|
||||
- Description: Allows you to modify the contents of an application *after* it has been extracted from git/tarball but *before* the image source type is detected.
|
||||
- Invoked by: `dokku tar:in`, `dokku tar:from` and the `receive-app` plugin trigger
|
||||
- Arguments: `$APP` `$TMP_WORK_DIR` `$REV`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Adds a clock process to an app's Procfile
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
APP="$1"; verify_app_name "$APP"
|
||||
TMP_WORK_DIR="$2"
|
||||
REV="$3" # optional, may not be sent for tar-based builds
|
||||
|
||||
pushd "$TMP_WORK_DIR" > /dev/null
|
||||
touch Procfile
|
||||
echo "clock: some-command" >> Procfile
|
||||
```
|
||||
|
||||
### `post-proxy-ports-update`
|
||||
|
||||
- Description: Allows you to run commands once the proxy port mappings for an application have been updated. It also sends the invoking command. This can be "add", "clear" or "remove".
|
||||
|
||||
@@ -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.8.0-2 (Mon Feb 22 23:20:37 CET 2016)"
|
||||
# wait for "==> build-arch: ==> Finished making: dokku 0.9.3-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'
|
||||
|
||||
@@ -52,7 +52,7 @@ Once Dokku is installed, if you are not using the web-installer, you'll want to
|
||||
|
||||
Set up a domain and a wildcard domain pointing to that host. Make sure `/home/dokku/VHOST` is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (`dig +short $(hostname -f)`). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, Dokku will publish the app with a port number (i.e. `http://example.com:49154` - note the missing subdomain).
|
||||
|
||||
Follow the [user management documentation](/dokku/deployment/user-management/) in order to add users to dokku.
|
||||
Follow the [user management documentation](/dokku/deployment/user-management/) in order to add users to Dokku, or to give other Unix accounts access to Dokku.
|
||||
|
||||
That's it!
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# Installing on Linode
|
||||
|
||||
When installing Dokku on a Linode server, you'll likely see an error during Docker installation:
|
||||
|
||||
> Warning: current kernel is not supported by the linux-image-extra-virtual package. We have no AUFS support. Consider installing the packages linux-image-virtual kernel and linux-image-extra-virtual for AUFS support.
|
||||
|
||||
After 10 seconds, the installation will continue as normal.
|
||||
|
||||
This warning is the result of Linode using its own kernel, which does not support AUFS, instead of using the kernel supplied by Ubuntu. If you ignore the warning, Docker will fall back to using the DeviceMapper storage backend and Dokku will work normally. However, AUFS is better tested and will perform better.
|
||||
|
||||
If you would like to use AUFS, follow the steps below to install Ubuntu's kernel and configure your server to boot it instead of Linode's.
|
||||
|
||||
## Preparing your Linode for AUFS
|
||||
|
||||
__Warning__: These steps will delete *everything* on your Linode.
|
||||
|
||||
1. Open your server's dashboard in the [Linode Manager](https://manager.linode.com/).
|
||||
|
||||
2. Make sure your Linode is [using KVM](https://www.linode.com/docs/platform/kvm#how-to-enable-kvm), not Xen, for virtualization.
|
||||
|
||||
3. In the "Rebuild" tab, select "Ubuntu 14.04 LTS", set a root password, and rebuild.
|
||||
|
||||
4. Once your Linode has been created, click "Boot" and wait for it to complete.
|
||||
|
||||
5. SSH into your Linode as root and run the following commands:
|
||||
|
||||
```shell
|
||||
apt-get update
|
||||
apt-get -qq upgrade
|
||||
apt-get install linux-image-virtual linux-image-extra-virtual
|
||||
```
|
||||
|
||||
6. When prompted, install Grub onto the first hard drive.
|
||||
|
||||
7. Back in your server's dashboard, click "Edit" on its Configuration Profile
|
||||
|
||||
8. Change the "Kernel" option to "GRUB 2" and save your changes.
|
||||
|
||||
9. Lastly, reboot the Linode.
|
||||
|
||||
Once your server comes back online, you'll be running Ubuntu's default kernel. You can now follow Dokku's [normal installation instructions](/dokku/getting-started/installation/) and `bootstrap.sh` will take care of everything else.
|
||||
@@ -1,18 +1,27 @@
|
||||
# RPM Package Installation Notes
|
||||
|
||||
> New as of 0.8.0
|
||||
> New as of 0.8.0 *(experimental)*
|
||||
|
||||
>**Warning:** Web installer is not available on CentOS. You will need to configure [SSH keys](/dokku/deployment/user-management/#adding-ssh-keys) and [virtual hosts](/dokku/configuration/domains/#customizing-hostnames) using dokku command line interface.
|
||||
|
||||
Dokku defaults to being installed via RPM package on CentOS 7. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script:
|
||||
|
||||
```shell
|
||||
# install docker
|
||||
# Install docker
|
||||
curl -fsSL https://get.docker.com/ | sh
|
||||
|
||||
# install epel for nginx packages to be available
|
||||
# Install epel for nginx packages to be available
|
||||
sudo yum install -y epel-release
|
||||
|
||||
# install dokku
|
||||
# Install dokku
|
||||
curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | sudo bash
|
||||
sudo yum install -y herokuish dokku
|
||||
sudo dokku plugin:install-dependencies --core
|
||||
systemctl start nginx
|
||||
|
||||
# Enable docker and nginx on system startup
|
||||
systemctl enable docker
|
||||
systemctl enable nginx
|
||||
```
|
||||
|
||||
The [devicemapper](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/) is the default Docker storage driver on CentOS 7 and defaults to a configuration mode known as `loop-lvm`. This mode is designed to work out-of-the-box with no additional configuration. However, production deployments should not run under `loop-lvm` mode. The preferred configuration for production deployments is [`direct-lvm`](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#/configure-direct-lvm-mode-for-production).
|
||||
|
||||
@@ -21,13 +21,15 @@
|
||||
cd path/to/dokku
|
||||
vagrant up
|
||||
```
|
||||
- Setup SSH Config in `~/.ssh/config`. The port listed here is usually correct, though you may want to verify that it is the same as the one listed in the output of `vagrant ssh-config dokku`
|
||||
- Setup SSH Config in `~/.ssh/config`.
|
||||
|
||||
```ini
|
||||
Host dokku.me
|
||||
Port 22
|
||||
```
|
||||
|
||||
> For users that have customized the IP address of their VM - either in a custom `Vagrantfile` or via the `DOKKU_IP` environment variable - and are not using `10.0.0.2` for the Vagrant IP, you'll need to instead use the output of `vagrant ssh-config dokku` for your ~/.ssh/config entry.
|
||||
|
||||
- Copy your SSH key via `cat ~/.ssh/id_rsa.pub | pbcopy` and paste it into the dokku-installer at http://dokku.me . Change the `Hostname` field on the Dokku Setup screen to your domain and then check the box that says `Use virtualhost naming`. Then click *Finish Setup* to install your key. You'll be directed to application deployment instructions from here.
|
||||
|
||||
Please note, the `dokku.me` domain is setup to point to `10.0.0.2` along with all subdomains (ie yourapp.dokku.me). If you change the `DOKKU_IP` in your vagrant setup you'll need to update your `/etc/hosts` file to point your reconfigured ip address.
|
||||
|
||||
@@ -6,12 +6,12 @@ Dokku is an extensible, open source Platform as a Service that runs on a single
|
||||
|
||||
To start using Dokku, you'll need a system that meets the following minimum requirements:
|
||||
|
||||
- A fresh installation of [Ubuntu 14.04 x64](http://www.ubuntu.com/download/) with the FQDN set <sup>[1]</sup>
|
||||
- A fresh installation of [Ubuntu 16.04 x64](https://www.ubuntu.com/download), [Ubuntu 14.04 x64](https://www.ubuntu.com/download), [Debian 8.2 x64](https://www.debian.org/distrib/) or [CentOS 7 x64](https://www.centos.org/download/) *(experimental)* with the FQDN set <sup>[1]</sup>
|
||||
- At least `1GB` of system memory <sup>[2]</sup>
|
||||
|
||||
You can *optionally* have a domain name pointed at the host's IP, though this is not necessary.
|
||||
|
||||
Dokku is designed for usage on a fresh installation of Ubuntu, and should install all necessary dependencies if installing via the bootstrap method.
|
||||
Dokku is designed for usage on a fresh VM installation, and should install all necessary dependencies if installing via the bootstrap method.
|
||||
|
||||
### Installing the latest stable version
|
||||
|
||||
@@ -21,8 +21,8 @@ To install the latest stable version of dokku, you can run the following shell c
|
||||
|
||||
```shell
|
||||
# for debian systems, installs Dokku via apt-get
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh;
|
||||
sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh
|
||||
wget https://raw.githubusercontent.com/dokku/dokku/v0.9.3/bootstrap.sh;
|
||||
sudo DOKKU_TAG=v0.9.3 bash bootstrap.sh
|
||||
```
|
||||
|
||||
The installation process takes about 5-10 minutes, depending upon internet connection speed.
|
||||
@@ -33,6 +33,8 @@ Once the installation is complete, you can open a browser to setup your SSH 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](/dokku/deployment/user-management/#adding-ssh-keys) and [virtual hosts](/dokku/configuration/domains/#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.
|
||||
|
||||
@@ -42,7 +44,6 @@ For various reasons, certain hosting providers may have other steps that should
|
||||
|
||||
- [Digital Ocean Installation Notes](/dokku/getting-started/install/digitalocean)
|
||||
- [DreamHost Cloud Installation Notes](/dokku/getting-started/install/dreamhost/)
|
||||
- [Linode Installation Notes](/dokku/getting-started/install/linode/)
|
||||
- [Microsoft Azure Installation Notes](/dokku/getting-started/install/azure/)
|
||||
|
||||
As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started:
|
||||
|
||||
@@ -155,6 +155,8 @@ dokku config:set --global CURL_CONNECT_TIMEOUT=30
|
||||
|
||||
Please see https://github.com/dokku/dokku/issues/509
|
||||
|
||||
Another reason for this error (although it may respond immediately ruling out a timeout issue) may be because you've set the config setting `SSL_CERT_FILE`. Using a config setting with this key interferes with the buildpack's ability to download it's dependencies, so you must rename the config setting to something else, e.g. `MY_APP_SSL_CERT_FILE`.
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ Build fails with `Killed` message.
|
||||
|
||||
@@ -7,33 +7,33 @@
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400.8.0" rel="stylesheet" type="text/css">
|
||||
<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.8.0/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/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.8.0/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.9.3/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.8.0/docs/assets/style.css" rel="stylesheet">
|
||||
<link href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/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.8.0/bootstrap.sh</span>
|
||||
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.9.3/bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path"></span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh</span>
|
||||
<span class="command">sudo DOKKU_TAG=v0.9.3 bash bootstrap.sh</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="output"> # go to your server's IP and follow the web installer</span>
|
||||
@@ -173,7 +173,7 @@
|
||||
</div>
|
||||
|
||||
<div class="alternate-instructions">
|
||||
<p>Hate <code>curl | bash</code>? See our official <a href="https://github.com/Azure/azure-quickstart-templates/tree/master/dokku-vm" target="_blank">Azure</a>, <a href="https://www.digitalocean.com/features/one-click-apps/dokku/" target="_blank">DigitalOcean</a>, <a href="/{{NAME}}~{{REF}}/getting-started/install/dreamhost/">DreamHost Cloud</a>, and <a href="/{{NAME}}~{{REF}}/getting-started/install/linode/" target="_blank">Linode</a> instructions.<p>
|
||||
<p>Hate <code>curl | bash</code>? See our official <a href="https://github.com/Azure/azure-quickstart-templates/tree/master/dokku-vm" target="_blank">Azure</a>, <a href="https://www.digitalocean.com/features/one-click-apps/dokku/" target="_blank">DigitalOcean</a>, and <a href="/{{NAME}}~{{REF}}/getting-started/install/dreamhost/">DreamHost Cloud</a> instructions.<p>
|
||||
<p>Still no love? <a href="https://github.com/dokku/dokku/blob/master/CONTRIBUTING.md" target="_blank">Contributions welcome</a>!</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,29 +7,28 @@
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400:sans-serif|Open+Sans:400:sans-serif" rel="stylesheet" type="text/css">
|
||||
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/manifest.json">
|
||||
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/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.8.0/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/mstile-144x144.png">
|
||||
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.9.3/docs/assets/favicons/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<script>
|
||||
@@ -43,97 +42,18 @@
|
||||
</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.8.0/docs/assets/style.css" rel="stylesheet">
|
||||
<link href="https://cdn.rawgit.com/dokku/dokku/v0.9.3/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>
|
||||
.highlight-show-language {
|
||||
position: relative;
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
}
|
||||
.highlight-show-language-label {
|
||||
color: black;
|
||||
background-color: #CFCFCF;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
bottom: auto;
|
||||
left: auto;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
font-size: 0.9em;
|
||||
border-radius: 0 0 0 5px;
|
||||
padding: 0 0.5em;
|
||||
text-shadow: none;
|
||||
z-index: 1;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-transform: none;
|
||||
-moz-transform: none;
|
||||
-ms-transform: none;
|
||||
-o-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
.highlight-output pre {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
padding: 10px;
|
||||
}
|
||||
.improve-slideout {
|
||||
position: fixed;
|
||||
bottom: 66%;
|
||||
right: 0;
|
||||
-webkit-transition-duration: 0.3s;
|
||||
-moz-transition-duration: 0.3s;
|
||||
-o-transition-duration: 0.3s;
|
||||
transition-duration: 0.3s;
|
||||
background: #363637;
|
||||
padding: 5px 0px 4px;
|
||||
z-index: 90;
|
||||
}
|
||||
.improve-slideout:hover {
|
||||
right: 205px;
|
||||
}
|
||||
.improve-slideout:hover .improve-slideout-inner {
|
||||
right: 0;
|
||||
}
|
||||
.improve-slideout-inner {
|
||||
position: fixed;
|
||||
bottom: 66%;
|
||||
right: -205px;
|
||||
-webkit-transition-duration: 0.3s;
|
||||
-moz-transition-duration: 0.3s;
|
||||
-o-transition-duration: 0.3s;
|
||||
transition-duration: 0.3s;
|
||||
background: #e0e0d9;
|
||||
padding: 4px 12px;
|
||||
width: 205px;
|
||||
}
|
||||
.improve-slideout-inner h6 {
|
||||
color: #363637;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
margin: 0;
|
||||
.list-group-item {
|
||||
font-size: 14px;
|
||||
}
|
||||
.git-improve {
|
||||
font-size: 20px;
|
||||
vertical-align: -2px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
.back-to-contents {
|
||||
position: fixed;
|
||||
bottom: calc(66% - 34px);
|
||||
right: 0;
|
||||
background: #363637;
|
||||
padding: 5px 0px 4px;
|
||||
z-index: 90;
|
||||
}
|
||||
.icon-improve {
|
||||
color: #bdbdb5;
|
||||
padding: 2px 9px 0 10px;
|
||||
font-size: 14px;
|
||||
.markdown-body {
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
12
dokku
12
dokku
@@ -35,10 +35,12 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
parse_args "$@"
|
||||
args=("$@")
|
||||
skip_arg=false
|
||||
if [[ "${args[0]}" =~ ^--.* ]]; then
|
||||
for arg in "$@"; do
|
||||
$skip_arg && skip_arg=false && continue
|
||||
if [[ "$arg" == "--app" ]]; then
|
||||
shift 2
|
||||
shift 2 && skip_arg=true
|
||||
elif [[ "$arg" =~ ^--.* ]]; then
|
||||
shift 1
|
||||
else
|
||||
@@ -54,8 +56,12 @@ if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]] && [[ ! $1 == "ssh-keys:
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [[ $(id -un) != "root" && $1 =~ ^plugin:.* ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]]; then
|
||||
dokku_log_fail "This command must be run as root"
|
||||
if [[ $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $1 == "ssh-keys:add" ]]; then
|
||||
if [[ $(id -un) != "root" ]]; then
|
||||
dokku_log_fail "This command must be run as root"
|
||||
else
|
||||
export SSH_USER=root
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core standard plugin"
|
||||
version = "0.8.0"
|
||||
version = "0.9.3"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
exec_app_json_scripts() {
|
||||
declare desc="core app.json scripts execution"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
dokku_run_cmd() {
|
||||
|
||||
@@ -10,6 +10,7 @@ flag_rsyslog_needs_restart=n
|
||||
|
||||
# This can be done unconditionally as mkdir -p
|
||||
# exits gracefully if the path already exists
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -m 775 -p "$DOKKU_LOGS_DIR"
|
||||
case "$DOKKU_DISTRO" in
|
||||
arch|debian|centos)
|
||||
@@ -59,7 +60,7 @@ $DOKKU_LOGS_DIR/*.log {
|
||||
EOF
|
||||
|
||||
if [[ "$DOKKU_DISTRO" = "debian" ]]; then
|
||||
sed -i '/\s*su syslog dokku/d; s/\(create [0-7][0-7][0-7]\) syslog dokku/\1 root dokku/g' $DOKKU_LOGROTATE_FILE
|
||||
sed -i 's/ syslog dokku$/root dokku/g' $DOKKU_LOGROTATE_FILE
|
||||
fi
|
||||
|
||||
flag_rsyslog_needs_restart=y
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core events logging plugin"
|
||||
version = "0.8.0"
|
||||
version = "0.9.3"
|
||||
[plugin.config]
|
||||
|
||||
@@ -1,36 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | apps:help)
|
||||
help_content_func () {
|
||||
declare desc="return apps plugin help content"
|
||||
cat<<help_content
|
||||
apps, List your apps
|
||||
apps:create <app>, Create a new app
|
||||
apps:destroy <app>, Permanently destroy an app
|
||||
apps:rename <old-app> <new-app>, Rename an app
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "apps:help" ]] ; then
|
||||
echo -e 'Usage: dokku apps[:COMMAND]'
|
||||
echo ''
|
||||
echo 'List your apps.'
|
||||
echo ''
|
||||
echo 'Example:'
|
||||
echo ''
|
||||
echo '$ dokku apps'
|
||||
echo '=====> My Apps'
|
||||
echo 'example'
|
||||
echo 'example2'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
apps_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
51
plugins/apps/internal-functions
Executable file
51
plugins/apps/internal-functions
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
apps_help_content_func() {
|
||||
declare desc="return apps plugin help content"
|
||||
cat<<help_content
|
||||
apps, [DEPRECATED] Alias for apps:list
|
||||
apps:clone <old-app> <new-app>, Clones an app
|
||||
apps:create <app>, Create a new app
|
||||
apps:destroy <app>, Permanently destroy an app
|
||||
apps:list, List your apps
|
||||
apps:rename <old-app> <new-app>, Rename an app
|
||||
apps:report [<app>] [<flag>], Display report about an app
|
||||
help_content
|
||||
}
|
||||
|
||||
apps_help_cmd() {
|
||||
if [[ $1 = "apps:help" ]] ; then
|
||||
echo -e 'Usage: dokku apps[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps'
|
||||
echo ''
|
||||
echo 'Example:'
|
||||
echo ''
|
||||
echo '$ dokku apps:list'
|
||||
echo '=====> My Apps'
|
||||
echo 'example'
|
||||
echo 'example2'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
apps_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
apps_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
apps, Manage Dokku apps
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
|
||||
apps_list_cmd() {
|
||||
declare desc="lists all apps"
|
||||
local cmd="apps"
|
||||
local app
|
||||
|
||||
dokku_log_info2_quiet "My Apps"
|
||||
for app in $(dokku_apps); do
|
||||
echo "$app"
|
||||
done
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core apps plugin"
|
||||
version = "0.8.0"
|
||||
version = "0.9.3"
|
||||
[plugin.config]
|
||||
|
||||
39
plugins/apps/subcommands/clone
Executable file
39
plugins/apps/subcommands/clone
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
apps_clone_cmd() {
|
||||
declare desc="clones an app"
|
||||
declare OLD_APP="$2" NEW_APP="$3"
|
||||
local cmd="apps:clone"
|
||||
local SKIP_REBUILD=false
|
||||
|
||||
if [[ "$2" == "--skip-deploy" ]]; then
|
||||
SKIP_REBUILD=true
|
||||
OLD_APP="$3"
|
||||
NEW_APP="$4"
|
||||
fi
|
||||
|
||||
[[ -z "$OLD_APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
[[ -d "$DOKKU_ROOT/$NEW_APP" ]] && dokku_log_fail "Name is already taken"
|
||||
local NEW_CACHE_DIR="$DOKKU_ROOT/$NEW_APP/cache"
|
||||
|
||||
apps_create "$NEW_APP"
|
||||
cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP"
|
||||
|
||||
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
|
||||
fi
|
||||
rm -rf "$NEW_CACHE_DIR"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS"
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
[[ "$SKIP_REBUILD" == "true" ]] || ps_rebuild "$NEW_APP"
|
||||
plugn trigger post-app-clone "$OLD_APP" "$NEW_APP"
|
||||
echo "Cloning $OLD_APP to $NEW_APP... done"
|
||||
}
|
||||
|
||||
apps_clone_cmd "$@"
|
||||
@@ -1,16 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
apps_main_cmd() {
|
||||
declare desc="lists all apps"
|
||||
local cmd="apps"
|
||||
local app
|
||||
|
||||
dokku_log_info2_quiet "My Apps"
|
||||
for app in $(dokku_apps); do
|
||||
echo "$app"
|
||||
done
|
||||
}
|
||||
|
||||
apps_main_cmd "$@"
|
||||
dokku_log_warn "Deprecated: Please use apps:list"
|
||||
apps_list_cmd "$@"
|
||||
|
||||
5
plugins/apps/subcommands/list
Executable file
5
plugins/apps/subcommands/list
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||
|
||||
apps_list_cmd "$@"
|
||||
92
plugins/apps/subcommands/report
Executable file
92
plugins/apps/subcommands/report
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
|
||||
report_single_app() {
|
||||
declare APP="$1" INFO_FLAG="$2"
|
||||
local APP_DIR="$DOKKU_ROOT/$APP"
|
||||
local use_echo;
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
use_echo=true
|
||||
INFO_FLAG=""
|
||||
fi
|
||||
verify_app_name "$APP"
|
||||
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
|
||||
if [[ -n $DOKKU_APP_CIDS ]]; then
|
||||
local cid
|
||||
for CID in $DOKKU_APP_CIDS; do
|
||||
local APP_CONTAINER_STATUS
|
||||
local DOKKU_APP_CID
|
||||
DOKKU_APP_CID=$CID
|
||||
APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Status}}' "$CID")
|
||||
done
|
||||
fi
|
||||
local flag_map=(
|
||||
"--app-dir: $APP_DIR"
|
||||
"--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2> /dev/null || false)"
|
||||
"--app-cid: ${DOKKU_APP_CID:0:12}"
|
||||
"--status: $APP_CONTAINER_STATUS"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
dokku_log_info2 "$APP"
|
||||
if (is_deployed "$APP"); then
|
||||
for flag in "${flag_map[@]}"; do
|
||||
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
if [[ "$use_echo" ]]; then
|
||||
echo "not deployed"
|
||||
else
|
||||
dokku_log_fail "not deployed"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
value=${flag#*: }
|
||||
size="${#value}"
|
||||
if [[ "$size" -ne 0 ]]; then
|
||||
echo "$value" && match=true && value_exists=true
|
||||
else
|
||||
match=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ "$match" == "true" ]]; then
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
else
|
||||
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
apps_report_cmd() {
|
||||
declare desc="displays the app report for one or more apps"
|
||||
local cmd="apps:report"
|
||||
local INSTALLED_APPS=$(dokku_apps)
|
||||
local APP="$2" INFO_FLAG="$3"
|
||||
|
||||
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
|
||||
INFO_FLAG="$APP"
|
||||
APP=""
|
||||
fi
|
||||
|
||||
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
|
||||
INFO_FLAG="true"
|
||||
fi
|
||||
|
||||
if [[ -z "$APP" ]]; then
|
||||
for app in $INSTALLED_APPS; do
|
||||
report_single_app "$app" "$INFO_FLAG" | tee || true
|
||||
done
|
||||
else
|
||||
report_single_app "$APP" "$INFO_FLAG"
|
||||
fi
|
||||
}
|
||||
|
||||
apps_report_cmd "$@"
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core build-env plugin"
|
||||
version = "0.8.0"
|
||||
version = "0.9.3"
|
||||
[plugin.config]
|
||||
|
||||
@@ -9,8 +9,8 @@ build_env_pre_build_buildpack() {
|
||||
local APP="$1"; local IMAGE=$(get_app_image_name "$APP"); local BUILD_ENV=""
|
||||
verify_app_name "$APP"
|
||||
|
||||
[[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=5
|
||||
[[ -z $(config_get --global CURL_TIMEOUT) ]] && config_set --global CURL_TIMEOUT=30
|
||||
[[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=90
|
||||
[[ -z $(config_get --global CURL_TIMEOUT) ]] && config_set --global CURL_TIMEOUT=60
|
||||
|
||||
if [[ -n $(config_export global) ]]; then
|
||||
local BUILD_ENV+=$'\n'
|
||||
|
||||
@@ -1,34 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | certs:help)
|
||||
help_content_func () {
|
||||
declare desc="return certs plugin help content"
|
||||
cat<<help_content
|
||||
certs, Manage Dokku apps SSL (TLS) certs
|
||||
certs:add <app> CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin
|
||||
certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate
|
||||
certs:generate <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
|
||||
certs:info <app>, Show certificate information for an ssl endpoint
|
||||
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate
|
||||
certs:remove <app>, Remove an SSL Endpoint from an app
|
||||
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app
|
||||
certs:update <app> CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "certs:help" ]] ; then
|
||||
echo -e 'Usage: dokku certs:COMMAND'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps SSL (TLS) certs.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
certs_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
71
plugins/certs/internal-functions
Executable file
71
plugins/certs/internal-functions
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
|
||||
certs_help_content_func() {
|
||||
declare desc="return certs plugin help content"
|
||||
cat<<help_content
|
||||
certs <app>, [DEPRECATED] Alternative for certs:report
|
||||
certs:add <app> CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin
|
||||
certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate
|
||||
certs:generate <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
|
||||
certs:info <app>, [DEPRECATED] Alternative for certs:report
|
||||
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate
|
||||
certs:remove <app>, Remove an SSL Endpoint from an app
|
||||
certs:report [<app>] [<flag>], Displays an ssl report for one or more apps
|
||||
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app
|
||||
certs:update <app> CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin
|
||||
help_content
|
||||
}
|
||||
|
||||
certs_help_cmd() {
|
||||
if [[ $1 = "certs:help" ]] ; then
|
||||
echo -e 'Usage: dokku certs[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage Dokku apps SSL (TLS) certs.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
certs_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
certs_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
certs, Manage Dokku apps SSL (TLS) certs
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
|
||||
certs_info_cmd() {
|
||||
# This is here because it's used in both the info and the default
|
||||
declare desc="prints SSL certificate info for app"
|
||||
local cmd="certs:info"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
|
||||
dokku_log_info1 "Certificate details:"
|
||||
dokku_log_info2 "Common Name(s): "
|
||||
|
||||
for domain in $(get_ssl_hostnames "$APP" | xargs); do
|
||||
dokku_log_info2 " $domain"
|
||||
done
|
||||
|
||||
dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
|
||||
dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
|
||||
dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
|
||||
dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
|
||||
local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
local SSL_SELF_SIGNED="verified by a certificate authority."
|
||||
else
|
||||
local SSL_SELF_SIGNED="self signed."
|
||||
fi
|
||||
dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
|
||||
else
|
||||
dokku_log_info1 "$APP does not have an SSL endpoint"
|
||||
fi
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core certificate management plugin"
|
||||
version = "0.8.0"
|
||||
version = "0.9.3"
|
||||
[plugin.config]
|
||||
|
||||
@@ -44,7 +44,7 @@ certs_set() {
|
||||
trap 'popd &> /dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR > /dev/null' RETURN
|
||||
tar xvf - <&0
|
||||
|
||||
local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.crt")
|
||||
local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f | grep ".crt$")
|
||||
local CRT_FILE_COUNT=$(printf "%s" "$CRT_FILE_SEARCH" | grep -c '^')
|
||||
if [[ $CRT_FILE_COUNT -lt 1 ]]; then
|
||||
dokku_log_fail "Tar archive is missing .crt file"
|
||||
@@ -54,7 +54,7 @@ certs_set() {
|
||||
local CRT_FILE=$CRT_FILE_SEARCH
|
||||
fi
|
||||
|
||||
local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.key")
|
||||
local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f | grep ".key$")
|
||||
local KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^')
|
||||
if [[ $KEY_FILE_COUNT -lt 1 ]]; then
|
||||
dokku_log_fail "Tar archive is missing .key file"
|
||||
@@ -72,7 +72,6 @@ certs_set() {
|
||||
cp "$KEY_FILE" "$APP_SSL_PATH/server.key"
|
||||
chmod 750 "$APP_SSL_PATH"
|
||||
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key"
|
||||
cd "$DOKKU_ROOT"
|
||||
plugn trigger post-certs-update "$APP"
|
||||
plugn trigger post-domains-update "$APP"
|
||||
}
|
||||
|
||||
6
plugins/certs/subcommands/default
Executable file
6
plugins/certs/subcommands/default
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
|
||||
dokku_log_warn "Deprecated: Please use certs:report"
|
||||
certs_info_cmd "$@"
|
||||
@@ -22,14 +22,15 @@ certs_generate_cmd() {
|
||||
|
||||
mkdir -p "$APP_SSL_PATH"
|
||||
dokku_log_info1 "Installing certificate and key..."
|
||||
mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$APP_SSL_PATH"
|
||||
mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$CERTS_GENERATE_TMP_WORK_DIR/server.csr" "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$APP_SSL_PATH"
|
||||
chmod 750 "$APP_SSL_PATH"
|
||||
chmod 640 "$APP_SSL_PATH/server.key" "$APP_SSL_PATH/server.crt"
|
||||
chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.csr" "$APP_SSL_PATH/server.key"
|
||||
plugn trigger post-certs-update "$APP"
|
||||
[[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP")
|
||||
dokku_log_info1 "The following is a certificate signing request that can be used"
|
||||
dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN"
|
||||
dokku_log_info1 "by a CA of your choosing."
|
||||
cat server.csr
|
||||
cat "$APP_SSL_PATH/server.csr"
|
||||
else
|
||||
dokku_log_info1 "$APP has an SSL endpoint already defined"
|
||||
fi
|
||||
|
||||
@@ -1,38 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
|
||||
certs_info_cmd() {
|
||||
declare desc="prints SSL certificate info for app"
|
||||
local cmd="certs:info"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$2"
|
||||
local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ -n "$APP_SSL_PATH" ]]; then
|
||||
dokku_log_info1 "Fetching SSL Endpoint info for $APP..."
|
||||
dokku_log_info1 "Certificate details:"
|
||||
dokku_log_info2 "Common Name(s): "
|
||||
|
||||
for domain in $(get_ssl_hostnames "$APP" | xargs); do
|
||||
dokku_log_info2 " $domain"
|
||||
done
|
||||
|
||||
dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')"
|
||||
dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")"
|
||||
dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')"
|
||||
dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")"
|
||||
local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
local SSL_SELF_SIGNED="verified by a certificate authority."
|
||||
else
|
||||
local SSL_SELF_SIGNED="self signed."
|
||||
fi
|
||||
dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED"
|
||||
else
|
||||
dokku_log_info1 "$APP does not have an SSL endpoint"
|
||||
fi
|
||||
}
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||
|
||||
dokku_log_warn "Deprecated: Please use certs:report"
|
||||
certs_info_cmd "$@"
|
||||
|
||||
147
plugins/certs/subcommands/report
Executable file
147
plugins/certs/subcommands/report
Executable file
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||
|
||||
fn-ssl-enabled() {
|
||||
declare APP="$1"
|
||||
local SSL_ENABLED=false
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
SSL_ENABLED=true
|
||||
fi
|
||||
echo "$SSL_ENABLED"
|
||||
}
|
||||
|
||||
fn-ssl-expires-at() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }'
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-hostnames() {
|
||||
declare APP="$1"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
get_ssl_hostnames "$APP" | xargs
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-issuer() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g"
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-starts-at() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }'
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-subject() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if is_ssl_enabled "$APP"; then
|
||||
openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g"
|
||||
fi
|
||||
}
|
||||
|
||||
fn-ssl-verified() {
|
||||
declare APP="$1"
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
local SSL_VERIFY_OUTPUT=false SSL_SELF_SIGNED="self signed"
|
||||
|
||||
if ! is_ssl_enabled "$APP"; then
|
||||
return
|
||||
fi
|
||||
|
||||
SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)"
|
||||
if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then
|
||||
SSL_SELF_SIGNED="verified by a certificate authority"
|
||||
fi
|
||||
|
||||
echo "$SSL_SELF_SIGNED"
|
||||
}
|
||||
|
||||
report_single_app() {
|
||||
declare APP="$1" INFO_FLAG="$2"
|
||||
local APP_DIR="$DOKKU_ROOT/$APP"
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
INFO_FLAG=""
|
||||
fi
|
||||
verify_app_name "$APP"
|
||||
local flag_map=(
|
||||
"--ssl-dir: $APP_DIR/tls"
|
||||
"--ssl-enabled: $(fn-ssl-enabled "$APP")"
|
||||
"--ssl-hostnames: $(fn-ssl-hostnames "$APP")"
|
||||
"--ssl-expires-at: $(fn-ssl-expires-at "$APP")"
|
||||
"--ssl-issuer: $(fn-ssl-issuer "$APP")"
|
||||
"--ssl-starts-at: $(fn-ssl-starts-at "$APP")"
|
||||
"--ssl-subject: $(fn-ssl-subject "$APP")"
|
||||
"--ssl-verified: $(fn-ssl-verified "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
dokku_log_info2 "$APP ssl information"
|
||||
for flag in "${flag_map[@]}"; do
|
||||
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
value=${flag#*: }
|
||||
size="${#value}"
|
||||
if [[ "$size" -ne 0 ]]; then
|
||||
echo "$value" && match=true && value_exists=true
|
||||
else
|
||||
match=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ "$match" == "true" ]]; then
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
else
|
||||
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
certs_report_cmd() {
|
||||
declare desc="displays an ssl report for one or more apps"
|
||||
local cmd="certs:report"
|
||||
local INSTALLED_APPS=$(dokku_apps)
|
||||
local APP="$2" INFO_FLAG="$3"
|
||||
|
||||
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
|
||||
INFO_FLAG="$APP"
|
||||
APP=""
|
||||
fi
|
||||
|
||||
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
|
||||
INFO_FLAG="true"
|
||||
fi
|
||||
|
||||
if [[ -z "$APP" ]]; then
|
||||
for app in $INSTALLED_APPS; do
|
||||
report_single_app "$app" "$INFO_FLAG" | tee || true
|
||||
done
|
||||
else
|
||||
report_single_app "$APP" "$INFO_FLAG"
|
||||
fi
|
||||
}
|
||||
|
||||
certs_report_cmd "$@"
|
||||
@@ -74,7 +74,7 @@ checks_check_deploy() {
|
||||
# after successfully copying the file. Thus, we suppress stderr.
|
||||
# ref: https://github.com/dotcloud/docker/issues/3986
|
||||
local CHECK_DEPLOY_TMP_WORK_DIR=$(mktemp -d /tmp/dokku_CHECKS.XXXXX)
|
||||
docker cp $DOKKU_APP_CONTAINER_ID:/app/CHECKS "$CHECK_DEPLOY_TMP_WORK_DIR" 2> /dev/null || true
|
||||
docker cp "$DOKKU_APP_CONTAINER_ID:/app/CHECKS" "$CHECK_DEPLOY_TMP_WORK_DIR" 2> /dev/null || true
|
||||
|
||||
local FILENAME=${CHECK_DEPLOY_TMP_WORK_DIR}/CHECKS
|
||||
|
||||
@@ -107,8 +107,8 @@ checks_check_deploy() {
|
||||
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_CHECKS_WAIT seconds ..."
|
||||
sleep "$DOKKU_DEFAULT_CHECKS_WAIT"
|
||||
|
||||
! (is_container_running $DOKKU_APP_CONTAINER_ID) && dokku_log_fail "App container failed to start!!"
|
||||
local container_restarts=$(docker inspect -f "{{ .RestartCount }}" $DOKKU_APP_CONTAINER_ID)
|
||||
! (is_container_running "$DOKKU_APP_CONTAINER_ID") && dokku_log_fail "App container failed to start!!"
|
||||
local container_restarts="$(docker inspect -f "{{ .RestartCount }}" "$DOKKU_APP_CONTAINER_ID")"
|
||||
if [[ $container_restarts -ne 0 ]]; then
|
||||
docker stop "$DOKKU_APP_CONTAINER_ID" || true
|
||||
dokku_log_fail "App container failed to start!!"
|
||||
|
||||
@@ -1,30 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help checks:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | checks:help)
|
||||
help_content_func () {
|
||||
declare desc="return checks plugin help content"
|
||||
cat<<help_content
|
||||
checks <app>, Show zero-downtime status
|
||||
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
help_content
|
||||
}
|
||||
|
||||
if [[ $1 = "checks:help" ]] ; then
|
||||
echo -e 'Usage: dokku checks[:COMAND]'
|
||||
echo ''
|
||||
echo 'Manage zero-downtime settings.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
checks_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
32
plugins/checks/internal-functions
Executable file
32
plugins/checks/internal-functions
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
checks_help_content_func() {
|
||||
declare desc="return checks plugin help content"
|
||||
cat<<help_content
|
||||
checks <app>, [DEPRECATED] Alternative for checks:report
|
||||
checks:disable <app> [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments***
|
||||
checks:enable <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
|
||||
checks:report [<app>] [<flag>], Displays a checks report for one or more apps
|
||||
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
|
||||
help_content
|
||||
}
|
||||
|
||||
checks_help_cmd() {
|
||||
if [[ $1 = "checks:help" ]] ; then
|
||||
echo -e 'Usage: dokku checks[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Manage zero-downtime settings.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
checks_help_content_func | sort | column -c2 -t -s,
|
||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||
checks_help_content_func
|
||||
else
|
||||
cat<<help_desc
|
||||
checks, Manage zero-downtime settings
|
||||
help_desc
|
||||
fi
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core checks plugin"
|
||||
version = "0.8.0"
|
||||
version = "0.9.3"
|
||||
[plugin.config]
|
||||
|
||||
@@ -12,6 +12,7 @@ checks_main_cmd() {
|
||||
local APPS="$1"
|
||||
fi
|
||||
|
||||
dokku_log_warn "Deprecated: Please use checks:report"
|
||||
dokku_col_log_info1_quiet "App Name" "Proctypes Disabled" "Proctypes Skipped"
|
||||
local app
|
||||
for app in $APPS; do
|
||||
|
||||
86
plugins/checks/subcommands/report
Executable file
86
plugins/checks/subcommands/report
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
|
||||
|
||||
fn-checks-disabled-list() {
|
||||
declare APP="$1"
|
||||
|
||||
local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED)
|
||||
DOKKU_CHECKS_DISABLED="${DOKKU_CHECKS_DISABLED:-none}"
|
||||
echo "$DOKKU_CHECKS_DISABLED"
|
||||
}
|
||||
|
||||
fn-checks-skipped-list() {
|
||||
declare APP="$1"
|
||||
|
||||
local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED)
|
||||
DOKKU_CHECKS_SKIPPED="${DOKKU_CHECKS_SKIPPED:-none}"
|
||||
echo "$DOKKU_CHECKS_SKIPPED"
|
||||
}
|
||||
|
||||
report_single_app() {
|
||||
declare APP="$1" INFO_FLAG="$2"
|
||||
local APP_DIR="$DOKKU_ROOT/$APP"
|
||||
if [[ "$INFO_FLAG" == "true" ]]; then
|
||||
INFO_FLAG=""
|
||||
fi
|
||||
verify_app_name "$APP"
|
||||
local flag_map=(
|
||||
"--checks-disabled-list: $(fn-checks-disabled-list "$APP")"
|
||||
"--checks-skipped-list: $(fn-checks-skipped-list "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
dokku_log_info2 "$APP checks information"
|
||||
for flag in "${flag_map[@]}"; do
|
||||
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
|
||||
dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")"
|
||||
done
|
||||
else
|
||||
local match=false; local value_exists=false
|
||||
for flag in "${flag_map[@]}"; do
|
||||
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
|
||||
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
|
||||
value=${flag#*: }
|
||||
size="${#value}"
|
||||
if [[ "$size" -ne 0 ]]; then
|
||||
echo "$value" && match=true && value_exists=true
|
||||
else
|
||||
match=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ "$match" == "true" ]]; then
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
else
|
||||
dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checks_report_cmd() {
|
||||
declare desc="shows reports for an app"
|
||||
local cmd="checks:report"
|
||||
local INSTALLED_APPS=$(dokku_apps)
|
||||
local APP="$2" INFO_FLAG="$3"
|
||||
|
||||
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
|
||||
INFO_FLAG="$APP"
|
||||
APP=""
|
||||
fi
|
||||
|
||||
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
|
||||
INFO_FLAG="true"
|
||||
fi
|
||||
|
||||
if [[ -z "$APP" ]]; then
|
||||
for app in $INSTALLED_APPS; do
|
||||
report_single_app "$app" "$INFO_FLAG" | tee || true
|
||||
done
|
||||
else
|
||||
report_single_app "$APP" "$INFO_FLAG"
|
||||
fi
|
||||
}
|
||||
|
||||
checks_report_cmd "$@"
|
||||
141
plugins/common/common.go
Normal file
141
plugins/common/common.go
Normal file
@@ -0,0 +1,141 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
sh "github.com/codeskyblue/go-sh"
|
||||
)
|
||||
|
||||
// ShellCmd represents a shell command to be run for dokku
|
||||
type ShellCmd struct {
|
||||
Env map[string]string
|
||||
Command *exec.Cmd
|
||||
CommandString string
|
||||
Args []string
|
||||
ShowOutput bool
|
||||
}
|
||||
|
||||
// NewShellCmd returns a new ShellCmd struct
|
||||
func NewShellCmd(command string) *ShellCmd {
|
||||
items := strings.Split(command, " ")
|
||||
cmd := items[0]
|
||||
args := items[1:]
|
||||
return &ShellCmd{
|
||||
Command: exec.Command(cmd, args...),
|
||||
CommandString: command,
|
||||
Args: args,
|
||||
ShowOutput: true,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute is a lightweight wrapper around exec.Command
|
||||
func (sc *ShellCmd) Execute() bool {
|
||||
env := os.Environ()
|
||||
for k, v := range sc.Env {
|
||||
env = append(env, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
sc.Command.Env = env
|
||||
if sc.ShowOutput {
|
||||
sc.Command.Stdout = os.Stdout
|
||||
sc.Command.Stderr = os.Stderr
|
||||
}
|
||||
err := sc.Command.Run()
|
||||
if 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)
|
||||
}
|
||||
r, _ := regexp.Compile("^[a-z].*")
|
||||
if !r.MatchString(appName) {
|
||||
return fmt.Errorf("App name (%s) must begin with lowercase alphanumeric character\n", appName)
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
// GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
|
||||
func GetDeployingAppImageName(appName, imageTag, imageRepo string) (imageName string) {
|
||||
if appName == "" {
|
||||
LogFail("(GetDeployingAppImageName) APP must not be empty")
|
||||
}
|
||||
|
||||
b, err := sh.Command("plugn", "trigger", "deployed-app-repository", appName).Output()
|
||||
if err != nil {
|
||||
LogFail(err.Error())
|
||||
}
|
||||
imageRemoteRepository := string(b[:])
|
||||
|
||||
b, err = sh.Command("plugn", "trigger", "deployed-app-image-tag", appName).Output()
|
||||
if err != nil {
|
||||
LogFail(err.Error())
|
||||
}
|
||||
newImageTag := string(b[:])
|
||||
|
||||
b, err = sh.Command("plugn", "trigger", "deployed-app-image-repo", appName).Output()
|
||||
if err != nil {
|
||||
LogFail(err.Error())
|
||||
}
|
||||
newImageRepo := string(b[:])
|
||||
|
||||
if newImageRepo != "" {
|
||||
imageRepo = newImageRepo
|
||||
}
|
||||
if newImageTag != "" {
|
||||
imageTag = newImageTag
|
||||
}
|
||||
if imageRepo == "" {
|
||||
imageRepo = GetAppImageRepo(appName)
|
||||
}
|
||||
if imageTag == "" {
|
||||
imageTag = "latest"
|
||||
}
|
||||
|
||||
imageName = fmt.Sprintf("%s%s:%s", imageRemoteRepository, imageRepo, imageTag)
|
||||
if !VerifyImage(imageName) {
|
||||
LogFail(fmt.Sprintf("app image (%s) not found", imageName))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetAppImageRepo is the central definition of a dokku image repo pattern
|
||||
func GetAppImageRepo(appName string) string {
|
||||
return strings.Join([]string{"dokku", appName}, "/")
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
38
plugins/common/common_test.go
Normal file
38
plugins/common/common_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestGetEnv(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(MustGetEnv("DOKKU_ROOT")).To(Equal("/home/dokku"))
|
||||
}
|
||||
|
||||
func TestGetAppImageRepo(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(GetAppImageRepo("testapp")).To(Equal("dokku/testapp"))
|
||||
}
|
||||
|
||||
func TestVerifyImageInvalid(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
Expect(VerifyImage("testapp")).To(Equal(false))
|
||||
}
|
||||
|
||||
func TestVerifyAppNameInvalid(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
err := VerifyAppName("1994testApp")
|
||||
Expect(err).To(HaveOccurred())
|
||||
}
|
||||
|
||||
func TestVerifyAppName(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
dir := "/home/dokku/testApp"
|
||||
os.MkdirAll(dir, 0644)
|
||||
err := VerifyAppName("testApp")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
os.RemoveAll(dir)
|
||||
}
|
||||
@@ -102,7 +102,7 @@ dokku_log_verbose() {
|
||||
|
||||
dokku_log_warn() {
|
||||
declare desc="log warning formatter"
|
||||
echo " ! $*"
|
||||
echo " ! $*" 1>&2
|
||||
}
|
||||
|
||||
dokku_log_fail() {
|
||||
@@ -142,7 +142,7 @@ verify_app_name() {
|
||||
local APP="$1"
|
||||
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
||||
if [[ ! "$APP" =~ ^[a-z].* && ! "$APP" =~ ^[0-9].* ]]; then
|
||||
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "$DOKKU_ROOT/$APP"
|
||||
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "${DOKKU_ROOT:?}/$APP"
|
||||
dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
||||
fi
|
||||
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
|
||||
@@ -211,7 +211,7 @@ get_running_image_tag() {
|
||||
verify_app_name "$APP"
|
||||
|
||||
local CIDS=( $(get_app_container_ids "$APP") )
|
||||
local RUNNING_IMAGE_TAG=$(docker inspect -f '{{ .Config.Image }}' ${CIDS[0]} 2>/dev/null | awk -F: '{ print $2 }' || echo '')
|
||||
local RUNNING_IMAGE_TAG=$(docker inspect -f '{{ .Config.Image }}' "${CIDS[0]}" 2>/dev/null | awk -F: '{ print $2 }' || echo '')
|
||||
echo "$RUNNING_IMAGE_TAG"
|
||||
}
|
||||
|
||||
@@ -251,7 +251,12 @@ parse_args() {
|
||||
declare desc="top-level cli arg parser"
|
||||
local next_index=1; local skip=false; local args=("$@")
|
||||
for arg in "$@"; do
|
||||
$skip && skip=false && continue
|
||||
if [[ "$skip" == "true" ]]; then
|
||||
next_index=$(( next_index + 1 ))
|
||||
skip=false
|
||||
continue
|
||||
fi
|
||||
|
||||
case "$arg" in
|
||||
--quiet)
|
||||
export DOKKU_QUIET_OUTPUT=1
|
||||
@@ -272,7 +277,7 @@ parse_args() {
|
||||
export DOKKU_APP_NAME=${args[$next_index]}; skip=true
|
||||
;;
|
||||
esac
|
||||
local next_index=$(( next_index + 1 ))
|
||||
next_index=$(( next_index + 1 ))
|
||||
done
|
||||
return 0
|
||||
}
|
||||
@@ -326,10 +331,11 @@ get_app_container_ids() {
|
||||
get_app_running_container_ids() {
|
||||
declare desc="return list of running docker container ids for given app and optional container_type"
|
||||
local APP="$1" CONTAINER_TYPE="$2"
|
||||
local CIDS
|
||||
verify_app_name "$APP"
|
||||
|
||||
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
|
||||
local CIDS=$(get_app_container_ids "$APP" "$CONTAINER_TYPE")
|
||||
CIDS=$(get_app_container_ids "$APP" "$CONTAINER_TYPE")
|
||||
|
||||
for CID in $CIDS; do
|
||||
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2>/dev/null || true)
|
||||
@@ -362,7 +368,7 @@ get_cmd_from_procfile() {
|
||||
|
||||
if [[ -f $DOKKU_PROCFILE ]]; then
|
||||
local line; local name; local command
|
||||
while read line || [[ -n "$line" ]]; do
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
if [[ -z "$line" ]] || [[ "$line" == "#"* ]]; then
|
||||
continue
|
||||
fi
|
||||
@@ -525,7 +531,7 @@ dokku_deploy_cmd() {
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to deploy"
|
||||
[[ -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")
|
||||
verify_app_name "$APP"
|
||||
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"
|
||||
@@ -697,6 +703,8 @@ release_and_deploy() {
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||
local DOKKU_DOCKERFILE_PORTS
|
||||
|
||||
verify_app_name "$APP"
|
||||
|
||||
if verify_image "$IMAGE"; then
|
||||
@@ -704,7 +712,7 @@ release_and_deploy() {
|
||||
local IMAGE_SOURCE_TYPE="herokuish"
|
||||
else
|
||||
local IMAGE_SOURCE_TYPE="dockerfile"
|
||||
local DOKKU_DOCKERFILE_PORTS=$(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true)
|
||||
DOKKU_DOCKERFILE_PORTS=$(config_get "$APP" DOKKU_DOCKERFILE_PORTS || true)
|
||||
if [[ -z "$DOKKU_DOCKERFILE_PORTS" ]]; then
|
||||
local DOCKER_IMAGE_PORTS=$(get_exposed_ports_from_image "$IMAGE")
|
||||
[[ -n "$DOCKER_IMAGE_PORTS" ]] && config_set --no-restart "$APP" DOKKU_DOCKERFILE_PORTS="$DOCKER_IMAGE_PORTS"
|
||||
|
||||
8
plugins/common/glide.lock
generated
Normal file
8
plugins/common/glide.lock
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
hash: e438ca8cf1bdca3e9c984bb1ee70c0d58be9da52cbe13a079a7c6cbc14210a37
|
||||
updated: 2017-01-03T17:17:27.973373328-08:00
|
||||
imports:
|
||||
- name: github.com/codegangsta/inject
|
||||
version: 33e0aa1cb7c019ccc3fbe049a8262a6403d30504
|
||||
- name: github.com/codeskyblue/go-sh
|
||||
version: ceb46ec4630a726eeed51d0a70066c9e1102c48f
|
||||
testImports: []
|
||||
3
plugins/common/glide.yaml
Normal file
3
plugins/common/glide.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
package: .
|
||||
import:
|
||||
- package: github.com/codeskyblue/go-sh
|
||||
@@ -1,4 +1,4 @@
|
||||
[plugin]
|
||||
description = "dokku core common plugin"
|
||||
version = "0.8.0"
|
||||
version = "0.9.3"
|
||||
[plugin.config]
|
||||
|
||||
2
plugins/common/vendor/github.com/codegangsta/inject/.gitignore
generated
vendored
Normal file
2
plugins/common/vendor/github.com/codegangsta/inject/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
inject
|
||||
inject.test
|
||||
20
plugins/common/vendor/github.com/codegangsta/inject/LICENSE
generated
vendored
Normal file
20
plugins/common/vendor/github.com/codegangsta/inject/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Jeremy Saenz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
92
plugins/common/vendor/github.com/codegangsta/inject/README.md
generated
vendored
Normal file
92
plugins/common/vendor/github.com/codegangsta/inject/README.md
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
# inject
|
||||
--
|
||||
import "github.com/codegangsta/inject"
|
||||
|
||||
Package inject provides utilities for mapping and injecting dependencies in
|
||||
various ways.
|
||||
|
||||
Language Translations:
|
||||
* [简体中文](translations/README_zh_cn.md)
|
||||
|
||||
## Usage
|
||||
|
||||
#### func InterfaceOf
|
||||
|
||||
```go
|
||||
func InterfaceOf(value interface{}) reflect.Type
|
||||
```
|
||||
InterfaceOf dereferences a pointer to an Interface type. It panics if value is
|
||||
not an pointer to an interface.
|
||||
|
||||
#### type Applicator
|
||||
|
||||
```go
|
||||
type Applicator interface {
|
||||
// Maps dependencies in the Type map to each field in the struct
|
||||
// that is tagged with 'inject'. Returns an error if the injection
|
||||
// fails.
|
||||
Apply(interface{}) error
|
||||
}
|
||||
```
|
||||
|
||||
Applicator represents an interface for mapping dependencies to a struct.
|
||||
|
||||
#### type Injector
|
||||
|
||||
```go
|
||||
type Injector interface {
|
||||
Applicator
|
||||
Invoker
|
||||
TypeMapper
|
||||
// SetParent sets the parent of the injector. If the injector cannot find a
|
||||
// dependency in its Type map it will check its parent before returning an
|
||||
// error.
|
||||
SetParent(Injector)
|
||||
}
|
||||
```
|
||||
|
||||
Injector represents an interface for mapping and injecting dependencies into
|
||||
structs and function arguments.
|
||||
|
||||
#### func New
|
||||
|
||||
```go
|
||||
func New() Injector
|
||||
```
|
||||
New returns a new Injector.
|
||||
|
||||
#### type Invoker
|
||||
|
||||
```go
|
||||
type Invoker interface {
|
||||
// Invoke attempts to call the interface{} provided as a function,
|
||||
// providing dependencies for function arguments based on Type. Returns
|
||||
// a slice of reflect.Value representing the returned values of the function.
|
||||
// Returns an error if the injection fails.
|
||||
Invoke(interface{}) ([]reflect.Value, error)
|
||||
}
|
||||
```
|
||||
|
||||
Invoker represents an interface for calling functions via reflection.
|
||||
|
||||
#### type TypeMapper
|
||||
|
||||
```go
|
||||
type TypeMapper interface {
|
||||
// Maps the interface{} value based on its immediate type from reflect.TypeOf.
|
||||
Map(interface{}) TypeMapper
|
||||
// Maps the interface{} value based on the pointer of an Interface provided.
|
||||
// This is really only useful for mapping a value as an interface, as interfaces
|
||||
// cannot at this time be referenced directly without a pointer.
|
||||
MapTo(interface{}, interface{}) TypeMapper
|
||||
// Provides a possibility to directly insert a mapping based on type and value.
|
||||
// This makes it possible to directly map type arguments not possible to instantiate
|
||||
// with reflect like unidirectional channels.
|
||||
Set(reflect.Type, reflect.Value) TypeMapper
|
||||
// Returns the Value that is mapped to the current type. Returns a zeroed Value if
|
||||
// the Type has not been mapped.
|
||||
Get(reflect.Type) reflect.Value
|
||||
}
|
||||
```
|
||||
|
||||
TypeMapper represents an interface for mapping interface{} values based on type.
|
||||
187
plugins/common/vendor/github.com/codegangsta/inject/inject.go
generated
vendored
Normal file
187
plugins/common/vendor/github.com/codegangsta/inject/inject.go
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
// Package inject provides utilities for mapping and injecting dependencies in various ways.
|
||||
package inject
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// Injector represents an interface for mapping and injecting dependencies into structs
|
||||
// and function arguments.
|
||||
type Injector interface {
|
||||
Applicator
|
||||
Invoker
|
||||
TypeMapper
|
||||
// SetParent sets the parent of the injector. If the injector cannot find a
|
||||
// dependency in its Type map it will check its parent before returning an
|
||||
// error.
|
||||
SetParent(Injector)
|
||||
}
|
||||
|
||||
// Applicator represents an interface for mapping dependencies to a struct.
|
||||
type Applicator interface {
|
||||
// Maps dependencies in the Type map to each field in the struct
|
||||
// that is tagged with 'inject'. Returns an error if the injection
|
||||
// fails.
|
||||
Apply(interface{}) error
|
||||
}
|
||||
|
||||
// Invoker represents an interface for calling functions via reflection.
|
||||
type Invoker interface {
|
||||
// Invoke attempts to call the interface{} provided as a function,
|
||||
// providing dependencies for function arguments based on Type. Returns
|
||||
// a slice of reflect.Value representing the returned values of the function.
|
||||
// Returns an error if the injection fails.
|
||||
Invoke(interface{}) ([]reflect.Value, error)
|
||||
}
|
||||
|
||||
// TypeMapper represents an interface for mapping interface{} values based on type.
|
||||
type TypeMapper interface {
|
||||
// Maps the interface{} value based on its immediate type from reflect.TypeOf.
|
||||
Map(interface{}) TypeMapper
|
||||
// Maps the interface{} value based on the pointer of an Interface provided.
|
||||
// This is really only useful for mapping a value as an interface, as interfaces
|
||||
// cannot at this time be referenced directly without a pointer.
|
||||
MapTo(interface{}, interface{}) TypeMapper
|
||||
// Provides a possibility to directly insert a mapping based on type and value.
|
||||
// This makes it possible to directly map type arguments not possible to instantiate
|
||||
// with reflect like unidirectional channels.
|
||||
Set(reflect.Type, reflect.Value) TypeMapper
|
||||
// Returns the Value that is mapped to the current type. Returns a zeroed Value if
|
||||
// the Type has not been mapped.
|
||||
Get(reflect.Type) reflect.Value
|
||||
}
|
||||
|
||||
type injector struct {
|
||||
values map[reflect.Type]reflect.Value
|
||||
parent Injector
|
||||
}
|
||||
|
||||
// InterfaceOf dereferences a pointer to an Interface type.
|
||||
// It panics if value is not an pointer to an interface.
|
||||
func InterfaceOf(value interface{}) reflect.Type {
|
||||
t := reflect.TypeOf(value)
|
||||
|
||||
for t.Kind() == reflect.Ptr {
|
||||
t = t.Elem()
|
||||
}
|
||||
|
||||
if t.Kind() != reflect.Interface {
|
||||
panic("Called inject.InterfaceOf with a value that is not a pointer to an interface. (*MyInterface)(nil)")
|
||||
}
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
// New returns a new Injector.
|
||||
func New() Injector {
|
||||
return &injector{
|
||||
values: make(map[reflect.Type]reflect.Value),
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke attempts to call the interface{} provided as a function,
|
||||
// providing dependencies for function arguments based on Type.
|
||||
// Returns a slice of reflect.Value representing the returned values of the function.
|
||||
// Returns an error if the injection fails.
|
||||
// It panics if f is not a function
|
||||
func (inj *injector) Invoke(f interface{}) ([]reflect.Value, error) {
|
||||
t := reflect.TypeOf(f)
|
||||
|
||||
var in = make([]reflect.Value, t.NumIn()) //Panic if t is not kind of Func
|
||||
for i := 0; i < t.NumIn(); i++ {
|
||||
argType := t.In(i)
|
||||
val := inj.Get(argType)
|
||||
if !val.IsValid() {
|
||||
return nil, fmt.Errorf("Value not found for type %v", argType)
|
||||
}
|
||||
|
||||
in[i] = val
|
||||
}
|
||||
|
||||
return reflect.ValueOf(f).Call(in), nil
|
||||
}
|
||||
|
||||
// Maps dependencies in the Type map to each field in the struct
|
||||
// that is tagged with 'inject'.
|
||||
// Returns an error if the injection fails.
|
||||
func (inj *injector) Apply(val interface{}) error {
|
||||
v := reflect.ValueOf(val)
|
||||
|
||||
for v.Kind() == reflect.Ptr {
|
||||
v = v.Elem()
|
||||
}
|
||||
|
||||
if v.Kind() != reflect.Struct {
|
||||
return nil // Should not panic here ?
|
||||
}
|
||||
|
||||
t := v.Type()
|
||||
|
||||
for i := 0; i < v.NumField(); i++ {
|
||||
f := v.Field(i)
|
||||
structField := t.Field(i)
|
||||
if f.CanSet() && (structField.Tag == "inject" || structField.Tag.Get("inject") != "") {
|
||||
ft := f.Type()
|
||||
v := inj.Get(ft)
|
||||
if !v.IsValid() {
|
||||
return fmt.Errorf("Value not found for type %v", ft)
|
||||
}
|
||||
|
||||
f.Set(v)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Maps the concrete value of val to its dynamic type using reflect.TypeOf,
|
||||
// It returns the TypeMapper registered in.
|
||||
func (i *injector) Map(val interface{}) TypeMapper {
|
||||
i.values[reflect.TypeOf(val)] = reflect.ValueOf(val)
|
||||
return i
|
||||
}
|
||||
|
||||
func (i *injector) MapTo(val interface{}, ifacePtr interface{}) TypeMapper {
|
||||
i.values[InterfaceOf(ifacePtr)] = reflect.ValueOf(val)
|
||||
return i
|
||||
}
|
||||
|
||||
// Maps the given reflect.Type to the given reflect.Value and returns
|
||||
// the Typemapper the mapping has been registered in.
|
||||
func (i *injector) Set(typ reflect.Type, val reflect.Value) TypeMapper {
|
||||
i.values[typ] = val
|
||||
return i
|
||||
}
|
||||
|
||||
func (i *injector) Get(t reflect.Type) reflect.Value {
|
||||
val := i.values[t]
|
||||
|
||||
if val.IsValid() {
|
||||
return val
|
||||
}
|
||||
|
||||
// no concrete types found, try to find implementors
|
||||
// if t is an interface
|
||||
if t.Kind() == reflect.Interface {
|
||||
for k, v := range i.values {
|
||||
if k.Implements(t) {
|
||||
val = v
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Still no type found, try to look it up on the parent
|
||||
if !val.IsValid() && i.parent != nil {
|
||||
val = i.parent.Get(t)
|
||||
}
|
||||
|
||||
return val
|
||||
|
||||
}
|
||||
|
||||
func (i *injector) SetParent(parent Injector) {
|
||||
i.parent = parent
|
||||
}
|
||||
159
plugins/common/vendor/github.com/codegangsta/inject/inject_test.go
generated
vendored
Normal file
159
plugins/common/vendor/github.com/codegangsta/inject/inject_test.go
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
package inject_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/codegangsta/inject"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type SpecialString interface {
|
||||
}
|
||||
|
||||
type TestStruct struct {
|
||||
Dep1 string `inject:"t" json:"-"`
|
||||
Dep2 SpecialString `inject`
|
||||
Dep3 string
|
||||
}
|
||||
|
||||
type Greeter struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
func (g *Greeter) String() string {
|
||||
return "Hello, My name is" + g.Name
|
||||
}
|
||||
|
||||
/* Test Helpers */
|
||||
func expect(t *testing.T, a interface{}, b interface{}) {
|
||||
if a != b {
|
||||
t.Errorf("Expected %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
|
||||
}
|
||||
}
|
||||
|
||||
func refute(t *testing.T, a interface{}, b interface{}) {
|
||||
if a == b {
|
||||
t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
|
||||
}
|
||||
}
|
||||
|
||||
func Test_InjectorInvoke(t *testing.T) {
|
||||
injector := inject.New()
|
||||
expect(t, injector == nil, false)
|
||||
|
||||
dep := "some dependency"
|
||||
injector.Map(dep)
|
||||
dep2 := "another dep"
|
||||
injector.MapTo(dep2, (*SpecialString)(nil))
|
||||
dep3 := make(chan *SpecialString)
|
||||
dep4 := make(chan *SpecialString)
|
||||
typRecv := reflect.ChanOf(reflect.RecvDir, reflect.TypeOf(dep3).Elem())
|
||||
typSend := reflect.ChanOf(reflect.SendDir, reflect.TypeOf(dep4).Elem())
|
||||
injector.Set(typRecv, reflect.ValueOf(dep3))
|
||||
injector.Set(typSend, reflect.ValueOf(dep4))
|
||||
|
||||
_, err := injector.Invoke(func(d1 string, d2 SpecialString, d3 <-chan *SpecialString, d4 chan<- *SpecialString) {
|
||||
expect(t, d1, dep)
|
||||
expect(t, d2, dep2)
|
||||
expect(t, reflect.TypeOf(d3).Elem(), reflect.TypeOf(dep3).Elem())
|
||||
expect(t, reflect.TypeOf(d4).Elem(), reflect.TypeOf(dep4).Elem())
|
||||
expect(t, reflect.TypeOf(d3).ChanDir(), reflect.RecvDir)
|
||||
expect(t, reflect.TypeOf(d4).ChanDir(), reflect.SendDir)
|
||||
})
|
||||
|
||||
expect(t, err, nil)
|
||||
}
|
||||
|
||||
func Test_InjectorInvokeReturnValues(t *testing.T) {
|
||||
injector := inject.New()
|
||||
expect(t, injector == nil, false)
|
||||
|
||||
dep := "some dependency"
|
||||
injector.Map(dep)
|
||||
dep2 := "another dep"
|
||||
injector.MapTo(dep2, (*SpecialString)(nil))
|
||||
|
||||
result, err := injector.Invoke(func(d1 string, d2 SpecialString) string {
|
||||
expect(t, d1, dep)
|
||||
expect(t, d2, dep2)
|
||||
return "Hello world"
|
||||
})
|
||||
|
||||
expect(t, result[0].String(), "Hello world")
|
||||
expect(t, err, nil)
|
||||
}
|
||||
|
||||
func Test_InjectorApply(t *testing.T) {
|
||||
injector := inject.New()
|
||||
|
||||
injector.Map("a dep").MapTo("another dep", (*SpecialString)(nil))
|
||||
|
||||
s := TestStruct{}
|
||||
err := injector.Apply(&s)
|
||||
expect(t, err, nil)
|
||||
|
||||
expect(t, s.Dep1, "a dep")
|
||||
expect(t, s.Dep2, "another dep")
|
||||
expect(t, s.Dep3, "")
|
||||
}
|
||||
|
||||
func Test_InterfaceOf(t *testing.T) {
|
||||
iType := inject.InterfaceOf((*SpecialString)(nil))
|
||||
expect(t, iType.Kind(), reflect.Interface)
|
||||
|
||||
iType = inject.InterfaceOf((**SpecialString)(nil))
|
||||
expect(t, iType.Kind(), reflect.Interface)
|
||||
|
||||
// Expecting nil
|
||||
defer func() {
|
||||
rec := recover()
|
||||
refute(t, rec, nil)
|
||||
}()
|
||||
iType = inject.InterfaceOf((*testing.T)(nil))
|
||||
}
|
||||
|
||||
func Test_InjectorSet(t *testing.T) {
|
||||
injector := inject.New()
|
||||
typ := reflect.TypeOf("string")
|
||||
typSend := reflect.ChanOf(reflect.SendDir, typ)
|
||||
typRecv := reflect.ChanOf(reflect.RecvDir, typ)
|
||||
|
||||
// instantiating unidirectional channels is not possible using reflect
|
||||
// http://golang.org/src/pkg/reflect/value.go?s=60463:60504#L2064
|
||||
chanRecv := reflect.MakeChan(reflect.ChanOf(reflect.BothDir, typ), 0)
|
||||
chanSend := reflect.MakeChan(reflect.ChanOf(reflect.BothDir, typ), 0)
|
||||
|
||||
injector.Set(typSend, chanSend)
|
||||
injector.Set(typRecv, chanRecv)
|
||||
|
||||
expect(t, injector.Get(typSend).IsValid(), true)
|
||||
expect(t, injector.Get(typRecv).IsValid(), true)
|
||||
expect(t, injector.Get(chanSend.Type()).IsValid(), false)
|
||||
}
|
||||
|
||||
func Test_InjectorGet(t *testing.T) {
|
||||
injector := inject.New()
|
||||
|
||||
injector.Map("some dependency")
|
||||
|
||||
expect(t, injector.Get(reflect.TypeOf("string")).IsValid(), true)
|
||||
expect(t, injector.Get(reflect.TypeOf(11)).IsValid(), false)
|
||||
}
|
||||
|
||||
func Test_InjectorSetParent(t *testing.T) {
|
||||
injector := inject.New()
|
||||
injector.MapTo("another dep", (*SpecialString)(nil))
|
||||
|
||||
injector2 := inject.New()
|
||||
injector2.SetParent(injector)
|
||||
|
||||
expect(t, injector2.Get(inject.InterfaceOf((*SpecialString)(nil))).IsValid(), true)
|
||||
}
|
||||
|
||||
func TestInjectImplementors(t *testing.T) {
|
||||
injector := inject.New()
|
||||
g := &Greeter{"Jeremy"}
|
||||
injector.Map(g)
|
||||
|
||||
expect(t, injector.Get(inject.InterfaceOf((*fmt.Stringer)(nil))).IsValid(), true)
|
||||
}
|
||||
85
plugins/common/vendor/github.com/codegangsta/inject/translations/README_zh_cn.md
generated
vendored
Normal file
85
plugins/common/vendor/github.com/codegangsta/inject/translations/README_zh_cn.md
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
# inject
|
||||
--
|
||||
import "github.com/codegangsta/inject"
|
||||
|
||||
inject包提供了多种对实体的映射和依赖注入方式。
|
||||
|
||||
## 用法
|
||||
|
||||
#### func InterfaceOf
|
||||
|
||||
```go
|
||||
func InterfaceOf(value interface{}) reflect.Type
|
||||
```
|
||||
函数InterfaceOf返回指向接口类型的指针。如果传入的value值不是指向接口的指针,将抛出一个panic异常。
|
||||
|
||||
#### type Applicator
|
||||
|
||||
```go
|
||||
type Applicator interface {
|
||||
// 在Type map中维持对结构体中每个域的引用并用'inject'来标记
|
||||
// 如果注入失败将会返回一个error.
|
||||
Apply(interface{}) error
|
||||
}
|
||||
```
|
||||
|
||||
Applicator接口表示到结构体的依赖映射关系。
|
||||
|
||||
#### type Injector
|
||||
|
||||
```go
|
||||
type Injector interface {
|
||||
Applicator
|
||||
Invoker
|
||||
TypeMapper
|
||||
// SetParent用来设置父injector. 如果在当前injector的Type map中找不到依赖,
|
||||
// 将会继续从它的父injector中找,直到返回error.
|
||||
SetParent(Injector)
|
||||
}
|
||||
```
|
||||
|
||||
Injector接口表示对结构体、函数参数的映射和依赖注入。
|
||||
|
||||
#### func New
|
||||
|
||||
```go
|
||||
func New() Injector
|
||||
```
|
||||
New创建并返回一个Injector.
|
||||
|
||||
#### type Invoker
|
||||
|
||||
```go
|
||||
type Invoker interface {
|
||||
// Invoke尝试将interface{}作为一个函数来调用,并基于Type为函数提供参数。
|
||||
// 它将返回reflect.Value的切片,其中存放原函数的返回值。
|
||||
// 如果注入失败则返回error.
|
||||
Invoke(interface{}) ([]reflect.Value, error)
|
||||
}
|
||||
```
|
||||
|
||||
Invoker接口表示通过反射进行函数调用。
|
||||
|
||||
#### type TypeMapper
|
||||
|
||||
```go
|
||||
type TypeMapper interface {
|
||||
// 基于调用reflect.TypeOf得到的类型映射interface{}的值。
|
||||
Map(interface{}) TypeMapper
|
||||
// 基于提供的接口的指针映射interface{}的值。
|
||||
// 该函数仅用来将一个值映射为接口,因为接口无法不通过指针而直接引用到。
|
||||
MapTo(interface{}, interface{}) TypeMapper
|
||||
// 为直接插入基于类型和值的map提供一种可能性。
|
||||
// 它使得这一类直接映射成为可能:无法通过反射直接实例化的类型参数,如单向管道。
|
||||
Set(reflect.Type, reflect.Value) TypeMapper
|
||||
// 返回映射到当前类型的Value. 如果Type没被映射,将返回对应的零值。
|
||||
Get(reflect.Type) reflect.Value
|
||||
}
|
||||
```
|
||||
|
||||
TypeMapper接口用来表示基于类型到接口值的映射。
|
||||
|
||||
|
||||
## 译者
|
||||
|
||||
张强 (qqbunny@yeah.net)
|
||||
3
plugins/common/vendor/github.com/codegangsta/inject/update_readme.sh
generated
vendored
Normal file
3
plugins/common/vendor/github.com/codegangsta/inject/update_readme.sh
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
go get github.com/robertkrimen/godocdown/godocdown
|
||||
godocdown > README.md
|
||||
202
plugins/common/vendor/github.com/codeskyblue/go-sh/LICENSE
generated
vendored
Normal file
202
plugins/common/vendor/github.com/codeskyblue/go-sh/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
69
plugins/common/vendor/github.com/codeskyblue/go-sh/OLD_README.md
generated
vendored
Normal file
69
plugins/common/vendor/github.com/codeskyblue/go-sh/OLD_README.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
## OLD README
|
||||
First give you a full example, I will explain every command below.
|
||||
|
||||
session := sh.NewSession()
|
||||
session.Env["PATH"] = "/usr/bin:/bin"
|
||||
session.Stdout = os.Stdout
|
||||
session.Stderr = os.Stderr
|
||||
session.Alias("ll", "ls", "-l")
|
||||
session.ShowCMD = true // enable for debug
|
||||
var err error
|
||||
err = session.Call("ll", "/")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
ret, err := session.Capture("pwd", sh.Dir("/home")) # wraper of session.Call
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
# ret is "/home\n"
|
||||
fmt.Println(ret)
|
||||
|
||||
create a new Session
|
||||
|
||||
session := sh.NewSession()
|
||||
|
||||
use alias like this
|
||||
|
||||
session.Alias("ll", "ls", "-l") # like alias ll='ls -l'
|
||||
|
||||
set current env like this
|
||||
|
||||
session.Env["BUILD_ID"] = "123" # like export BUILD_ID=123
|
||||
|
||||
set current directory
|
||||
|
||||
session.Set(sh.Dir("/")) # like cd /
|
||||
|
||||
pipe is also supported
|
||||
|
||||
session.Command("echo", "hello\tworld").Command("cut", "-f2")
|
||||
// output should be "world"
|
||||
session.Run()
|
||||
|
||||
test, the build in command support
|
||||
|
||||
session.Test("d", "dir") // test dir
|
||||
session.Test("f", "file) // test regular file
|
||||
|
||||
with `Alias Env Set Call Capture Command` a shell scripts can be easily converted into golang program. below is a shell script.
|
||||
|
||||
#!/bin/bash -
|
||||
#
|
||||
export PATH=/usr/bin:/bin
|
||||
alias ll='ls -l'
|
||||
cd /usr
|
||||
if test -d "local"
|
||||
then
|
||||
ll local | awk '{print $1, $NF}'
|
||||
fi
|
||||
|
||||
convert to golang, will be
|
||||
|
||||
s := sh.NewSession()
|
||||
s.Env["PATH"] = "/usr/bin:/bin"
|
||||
s.Set(sh.Dir("/usr"))
|
||||
s.Alias("ll", "ls", "-l")
|
||||
if s.Test("d", "local") {
|
||||
s.Command("ll", "local").Command("awk", "{print $1, $NF}").Run()
|
||||
}
|
||||
85
plugins/common/vendor/github.com/codeskyblue/go-sh/README.md
generated
vendored
Normal file
85
plugins/common/vendor/github.com/codeskyblue/go-sh/README.md
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
## go-sh
|
||||
[](https://app.wercker.com/project/bykey/009acbd4f00ccc6de7e2554e12a50d84)
|
||||
[](http://gowalker.org/github.com/codeskyblue/go-sh)
|
||||
|
||||
*If you depend on the old api, see tag: v.0.1*
|
||||
|
||||
install: `go get github.com/codeskyblue/go-sh`
|
||||
|
||||
Pipe Example:
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/codeskyblue/go-sh"
|
||||
|
||||
func main() {
|
||||
sh.Command("echo", "hello\tworld").Command("cut", "-f2").Run()
|
||||
}
|
||||
|
||||
Because I like os/exec, `go-sh` is very much modelled after it. However, `go-sh` provides a better experience.
|
||||
|
||||
These are some of its features:
|
||||
|
||||
* keep the variable environment (e.g. export)
|
||||
* alias support (e.g. alias in shell)
|
||||
* remember current dir
|
||||
* pipe command
|
||||
* shell build-in commands echo & test
|
||||
* timeout support
|
||||
|
||||
Examples are important:
|
||||
|
||||
sh: echo hello
|
||||
go: sh.Command("echo", "hello").Run()
|
||||
|
||||
sh: export BUILD_ID=123
|
||||
go: s = sh.NewSession().SetEnv("BUILD_ID", "123")
|
||||
|
||||
sh: alias ll='ls -l'
|
||||
go: s = sh.NewSession().Alias('ll', 'ls', '-l')
|
||||
|
||||
sh: (cd /; pwd)
|
||||
go: sh.Command("pwd", sh.Dir("/")).Run()
|
||||
|
||||
sh: test -d data || mkdir data
|
||||
go: if ! sh.Test("dir", "data") { sh.Command("mkdir", "data").Run() }
|
||||
|
||||
sh: cat first second | awk '{print $1}'
|
||||
go: sh.Command("cat", "first", "second").Command("awk", "{print $1}").Run()
|
||||
|
||||
sh: count=$(echo "one two three" | wc -w)
|
||||
go: count, err := sh.Echo("one two three").Command("wc", "-w").Output()
|
||||
|
||||
sh(in ubuntu): timeout 1s sleep 3
|
||||
go: c := sh.Command("sleep", "3"); c.Start(); c.WaitTimeout(time.Second) # default SIGKILL
|
||||
go: out, err := sh.Command("sleep", "3").SetTimeout(time.Second).Output() # set session timeout and get output)
|
||||
|
||||
sh: echo hello | cat
|
||||
go: out, err := sh.Command("cat").SetInput("hello").Output()
|
||||
|
||||
sh: cat # read from stdin
|
||||
go: out, err := sh.Command("cat").SetStdin(os.Stdin).Output()
|
||||
|
||||
If you need to keep env and dir, it is better to create a session
|
||||
|
||||
session := sh.NewSession()
|
||||
session.SetEnv("BUILD_ID", "123")
|
||||
session.SetDir("/")
|
||||
# then call cmd
|
||||
session.Command("echo", "hello").Run()
|
||||
# set ShowCMD to true for easily debug
|
||||
session.ShowCMD = true
|
||||
|
||||
for more information, it better to see docs.
|
||||
[](http://gowalker.org/github.com/codeskyblue/go-sh)
|
||||
|
||||
### contribute
|
||||
If you love this project, starring it will encourage the coder. Pull requests are welcome.
|
||||
|
||||
support the author: [alipay](https://me.alipay.com/goskyblue)
|
||||
|
||||
### thanks
|
||||
this project is based on <http://github.com/codegangsta/inject>. thanks for the author.
|
||||
|
||||
# the reason to use Go shell
|
||||
Sometimes we need to write shell scripts, but shell scripts are not good at working cross platform, Go, on the other hand, is good at that. Is there a good way to use Go to write shell like scripts? Using go-sh we can do this now.
|
||||
41
plugins/common/vendor/github.com/codeskyblue/go-sh/example/example1.go
generated
vendored
Normal file
41
plugins/common/vendor/github.com/codeskyblue/go-sh/example/example1.go
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/codeskyblue/go-sh"
|
||||
)
|
||||
|
||||
func main() {
|
||||
sh.Command("echo", "hello").Run()
|
||||
out, err := sh.Command("echo", "hello").Output()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println("output is", string(out))
|
||||
|
||||
var a int
|
||||
sh.Command("echo", "2").UnmarshalJSON(&a)
|
||||
fmt.Println("a =", a)
|
||||
|
||||
s := sh.NewSession()
|
||||
s.Alias("hi", "echo", "hi")
|
||||
s.Command("hi", "boy").Run()
|
||||
|
||||
fmt.Print("pwd = ")
|
||||
s.Command("pwd", sh.Dir("/")).Run()
|
||||
|
||||
if !sh.Test("dir", "data") {
|
||||
sh.Command("echo", "mkdir", "data").Run()
|
||||
}
|
||||
|
||||
sh.Command("echo", "hello", "world").
|
||||
Command("awk", `{print "second arg is "$2}`).Run()
|
||||
s.ShowCMD = true
|
||||
s.Command("echo", "hello", "world").
|
||||
Command("awk", `{print "second arg is "$2}`).Run()
|
||||
|
||||
s.SetEnv("BUILD_ID", "123").Command("bash", "-c", "echo $BUILD_ID").Run()
|
||||
s.Command("bash", "-c", "echo current shell is $SHELL").Run()
|
||||
}
|
||||
7
plugins/common/vendor/github.com/codeskyblue/go-sh/example/less/less.go
generated
vendored
Normal file
7
plugins/common/vendor/github.com/codeskyblue/go-sh/example/less/less.go
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "github.com/codeskyblue/go-sh"
|
||||
|
||||
func main() {
|
||||
sh.Command("less", "less.go").Run()
|
||||
}
|
||||
17
plugins/common/vendor/github.com/codeskyblue/go-sh/example/tail/tailf.go
generated
vendored
Normal file
17
plugins/common/vendor/github.com/codeskyblue/go-sh/example/tail/tailf.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/codeskyblue/go-sh"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if flag.NArg() != 1 {
|
||||
fmt.Println("Usage: PROGRAM <file>")
|
||||
return
|
||||
}
|
||||
sh.Command("tail", "-f", flag.Arg(0)).Run()
|
||||
}
|
||||
23
plugins/common/vendor/github.com/codeskyblue/go-sh/example/timeout/timeout.go
generated
vendored
Normal file
23
plugins/common/vendor/github.com/codeskyblue/go-sh/example/timeout/timeout.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
sh "github.com/codeskyblue/go-sh"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c := sh.Command("sleep", "3")
|
||||
c.Start()
|
||||
err := c.WaitTimeout(time.Second * 1)
|
||||
if err != nil {
|
||||
fmt.Printf("timeout should happend: %v\n", err)
|
||||
}
|
||||
// timeout should be a session
|
||||
out, err := sh.Command("sleep", "2").SetTimeout(time.Second).Output()
|
||||
fmt.Printf("output:(%s), err(%v)\n", string(out), err)
|
||||
|
||||
out, err = sh.Command("echo", "hello").SetTimeout(time.Second).Output()
|
||||
fmt.Printf("output:(%s), err(%v)\n", string(out), err)
|
||||
}
|
||||
28
plugins/common/vendor/github.com/codeskyblue/go-sh/example_test.go
generated
vendored
Normal file
28
plugins/common/vendor/github.com/codeskyblue/go-sh/example_test.go
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
package sh_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/codeskyblue/go-sh"
|
||||
)
|
||||
|
||||
func ExampleCommand() {
|
||||
out, err := sh.Command("echo", "hello").Output()
|
||||
fmt.Println(string(out), err)
|
||||
}
|
||||
|
||||
func ExampleCommandPipe() {
|
||||
out, err := sh.Command("echo", "-n", "hi").Command("wc", "-c").Output()
|
||||
fmt.Println(string(out), err)
|
||||
}
|
||||
|
||||
func ExampleCommandSetDir() {
|
||||
out, err := sh.Command("pwd", sh.Dir("/")).Output()
|
||||
fmt.Println(string(out), err)
|
||||
}
|
||||
|
||||
func ExampleTest() {
|
||||
if sh.Test("dir", "mydir") {
|
||||
fmt.Println("mydir exists")
|
||||
}
|
||||
}
|
||||
148
plugins/common/vendor/github.com/codeskyblue/go-sh/pipe.go
generated
vendored
Normal file
148
plugins/common/vendor/github.com/codeskyblue/go-sh/pipe.go
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
package sh
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrExecTimeout = errors.New("execute timeout")
|
||||
|
||||
// unmarshal shell output to decode json
|
||||
func (s *Session) UnmarshalJSON(data interface{}) (err error) {
|
||||
bufrw := bytes.NewBuffer(nil)
|
||||
s.Stdout = bufrw
|
||||
if err = s.Run(); err != nil {
|
||||
return
|
||||
}
|
||||
return json.NewDecoder(bufrw).Decode(data)
|
||||
}
|
||||
|
||||
// unmarshal command output into xml
|
||||
func (s *Session) UnmarshalXML(data interface{}) (err error) {
|
||||
bufrw := bytes.NewBuffer(nil)
|
||||
s.Stdout = bufrw
|
||||
if err = s.Run(); err != nil {
|
||||
return
|
||||
}
|
||||
return xml.NewDecoder(bufrw).Decode(data)
|
||||
}
|
||||
|
||||
// start command
|
||||
func (s *Session) Start() (err error) {
|
||||
s.started = true
|
||||
var rd *io.PipeReader
|
||||
var wr *io.PipeWriter
|
||||
var length = len(s.cmds)
|
||||
if s.ShowCMD {
|
||||
var cmds = make([]string, 0, 4)
|
||||
for _, cmd := range s.cmds {
|
||||
cmds = append(cmds, strings.Join(cmd.Args, " "))
|
||||
}
|
||||
s.writePrompt(strings.Join(cmds, " | "))
|
||||
}
|
||||
for index, cmd := range s.cmds {
|
||||
if index == 0 {
|
||||
cmd.Stdin = s.Stdin
|
||||
} else {
|
||||
cmd.Stdin = rd
|
||||
}
|
||||
if index != length {
|
||||
rd, wr = io.Pipe() // create pipe
|
||||
cmd.Stdout = wr
|
||||
cmd.Stderr = os.Stderr
|
||||
}
|
||||
if index == length-1 {
|
||||
cmd.Stdout = s.Stdout
|
||||
cmd.Stderr = s.Stderr
|
||||
}
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Should be call after Start()
|
||||
// only catch the last command error
|
||||
func (s *Session) Wait() (err error) {
|
||||
for _, cmd := range s.cmds {
|
||||
err = cmd.Wait()
|
||||
wr, ok := cmd.Stdout.(*io.PipeWriter)
|
||||
if ok {
|
||||
wr.Close()
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *Session) Kill(sig os.Signal) {
|
||||
for _, cmd := range s.cmds {
|
||||
if cmd.Process != nil {
|
||||
cmd.Process.Signal(sig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Session) WaitTimeout(timeout time.Duration) (err error) {
|
||||
select {
|
||||
case <-time.After(timeout):
|
||||
s.Kill(syscall.SIGKILL)
|
||||
return ErrExecTimeout
|
||||
case err = <-Go(s.Wait):
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func Go(f func() error) chan error {
|
||||
ch := make(chan error)
|
||||
go func() {
|
||||
ch <- f()
|
||||
}()
|
||||
return ch
|
||||
}
|
||||
|
||||
func (s *Session) Run() (err error) {
|
||||
if err = s.Start(); err != nil {
|
||||
return
|
||||
}
|
||||
if s.timeout != time.Duration(0) {
|
||||
return s.WaitTimeout(s.timeout)
|
||||
}
|
||||
return s.Wait()
|
||||
}
|
||||
|
||||
func (s *Session) Output() (out []byte, err error) {
|
||||
oldout := s.Stdout
|
||||
defer func() {
|
||||
s.Stdout = oldout
|
||||
}()
|
||||
stdout := bytes.NewBuffer(nil)
|
||||
s.Stdout = stdout
|
||||
err = s.Run()
|
||||
out = stdout.Bytes()
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Session) CombinedOutput() (out []byte, err error) {
|
||||
oldout := s.Stdout
|
||||
olderr := s.Stderr
|
||||
defer func() {
|
||||
s.Stdout = oldout
|
||||
s.Stderr = olderr
|
||||
}()
|
||||
stdout := bytes.NewBuffer(nil)
|
||||
s.Stdout = stdout
|
||||
s.Stderr = stdout
|
||||
|
||||
err = s.Run()
|
||||
out = stdout.Bytes()
|
||||
return
|
||||
}
|
||||
126
plugins/common/vendor/github.com/codeskyblue/go-sh/pipe_test.go
generated
vendored
Normal file
126
plugins/common/vendor/github.com/codeskyblue/go-sh/pipe_test.go
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
package sh
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestUnmarshalJSON(t *testing.T) {
|
||||
var a int
|
||||
s := NewSession()
|
||||
s.ShowCMD = true
|
||||
err := s.Command("echo", []string{"1"}).UnmarshalJSON(&a)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if a != 1 {
|
||||
t.Errorf("expect a tobe 1, but got %d", a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalXML(t *testing.T) {
|
||||
s := NewSession()
|
||||
xmlSample := `<?xml version="1.0" encoding="utf-8"?>
|
||||
<server version="1" />`
|
||||
type server struct {
|
||||
XMLName xml.Name `xml:"server"`
|
||||
Version string `xml:"version,attr"`
|
||||
}
|
||||
data := &server{}
|
||||
s.Command("echo", xmlSample).UnmarshalXML(data)
|
||||
if data.Version != "1" {
|
||||
t.Error(data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPipe(t *testing.T) {
|
||||
s := NewSession()
|
||||
s.ShowCMD = true
|
||||
s.Call("echo", "hello")
|
||||
err := s.Command("echo", "hi").Command("cat", "-n").Start()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
err = s.Wait()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
out, err := s.Command("echo", []string{"hello"}).Output()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if string(out) != "hello\n" {
|
||||
t.Error("capture wrong output:", out)
|
||||
}
|
||||
s.Command("echo", []string{"hello\tworld"}).Command("cut", []string{"-f2"}).Run()
|
||||
}
|
||||
|
||||
func TestPipeCommand(t *testing.T) {
|
||||
c1 := exec.Command("echo", "good")
|
||||
rd, wr := io.Pipe()
|
||||
c1.Stdout = wr
|
||||
c2 := exec.Command("cat", "-n")
|
||||
c2.Stdout = os.Stdout
|
||||
c2.Stdin = rd
|
||||
c1.Start()
|
||||
c2.Start()
|
||||
|
||||
c1.Wait()
|
||||
wc, ok := c1.Stdout.(io.WriteCloser)
|
||||
if ok {
|
||||
wc.Close()
|
||||
}
|
||||
c2.Wait()
|
||||
}
|
||||
|
||||
func TestPipeInput(t *testing.T) {
|
||||
s := NewSession()
|
||||
s.ShowCMD = true
|
||||
s.SetInput("first line\nsecond line\n")
|
||||
out, err := s.Command("grep", "second").Output()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if string(out) != "second line\n" {
|
||||
t.Error("capture wrong output:", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimeout(t *testing.T) {
|
||||
s := NewSession()
|
||||
err := s.Command("sleep", "2").Start()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = s.WaitTimeout(time.Second)
|
||||
if err != ErrExecTimeout {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetTimeout(t *testing.T) {
|
||||
s := NewSession()
|
||||
s.SetTimeout(time.Second)
|
||||
defer s.SetTimeout(0)
|
||||
err := s.Command("sleep", "2").Run()
|
||||
if err != ErrExecTimeout {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCombinedOutput(t *testing.T) {
|
||||
s := NewSession()
|
||||
bytes, err := s.Command("sh", "-c", "echo stderr >&2 ; echo stdout").CombinedOutput()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
stringOutput := string(bytes)
|
||||
if !(strings.Contains(stringOutput, "stdout") && strings.Contains(stringOutput, "stderr")) {
|
||||
t.Errorf("expect output from both output streams, got '%s'", strings.TrimSpace(stringOutput))
|
||||
}
|
||||
}
|
||||
200
plugins/common/vendor/github.com/codeskyblue/go-sh/sh.go
generated
vendored
Normal file
200
plugins/common/vendor/github.com/codeskyblue/go-sh/sh.go
generated
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
Package go-sh is intented to make shell call with golang more easily.
|
||||
Some usage is more similar to os/exec, eg: Run(), Output(), Command(name, args...)
|
||||
|
||||
But with these similar function, pipe is added in and this package also got shell-session support.
|
||||
|
||||
Why I love golang so much, because the usage of golang is simple, but the power is unlimited. I want to make this pakcage got the sample style like golang.
|
||||
|
||||
// just like os/exec
|
||||
sh.Command("echo", "hello").Run()
|
||||
|
||||
// support pipe
|
||||
sh.Command("echo", "hello").Command("wc", "-c").Run()
|
||||
|
||||
// create a session to store dir and env
|
||||
sh.NewSession().SetDir("/").Command("pwd")
|
||||
|
||||
// shell buildin command - "test"
|
||||
sh.Test("dir", "mydir")
|
||||
|
||||
// like shell call: (cd /; pwd)
|
||||
sh.Command("pwd", sh.Dir("/")) same with sh.Command(sh.Dir("/"), "pwd")
|
||||
|
||||
// output to json and xml easily
|
||||
v := map[string] int {}
|
||||
err = sh.Command("echo", `{"number": 1}`).UnmarshalJSON(&v)
|
||||
*/
|
||||
package sh
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/codegangsta/inject"
|
||||
)
|
||||
|
||||
type Dir string
|
||||
|
||||
type Session struct {
|
||||
inj inject.Injector
|
||||
alias map[string][]string
|
||||
cmds []*exec.Cmd
|
||||
dir Dir
|
||||
started bool
|
||||
Env map[string]string
|
||||
Stdin io.Reader
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
ShowCMD bool // enable for debug
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
func (s *Session) writePrompt(args ...interface{}) {
|
||||
var ps1 = fmt.Sprintf("[golang-sh]$")
|
||||
args = append([]interface{}{ps1}, args...)
|
||||
fmt.Fprintln(s.Stderr, args...)
|
||||
}
|
||||
|
||||
func NewSession() *Session {
|
||||
env := make(map[string]string)
|
||||
for _, key := range []string{"PATH"} {
|
||||
env[key] = os.Getenv(key)
|
||||
}
|
||||
s := &Session{
|
||||
inj: inject.New(),
|
||||
alias: make(map[string][]string),
|
||||
dir: Dir(""),
|
||||
Stdin: strings.NewReader(""),
|
||||
Stdout: os.Stdout,
|
||||
Stderr: os.Stderr,
|
||||
Env: env,
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func InteractiveSession() *Session {
|
||||
s := NewSession()
|
||||
s.SetStdin(os.Stdin)
|
||||
return s
|
||||
}
|
||||
|
||||
func Command(name string, a ...interface{}) *Session {
|
||||
s := NewSession()
|
||||
return s.Command(name, a...)
|
||||
}
|
||||
|
||||
func Echo(in string) *Session {
|
||||
s := NewSession()
|
||||
return s.SetInput(in)
|
||||
}
|
||||
|
||||
func (s *Session) Alias(alias, cmd string, args ...string) {
|
||||
v := []string{cmd}
|
||||
v = append(v, args...)
|
||||
s.alias[alias] = v
|
||||
}
|
||||
|
||||
func (s *Session) Command(name string, a ...interface{}) *Session {
|
||||
var args = make([]string, 0)
|
||||
var sType = reflect.TypeOf("")
|
||||
|
||||
// init cmd, args, dir, envs
|
||||
// if not init, program may panic
|
||||
s.inj.Map(name).Map(args).Map(s.dir).Map(map[string]string{})
|
||||
for _, v := range a {
|
||||
switch reflect.TypeOf(v) {
|
||||
case sType:
|
||||
args = append(args, v.(string))
|
||||
default:
|
||||
s.inj.Map(v)
|
||||
}
|
||||
}
|
||||
if len(args) != 0 {
|
||||
s.inj.Map(args)
|
||||
}
|
||||
s.inj.Invoke(s.appendCmd)
|
||||
return s
|
||||
}
|
||||
|
||||
// combine Command and Run
|
||||
func (s *Session) Call(name string, a ...interface{}) error {
|
||||
return s.Command(name, a...).Run()
|
||||
}
|
||||
|
||||
/*
|
||||
func (s *Session) Exec(cmd string, args ...string) error {
|
||||
return s.Call(cmd, args)
|
||||
}
|
||||
*/
|
||||
|
||||
func (s *Session) SetEnv(key, value string) *Session {
|
||||
s.Env[key] = value
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Session) SetDir(dir string) *Session {
|
||||
s.dir = Dir(dir)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Session) SetInput(in string) *Session {
|
||||
s.Stdin = strings.NewReader(in)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Session) SetStdin(r io.Reader) *Session {
|
||||
s.Stdin = r
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Session) SetTimeout(d time.Duration) *Session {
|
||||
s.timeout = d
|
||||
return s
|
||||
}
|
||||
|
||||
func newEnviron(env map[string]string, inherit bool) []string { //map[string]string {
|
||||
environ := make([]string, 0, len(env))
|
||||
if inherit {
|
||||
for _, line := range os.Environ() {
|
||||
for k, _ := range env {
|
||||
if strings.HasPrefix(line, k+"=") {
|
||||
goto CONTINUE
|
||||
}
|
||||
}
|
||||
environ = append(environ, line)
|
||||
CONTINUE:
|
||||
}
|
||||
}
|
||||
for k, v := range env {
|
||||
environ = append(environ, k+"="+v)
|
||||
}
|
||||
return environ
|
||||
}
|
||||
|
||||
func (s *Session) appendCmd(cmd string, args []string, cwd Dir, env map[string]string) {
|
||||
if s.started {
|
||||
s.started = false
|
||||
s.cmds = make([]*exec.Cmd, 0)
|
||||
}
|
||||
for k, v := range s.Env {
|
||||
if _, ok := env[k]; !ok {
|
||||
env[k] = v
|
||||
}
|
||||
}
|
||||
environ := newEnviron(s.Env, true) // true: inherit sys-env
|
||||
v, ok := s.alias[cmd]
|
||||
if ok {
|
||||
cmd = v[0]
|
||||
args = append(v[1:], args...)
|
||||
}
|
||||
c := exec.Command(cmd, args...)
|
||||
c.Env = environ
|
||||
c.Dir = string(cwd)
|
||||
s.cmds = append(s.cmds, c)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user