Compare commits
477 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5606a308b6 | ||
|
|
9980b74688 | ||
|
|
414b1fd744 | ||
|
|
b99e26811b | ||
|
|
2e69ff6041 | ||
|
|
d9a989d6b0 | ||
|
|
75180f7f9b | ||
|
|
fc466e2c05 | ||
|
|
a54f9ebc7c | ||
|
|
c5337cf6a2 | ||
|
|
b0189049b7 | ||
|
|
fc4699dee9 | ||
|
|
d9334900fb | ||
|
|
f92d8d9a6a | ||
|
|
b836c1f65a | ||
|
|
02277cc411 | ||
|
|
495994daf0 | ||
|
|
56d0af02c4 | ||
|
|
1a70dd1707 | ||
|
|
e9ddde8a82 | ||
|
|
da92419023 | ||
|
|
4aa970ace8 | ||
|
|
a36aaab686 | ||
|
|
c1d901723d | ||
|
|
952ff31189 | ||
|
|
713a8d4f31 | ||
|
|
42712f8896 | ||
|
|
e0adfd035f | ||
|
|
379ee525a8 | ||
|
|
b9e7a09f4c | ||
|
|
a6c7cc50ce | ||
|
|
981e857ab1 | ||
|
|
c8c4a6a0c6 | ||
|
|
383deb2b1b | ||
|
|
9fdff11687 | ||
|
|
2f0f2889db | ||
|
|
dce031d38d | ||
|
|
31fafe55d3 | ||
|
|
833f308d2f | ||
|
|
0c715d4b39 | ||
|
|
a529f6fce8 | ||
|
|
0d838d1248 | ||
|
|
3d2af158ff | ||
|
|
5968e81b17 | ||
|
|
3aa5231f7e | ||
|
|
3c056527e8 | ||
|
|
0fe3d92fd7 | ||
|
|
2b8ea890ad | ||
|
|
9242a5dd31 | ||
|
|
d960b9c246 | ||
|
|
9f7a33ca3e | ||
|
|
4d7671dee3 | ||
|
|
f55e047619 | ||
|
|
661b6706de | ||
|
|
a8f08bd5a8 | ||
|
|
b299f66c28 | ||
|
|
b5495ed0c3 | ||
|
|
99c9bb2863 | ||
|
|
d6aa8d59f1 | ||
|
|
d9d3a16e5c | ||
|
|
5105c4f71d | ||
|
|
23a6656566 | ||
|
|
a2ed0ef2b6 | ||
|
|
e2d3107e8a | ||
|
|
0e5bc10ae7 | ||
|
|
b3053fe392 | ||
|
|
12ee6953bb | ||
|
|
9dfa7ccee6 | ||
|
|
45e53d3d9d | ||
|
|
ea7e3dc61d | ||
|
|
50fe9e39ad | ||
|
|
9312a99664 | ||
|
|
d8f69746bb | ||
|
|
e45db108d8 | ||
|
|
845c7e7dea | ||
|
|
e33d17b7dd | ||
|
|
96c6d46dd1 | ||
|
|
30f9ab740d | ||
|
|
5224a6c678 | ||
|
|
bc8750ebe3 | ||
|
|
aee2d9ca64 | ||
|
|
1a151ddabe | ||
|
|
b5eef489fd | ||
|
|
580bab491f | ||
|
|
41db33696f | ||
|
|
33eca97c87 | ||
|
|
cc565661e3 | ||
|
|
6225a4113c | ||
|
|
b388c2ce1e | ||
|
|
d16a5aede6 | ||
|
|
62774b156d | ||
|
|
59b9e5335b | ||
|
|
d701c99c72 | ||
|
|
132c0b1c81 | ||
|
|
4e6a980bc6 | ||
|
|
95334ed3fe | ||
|
|
61270967c1 | ||
|
|
705c04504c | ||
|
|
2aeb298663 | ||
|
|
7df1642e4a | ||
|
|
29023927f5 | ||
|
|
6ac59dcdfc | ||
|
|
c2053d5322 | ||
|
|
5c938fee8a | ||
|
|
ba33c161f5 | ||
|
|
6374178046 | ||
|
|
295c897b7e | ||
|
|
814c2a39c5 | ||
|
|
7e7eb1dc87 | ||
|
|
4e472c39e3 | ||
|
|
6d0b4ef4ec | ||
|
|
1bad26426e | ||
|
|
df8f4fb882 | ||
|
|
89af9cf5db | ||
|
|
0f4ee909d5 | ||
|
|
48132aa658 | ||
|
|
af924efe17 | ||
|
|
79366216cc | ||
|
|
61136e2591 | ||
|
|
5ecfc7bb91 | ||
|
|
020215ac0a | ||
|
|
bb54f845aa | ||
|
|
802c183b56 | ||
|
|
c4d0d37113 | ||
|
|
2b59c4b8eb | ||
|
|
e1672b2764 | ||
|
|
b6ce856acb | ||
|
|
b33aebcae2 | ||
|
|
f90c7b9524 | ||
|
|
4a0c0eab25 | ||
|
|
50f7b4236b | ||
|
|
af626069dd | ||
|
|
be533692fd | ||
|
|
48f76bcfef | ||
|
|
3b252d43c6 | ||
|
|
2949b620d8 | ||
|
|
3d7e7028fd | ||
|
|
9293572e41 | ||
|
|
cec2802df2 | ||
|
|
d6c5b648f2 | ||
|
|
77257c484f | ||
|
|
95ae41b2fd | ||
|
|
aee8ada6d0 | ||
|
|
6f52853049 | ||
|
|
077b7cee6e | ||
|
|
23b35a03b4 | ||
|
|
f9b0f3ad34 | ||
|
|
65af77e1bc | ||
|
|
c83fbad205 | ||
|
|
3b1e0ceb51 | ||
|
|
3caec44eac | ||
|
|
767b45ae56 | ||
|
|
1a7586cd03 | ||
|
|
2834ce1f1a | ||
|
|
fafa33e40d | ||
|
|
3ce5df90bf | ||
|
|
f1406fd93d | ||
|
|
fdec668646 | ||
|
|
48fef51f76 | ||
|
|
72c829e29b | ||
|
|
6cb770bf1c | ||
|
|
bdce8f6f05 | ||
|
|
c7ef040e8c | ||
|
|
ee039fe4f1 | ||
|
|
7a5942e1ac | ||
|
|
be6a19c210 | ||
|
|
986e8f7b25 | ||
|
|
fffa6a1bc5 | ||
|
|
a375eb3ec3 | ||
|
|
052e3e88c8 | ||
|
|
00e0187ad1 | ||
|
|
fbc2e22dd6 | ||
|
|
86c11f1068 | ||
|
|
110d8a4863 | ||
|
|
bc00b5bfa8 | ||
|
|
3ab828a362 | ||
|
|
88cd81e390 | ||
|
|
42ee978549 | ||
|
|
b468c2e09e | ||
|
|
2922a95ff6 | ||
|
|
9202f110ab | ||
|
|
054ccfe3fd | ||
|
|
2fb48c414b | ||
|
|
c4125f9e47 | ||
|
|
dc36e6008c | ||
|
|
3a7e1bfa16 | ||
|
|
482b680e16 | ||
|
|
a4d79e2de9 | ||
|
|
6b973a9565 | ||
|
|
53f9974f6f | ||
|
|
fb8f08d280 | ||
|
|
5dafee84ba | ||
|
|
f366a37cd1 | ||
|
|
64d4af160b | ||
|
|
70e1e5d14d | ||
|
|
7cdc2a6e49 | ||
|
|
26ae97eea2 | ||
|
|
f90d298027 | ||
|
|
8f9ccf9b0b | ||
|
|
f0f363da4c | ||
|
|
0e6c978d62 | ||
|
|
07ae5190c3 | ||
|
|
3cfadb9c9b | ||
|
|
886acfaf39 | ||
|
|
59dc7c0deb | ||
|
|
4c53911993 | ||
|
|
909f86a393 | ||
|
|
c7bde60966 | ||
|
|
1cba586e90 | ||
|
|
51d704c123 | ||
|
|
3837cb42cf | ||
|
|
6dfc90d388 | ||
|
|
3a6f2eca82 | ||
|
|
0ed0e8d458 | ||
|
|
19a10e3455 | ||
|
|
c475bfdc24 | ||
|
|
6240aaa605 | ||
|
|
05b1421027 | ||
|
|
0822f12226 | ||
|
|
914757360b | ||
|
|
485068479c | ||
|
|
724ec8e0a4 | ||
|
|
5c5039a533 | ||
|
|
230066fc98 | ||
|
|
9b409bf628 | ||
|
|
826e08bea9 | ||
|
|
ff9e149465 | ||
|
|
0bb8fd0b8e | ||
|
|
77bea6e040 | ||
|
|
f6ca187a5e | ||
|
|
afc492e23f | ||
|
|
859e400587 | ||
|
|
d79966af05 | ||
|
|
7d5813f0a7 | ||
|
|
9c15f89a35 | ||
|
|
12777d9bf0 | ||
|
|
64fa098d2c | ||
|
|
043b055558 | ||
|
|
870ca86ba6 | ||
|
|
df936fb057 | ||
|
|
3f0b3f8385 | ||
|
|
c90c6b3f45 | ||
|
|
7e25e74779 | ||
|
|
0992719e3d | ||
|
|
97ef925243 | ||
|
|
1842c19a03 | ||
|
|
d5ceda6da7 | ||
|
|
e5fb746a7f | ||
|
|
7c7896029c | ||
|
|
8b7b2107f4 | ||
|
|
ef583eef66 | ||
|
|
c2fa43384c | ||
|
|
179a5e611b | ||
|
|
7357df7c9d | ||
|
|
122df4cdaf | ||
|
|
1cfb1fc3fc | ||
|
|
b10120af12 | ||
|
|
7af7355441 | ||
|
|
a9c1ed0c6d | ||
|
|
e931930faa | ||
|
|
66f7fa3192 | ||
|
|
959c51eb50 | ||
|
|
c4ef29173c | ||
|
|
fe3e079a93 | ||
|
|
57acf3b295 | ||
|
|
6f92385608 | ||
|
|
f5bceb955c | ||
|
|
c35a024d39 | ||
|
|
a02f32e985 | ||
|
|
9164740117 | ||
|
|
371ba99540 | ||
|
|
6ad65dd9b4 | ||
|
|
72a58bbda3 | ||
|
|
30d660335f | ||
|
|
d891e2214a | ||
|
|
1c02ef9674 | ||
|
|
b48464a7e2 | ||
|
|
5fb30ab934 | ||
|
|
89df6eeded | ||
|
|
2a4caf95b4 | ||
|
|
edfb2ab990 | ||
|
|
bf7b44f215 | ||
|
|
955f95e899 | ||
|
|
14bff0679f | ||
|
|
2dad1afa57 | ||
|
|
e8118d1af8 | ||
|
|
9b6322e96b | ||
|
|
1b22f69b9e | ||
|
|
be8e4ab014 | ||
|
|
ce89c021ab | ||
|
|
c96d139f54 | ||
|
|
ef369eb02f | ||
|
|
9f985077c7 | ||
|
|
2a756ff3a4 | ||
|
|
4ad0c3022e | ||
|
|
013eafd8df | ||
|
|
d871d2f292 | ||
|
|
c5f0639267 | ||
|
|
f99915b682 | ||
|
|
a1acc5e1fd | ||
|
|
d8c564d926 | ||
|
|
55892d7743 | ||
|
|
3e100e3002 | ||
|
|
40d1f22d74 | ||
|
|
b81a6c398d | ||
|
|
b8851a66cf | ||
|
|
2ff2ca55c1 | ||
|
|
fb3492c824 | ||
|
|
32f47d31b2 | ||
|
|
fbc96d92b5 | ||
|
|
666f2d7434 | ||
|
|
d7830fa730 | ||
|
|
00babb5ff5 | ||
|
|
161111aab5 | ||
|
|
cb39110904 | ||
|
|
c7bd7119b8 | ||
|
|
fda3a08c83 | ||
|
|
55c2b0fd62 | ||
|
|
e35493e248 | ||
|
|
ca9443669f | ||
|
|
dc64759a97 | ||
|
|
45120c5e43 | ||
|
|
7f99fcb844 | ||
|
|
d8fa69c5f4 | ||
|
|
1eb01db8f9 | ||
|
|
aec4543b61 | ||
|
|
3e05a8c8ac | ||
|
|
0af71abe12 | ||
|
|
34895630fd | ||
|
|
cd65704c5e | ||
|
|
f293e9026d | ||
|
|
8f21a38160 | ||
|
|
077c6a1b89 | ||
|
|
3d49dbb1a7 | ||
|
|
4656e80ab8 | ||
|
|
87b7a74cf0 | ||
|
|
20bb7caef4 | ||
|
|
d9026a9974 | ||
|
|
2b9a31f06d | ||
|
|
3fdc1d20b6 | ||
|
|
0fcc541e4f | ||
|
|
8fba61e212 | ||
|
|
9c68bda9b4 | ||
|
|
9e396a1b42 | ||
|
|
92610f347f | ||
|
|
b6767f8efc | ||
|
|
8c8745ca4c | ||
|
|
992ac973cc | ||
|
|
7d9adaffc3 | ||
|
|
78238785ba | ||
|
|
6e7c887d5f | ||
|
|
6b80d1e0f2 | ||
|
|
19871fe81d | ||
|
|
514d66f40d | ||
|
|
22088f5d82 | ||
|
|
59baadef06 | ||
|
|
cb6213adee | ||
|
|
40e628778b | ||
|
|
6cd89fa72a | ||
|
|
2d96bd2939 | ||
|
|
cbba084cb8 | ||
|
|
31c6444dae | ||
|
|
d6ad9f0e85 | ||
|
|
e760e1cc92 | ||
|
|
9490889411 | ||
|
|
17d78856e0 | ||
|
|
376e1d3411 | ||
|
|
a0c5c4576e | ||
|
|
61e154899b | ||
|
|
c0028f122b | ||
|
|
22fd0aa7f0 | ||
|
|
08bcebbd17 | ||
|
|
78967eedd7 | ||
|
|
cc4fda235c | ||
|
|
d6c369cfdf | ||
|
|
55129cb9f6 | ||
|
|
2e220da491 | ||
|
|
e0c49ec724 | ||
|
|
938a16de53 | ||
|
|
80d13c0005 | ||
|
|
d1f358c6fb | ||
|
|
f5f7b8dd7e | ||
|
|
795da11d24 | ||
|
|
c63be44989 | ||
|
|
17271b6132 | ||
|
|
82b700d635 | ||
|
|
da465a61dd | ||
|
|
875da5211f | ||
|
|
fc8e8484c6 | ||
|
|
7ebdcaa2e5 | ||
|
|
8e5c8c0832 | ||
|
|
4abccf0119 | ||
|
|
dd9ef4866c | ||
|
|
8502881633 | ||
|
|
43e9e6ddb6 | ||
|
|
471a5fa087 | ||
|
|
f95ad79fc4 | ||
|
|
896ce50c93 | ||
|
|
cbbc63d0f8 | ||
|
|
1f73b58340 | ||
|
|
881a700e99 | ||
|
|
9d81dda524 | ||
|
|
566cc15081 | ||
|
|
f1827a86a4 | ||
|
|
fc1762156d | ||
|
|
343ee24c46 | ||
|
|
441d212ef2 | ||
|
|
bc072e1db3 | ||
|
|
ab7f9f1161 | ||
|
|
e95d1e8602 | ||
|
|
948d7902f2 | ||
|
|
8535900f9d | ||
|
|
152b060901 | ||
|
|
464ef4d879 | ||
|
|
156e987300 | ||
|
|
8abb9ec408 | ||
|
|
97734cc242 | ||
|
|
93a01fb763 | ||
|
|
2a51301a5d | ||
|
|
1d6d5755d4 | ||
|
|
6fed503024 | ||
|
|
95914d1c13 | ||
|
|
92c18fa664 | ||
|
|
7bd5df0e25 | ||
|
|
9b5abeac4d | ||
|
|
de09260c33 | ||
|
|
7cf28ee01f | ||
|
|
e04b90c416 | ||
|
|
5e1b5b2900 | ||
|
|
416dac6d2b | ||
|
|
9a04104bb9 | ||
|
|
43fe6edb04 | ||
|
|
3a850fa05e | ||
|
|
097bdecfac | ||
|
|
1d4cc0b991 | ||
|
|
3e62b1acce | ||
|
|
c2911c94a8 | ||
|
|
f5a5f7702b | ||
|
|
5f2a5fe2bc | ||
|
|
50208862b2 | ||
|
|
283432f214 | ||
|
|
d1e94f6c91 | ||
|
|
dbb6560b1e | ||
|
|
f3535292b3 | ||
|
|
568902302b | ||
|
|
cddcf997e1 | ||
|
|
f2bd2b8541 | ||
|
|
6bb01404ec | ||
|
|
e8b4bd5a89 | ||
|
|
2695d957ac | ||
|
|
051b286a62 | ||
|
|
67b7fa6263 | ||
|
|
c697c65508 | ||
|
|
85f9bb3aae | ||
|
|
c5c0ae00ba | ||
|
|
0dec01c324 | ||
|
|
3827e38caa | ||
|
|
14a7cac686 | ||
|
|
9322200eae | ||
|
|
ee32b05a36 | ||
|
|
3b41d6d16f | ||
|
|
8aef43b3ae | ||
|
|
e45455b73f | ||
|
|
356acdd08d | ||
|
|
f9b7d5378d | ||
|
|
58d0bc983a | ||
|
|
81aefba305 | ||
|
|
8f5c5d5ae2 | ||
|
|
8025657a38 | ||
|
|
779808f832 | ||
|
|
d3e18d3362 | ||
|
|
606bbda66c | ||
|
|
3706392e65 | ||
|
|
ab7c313411 | ||
|
|
f797ff77f4 | ||
|
|
c2736c7c7a | ||
|
|
2464bc0458 |
@@ -9,3 +9,8 @@ indent_size = 2
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.mk]
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
.vagrant
|
||||
.DS_Store
|
||||
stack.tgz
|
||||
build
|
||||
tmp
|
||||
*.deb
|
||||
|
||||
38
.s3cfg
38
.s3cfg
@@ -1,38 +0,0 @@
|
||||
[default]
|
||||
access_key
|
||||
secret_key
|
||||
bucket_location = US
|
||||
cloudfront_host = cloudfront.amazonaws.com
|
||||
cloudfront_resource = /2010-07-15/distribution
|
||||
default_mime_type = binary/octet-stream
|
||||
delete_removed = False
|
||||
dry_run = False
|
||||
encoding = UTF-8
|
||||
encrypt = False
|
||||
follow_symlinks = False
|
||||
force = False
|
||||
get_continue = False
|
||||
gpg_command = None
|
||||
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
||||
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
||||
gpg_passphrase =
|
||||
guess_mime_type = True
|
||||
host_base = s3.amazonaws.com
|
||||
host_bucket = %(bucket)s.s3.amazonaws.com
|
||||
human_readable_sizes = False
|
||||
list_md5 = False
|
||||
log_target_prefix =
|
||||
preserve_attrs = True
|
||||
progress_meter = True
|
||||
proxy_host =
|
||||
proxy_port = 0
|
||||
recursive = False
|
||||
recv_chunk = 4096
|
||||
reduced_redundancy = False
|
||||
send_chunk = 4096
|
||||
simpledb_host = sdb.amazonaws.com
|
||||
skip_existing = False
|
||||
socket_timeout = 300
|
||||
urlencoding_mode = normal
|
||||
use_https = False
|
||||
verbosity = WARNING
|
||||
16
.travis.yml
16
.travis.yml
@@ -1,16 +0,0 @@
|
||||
---
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- echo "StrictHostKeyChecking=no" >> ~/.ssh/config
|
||||
- export IP=$(curl -s http://dokku-ci.herokuapp.com/hosts | tail -1)
|
||||
- git config --global user.email "travis-ci@exmaple.com"
|
||||
- git config --global user.name "Travis CI"
|
||||
- git checkout --orphan orphan HEAD
|
||||
- git commit -am 'orphaned'
|
||||
- git remote add runner ssh://test@$IP:2022/dokku
|
||||
- sleep 8
|
||||
- git push runner orphan:master
|
||||
notifications:
|
||||
irc: "chat.freenode.net#dokku"
|
||||
3
AUTHORS
3
AUTHORS
@@ -1,9 +1,11 @@
|
||||
# If you're submitting a patch, please add your name here in alphabetical order as part of the patch.
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
#
|
||||
3onyc <3onyc@x3tech.com>
|
||||
Alexander <iam.asm89@gmail.com>
|
||||
Alexander Beletsky <alexander.beletsky@gmail.com>
|
||||
Alexis Gavoty <kload@kload.fr>
|
||||
Christian Joudrey <cmallette@gmail.com>
|
||||
Felipe Coury <felipe.coury@gmail.com>
|
||||
Jeff Lindsay <progrium@gmail.com>
|
||||
Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
@@ -11,6 +13,7 @@ Leo Unbekandt <leo@unbekandt.eu>
|
||||
Ludovic Perrine <jazzzz@gmail.com>
|
||||
Luigi Maselli <grigio.org@gmail.com>
|
||||
Martin Weiss <kornnflake@gmail.com>
|
||||
Michael Hobbs <github@psudo.net>
|
||||
Paul Lietar <paul@lietar.net>
|
||||
Rajiv Makhijani <rajiv@blue-tech.org>
|
||||
rhy-jot <rhy-jot@myeml.net>
|
||||
|
||||
176
HISTORY.md
176
HISTORY.md
@@ -1,5 +1,181 @@
|
||||
# History
|
||||
|
||||
## 0.3.18
|
||||
|
||||
- #1111: @michaelhobbs Call pre-build-dockerfile before docker build
|
||||
- #1119: @joshco Logging info suggesting tuned CHECKS
|
||||
- #1120: @josegonzalez [docs] Add freenode shield to readme
|
||||
- #1121: @josegonzalez Prompt users to run the web installer via MOTD. Closes #943
|
||||
- #1129: @josegonzalez Validate nginx configuration before restarting nginx
|
||||
- #1137: @YellowApple [docs] Safer installation method
|
||||
- #1138: @chrisbutcher [docs] Include tip about using sshcommand acl-add
|
||||
- #1140: @NigelThorne [docs] Replaced reference to gitreceive with sshcommand as per #746
|
||||
- #1144: @protonet Allow git-remote with different port
|
||||
- #1145: @michaelhobbs allow docker-options over ssh. plus test. closes #1135
|
||||
- #1146: @michaelhobbs Don't re-deploy on domains:add. allow multple domains on command line. Closes #1142
|
||||
- #1147: @michaelhobbs Utilize all 4 free CircleCI containers
|
||||
- #1148: @TheEmpty [docs] Add information about 444 for nginx in default_sever.
|
||||
- #1150: @cjblomqvist [docs] Add monit plugin
|
||||
- #1151: @LTe Do not kill docker container with SIGKILL
|
||||
- #1153: @econya [docs] Add README-section: how to contribute
|
||||
- #1058: @josegonzalez Move bootstrap script to use debian package where possible
|
||||
- #1171: @josegonzalez Use debconf for package configuration
|
||||
- #1172: @michaelhobbs unify default and custom nginx template processing
|
||||
- #1173: @josegonzalez [docs] standardize readme badges
|
||||
- #1178: @jagandecapri [docs] Update plugins.md
|
||||
- #1189: @vincentfretin wait 30 seconds and not 30 minutes
|
||||
- #1190: @josegonzalez Fix docker gpg key installation
|
||||
|
||||
## 0.3.17
|
||||
|
||||
- #1056: @joshco New check retries feature
|
||||
- #1060: @josegonzalez Add .template suffix to nginx configuration templates. Refs #1054
|
||||
- #1064: @michaelhobbs [docs] Document test suite
|
||||
- #1065: @michaelhobbs Minor dev env cleanup
|
||||
- #1067: @martinAntsy Fix nginx docs wording around config template eg
|
||||
- #1068: @matiaskorhonen Fix escaping in the rc.local script in the Linode StackScript
|
||||
- #1074: @Flink Better detection of dokku remote in dokku_client.sh
|
||||
- #1075: @Flink Use TTY option for SSH
|
||||
- #1077: @Flink [docs] Add dokku-psql-single-container to plugins
|
||||
- #1079: @rorykoehler Corrected configuration link in bootstrap.sh
|
||||
- #1080: @michaelhobbs Include official docker-options plugin. closes #1062
|
||||
- #1081: @michaelhobbs Force testing .env with no newline. Closes #1025, #1026, #1063
|
||||
- #1082: @michaelhobbs Test cleanup with slight performance boost
|
||||
- #1084: @awendt Make port forwarding configurable
|
||||
- #1087: @michaelhobbs Make docker-options adhere to DOKKU_NOT_IMPLEMENTED_EXIT pattern
|
||||
- #1088: @michaelhobbs Support dockerfiles without expose command. closes #1083
|
||||
- #1097: @michaelhobbs Use config:set-norestart in domains plugin. config:get for dockerfile port. closes #1041
|
||||
- #1102: @kblcuk Source app-specific ENV during check-deploy
|
||||
- #1107: @Benjamin-Dobell [docs] Added Dokku Graduate to the list of known plugins
|
||||
|
||||
## 0.3.16
|
||||
|
||||
- #974: @michaelhobbs Don't use set to guard against pipefail
|
||||
- #975: @michaelhobbs Simplify SSL hostname handling and avoid overwriting variables. refs #971
|
||||
- #978: @michaelhobbs Add apparmor and cgroup-lite as pre-dependencies for dokku debian package
|
||||
- #980: @josegonzalez [docs] Add documentation for pluginhooks
|
||||
- #981: @josegonzalez Remove old files
|
||||
- #982: @josegonzalez [docs] Add documentation for existing clients. Closes #977
|
||||
- #983: @josegonzalez [docs] Update installation documentation
|
||||
- #984: @josegonzalez [docs] Clarify installation instructions
|
||||
- #988: @josegonzalez [docs] Add deprecated plugins section and where to get help
|
||||
- #989: @josegonzalez [docs] Add more clients
|
||||
- #986: @josegonzalez Switch to yabawock's static nginx buildpack for tests
|
||||
- #987: @techniq Improve Dockerfile example/test
|
||||
- #967: @alessio Really clean-up containers and images a-la-Docker
|
||||
- #992: @josegonzalez [docs] Fix digital ocean docs. Closes #991
|
||||
- #994: @alessio Fix quoting in container termination. Closes #249
|
||||
- #996: @pmvieira [docs] Minor typo fix in the pluginhooks documentation
|
||||
- #1003: @michaelhobbs Remove quoting around cleanup and disable lint for those lines
|
||||
- #1001: @sekjun9878 [docs] Add sekjun9878/dokku-redis-plugin to plugins.md
|
||||
- #1004: @michaelhobbs Remove quoting from dockerfile env. closes #1002
|
||||
- #1018: @michaelhobbs Confine arg shifting to between dokku and command. closes #1017
|
||||
- #1022: @Flink [docs] Add dokku-maintenance to plugins
|
||||
- #1008: @lmars Support multiple domains using a wildcard TLS certificate
|
||||
- #1013: @lmars Fix URL schemes in `dokku urls` output
|
||||
- #1027: @nickstenning [docs] Add webhooks plugin to documentation
|
||||
- #1026: @michaelhobbs Ensure we have newlines around our config. closes #1025
|
||||
- #1010: @michaelhobbs Don't run create/destroy twice in tests
|
||||
- #1028: @Flink [docs] Add rails-logs to plugins
|
||||
- #1031: @michaelhobbs Upgrade docker in CI to 1.5.0
|
||||
- #1029: @assaf Added several enhancements for CHECKS file:
|
||||
- Specify how long to wait before running first check
|
||||
- Specify timeout for each check
|
||||
- Check specific hosts, e.g. http://signin.example.com
|
||||
- Check both HTTP and HTTPS resources
|
||||
- #1032: @cameron-martin Updated dokku-installer to use relative path
|
||||
- #1035: @Flink [docs] Add dokku-http-auth to plugins
|
||||
- #1040: @ebeigarts [docs] Add dokku-slack plugin information
|
||||
- #1038: @michaelhobbs Default container check. closes #1020
|
||||
- #1036: @michaelhobbs Create config set/unset without restart. closes #908
|
||||
- #1009: @michaelhobbs Extract first port from Dockerfile and set config variable for use in deploy phase. closes #993
|
||||
- #1042: @michaelhobbs Update to Support xip.io wildcard DNS as a VHOST
|
||||
- #1043: @michaelhobbs Use upstart config from docker docs. closes #1015
|
||||
- #1047: @michaelhobbs Show logs on deploy success and failure
|
||||
- #1049: @ebeigarts [docs] Change Slack Notifications link
|
||||
- #1051: @Flink [docs] Add dokku-airbrake-deploy to plugins
|
||||
- #1057: @josegonzalez Updated deb packaging
|
||||
|
||||
## 0.3.15
|
||||
|
||||
- #950: @michaelhobbs Do not count blank lines in `make count`
|
||||
- #952: @michaelhobbs Document cli args over ssh. closes #951
|
||||
- #954: @michaelhobbs Dockerfile support
|
||||
- #955: @michaelhobbs Quick style refactor
|
||||
- #956: @michaelhobbs Comment out skipped tests as we pay the cost for setup() and teardown() anyway
|
||||
- #957: @michaelhobbs Implement dokku shell and ls (by @plietar). refs #312
|
||||
- #960: @michaelhobbs Use consistent bash shebang. closes #959
|
||||
- #962: @josegonzalez Update debian package building due to man page generation changes
|
||||
- #964: @michaelhobbs Only look for long args in global space. allows for short args in plugins. closes #963
|
||||
- #966: @djelic handle upgrade in debian/preinst script
|
||||
|
||||
## 0.3.14
|
||||
|
||||
- #891: @josegonzalez Keep existing configuration files when installing nginx. Refs #886
|
||||
- #892: @josegonzalez Change documentation on where the ssh config PORT is setup
|
||||
- #894: @josegonzalez Dokku client improvements
|
||||
- #895: @michaelhobbs Document deploying private git submodules. Closes #644
|
||||
- #896: @michaelhobbs Add docker-args pluginhook call to build phase. Closes #515
|
||||
- #897: @michaelhobbs Official PS plugin
|
||||
- #898: @joliv Update man page for 0.3.13
|
||||
- #899: @joliv Use help2man to automatically generate man pages
|
||||
- #900: @michaelhobbs Support extracting SANs from SSL certificates and adding them to nginx config
|
||||
- #901: @misto Pull new tags when upgrading to update VERSION
|
||||
- #904: @michaelhobbs Prevent error on restartall when no apps deployed
|
||||
- #905: @vincentfretin robv/dokku-elasticsearch not compatible with latest version
|
||||
- #907: @vincentfretin Don't use -o pipefail for plugin
|
||||
- #914: @michaelhobbs Conditionally set interactive and tty on dokku run. Closes #552. Closes #913
|
||||
- #915: @michaelhobbs Document default sites in nginx. Closes #650
|
||||
- #916: @michaelhobbs Document build phase troubleshooting suggestions. Closes #841. Closes #911.
|
||||
- #917: @michaelhobbs Document resolvconf troubleshooting step. Closes #649
|
||||
- #922: @michaelhobbs Use tty cmd to detect if we have one. Closes #921
|
||||
- #925: @michaelhobbs Implement rebuild command that reuses git_archive_all
|
||||
- #926: @dyson Update Troubleshooting link in README.md.
|
||||
- #927: @michaelhobbs Support both docker-args PHASE and docker-args-PHASE. Closes #906
|
||||
- #933: @michaelhobbs Remove references to .pem. Closes #930
|
||||
- #936: @michaelhobbs Only execute build stack if we have access to /var/run/docker.sock. Closes #929
|
||||
- #938: @vincentfretin Enable ssl_prefer_server_ciphers
|
||||
- #940: @michaelhobbs Use valid composer json with specified php runtime
|
||||
- #941: @michaelhobbs Source global env prior to app env. Closes #931
|
||||
- #942: @michaelhobbs Test clojure app
|
||||
- #949: @michaelhobbs Common functions library with simple argument parsing. Closes #932. Closes #945
|
||||
|
||||
## 0.3.13
|
||||
|
||||
- #815: @abossard Added wordpress installation helper to plugin index
|
||||
- #858: @josegonzalez Disable server tokens in nginx. Closes #857
|
||||
- #859: @josegonzalez Pass command being executed when retrieving DOCKER_ARGS via pluginhook.
|
||||
- #861: @josegonzalez Default DOKKU_ROOT to ~dokku if unspecified. Closes #587
|
||||
- #863: @josegonzalez Add missing properties to the php composer.json
|
||||
- #864: @michaelhobbs bind docker container to internal port if using vhosts
|
||||
- #867: @michaelhobbs silent grep stderr. closes #862
|
||||
- #868: @michaelhobbs use circleci for automated testing
|
||||
- #872: @michaelhobbs fix/enable multi buildpack test
|
||||
- #873: @michaelhobbs support pre deployment usage of domains plugin. fixes interface binding issue
|
||||
- #874: @josegonzalez Add advanced installation docs that were removed in #706. Closes #869
|
||||
- #876: @vincentfretin give CACHE_PATH env variable for forward compatibility with herokuish
|
||||
- #877: @michaelhobbs add MH to AUTHORS
|
||||
- #880: @michaelhobbs disable VHOST deployment if global VHOST file is missing and an app domain has not been added
|
||||
- #881: @jomo troubleshooting typo: 64 != 46
|
||||
- #884: @michaelhobbs IP and PORT are likely to get clobbered. rename them
|
||||
- #885: @michaelhobbs test deploy node app without procfile
|
||||
|
||||
## 0.3.12
|
||||
|
||||
- #846: @michaelhobbs add certificate CN to app VHOST if it's not already
|
||||
- #847: @leonardodino Update bootstrap.sh: new docs url
|
||||
- #849: @cjoudrey Add docs for CHECKS
|
||||
- #850: @michaelhobbs test scala deployment
|
||||
|
||||
## 0.3.11
|
||||
|
||||
- #821: @michaelhobbs use wercker for automated testing
|
||||
- #833: @michaelhobbs auto remove the cache dir cleanup container
|
||||
- #835: @michaelhobbs make sure we match the specific string in VHOST
|
||||
- #838: @michaelhobbs quote build_env vars to allow for spaces in config
|
||||
- #839: @michaelhobbs notify irc on builds
|
||||
- #844: @michaelhobbs build app urls based on wildcard ssl or app ssl
|
||||
|
||||
## 0.3.10
|
||||
|
||||
- #783: @josegonzalez New domains plugin and nginx extension
|
||||
|
||||
64
Makefile
64
Makefile
@@ -3,8 +3,7 @@ DOKKU_VERSION = master
|
||||
SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand
|
||||
PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb
|
||||
STACK_URL ?= https://github.com/progrium/buildstep.git
|
||||
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz
|
||||
DOKKU_ROOT ?= /home/dokku
|
||||
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-12-16/2014-12-16_42bd9f4aab.tar.gz
|
||||
PLUGINS_PATH ?= /var/lib/dokku/plugins
|
||||
|
||||
# If the first argument is "vagrant-dokku"...
|
||||
@@ -15,30 +14,46 @@ ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
||||
$(eval $(RUN_ARGS):;@:)
|
||||
endif
|
||||
|
||||
.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
.PHONY: all apt-update install copyfiles man-db version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
|
||||
include tests.mk
|
||||
include deb.mk
|
||||
|
||||
all:
|
||||
# Type "make install" to install.
|
||||
|
||||
install: dependencies stack copyfiles plugin-dependencies plugins version
|
||||
install: dependencies copyfiles plugin-dependencies plugins version
|
||||
|
||||
copyfiles: addman
|
||||
release: deb-all package_cloud packer
|
||||
|
||||
package_cloud:
|
||||
package_cloud push dokku/dokku/ubuntu/trusty buildstep*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty pluginhook*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb
|
||||
package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb
|
||||
|
||||
packer:
|
||||
packer build contrib/packer.json
|
||||
|
||||
copyfiles:
|
||||
cp dokku /usr/local/bin/dokku
|
||||
mkdir -p ${PLUGINS_PATH}
|
||||
find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
|
||||
rm -Rf ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
||||
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
||||
done
|
||||
rm -Rf ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
||||
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
||||
done
|
||||
$(MAKE) addman
|
||||
|
||||
addman:
|
||||
mkdir -p /usr/local/share/man/man1
|
||||
cp dokku.1 /usr/local/share/man/man1/dokku.1
|
||||
help2man -Nh help -v version -n "configure and get information from your dokku installation" -o /usr/local/share/man/man1/dokku.1 dokku
|
||||
mandb
|
||||
|
||||
version:
|
||||
git describe --tags > ${DOKKU_ROOT}/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ${DOKKU_ROOT}/VERSION
|
||||
git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION
|
||||
|
||||
plugin-dependencies: pluginhook
|
||||
dokku plugins-install-dependencies
|
||||
@@ -46,7 +61,17 @@ plugin-dependencies: pluginhook
|
||||
plugins: pluginhook docker
|
||||
dokku plugins-install
|
||||
|
||||
dependencies: sshcommand pluginhook docker stack
|
||||
dependencies: apt-update sshcommand pluginhook docker help2man man-db
|
||||
$(MAKE) -e stack
|
||||
|
||||
apt-update:
|
||||
apt-get update
|
||||
|
||||
help2man:
|
||||
apt-get install -qq -y help2man
|
||||
|
||||
man-db:
|
||||
apt-get install -qq -y man-db
|
||||
|
||||
sshcommand:
|
||||
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
|
||||
@@ -61,7 +86,7 @@ docker: aufs
|
||||
apt-get install -qq -y curl
|
||||
egrep -i "^docker" /etc/group || groupadd docker
|
||||
usermod -aG docker dokku
|
||||
curl --silent https://get.docker.io/gpg | apt-key add -
|
||||
curl -sSL https://get.docker.com/gpg | apt-key add -
|
||||
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
|
||||
apt-get update
|
||||
ifdef DOCKER_VERSION
|
||||
@@ -72,23 +97,27 @@ endif
|
||||
sleep 2 # give docker a moment i guess
|
||||
|
||||
aufs:
|
||||
ifndef CI
|
||||
lsmod | grep aufs || modprobe aufs || apt-get install -qq -y linux-image-extra-`uname -r` > /dev/null
|
||||
endif
|
||||
|
||||
stack:
|
||||
ifeq ($(shell test -e /var/run/docker.sock && touch -a -c /var/run/docker.sock && echo $$?),0)
|
||||
@echo "Start building buildstep"
|
||||
ifdef BUILD_STACK
|
||||
@docker images | grep progrium/buildstep || (git clone ${STACK_URL} /tmp/buildstep && docker build -t progrium/buildstep /tmp/buildstep && rm -rf /tmp/buildstep)
|
||||
else
|
||||
@docker images | grep progrium/buildstep || curl --silent -L ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep
|
||||
endif
|
||||
endif
|
||||
|
||||
count:
|
||||
@echo "Core lines:"
|
||||
@cat dokku bootstrap.sh | wc -l
|
||||
@cat dokku bootstrap.sh | egrep -v "^$$" | wc -l
|
||||
@echo "Plugin lines:"
|
||||
@find plugins -type f | xargs cat | wc -l
|
||||
@find plugins -type f | xargs cat | egrep -v "^$$" | wc -l
|
||||
@echo "Test lines:"
|
||||
@find tests -type f | xargs cat | wc -l
|
||||
@find tests -type f | xargs cat | egrep -v "^$$" |wc -l
|
||||
|
||||
dokku-installer:
|
||||
apt-get install -qq -y ruby
|
||||
@@ -96,7 +125,7 @@ dokku-installer:
|
||||
test -f /var/lib/dokku/.dokku-installer-created || gem install rack-protection -v 1.5.3 --no-rdoc --no-ri
|
||||
test -f /var/lib/dokku/.dokku-installer-created || gem install sinatra -v 1.4.5 --no-rdoc --no-ri
|
||||
test -f /var/lib/dokku/.dokku-installer-created || gem install tilt -v 1.4.1 --no-rdoc --no-ri
|
||||
test -f /var/lib/dokku/.dokku-installer-created || ruby /root/dokku/contrib/dokku-installer.rb onboot
|
||||
test -f /var/lib/dokku/.dokku-installer-created || ruby contrib/dokku-installer.rb onboot
|
||||
test -f /var/lib/dokku/.dokku-installer-created || service dokku-installer start
|
||||
test -f /var/lib/dokku/.dokku-installer-created || service nginx reload
|
||||
test -f /var/lib/dokku/.dokku-installer-created || touch /var/lib/dokku/.dokku-installer-created
|
||||
@@ -106,3 +135,4 @@ vagrant-acl-add:
|
||||
|
||||
vagrant-dokku:
|
||||
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"
|
||||
|
||||
|
||||
15
README.md
15
README.md
@@ -1,4 +1,4 @@
|
||||
# Dokku [](https://travis-ci.org/progrium/dokku)
|
||||
# Dokku [](https://circleci.com/gh/progrium/dokku/tree/master) [](https://packagecloud.io/dokku/dokku) [](https://webchat.freenode.net/?channels=dokku) [](http://progrium.viewdocs.io/dokku/index)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
|
||||
|
||||
@@ -8,9 +8,10 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
|
||||
|
||||
## Installing
|
||||
|
||||
To install the latest stable version of dokku, you can run the following bootstrapper command:
|
||||
To install the latest stable release, you can run the following commands as a user that has access to `sudo`:
|
||||
|
||||
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.10/bootstrap.sh | sudo DOKKU_TAG=v0.3.10 bash
|
||||
wget https://raw.github.com/progrium/dokku/v0.3.18/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.3.18 bash bootstrap.sh
|
||||
|
||||
### Upgrading
|
||||
|
||||
@@ -22,7 +23,13 @@ Full documentation - including advanced installation docs - are available online
|
||||
|
||||
## Support
|
||||
|
||||
You can use [Github Issues](https://github.com/progrium/dokku/issues), check [Troubleshooting](https://github.com/progrium/dokku/wiki/Troubleshooting) on the wiki, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku)
|
||||
You can use [Github Issues](https://github.com/progrium/dokku/issues), check [Troubleshooting](http://progrium.viewdocs.io/dokku/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/progrium/dokku/issues), the [Troubleshooting Guide](http://progrium.viewdocs.io/dokku/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
|
||||
|
||||
|
||||
43
Vagrantfile
vendored
43
Vagrantfile
vendored
@@ -1,25 +1,24 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
BOX_NAME = ENV["BOX_NAME"] || "trusty"
|
||||
BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
BOX_MEMORY = ENV["BOX_MEMORY"] || "512"
|
||||
BOX_NAME = ENV["BOX_NAME"] || "chef/ubuntu-14.04"
|
||||
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
|
||||
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
|
||||
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
|
||||
FORWARDED_PORT = (ENV["FORWARDED_PORT"] || '8080').to_i
|
||||
PREBUILT_STACK_URL = File.exist?("#{File.dirname(__FILE__)}/stack.tgz") ? 'file:///root/dokku/stack.tgz' : nil
|
||||
PUBLIC_KEY_PATH = "#{Dir.home}/.ssh/id_rsa.pub"
|
||||
|
||||
make_cmd = "make install"
|
||||
make_cmd = "DEBIAN_FRONTEND=noninteractive make -e install"
|
||||
if PREBUILT_STACK_URL
|
||||
make_cmd = "PREBUILT_STACK_URL='#{PREBUILT_STACK_URL}' #{make_cmd}"
|
||||
end
|
||||
|
||||
Vagrant::configure("2") do |config|
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
config.vm.box = BOX_NAME
|
||||
config.vm.box_url = BOX_URI
|
||||
config.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
|
||||
config.vm.network :forwarded_port, guest: 80, host: 8080
|
||||
config.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
config.vm.network :private_network, ip: DOKKU_IP
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||
@@ -29,6 +28,30 @@ Vagrant::configure("2") do |config|
|
||||
vb.customize ["modifyvm", :id, "--memory", BOX_MEMORY]
|
||||
end
|
||||
|
||||
config.vm.provision :shell, :inline => "apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
|
||||
config.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
|
||||
config.vm.define "empty", autostart: false
|
||||
|
||||
config.vm.define "dokku", primary: true do |vm|
|
||||
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
|
||||
vm.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
vm.vm.network :private_network, ip: DOKKU_IP
|
||||
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
|
||||
end
|
||||
|
||||
config.vm.define "dokku-deb", autostart: false do |vm|
|
||||
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
|
||||
vm.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
vm.vm.network :private_network, ip: DOKKU_IP
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
|
||||
end
|
||||
|
||||
config.vm.define "build", autostart: false do |vm|
|
||||
vm.vm.provision :shell, :inline => "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
|
||||
end
|
||||
|
||||
if Pathname.new(PUBLIC_KEY_PATH).exist?
|
||||
config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub'
|
||||
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && mkdir -p /root/.ssh && sudo cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
|
||||
end
|
||||
end
|
||||
|
||||
68
bootstrap.sh
68
bootstrap.sh
@@ -1,35 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
#
|
||||
# A script to bootstrap dokku.
|
||||
# It expects to be run on Ubuntu 14.04 via 'sudo'
|
||||
# If installing a tag higher than 0.3.13, it may install dokku via a package (so long as the package is higher than 0.3.13)
|
||||
# It checks out the dokku source code from Github into ~/dokku and then runs 'make install' from dokku source.
|
||||
|
||||
set -eo pipefail
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"}
|
||||
|
||||
if ! command -v apt-get &>/dev/null
|
||||
then
|
||||
echo "This installation script requires apt-get. For manual installation instructions, consult https://github.com/progrium/dokku ."
|
||||
if ! command -v apt-get &>/dev/null; then
|
||||
echo "This installation script requires apt-get. For manual installation instructions, consult http://progrium.viewdocs.io/dokku/advanced-installation ."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -qq -y git make curl software-properties-common man-db
|
||||
[[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties
|
||||
|
||||
[[ `lsb_release -sr` == "12.04" ]] && apt-get install -qq -y python-software-properties
|
||||
dokku_install_source() {
|
||||
apt-get install -qq -y git make software-properties-common
|
||||
cd /root
|
||||
if [ ! -d /root/dokku ]; then
|
||||
git clone $DOKKU_REPO /root/dokku
|
||||
fi
|
||||
|
||||
cd ~ && test -d dokku || git clone $DOKKU_REPO
|
||||
cd dokku
|
||||
git fetch origin
|
||||
cd /root/dokku
|
||||
git fetch origin
|
||||
git checkout $DOKKU_CHECKOUT
|
||||
make install
|
||||
}
|
||||
|
||||
dokku_install_package() {
|
||||
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -qq -y "linux-image-extra-$(uname -r)" apt-transport-https
|
||||
|
||||
if [[ -n $DOKKU_CHECKOUT ]]; then
|
||||
sudo apt-get install -qq -y dokku=$DOKKU_CHECKOUT
|
||||
else
|
||||
sudo apt-get install -qq -y dokku
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -n $DOKKU_BRANCH ]]; then
|
||||
git checkout origin/$DOKKU_BRANCH
|
||||
export DOKKU_CHECKOUT="origin/$DOKKU_BRANCH"
|
||||
dokku_install_source
|
||||
elif [[ -n $DOKKU_TAG ]]; then
|
||||
git checkout $DOKKU_TAG
|
||||
export DOKKU_SEMVER="${DOKKU_TAG//v}"
|
||||
major=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[1]}')
|
||||
minor=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[2]}')
|
||||
patch=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[3]}')
|
||||
|
||||
# 0.3.13 was the first version with a debian package
|
||||
if [[ "$major" -eq "0" ]] && [[ "$minor" -lt "4" ]] && [[ "$patch" -lt "13" ]]; then
|
||||
export DOKKU_CHECKOUT="$DOKKU_TAG"
|
||||
dokku_install_source
|
||||
else
|
||||
export DOKKU_CHECKOUT="$DOKKU_SEMVER"
|
||||
dokku_install_package
|
||||
fi
|
||||
else
|
||||
dokku_install_package
|
||||
fi
|
||||
|
||||
make install
|
||||
|
||||
echo
|
||||
echo "Almost done! For next steps on configuration:"
|
||||
echo " https://github.com/progrium/dokku#configuring"
|
||||
|
||||
13
circle.yml
Normal file
13
circle.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
machine:
|
||||
services:
|
||||
- docker
|
||||
dependencies:
|
||||
cache_directories:
|
||||
- "~/docker"
|
||||
override:
|
||||
- ./tests/ci/parallel_runner.sh setup: { timeout: 300 }
|
||||
post:
|
||||
- sudo -E make -e lint
|
||||
test:
|
||||
override:
|
||||
- ./tests/ci/parallel_runner.sh testing: { parallel: true, timeout: 1800 }
|
||||
@@ -16,12 +16,12 @@ if ARGV[0] == "onboot"
|
||||
f.puts " }"
|
||||
f.puts "}"
|
||||
end
|
||||
`rm /etc/nginx/sites-enabled/*`
|
||||
`rm -f /etc/nginx/sites-enabled/*`
|
||||
puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot."
|
||||
exit
|
||||
end
|
||||
|
||||
version = "v0.3.10"
|
||||
version = "v0.3.18"
|
||||
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
|
||||
admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first
|
||||
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip
|
||||
|
||||
@@ -1,32 +1,128 @@
|
||||
if [ -z "$DOKKU_HOST" ]
|
||||
then
|
||||
function dokku {
|
||||
appname=$(git remote -v 2>/dev/null | grep dokku | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
donotshift="YES"
|
||||
fi
|
||||
if [ "$1" = "create" ]
|
||||
then
|
||||
appname=$(echo "print(elfs.GenName())" | lua -l elfs)
|
||||
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
|
||||
git push dokku master
|
||||
else
|
||||
if [ -z "$donotshift" ]
|
||||
then
|
||||
ssh dokku@$DOKKU_HOST $*
|
||||
exit
|
||||
fi
|
||||
verb=$1
|
||||
shift
|
||||
ssh dokku@$DOKKU_HOST "$verb" "$appname" $@
|
||||
fi
|
||||
}
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
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() {
|
||||
[[ -n "$1" ]] && RANGE="$1"
|
||||
if [[ -n "$RANGE" ]];then
|
||||
number=$RANDOM
|
||||
let "number %= $RANGE"
|
||||
else
|
||||
number=$RANDOM
|
||||
fi
|
||||
echo $number
|
||||
}
|
||||
|
||||
random_name() {
|
||||
NUM1=$(random_number ${#MOVES[@]})
|
||||
NUM2=$(random_number ${#MOVES[@]})
|
||||
NUM3=$(random_number ${#NAMES[@]})
|
||||
|
||||
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>"
|
||||
exit 20 # exit with specific status. only used in units tests for now
|
||||
}
|
||||
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -z $DOKKU_HOST ]]; then
|
||||
_dokku() {
|
||||
appname=""
|
||||
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
set +e
|
||||
appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
|
||||
set -e
|
||||
else
|
||||
echo "This is not a git repository"
|
||||
fi
|
||||
|
||||
if [[ "$appname" != "" ]] && [[ -n "$*" ]]; then
|
||||
case "$1" in
|
||||
apps|backup*|help|plugins*|ps:restartall|trace|version)
|
||||
true
|
||||
;;
|
||||
apps:destroy)
|
||||
if [[ -z "$2" ]] || [[ "$2" == "force" ]];then
|
||||
donotshift="YES"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
donotshift="YES"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ "$1" = "apps:create" ]] && [[ -z "$2" ]]; then
|
||||
appname=$(random_name)
|
||||
counter=0
|
||||
while ssh "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 "dokku@$DOKKU_HOST" apps
|
||||
exit 1
|
||||
else
|
||||
appname=$(random_name)
|
||||
counter=$((counter+1))
|
||||
fi
|
||||
done
|
||||
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
|
||||
git push dokku master
|
||||
return $?
|
||||
fi
|
||||
|
||||
if [[ -z "$donotshift" ]]; then
|
||||
ssh -t "dokku@$DOKKU_HOST" "$@"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [[ -z "$verb" ]]; then
|
||||
if [[ ! "$1" =~ --* ]]; then
|
||||
verb=$1
|
||||
shift
|
||||
args="$*"
|
||||
else
|
||||
long_args="--"
|
||||
for arg in "$@";do
|
||||
if [[ "$arg" =~ --* ]];then
|
||||
long_args+=" $arg"
|
||||
args=("${args[@]/$arg}")
|
||||
else
|
||||
verb="$arg"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
ssh -t "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}"
|
||||
}
|
||||
|
||||
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]]; then
|
||||
_dokku "$@"
|
||||
exit $?
|
||||
fi
|
||||
else
|
||||
client_help_msg
|
||||
fi
|
||||
|
||||
32
contrib/packer.json
Normal file
32
contrib/packer.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"builders": [
|
||||
{
|
||||
"type": "digitalocean",
|
||||
"region": "nyc3",
|
||||
"image": "ubuntu-14-04-x64"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "file",
|
||||
"source": "deb.mk",
|
||||
"destination": "/tmp/Makefile"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"echo '--> Waiting 30 seconds for core services to be available'",
|
||||
"sleep 30",
|
||||
|
||||
"echo '--> Updating apt repositories'",
|
||||
"sudo apt-get update > /dev/null",
|
||||
|
||||
"echo '--> Installing make requirement'",
|
||||
"sudo apt-get -qq -y install build-essential",
|
||||
|
||||
"cd /tmp && make install-from-deb",
|
||||
"rm /root/.ssh/authorized_keys"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
183
contrib/stackscript.sh
Normal file
183
contrib/stackscript.sh
Normal file
@@ -0,0 +1,183 @@
|
||||
#!/bin/bash
|
||||
# <UDF name="hostname" default="" label="Hostname for dokku instance" example="example.com">
|
||||
# <UDF name="ssh_key" default="" label="Public SSH Key for root user" example="Sets the root user's public ssh key, which is also automatically imported into the dokku installer">
|
||||
# <UDF name="notify_email" default="" Label="Send Finish Notification To" example="Email address to send notification to when finished." />
|
||||
|
||||
function logit {
|
||||
# Simple logging function that prepends an easy-to-find marker '=> ' and a timestamp to a message
|
||||
TIMESTAMP=$(date -u +'%m/%d %H:%M:%S')
|
||||
MSG="=> ${TIMESTAMP} $1"
|
||||
echo ${MSG}
|
||||
}
|
||||
|
||||
function set_ssh_key {
|
||||
if [ -n "${SSH_KEY}" ]; then
|
||||
logit "Setting root ssh key"
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 /root/.ssh
|
||||
echo "$SSH_KEY" > /root/.ssh/authorized_keys
|
||||
chmod 600 /root/.ssh/authorized_keys
|
||||
chown -R root:root /root/.ssh
|
||||
fi
|
||||
}
|
||||
|
||||
function set_passwordless_ssh {
|
||||
logit "Turn off password authentication and root login for SSH"
|
||||
echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config
|
||||
service ssh restart
|
||||
}
|
||||
|
||||
function system_primary_ip {
|
||||
# returns the primary IP assigned to eth0
|
||||
ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }'
|
||||
}
|
||||
|
||||
function set_hostname {
|
||||
logit "Set up hostname"
|
||||
if [ -n "${HOSTNAME}" ]; then
|
||||
echo $HOSTNAME > /etc/hostname
|
||||
echo $IPADDR $FQDN $HOSTNAME >> /etc/hosts
|
||||
else
|
||||
system_primary_ip > /etc/hostname
|
||||
echo "$(system_primary_ip) localhost" >> /etc/hosts
|
||||
fi
|
||||
|
||||
IPADDR=$(/sbin/ifconfig eth0 | awk '/inet / { print $2 }' | sed 's/addr://')
|
||||
hostname -F /etc/hostname
|
||||
}
|
||||
|
||||
function postfix_install_loopback_only {
|
||||
logit "Installing and configuring Postfix"
|
||||
# Installs postfix and configure to listen only on the local interface. Also
|
||||
# allows for local mail delivery
|
||||
|
||||
echo "postfix postfix/destinations string localhost.localdomain, localhost" | debconf-set-selections
|
||||
echo "postfix postfix/mailname string localhost" | debconf-set-selections
|
||||
echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections
|
||||
echo "postfix postfix/myhostname string localhost" | debconf-set-selections
|
||||
sudo apt-get install -qq -y postfix > /dev/null 2>&1
|
||||
/usr/sbin/postconf -e "inet_interfaces = loopback-only"
|
||||
#/usr/sbin/postconf -e "local_transport = error:local delivery is disabled"
|
||||
|
||||
touch /tmp/restart-postfix
|
||||
}
|
||||
|
||||
function notify_install_via_email {
|
||||
if [ -n "${NOTIFY_EMAIL}" ]; then
|
||||
logit "Sending notification email to ${NOTIFY_EMAIL}"
|
||||
/usr/sbin/sendmail "${NOTIFY_EMAIL}" <<EOD
|
||||
To: ${NOTIFY_EMAIL}
|
||||
Subject: Dokku installation is complete
|
||||
From: Dokku StackScript <no-reply@${HOSTNAME}>
|
||||
|
||||
Your Dokku installation is complete and now ready to be configured: http://$(system_primary_ip) . Please visit this url to complete the setup of your Dokku instance.
|
||||
|
||||
Enjoy using Dokku!
|
||||
EOD
|
||||
fi
|
||||
}
|
||||
|
||||
function notify_restart_via_email {
|
||||
if [ -n "${NOTIFY_EMAIL}" ]; then
|
||||
logit "Sending notification email to ${NOTIFY_EMAIL} of required restart"
|
||||
/usr/sbin/sendmail "${NOTIFY_EMAIL}" <<EOD
|
||||
To: ${NOTIFY_EMAIL}
|
||||
Subject: Dokku Linode instance must be restarted
|
||||
From: Dokku StackScript <no-reply@${HOSTNAME}>
|
||||
|
||||
The following linode instance must be restarted:
|
||||
|
||||
${LINODE_LISHUSERNAME}
|
||||
|
||||
Before restarting, please go to this url:
|
||||
|
||||
https://manager.linode.com/linodes/dashboard/${LINODE_LISHUSERNAME}
|
||||
|
||||
Then click "Edit" next to the selected configuration profile and make the following changes:
|
||||
|
||||
- Change the "Kernel" option to the current "pv-grub" release
|
||||
- Set the "Xenify Distro" option to "no"
|
||||
|
||||
Then save your changes. Next, reboot the instance from the Linode Dashboard. You'll receive an email once the instance is available to continue the dokku installation.
|
||||
EOD
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_linode {
|
||||
logit "Installing via linode"
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y linux-virtual
|
||||
DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y grub2 grub-pc
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y grub
|
||||
mkdir -p /boot/grub
|
||||
update-grub -y
|
||||
sed -i 's/kopt=root=UUID=.* ro/kopt=root=\/dev\/xvda console=hvc0 ro quiet/g' /boot/grub/menu.lst
|
||||
sed -i 's/# groot=(hd0,0)/# groot=(hd0)/g' /boot/grub/menu.lst
|
||||
update-grub
|
||||
|
||||
cp /etc/rc.local /etc/rc.local-bak
|
||||
cat << "EOF" > /etc/rc.local
|
||||
#!/bin/sh -e
|
||||
sudo apt-get update >> /root/setup_linode.txt 2>&1
|
||||
sudo apt-get install -y linux-image-extra-"$(uname -r)" >> /root/setup_linode.txt 2>&1
|
||||
modprobe aufs >> /root/setup_linode.txt 2>&1
|
||||
|
||||
sudo apt-get install -y apparmor cgroup-lite >> /root/setup_linode.txt 2>&1
|
||||
|
||||
sudo apt-get install -y dokku >> /root/setup_linode.txt 2>&1
|
||||
|
||||
# Clean up this script so it only runs once
|
||||
rm -f /etc/rc.local
|
||||
mv /etc/rc.local-bak /etc/rc.local
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x /etc/rc.local
|
||||
}
|
||||
|
||||
function install_prerequisites {
|
||||
sudo apt-get install -qq -y curl > /dev/null 2>&1
|
||||
|
||||
logit "Installing docker gpg key"
|
||||
curl -sSL https://get.docker.com/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
logit "Installing dokku gpg key"
|
||||
curl -sSL https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
logit "Running apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
|
||||
logit "Installing pre-requisites"
|
||||
sudo apt-get install -qq -y apt-transport-https > /dev/null 2>&1
|
||||
|
||||
logit "Setting up apt repositories"
|
||||
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
logit "Running apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
}
|
||||
|
||||
function install_dokku {
|
||||
logit "Installing pre-requisites"
|
||||
sudo apt-get install -qq -y linux-image-extra-"$(uname -r)" > /dev/null 2>&1
|
||||
|
||||
logit "Installing dokku"
|
||||
sudo apt-get install -qq -y dokku > /dev/null 2>&1
|
||||
|
||||
logit "Done!"
|
||||
}
|
||||
|
||||
exec &> /root/stackscript.log
|
||||
|
||||
set_ssh_key
|
||||
set_passwordless_ssh
|
||||
postfix_install_loopback_only
|
||||
set_hostname
|
||||
install_prerequisites
|
||||
|
||||
if [ -n "$LINODE_ID" ]; then
|
||||
setup_linode
|
||||
notify_restart_via_email
|
||||
else
|
||||
install_dokku
|
||||
notify_install_via_email
|
||||
fi
|
||||
165
deb.mk
Normal file
165
deb.mk
Normal file
@@ -0,0 +1,165 @@
|
||||
BUILDSTEP_DESCRIPTION = 'Buildstep uses Docker and Buildpacks to build applications like Heroku'
|
||||
BUILDSTEP_REPO_NAME ?= progrium/buildstep
|
||||
BUILDSTEP_VERSION ?= 0.0.1
|
||||
BUILDSTEP_ARCHITECTURE = amd64
|
||||
BUILDSTEP_PACKAGE_NAME = buildstep_$(BUILDSTEP_VERSION)_$(BUILDSTEP_ARCHITECTURE).deb
|
||||
|
||||
DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash'
|
||||
DOKKU_REPO_NAME ?= progrium/dokku
|
||||
DOKKU_ARCHITECTURE = amd64
|
||||
|
||||
PLUGINHOOK_DESCRIPTION = 'Simple dispatcher and protocol for shell-based plugins, an improvement to hook scripts'
|
||||
PLUGINHOOK_REPO_NAME ?= progrium/pluginhook
|
||||
PLUGINHOOK_VERSION ?= 0.0.1
|
||||
PLUGINHOOK_ARCHITECTURE = amd64
|
||||
PLUGINHOOK_PACKAGE_NAME = pluginhook_$(PLUGINHOOK_VERSION)_$(PLUGINHOOK_ARCHITECTURE).deb
|
||||
|
||||
SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app'
|
||||
SSHCOMMAND_REPO_NAME ?= progrium/sshcommand
|
||||
SSHCOMMAND_VERSION ?= 0.0.1
|
||||
SSHCOMMAND_ARCHITECTURE = amd64
|
||||
SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb
|
||||
|
||||
GEM_ARCHITECTURE = amd64
|
||||
|
||||
GOROOT = /usr/lib/go
|
||||
GOBIN = /usr/bin/go
|
||||
GOPATH = /home/vagrant/gocode
|
||||
|
||||
.PHONY: install-from-deb deb-all deb-buildstep deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand
|
||||
|
||||
install-from-deb:
|
||||
echo "--> Initial apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -y apt-transport-https curl
|
||||
|
||||
echo "--> Installing docker gpg key"
|
||||
curl -sSL https://get.docker.com/gpg | apt-key add -
|
||||
|
||||
echo "--> Installing dokku gpg key"
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
|
||||
echo "--> Setting up apt repositories"
|
||||
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
echo "--> Running apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
|
||||
echo "--> Installing pre-requisites"
|
||||
sudo apt-get install -y linux-image-extra-`uname -r`
|
||||
|
||||
echo "--> Installing dokku"
|
||||
sudo apt-get install -y dokku
|
||||
|
||||
echo "--> Done!"
|
||||
|
||||
deb-all: deb-buildstep deb-dokku deb-gems deb-pluginhook deb-sshcommand
|
||||
mv /tmp/*.deb .
|
||||
echo "Done"
|
||||
|
||||
deb-setup:
|
||||
echo "-> Updating deb repository and installing build requirements"
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -qq -y gcc git ruby1.9.1-dev 2>&1 > /dev/null
|
||||
command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
|
||||
ssh -o StrictHostKeyChecking=no git@github.com || true
|
||||
|
||||
deb-buildstep: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build $(BUILDSTEP_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
echo "-> Creating deb files"
|
||||
echo "#!/usr/bin/env bash" >> /tmp/tmp/post-install
|
||||
echo "sleep 5" >> /tmp/tmp/post-install
|
||||
echo "count=\`sudo docker images | grep progrium/buildstep | wc -l\`" >> /tmp/tmp/post-install
|
||||
echo 'if [ "$$count" -ne 0 ]; then' >> /tmp/tmp/post-install
|
||||
echo " echo 'Removing old buildstep image'" >> /tmp/tmp/post-install
|
||||
echo " sudo docker rmi progrium/buildstep" >> /tmp/tmp/post-install
|
||||
echo "fi" >> /tmp/tmp/post-install
|
||||
echo "echo 'Importing buildstep into docker (around 5 minutes)'" >> /tmp/tmp/post-install
|
||||
echo "sudo docker build -t progrium/buildstep /var/lib/buildstep 1> /dev/null" >> /tmp/tmp/post-install
|
||||
|
||||
echo "-> Cloning repository"
|
||||
git clone -q "git@github.com:$(BUILDSTEP_REPO_NAME).git" /tmp/tmp/buildstep > /dev/null
|
||||
rm -rf /tmp/tmp/buildstep/.git /tmp/tmp/buildstep/.gitignore
|
||||
|
||||
echo "-> Copying files into place"
|
||||
mkdir -p "/tmp/build/var/lib"
|
||||
cp -rf /tmp/tmp/buildstep /tmp/build/var/lib/buildstep
|
||||
|
||||
echo "-> Creating $(BUILDSTEP_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n buildstep -v $(BUILDSTEP_VERSION) -a $(BUILDSTEP_ARCHITECTURE) -p $(BUILDSTEP_PACKAGE_NAME) --deb-pre-depends 'lxc-docker >= 1.4.0' --after-install /tmp/tmp/post-install --url "https://github.com/$(BUILDSTEP_REPO_NAME)" --description $(BUILDSTEP_DESCRIPTION) --license 'MIT License' .
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-dokku: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build dokku_*_$(DOKKU_ARCHITECTURE).deb
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
cp -r debian /tmp/build/DEBIAN
|
||||
mkdir -p /tmp/build/usr/local/bin
|
||||
mkdir -p /tmp/build/var/lib/dokku
|
||||
mkdir -p /tmp/build/usr/local/share/man/man1
|
||||
mkdir -p /tmp/build/usr/local/share/dokku/contrib
|
||||
|
||||
cp dokku /tmp/build/usr/local/bin
|
||||
cp -r plugins /tmp/build/var/lib/dokku
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/plugins/$$plugin/.core; done
|
||||
$(MAKE) help2man
|
||||
$(MAKE) addman
|
||||
cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/local/share/man/man1/dokku.1
|
||||
cp contrib/dokku-installer.rb /tmp/build/usr/local/share/dokku/contrib
|
||||
git describe --tags > /tmp/build/var/lib/dokku/VERSION
|
||||
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
|
||||
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
|
||||
sed -i "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control
|
||||
dpkg-deb --build /tmp/build "/vagrant/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb"
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-gems: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build rubygem-*.deb
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp rack -v 1.5.2 > /dev/null
|
||||
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp rack-protection -v 1.5.3 > /dev/null
|
||||
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp sinatra -v 1.4.5 > /dev/null
|
||||
gem install --quiet --no-verbose --no-ri --no-rdoc --install-dir /tmp/tmp tilt -v 1.4.1 > /dev/null
|
||||
|
||||
find /tmp/tmp/cache -name '*.gem' | xargs -rn1 fpm -d ruby -d ruby --prefix /var/lib/gems/1.9.1 -s gem -t deb -a $(GEM_ARCHITECTURE)
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-pluginhook: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build $(PLUGINHOOK_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
echo "-> Cloning repository"
|
||||
git clone -q "git@github.com:$(PLUGINHOOK_REPO_NAME).git" /tmp/tmp/pluginhook > /dev/null
|
||||
rm -rf /tmp/tmp/pluginhook/.git /tmp/tmp/pluginhook/.gitignore
|
||||
|
||||
echo "-> Copying files into place"
|
||||
mkdir -p /tmp/build/usr/local/bin $(GOPATH)
|
||||
sudo apt-get install -qq -y git golang mercurial 2>&1 > /dev/null
|
||||
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && go get "code.google.com/p/go.crypto/ssh/terminal"
|
||||
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/pluginhook && go build -o pluginhook
|
||||
mv /tmp/tmp/pluginhook/pluginhook /tmp/build/usr/local/bin/pluginhook
|
||||
|
||||
echo "-> Creating $(PLUGINHOOK_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n pluginhook -v $(PLUGINHOOK_VERSION) -a $(PLUGINHOOK_ARCHITECTURE) -p $(PLUGINHOOK_PACKAGE_NAME) --url "https://github.com/$(PLUGINHOOK_REPO_NAME)" --description $(PLUGINHOOK_DESCRIPTION) --license 'MIT License' .
|
||||
mv *.deb /tmp
|
||||
|
||||
deb-sshcommand: deb-setup
|
||||
rm -rf /tmp/tmp /tmp/build $(SSHCOMMAND_PACKAGE_NAME)
|
||||
mkdir -p /tmp/tmp /tmp/build
|
||||
|
||||
echo "-> Cloning repository"
|
||||
git clone -q "git@github.com:$(SSHCOMMAND_REPO_NAME).git" /tmp/tmp/sshcommand > /dev/null
|
||||
rm -rf /tmp/tmp/sshcommand/.git /tmp/tmp/sshcommand/.gitignore
|
||||
|
||||
echo "-> Copying files into place"
|
||||
mkdir -p "/tmp/build/usr/local/bin"
|
||||
cp /tmp/tmp/sshcommand/sshcommand /tmp/build/usr/local/bin/sshcommand
|
||||
chmod +x /tmp/build/usr/local/bin/sshcommand
|
||||
|
||||
echo "-> Creating $(SSHCOMMAND_PACKAGE_NAME)"
|
||||
sudo fpm -t deb -s dir -C /tmp/build -n sshcommand -v $(SSHCOMMAND_VERSION) -a $(SSHCOMMAND_ARCHITECTURE) -p $(SSHCOMMAND_PACKAGE_NAME) --url "https://github.com/$(SSHCOMMAND_REPO_NAME)" --description $(SSHCOMMAND_DESCRIPTION) --license 'MIT License' .
|
||||
mv *.deb /tmp
|
||||
21
debian/config
vendored
Executable file
21
debian/config
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
readonly ACTION="${1:-configure}"
|
||||
readonly VERSION="${2:-dev}"
|
||||
|
||||
db_input "high" "dokku/web_config" || true
|
||||
db_go || true
|
||||
|
||||
db_get "dokku/web_config"
|
||||
if [ $RET = "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
db_input "high" "dokku/hostname" || true
|
||||
db_input "high" "dokku/vhost_enable" || true
|
||||
if [ "$ACTION" != "reconfigure" ]; then
|
||||
db_input "high" "dokku/key_file" || true
|
||||
fi
|
||||
db_go || true
|
||||
10
debian/control
vendored
Normal file
10
debian/control
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
Package: dokku
|
||||
Version: 0.3.12
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: locales, git, make, curl, software-properties-common, lxc-docker (>= 1.4.0), gcc, python-software-properties, man-db, buildstep, sshcommand, pluginhook
|
||||
Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroup-lite
|
||||
Provides: dokku
|
||||
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
Description: Docker powered mini-Heroku in around 100 lines of Bash
|
||||
55
debian/postinst
vendored
Executable file
55
debian/postinst
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
|
||||
|
||||
case "$1" in
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
configure)
|
||||
mandb
|
||||
[ ! -x /usr/bin/docker.io ] || ln -sf /usr/bin/docker.io /usr/local/bin/docker
|
||||
modprobe aufs || echo "WARNING: Restart server to finish installing dokku!"
|
||||
sshcommand create dokku /usr/local/bin/dokku
|
||||
egrep -i "^docker" /etc/group || groupadd docker
|
||||
usermod -aG docker dokku
|
||||
dokku plugins-install
|
||||
rm -f /home/dokku/VERSION
|
||||
cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION
|
||||
|
||||
if [ -f /etc/init/dokku-installer.conf ] && service dokku-installer status 2> /dev/null | grep waiting; then
|
||||
sudo service dokku-installer start
|
||||
fi
|
||||
|
||||
db_get "dokku/web_config"
|
||||
if [ "$RET" = "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
db_get "dokku/vhost_enable"
|
||||
if [ "$RET" = "true" ]; then
|
||||
db_get "dokku/hostname"
|
||||
echo "$RET" > "${DOKKU_ROOT}/VHOST"
|
||||
else
|
||||
rm -f "${DOKKU_ROOT}/VHOST"
|
||||
fi
|
||||
|
||||
db_get "dokku/hostname"
|
||||
echo "$RET" > "${DOKKU_ROOT}/HOSTNAME"
|
||||
|
||||
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
|
||||
db_get "dokku/key_file"
|
||||
sshcommand acl-add dokku default < "$RET"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
57
debian/preinst
vendored
Executable file
57
debian/preinst
vendored
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
case "$1" in
|
||||
install)
|
||||
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
|
||||
db_get "dokku/key_file"
|
||||
if [ ! -f "$RET" ]; then
|
||||
echo "Error: keyfile '$RET' not found."
|
||||
echo " you can enter a new keyfile path when you restart the installation."
|
||||
db_reset "dokku/key_file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
db_get "dokku/web_config"
|
||||
if [ "$RET" = "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
INIT_CONF="/etc/init/dokku-installer.conf"
|
||||
NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf"
|
||||
|
||||
rm -f $INIT_CONF
|
||||
touch $INIT_CONF
|
||||
echo 'start on runlevel [2345]' >> $INIT_CONF
|
||||
echo 'exec /usr/local/share/dokku/contrib/dokku-installer.rb selfdestruct' >> $INIT_CONF
|
||||
|
||||
rm -f $NGINX_CONF
|
||||
touch $NGINX_CONF
|
||||
echo 'upstream dokku-installer { server 127.0.0.1:2000; }' >> $NGINX_CONF
|
||||
echo 'server {' >> $NGINX_CONF
|
||||
echo ' listen 80;' >> $NGINX_CONF
|
||||
echo ' location / {' >> $NGINX_CONF
|
||||
echo ' proxy_pass http://dokku-installer;' >> $NGINX_CONF
|
||||
echo ' }' >> $NGINX_CONF
|
||||
echo '}' >> $NGINX_CONF
|
||||
|
||||
rm -f /etc/nginx/sites-enabled/*
|
||||
service nginx reload
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
;;
|
||||
|
||||
abort-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "preinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
19
debian/templates
vendored
Normal file
19
debian/templates
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Template: dokku/web_config
|
||||
Description: Use the web-based config page?
|
||||
Type: boolean
|
||||
Default: true
|
||||
|
||||
Template: dokku/vhost_enable
|
||||
Description: Use vhost based deployments?
|
||||
Type: boolean
|
||||
Default: false
|
||||
|
||||
Template: dokku/hostname
|
||||
Description: Machine's hostname or IP
|
||||
Type: string
|
||||
Default: dokku.me
|
||||
|
||||
Template: dokku/key_file
|
||||
Description: Keyfile for initial user
|
||||
Type: string
|
||||
Default: /root/.ssh/id_rsa.pub
|
||||
59
docs/advanced-installation.md
Normal file
59
docs/advanced-installation.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Advanced installation
|
||||
|
||||
You can always install dokku straight from the latest - potentially unstable - master release via the following bash command:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
If you plan on developing dokku, the easiest way to install from your own repository is cloning the repository and calling the install script. Example:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/yourusername/dokku.git
|
||||
cd dokku
|
||||
sudo make install
|
||||
```
|
||||
|
||||
The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example:
|
||||
|
||||
```shell
|
||||
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
|
||||
```
|
||||
|
||||
## Bootstrap a server from your own repository
|
||||
|
||||
The bootstrap script allows the dokku repository URL to be overridden to bootstrap a host from your own clone of dokku using the `DOKKU_REPO` environment variable. Example:
|
||||
|
||||
```shell
|
||||
wget https://raw.github.com/progrium/dokku/master/bootstrap.sh
|
||||
chmod +x bootstrap.sh
|
||||
sudo DOKKU_REPO=https://github.com/yourusername/dokku.git DOKKU_BRANCH=master ./bootstrap.sh
|
||||
```
|
||||
|
||||
## Custom buildstep build
|
||||
|
||||
Dokku ships with a pre-built version of version of the [buildstep](https://github.com/progrium/buildstep) component by default. If you want to build your own version you can specify that with an env variable.
|
||||
|
||||
```shell
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
cd dokku
|
||||
sudo BUILD_STACK=true STACK_URL=https://github.com/progrium/buildstep.git make install
|
||||
```
|
||||
|
||||
## Configuring
|
||||
|
||||
Once dokku is installed, if you are not using the web-installer, you'll want to configure a the virtualhost setup as well as the push user. If you do not, your installation will be considered incomplete and you will not be able to deploy applications.
|
||||
|
||||
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).
|
||||
|
||||
You'll have to add a public key associated with a username by doing something like this from your local machine:
|
||||
|
||||
$ cat ~/.ssh/id_rsa.pub | ssh dokku.me "sudo sshcommand acl-add dokku $USER"
|
||||
|
||||
If you are using the vagrant installation, you can use the following command to add your public key to dokku:
|
||||
|
||||
$ cat ~/.ssh/id_rsa.pub | make vagrant-acl-add
|
||||
|
||||
That's it!
|
||||
@@ -28,6 +28,24 @@ Dokku only supports deploying from its master branch, so if you'd like to deploy
|
||||
Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)!
|
||||
Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root.
|
||||
|
||||
## Deploying to server over SSH
|
||||
|
||||
Pushing to the dokku remote may prompt you to input a password for the dokku user. It's preferable, however, to use key-based authentication, and you can add your public key to the dokku user's authorized_keys file with:
|
||||
|
||||
```
|
||||
cat ~/.ssh/id_rsa.pub | ssh [sudouser]@[yourdomain].com "sudo sshcommand acl-add dokku [description]"
|
||||
```
|
||||
|
||||
## Deploying with private git submodules
|
||||
|
||||
Dokku uses git locally (i.e. not a docker image) to build its own copy of your app repo, including submodules. This is done as the `dokku` user. Therefore, in order to deploy private git submodules, you'll need to drop your deploy key in `~dokku/.ssh` and potentially add github.com (or your VCS host key) into `~dokku/.ssh/known_hosts`. A decent test like this should help confirm you've done it correctly.
|
||||
|
||||
```
|
||||
su - dokku
|
||||
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
|
||||
ssh -T git@github.com
|
||||
```
|
||||
|
||||
## Specifying a custom buildpack
|
||||
|
||||
If buildpack detection isn't working well for you or you want to specify a custom buildpack for one repository you can create & commit a file in the root of your git repository named `.env` containing `export BUILDPACK_URL=<repository>` before pushing. This will tell buildstep to fetch the specified buildpack and use it instead of relying on the built-in buildpacks & their detection methods.
|
||||
@@ -81,10 +99,34 @@ This is in particular useful, then you want to deploy to root domain, as
|
||||
remote: -----> Application deployed:
|
||||
remote: http://dokku.me
|
||||
|
||||
# Zero downtime deploy
|
||||
|
||||
Following a deploy Dokku's default behaviour is to switch new traffic over to the new container immediately.
|
||||
|
||||
This can be problematic for applications that take some time to boot up and can lead to `502 Bad Gateway` errors.
|
||||
|
||||
Dokku provides a way to run a set of checks against the new container, and only switch traffic over if all checks complete successfully.
|
||||
|
||||
To specify checks, add a `CHECKS` file to the root of your project directory. This is a text file with one line per check. Empty lines and lines starting with `#` are ignored.
|
||||
|
||||
A check is a relative URL and may be followed by expected content from the page, for example:
|
||||
|
||||
```
|
||||
/about Our Amazing Team
|
||||
```
|
||||
|
||||
Dokku will wait `DOKKU_CHECKS_WAIT` seconds (default: `5`) before running the checks to give server time to start. For shorter/longer wait, change the `DOKKU_CHECKS_WAIT` environment variable. This can be overridden in the CHECKS file by setting WAIT=nn.
|
||||
|
||||
Dokku will wait `DOKKU_WAIT_TO_RETIRE` seconds (default: `60`) before stopping the old container such that no existing connections to it are dropped.
|
||||
|
||||
Dokku will retry the checks DOKKU_CHECKS_ATTEMPTS times until the checks are successful or DOKKU_CHECKS_ATTEMPTS is exceeded. In the latter case, the deployment is considered failed. This can be overridden in the CHECKS file by setting ATTEMPTS=nn.
|
||||
|
||||
See [checks-examples.md](checks-examples.md) for examples and output.
|
||||
|
||||
# Removing a deployed app
|
||||
|
||||
SSH onto the server, then execute:
|
||||
|
||||
```shell
|
||||
dokku delete myapp
|
||||
dokku apps:destroy myapp
|
||||
```
|
||||
|
||||
203
docs/checks-examples.md
Normal file
203
docs/checks-examples.md
Normal file
@@ -0,0 +1,203 @@
|
||||
# Checks Examples
|
||||
|
||||
The CHECKS file may contain empty lines, comments (lines starting with #),
|
||||
settings (NAME=VALUE) and check instructions.
|
||||
|
||||
The format of a check instruction is a path, optionally followed by the
|
||||
expected content. For example:
|
||||
|
||||
/ My Amazing App
|
||||
/stylesheets/index.css .body
|
||||
/scripts/index.js $(function()
|
||||
/images/logo.png
|
||||
|
||||
To check an application that supports multiple hostnames, use relative URLs
|
||||
that include the hostname, for example:
|
||||
|
||||
//admin.example.com Admin Dashboard
|
||||
//static.example.com/logo.png
|
||||
|
||||
You can also specify the protocol to explicitly check HTTPS requests.
|
||||
|
||||
The default behavior is to wait for 5 seconds before running the first check,
|
||||
and timeout each check to 30 seconds.
|
||||
|
||||
By default, checks will be attempted 5 times. (Retried 4 times)
|
||||
|
||||
You can change these by setting WAIT, TIMEOUT and ATTEMPTS to different values, for
|
||||
example:
|
||||
|
||||
WAIT=30 # Wait 1/2 minute
|
||||
TIMEOUT=60 # Timeout after a minute
|
||||
ATTEMPTS=10 # attempt checks 10 times
|
||||
|
||||
# Example: Successful Rails Deployment
|
||||
In this example, a rails applicaiton is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful.
|
||||
ATTEMPTS is set to 6, but the third attempt succeeds.
|
||||
|
||||
## CHECKS file
|
||||
|
||||
````
|
||||
WAIT=5
|
||||
ATTEMPTS=6
|
||||
/check.txt simple_check
|
||||
````
|
||||
|
||||
> check.txt is a text file returning the string 'simple_check'
|
||||
|
||||
## Deploy Output
|
||||
|
||||
> Note: The output has been trimmed for brevity
|
||||
|
||||
````
|
||||
git push dokku master
|
||||
|
||||
-----> Cleaning up...
|
||||
-----> Building myapp from buildstep...
|
||||
-----> Adding BUILD_ENV to build environment...
|
||||
-----> Ruby app detected
|
||||
-----> Compiling Ruby/Rails
|
||||
-----> Using Ruby version: ruby-2.0.0
|
||||
|
||||
.....
|
||||
|
||||
-----> Discovering process types
|
||||
Procfile declares types -> web
|
||||
-----> Releasing myapp...
|
||||
-----> Deploying myapp...
|
||||
-----> Running pre-flight checks
|
||||
-----> Attempt 1/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/check.txt => "simple_check"
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
|
||||
! Check attempt 1/6 failed.
|
||||
-----> Attempt 2/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/check.txt => "simple_check"
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
|
||||
! Check attempt 2/6 failed.
|
||||
-----> Attempt 3/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/check.txt => "simple_check"
|
||||
-----> All checks successful!
|
||||
=====> myapp container output:
|
||||
=> Booting Thin
|
||||
=> Rails 4.2.0 application starting in production on http://0.0.0.0:5000
|
||||
=> Run `rails server -h` for more startup options
|
||||
=> Ctrl-C to shutdown server
|
||||
Thin web server (v1.6.3 codename Protein Powder)
|
||||
Maximum connections set to 1024
|
||||
Listening on 0.0.0.0:5000, CTRL+C to stop
|
||||
=====> end myapp container output
|
||||
-----> Running post-deploy
|
||||
-----> Configuring myapp.dokku.example.com...
|
||||
-----> Creating http nginx.conf
|
||||
-----> Running nginx-pre-reload
|
||||
Reloading nginx
|
||||
-----> Shutting down old container in 60 seconds
|
||||
=====> Application deployed:
|
||||
http://myapp.dokku.example.com
|
||||
````
|
||||
|
||||
# Example: Failing Rails Deployment
|
||||
In this example, a Rails application fails to deploy. The reason for the failure is that the postgres database connection fails. The initial checks will fail while we wait for the server to start up, just like in the above example. However, once the server does start accepting connections, we will see an error 500 due to the postgres database connection failure.
|
||||
|
||||
Once the attempts have been exceeded, the deployment fails and we see the container output, which shows the Postgres connection errors.
|
||||
|
||||
## CHECKS file
|
||||
|
||||
````
|
||||
WAIT=5
|
||||
ATTEMPTS=6
|
||||
/
|
||||
````
|
||||
|
||||
> The check to the root url '/' would normally access the database.
|
||||
|
||||
## Deploy Output
|
||||
|
||||
> Note: The output has been trimmed for brevity
|
||||
|
||||
````
|
||||
git push dokku master
|
||||
|
||||
-----> Cleaning up...
|
||||
-----> Building myapp from buildstep...
|
||||
-----> Adding BUILD_ENV to build environment...
|
||||
-----> Ruby app detected
|
||||
-----> Compiling Ruby/Rails
|
||||
-----> Using Ruby version: ruby-2.0.0
|
||||
|
||||
.....
|
||||
|
||||
Discovering process types
|
||||
Procfile declares types -> web
|
||||
Releasing myapp...
|
||||
Deploying myapp...
|
||||
Running pre-flight checks
|
||||
-----> Attempt 1/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
|
||||
! Check attempt 1/6 failed.
|
||||
-----> Attempt 2/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
|
||||
! Check attempt 2/6 failed.
|
||||
-----> Attempt 3/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
! Check attempt 3/6 failed.
|
||||
-----> Attempt 4/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
! Check attempt 4/6 failed.
|
||||
-----> Attempt 5/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
! Check attempt 5/6 failed.
|
||||
-----> Attempt 6/6 Waiting for 5 seconds ...
|
||||
CHECKS expected result:
|
||||
http://localhost/ => ""
|
||||
!
|
||||
curl: (22) The requested URL returned error: 500 Internal Server Error
|
||||
Could not start due to 1 failed checks.
|
||||
! Check attempt 6/6 failed.
|
||||
=====> myapp container output:
|
||||
=> Booting Thin
|
||||
=> Rails 4.2.0 application starting in production on http://0.0.0.0:5000
|
||||
=> Run `rails server -h` for more startup options
|
||||
=> Ctrl-C to shutdown server
|
||||
Thin web server (v1.6.3 codename Protein Powder)
|
||||
Maximum connections set to 1024
|
||||
Listening on 0.0.0.0:5000, CTRL+C to stop
|
||||
Started GET "/" for 172.17.42.1 at 2015-03-26 21:36:47 +0000
|
||||
Is the server running on host "172.17.42.1" and accepting
|
||||
TCP/IP connections on port 5431?
|
||||
PG::ConnectionBad (could not connect to server: Connection refused
|
||||
Is the server running on host "172.17.42.1" and accepting
|
||||
TCP/IP connections on port 5431?
|
||||
):
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
|
||||
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection
|
||||
=====> end myapp container output
|
||||
/usr/local/bin/dokku: line 49: 23409 Killed dokku deploy "$APP"
|
||||
To dokku@dokku.example.com:myapp
|
||||
! [remote rejected] dokku -> master (pre-receive hook declined)
|
||||
error: failed to push some refs to 'dokku@dokku.example.com:myapp'
|
||||
````
|
||||
81
docs/community/clients.md
Normal file
81
docs/community/clients.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Clients
|
||||
|
||||
Given the constraints, running dokku commands remotely via SSH is fine. For certain configurations, the extra complication of manually invoking ssh can be a burden.
|
||||
|
||||
While dokku does not yet have an official client, there are a multitude of ways in which you can interact with your dokku installation. The easiest is to use the **bash** client, though you may wish to use another.
|
||||
|
||||
## (bash) `dokku_client.sh`
|
||||
|
||||
Of all methods, this is the *most* official method of interacting with your dokku installation. It is a bash script that interacts with a remote dokku installation via ssh. It is available in `contrib/dokku_client.sh` in the root of the dokku repository.
|
||||
|
||||
To install, simply clone the dokku repository down and add the `dokku` alias pointing at the script:
|
||||
|
||||
```shell
|
||||
git clone git@github.com:progrium/dokku.git ~/.dokku
|
||||
|
||||
# add the following to either your
|
||||
# .bashrc, .bash_profile, or .profile file
|
||||
alias dokku='$HOME/.dokku/contrib/dokku_client.sh'
|
||||
```
|
||||
|
||||
Configure the `DOKKU_HOST` environment variable or run `dokku` from a repository with a git remote named dokku pointed at your dokku host in order to use the script as normal.
|
||||
|
||||
## (nodejs) dokku-toolbelt
|
||||
|
||||
Dokku-toolbelt is a node-based cli wrapper that proxies requests to the dokku command running on remote hosts. You can install it via the following shell command (assuming you have nodejs and npm installed):
|
||||
|
||||
```shell
|
||||
npm install -g dokku-toolbelt
|
||||
```
|
||||
|
||||
See [documentation here](https://www.npmjs.com/package/dokku-toolbelt) for more information.
|
||||
|
||||
## (python) dokku-client
|
||||
|
||||
dokku-client is an extensible python-based cli wrapper for remote dokku hosts. You can install it via the following shell command (assuming you have python and pip installed):
|
||||
|
||||
```shell
|
||||
pip install dokku-client
|
||||
```
|
||||
|
||||
See [documentation here](https://github.com/adamcharnock/dokku-client) for more information.
|
||||
|
||||
## (ruby) Dokku CLI
|
||||
|
||||
Dokku CLI is a rubygem that acts as a client for your dokku installation. You can install it via the following shell command (assuming you have ruby and rubygems installed):
|
||||
|
||||
```shell
|
||||
gem install dokku-cli
|
||||
```
|
||||
|
||||
See [documentation here](https://github.com/SebastianSzturo/dokku-cli) for more information.
|
||||
|
||||
## (ruby) DokkuClient
|
||||
|
||||
DokkuClient is another rubygem that acts as a client for your dokku installation with built-in support for certain external plugins. You can install it via the following shell command (assuming you have ruby and rubygems installed):
|
||||
|
||||
```shell
|
||||
gem install dokku_client
|
||||
```
|
||||
|
||||
See [documentation here](https://github.com/netguru/dokku_client) for more information.
|
||||
|
||||
## (ruby) Dokkufy
|
||||
|
||||
Dokkufy is a rubygem that handles automation of certain tasks, such as dokku setup, plugin installation, etc. You can install it via the following shell command (assuming you have ruby and rubygems installed):
|
||||
|
||||
```shell
|
||||
gem install dokkufy
|
||||
```
|
||||
|
||||
See [documentation here](https://github.com/cbetta/dokkufy) for more information.
|
||||
|
||||
## (ruby) Dockland
|
||||
|
||||
Dockland is a rubygem that acts as a client for your dokku installation. You can install it via the following shell command (assuming you have ruby and rubygems installed):
|
||||
|
||||
```shell
|
||||
gem install dockland
|
||||
```
|
||||
|
||||
See [documentation here](https://github.com/uetchy/dockland) for more information.
|
||||
@@ -13,4 +13,4 @@ config:unset <app> KEY1 [KEY2 ...] - unset one or more config vars
|
||||
|
||||
The variables are available both at at run time and during the application build/compilation step. You no longer need a `user-env` plugin as Dokku handles this functionality in a way equivalent to how Heroku handles it.
|
||||
|
||||
> Note: Global `BUILD_ENV` files are currently migrated into a global `ENV` file. Configuring your global `ENV` file is manual, and should be considered potentially dangerous as configuration applies to all applications.
|
||||
> Note: Global `BUILD_ENV` files are currently migrated into a global `ENV` file and sourced before app-specific variables. This means that app-specific variables will take precedence over global variables. Configuring your global `ENV` file is manual, and should be considered potentially dangerous as configuration applies to all applications.
|
||||
|
||||
81
docs/development/plugin-creation.md
Normal file
81
docs/development/plugin-creation.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Plugin Creation
|
||||
|
||||
If you create your own plugin:
|
||||
|
||||
1. Take a look at the plugins shipped with dokku and hack away!
|
||||
2. Upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
|
||||
3. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it.
|
||||
4. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
|
||||
|
||||
### Sample plugin
|
||||
|
||||
The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
case "$1" in
|
||||
hello)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2";
|
||||
|
||||
echo "Hello $APP"
|
||||
;;
|
||||
|
||||
hello:world)
|
||||
echo "Hello world"
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
hello <app> Says "Hello <app>"
|
||||
hello:world Says "Hello world"
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
```
|
||||
|
||||
A few notes:
|
||||
|
||||
- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin.
|
||||
- If your command requires that an application exists, ensure you check for it's existence in the manner prescribed above.
|
||||
- A `help` command is required, though it is allowed to be empty.
|
||||
- Commands *should* be namespaced.
|
||||
- As of 0.3.3, a catch-all should be implemented which exits with a `DOKKU_NOT_IMPLEMENTED_EXIT` code. This allows dokku to output a `command not found` message.
|
||||
- Be sure you want the "set -eo pipefail" option. Look at the following example :
|
||||
|
||||
```shell
|
||||
IMAGE=$(docker images | grep "user/repo" | awk '{print $3}')
|
||||
if [[ -z $IMAGE ]]; then
|
||||
echo "user/repo image not found... Did you run 'dokku plugins-install'?"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
In the case where the "user/repo" is not installed, dokku exits just before the awk command,
|
||||
you will never see the message printed with echo. You just want "set -e" in this case.
|
||||
|
||||
Here is the documentation of the 'set -eo pipefail' option:
|
||||
```
|
||||
help set
|
||||
Options:
|
||||
-e Exit immediately if a command exits with a non-zero status.
|
||||
-o option-name
|
||||
pipefail the return value of a pipeline is the status of
|
||||
the last command to exit with a non-zero status,
|
||||
or zero if no command exited with a non-zero status
|
||||
```
|
||||
- As some plugins require access to set app config settings and do not want/require the default Heroku-style behavior of a restart, we have the following "internal" commands that provide this functionality :
|
||||
|
||||
```shell
|
||||
dokku config:set-norestart APP KEY1=VALUE1 [KEY2=VALUE2 ...]
|
||||
dokku config:unset-norestart APP KEY1 [KEY2 ...]
|
||||
```
|
||||
591
docs/development/pluginhooks.md
Normal file
591
docs/development/pluginhooks.md
Normal file
@@ -0,0 +1,591 @@
|
||||
# Pluginhooks
|
||||
|
||||
[Pluginhooks](https://github.com/progrium/pluginhook) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration.
|
||||
|
||||
Pluginhooks are simply scripts that are executed by the system. You can use any language you want, so long as the script:
|
||||
|
||||
- Is executable
|
||||
- Has the proper language requirements installed
|
||||
|
||||
For instance, if you wanted to write a pluginhook in PHP, you would need to have `php` installed and available on the CLI prior to pluginhook invocation.
|
||||
|
||||
The following is an example for the `nginx-hostname` pluginhook. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin, it would be invoked by dokku during the normal app deployment process:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; SUBDOMAIN="$2"; VHOST="$3"
|
||||
|
||||
NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
|
||||
echo "$NEW_SUBDOMAIN.$VHOST"
|
||||
```
|
||||
|
||||
## Available Pluginhooks
|
||||
|
||||
There are a number of plugin-related pluginhooks. These can be optionally implemented by plugins and allow integration into the standard dokku plugin setup/backup/teardown process.
|
||||
|
||||
The following pluginhooks describe those available to a dokku installation. As well, there is an example for each pluginhook that you can use as templates for your own plugin development.
|
||||
|
||||
> The example pluginhook code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples.
|
||||
|
||||
### `install`
|
||||
|
||||
- Description: Used to setup any files/configuration for a plugin.
|
||||
- Invoked by: `dokku plugins-install`.
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Sets the hostname of the dokku server
|
||||
# based on the output of `hostname -f`
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
hostname -f > $DOKKU_ROOT/HOSTNAME
|
||||
fi
|
||||
```
|
||||
|
||||
### `dependencies`
|
||||
|
||||
- Description: Used to install system-level dependencies. Invoked by `plugins-install-dependencies`.
|
||||
- Invoked by: `dokku plugins-install-dependencies`
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs nginx for the current plugin
|
||||
# Supports both opensuse and ubuntu
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get install --force-yes -qq -y nginx
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
zypper -q in -y nginx
|
||||
;;
|
||||
esac
|
||||
```
|
||||
|
||||
### `update`
|
||||
|
||||
- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates.
|
||||
- Invoked by: `dokku plugins-update`.
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Update the buildstep image from git source
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
cd /root/dokku
|
||||
sudo BUILD_STACK=true make install
|
||||
```
|
||||
|
||||
### `commands help`
|
||||
|
||||
- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this pluginhook. This must be implemented inside the `commands` pluginhook file.
|
||||
- Invoked by: `dokku help`
|
||||
- Arguments: None
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Outputs help for the derp plugin
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | derp:help)
|
||||
cat && cat<<EOF
|
||||
derp:herp Herps the derp
|
||||
derp:serp [file] Shows the file's serp
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
```
|
||||
|
||||
### `backup-export`
|
||||
|
||||
- Description: Used to backup files for a given plugin. If your plugin writes files to disk, this pluginhook should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz.
|
||||
- Invoked by: `dokku backup:export`
|
||||
- Arguments: `$VERSION $DOKKU_ROOT`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Echos out the location of every `REDIRECT` file
|
||||
# that are used by the apps
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
DOKKU_ROOT="$2"
|
||||
|
||||
cat; for i in $DOKKU_ROOT/*/REDIRECT; do echo $i; done
|
||||
```
|
||||
|
||||
### `backup-check`
|
||||
|
||||
- Description: Checks that a backup being imported passes sanity checks.
|
||||
- Invoked by: `dokku backup:import`
|
||||
- Arguments: `$VERSION $BACKUP_ROOT $DOKKU_ROOT $BACKUP_TMP_DIR/.dokku_backup_apps`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `backup-import`
|
||||
|
||||
- Description: Allows a plugin to import specific files from a `$BACKUP_ROOT` to the `DOKKU_ROOT` directory.
|
||||
- Invoked by: `dokku backup:import`
|
||||
- Arguments: `$VERSION $BACKUP_ROOT $DOKKU_ROOT $BACKUP_TMP_DIR/.dokku_backup_apps`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Copies all redirect files from the backup
|
||||
# into the correct app path.
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
BACKUP_ROOT="$2"
|
||||
DOKKU_ROOT="$3"
|
||||
|
||||
cd $BACKUP_ROOT
|
||||
for file in */REDIRECT; do
|
||||
cp $file "$DOKKU_ROOT/$file"
|
||||
done
|
||||
```
|
||||
|
||||
### `pre-build-buildstep`
|
||||
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using buildstep.
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-build-buildstep`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using buildstep.
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before the build image is created for a given app. For instance, this can be useful to add env vars to your container. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-build-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands after the build image is create for a given app. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `pre-release-buildstep`
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildstep.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs the graphicsmagick package into the container
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
dokku_log_info1" Installing GraphicsMagick..."
|
||||
|
||||
CMD="cat > gm && \
|
||||
dpkg -s graphicsmagick > /dev/null 2>&1 || \
|
||||
(apt-get update && apt-get install -y graphicsmagick && apt-get clean)"
|
||||
|
||||
ID=$(docker run -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
||||
test $(docker wait $ID) -eq 0
|
||||
docker commit $ID $IMAGE > /dev/null
|
||||
```
|
||||
|
||||
### `post-release-buildstep`
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildstep.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Installs a package specified by the `CONTAINER_PACKAGE` env var
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
dokku_log_info1" Installing $CONTAINER_PACKAGE..."
|
||||
|
||||
CMD="cat > gm && \
|
||||
dpkg -s CONTAINER_PACKAGE > /dev/null 2>&1 || \
|
||||
(apt-get update && apt-get install -y CONTAINER_PACKAGE && apt-get clean)"
|
||||
|
||||
ID=$(docker run -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
||||
test $(docker wait $ID) -eq 0
|
||||
docker commit $ID $IMAGE > /dev/null
|
||||
```
|
||||
|
||||
### `pre-release-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `post-release-dockerfile`
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `check-deploy`
|
||||
|
||||
- Description: Allows you to run checks on a deploy before dokku allows the container to handle requests.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$CONTAINER_ID $APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Disables deploys of containers based on whether the
|
||||
# `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
DOKKU_DISABLE_DEPLOY="${DOKKU_DISABLE_DEPLOY:-false}"
|
||||
|
||||
if [[ "$DOKKU_DISABLE_DEPLOY" = "true" ]]; then
|
||||
echo -e "\033[31m\033[1mDeploys disabled, sorry.\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
### `pre-deploy`
|
||||
|
||||
- Description: Allows the running of code before the container's process is started.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs gulp in our container
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
APP="$1"
|
||||
IMAGE="dokku/$APP"
|
||||
|
||||
dokku_log_info1 "Running gulp"
|
||||
id=$(docker run -d $IMAGE /bin/bash -c "cd /app && gulp default")
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
dokku_log_info1 "Building UI Complete"
|
||||
```
|
||||
|
||||
### `post-deploy`
|
||||
|
||||
- Description: Allows running of commands after a deploy has completed. Dokku core currently uses this to switch traffic on nginx.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Notify an external service that a successful deploy has occurred.
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
curl "http://httpstat.us/200"
|
||||
```
|
||||
|
||||
### `pre-delete`
|
||||
|
||||
- Description: Can be used to run commands before an app is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Clears out the gulp asset build cache for applications
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; IMAGE="dokku/$APP"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"
|
||||
|
||||
if [[ -d $GULP_CACHE_DIR ]]; then
|
||||
docker run --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
fi
|
||||
```
|
||||
|
||||
### `post-delete`
|
||||
|
||||
- Description: Can be used to run commands after an application is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs a command to ensure that an app's
|
||||
# postgres installation is removed
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1";
|
||||
|
||||
dokku postgres:destroy $APP
|
||||
```
|
||||
|
||||
### `docker-args-build`
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku build`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `docker-args-deploy`
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `docker-args-run`
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku run`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `bind-external-ip`
|
||||
|
||||
- Description: Allows you to disable binding to the external box ip
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Force always binding to the docker ip, no matter
|
||||
# what the settings are for a given app.
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
echo false
|
||||
```
|
||||
|
||||
### `post-domains-update`
|
||||
|
||||
- Description: Allows you to run commands once the domain for an application has been updated.
|
||||
- Invoked by: `dokku domains:add`, `dokku domains:clear`, `dokku domains:remove`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Reloads haproxy for our imaginary haproxy plugin
|
||||
# that replaces the nginx-vhosts plugin
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
sudo service haproxy reload
|
||||
```
|
||||
|
||||
### `git-pre-pull`
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku git-upload-pack`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `git-post-pull`
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku git-upload-pack`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `nginx-hostname`
|
||||
|
||||
- Description: Allows you to customize the hostname for a given application.
|
||||
- Invoked by: `dokku domains:setup`
|
||||
- Arguments: `$APP $SUBDOMAIN $VHOST`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Reverses the hostname for the application
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; SUBDOMAIN="$2"; VHOST="$3"
|
||||
|
||||
NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
|
||||
echo "$NEW_SUBDOMAIN.$VHOST"
|
||||
```
|
||||
|
||||
### `nginx-pre-reload`
|
||||
|
||||
- Description: Run before nginx reloads hosts
|
||||
- Invoked by: `dokku nginx:build-config`
|
||||
- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# Runs a check against all nginx conf files
|
||||
# to ensure they are valid
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
nginx -t
|
||||
```
|
||||
|
||||
### `receive-app`
|
||||
|
||||
- Description: Allows you to customize what occurs when an app is received. Normally just triggers an application build.
|
||||
- Invoked by: `dokku git-hook`, `dokku ps:rebuild`
|
||||
- Arguments: `$APP $REV`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
# For our imaginary mercurial plugin, triggers a rebuild
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; REV="$2"
|
||||
|
||||
dokku hg-build $APP $REV
|
||||
```
|
||||
36
docs/development/testing.md
Normal file
36
docs/development/testing.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Dokku test suite
|
||||
|
||||
Dokku now has a full test suite to assist in quick iterating development. These tests include a linter using [shellcheck](https://github.com/koalaman/shellcheck), functional unit tests using the [bats testing framework](https://github.com/sstephenson/bats), and a deployment suite of example apps that use the most popular languages and frameworks.
|
||||
|
||||
Bats tests can be found here:
|
||||
```
|
||||
tests/unit/*.bats
|
||||
```
|
||||
|
||||
Example apps can be found here:
|
||||
```
|
||||
tests/apps/
|
||||
```
|
||||
|
||||
### Executing tests locally
|
||||
|
||||
- Setup dokku in a [vagrant vm](http://progrium.viewdocs.io/dokku/getting-started/install/vagrant)
|
||||
- Test setup and execution
|
||||
|
||||
```shell
|
||||
$ vagrant ssh
|
||||
$ sudo su -
|
||||
$ cd ~/dokku
|
||||
$ make ci-dependencies setup-deploy-tests
|
||||
$ make test # run the entire test suite (linter, bats tests, and app deployment tests)
|
||||
$
|
||||
$ make lint # linter
|
||||
$ make unit-tests # bats tests
|
||||
$ make deploy-tests # app deployment tests
|
||||
```
|
||||
- Additionally you may run a specific app deployment tests with a target similar to:
|
||||
|
||||
```shell
|
||||
make deploy-test-nodejs-express
|
||||
```
|
||||
- For a full list of test make targets check out `tests.mk` in the root of the dokku repository.
|
||||
60
docs/docker-options.md
Normal file
60
docs/docker-options.md
Normal file
@@ -0,0 +1,60 @@
|
||||
docker-options
|
||||
========================
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```bash
|
||||
$ dokku help
|
||||
...
|
||||
docker-options <app> Display apps docker options for all phases
|
||||
docker-options <app> <phase(s)> Display apps docker options for phase (comma seperated phase list)
|
||||
docker-options:add <app> <phase(s)> OPTION Add docker option to app for phase (comma seperated phase list)
|
||||
docker-options:remove <app> <phase(s)> OPTION Remove docker option from app for phase (comma seperated phase list)
|
||||
...
|
||||
````
|
||||
|
||||
Add some options
|
||||
|
||||
```bash
|
||||
$ dokku docker-options:add myapp deploy "-v /host/path:/container/path"
|
||||
$ dokku docker-options:add myapp run "-v /another/container/path"
|
||||
$ dokku docker-options:add myapp "-link container_name:alias"
|
||||
```
|
||||
|
||||
Check what we added
|
||||
|
||||
```bash
|
||||
$ dokku docker-options myapp
|
||||
-link container_name:alias
|
||||
-v /host/path:/container/path
|
||||
-v /another/container/path
|
||||
```
|
||||
|
||||
Remove an option
|
||||
```bash
|
||||
$ dokku docker-options:remove myapp "-link container_name:alias"
|
||||
```
|
||||
|
||||
Advanced Usage (avoid if possible)
|
||||
------------
|
||||
|
||||
In your applications folder (/home/dokku/app_name) create a file called DOCKER_OPTIONS.
|
||||
|
||||
Inside this file list one docker option per line. For example:
|
||||
|
||||
```bash
|
||||
-link container_name:alias
|
||||
-v /host/path:/container/path
|
||||
-v /another/container/path
|
||||
```
|
||||
|
||||
The above example will result in the following options being passed to docker during deploy and docker run:
|
||||
|
||||
```bash
|
||||
-link container_name:alias -v /host/path:/container/path -v /another/container/path
|
||||
```
|
||||
|
||||
You may also include comments (lines beginning with a #) and blank lines in the DOCKER_OPTIONS file.
|
||||
|
||||
Move information on docker options can be found here: http://docs.docker.io/en/latest/reference/run/ .
|
||||
36
docs/getting-started/install/debian.md
Normal file
36
docs/getting-started/install/debian.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Debian Package Installation Notes
|
||||
|
||||
As of 0.3.18, dokku defaults to being installed via debian package. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script:
|
||||
|
||||
```shell
|
||||
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
|
||||
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -qq -y linux-image-extra-`uname -r` apt-transport-https
|
||||
sudo apt-get install -qq -y dokku
|
||||
```
|
||||
|
||||
## Unattended installation
|
||||
|
||||
In case you want to perform an unattended installation of dokku, this is made possible through [debconf](https://en.wikipedia.org/wiki/Debconf_%28software_package%29), which allows you to configure a package before installing it.
|
||||
|
||||
You can set any of the below options through the `debconf-set-selections` command, for example to enable vhost-based deployments:
|
||||
|
||||
```bash
|
||||
echo "dokku dokku/vhost_enable boolean true" | debconf-set-selections
|
||||
```
|
||||
|
||||
After setting the desired options, proceed with the installation as described above.
|
||||
|
||||
### debconf options
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------------ | ------- | --------------------- | ------------------------------------------------------------------------ |
|
||||
| dokku/web_config | boolean | true | Use web-based config for below options |
|
||||
| dokku/vhost_enable | boolean | false | Use vhost-based deployments (e.g. <app>.dokku.me) |
|
||||
| dokku/hostname | string | dokku.me | Hostname, used as vhost domain and for showing app URL after deploy |
|
||||
| dokku/key_file | string | /root/.ssh/id_rsa.pub | SSH key to add to the Dokku user (Will be ignored on `dpkg-reconfigure`) |
|
||||
7
docs/getting-started/install/digitalocean.md
Normal file
7
docs/getting-started/install/digitalocean.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Digital Ocean
|
||||
|
||||
On Digital Ocean, there is a pre-made image that can be run for Dokku. You can choose to run this image on any sized droplet, though larger droplets will allow you to run larger applications.
|
||||
|
||||
When choosing your Droplet configuration, please disable IPv6 on the droplet. There are known issues with IPv6 on Digital Ocean and Docker, and many have been reported to the Dokku issue tracker.
|
||||
|
||||
If you would like to run Dokku on an IPv6 Digital Ocean Droplet, please consult [this guide](https://jeffloughridge.wordpress.com/2015/01/17/native-ipv6-functionality-in-docker/) for modifying Docker to run under the Digital Ocean IPv6 configuration.
|
||||
36
docs/getting-started/install/linode.md
Normal file
36
docs/getting-started/install/linode.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Installing on Linode
|
||||
|
||||
Due to how Linode installs custom kernels, Linode instances *require* a reboot before they can fully work with Docker/Dokku. The Official Dokku StackScript should take care of this process for you, and will email notify you when the instance is running and you can proceed with installation.
|
||||
|
||||
## Using StackScript
|
||||
|
||||
Deploy using the following (experimental) Official StackScript:
|
||||
|
||||
- https://www.linode.com/stackscripts/view/11348
|
||||
|
||||
## Without StackScript
|
||||
|
||||
* Build a Ubuntu 13.04 instance
|
||||
|
||||
* Follow these instructions: https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distributionsupplied-kernel-with-pvgrub#ubuntu-1304-raring
|
||||
|
||||
* If `apt-get update` no longer works:
|
||||
|
||||
* Verify if apt-get is trying to use ipv6 instead of ipv4 (e.g. you read something like "[Connecting to us.archive.ubuntu.com (2001:67c:1562::14)]" and apt-get would not proceed). In that case, follow these instructions: http://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method (append "precedence ::ffff:0:0/96 100" to /etc/gai.conf)
|
||||
|
||||
* OR: change `/etc/apt/sources.list` to one mentioned in http://mirrors.ubuntu.com/mirrors.txt
|
||||
|
||||
* Run the following commands:
|
||||
|
||||
```shell
|
||||
apt-get update
|
||||
|
||||
apt-get install lxc wget bsdtar linux-image-extra-$(uname -r)
|
||||
|
||||
modprobe aufs
|
||||
```
|
||||
* After this, you can install dokku the default way:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
```
|
||||
40
docs/getting-started/install/vagrant.md
Normal file
40
docs/getting-started/install/vagrant.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Install Dokku using Vagrant
|
||||
|
||||
- Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
|
||||
- Download and install [Vagrant](http://www.vagrantup.com/downloads.html)
|
||||
- Clone Dokku
|
||||
|
||||
```
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
```
|
||||
|
||||
- Setup SSH hosts in your `/etc/hosts`
|
||||
|
||||
```
|
||||
10.0.0.2 dokku.me
|
||||
```
|
||||
|
||||
- Create VM
|
||||
```
|
||||
# Optional ENV arguments:
|
||||
# - `BOX_NAME`
|
||||
# - `BOX_URI`
|
||||
# - `BOX_MEMORY`
|
||||
# - `DOKKU_DOMAIN`
|
||||
# - `DOKKU_IP`
|
||||
# - `FORWARDED_PORT`.
|
||||
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`
|
||||
|
||||
```
|
||||
Host dokku.me
|
||||
Port 2222
|
||||
```
|
||||
|
||||
- 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.
|
||||
|
||||
You are now ready to deploy an app or install plugins.
|
||||
|
||||
For a different, complete, example see https://github.com/RyanBalfanz/dokku-vagrant-example.
|
||||
25
docs/getting-started/where-to-get-help.md
Normal file
25
docs/getting-started/where-to-get-help.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Where to Get Help
|
||||
|
||||
If you’re stuck, there are a number of places you can get help:
|
||||
|
||||
## The Official Dokku Website
|
||||
|
||||
[http://progrium.viewdocs.io/dokku](http://progrium.viewdocs.io/dokku)
|
||||
|
||||
The Official Dokku website is always a great place to visit. It features links to oft-used developer tools, community plugins, and guides on using dokku.
|
||||
|
||||
## The IRC Channel
|
||||
|
||||
IRC Channel on irc.freenode.net:
|
||||
|
||||
- #dokku – General Discussion
|
||||
|
||||
If you’re stumped, give us a holler in the Dokku IRC channel. Someone from the development team is usually there, especially during the daylight hours for North and South America users. We’d love to hear from you, whether you need some help, want to find users in your area, or would like to donate your brand new sports car.
|
||||
|
||||
If [here](http://webchat.freenode.net/?channels=dokku) for a web-based client IRC client.
|
||||
|
||||
## Stackoverflow
|
||||
|
||||
http://stackoverflow.com/
|
||||
|
||||
Tag your questions with `dokku` to enable existing users of stackoverflow to find your questions.
|
||||
@@ -2,24 +2,38 @@
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
|
||||
|
||||
## Table Of Contents
|
||||
### Getting Started
|
||||
|
||||
- [Installation](http://progrium.viewdocs.io/dokku/installation)
|
||||
- [Upgrading](http://progrium.viewdocs.io/dokku/upgrading)
|
||||
- [Troubleshooting](http://progrium.viewdocs.io/dokku/troubleshooting)
|
||||
- [Components](http://progrium.viewdocs.io/dokku/components)
|
||||
- [Getting Help](http://progrium.viewdocs.io/dokku/getting-started/where-to-get-help)
|
||||
|
||||
### Deployment
|
||||
|
||||
- [Application Deployment](http://progrium.viewdocs.io/dokku/application-deployment)
|
||||
- [Remote commands](http://progrium.viewdocs.io/dokku/remote-commands)
|
||||
- [Plugins](http://progrium.viewdocs.io/dokku/plugins)
|
||||
- [Configuration management](http://progrium.viewdocs.io/dokku/configuration-management)
|
||||
- [Process management](http://progrium.viewdocs.io/dokku/process-management)
|
||||
- [DNS Configuration](http://progrium.viewdocs.io/dokku/dns)
|
||||
- [Nginx Configuration](http://progrium.viewdocs.io/dokku/nginx)
|
||||
- [DNS](http://progrium.viewdocs.io/dokku/dns)
|
||||
- [Running Remote commands](http://progrium.viewdocs.io/dokku/remote-commands)
|
||||
- [Container Options](http://progrium.viewdocs.io/dokku/docker-options)
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [Clients](http://progrium.viewdocs.io/dokku/community/clients)
|
||||
- [Plugins](http://progrium.viewdocs.io/dokku/plugins)
|
||||
|
||||
### Development
|
||||
|
||||
- [Plugin Creation](http://progrium.viewdocs.io/dokku/development/plugin-creation)
|
||||
- [Pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks)
|
||||
- [Test Suite](http://progrium.viewdocs.io/dokku/development/testing)
|
||||
|
||||
## Things this project won't do
|
||||
|
||||
* **Multi-host.** Not a huge leap, but this isn't the project for it. Have a look at [Deis](http://deis.io/).
|
||||
* **Multitenancy.** It's ready for it, but again, have a look at [Deis](http://deis.io/).
|
||||
* **Client app.** Given the constraints, running commands remotely via SSH is fine.
|
||||
* **Multi-host.** It runs on one host. If you need more, have a look at [Deis](http://deis.io/).
|
||||
* **Multitenancy.** Multi-app, and loosely multi-user based on SSH keys, but that's it.
|
||||
|
||||
## Sponsors
|
||||
|
||||
|
||||
@@ -11,145 +11,20 @@ Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's de
|
||||
To install the latest stable version of dokku, you can run the following bootstrapper command:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/v0.3.10/bootstrap.sh | sudo DOKKU_TAG=v0.3.10 bash
|
||||
# installs dokku via apt-get
|
||||
wget https://raw.github.com/progrium/dokku/v0.3.18/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.3.18 bash bootstrap.sh
|
||||
|
||||
# Go to your server's IP and follow the web installer
|
||||
```
|
||||
|
||||
## Configuring
|
||||
For various reasons, certain hosting providers may have other steps that should be preferred to the above. If hosted on any of the following popular hosts, please follow the linked to instructions:
|
||||
|
||||
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).
|
||||
- [Digital Ocean Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/digitalocean)
|
||||
- [Linode Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/linode)
|
||||
|
||||
You'll have to add a public key associated with a username by doing something like this from your local machine:
|
||||
As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started:
|
||||
|
||||
$ cat ~/.ssh/id_rsa.pub | ssh dokku.me "sudo sshcommand acl-add dokku $USER"
|
||||
|
||||
That's it!
|
||||
|
||||
## Advanced installation
|
||||
|
||||
### Development via bash script
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
```
|
||||
|
||||
This may take around 5 minutes. Certainly better than the several hours it takes to bootstrap Cloud Foundry.
|
||||
|
||||
You may also wish to take a look at the [advanced installation](http://progrium.viewdocs.io/dokku/advanced-installation) document for additional installation options.
|
||||
|
||||
### Development From Source
|
||||
|
||||
If you plan on developing dokku, the easiest way to install from your own repository is cloning
|
||||
the repository and calling the install script. Example:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/yourusername/dokku.git
|
||||
cd dokku
|
||||
sudo make install
|
||||
```
|
||||
|
||||
The `Makefile` allows source URLs to be overridden to include customizations from your own
|
||||
repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL`
|
||||
environment variables may be set to override the defaults (see the `Makefile` for how these
|
||||
apply). Example:
|
||||
|
||||
```shell
|
||||
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
|
||||
```
|
||||
|
||||
### Bootstrap a server from your own repository
|
||||
|
||||
The bootstrap script allows the dokku repository URL to be overridden to bootstrap a host from
|
||||
your own clone of dokku using the `DOKKU_REPO` environment variable. Example:
|
||||
|
||||
```shell
|
||||
wget https://raw.github.com/progrium/dokku/master/bootstrap.sh
|
||||
chmod +x bootstrap.sh
|
||||
sudo DOKKU_REPO=https://github.com/yourusername/dokku.git ./bootstrap.sh
|
||||
```
|
||||
|
||||
### Custom buildstep build
|
||||
|
||||
Dokku ships with a pre-built version of the [buildstep](https://github.com/progrium/buildstep) component by
|
||||
default. If you want to build your own version you can specify that with an env
|
||||
variable.
|
||||
|
||||
```shell
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
cd dokku
|
||||
sudo BUILD_STACK=true make install
|
||||
```
|
||||
|
||||
### Install Dokku using Vagrant
|
||||
|
||||
- Download and install [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
|
||||
- Download and install [Vagrant](http://www.vagrantup.com/downloads.html)
|
||||
- Clone Dokku
|
||||
|
||||
```
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
```
|
||||
|
||||
- Setup SSH hosts in your `/etc/hosts`
|
||||
|
||||
```
|
||||
10.0.0.2 dokku.me
|
||||
```
|
||||
|
||||
- Setup SSH Config in `~/.ssh/config`
|
||||
|
||||
```
|
||||
Host dokku.me
|
||||
Port 2222
|
||||
```
|
||||
|
||||
- Create VM
|
||||
```
|
||||
# Optional ENV arguments:
|
||||
# - `BOX_NAME`
|
||||
# - `BOX_URI`
|
||||
# - `BOX_MEMORY`
|
||||
# - `DOKKU_DOMAIN`
|
||||
# - `DOKKU_IP`.
|
||||
cd path/to/dokku
|
||||
vagrant up
|
||||
```
|
||||
|
||||
- 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.
|
||||
|
||||
You are now ready to deploy an app or install plugins.
|
||||
|
||||
For a different, complete, example see https://github.com/RyanBalfanz/dokku-vagrant-example.
|
||||
|
||||
### Installing on Linode
|
||||
|
||||
#### Using StackScript
|
||||
|
||||
Deploy using the following StackScript:
|
||||
* https://www.linode.com/stackscripts/view/8552
|
||||
|
||||
#### Without StackScript
|
||||
|
||||
* Build a Ubuntu 13.04 instance
|
||||
|
||||
* Follow these instructions: https://www.linode.com/wiki/index.php/PV-GRUB#Ubuntu_12.04_Precise
|
||||
|
||||
* If `apt-get update` no longer works:
|
||||
|
||||
* Verify if apt-get is trying to use ipv6 instead of ipv4 (e.g. you read something like "[Connecting to us.archive.ubuntu.com (2001:67c:1562::14)]" and apt-get would not proceed). In that case, follow these instructions: http://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method (append "precedence ::ffff:0:0/96 100" to /etc/gai.conf)
|
||||
|
||||
* OR: change `/etc/apt/sources.list` to one mentioned in http://mirrors.ubuntu.com/mirrors.txt
|
||||
|
||||
* Run the following commands:
|
||||
|
||||
```shell
|
||||
apt-get update
|
||||
|
||||
apt-get install lxc wget bsdtar linux-image-extra-$(uname -r)
|
||||
|
||||
modprobe aufs
|
||||
```
|
||||
* After this, you can install dokku the default way:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
```
|
||||
- [Debian Package Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/debian)
|
||||
- [Vagrant Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/vagrant)
|
||||
- [Advanced Install Customization](http://progrium.viewdocs.io/dokku/advanced-installation)
|
||||
|
||||
@@ -8,7 +8,7 @@ Dokku provides easy TLS/SPDY support out of the box. This can be done app-by-app
|
||||
|
||||
### Per App
|
||||
|
||||
To enable TLS connection to to one of your applications, copy or symlink the `.crt`/`.pem` and `.key` files into the application's `/home/dokku/:app/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively.
|
||||
To enable TLS connection to to one of your applications, copy or symlink the `.crt` and `.key` files into the application's `/home/dokku/:app/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively.
|
||||
|
||||
Redeployment of the application will be needed to apply TLS configuration. Once it is redeployed, the application will be accessible by `https://` (redirection from `http://` is applied as well).
|
||||
|
||||
@@ -16,7 +16,7 @@ Redeployment of the application will be needed to apply TLS configuration. Once
|
||||
|
||||
To enable TLS connections for all your applications at once you will need a wildcard TLS certificate.
|
||||
|
||||
To enable TLS across all apps, copy or symlink the `.crt`/`.pem` and `.key` files into the `/home/dokku/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively. Then, enable the certificates by editing `/etc/nginx/conf.d/dokku.conf` and uncommenting these two lines (remove the #):
|
||||
To enable TLS across all apps, copy or symlink the `.crt` and `.key` files into the `/home/dokku/tls` folder (create this folder if it doesn't exist) as `server.crt` and `server.key` respectively. Then, enable the certificates by editing `/etc/nginx/conf.d/dokku.conf` and uncommenting these two lines (remove the #):
|
||||
|
||||
```
|
||||
ssl_certificate /home/dokku/tls/server.crt;
|
||||
@@ -75,7 +75,13 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
The above is a sample, http configuration that adds an `X-Served-By` header to requests. The template is manually uploaded this template file and **must** it owned by `dokku:dokku`.
|
||||
The above is a sample http configuration that adds an `X-Served-By` header to requests. The template file **must** be owned by the user `dokku:dokku`.
|
||||
|
||||
A few tips for custom nginx templates:
|
||||
|
||||
- Special characters - dollar signs, spaces inside of quotes, etc. - should be escaped with a single backslash or can cause deploy failures.
|
||||
- Templated files will be validated via `nginx -t`.
|
||||
- Application environment variables can be used within your nginx configuration.
|
||||
|
||||
## Customizing hostnames
|
||||
|
||||
@@ -136,3 +142,40 @@ dokku domains:clear myapp
|
||||
# remove a custom domain from app
|
||||
dokku domains:remove myapp example.com
|
||||
```
|
||||
|
||||
### Container network interface binding
|
||||
|
||||
> New as of 0.3.13
|
||||
|
||||
The deployed docker container running your app's web process will bind to either the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`) or an external interface (i.e. 0.0.0.0) depending on dokku's VHOST configuration. Dokku will attempt to bind to the internal docker network interface unless you specifically set NO_VHOST for the given app or your dokku installation is not setup to use VHOSTS (i.e. $DOKKU_ROOT/VHOST is missing or $DOKKU_ROOT/HOSTNAME is set to an IPv4 or IPv6 address)
|
||||
|
||||
```shell
|
||||
# container bound to docker interface
|
||||
root@dokku:~/dokku# docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute goofy_albattani
|
||||
|
||||
root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' goofy_albattani
|
||||
172.17.0.6
|
||||
|
||||
# container bound to all interfaces (previous default)
|
||||
root@dokku:/home/dokku# docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp nostalgic_tesla
|
||||
|
||||
```
|
||||
|
||||
# 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 nginx. 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).
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
server_name _;
|
||||
return 410;
|
||||
log_not_found off;
|
||||
}
|
||||
```
|
||||
|
||||
109
docs/plugins.md
109
docs/plugins.md
@@ -21,55 +21,7 @@ dokku plugins-install
|
||||
|
||||
## Creating your own plugin
|
||||
|
||||
If you create your own plugin:
|
||||
|
||||
1. take a look at the plugins shipped with dokku and hack away!
|
||||
2. upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
|
||||
3. edit this page and add a link to it below!
|
||||
4. subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
|
||||
|
||||
### Sample plugin
|
||||
|
||||
The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
hello)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2";
|
||||
|
||||
echo "Hello $APP"
|
||||
;;
|
||||
|
||||
hello:world)
|
||||
echo "Hello world"
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
hello <app> Says "Hello <app>"
|
||||
hello:world Says "Hello world"
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
```
|
||||
|
||||
A few notes:
|
||||
|
||||
- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin.
|
||||
- If your command requires that an application exists, ensure you check for it's existence in the manner prescribed above.
|
||||
- A `help` command is required, though it is allowed to be empty.
|
||||
- Commands *should* be namespaced.
|
||||
- As of 0.3.3, a catch-all should be implemented which exits with a `DOKKU_NOT_IMPLEMENTED_EXIT` code. This allows dokku to output a `command not found` message.
|
||||
[See the full documentation](http://progrium.viewdocs.io/dokku/development/plugin-creation).
|
||||
|
||||
## Community plugins
|
||||
|
||||
@@ -85,6 +37,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[cameron-martin]: https://github.com/cameron-martin
|
||||
[cedricziel]: https://github.com/cedricziel
|
||||
[cef]: https://github.com/cef
|
||||
[cjblomqvist]: https://github.com/cjblomqvist
|
||||
[darkpixel]: https://github.com/darkpixel
|
||||
[dyson]: https://github.com/dyson
|
||||
[F4-Group]: https://github.com/F4-Group
|
||||
@@ -108,6 +61,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[motin]: https://github.com/motin
|
||||
[musicglue]: https://github.com/musicglue
|
||||
[neam]: https://github.com/neam
|
||||
[nickstenning]: https://github.com/nickstenning
|
||||
[nornagon]: https://github.com/nornagon
|
||||
[ohardy]: https://github.com/ohardy
|
||||
[pauldub]: https://github.com/pauldub
|
||||
@@ -122,6 +76,11 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[thrashr888]: https://github.com/thrashr888
|
||||
[wmluke]: https://github.com/wmluke
|
||||
[Zenedith]: https://github.com/Zenedith
|
||||
[sekjun9878]: https://github.com/sekjun9878
|
||||
[Flink]: https://github.com/Flink
|
||||
[ribot]: https://github.com/ribot
|
||||
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell
|
||||
[jagandecapri]: https://github.com/jagandecapri
|
||||
|
||||
### Datastores
|
||||
|
||||
@@ -137,6 +96,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| [PostgreSQL](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). |
|
||||
| [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [PostgreSQL (single container)](https://github.com/Flink/dokku-psql-single-container) | [Flink][] | Single Postgresql container with official Postgresql docker image. Compatible with 0.3.16 |
|
||||
| [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | |
|
||||
|
||||
#### Caching
|
||||
@@ -147,6 +107,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| [Memcached](https://github.com/jlachowski/dokku-memcached-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
|
||||
| [Redis](https://github.com/jezdez/dokku-redis-plugin) | [jezdez][] | Requires https://github.com/rlaneve/dokku-link; compatible with 0.2.0 |
|
||||
| [Redis](https://github.com/luxifer/dokku-redis-plugin) | [luxifer][] | |
|
||||
| [Redis](https://github.com/sekjun9878/dokku-redis-plugin) | [sekjun9878][] | A better Redis plugin with automatic instance creation and Dokku Link support
|
||||
| [Redis (single container)](https://github.com/ohardy/dokku-redis) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [Varnish](https://github.com/Zenedith/dokku-varnish-plugin) | [Zenedith][] | Varnish cache between nginx and application with base configuration|
|
||||
|
||||
@@ -162,6 +123,9 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [CouchDB](https://github.com/racehub/dokku-couchdb-plugin) | [RaceHub][] | Compatible with 0.2.0 |
|
||||
| [Elasticsearch](https://github.com/robv/dokku-elasticsearch) | [robv][] | Not compatible with >= 0.3.0 (still uses /home/git) |
|
||||
| [Elasticsearch](https://github.com/jezdez/dokku-elasticsearch-plugin) | [jezdez][] | Compatible with 0.2.0 to 0.3.13 |
|
||||
| [Elasticsearch](https://github.com/blag/dokku-elasticsearch-plugin)<sup>1</sup> | [blag][] | Compatible with 0.2.0 |
|
||||
| [MongoDB (single container)](https://github.com/jeffutter/dokku-mongodb-plugin) | [jeffutter][] | |
|
||||
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 2014-02-22: targeting dokku @ [latest][217d00a]; will fail with Dokku earlier than [28de3ec][]. |
|
||||
| [RiakCS (single container)](https://github.com/jeffutter/dokku-riakcs-plugin) | [jeffutter][] | Incompatible with 0.2.0 (checked at [dccee02][]) |
|
||||
@@ -178,6 +142,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | Compatible with 0.2.0 |
|
||||
| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | Works with dokku @ [c77cbf1][] - no 0.2.0 compatibility |
|
||||
| [Forego](https://github.com/iskandar/dokku-forego) | [iskandar][] | Compatible with 0.2.x |
|
||||
| [Monit](https://github.com/cjblomqvist/dokku-monit) | [cjblomqvist][] | |
|
||||
|
||||
[c77cbf1]: https://github.com/progrium/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147
|
||||
[28de3ec]: https://github.com/progrium/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40
|
||||
@@ -187,60 +152,76 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh][] | Works with 0.2.0 |
|
||||
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | Compatible with 0.2.* |
|
||||
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | |
|
||||
| [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | |
|
||||
| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | dokku >= [c77cbf1][] |
|
||||
| [Dokku Name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | dokku >= [c77cbf1][] |
|
||||
| [Dokku Registry](https://github.com/agco-adm/dokku-registry) | [agco-adm][] | |
|
||||
| [Dokku Registry](https://github.com/agco-adm/dokku-registry)<sup>1</sup> | [agco-adm][] | |
|
||||
| [git rev-parse HEAD in env](https://github.com/nornagon/dokku-git-rev) | [nornagon][] | Compatible with 0.2.0 |
|
||||
| [Graduate (Environment Management)](https://github.com/glassechidna/dokku-graduate) | [Benjamin-Dobell][] | dokku >= v0.3.14 |
|
||||
| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 |
|
||||
| [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | dokku >= [c77cbf1][]. 2014-02-17: [a043e98][] targeting dokku @ [latest][217d00a] |
|
||||
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | |
|
||||
| [Link Containers](https://github.com/rlaneve/dokku-link) | [rlaneve][] | dokku >= [c77cbf1][] |
|
||||
| [Multi-Buildpack](https://github.com/pauldub/dokku-multi-buildpack) | [pauldub][] | |
|
||||
| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>4</sup> | [wmluke][] | Compatible with 0.2.0 |
|
||||
| [Nginx-Alt](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | Works with v0.2.3 |
|
||||
| [Persistent Storage](https://github.com/dyson/dokku-persistent-storage) | [dyson][] | Requires dokku >= [c77cbf1][] |
|
||||
| [Ports](https://github.com/heichblatt/dokku-ports) | [heichblatt][] | |
|
||||
| [Pre-Deploy Tasks](https://github.com/michaelshobbs/dokku-app-predeploy-tasks) | [michaelshobbs][] | |
|
||||
| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | Compatible with 0.2.x |
|
||||
| [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)<sup>2</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master |
|
||||
| [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)<sup>3</sup> | [cedricziel][] | 2014-01-17: compatible with upstream/master |
|
||||
| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env) | [cameron-martin][] | Works with v0.2.3 |
|
||||
| [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration) | [motin][] | Compatible with 0.3.1 |
|
||||
| [Volume (persistent storage)](https://github.com/ohardy/dokku-volume) | [ohardy][] | Compatible with 0.2.0 |
|
||||
| [Maintenance mode](https://github.com/Flink/dokku-maintenance) | [Flink][] | |
|
||||
| [HTTP Auth](https://github.com/Flink/dokku-http-auth) | [Flink][] | |
|
||||
|
||||
[8fca220]: https://github.com/progrium/dokku/commit/8fca2204edb0017796d6915ca9157c05b1238e28
|
||||
[217d00a]: https://github.com/progrium/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7
|
||||
[98332de]: https://github.com/dyson/dokku-persistent-storage/commit/98332de4b5b640610bee535f4d5260263074e18b
|
||||
[a043e98]: https://github.com/stuartpb/dokku-bind-port/commit/a043e9892f4815b6525c850131e09fd64db5c1fa
|
||||
|
||||
<sup>1</sup> On Heroku similar functionality is offered by the [heroku-labs pipeline feature](https://devcenter.heroku.com/articles/labs-pipelines), which allows you to promote builds across multiple environments (staging -> production)
|
||||
|
||||
<sup>2</sup> Adds the possibility to add SSH deployment keys to receive private hosted packages
|
||||
|
||||
<sup>3</sup> Adds the ability to add custom hosts to the containers known_hosts file to be able to ssh them easily (useful with deployment keys)
|
||||
|
||||
<sup>4</sup> Conflicts with [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration)
|
||||
|
||||
<sup>5</sup> On Heroku similar functionality is offered by the [heroku-labs pipeline feature](https://devcenter.heroku.com/articles/labs-pipelines), which allows you to promote builds across multiple environments (staging -> production)
|
||||
|
||||
### Other Add-ons
|
||||
### Other Plugins
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Wordpress](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | Dokku dev, mariadb, volume, domains |
|
||||
| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | |
|
||||
| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | |
|
||||
| [Chef cookbooks](https://github.com/fgrehm/chef-dokku) | [fgrehm][] | |
|
||||
| [Bower install](https://github.com/alexanderbeletsky/dokku-bower-install) | [alexanderbeletsky][] | |
|
||||
| [Bower/Grunt](https://github.com/thrashr888/dokku-bower-grunt-build-plugin) | [thrashr888][] | |
|
||||
| [Bower/Gulp](https://github.com/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290][] | |
|
||||
| [Elasticsearch](https://github.com/robv/dokku-elasticsearch) | [robv][] | |
|
||||
| [Elasticsearch](https://github.com/jezdez/dokku-elasticsearch-plugin) | [jezdez][] | Compatible with 0.2.0 |
|
||||
| [Elasticsearch](https://github.com/blag/dokku-elasticsearch-plugin)<sup>1</sup> | [blag][] | Compatible with 0.2.0 |
|
||||
| [Bower/Gulp](https://github.com/jagandecapri/dokku-bower-gulp-build-plugin) | [jagandecapri][] | |
|
||||
| [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | |
|
||||
| [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | |
|
||||
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | |
|
||||
| [APT](https://github.com/F4-Group/dokku-apt) | [F4-Group][] | |
|
||||
| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | |
|
||||
| [PrimeCache](https://github.com/darkpixel/dokku-prime-cache) | [darkpixel][] | |
|
||||
| [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | |
|
||||
| [Rails logs](https://github.com/Flink/dokku-rails-logs) | [Flink][] | |
|
||||
| [Airbrake deploy](https://github.com/Flink/dokku-airbrake-deploy) | [Flink][] | |
|
||||
|
||||
<sup>1</sup> Forked from [jezdez/dokku-elasticsearch-plugin](https://github.com/jezdez/dokku-elasticsearch-plugin): uses Elasticsearch 1.2 (instead of 0.90), doesn't depend on dokku-link, runs as elasticsearch user instead of root, and turns off multicast autodiscovery for use in a VPS environment.
|
||||
|
||||
### Deprecated Plugins
|
||||
|
||||
The following plugins have been removed as their functionality is now in Dokku Core.
|
||||
|
||||
| Plugin | Author | In Dokku Since |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------- |
|
||||
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | v0.3.10 (domains plugin) |
|
||||
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | v0.3.9 (trace command) |
|
||||
| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | v0.3.17 (docker-options plugin) |
|
||||
| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>1</sup> | [wmluke][] | v0.3.10 (domains plugin) |
|
||||
| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) |
|
||||
| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)<sup>2</sup> | [cameron-martin][] | v0.3.9 (build-env plugin) |
|
||||
| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>2</sup> | [musicglue][] | v0.3.9 (build-env plugin) |
|
||||
| [user-env-compile](https://github.com/motin/dokku-user-env-compile)<sup>2</sup> | [motin][] | v0.3.9 (build-env plugin) |
|
||||
|
||||
<sup>1</sup> Conflicts with [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration)
|
||||
<sup>2</sup> Similar to the heroku-labs feature (see https://devcenter.heroku.com/articles/labs-user-env-compile)
|
||||
|
||||
13
docs/process-management.md
Normal file
13
docs/process-management.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Process/Container management
|
||||
|
||||
Dokku supports rudimentary process (really container) management via the `ps` plugin.
|
||||
|
||||
```
|
||||
ps <app> List processes running in app container(s)
|
||||
ps:start <app> Start app container(s)
|
||||
ps:stop <app> Stop app container(s)
|
||||
ps:restart <app> Restart app container(s)
|
||||
ps:restartall Restart all deployed app containers
|
||||
```
|
||||
|
||||
*NOTE*: As of v0.3.14, `dokku deploy:all` in now deprecated by `ps:restartall` and will be removed in a future version.
|
||||
@@ -17,3 +17,15 @@ It's possible to run commands in the environment of the deployed application:
|
||||
dokku run node-js-app ls -alh
|
||||
dokku run <app> <cmd>
|
||||
```
|
||||
|
||||
## Behavioral modifiers
|
||||
|
||||
Dokku also supports certain command-line arguments that augment it's behavior. If using these over ssh, you must use the form `ssh -t dokku@dokku.me -- <command>`
|
||||
in order to avoid ssh interpretting dokku arguments for itself.
|
||||
|
||||
```shell
|
||||
--quiet suppress output headers
|
||||
--trace enable DOKKU_TRACE for current execution only
|
||||
--rm|--rm-container remove docker container after successful dokku run <app> <command>
|
||||
--force force flag. currently used in apps:destroy
|
||||
```
|
||||
|
||||
@@ -22,7 +22,7 @@ http {
|
||||
```
|
||||
|
||||
Note that the `server_names_hash_bucket_size` setting defines the maximum domain name length.
|
||||
A value of 64 would allow domains with up to 46 characters. Set it to 128 if you need longer ones.
|
||||
A value of 64 would allow domains with up to 64 characters. Set it to 128 if you need longer ones.
|
||||
|
||||
Save the file and try stopping nginx and starting it again:
|
||||
|
||||
@@ -56,6 +56,41 @@ This will trace all of dokku's activity. If this does not help you, create a [gi
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I get the aforementioned error in the build phase (after turning on dokku tracing)
|
||||
|
||||
Most errors that happen in this phase are due to transient network issues (either locally or remotely) buildpack bugs.
|
||||
|
||||
__Solution (Less solution, more helpful troubleshooting steps):__
|
||||
|
||||
Find the failed phase's container image (*077581956a92* in this example)
|
||||
|
||||
```
|
||||
root@dokku:~# docker ps -a | grep builder
|
||||
94d9515e6d93 077581956a92 "/build/builder" 29 minutes ago Exited (0) 25 minutes ago cocky_bell
|
||||
```
|
||||
|
||||
Start a new container with the failed image and poke around (i.e. ensure you can access the internet from within the container or attempt the failed command, if known)
|
||||
|
||||
```
|
||||
root@dokku:~# docker run -ti 077581956a92 /bin/bash
|
||||
root@9763ab86e1b4:/# curl -s -S icanhazip.com
|
||||
192.168.0.1
|
||||
curl http://s3pository.heroku.com/node/v0.10.30/node-v0.10.30-linux-x64.tar.gz -o node-v0.10.30-linux-x64.tar.gz
|
||||
tar tzf node-v0.10.30-linux-x64.tar.gz
|
||||
...
|
||||
```
|
||||
|
||||
Sometimes (especially on DO) deploying again seems to get past these seemingly transient issues
|
||||
Additionally we've seen issues if changing networks that have different DNS resolvers. In this case, you can run the following to update your resolv.conf
|
||||
|
||||
```
|
||||
root@dokku:~# resolvconf -u
|
||||
```
|
||||
|
||||
Please see https://github.com/progrium/dokku/issues/841 and https://github.com/progrium/dokku/issues/649
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ I want to deploy my app but I am getting asked for the password of the git user and the error message
|
||||
|
||||
fatal: 'NAME' does not appear to be a git repository
|
||||
@@ -105,3 +140,32 @@ When specifying your port you may want to use something similar to:
|
||||
var port = process.env.PORT || 3000
|
||||
|
||||
Please see https://github.com/progrium/dokku/issues/282
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ Deployment fails because of slow internet connection, messages shows `gzip: stdin: unexpected end of file`
|
||||
|
||||
__Solution:__
|
||||
|
||||
If you see output similar this when deploying:
|
||||
|
||||
```
|
||||
Command: 'set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/ruby-2.0.0-p451-default-cache.tgz -s -o - | tar zxf -' failed unexpectedly:
|
||||
!
|
||||
! gzip: stdin: unexpected end of file
|
||||
! tar: Unexpected EOF in archive
|
||||
! tar: Unexpected EOF in archive
|
||||
! tar: Error is not recoverable: exiting now
|
||||
```
|
||||
|
||||
it might that the curl command that is supposed to fetch the buildpack (anything in the low megabyte file size range) takes too long to finish, due to slowish connection. To overwrite the default values (connection timeout: 3 seconds, total maximum time for operation: 30 seconds), edit `/home/dokku/ENV` like the following:
|
||||
|
||||
```
|
||||
#/home/dokku/ENV
|
||||
export CURL_TIMEOUT=600
|
||||
export CURL_CONNECT_TIMEOUT=30
|
||||
```
|
||||
|
||||
References
|
||||
* https://github.com/progrium/dokku/issues/509
|
||||
* https://github.com/dokku-alt/dokku-alt/issues/169
|
||||
|
||||
@@ -1,73 +1,62 @@
|
||||
# Upgrading
|
||||
|
||||
Dokku is in active development. You can update the deployment step and the build step separately.
|
||||
This document covers upgrades for the 0.3.0 series and up. If upgrading from previous versions, we recommend [a fresh install](http://progrium.viewdocs.io/dokku/installation) on a new server.
|
||||
|
||||
**Note**: If you are upgrading from a revision prior to [27d4bc8c3c](https://github.com/progrium/dokku/commit/27d4bc8c3c19fe580ef3e65f2f85b85101cd83e4), follow the instructions in [this wiki entry](https://github.com/progrium/dokku/wiki/Migrating-to-Dokku-0.2.0).
|
||||
> As of 0.3.18, dokku is installed by default via a debian package. Source-based installations are still available, though not recommended.
|
||||
|
||||
To update the deploy step (this is updated less frequently):
|
||||
## Dokku
|
||||
|
||||
If dokku was installed via a debian package, you can upgrade dokku via the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install dokku
|
||||
```
|
||||
|
||||
For unattended upgrades, you may run the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install -qq -y dokku
|
||||
```
|
||||
|
||||
If you have installed dokku from source, you may run the following commands to upgrade:
|
||||
|
||||
```shell
|
||||
cd ~/dokku
|
||||
git pull origin master
|
||||
git pull --tags origin master
|
||||
|
||||
# continue to install from source
|
||||
sudo DOKKU_BRANCH=master make install
|
||||
|
||||
# upgrade to debian package-based installation
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Nothing needs to be restarted. Changes will take effect on the next push / deployment.
|
||||
|
||||
To update the build step:
|
||||
All changes will take effect upon next application deployment. To trigger a rebuild of every application, simply run the following command:
|
||||
|
||||
```shell
|
||||
dokku ps:rebuildall
|
||||
```
|
||||
|
||||
## Buildstep image
|
||||
|
||||
If dokku was installed via a debian package, you can upgrade buildstep via the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install buildstep
|
||||
```
|
||||
|
||||
For unattended upgrades, you may run the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install -qq -y buildstep
|
||||
```
|
||||
|
||||
In some cases, it may be desirable to run a specific version of buildstep. To install/upgrade buildstep from source, run the following commands:
|
||||
|
||||
```shell
|
||||
cd /tmp
|
||||
git clone https://github.com/progrium/buildstep.git
|
||||
cd buildstep
|
||||
git pull origin master
|
||||
sudo make build
|
||||
```
|
||||
|
||||
This will build a fresh Ubuntu Quantal image, install a number of packages, and
|
||||
eventually replace the Docker image for buildstep.
|
||||
|
||||
## Migrating from 0.1.0 to 0.2.0
|
||||
|
||||
This should be summary of breaking changes between 0.1 and 0.2 version with instructions to upgrade.
|
||||
|
||||
### software-properties-common
|
||||
|
||||
software-properties-common is now a dependency for plugins. Before running dokku install script, make sure it is installed.
|
||||
|
||||
```shell
|
||||
> sudo apt-get install software-properties-common
|
||||
```
|
||||
|
||||
### Gitreceive removed
|
||||
|
||||
PR [#270](https://github.com/progrium/dokku/pull/270).
|
||||
|
||||
Starting with Dokku 0.2.0, [Gitrecieve](https://github.com/progrium/gitreceive) is replaced by a `git` plugin.
|
||||
|
||||
Dokku no longer uses the `git` user. Everything is done with the `dokku` user account.
|
||||
|
||||
This causes the remote url to change. Instead of pushing to `git@hostname:app`, you should now push to `dokku@hostname:app`.
|
||||
The url must be modified using the `git remote set-url` command :
|
||||
|
||||
git remote set-url deploy dokku@hostname:app
|
||||
|
||||
Where `deploy` is the name of the remote.
|
||||
|
||||
Additionally, the repositiories on the server must be migrated to work with dokku 0.2.0
|
||||
|
||||
There is an upgrade [script](https://gist.github.com/plietar/7201430), which is meant to automate this migration. To use it:
|
||||
|
||||
1. run the script as root
|
||||
2. `git pull` to get the latest version of dokku
|
||||
3. make install
|
||||
4. `dokku deploy:all`
|
||||
|
||||
TDB.
|
||||
|
||||
### Cache directory
|
||||
|
||||
Commit [#6350f373](https://github.com/progrium/dokku/commit/6350f373be2cef4f3bb90912099e1be6196522d1)
|
||||
|
||||
Buildstep have to be re-installed in order to support cache directory.
|
||||
|
||||
TDB.
|
||||
|
||||
139
dokku
139
dokku
@@ -1,19 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
|
||||
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
|
||||
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
|
||||
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
|
||||
|
||||
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
||||
export DOKKU_NOT_IMPLEMENTED_EXIT=10
|
||||
export DOKKU_VALID_EXIT=0
|
||||
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
|
||||
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done
|
||||
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
parse_args "$@"
|
||||
args=("$@")
|
||||
if [[ "${args[0]}" =~ ^--.* ]]; then
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" =~ ^--.* ]];then
|
||||
shift 1
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
! has_tty && DOKKU_QUIET_OUTPUT=1
|
||||
|
||||
if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then
|
||||
sudo -u dokku -E -H $0 "$@"
|
||||
exit
|
||||
@@ -21,51 +37,31 @@ fi
|
||||
|
||||
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
|
||||
export -n SSH_ORIGINAL_COMMAND
|
||||
$0 $SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]];then
|
||||
xargs $0 <<<$SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
else
|
||||
$0 $SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
receive)
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
echo "-----> Cleaning up ..."
|
||||
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
|
||||
dokku_log_info1 "Cleaning up..."
|
||||
dokku cleanup
|
||||
echo "-----> Building $APP ..."
|
||||
cat | dokku build $APP
|
||||
echo "-----> Releasing $APP ..."
|
||||
dokku release $APP
|
||||
echo "-----> Deploying $APP ..."
|
||||
dokku deploy $APP
|
||||
echo "=====> Application deployed:"
|
||||
echo "$(dokku urls $APP | sed "s/^/ /")"
|
||||
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
|
||||
dokku build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
|
||||
dokku_log_info1 "Releasing $APP..."
|
||||
dokku release "$APP" "$IMAGE_SOURCE_TYPE"
|
||||
dokku_log_info1 "Deploying $APP..."
|
||||
dokku deploy "$APP"
|
||||
dokku_log_info2 "Application deployed:"
|
||||
dokku urls "$APP" | sed "s/^/ /"
|
||||
echo
|
||||
;;
|
||||
|
||||
build)
|
||||
APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
id=$(cat | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
||||
pluginhook pre-build $APP
|
||||
id=$(docker run -d -v $CACHE_DIR:/cache $IMAGE /build/builder)
|
||||
docker attach $id
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
pluginhook post-build $APP
|
||||
;;
|
||||
|
||||
release)
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
pluginhook pre-release $APP
|
||||
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
||||
id=$(cat "$DOKKU_ROOT/$APP/ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/app-env.sh")
|
||||
test $(docker wait $id) -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
fi
|
||||
pluginhook post-release $APP
|
||||
;;
|
||||
|
||||
deploy)
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
pluginhook pre-deploy $APP
|
||||
@@ -75,40 +71,56 @@ case "$1" in
|
||||
fi
|
||||
|
||||
# start the app
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP)
|
||||
id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE /bin/bash -c "/start web")
|
||||
port=$(docker port $id 5000 | sed 's/[0-9.]*://')
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy)
|
||||
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP)
|
||||
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
|
||||
|
||||
is_image_buildstep_based "$IMAGE" && DOKKU_BUILDSTEP=true
|
||||
[[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start web"
|
||||
[[ -z "$DOKKU_BUILDSTEP" ]] && DOKKU_DOCKERFILE_PORT=$(dokku config:get $APP DOKKU_DOCKERFILE_PORT || true)
|
||||
|
||||
if [[ "$BIND_EXTERNAL" = "false" ]];then
|
||||
port=${DOKKU_DOCKERFILE_PORT:=5000}
|
||||
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id)
|
||||
else
|
||||
id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE $START_CMD)
|
||||
port=$(docker port $id 5000 | sed 's/[0-9.]*://')
|
||||
ipaddr=127.0.0.1
|
||||
fi
|
||||
|
||||
# if we can't post-deploy successfully, kill new container
|
||||
function kill_new {
|
||||
docker inspect $id &> /dev/null && docker kill $id > /dev/null
|
||||
kill_new() {
|
||||
docker inspect $id &> /dev/null && docker stop $id > /dev/null && docker kill $id > /dev/null
|
||||
trap - INT TERM EXIT
|
||||
kill -9 $$
|
||||
}
|
||||
|
||||
# run checks first, then post-deploy hooks, which switches Nginx traffic
|
||||
trap kill_new INT TERM EXIT
|
||||
echo "-----> Running pre-flight checks"
|
||||
pluginhook check-deploy $id $APP $port
|
||||
dokku_log_info1 "Running pre-flight checks"
|
||||
pluginhook check-deploy $APP $port $ipaddr $id
|
||||
trap - INT TERM EXIT
|
||||
|
||||
# now using the new container
|
||||
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
|
||||
echo $ipaddr > "$DOKKU_ROOT/$APP/IP"
|
||||
echo $port > "$DOKKU_ROOT/$APP/PORT"
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
|
||||
|
||||
echo "-----> Running post-deploy"
|
||||
pluginhook post-deploy $APP $port
|
||||
trap - INT TERM EXIT
|
||||
dokku_log_info1 "Running post-deploy"
|
||||
pluginhook post-deploy $APP $port $ipaddr
|
||||
|
||||
# kill the old container
|
||||
if [[ -n "$oldid" ]]; then
|
||||
# Let the old container finish processing requests, before terminating it
|
||||
WAIT="${DOKKU_WAIT_TO_RETIRE:-60}"
|
||||
echo "-----> Shutting down old container in $WAIT seconds"
|
||||
dokku_log_info1 "Shutting down old container in $WAIT seconds"
|
||||
(
|
||||
exec >/dev/null 2>/dev/null </dev/null
|
||||
trap '' INT HUP
|
||||
sleep $WAIT
|
||||
docker stop $oldid
|
||||
docker kill $oldid
|
||||
) & disown -a
|
||||
# Use trap since disown/nohup don't seem to keep child alive
|
||||
@@ -120,9 +132,11 @@ case "$1" in
|
||||
|
||||
cleanup)
|
||||
# delete all non-running container
|
||||
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm &> /dev/null &
|
||||
# shellcheck disable=SC2046
|
||||
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null &
|
||||
# delete unused images
|
||||
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi &> /dev/null &
|
||||
# shellcheck disable=SC2046
|
||||
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
|
||||
;;
|
||||
|
||||
plugins)
|
||||
@@ -141,17 +155,16 @@ case "$1" in
|
||||
pluginhook update
|
||||
;;
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
# DEPRECATED as of v0.3.14
|
||||
deploy:all)
|
||||
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
|
||||
APP=$(basename $(dirname $app));
|
||||
dokku deploy $APP
|
||||
done
|
||||
echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions"
|
||||
dokku ps:restartall
|
||||
;;
|
||||
|
||||
help|'')
|
||||
echo "Usage: dokku COMMAND <app> [command-specific-options]"
|
||||
echo "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND <app> [command-specific-options]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
|
||||
cat<<EOF | pluginhook commands help | sort
|
||||
help Print the list of commands
|
||||
@@ -163,21 +176,21 @@ EOF
|
||||
|
||||
*)
|
||||
implemented=0
|
||||
for script in $(ls -d $PLUGIN_PATH/*/commands); do
|
||||
for script in $PLUGIN_PATH/*/commands; do
|
||||
set +e; $script "$@" ; exit_code=$? ; set -e
|
||||
if [ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]; then
|
||||
if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
implemented=1
|
||||
if [ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]; then
|
||||
if [[ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]]; then
|
||||
exit $exit_code
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$implemented" -eq 0 ]; then
|
||||
echo " ! \`$@\` is not a dokku command."
|
||||
echo " ! See \`dokku help\` for a list of available commands."
|
||||
if [[ "$implemented" -eq 0 ]]; then
|
||||
dokku_log_warn "\`$*\` is not a dokku command."
|
||||
dokku_log_warn "See \`dokku help\` for a list of available commands."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
77
dokku.1
77
dokku.1
@@ -1,77 +0,0 @@
|
||||
.TH DOKKU 1 2014-11-22
|
||||
.\"Make sure to change that date when you commit a change!
|
||||
.\"
|
||||
.SH NAME
|
||||
dokku \- configure and get information from your dokku installation
|
||||
.\"
|
||||
.SH SYNOPSIS
|
||||
.B dokku
|
||||
.I <command>
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
.B dokku
|
||||
is a catch-all command to configure your apps,
|
||||
work with plugins and inspect the current state of your server.
|
||||
.\"
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI apps:create " <app>"
|
||||
Create a new app.
|
||||
.TP
|
||||
.BI apps:destroy " <app>"
|
||||
Permanantly destroy an app.
|
||||
.TP
|
||||
.B apps
|
||||
List your apps.
|
||||
.TP
|
||||
.BI backup:import " file"
|
||||
Import dokku config files.
|
||||
.TP
|
||||
.BI backup:export " file"
|
||||
Export dokku config files.
|
||||
.TP
|
||||
.BI config " <app>"
|
||||
Display the config vars for an app.
|
||||
.TP
|
||||
.BI config:get " <app> KEY"
|
||||
Display a specific config var for an app.
|
||||
.TP
|
||||
.BI config:set " <app> KEY1=VAL1" \fR\ (KEY2=VAL2\ \.\.\.)
|
||||
Set one or more config vars for an app.
|
||||
.TP
|
||||
.BI config:unset " <app> KEY1" \fR\ (KEY2\ \.\.\.)
|
||||
Remove one or more config vars from an app.
|
||||
.TP
|
||||
.B help
|
||||
Print the list of commands.
|
||||
.TP
|
||||
.B logs \ \fI<app> \fR[\fI-t\fR]
|
||||
Show the last logs for an application (-t follows)
|
||||
.TP
|
||||
.BI nginx:import-ssl " <app>"
|
||||
Imports a tarball from stdin which should contain
|
||||
server\.crt and server\.key
|
||||
.TP
|
||||
.B plugins-install
|
||||
Install active plugins.
|
||||
.TP
|
||||
.B plugins-update
|
||||
Update active plugins.
|
||||
.TP
|
||||
.B plugins
|
||||
Print active plugins.
|
||||
.TP
|
||||
.BI run " <app> command"
|
||||
Run a command in the environment of an app.
|
||||
.TP
|
||||
.BI url " <app>"
|
||||
Show the url for an app.
|
||||
.TP
|
||||
.B version
|
||||
Print dokku's version.
|
||||
.\"
|
||||
.SH NOTES
|
||||
This man page does not include commands added
|
||||
by non-default plugins. To see the full list
|
||||
of commands available to your current dokku
|
||||
installation, run \fBdokku help\fR.
|
||||
@@ -8,7 +8,7 @@ TARGET_DIR="$3"
|
||||
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
|
||||
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
||||
mkdir -p $TARGET_DIR/.ssh
|
||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
|
||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > tmpfile && mv tmpfile $TARGET_DIR/.ssh/authorized_keys
|
||||
chmod 0700 $TARGET_DIR/.ssh
|
||||
chmod 0600 $TARGET_DIR/.ssh/*
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,91 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
case "$1" in
|
||||
build)
|
||||
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
|
||||
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
|
||||
pushd "$TMP_WORK_DIR" &> /dev/null
|
||||
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
buildstep)
|
||||
id=$(tar -c . | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook pre-build` will be removed in future releases
|
||||
pluginhook pre-build "$APP"
|
||||
pluginhook pre-build-buildstep "$APP"
|
||||
|
||||
# *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases
|
||||
# https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP build)
|
||||
DOCKER_ARGS+=$(: | pluginhook docker-args-build $APP)
|
||||
id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build/builder)
|
||||
docker attach $id
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook post-build` will be removed in future releases
|
||||
pluginhook post-build "$APP"
|
||||
pluginhook post-build-buildstep "$APP"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# extract first port from Dockerfile
|
||||
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true)
|
||||
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
|
||||
|
||||
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
pluginhook pre-build-dockerfile "$APP"
|
||||
|
||||
docker build -t "$IMAGE" .
|
||||
|
||||
pluginhook post-build-dockerfile "$APP"
|
||||
;;
|
||||
|
||||
*)
|
||||
dokku_log_fail "Building image source type $IMAGE_SOURCE_TYPE not supported!"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
release)
|
||||
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"
|
||||
case "$IMAGE_SOURCE_TYPE" in
|
||||
buildstep)
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook pre-release` will be removed in future releases
|
||||
pluginhook pre-release "$APP"
|
||||
pluginhook pre-release-buildstep "$APP"
|
||||
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
|
||||
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh" < "$DOKKU_ROOT/ENV")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
||||
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh" < "$DOKKU_ROOT/$APP/ENV")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
fi
|
||||
# *DEPRECATED* in v0.4.0: `pluginhook post-release` will be removed in future releases
|
||||
pluginhook post-release "$APP"
|
||||
pluginhook post-release-buildstep "$APP"
|
||||
;;
|
||||
|
||||
dockerfile)
|
||||
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
pluginhook pre-release-dockerfile "$APP"
|
||||
pluginhook post-release-dockerfile "$APP"
|
||||
;;
|
||||
|
||||
*)
|
||||
dokku_log_fail "Releasing image source type $IMAGE_SOURCE_TYPE not supported!"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
trace)
|
||||
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p $DOKKU_ROOT/.dokkurc
|
||||
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
|
||||
@@ -24,9 +108,23 @@ case "$1" in
|
||||
dokku apps:destroy $2
|
||||
;;
|
||||
|
||||
ls)
|
||||
apps=$(ls -d $DOKKU_ROOT/*/ 2>/dev/null) || (echo "You haven't depoyed any applications yet" && exit 1)
|
||||
|
||||
dokku_col_log_info2_quiet "App Name" "Container id"
|
||||
|
||||
for app in $apps; do
|
||||
if [[ -f $app/CONTAINER ]]; then
|
||||
dokku_col_log_msg "$(basename $app)" "$(< $app/CONTAINER)"
|
||||
else
|
||||
dokku_col_log_msg "$(basename $app)"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
logs)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2";
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
@@ -43,36 +141,44 @@ case "$1" in
|
||||
|
||||
run)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
|
||||
shift 2
|
||||
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP)
|
||||
docker run -i -t $DOCKER_ARGS $IMAGE /exec "$@"
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP run)
|
||||
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP)
|
||||
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
|
||||
has_tty && DOKKU_RUN_OPTS+=" -i -t"
|
||||
is_image_buildstep_based "$IMAGE" && EXEC_CMD="/exec"
|
||||
|
||||
docker run $DOKKU_RUN_OPTS $DOCKER_ARGS $IMAGE $EXEC_CMD "$@"
|
||||
;;
|
||||
|
||||
url | urls)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2"; SCHEME="http"; SSL="$DOKKU_ROOT/$APP/tls"
|
||||
verify_app_name "$2"
|
||||
APP="$2";
|
||||
|
||||
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
|
||||
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then
|
||||
case "$1" in
|
||||
url)
|
||||
grep "^http" "$DOKKU_ROOT/$APP/URLS" | head -1
|
||||
;;
|
||||
urls)
|
||||
grep "^http" "$DOKKU_ROOT/$APP/URLS"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SCHEME="http"; SSL="$DOKKU_ROOT/$APP/tls"; WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||
if [[ -e "$SSL/server.crt" && -e "$SSL/server.key" ]] || [[ -e "$WILDCARD_SSL/server.crt" && -e "$WILDCARD_SSL/server.key" ]]; then
|
||||
SCHEME="https"
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
case "$1" in
|
||||
url)
|
||||
echo "$SCHEME://$(head -n1 "$DOKKU_ROOT/$APP/VHOST")"
|
||||
;;
|
||||
urls)
|
||||
for vhost in $(< "$DOKKU_ROOT/$APP/VHOST"); do
|
||||
echo "$SCHEME://$vhost"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
elif [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
|
||||
else
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$DOKKU_ROOT/$APP/PORT")"
|
||||
@@ -88,6 +194,7 @@ case "$1" in
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
ls Pretty listing of deployed applications and containers
|
||||
logs <app> [-t] Show the last logs for an application (-t follows)
|
||||
run <app> <cmd> Run a command in the environment of an application
|
||||
url <app> Show the first URL for an application (compatibility)
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||
hostname -f > $DOKKU_ROOT/HOSTNAME
|
||||
fi
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
fi
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
@@ -16,11 +16,11 @@ case "$DOKKU_DISTRO" in
|
||||
cat<<EOF > /etc/init/dokku-redeploy.conf
|
||||
description "Dokku app redeploy service"
|
||||
|
||||
start on (started docker)
|
||||
start on filesystem and started docker
|
||||
|
||||
script
|
||||
sleep 2 # give docker some time
|
||||
sudo -i -u dokku /usr/local/bin/dokku deploy:all
|
||||
sudo -i -u dokku /usr/local/bin/dokku ps:restartall
|
||||
end script
|
||||
EOF
|
||||
;;
|
||||
@@ -34,10 +34,25 @@ After=docker.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=dokku
|
||||
ExecStart=/usr/local/bin/dokku deploy:all
|
||||
ExecStart=/usr/local/bin/dokku ps:restartall
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
cat<<EOF > /etc/update-motd.d/99-dokku
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "/home/dokku/HOSTNAME" ]; then
|
||||
echo "\nTo avoid cli-based dokku configuration, use the web installer"
|
||||
echo "Debian-based installs should have this running and available"
|
||||
echo "on port 80. You can also install it via the following commands:"
|
||||
echo ""
|
||||
echo " cd /root/dokku"
|
||||
echo " sudo make dokku-installer\n"
|
||||
fi
|
||||
EOF
|
||||
chmod +x /etc/update-motd.d/99-dokku
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
case "$1" in
|
||||
apps)
|
||||
echo "=== My Apps"
|
||||
dokku_log_info2_quiet "My Apps"
|
||||
find $DOKKU_ROOT -follow -maxdepth 1 -type d \( ! -iname ".*" \) -not -path $DOKKU_ROOT/tls | sed 's|^\./||g' | sed 's|'$DOKKU_ROOT'\/||' | tail -n +2 | sort
|
||||
;;
|
||||
|
||||
apps:create)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ -d "$DOKKU_ROOT/$2" ]] && echo " ! Name is already taken" && exit 1
|
||||
[[ -d "$DOKKU_ROOT/$2" ]] && dokku_log_warn "Name is already taken" && exit 1
|
||||
APP="$2"
|
||||
|
||||
mkdir -p "$DOKKU_ROOT/$APP"
|
||||
@@ -18,19 +19,22 @@ case "$1" in
|
||||
|
||||
apps:destroy)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
[[ "$2" == "tls" ]] && echo "Unable to destroy tls directory" && exit 1
|
||||
APP="$2"; IMAGE="dokku/$APP";
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
|
||||
echo " ! WARNING: Potentially Destructive Action"
|
||||
echo " ! This command will destroy $APP (including all add-ons)."
|
||||
echo " ! To proceed, type \"$APP\""
|
||||
echo ""
|
||||
[[ "$3" == "force" ]] && DOKKU_APPS_FORCE_DELETE=1
|
||||
if [[ -z "$DOKKU_APPS_FORCE_DELETE" ]]; then
|
||||
dokku_log_warn "WARNING: Potentially Destructive Action"
|
||||
dokku_log_warn "This command will destroy $APP (including all add-ons)."
|
||||
dokku_log_warn "To proceed, type \"$APP\""
|
||||
echo ""
|
||||
|
||||
read -p "> " app_name
|
||||
if [[ "$app_name" != "$APP" ]]; then
|
||||
echo " ! Confirmation did not match $APP. Aborted."
|
||||
exit 1
|
||||
read -p "> " app_name
|
||||
if [[ "$app_name" != "$APP" ]]; then
|
||||
dokku_log_warn "Confirmation did not match $APP. Aborted."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Destroying $APP (including all add-ons)"
|
||||
|
||||
@@ -3,5 +3,5 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
if [[ -d $CACHE_DIR ]]; then
|
||||
docker run -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \;
|
||||
docker run --rm -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
fi
|
||||
|
||||
@@ -14,7 +14,7 @@ case "$1" in
|
||||
: | pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
|
||||
|
||||
pushd $BACKUP_DIR > /dev/null
|
||||
ls -d */ | grep -oE '[^/]+' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
popd > /dev/null
|
||||
|
||||
# we want to insert the files in the root of the tar
|
||||
|
||||
@@ -1,31 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
|
||||
|
||||
[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && rm "$DOKKU_ROOT/BUILD_ENV"
|
||||
|
||||
[[ ! $(grep CURL_CONNECT_TIMEOUT "$DOKKU_ROOT/ENV") ]] && echo "export CURL_CONNECT_TIMEOUT=5" >> "$DOKKU_ROOT/ENV"
|
||||
[[ ! $(grep CURL_TIMEOUT "$DOKKU_ROOT/ENV") ]] && echo "export CURL_TIMEOUT=30" >> "$DOKKU_ROOT/ENV"
|
||||
! (grep -q CURL_CONNECT_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_CONNECT_TIMEOUT=5" >> "$DOKKU_ROOT/ENV"
|
||||
! (grep -q CURL_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_TIMEOUT=30" >> "$DOKKU_ROOT/ENV"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
|
||||
BUILD_ENV+=$'\n'
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
|
||||
BUILD_ENV+=$'\n'
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
||||
BUILD_ENV+=" "
|
||||
BUILD_ENV+=$'\n'
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
|
||||
BUILD_ENV+=$'\n'
|
||||
fi
|
||||
|
||||
if [[ ! -z "$BUILD_ENV" ]]; then
|
||||
echo "-----> Adding BUILD_ENV to build environment..."
|
||||
dokku_log_info1 "Adding BUILD_ENV to build environment..."
|
||||
# create build env files for use in buildpacks like this:
|
||||
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
|
||||
id=$(echo $BUILD_ENV |sed 's@export @@g'| docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in `cat`; do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \2 >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
|
||||
test $(docker wait $id) -eq 0
|
||||
id=$(echo $BUILD_ENV |sed -e 's@export @@g' -e 's@\\n@ @g' | docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
|
||||
# create build env for 'old style' buildpacks and dokku plugins
|
||||
id=$(echo "$BUILD_ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
|
||||
test $(docker wait $id) -eq 0
|
||||
id=$(echo -e "$BUILD_ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
fi
|
||||
|
||||
@@ -1,75 +1,195 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Hook to check server against list of checks specified in CHECKS file. Each
|
||||
# check is a relative path and, optionally, expected content.
|
||||
# Hook to check server against list of checks specified in CHECKS file.
|
||||
#
|
||||
# The CHECKS file may contain empty lines, comments (lines starting with #),
|
||||
# settings (NAME=VALUE) and check instructions.
|
||||
#
|
||||
# The format of a check instruction is a path, optionally followed by the
|
||||
# expected content. For example:
|
||||
#
|
||||
# For example:
|
||||
# / My Amazing App
|
||||
# /stylesheets/index.css .body
|
||||
# /scripts/index.js $(function()
|
||||
# /images/logo.png
|
||||
#
|
||||
# Waits 5 seconds, giving server time to start, before running the checks. For
|
||||
# shorter/longer wait, change the DOKKU_CHECKS_WAIT environment variable (value
|
||||
# in seconds).
|
||||
# To check an application that supports multiple hostnames, use relative URLs
|
||||
# that include the hostname, for example:
|
||||
#
|
||||
# //admin.example.com Admin Dashboard
|
||||
# //static.example.com/logo.png
|
||||
#
|
||||
# You can also specify the protocol to explicitly check HTTPS requests.
|
||||
#
|
||||
# The default behavior is to wait for 5 seconds before running the first check,
|
||||
# and timeout each check to 30 seconds.
|
||||
#
|
||||
# By default, checks will be retried 5 times.
|
||||
|
||||
# You can change these by setting WAIT, TIMEOUT and ATTEMPTS to different values, for
|
||||
# example:
|
||||
#
|
||||
# WAIT=30 # Wait 1/2 minute
|
||||
# TIMEOUT=60 # Timeout after a minute
|
||||
# ATTEMPTS=10 # retry checks 10 times
|
||||
#
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
|
||||
APP="$1"; DOKKU_APP_LISTEN_PORT="$2"; DOKKU_APP_LISTEN_IP="$3"; DOKKU_APP_CONTAINER_ID="$4"
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
DOKKU_APP_LISTEN_PORT=$(< "$DOKKU_ROOT/$APP/PORT")
|
||||
fi
|
||||
if [[ -z "$DOKKU_APP_LISTEN_IP" ]] && [[ -f "$DOKKU_ROOT/$APP/IP" ]]; then
|
||||
DOKKU_APP_LISTEN_IP=$(< "$DOKKU_ROOT/$APP/IP")
|
||||
fi
|
||||
if [[ -z "$DOKKU_APP_CONTAINER_ID" ]] && [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
DOKKU_APP_CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
fi
|
||||
|
||||
# source in app env to get DOKKU_CHECKS_WAIT and any other necessary vars
|
||||
|
||||
# source global and in-app envs to get DOKKU_CHECKS_WAIT and any other necessary vars
|
||||
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
# echo "DOKKU_CHECKS_WAIT is $DOKKU_CHECKS_WAIT"
|
||||
FILENAME="$DOKKU_ROOT/$APP/CHECKS"
|
||||
|
||||
# Wait this many seconds (default 5) for server to start before running checks.
|
||||
WAIT="${DOKKU_CHECKS_WAIT:-5}"
|
||||
# Wait this many seconds (default 30) for each response.
|
||||
TIMEOUT="${DOKKU_CHECKS_TIMEOUT:-30}"
|
||||
# use this number of retries for checks
|
||||
ATTEMPTS="${DOKKU_CHECKS_ATTEMPTS:-5}"
|
||||
|
||||
# try to copy CHECKS from container if not in APP dir & quit gracefully if it doesn't exist
|
||||
# docker cp exits with status 1 when run as non-root user when it tries to chown the file
|
||||
# after successfully copying the file. Thus, we suppress stderr.
|
||||
# ref: https://github.com/dotcloud/docker/issues/3986
|
||||
if [[ ! -f "$FILENAME" ]] ; then
|
||||
echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..."
|
||||
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
|
||||
docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true
|
||||
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
||||
echo " CHECKS file not found in container. skipping checks."
|
||||
rm -rf $TMPDIR
|
||||
exit 0
|
||||
else
|
||||
echo " CHECKS file found in container"
|
||||
FILENAME=${TMPDIR}/CHECKS
|
||||
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
|
||||
docker cp $DOKKU_APP_CONTAINER_ID:/app/CHECKS $TMPDIR 2> /dev/null || true
|
||||
|
||||
function cleanup() {
|
||||
echo " removing CHECKS file copied from container"
|
||||
rm -rf $TMPDIR
|
||||
}
|
||||
trap cleanup EXIT
|
||||
fi
|
||||
FILENAME=${TMPDIR}/CHECKS
|
||||
|
||||
cleanup() {
|
||||
rm -rf $TMPDIR
|
||||
dokku_log_info2_quiet "$APP container output:"
|
||||
dokku_container_log_verbose_quiet $DOKKU_APP_CONTAINER_ID
|
||||
dokku_log_info2_quiet "end $APP container output"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
||||
dokku_log_verbose "For more efficient zero downtime deployments, create a file CHECKS."
|
||||
dokku_log_verbose "See http://progrium.viewdocs.io/dokku/checks-examples.md for examples"
|
||||
dokku_log_verbose "CHECKS file not found in container: Running simple container check..."
|
||||
|
||||
rm -rf $TMPDIR
|
||||
|
||||
# simple default check to see if the container stuck around
|
||||
# for more thorough checks, create a CHECKS file
|
||||
DOKKU_DEFAULT_WAIT=$((WAIT+TIMEOUT))
|
||||
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_WAIT seconds ..."
|
||||
sleep $DOKKU_DEFAULT_WAIT
|
||||
|
||||
docker ps -q --no-trunc | grep -q "$DOKKU_APP_CONTAINER_ID" || dokku_log_fail "App container failed to start!!"
|
||||
dokku_log_info1 "Default container check successful!" && exit 0
|
||||
fi
|
||||
|
||||
echo "Waiting $WAIT seconds ..."
|
||||
sleep $WAIT
|
||||
|
||||
# -q do not use .curlrc (must come first)
|
||||
# --compressed Test compression handled correctly
|
||||
# --fail Fail on server errors (4xx, 5xx)
|
||||
# --location Follow redirects
|
||||
CURL_OPTIONS="-q --compressed --fail --location --max-time 30"
|
||||
|
||||
cat "$FILENAME" | while read PATHNAME EXPECTED ; do
|
||||
# Ignore empty lines and lines starting with #
|
||||
[[ -z "$PATHNAME" || "$PATHNAME" =~ ^\# ]] && continue
|
||||
|
||||
URL="http://$HOSTNAME:$PORT$PATHNAME"
|
||||
|
||||
echo "checking with: curl $CURL_OPTIONS $URL"
|
||||
HTML=$(curl $CURL_OPTIONS $URL)
|
||||
if [[ -n "$EXPECTED" && ! "$HTML" =~ "$EXPECTED" ]] ; then
|
||||
echo -e "\033[31m\033[1m$URL: expected to but did not find: \"$EXPECTED\"\033[0m"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\033[32m\033[1m$URL => \"$EXPECTED\"\033[0m"
|
||||
# Reads name/value pairs, sets the WAIT and TIMEOUT variables
|
||||
exec < "$FILENAME"
|
||||
while read LINE ; do
|
||||
# Name/value pair
|
||||
if [[ "$LINE" =~ ^.+= ]] ; then
|
||||
TRIM=${LINE%#*}
|
||||
NAME=${TRIM%=*}
|
||||
VALUE=${TRIM#*=}
|
||||
[[ "$NAME" = "WAIT" ]] && WAIT=$VALUE
|
||||
[[ "$NAME" = "TIMEOUT" ]] && TIMEOUT=$VALUE
|
||||
[[ "$NAME" = "ATTEMPTS" ]] && ATTEMPTS=$VALUE
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\033[32m\033[1mAll checks successful!\033[0m"
|
||||
ATTEMPT=0
|
||||
|
||||
until [[ $SUCCESS == 1 || $ATTEMPT -ge $ATTEMPTS ]]
|
||||
do
|
||||
FAILEDCHECKS=0
|
||||
ATTEMPT=$(( ATTEMPT + 1 ))
|
||||
dokku_log_info1 "Attempt $ATTEMPT/$ATTEMPTS Waiting for $WAIT seconds ..."
|
||||
sleep $WAIT
|
||||
|
||||
|
||||
# -q do not use .curlrc (must come first)
|
||||
# --compressed Test compression handled correctly
|
||||
# --fail Fail on server errors (4xx, 5xx)
|
||||
# --location Follow redirects
|
||||
CURL_OPTIONS="-q --compressed --fail --location --max-time $TIMEOUT"
|
||||
|
||||
|
||||
exec < "$FILENAME"
|
||||
while read CHECK_URL EXPECTED ; do
|
||||
# Ignore empty lines and lines starting with #
|
||||
# shellcheck disable=SC1001
|
||||
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
|
||||
# Ignore variables
|
||||
[[ "$CHECK_URL" =~ ^.+= ]] && continue
|
||||
|
||||
if [[ "$CHECK_URL" =~ ^https?: ]] ; then
|
||||
URL_PROTOCOL=${CHECK_URL%:*}
|
||||
CHECK_URL=${CHECK_URL#*:}
|
||||
else
|
||||
URL_PROTOCOL="http"
|
||||
fi
|
||||
|
||||
if [[ "$CHECK_URL" =~ ^//.+ ]] ; then
|
||||
# To test a URL with specific host name, we still make request to localhost,
|
||||
# but we set Host header to $SEND_HOST.
|
||||
#
|
||||
# The pattern is
|
||||
# //SEND_HOST/PATHNAME
|
||||
UNPREFIXED=${CHECK_URL#//}
|
||||
URL_HOSTNAME=${UNPREFIXED%%/*}
|
||||
URL_PATHNAME=${UNPREFIXED#$URL_HOSTNAME}
|
||||
|
||||
HEADERS="-H Host:$URL_HOSTNAME"
|
||||
else
|
||||
URL_HOSTNAME=localhost
|
||||
URL_PATHNAME=$CHECK_URL
|
||||
fi
|
||||
|
||||
# This URL will show up in the messages
|
||||
LOG_URL="$URL_PROTOCOL://$URL_HOSTNAME$URL_PATHNAME"
|
||||
# And how we formulate the CURL request
|
||||
CURL_ARGS="$CURL_OPTIONS $URL_PROTOCOL://$DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT$URL_PATHNAME $HEADERS"
|
||||
|
||||
dokku_log_verbose "CHECKS expected result:"
|
||||
dokku_log_verbose "$LOG_URL => \"$EXPECTED\""
|
||||
[[ $DOKKU_TRACE ]] && dokku_log_verbose "$ curl $CURL_ARGS"
|
||||
|
||||
# Capture HTTP response or CURL error message
|
||||
if OUTPUT=$(curl -# $CURL_ARGS 2>&1) ; then
|
||||
# OUTPUT contains the HTTP response
|
||||
if [[ ! "$OUTPUT" =~ $EXPECTED ]] ; then
|
||||
dokku_log_warn "$LOG_URL: expected to but did not find: \"$EXPECTED\""
|
||||
FAILEDCHECKS=$(( FAILEDCHECKS + 1 ))
|
||||
fi
|
||||
else
|
||||
# Failed to connect/no response, OUTPUT contains error message
|
||||
dokku_log_warn "$OUTPUT"
|
||||
FAILEDCHECKS=$(( FAILEDCHECKS + 1 ))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILEDCHECKS -gt 0 ]; then
|
||||
dokku_log_warn "Check attempt $ATTEMPT/$ATTEMPTS failed."
|
||||
SUCCESS=0
|
||||
else
|
||||
SUCCESS=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILEDCHECKS -gt 0 ]; then
|
||||
dokku_log_fail "Could not start due to $FAILEDCHECKS failed checks."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dokku_log_info1 "All checks successful!"
|
||||
|
||||
137
plugins/common/functions
Executable file
137
plugins/common/functions
Executable file
@@ -0,0 +1,137 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
has_tty() {
|
||||
if [[ "$(/usr/bin/tty || true)" == "not a tty" ]]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_log_info1() {
|
||||
echo "-----> $@"
|
||||
}
|
||||
|
||||
dokku_log_info2() {
|
||||
echo "=====> $@"
|
||||
}
|
||||
|
||||
dokku_log_info1_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
echo "-----> $@"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_log_info2_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
echo "=====> $@"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_col_log_info1() {
|
||||
printf "%-40s %-40s\n" "-----> $@"
|
||||
}
|
||||
|
||||
dokku_col_log_info1_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
printf "%-40s %-40s\n" "-----> $@"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_col_log_info2() {
|
||||
printf "%-40s %-40s\n" "=====> $@"
|
||||
}
|
||||
|
||||
dokku_col_log_info2_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
printf "%-40s %-40s\n" "=====> $@"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_col_log_msg() {
|
||||
printf "%-40s %-40s\n" "$@"
|
||||
}
|
||||
|
||||
dokku_col_log_msg_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
printf "%-40s %-40s\n" "$@"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_log_verbose_quiet() {
|
||||
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
|
||||
echo " $@"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
dokku_log_verbose() {
|
||||
echo " $@"
|
||||
}
|
||||
|
||||
dokku_log_warn() {
|
||||
echo " ! $@"
|
||||
}
|
||||
|
||||
dokku_log_fail() {
|
||||
echo "$@" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
dokku_container_log_verbose_quiet() {
|
||||
CID=$1;
|
||||
shift
|
||||
|
||||
OIFS=$IFS
|
||||
IFS=$'\n'
|
||||
for line in $(docker logs $CID 2>&1); do
|
||||
dokku_log_verbose_quiet "$line"
|
||||
done
|
||||
IFS=$OIFS
|
||||
}
|
||||
|
||||
verify_app_name() {
|
||||
local APP="$1"
|
||||
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
||||
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
|
||||
IMAGE="dokku/$APP"
|
||||
return 0
|
||||
}
|
||||
|
||||
is_image_buildstep_based() {
|
||||
# circleci can't support --rm as they run lxc in lxc
|
||||
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
|
||||
docker run --entrypoint="/bin/bash" $DOCKER_ARGS "$@" -c "[[ -f /exec ]]"
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--quiet)
|
||||
export DOKKU_QUIET_OUTPUT=1
|
||||
;;
|
||||
--trace)
|
||||
export DOKKU_TRACE=1
|
||||
;;
|
||||
--rm-container|--rm)
|
||||
export DOKKU_RM_CONTAINER=1
|
||||
;;
|
||||
--force)
|
||||
export DOKKU_APPS_FORCE_DELETE=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return 0
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
ENV_FILE="$DOKKU_ROOT/$2/ENV"
|
||||
ENV_FILE_TEMP="$DOKKU_ROOT/$2/ENV.tmp"
|
||||
@@ -15,46 +16,32 @@ config_styled_hash () {
|
||||
|
||||
longest=""
|
||||
while read -r word; do
|
||||
KEY=`echo $word | cut -d"=" -f1`
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
if [ ${#KEY} -gt ${#longest} ]; then
|
||||
longest=$KEY
|
||||
fi
|
||||
done <<< "$vars"
|
||||
|
||||
while read -r word; do
|
||||
KEY=`echo $word | cut -d"=" -f1`
|
||||
VALUE=`echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"`
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//")
|
||||
|
||||
num_zeros=$((${#longest} - ${#KEY}))
|
||||
zeros=" "
|
||||
while [ $num_zeros -gt 0 ]; do
|
||||
zeros="$zeros "
|
||||
num_zeros=$(($num_zeros - 1))
|
||||
num_zeros=$((num_zeros - 1))
|
||||
done
|
||||
echo "$prefix$KEY:$zeros$VALUE"
|
||||
done <<< "$vars"
|
||||
}
|
||||
|
||||
config_restart_app() {
|
||||
APP="$1";
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
echo "-----> Releasing $APP ..."
|
||||
dokku release $APP
|
||||
echo "-----> Release complete!"
|
||||
echo "-----> Deploying $APP ..."
|
||||
dokku deploy $APP
|
||||
echo "-----> Deploy complete!"
|
||||
fi
|
||||
}
|
||||
|
||||
config_write() {
|
||||
ENV_TEMP="$1"
|
||||
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
|
||||
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
|
||||
cp -f $ENV_FILE_TEMP $ENV_FILE
|
||||
chmod 600 $ENV_FILE
|
||||
config_restart_app $APP
|
||||
fi
|
||||
rm -f $ENV_FILE_TEMP
|
||||
}
|
||||
@@ -62,13 +49,13 @@ config_write() {
|
||||
case "$1" in
|
||||
config)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
config_create
|
||||
[[ ! -s $ENV_FILE ]] && echo "$APP has no config vars" && exit 1
|
||||
|
||||
VARS=`cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | cut -d" " -f2-`
|
||||
VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
|
||||
|
||||
for var in "$@"; do
|
||||
if [[ "$var" == "--shell" ]]; then
|
||||
@@ -77,13 +64,13 @@ case "$1" in
|
||||
fi
|
||||
done
|
||||
|
||||
echo "=== $APP config vars ==="
|
||||
dokku_log_info2_quiet "$APP config vars"
|
||||
config_styled_hash "$VARS"
|
||||
;;
|
||||
|
||||
config:get)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
@@ -99,12 +86,29 @@ case "$1" in
|
||||
|
||||
KEY="$3"
|
||||
|
||||
cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
|
||||
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
|
||||
;;
|
||||
|
||||
config:set)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
dokku config:set-norestart $APP "$@"
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart $APP
|
||||
;;
|
||||
|
||||
config:set-norestart)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
@@ -115,7 +119,7 @@ case "$1" in
|
||||
|
||||
config_create
|
||||
ENV_ADD=""
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
RESTART_APP=false
|
||||
shift 2
|
||||
|
||||
@@ -128,8 +132,8 @@ case "$1" in
|
||||
done
|
||||
|
||||
for var; do
|
||||
KEY=`echo ${var} | cut -d"=" -f1`
|
||||
VALUE=`echo ${var} | cut -d"=" -f2-`
|
||||
KEY=$(echo ${var} | cut -d"=" -f1)
|
||||
VALUE=$(echo ${var} | cut -d"=" -f2-)
|
||||
|
||||
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
|
||||
RESTART_APP=true
|
||||
@@ -143,7 +147,7 @@ ${var}"
|
||||
ENV_ADD=$(echo "$ENV_ADD" | tail -n +2) #remove first empty line
|
||||
|
||||
if [ $RESTART_APP ]; then
|
||||
echo "-----> Setting config vars and restarting $APP"
|
||||
dokku_log_info1 "Setting config vars"
|
||||
config_styled_hash "$ENV_ADD" " "
|
||||
|
||||
config_write "$ENV_TEMP"
|
||||
@@ -152,7 +156,24 @@ ${var}"
|
||||
|
||||
config:unset)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
|
||||
echo "Must specify KEY to unset."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
dokku config:unset-norestart $APP "$@"
|
||||
dokku_log_info1 "Restarting app $APP"
|
||||
dokku ps:restart $APP
|
||||
;;
|
||||
|
||||
config:unset-norestart)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
@@ -162,11 +183,11 @@ ${var}"
|
||||
fi
|
||||
|
||||
config_create
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
VARS="${*:3}"
|
||||
|
||||
for var in $VARS; do
|
||||
echo "-----> Unsetting $var and restarting $APP"
|
||||
dokku_log_info1 "Unsetting $var"
|
||||
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
|
||||
|
||||
config_write "$ENV_TEMP"
|
||||
|
||||
16
plugins/config/docker-args-deploy
Executable file
16
plugins/config/docker-args-deploy
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
STDIN=$(cat); APP="$1"; IMAGE="dokku/$APP"
|
||||
DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
|
||||
|
||||
if ! is_image_buildstep_based "$IMAGE"; then
|
||||
> "$DOCKERFILE_ENV_FILE"
|
||||
[[ -f "$DOKKU_ROOT/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/ENV" > "$DOCKERFILE_ENV_FILE"
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && sed -e "s:^export ::g" -e "s:=':=:g" -e "s:'$::g" "$DOKKU_ROOT/$APP/ENV" >> "$DOCKERFILE_ENV_FILE"
|
||||
|
||||
echo "$STDIN --env-file=$DOCKERFILE_ENV_FILE"
|
||||
else
|
||||
echo "$STDIN"
|
||||
fi
|
||||
1
plugins/config/docker-args-run
Symbolic link
1
plugins/config/docker-args-run
Symbolic link
@@ -0,0 +1 @@
|
||||
docker-args-deploy
|
||||
153
plugins/docker-options/commands
Executable file
153
plugins/docker-options/commands
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
PHASES=(build deploy run)
|
||||
|
||||
FILE_PREFIX="DOCKER_OPTIONS_"
|
||||
|
||||
get_app() {
|
||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$1"
|
||||
APP="$1"
|
||||
}
|
||||
|
||||
get_phases() {
|
||||
local passed_phases_list=$1
|
||||
local phase
|
||||
if [[ -n $passed_phases_list ]]; then
|
||||
IFS=',' read -ra passed_phases <<< "$passed_phases_list"
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
verify_phase $phase
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
verify_phase() {
|
||||
local phase
|
||||
for phase in "${PHASES[@]}"; do
|
||||
if [[ "$phase" = "$1" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
dokku_log_fail "Phase(s) must be one of [${PHASES[@]}]"
|
||||
}
|
||||
|
||||
get_phase_file_path() {
|
||||
local phase=$1
|
||||
phase_file_path="${DOKKU_ROOT}/${APP}/${FILE_PREFIX}${phase^^}"
|
||||
}
|
||||
|
||||
create_phase_file_if_required() {
|
||||
local phase_file_path=$1
|
||||
[[ -f $phase_file_path ]] || {
|
||||
touch $phase_file_path
|
||||
}
|
||||
}
|
||||
|
||||
display_phase_options() {
|
||||
local phase=$1
|
||||
local phase_file_path=$2
|
||||
echo "${phase^} options:"
|
||||
sed -e 's/^/ /' $phase_file_path
|
||||
}
|
||||
|
||||
display_all_phases_options() {
|
||||
for phase in "${PHASES[@]}"; do
|
||||
get_phase_file_path $phase
|
||||
if [[ -s $phase_file_path ]] ; then
|
||||
display_phase_options $phase $phase_file_path
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
display_passed_phases_options() {
|
||||
local passed_phases=("${!1}")
|
||||
local phase
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
get_phase_file_path $phase
|
||||
if [ ! -s $phase_file_path ] ; then
|
||||
echo "${phase^} options: none"
|
||||
else
|
||||
display_phase_options $phase $phase_file_path
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
get_passed_docker_option() {
|
||||
[[ -z "$@" ]] && dokku_log_fail "Please specify docker options to add to the phase"
|
||||
passed_docker_option=("$@")
|
||||
}
|
||||
|
||||
add_passed_docker_option() {
|
||||
local passed_phases=("${!1}")
|
||||
local passed_option_string=$2
|
||||
local phase
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
get_phase_file_path $phase
|
||||
create_phase_file_if_required $phase_file_path
|
||||
echo "${passed_option_string}" >> $phase_file_path
|
||||
all_phase_options=$(< $phase_file_path)
|
||||
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u > $phase_file_path
|
||||
done
|
||||
}
|
||||
|
||||
remove_passed_docker_option() {
|
||||
local passed_phases=("${!1}")
|
||||
local passed_option_string=$2
|
||||
local phase
|
||||
for phase in "${passed_phases[@]}"; do
|
||||
get_phase_file_path $phase
|
||||
[[ ! -s $phase_file_path ]] || {
|
||||
all_phase_options=$(< $phase_file_path)
|
||||
all_phase_options=$(echo -e "${all_phase_options}" | sed "s#^${passed_option_string}\$##")
|
||||
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u > $phase_file_path
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
# Display applications docker options
|
||||
docker-options)
|
||||
get_app $2
|
||||
get_phases $3
|
||||
if [[ ! "${passed_phases[@]}" ]]; then
|
||||
display_all_phases_options
|
||||
else
|
||||
display_passed_phases_options passed_phases[@]
|
||||
fi
|
||||
;;
|
||||
|
||||
# Add a docker option to application
|
||||
docker-options:add)
|
||||
get_app $2
|
||||
get_phases $3
|
||||
shift 3 # everything else passed is the docker option
|
||||
get_passed_docker_option "$@"
|
||||
add_passed_docker_option passed_phases[@] "${passed_docker_option[@]}"
|
||||
;;
|
||||
|
||||
# Remove a docker option from application
|
||||
docker-options:remove)
|
||||
get_app $2
|
||||
get_phases $3
|
||||
shift 3 # everything else passed is the docker option
|
||||
get_passed_docker_option "$@"
|
||||
remove_passed_docker_option passed_phases[@] "${passed_docker_option[@]}"
|
||||
;;
|
||||
|
||||
# Display usage help
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
docker-options <app> Display apps docker options for all phases
|
||||
docker-options <app> <phase(s)> Display apps docker options for phase (comma seperated phase list)
|
||||
docker-options:add <app> <phase(s)> OPTION Add docker option to app for phase (comma seperated phase list)
|
||||
docker-options:remove <app> <phase(s)> OPTION Remove docker option from app for phase (comma seperated phase list)
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
1
plugins/docker-options/docker-args-build
Symbolic link
1
plugins/docker-options/docker-args-build
Symbolic link
@@ -0,0 +1 @@
|
||||
docker-args-deploy
|
||||
43
plugins/docker-options/docker-args-deploy
Executable file
43
plugins/docker-options/docker-args-deploy
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
STDIN=$(cat)
|
||||
APP="$1"
|
||||
|
||||
case "$0" in
|
||||
*docker-args-build)
|
||||
PHASE=BUILD
|
||||
;;
|
||||
*docker-args-deploy)
|
||||
PHASE=DEPLOY
|
||||
;;
|
||||
*docker-args-run)
|
||||
PHASE=RUN
|
||||
;;
|
||||
esac
|
||||
|
||||
FILE_PREFIX="DOCKER_OPTIONS_"
|
||||
PHASE_FILE_PATH="${DOKKU_ROOT}/${APP}/${FILE_PREFIX}${PHASE}"
|
||||
|
||||
output=""
|
||||
|
||||
if [[ -f "$PHASE_FILE_PATH" ]]; then
|
||||
DONE=false
|
||||
until $DONE; do
|
||||
read line || DONE=true
|
||||
|
||||
[[ ! -n "$line" ]] && continue
|
||||
|
||||
# shellcheck disable=SC1001
|
||||
case "$line" in
|
||||
\#*)
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
output="$output $line"
|
||||
;;
|
||||
esac
|
||||
done < $PHASE_FILE_PATH
|
||||
fi
|
||||
|
||||
echo "$STDIN$output"
|
||||
1
plugins/docker-options/docker-args-run
Symbolic link
1
plugins/docker-options/docker-args-run
Symbolic link
@@ -0,0 +1 @@
|
||||
docker-args-deploy
|
||||
@@ -1,20 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
|
||||
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
RE_IPV4="${RE_IPV4}\$"
|
||||
RE_IPV6="${RE_IPV6}\$"
|
||||
|
||||
case "$1" in
|
||||
domains)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
dokku domains:setup $APP
|
||||
echo "=== $APP Domain Names"
|
||||
dokku_log_info2_quiet "$APP Domain Names"
|
||||
cat "$DOKKU_ROOT/$APP/VHOST"
|
||||
;;
|
||||
|
||||
domains:setup)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"; VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
|
||||
if [[ ! -f $VHOST_PATH ]]; then
|
||||
@@ -23,76 +44,90 @@ case "$1" in
|
||||
else
|
||||
VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
fi
|
||||
if [[ "$VHOST" =~ ([0-9]{1,3}[\.]){3}[0-9]{1,3} ]];then
|
||||
echo "ip found as hostname. disabling vhost support"
|
||||
[[ ! $(grep -q NO_VHOST "$DOKKU_ROOT/$APP/ENV") ]] && echo "export NO_VHOST='1'" >> "$DOKKU_ROOT/$APP/ENV"
|
||||
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
|
||||
dokku_log_info2 "unsupported vhost config found. disabling vhost support"
|
||||
dokku config:set-norestart $APP NO_VHOST=1
|
||||
else
|
||||
echo "-----> Creating new $VHOST_PATH..."
|
||||
SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
|
||||
if [[ ! -n $hostname ]]; then
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
else
|
||||
hostname="${APP/\//-}.$VHOST"
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
dokku_log_info1 "Creating new $VHOST_PATH..."
|
||||
SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
|
||||
if [[ ! -n $hostname ]]; then
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
else
|
||||
hostname="${APP/\//-}.$VHOST"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$hostname" > $VHOST_PATH
|
||||
echo "$hostname" > $VHOST_PATH
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
domains:add)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku $1 $APP DOMAIN"
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
|
||||
echo "Must specify DOMAIN."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $(grep $3 "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
if [[ $(egrep ^"$3"$ "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
echo "$3 is already defined for $APP"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
dokku domains:setup $APP
|
||||
echo "$3" >> "$DOKKU_ROOT/$APP/VHOST"
|
||||
for DOMAIN in "$@";do
|
||||
echo "$DOMAIN" >> "$DOKKU_ROOT/$APP/VHOST"
|
||||
done
|
||||
# we need to restart the app to make sure we're binding to the appropriate network interface
|
||||
dokku nginx:build-config $APP
|
||||
pluginhook post-domains-update $APP
|
||||
echo "-----> Added $3 to $APP"
|
||||
for DOMAIN in "$@";do
|
||||
dokku_log_info1 "Added $DOMAIN to $APP"
|
||||
done
|
||||
|
||||
;;
|
||||
|
||||
domains:clear)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
rm -f "$DOKKU_ROOT/$APP/VHOST"
|
||||
dokku domains:setup $APP
|
||||
pluginhook post-domains-update $APP
|
||||
echo "-----> Cleared domains in $APP"
|
||||
dokku_log_info1 "Cleared domains in $APP"
|
||||
|
||||
;;
|
||||
|
||||
domains:remove)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku $1 $2 DOMAIN"
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
|
||||
echo "Must specify DOMAIN."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
dokku domains:setup $APP
|
||||
sed -i "/^$3$/d" "$DOKKU_ROOT/$APP/VHOST"
|
||||
for DOMAIN in "$@";do
|
||||
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
|
||||
done
|
||||
pluginhook post-domains-update $APP
|
||||
echo "-----> Removed $3 from $APP"
|
||||
for DOMAIN in "$@";do
|
||||
dokku_log_info1 "Removed $DOMAIN from $APP"
|
||||
done
|
||||
|
||||
;;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
shopt -s nullglob
|
||||
|
||||
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
|
||||
APP=$(basename $(dirname $app));
|
||||
for app in $DOKKU_ROOT/*/CONTAINER; do
|
||||
APP=$(basename "$(dirname $app)");
|
||||
dokku domains:setup $APP
|
||||
done
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
git_archive_all() {
|
||||
APP=$1; REV=$2
|
||||
git_build_app_repo() {
|
||||
verify_app_name "$1"
|
||||
APP="$1"; REV="$2"
|
||||
|
||||
# clean up after ourselves
|
||||
TMP_WORK_DIR=$(mktemp -d)
|
||||
trap 'rm -rf "$TMP_WORK_DIR" > /dev/null' RETURN
|
||||
|
||||
# git clone
|
||||
chmod 755 $TMP_WORK_DIR
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
git clone -q $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
|
||||
pushd $TMP_WORK_DIR > /dev/null
|
||||
git clone -q "$DOKKU_ROOT/$APP" "$TMP_WORK_DIR" &> /dev/null
|
||||
git config advice.detachedHead false
|
||||
git checkout $REV &> /dev/null
|
||||
git checkout "$REV" &> /dev/null
|
||||
git submodule update --init --recursive &> /dev/null
|
||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||
tar c .
|
||||
popd > /dev/null
|
||||
rm -rf $TMP_WORK_DIR > /dev/null
|
||||
|
||||
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then
|
||||
dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
else
|
||||
dokku receive "$APP" "buildstep" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -26,7 +36,8 @@ case "$1" in
|
||||
# Only run this script for the master branch. You can remove this
|
||||
# if block if you wish to run it for others as well.
|
||||
if [[ $refname = "refs/heads/master" ]] ; then
|
||||
git_archive_all $APP $newrev | dokku receive $APP | sed -u "s/^/"$'\e[1G'"/"
|
||||
# broken out into pluginhook so we might support other methods to receive an app
|
||||
pluginhook receive-app $APP $newrev
|
||||
else
|
||||
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
|
||||
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
|
||||
@@ -41,8 +52,27 @@ case "$1" in
|
||||
pluginhook git-post-pull $APP
|
||||
;;
|
||||
|
||||
git-build)
|
||||
APP="$2"; APP_BUILD_LOCK="$DOKKU_ROOT/$APP/.build.lock"
|
||||
APP_BUILD_LOCK_MSG="$APP is currently being deployed or locked. Waiting..."
|
||||
[[ $(flock -n "$APP_BUILD_LOCK" true &>/dev/null ; echo $?) -ne 0 ]] && echo "$APP_BUILD_LOCK_MSG"
|
||||
|
||||
shift 1
|
||||
flock -o "$APP_BUILD_LOCK" dokku git-build-locked "$@"
|
||||
;;
|
||||
|
||||
git-build-locked)
|
||||
APP="$2"
|
||||
if [[ $# -ge 3 ]];then
|
||||
REF="$3"
|
||||
else
|
||||
REF=$(< "$DOKKU_ROOT/$APP/refs/heads/master")
|
||||
fi
|
||||
git_build_app_repo $APP $REF
|
||||
;;
|
||||
|
||||
git-*)
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
|
||||
APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||
@@ -57,7 +87,11 @@ EOF
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
fi
|
||||
|
||||
args=$@
|
||||
if [[ $1 == "git-receive-pack" ]]; then
|
||||
args="$1 '$APP_PATH'"
|
||||
else
|
||||
args=$*
|
||||
fi
|
||||
git-shell -c "$args"
|
||||
;;
|
||||
|
||||
|
||||
7
plugins/git/receive-app
Executable file
7
plugins/git/receive-app
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
APP="$1"; REV="$2"
|
||||
|
||||
dokku git-build $APP $REV
|
||||
@@ -9,6 +9,6 @@ TARGET_DIR="$3"
|
||||
cd $IMPORT_DIR
|
||||
|
||||
for file in */tls/server.*; do
|
||||
mkdir -p $(dirname $TARGET_DIR$file)
|
||||
mkdir -p "$(dirname $TARGET_DIR$file)"
|
||||
cp $file $TARGET_DIR$file
|
||||
done
|
||||
|
||||
40
plugins/nginx-vhosts/bind-external-ip
Executable file
40
plugins/nginx-vhosts/bind-external-ip
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"
|
||||
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
|
||||
|
||||
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
|
||||
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
|
||||
|
||||
# Ensure the ip address continues to the end of the line
|
||||
# Fixes using a wildcard dns service such as xip.io which allows for *.<ip address>.xip.io
|
||||
RE_IPV4="${RE_IPV4}\$"
|
||||
RE_IPV6="${RE_IPV6}\$"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/VHOST" ]] && GLOBAL_VHOST=$(< "$DOKKU_ROOT/VHOST")
|
||||
|
||||
if [[ -n "$NO_VHOST" ]]; then
|
||||
echo true # bind to external ip. VHOST is disabled
|
||||
elif [[ "$GLOBAL_VHOST" =~ $RE_IPV4 ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV6 ]]; then
|
||||
echo true # bind to external ip. GLOBAL_VHOST is somehow an IPv4 or IPv6 address
|
||||
elif [[ -z "$GLOBAL_VHOST" ]] && [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo true # bind to external ip. no GLOBAL_VHOST and no app vhost
|
||||
elif [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo false # bind to docker ip. this app has a vhost defined
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
@@ -1,5 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
validate_nginx () {
|
||||
set +e
|
||||
sudo /usr/sbin/nginx -t > /dev/null 2>&1
|
||||
exit_code=$?
|
||||
set -e
|
||||
if [[ "$exit_code" -ne "0" ]]; then
|
||||
sudo /usr/sbin/nginx -t
|
||||
exit "$exit_code"
|
||||
fi
|
||||
}
|
||||
|
||||
restart_nginx () {
|
||||
case "$DOKKU_DISTRO" in
|
||||
@@ -15,16 +27,27 @@ restart_nginx () {
|
||||
|
||||
case "$1" in
|
||||
nginx:build-config)
|
||||
APP="$2"; PORT="$3"
|
||||
[[ -z "$PORT" ]] && PORT=$(< "$DOKKU_ROOT/$APP/PORT")
|
||||
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="${4}"
|
||||
verify_app_name "$APP"
|
||||
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
URLS_PATH="$DOKKU_ROOT/$APP/URLS"
|
||||
WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||
SSL="$DOKKU_ROOT/$APP/tls"
|
||||
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
|
||||
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
DOKKU_APP_LISTEN_PORT=$(< "$DOKKU_ROOT/$APP/PORT")
|
||||
fi
|
||||
if [[ -z "$DOKKU_APP_LISTEN_IP" ]] && [[ -f "$DOKKU_ROOT/$APP/IP" ]]; then
|
||||
DOKKU_APP_LISTEN_IP=$(< "$DOKKU_ROOT/$APP/IP")
|
||||
fi
|
||||
|
||||
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
[[ -f "$APP_NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$APP_NGINX_TEMPLATE" && NGINX_CUSTOM_TEMPLATE="true" && dokku_log_info1 'Overriding default nginx.conf with detected nginx.conf.template'
|
||||
|
||||
if [[ ! -n "$NO_VHOST" ]]; then
|
||||
NONSSL_VHOSTS=`cat $VHOST_PATH`
|
||||
if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
NONSSL_VHOSTS=$(cat $VHOST_PATH)
|
||||
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
|
||||
SSL_INUSE="$SSL"
|
||||
SSL_DIRECTIVES=$(cat <<EOF
|
||||
@@ -37,53 +60,71 @@ EOF
|
||||
SSL_DIRECTIVES=""
|
||||
fi
|
||||
|
||||
NGINX_CONF="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf"
|
||||
NGINX_CONF=$(mktemp -t "nginx.conf.XXXXXX")
|
||||
SCHEME="http"
|
||||
if [[ -n "$SSL_INUSE" ]]; then
|
||||
NGINX_CONF="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf"
|
||||
SCHEME="https"
|
||||
|
||||
SSL_HOSTNAME=`openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-`
|
||||
SSL_HOSTNAME=`echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g'`
|
||||
SSL_VHOSTS=`egrep ^"$SSL_HOSTNAME"$ $VHOST_PATH`
|
||||
NONSSL_VHOSTS=`egrep -v ^"$SSL_HOSTNAME"$ $VHOST_PATH || exit 0`
|
||||
[[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
|
||||
SSL_HOSTNAME=$(openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
|
||||
if [[ -n "$SSL_HOSTNAME" ]]; then
|
||||
SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g')
|
||||
[[ -z "$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME" >> $VHOST_PATH
|
||||
fi
|
||||
|
||||
SSL_HOSTNAME_ALT=$(openssl x509 -in $SSL_INUSE/server.crt -noout -text | grep --after-context=1 '509v3 Subject Alternative Name:' | tail -n 1 | sed -e "s/[[:space:]]*DNS://g" | tr ',' '\n' || true)
|
||||
if [[ -n "$SSL_HOSTNAME_ALT" ]]; then
|
||||
SSL_HOSTNAME_ALT_REGEX=$(echo "$SSL_HOSTNAME_ALT" | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g')
|
||||
[[ -z "$(egrep "^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME_ALT" >> $VHOST_PATH
|
||||
fi
|
||||
|
||||
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
|
||||
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
|
||||
|
||||
while read line; do
|
||||
echo "-----> Configuring SSL for $line..."
|
||||
dokku_log_info1 "Configuring SSL for $line..."
|
||||
SSL_SERVER_NAME=$line
|
||||
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
|
||||
NOSSL_SERVER_NAME=$line
|
||||
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
|
||||
done <<< "$SSL_VHOSTS"
|
||||
fi
|
||||
|
||||
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
|
||||
if [[ -f $APP_NGINX_TEMPLATE ]]; then
|
||||
echo "-----> Overriding default nginx.conf with detected nginx.conf.template"
|
||||
NGINX_CONF=$APP_NGINX_TEMPLATE
|
||||
if [[ -n "$NONSSL_VHOSTS" ]]; then
|
||||
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
|
||||
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
|
||||
[[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template"
|
||||
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
|
||||
fi
|
||||
|
||||
cat $VHOST_PATH | xargs -i echo "-----> Configuring {}..."
|
||||
# Include SSL_VHOSTS so we can redirect http to https on that hostname as well
|
||||
NOSSL_SERVER_NAME=`echo $NONSSL_VHOSTS $SSL_VHOSTS| tr '\n' ' '`
|
||||
if [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
echo "upstream $APP { server $DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT; }" >> $NGINX_CONF
|
||||
fi
|
||||
|
||||
echo "-----> Creating $SCHEME nginx.conf"
|
||||
echo "upstream $APP { server 127.0.0.1:$PORT; }" > $DOKKU_ROOT/$APP/nginx.conf
|
||||
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
|
||||
dokku_log_info1 "Creating $SCHEME nginx.conf"
|
||||
mv $NGINX_CONF "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
echo "-----> Running nginx-pre-reload"
|
||||
pluginhook nginx-pre-reload $APP $PORT
|
||||
if [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
dokku_log_info1 "Running nginx-pre-reload"
|
||||
pluginhook nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
|
||||
|
||||
echo " Reloading nginx"
|
||||
restart_nginx
|
||||
dokku_log_verbose "Reloading nginx"
|
||||
validate_nginx
|
||||
restart_nginx
|
||||
fi
|
||||
|
||||
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" > $URLS_PATH
|
||||
xargs -i echo "https://{}" <<< "${SSL_VHOSTS}" >> $URLS_PATH
|
||||
xargs -i echo "http://{}" <<< "${NONSSL_VHOSTS}" >> $URLS_PATH
|
||||
else
|
||||
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo "-----> NO_VHOST set, deleting $APP/VHOST"
|
||||
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
|
||||
rm "$DOKKU_ROOT/$APP/VHOST"
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
echo "-----> NO_VHOST set, deleting nginx.conf"
|
||||
dokku_log_info1 "VHOST support disabled, deleting nginx.conf"
|
||||
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
echo "-----> NO_VHOST set, reloading nginx after nginx.conf deletion"
|
||||
dokku_log_info1 "VHOST support disabled, reloading nginx after nginx.conf deletion"
|
||||
restart_nginx
|
||||
fi
|
||||
fi
|
||||
@@ -91,11 +132,11 @@ EOF
|
||||
|
||||
nginx:import-ssl)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
verify_app_name "$2"
|
||||
[[ -t 0 ]] && echo "Tar archive containing server.crt and server.key expected on stdin" && exit 1
|
||||
APP="$2"
|
||||
|
||||
TEMP_DIR=`mktemp -d`
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
cd $TEMP_DIR
|
||||
tar xvf - <&0
|
||||
[[ ! -f "$TEMP_DIR/server.crt" ]] && echo "Tar archive missing server.crt" && exit 1
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
apt-get install -qq -y software-properties-common python-software-properties
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
|
||||
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
|
||||
add-apt-repository -y ppa:nginx/stable
|
||||
apt-get update
|
||||
apt-get install -qq -y nginx dnsutils
|
||||
apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes -qq -y nginx dnsutils
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f /etc/sudoers.d/dokku-nginx ]]; then
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
esac
|
||||
opensuse)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
esac
|
||||
|
||||
chmod 0440 /etc/sudoers.d/dokku-nginx
|
||||
fi
|
||||
chmod 0440 /etc/sudoers.d/dokku-nginx
|
||||
|
||||
# if dokku.conf has not been created, create it
|
||||
if [[ ! -f /etc/nginx/conf.d/dokku.conf ]]; then
|
||||
@@ -27,8 +25,8 @@ ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:
|
||||
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
#ssl_certificate $DOKKU_ROOT/tls/server.crt;
|
||||
#ssl_certificate_key $DOKKU_ROOT/tls/server.key;
|
||||
# ssl_certificate $DOKKU_ROOT/tls/server.crt;
|
||||
# ssl_certificate_key $DOKKU_ROOT/tls/server.key;
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -42,6 +40,7 @@ events {
|
||||
}
|
||||
|
||||
http {
|
||||
server_tokens off;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
APP="$1"; PORT="$2"
|
||||
|
||||
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
|
||||
APP="$1"; PORT="$2"; IP="$3"
|
||||
NO_VHOST=$(dokku config:get $APP NO_VHOST || true)
|
||||
|
||||
if [[ -n "$NO_VHOST" ]]; then
|
||||
echo "-----> NO_VHOST config detected"
|
||||
dokku_log_info1 "NO_VHOST config detected"
|
||||
elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
dokku domains:setup $APP
|
||||
fi
|
||||
|
||||
dokku nginx:build-config $APP $PORT
|
||||
dokku nginx:build-config $APP $PORT $IP
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
APP="$1"
|
||||
|
||||
|
||||
116
plugins/ps/commands
Executable file
116
plugins/ps/commands
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
release_and_deploy() {
|
||||
source "$(dirname $0)/../common/functions"
|
||||
local APP="$1"; local IMAGE="dokku/$APP"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
if is_image_buildstep_based "$IMAGE"; then
|
||||
IMAGE_SOURCE_TYPE="buildstep"
|
||||
else
|
||||
IMAGE_SOURCE_TYPE="dockerfile"
|
||||
fi
|
||||
|
||||
dokku_log_info1 "Releasing $APP ..."
|
||||
dokku release "$APP" "$IMAGE_SOURCE_TYPE"
|
||||
dokku_log_info1 "Deploying $APP ..."
|
||||
dokku deploy "$APP"
|
||||
dokku_log_info2 "Application deployed:"
|
||||
dokku urls $APP | sed "s/^/ /"
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
ps)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
docker exec -ti "$CONTAINER_ID" /bin/bash -c "ps auxwww"
|
||||
;;
|
||||
|
||||
ps:start)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
if [[ "$(docker ps -q --no-trunc| grep -q $CONTAINER_ID; echo $?)" != "0" ]]; then
|
||||
release_and_deploy $APP
|
||||
else
|
||||
echo "App $APP already running"
|
||||
fi
|
||||
;;
|
||||
|
||||
ps:stop)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
if [[ "$(docker ps -q --no-trunc| grep -q $CONTAINER_ID; echo $?)" = "0" ]]; then
|
||||
echo "Stopping $APP ..."
|
||||
docker stop $CONTAINER_ID > /dev/null
|
||||
else
|
||||
echo "App $APP already stopped"
|
||||
fi
|
||||
;;
|
||||
|
||||
ps:rebuild)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
pluginhook receive-app $APP
|
||||
;;
|
||||
|
||||
ps:rebuildall)
|
||||
shopt -s nullglob
|
||||
for app in $DOKKU_ROOT/*/CONTAINER; do
|
||||
APP=$(basename "$(dirname $app)");
|
||||
dokku ps:rebuild $APP
|
||||
done
|
||||
;;
|
||||
|
||||
ps:restart)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
verify_app_name "$2"
|
||||
|
||||
APP="$2"; [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]] && CONTAINER_ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
[[ -z "$CONTAINER_ID" ]] && echo "App $APP has not been deployed" && exit 0
|
||||
|
||||
release_and_deploy $APP
|
||||
;;
|
||||
|
||||
ps:restartall)
|
||||
shopt -s nullglob
|
||||
for app in $DOKKU_ROOT/*/CONTAINER; do
|
||||
APP=$(basename "$(dirname $app)");
|
||||
dokku ps:restart $APP
|
||||
done
|
||||
;;
|
||||
|
||||
help | ps:help)
|
||||
cat && cat<<EOF
|
||||
ps <app> List processes running in app container(s)
|
||||
ps:start <app> Start app container(s)
|
||||
ps:stop <app> Stop app container(s)
|
||||
ps:rebuild <app> Rebuild an app
|
||||
ps:rebuildall Rebuild all apps
|
||||
ps:restart <app> Restart app container(s)
|
||||
ps:restartall Restart all deployed app containers
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
59
plugins/shell/commands
Executable file
59
plugins/shell/commands
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
shell)
|
||||
INPUTRC="$PLUGIN_ROOT/inputrc"
|
||||
HISTFILE=~/.dokku_history
|
||||
|
||||
history -r || true
|
||||
|
||||
trim()
|
||||
{
|
||||
sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g'
|
||||
}
|
||||
|
||||
trap 'history -w' EXIT
|
||||
|
||||
while true; do
|
||||
trap '' SIGINT
|
||||
read -ep "dokku> " line || {
|
||||
echo; true; break
|
||||
}
|
||||
trap - SIGINT
|
||||
|
||||
line=$(echo $line | trim)
|
||||
CMD=$(echo $line | awk '{ print $1 }')
|
||||
|
||||
[ -z $CMD ] && continue
|
||||
|
||||
[[ "$line" != "$(fc -ln -1 | trim)" ]] && history -s "$line"
|
||||
|
||||
case $CMD in
|
||||
# shell builtins
|
||||
clear)
|
||||
clear
|
||||
;;
|
||||
quit|exit)
|
||||
break
|
||||
;;
|
||||
|
||||
# Not a built-in, run as regular dokku command
|
||||
*)
|
||||
dokku $line || true
|
||||
esac
|
||||
|
||||
done
|
||||
;;
|
||||
|
||||
help | shell:help)
|
||||
cat && cat<<EOF
|
||||
shell Spawn dokku shell
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit $DOKKU_NOT_IMPLEMENTED_EXIT
|
||||
;;
|
||||
|
||||
esac
|
||||
1
plugins/shell/inputrc
Normal file
1
plugins/shell/inputrc
Normal file
@@ -0,0 +1 @@
|
||||
set disable-completion on
|
||||
155
tests.mk
Normal file
155
tests.mk
Normal file
@@ -0,0 +1,155 @@
|
||||
shellcheck:
|
||||
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127)
|
||||
ifeq ($(shell uname),Darwin)
|
||||
brew install shellcheck
|
||||
else
|
||||
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
|
||||
sudo apt-get update && sudo apt-get install -y shellcheck
|
||||
endif
|
||||
endif
|
||||
|
||||
ci-dependencies: shellcheck bats
|
||||
|
||||
setup-deploy-tests:
|
||||
mkdir -p /home/dokku
|
||||
ifdef ENABLE_DOKKU_TRACE
|
||||
echo "-----> Enabling tracing"
|
||||
echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc
|
||||
endif
|
||||
@echo "Setting dokku.me in /etc/hosts"
|
||||
sudo /bin/bash -c "[[ `ping -c1 dokku.me > /dev/null 2>&1; echo $$?` -eq 0 ]] || echo \"127.0.0.1 dokku.me *.dokku.me www.test.app.dokku.me\" >> /etc/hosts"
|
||||
|
||||
@echo "-----> Generating keypair..."
|
||||
mkdir -p /root/.ssh
|
||||
rm -f /root/.ssh/dokku_test_rsa*
|
||||
echo -e "y\n" | ssh-keygen -f /root/.ssh/dokku_test_rsa -t rsa -N ''
|
||||
chmod 600 /root/.ssh/dokku_test_rsa*
|
||||
|
||||
@echo "-----> Setting up ssh config..."
|
||||
ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0)
|
||||
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
else ifeq ($(shell grep dokku.me /root/.ssh/config),)
|
||||
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
endif
|
||||
|
||||
ifeq ($(shell grep 22333 /etc/ssh/sshd_config),)
|
||||
sed --in-place "s:^Port 22:Port 22 \\nPort 22333:g" /etc/ssh/sshd_config
|
||||
restart ssh
|
||||
endif
|
||||
|
||||
@echo "-----> Installing SSH public key..."
|
||||
sudo sshcommand acl-remove dokku test
|
||||
cat /root/.ssh/dokku_test_rsa.pub | sudo sshcommand acl-add dokku test
|
||||
|
||||
@echo "-----> Intitial SSH connection to populate known_hosts..."
|
||||
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
|
||||
ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help > /dev/null
|
||||
|
||||
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
|
||||
@echo "-----> Setting default VHOST to dokku.me..."
|
||||
echo "dokku.me" > /home/dokku/VHOST
|
||||
endif
|
||||
|
||||
bats:
|
||||
git clone https://github.com/sstephenson/bats.git /tmp/bats
|
||||
cd /tmp/bats && sudo ./install.sh /usr/local
|
||||
rm -rf /tmp/bats
|
||||
|
||||
lint:
|
||||
# these are disabled due to their expansive existence in the codebase. we should clean it up though
|
||||
# SC2034: VAR appears unused - https://github.com/koalaman/shellcheck/wiki/SC2034
|
||||
# SC2086: Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086
|
||||
# SC2143: Instead of [ -n $(foo | grep bar) ], use foo | grep -q bar - https://github.com/koalaman/shellcheck/wiki/SC2143
|
||||
# SC2001: See if you can use ${variable//search/replace} instead. - https://github.com/koalaman/shellcheck/wiki/SC2001
|
||||
@echo linting...
|
||||
@$(QUIET) shellcheck -e SC2029 ./contrib/dokku_client.sh
|
||||
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | grep -v directory | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001
|
||||
|
||||
unit-tests:
|
||||
@echo running unit tests...
|
||||
ifndef UNIT_TEST_BATCH
|
||||
@$(QUIET) bats tests/unit
|
||||
else
|
||||
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
|
||||
endif
|
||||
|
||||
deploy-test-clojure:
|
||||
@echo deploying config app...
|
||||
cd tests && ./test_deploy ./apps/clojure dokku.me
|
||||
|
||||
deploy-test-config:
|
||||
@echo deploying config app...
|
||||
cd tests && ./test_deploy ./apps/config dokku.me
|
||||
|
||||
deploy-test-dockerfile:
|
||||
@echo deploying dockerfile app...
|
||||
cd tests && ./test_deploy ./apps/dockerfile dokku.me
|
||||
|
||||
deploy-test-dockerfile-noexpose:
|
||||
@echo deploying dockerfile-noexpose app...
|
||||
cd tests && ./test_deploy ./apps/dockerfile-noexpose dokku.me
|
||||
|
||||
deploy-test-gitsubmodules:
|
||||
@echo deploying gitsubmodules app...
|
||||
cd tests && ./test_deploy ./apps/gitsubmodules dokku.me
|
||||
|
||||
deploy-test-go:
|
||||
@echo deploying go app...
|
||||
cd tests && ./test_deploy ./apps/go dokku.me
|
||||
|
||||
deploy-test-java:
|
||||
@echo deploying java app...
|
||||
cd tests && ./test_deploy ./apps/java dokku.me
|
||||
|
||||
deploy-test-multi:
|
||||
@echo deploying multi app...
|
||||
cd tests && ./test_deploy ./apps/multi dokku.me
|
||||
|
||||
deploy-test-nodejs-express:
|
||||
@echo deploying nodejs-express app...
|
||||
cd tests && ./test_deploy ./apps/nodejs-express dokku.me
|
||||
|
||||
deploy-test-nodejs-express-noprocfile:
|
||||
@echo deploying nodejs-express app with no Procfile...
|
||||
cd tests && ./test_deploy ./apps/nodejs-express-noprocfile dokku.me
|
||||
|
||||
deploy-test-php:
|
||||
@echo deploying php app...
|
||||
cd tests && ./test_deploy ./apps/php dokku.me
|
||||
|
||||
deploy-test-python-flask:
|
||||
@echo deploying python-flask app...
|
||||
cd tests && ./test_deploy ./apps/python-flask dokku.me
|
||||
|
||||
deploy-test-ruby:
|
||||
@echo deploying ruby app...
|
||||
cd tests && ./test_deploy ./apps/ruby dokku.me
|
||||
|
||||
deploy-test-scala:
|
||||
@echo deploying scala app...
|
||||
cd tests && ./test_deploy ./apps/scala dokku.me
|
||||
|
||||
deploy-test-static:
|
||||
@echo deploying static app...
|
||||
cd tests && ./test_deploy ./apps/static dokku.me
|
||||
|
||||
deploy-tests:
|
||||
@echo running deploy tests...
|
||||
@$(QUIET) $(MAKE) deploy-test-config
|
||||
@$(QUIET) $(MAKE) deploy-test-clojure
|
||||
@$(QUIET) $(MAKE) deploy-test-dockerfile
|
||||
@$(QUIET) $(MAKE) deploy-test-dockerfile-noexpose
|
||||
@$(QUIET) $(MAKE) deploy-test-gitsubmodules
|
||||
@$(QUIET) $(MAKE) deploy-test-go
|
||||
@$(QUIET) $(MAKE) deploy-test-java
|
||||
@$(QUIET) $(MAKE) deploy-test-multi
|
||||
@$(QUIET) $(MAKE) deploy-test-nodejs-express
|
||||
@$(QUIET) $(MAKE) deploy-test-nodejs-express-noprocfile
|
||||
@$(QUIET) $(MAKE) deploy-test-php
|
||||
@$(QUIET) $(MAKE) deploy-test-python-flask
|
||||
@$(QUIET) $(MAKE) deploy-test-scala
|
||||
@$(QUIET) $(MAKE) deploy-test-static
|
||||
|
||||
test: setup-deploy-tests lint unit-tests deploy-tests
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: $1\" -H \"Origin: $1\" $1 -m 2)"; echo $output; test "$output" == "bazingaa"
|
||||
#!/usr/bin/env bash
|
||||
set -e; output="$(curl -s -S -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: $1\" -H \"Origin: $1\" $1 -m 2)"; echo $output; test "$output" == "bazingaa"
|
||||
|
||||
1
tests/apps/clojure/Procfile
Normal file
1
tests/apps/clojure/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: lein run
|
||||
4
tests/apps/clojure/README.md
Normal file
4
tests/apps/clojure/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Hello Clojure/Compojure
|
||||
=======================
|
||||
|
||||
A minimal Hello World web app in [Clojure](http://clojure.org/), using the [Compojure](https://github.com/weavejester/compojure) web framework.
|
||||
1
tests/apps/clojure/check_deploy
Executable file
1
tests/apps/clojure/check_deploy
Executable file
@@ -0,0 +1 @@
|
||||
set -e; sleep 5; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!"
|
||||
7
tests/apps/clojure/project.clj
Normal file
7
tests/apps/clojure/project.clj
Normal file
@@ -0,0 +1,7 @@
|
||||
(defproject clojure-sample "1.0.1"
|
||||
:description "Hello World Clojure Web App"
|
||||
:dependencies [[org.clojure/clojure "1.6.0"]
|
||||
[compojure "1.3.1"]
|
||||
[ring/ring-jetty-adapter "1.3.2"]]
|
||||
:main ^:skip-aot sample.app
|
||||
:min-lein-version "2.0.0")
|
||||
13
tests/apps/clojure/src/sample/app.clj
Normal file
13
tests/apps/clojure/src/sample/app.clj
Normal file
@@ -0,0 +1,13 @@
|
||||
(ns sample.app
|
||||
(:require [ring.adapter.jetty :as jetty]
|
||||
[compojure.core :refer [defroutes GET]]))
|
||||
|
||||
(defroutes handler
|
||||
(GET "/" []
|
||||
{:headers {"Content-type" "text/plain; charset=UTF-8"}
|
||||
:body "Hello World!"}))
|
||||
|
||||
(defn -main []
|
||||
(jetty/run-jetty handler
|
||||
{:port (Integer. (or (System/getenv "PORT") "5000"))
|
||||
:join? false}))
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -e;
|
||||
|
||||
base_url="$1"
|
||||
test_url / "config-test"
|
||||
test_url /hello "Hello world"
|
||||
|
||||
test_url () {
|
||||
path="$1"
|
||||
expected_output="$2"
|
||||
url="$base_url$path"
|
||||
output="$(curl -s $url)"
|
||||
echo $output
|
||||
output="$(curl -s -S "$url")"
|
||||
echo "$output"
|
||||
test "$output" == "$expected_output"
|
||||
}
|
||||
}
|
||||
|
||||
base_url="$1"
|
||||
test_url / "config-test"
|
||||
test_url /hello "Hello world"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"express": "2.5.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.8.x",
|
||||
"npm": "1.1.x"
|
||||
"node": "0.10.x",
|
||||
"npm": "2.7.x"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -ex;
|
||||
|
||||
REMOTE=$1
|
||||
REPO=$2
|
||||
|
||||
ssh $REMOTE config:set $REPO CONFTEST=config-test HELLO=\"Hello world\"
|
||||
|
||||
# setting config variables with spaces is broken at the moment. ref: 820
|
||||
# ssh "$REMOTE" config:set "$REPO" CONFTEST=config-test HELLO=\"Hello world\"
|
||||
dokku config:set "$REPO" CONFTEST=config-test HELLO="Hello world"
|
||||
|
||||
1
tests/apps/dockerfile-noexpose/CHECKS
Normal file
1
tests/apps/dockerfile-noexpose/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ Hello World!
|
||||
13
tests/apps/dockerfile-noexpose/Dockerfile
Normal file
13
tests/apps/dockerfile-noexpose/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM ubuntu:trusty
|
||||
ENV LC_ALL C
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV DEBCONF_NONINTERACTIVE_SEEN true
|
||||
|
||||
RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update
|
||||
RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN npm install
|
||||
|
||||
CMD npm start
|
||||
2
tests/apps/dockerfile-noexpose/check_deploy
Executable file
2
tests/apps/dockerfile-noexpose/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!"
|
||||
13
tests/apps/dockerfile-noexpose/index.js
Normal file
13
tests/apps/dockerfile-noexpose/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
var express = require('express')
|
||||
var app = express();
|
||||
|
||||
app.set('port', (process.env.PORT || 5000))
|
||||
app.use(express.static(__dirname + '/public'))
|
||||
|
||||
app.get('/', function(request, response) {
|
||||
response.send('Hello World!')
|
||||
})
|
||||
|
||||
app.listen(app.get('port'), function() {
|
||||
console.log("Node app is running at localhost:" + app.get('port'))
|
||||
})
|
||||
29
tests/apps/dockerfile-noexpose/package.json
Normal file
29
tests/apps/dockerfile-noexpose/package.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "node-js-sample",
|
||||
"version": "0.1.0",
|
||||
"description": "A sample Node.js app using Express 4",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.x"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/heroku/node-js-sample"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"heroku",
|
||||
"express"
|
||||
],
|
||||
"author": "Mark Pundsack",
|
||||
"contributors": [
|
||||
"Zeke Sikelianos <zeke@sikelianos.com> (http://zeke.sikelianos.com)"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
1
tests/apps/dockerfile/CHECKS
Normal file
1
tests/apps/dockerfile/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ Hello World!
|
||||
14
tests/apps/dockerfile/Dockerfile
Normal file
14
tests/apps/dockerfile/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM ubuntu:trusty
|
||||
ENV LC_ALL C
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV DEBCONF_NONINTERACTIVE_SEEN true
|
||||
EXPOSE 3000
|
||||
|
||||
RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update
|
||||
RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN npm install
|
||||
|
||||
CMD npm start
|
||||
2
tests/apps/dockerfile/check_deploy
Executable file
2
tests/apps/dockerfile/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!"
|
||||
13
tests/apps/dockerfile/index.js
Normal file
13
tests/apps/dockerfile/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
var express = require('express')
|
||||
var app = express();
|
||||
|
||||
app.set('port', (process.env.PORT || 5000))
|
||||
app.use(express.static(__dirname + '/public'))
|
||||
|
||||
app.get('/', function(request, response) {
|
||||
response.send('Hello World!')
|
||||
})
|
||||
|
||||
app.listen(app.get('port'), function() {
|
||||
console.log("Node app is running at localhost:" + app.get('port'))
|
||||
})
|
||||
29
tests/apps/dockerfile/package.json
Normal file
29
tests/apps/dockerfile/package.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "node-js-sample",
|
||||
"version": "0.1.0",
|
||||
"description": "A sample Node.js app using Express 4",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.x"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/heroku/node-js-sample"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"heroku",
|
||||
"express"
|
||||
],
|
||||
"author": "Mark Pundsack",
|
||||
"contributors": [
|
||||
"Zeke Sikelianos <zeke@sikelianos.com> (http://zeke.sikelianos.com)"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
1
tests/apps/gitsubmodules/CHECKS
Normal file
1
tests/apps/gitsubmodules/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ Hello
|
||||
@@ -1 +1 @@
|
||||
web: node node-js-sample/web.js
|
||||
web: node node-js-sample/index.js
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user