Compare commits
323 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1560888f8 | ||
|
|
25b2cd7dc5 | ||
|
|
ab978fab4e | ||
|
|
6d64edc16a | ||
|
|
dae4e55f25 | ||
|
|
f92e7a59d9 | ||
|
|
4ad0c6bb7c | ||
|
|
aed9968265 | ||
|
|
e641fda68e | ||
|
|
7ecacd5d98 | ||
|
|
bc9dbf6127 | ||
|
|
5e1e903d51 | ||
|
|
158c3d215b | ||
|
|
83ce81fc51 | ||
|
|
805c5a27c6 | ||
|
|
584ddf9044 | ||
|
|
da11349e81 | ||
|
|
ea663d13d3 | ||
|
|
a06d27ab45 | ||
|
|
2219044114 | ||
|
|
682229baae | ||
|
|
8981b9e613 | ||
|
|
59ef6510bc | ||
|
|
1d3ae29ba6 | ||
|
|
7281daaa5e | ||
|
|
f8fb8e104a | ||
|
|
be97ee6019 | ||
|
|
dd0fe5eeb1 | ||
|
|
a0b7831b08 | ||
|
|
d829135d78 | ||
|
|
f308025694 | ||
|
|
ba6393fadd | ||
|
|
d41f88fd22 | ||
|
|
09fa06beaa | ||
|
|
b59e36af3f | ||
|
|
a2fb231810 | ||
|
|
2ac9996b27 | ||
|
|
a159c5a708 | ||
|
|
a3c561c69d | ||
|
|
48aba9567f | ||
|
|
960f9503e3 | ||
|
|
75a5466650 | ||
|
|
986acb28b5 | ||
|
|
b732fc58c0 | ||
|
|
94b77a8c8b | ||
|
|
0e0135284c | ||
|
|
beea0935e3 | ||
|
|
3cf7fbae06 | ||
|
|
d2426530f3 | ||
|
|
d71cd77f7a | ||
|
|
407c5b2875 | ||
|
|
9aa5f7a85b | ||
|
|
28c78300db | ||
|
|
0da5065429 | ||
|
|
d457aaae99 | ||
|
|
3c1666076e | ||
|
|
3321186ffe | ||
|
|
fc11d5b8e9 | ||
|
|
483860e429 | ||
|
|
b64fe76ec0 | ||
|
|
df7507d1be | ||
|
|
14b71cec87 | ||
|
|
bca5a99b1d | ||
|
|
b5c8dd7436 | ||
|
|
e04f271d8e | ||
|
|
27d4bc8c3c | ||
|
|
6350f373be | ||
|
|
7b74935210 | ||
|
|
01d57ef0dc | ||
|
|
bcfaefa896 | ||
|
|
85f14baad5 | ||
|
|
c0a2683744 | ||
|
|
96f0d8e2fa | ||
|
|
c90fd9406a | ||
|
|
7e201e9eb0 | ||
|
|
faac15bddb | ||
|
|
98168b0e0b | ||
|
|
a308ff6546 | ||
|
|
2d76bfb9d3 | ||
|
|
d617b73ece | ||
|
|
13cda0fd16 | ||
|
|
b5ce871da4 | ||
|
|
fb3051d108 | ||
|
|
925a0b0f05 | ||
|
|
c05007a9d2 | ||
|
|
d8cd86fa8b | ||
|
|
c1c96e22ce | ||
|
|
04e7934104 | ||
|
|
3048c181e7 | ||
|
|
657e6fd543 | ||
|
|
ce81497156 | ||
|
|
4f8604777a | ||
|
|
83e4744fa5 | ||
|
|
85ab9944fa | ||
|
|
68bbf0d888 | ||
|
|
2b2c68ddd7 | ||
|
|
681de274a7 | ||
|
|
9b4fe6badd | ||
|
|
ba1f1bc30d | ||
|
|
7f4f46a1e2 | ||
|
|
3a111a8308 | ||
|
|
1a7d68a3fc | ||
|
|
6a7de8d7e8 | ||
|
|
fbf2b28512 | ||
|
|
774b1f3c45 | ||
|
|
7b8b8172e8 | ||
|
|
3e9e6127a7 | ||
|
|
6ead1ab943 | ||
|
|
2563581f49 | ||
|
|
c773e52508 | ||
|
|
4b5b86173f | ||
|
|
8359b9613d | ||
|
|
0254cb5907 | ||
|
|
1c27f1b70a | ||
|
|
1751a4ad74 | ||
|
|
dfcb52a079 | ||
|
|
53395bfa08 | ||
|
|
84cf39bf09 | ||
|
|
7c4f2fd801 | ||
|
|
772629279e | ||
|
|
5c0379f2b9 | ||
|
|
9be10ac2d9 | ||
|
|
2dfa0fac64 | ||
|
|
b515ddbf01 | ||
|
|
6ecc94b4a2 | ||
|
|
d120ef4b13 | ||
|
|
5ef7b00243 | ||
|
|
584ad9d6d6 | ||
|
|
bd269aad42 | ||
|
|
6eded2f099 | ||
|
|
40fa670770 | ||
|
|
d56db3457b | ||
|
|
9e9cc0c96e | ||
|
|
2f92d500f8 | ||
|
|
7a24561194 | ||
|
|
ba8a84d422 | ||
|
|
9b27a3faf6 | ||
|
|
d26164f536 | ||
|
|
3a80609166 | ||
|
|
d3d6486169 | ||
|
|
33a3b85674 | ||
|
|
4f82bc9d9a | ||
|
|
b44bf15c92 | ||
|
|
e616da514c | ||
|
|
eb189d639c | ||
|
|
84337da262 | ||
|
|
18db1cf7f6 | ||
|
|
bb59f47cab | ||
|
|
7f6e6ee8a4 | ||
|
|
3bd0f6d3fb | ||
|
|
a41bf80699 | ||
|
|
fa34cb3eff | ||
|
|
5c25bd1557 | ||
|
|
30d39d0da2 | ||
|
|
9ebf453b72 | ||
|
|
25b04e12cc | ||
|
|
7c6f7232d9 | ||
|
|
c4f6393946 | ||
|
|
2edc4e890d | ||
|
|
9aa64f4f6c | ||
|
|
8d979b125e | ||
|
|
f89430535a | ||
|
|
ad6459a70c | ||
|
|
6257ebdcfe | ||
|
|
eef39c30d3 | ||
|
|
36c4f37ad6 | ||
|
|
fef5ee080d | ||
|
|
154d76e314 | ||
|
|
39b05a1b20 | ||
|
|
c8633db721 | ||
|
|
d160036954 | ||
|
|
f4cdc94209 | ||
|
|
3eadb0ae03 | ||
|
|
6c6196fd5a | ||
|
|
b433626b4e | ||
|
|
3d1c8a30e9 | ||
|
|
3aa6340c06 | ||
|
|
1f4dab1fd8 | ||
|
|
ee40473a18 | ||
|
|
ea14fb0543 | ||
|
|
264d196eee | ||
|
|
1f45937abc | ||
|
|
c118c20b36 | ||
|
|
5493236d7e | ||
|
|
bc852395cc | ||
|
|
49f1c444c4 | ||
|
|
621de7cbd1 | ||
|
|
99dcacd991 | ||
|
|
713365f53d | ||
|
|
5065810bf0 | ||
|
|
eaa486e888 | ||
|
|
04e0618833 | ||
|
|
30bd933e68 | ||
|
|
67958431b0 | ||
|
|
e08aac8b46 | ||
|
|
65f1dd7072 | ||
|
|
a3cf19b9b5 | ||
|
|
a0eb48c32b | ||
|
|
bc249ef5ac | ||
|
|
2dfe1e1b05 | ||
|
|
19a0ee20e7 | ||
|
|
e8e6267114 | ||
|
|
ee80167c0c | ||
|
|
bcd3ba3c66 | ||
|
|
5e08d92040 | ||
|
|
5653eedac4 | ||
|
|
407e3f04c4 | ||
|
|
6d8232dc20 | ||
|
|
9623b4c474 | ||
|
|
47ca5bd4e0 | ||
|
|
cf7a2a00d4 | ||
|
|
1024492c3d | ||
|
|
4f07b7af1c | ||
|
|
e75099d5e0 | ||
|
|
0b07e4e4e3 | ||
|
|
4ecb13a918 | ||
|
|
1626b10539 | ||
|
|
7b9d180b2d | ||
|
|
538925f7f4 | ||
|
|
4d77b668b4 | ||
|
|
de906a22aa | ||
|
|
60f29cdb18 | ||
|
|
997d2dd09c | ||
|
|
071c446315 | ||
|
|
5c0f7320cf | ||
|
|
c4fd6d620b | ||
|
|
51dc343630 | ||
|
|
79b099e401 | ||
|
|
6be113f7de | ||
|
|
1ebfc9486a | ||
|
|
17953fc5a0 | ||
|
|
98859df6d6 | ||
|
|
c08f3233e9 | ||
|
|
183d8f6ed3 | ||
|
|
caa03d0554 | ||
|
|
6d2954d11b | ||
|
|
3ce4897264 | ||
|
|
1ee35cb3b9 | ||
|
|
0d49424c45 | ||
|
|
7ecdba7387 | ||
|
|
fc396490dd | ||
|
|
65fb3c18c3 | ||
|
|
977d1269a7 | ||
|
|
70be1daec4 | ||
|
|
dc2c4825d8 | ||
|
|
d5e264d5b5 | ||
|
|
0d6d7cdbed | ||
|
|
601bbc2efd | ||
|
|
b15b55f4af | ||
|
|
964299d167 | ||
|
|
02fa55342b | ||
|
|
5f1d2c4a3e | ||
|
|
0f230c3732 | ||
|
|
ef7ac5bbdb | ||
|
|
67c727a935 | ||
|
|
5af2055c82 | ||
|
|
daebad9b88 | ||
|
|
28651543ab | ||
|
|
2f74fc98c0 | ||
|
|
7da64d77c1 | ||
|
|
1184dc39c6 | ||
|
|
4bd8331ee2 | ||
|
|
c5ebc4a5dc | ||
|
|
8a884f02f2 | ||
|
|
7fd8f4e437 | ||
|
|
5fab0a4c3a | ||
|
|
e94a9a47c7 | ||
|
|
9d56c54d48 | ||
|
|
9d1f04a9ba | ||
|
|
c3c20716e4 | ||
|
|
93f8c5c46b | ||
|
|
4ece03abf6 | ||
|
|
79c3c5b85e | ||
|
|
946973b060 | ||
|
|
3a6d2c4442 | ||
|
|
7a1b4be14e | ||
|
|
4bb66c6c63 | ||
|
|
6244d81d0b | ||
|
|
0cfdcb66e4 | ||
|
|
6525b87850 | ||
|
|
69c502a019 | ||
|
|
bff5342459 | ||
|
|
92f395dc5f | ||
|
|
49ce9aa862 | ||
|
|
dab5b7911b | ||
|
|
e295c46672 | ||
|
|
5855c75dd3 | ||
|
|
5fd7ac4fba | ||
|
|
c3aa085fb3 | ||
|
|
47c6b87e2b | ||
|
|
c058c17f63 | ||
|
|
bc828475e8 | ||
|
|
f25c9eb3c8 | ||
|
|
1f175f7d12 | ||
|
|
d7a77ed2cd | ||
|
|
79a0bc001c | ||
|
|
f97fbef82f | ||
|
|
c8baad638e | ||
|
|
4634bf68b2 | ||
|
|
8aad633606 | ||
|
|
1ca9e05be7 | ||
|
|
47aad38840 | ||
|
|
fa9757b784 | ||
|
|
f9ffc72f5e | ||
|
|
b31ef35ccc | ||
|
|
e16be6096b | ||
|
|
3a724bae85 | ||
|
|
c6ed38512b | ||
|
|
de78434086 | ||
|
|
7fd0d797ab | ||
|
|
d690c5da43 | ||
|
|
f9d594bbe9 | ||
|
|
19c69a28fa | ||
|
|
bc29aeadc1 | ||
|
|
a22c55a76b | ||
|
|
8b7c8ad5eb | ||
|
|
e5ba03eea0 | ||
|
|
4674e83d47 | ||
|
|
6035737556 | ||
|
|
a2ee3d09b1 | ||
|
|
3e62268b98 | ||
|
|
66d8ff96fa | ||
|
|
c27dd1b9b8 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
.vagrant
|
||||
.DS_Store
|
||||
stack.tgz
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "buildstep"]
|
||||
path = buildstep
|
||||
url = https://github.com/progrium/buildstep.git
|
||||
38
.s3cfg
Normal file
38
.s3cfg
Normal file
@@ -0,0 +1,38 @@
|
||||
[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
Normal file
16
.travis.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
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"
|
||||
16
AUTHORS
16
AUTHORS
@@ -1,6 +1,18 @@
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
# 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.
|
||||
#
|
||||
Alexander <iam.asm89@gmail.com>
|
||||
Alexander Beletsky <alexander.beletsky@gmail.com>
|
||||
Alexis Gavoty <kload@kload.fr>
|
||||
Felipe Coury <felipe.coury@gmail.com>
|
||||
Jeff Lindsay <progrium@gmail.com>
|
||||
Richard North <rich.north@gmail.com>
|
||||
Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
Leo Unbekandt <leo@unbekandt.eu>
|
||||
Luigi Maselli <grigio.org@gmail.com>
|
||||
Martin Weiss <kornnflake@gmail.com>
|
||||
Paul Lietar <paul@lietar.net>
|
||||
Rajiv Makhijani <rajiv@blue-tech.org>
|
||||
rhy-jot <rhy-jot@myeml.net>
|
||||
Richard North <rich.north@gmail.com>
|
||||
Sebastian Götte <github@jaseg.net>
|
||||
Silas Baronda <silas.baronda@gmail.com>
|
||||
|
||||
14
HISTORY.md
14
HISTORY.md
@@ -1,9 +1,21 @@
|
||||
# History
|
||||
|
||||
## 0.2.0 (in progress)
|
||||
|
||||
* Cache dir is preserved across builds
|
||||
* Application config (environment variable management)
|
||||
* Basic hooks/plugin system
|
||||
* Exposed commands over SSH using sshcommand
|
||||
* Integration test coverage
|
||||
* Pulled nginx vhosts out into plugin
|
||||
* Run command
|
||||
* Separated dokku and buildstep more cleanly
|
||||
* Uses latest version of Docker again
|
||||
|
||||
## 0.1.0 (2013-06-15)
|
||||
|
||||
* First release
|
||||
* Bootstrap script for Ubuntu system
|
||||
* Basic push / deploy with git
|
||||
* Hostname support with Nginx
|
||||
* Support for Java, Ruby, Node.js buildpacks
|
||||
* Support for Java, Ruby, Node.js buildpacks
|
||||
|
||||
64
Makefile
64
Makefile
@@ -1,29 +1,57 @@
|
||||
GITRECEIVE_URL = https://raw.github.com/progrium/gitreceive/master/gitreceive
|
||||
SSHCOMMAND_URL = https://raw.github.com/progrium/sshcommand/master/sshcommand
|
||||
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 ?= github.com/progrium/buildstep
|
||||
PREBUILT_STACK_URL ?= https://s3.amazonaws.com/progrium-dokku/progrium_buildstep_79cf6805cf.tgz
|
||||
|
||||
all: install
|
||||
.PHONY: all install copyfiles plugins dependencies sshcommand pluginhook docker aufs stack count
|
||||
|
||||
install: submodule gitreceive sshcommand
|
||||
all:
|
||||
# Type "make install" to install.
|
||||
|
||||
install: dependencies stack copyfiles plugins
|
||||
|
||||
copyfiles:
|
||||
cp dokku /usr/local/bin/dokku
|
||||
cp receiver /home/git/receiver
|
||||
cp deploystep /home/git/deploystep
|
||||
cp buildstep/buildstep /home/git/buildstep
|
||||
cp nginx-app-conf /home/git/nginx-app-conf
|
||||
cp nginx-reloader.conf /etc/init/nginx-reloader.conf
|
||||
echo "include /home/git/*/nginx.conf;" > /etc/nginx/conf.d/dokku.conf
|
||||
mkdir -p /var/lib/dokku/plugins
|
||||
cp -r plugins/* /var/lib/dokku/plugins
|
||||
|
||||
submodule:
|
||||
git submodule init
|
||||
git submodule update
|
||||
plugins: pluginhook docker
|
||||
dokku plugins-install
|
||||
|
||||
gitreceive:
|
||||
wget -qO /usr/local/bin/gitreceive ${GITRECEIVE_URL}
|
||||
chmod +x /usr/local/bin/gitreceive
|
||||
gitreceive init
|
||||
dependencies: sshcommand pluginhook docker stack
|
||||
|
||||
sshcommand:
|
||||
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
|
||||
chmod +x /usr/local/bin/sshcommand
|
||||
sshcommand create dokku /usr/local/bin/dokku
|
||||
|
||||
pluginhook:
|
||||
wget -qO /tmp/pluginhook_0.1.0_amd64.deb ${PLUGINHOOK_URL}
|
||||
dpkg -i /tmp/pluginhook_0.1.0_amd64.deb
|
||||
|
||||
docker: aufs
|
||||
egrep -i "^docker" /etc/group || groupadd docker
|
||||
usermod -aG docker dokku
|
||||
curl https://get.docker.io/gpg | apt-key add -
|
||||
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
|
||||
apt-get update
|
||||
apt-get install -y lxc-docker
|
||||
sleep 2 # give docker a moment i guess
|
||||
|
||||
aufs:
|
||||
lsmod | grep aufs || modprobe aufs || apt-get install -y linux-image-extra-`uname -r`
|
||||
|
||||
stack:
|
||||
ifdef BUILD_STACK
|
||||
@docker images | grep progrium/buildstep || docker build -t progrium/buildstep ${STACK_URL}
|
||||
else
|
||||
@docker images | grep progrium/buildstep || curl ${PREBUILT_STACK_URL} | gunzip -cd | docker import - progrium/buildstep
|
||||
endif
|
||||
|
||||
count:
|
||||
cat receiver deploystep bootstrap.sh nginx-app-conf nginx-reloader.conf | wc -l
|
||||
@echo "Core lines:"
|
||||
@cat dokku bootstrap.sh | wc -l
|
||||
@echo "Plugin lines:"
|
||||
@find plugins -type f | xargs cat | wc -l
|
||||
@echo "Test lines:"
|
||||
@find tests -type f | xargs cat | wc -l
|
||||
|
||||
122
README.md
122
README.md
@@ -2,102 +2,136 @@
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
|
||||
|
||||
[](https://travis-ci.org/progrium/dokku)
|
||||
|
||||
## Requirements
|
||||
|
||||
Assumes Ubuntu 13 right now. Ideally have a domain ready to point to your host. It's designed for and is probably
|
||||
Assumes Ubuntu 13 x64 right now. Ideally have a domain ready to point to your host. It's designed for and is probably
|
||||
best to use a fresh VM. The bootstrapper will install everything it needs.
|
||||
|
||||
**Note: There are known issues with docker and Ubuntu 13.10 ([1](https://github.com/dotcloud/docker/issues/1300), [2](https://github.com/dotcloud/docker/issues/1906)) - use of 13.04 is recommended until these issues are resolved.**
|
||||
|
||||
## Installing
|
||||
|
||||
$ wget -qO- j.mp/dokku-bootstrap | bash
|
||||
$ 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 aditional installation options.
|
||||
|
||||
## Configuring
|
||||
|
||||
Set up a domain and a wildcard domain pointing to that host. Make sure `/home/git/DOMAIN` is set to this domain.
|
||||
By default it's set to whatever the hostname the host has.
|
||||
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 the hostname the host has. This file only created if the hostname can be resolved by dig (`dig +short $HOSTNAME`). Otherwise you have to create the file manually and set it to your prefered domain. If this file still 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 as it says at the end of the bootstrapper. You'll do something
|
||||
like this from your local machine:
|
||||
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 root@progriumapp.com "gitreceive upload-key progrium"
|
||||
$ cat ~/.ssh/id_rsa.pub | ssh progriumapp.com "sudo sshcommand acl-add dokku progrium"
|
||||
|
||||
That's it!
|
||||
|
||||
## Deploy an App
|
||||
|
||||
Right now Buildstep supports the Node.js, Ruby, and Java buildpacks. It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)! Let's deploy
|
||||
the Heroku Node.js sample app. All you have to do is add a remote to name the app. It's created on-the-fly.
|
||||
Now you can deploy apps on your Dokku. Let's deploy the [Heroku Node.js sample app](https://github.com/heroku/node-js-sample). All you have to do is add a remote to name the app. It's created on-the-fly.
|
||||
|
||||
$ cd node-js-sample
|
||||
$ git remote add progrium git@progriumapp.com:node-js-app
|
||||
$ git remote add progrium dokku@progriumapp.com:node-js-app
|
||||
$ git push progrium master
|
||||
Counting objects: 296, done.
|
||||
Delta compression using up to 4 threads.
|
||||
Compressing objects: 100% (254/254), done.
|
||||
Writing objects: 100% (296/296), 193.59 KiB, done.
|
||||
Total 296 (delta 25), reused 276 (delta 13)
|
||||
remote: -----> Building node-js-app ...
|
||||
remote: Node.js app detected
|
||||
remote: -----> Resolving engine versions
|
||||
|
||||
-----> Building node-js-app ...
|
||||
Node.js app detected
|
||||
-----> Resolving engine versions
|
||||
|
||||
... blah blah blah ...
|
||||
|
||||
remote: -----> Application deployed:
|
||||
remote: http://node-js-app.progriumapp.com
|
||||
|
||||
-----> Application deployed:
|
||||
http://node-js-app.progriumapp.com
|
||||
|
||||
You're done!
|
||||
|
||||
## Advanced installation (for development)
|
||||
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.
|
||||
|
||||
The bootstrap script allows source URLs to be overridden to include customizations from your own
|
||||
repositories. The GITRECEIVE_URL and DOKKU_REPO environment variables
|
||||
may be set to override the defaults (see the bootstrap.sh script for how these apply). Example:
|
||||
## Run a command in the app environment
|
||||
|
||||
It's possible to run commands in the environment of the deployed application:
|
||||
|
||||
$ dokku run node-js-app ls -alh
|
||||
$ dokku run <app> <cmd>
|
||||
|
||||
## Plugins
|
||||
|
||||
Dokku itself is built out of plugins. Checkout the wiki for information about
|
||||
creating your own and a list of existing plugins:
|
||||
|
||||
https://github.com/progrium/dokku/wiki/Plugins
|
||||
|
||||
## Removing a deployed app
|
||||
|
||||
SSH onto the server, then execute:
|
||||
|
||||
$ dokku delete myapp
|
||||
|
||||
## Environment variable management
|
||||
|
||||
Typically an application will require some environment variables to run properly. Environment variables may contain private data, such as passwords or API keys, so it is not recommend to store them in your application's repository.
|
||||
|
||||
The `config` plugin provides the following commands to manage your variables:
|
||||
```
|
||||
config <app> - display the config vars for an app
|
||||
config:get <app> KEY - display a config value for an app
|
||||
config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] - set one or more config vars
|
||||
config:unset <app> KEY1 [KEY2 ...] - unset one or more config vars
|
||||
```
|
||||
|
||||
## SSL support
|
||||
|
||||
Dokku provides easy SSL support from the box. To enable SSL connection to your application, copy `.crt` and `.key` file into `/home/dokku/:app/ssl` folder (notice, file names should be `server.crt` and `server.key`, respectively). Redeployment of application will be needed to apply SSL configuration. Once it redeployed, application will be accessible by `https://` (redirection from `http://` is applied as well).
|
||||
|
||||
$ wget j.mp/dokku-bootstrap
|
||||
$ chmod +x bootstrap.sh
|
||||
$ DOKKU_REPO=https://github.com/yourusername/dokku.git bootstrap.sh
|
||||
|
||||
## Upgrading
|
||||
|
||||
Dokku is in active development. You can update the deployment step and the build step separately.
|
||||
|
||||
**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).
|
||||
|
||||
To update the deploy step (this is updated less frequently):
|
||||
|
||||
$ cd ~/dokku
|
||||
$ git pull origin master
|
||||
$ make install
|
||||
|
||||
More frequently, the build step is updated. This is where the app "stack" lives and where buildpacks
|
||||
are supported. You can update this by running:
|
||||
|
||||
$ cd ~/dokku/buildstep
|
||||
$ git pull origin master
|
||||
$ make build
|
||||
$ sudo make install
|
||||
|
||||
Nothing needs to be restarted. Changes will take effect on the next push / deployment.
|
||||
|
||||
To update the build step:
|
||||
|
||||
$ 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.
|
||||
|
||||
## 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
|
||||
|
||||
## Components
|
||||
|
||||
* [Docker](https://github.com/dotcloud/docker) - Container runtime and manager
|
||||
* [Buildstep](https://github.com/progrium/buildstep) - Buildpack builder
|
||||
* [gitreceive](https://github.com/progrium/gitreceive) - Git push interface
|
||||
* [pluginhook](https://github.com/progrium/pluginhook) - Shell based plugins and hooks
|
||||
* [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH
|
||||
|
||||
## Ideas for Improvements
|
||||
|
||||
* Custom domain support for apps
|
||||
* HTTPS support on default domain
|
||||
* Support more buildpacks (see Buildstep)
|
||||
* Use dokku as the system user instead of git
|
||||
* Heroku-ish commands to be run via SSH (like [Dokuen](https://github.com/peterkeen/dokuen#available-app-sub-commands))
|
||||
|
||||
Looking to keep codebase as simple and hackable as possible, so try to keep your line count down.
|
||||
|
||||
## Things this project won't do
|
||||
|
||||
* **Multi-host.** Not a huge leap, but this isn't the project for it. Maybe as Super Dokku.
|
||||
* **Multitenancy.** It's ready for it, but again, probably for Super Dokku.
|
||||
* **Multi-host.** Not a huge leap, but this isn't the project for it. Have a look at [Flynn](https://flynn.io/).
|
||||
* **Multitenancy.** It's ready for it, but again, have a look at [Flynn](https://flynn.io/).
|
||||
* **Client app.** Given the constraints, running commands remotely via SSH is fine.
|
||||
|
||||
## License
|
||||
|
||||
17
Vagrantfile
vendored
17
Vagrantfile
vendored
@@ -2,19 +2,30 @@
|
||||
# vi: set ft=ruby :
|
||||
|
||||
BOX_NAME = ENV["BOX_NAME"] || "raring"
|
||||
BOX_URI = ENV["BOX_URI"] || "http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
|
||||
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
|
||||
PREBUILT_STACK_URL = File.exist?("#{File.dirname(__FILE__)}/stack.tgz") ? 'file:///root/dokku/stack.tgz' : nil
|
||||
|
||||
make_cmd = "make install"
|
||||
if PREBUILT_STACK_URL
|
||||
make_cmd = "PREBUILT_STACK_URL='#{PREBUILT_STACK_URL}' #{make_cmd}"
|
||||
end
|
||||
|
||||
Vagrant::configure("2") do |config|
|
||||
config.vm.box = BOX_NAME
|
||||
config.vm.box_url = BOX_URI
|
||||
config.vm.provision :shell, :path => "bootstrap.sh"
|
||||
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"]
|
||||
# Ubuntu's Raring 64-bit cloud image is set to a 32-bit Ubuntu OS type by
|
||||
# default in Virtualbox and thus will not boot. Manually override that.
|
||||
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
|
||||
end
|
||||
|
||||
config.vm.provision :shell, :inline => "apt-get -y install git && cd /root/dokku && #{make_cmd}"
|
||||
end
|
||||
|
||||
30
bootstrap.sh
30
bootstrap.sh
@@ -1,19 +1,21 @@
|
||||
DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"}
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"}
|
||||
|
||||
apt-get install -y linux-image-extra-`uname -r` software-properties-common
|
||||
add-apt-repository -y ppa:dotcloud/lxc-docker
|
||||
apt-get update && apt-get install -y lxc-docker git ruby nginx make
|
||||
if ! which apt-get &>/dev/null
|
||||
then
|
||||
echo "This installation script requires apt-get. For manual installation instructions, consult https://github.com/progrium/dokku ."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ~ && git clone ${DOKKU_REPO}
|
||||
cd dokku && make install
|
||||
cd buildstep && make build
|
||||
apt-get update
|
||||
apt-get install -y git make curl software-properties-common
|
||||
|
||||
/etc/init.d/nginx start
|
||||
start nginx-reloader
|
||||
|
||||
[[ $(dig +short $HOSTNAME) ]] && HOSTFILE=DOMAIN || HOSTFILE=HOSTNAME
|
||||
echo $HOSTNAME > /home/git/$HOSTFILE
|
||||
cd ~ && test -d dokku || git clone $DOKKU_REPO
|
||||
cd dokku && test $DOKKU_BRANCH && git checkout origin/$DOKKU_BRANCH || true
|
||||
make install
|
||||
|
||||
echo
|
||||
echo "Be sure to upload a public key for your user:"
|
||||
echo " cat ~/.ssh/id_rsa.pub | ssh root@$HOSTNAME \"gitreceive upload-key progrium\""
|
||||
echo "Almost done! For next steps on configuration:"
|
||||
echo " https://github.com/progrium/dokku#configuring"
|
||||
|
||||
Submodule buildstep deleted from 7853644156
121
contrib/dokku-installer.rb
Executable file
121
contrib/dokku-installer.rb
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env ruby
|
||||
require "sinatra"
|
||||
require "open3"
|
||||
|
||||
if ARGV[0] == "onboot"
|
||||
File.open("/etc/init/dokku-installer.conf", "w") do |f|
|
||||
f.puts "start on runlevel [2345]"
|
||||
f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct"
|
||||
end
|
||||
File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f|
|
||||
f.puts "upstream dokku-installer { server 127.0.0.1:2000; }"
|
||||
f.puts "server {"
|
||||
f.puts " listen 80;"
|
||||
f.puts " location / {"
|
||||
f.puts " proxy_pass http://dokku-installer;"
|
||||
f.puts " }"
|
||||
f.puts "}"
|
||||
end
|
||||
puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot."
|
||||
exit
|
||||
end
|
||||
|
||||
version = "v0.2.0"
|
||||
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
|
||||
template = DATA.read
|
||||
|
||||
set :port, 2000
|
||||
set :environment, :production
|
||||
disable :protection
|
||||
|
||||
get "/" do
|
||||
ERB.new(template).result binding
|
||||
end
|
||||
|
||||
post "/setup" do
|
||||
if params[:vhost] == "true"
|
||||
File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] }
|
||||
else
|
||||
`rm #{dokku_root}/VHOST`
|
||||
end
|
||||
File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] }
|
||||
Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key])
|
||||
Thread.new {
|
||||
`rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start`
|
||||
`rm /etc/init/dokku-installer.conf && stop dokku-installer`
|
||||
}.run if ARGV[0] == "selfdestruct"
|
||||
end
|
||||
|
||||
__END__
|
||||
<html>
|
||||
<head>
|
||||
<title>Dokku Setup</title>
|
||||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="width: 640px;">
|
||||
<form id="form" role="form">
|
||||
<h1>Dokku Setup <small><%= version %></small></h1>
|
||||
<div class="form-group">
|
||||
<h3><small style="text-transform: uppercase;">Admin Access</small></h3>
|
||||
<label for="key">Public Key</label><br />
|
||||
<textarea class="form-control" name="key" rows="7" id="key"><%= admin_key %></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<h3><small style="text-transform: uppercase;">Hostname Configuration</small></h3>
|
||||
<div class="form-group">
|
||||
<label for="hostname">Hostname</label>
|
||||
<input class="form-control" type="text" id="hostname" name="hostname" value="<%= hostname %>" />
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label><input id="vhost" name="vhost" type="checkbox" value="true"> Use <abbr title="Nginx will be run on port 80 and backend to your apps based on hostname">virtualhost naming</abbr> for apps</label>
|
||||
</div>
|
||||
<p>Your app URLs will look like:</p>
|
||||
<pre id="example">http://hostname:port</pre>
|
||||
</div>
|
||||
<button type="button" onclick="setup()" class="btn btn-primary">Finish Setup</button> <span style="padding-left: 20px;" id="result"></span>
|
||||
</form>
|
||||
</div>
|
||||
<div id="error-output"></div>
|
||||
<script>
|
||||
function setup() {
|
||||
if ($.trim($("#key").val()) == "") {
|
||||
alert("Your admin public key cannot be blank.")
|
||||
return
|
||||
}
|
||||
if ($.trim($("#hostname").val()) == "") {
|
||||
alert("Your hostname cannot be blank.")
|
||||
return
|
||||
}
|
||||
data = $("#form").serialize()
|
||||
$("input,textarea,button").prop("disabled", true);
|
||||
$.post('/setup', data)
|
||||
.done(function() {
|
||||
$("#result").html("Success!")
|
||||
window.location.href = "https://github.com/progrium/dokku#deploy-an-app";
|
||||
})
|
||||
.fail(function(data) {
|
||||
$("#result").html("Something went wrong...")
|
||||
$("#error-output").html(data.responseText)
|
||||
});
|
||||
}
|
||||
function update() {
|
||||
if ($("#vhost").is(":checked") && !isNaN($("#hostname").val()[0])) {
|
||||
alert("In order to use virtualhost naming, the hostname must not be an IP but a valid domain name.")
|
||||
$("#vhost").prop('checked', false);
|
||||
}
|
||||
if ($("#vhost").is(':checked')) {
|
||||
$("#example").html("http://<app-name>."+$("#hostname").val())
|
||||
} else {
|
||||
$("#example").html("http://"+$("#hostname").val()+":<app-port>")
|
||||
}
|
||||
}
|
||||
$("#vhost").change(update);
|
||||
$("#hostname").change(update);
|
||||
update();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
25
deploystep
25
deploystep
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
APP="$1"; CONTAINER="$2"
|
||||
|
||||
if [[ ! -f "$HOME/$APP/PORT" ]]; then
|
||||
# First deploy
|
||||
ID=$(docker run -d -p 5000 -e PORT=5000 $CONTAINER /bin/bash -c "/start web")
|
||||
echo $ID > "$HOME/$APP/CONTAINER"
|
||||
PORT=$(docker inspect $ID | ruby -e 'require"json";puts JSON.parse(STDIN.read)["NetworkSettings"]["PortMapping"]["5000"]')
|
||||
echo $PORT > "$HOME/$APP/PORT"
|
||||
if [[ -f "$HOME/DOMAIN" ]]; then
|
||||
HOSTNAME="${APP/\//-}.$(< "$HOME/DOMAIN")"
|
||||
$HOME/nginx-app-conf ${APP/\//-} $PORT $HOSTNAME > $HOME/$APP/nginx.conf
|
||||
nc -U $HOME/reload-nginx
|
||||
else
|
||||
HOSTNAME="$(< "$HOME/HOSTNAME"):$PORT"
|
||||
fi
|
||||
echo $HOSTNAME > "$HOME/$APP/HOSTNAME"
|
||||
else
|
||||
# Regular deploy
|
||||
OLDID=$(< "$HOME/$APP/CONTAINER")
|
||||
docker kill $OLDID > /dev/null
|
||||
PORT=$(< "$HOME/$APP/PORT")
|
||||
ID=$(docker run -d -p ":$PORT" -e "PORT=$PORT" $CONTAINER /bin/bash -c "/start web")
|
||||
echo $ID > "$HOME/$APP/CONTAINER"
|
||||
fi
|
||||
38
docs/advanced-installation.md
Normal file
38
docs/advanced-installation.md
Normal file
@@ -0,0 +1,38 @@
|
||||
#Advanced installation
|
||||
|
||||
## 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:
|
||||
|
||||
$ 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:
|
||||
|
||||
$ sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/gitreceive 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:
|
||||
|
||||
$ 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 version of the [buildstep] component by
|
||||
default. If you want to build your own version you can specify that with an env
|
||||
variable.
|
||||
|
||||
$ git clone https://github.com/progrium/dokku.git
|
||||
$ cd dokku
|
||||
$ sudo BUILD_STACK=true make install
|
||||
|
||||
[buildstep]: https://github.com/progrium/buildstep
|
||||
3
docs/index.md
Normal file
3
docs/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Dokku Documentation
|
||||
|
||||
Docs go here.
|
||||
106
dokku
Executable file
106
dokku
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
|
||||
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
||||
|
||||
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
|
||||
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
receive)
|
||||
APP="$2"; IMAGE="app/$APP"
|
||||
echo "-----> Building $APP ..."
|
||||
cat | dokku build $APP $IMAGE
|
||||
echo "-----> Releasing $APP ..."
|
||||
dokku release $APP $IMAGE
|
||||
echo "-----> Deploying $APP ..."
|
||||
dokku deploy $APP $IMAGE
|
||||
echo "-----> Cleaning up ..."
|
||||
dokku cleanup
|
||||
echo "=====> Application deployed:"
|
||||
echo " $(dokku url $APP)"
|
||||
echo
|
||||
;;
|
||||
|
||||
build)
|
||||
APP="$2"; IMAGE="$3"; CACHE_DIR="$HOME/$APP/cache"
|
||||
id=$(cat | docker run -i -a stdin progrium/buildstep /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 $IMAGE
|
||||
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
|
||||
;;
|
||||
|
||||
release)
|
||||
APP="$2"; IMAGE="$3"
|
||||
pluginhook pre-release $APP $IMAGE
|
||||
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 $IMAGE
|
||||
;;
|
||||
|
||||
deploy)
|
||||
APP="$2"; IMAGE="$3"
|
||||
pluginhook pre-deploy $APP $IMAGE
|
||||
|
||||
# kill the app when running
|
||||
if [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
docker kill $oldid > /dev/null
|
||||
fi
|
||||
|
||||
# start the app
|
||||
id=$(docker run -d -p 5000 -e PORT=5000 $IMAGE /bin/bash -c "/start web")
|
||||
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
|
||||
port=$(docker port $id 5000 | sed 's/0.0.0.0://')
|
||||
echo $port > "$DOKKU_ROOT/$APP/PORT"
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
|
||||
|
||||
pluginhook post-deploy $APP $port
|
||||
;;
|
||||
|
||||
cleanup)
|
||||
# delete all non-running container
|
||||
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm &> /dev/null &
|
||||
# delete unused images
|
||||
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi &> /dev/null &
|
||||
;;
|
||||
|
||||
plugins)
|
||||
ls -1 -d $PLUGIN_PATH/*/
|
||||
;;
|
||||
|
||||
plugins-install)
|
||||
pluginhook install
|
||||
;;
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
deploy:all)
|
||||
for app in $(ls -d $DOKKU_ROOT/*/); do
|
||||
APP=$(basename $app);
|
||||
IMAGE="app/$APP"
|
||||
dokku deploy $APP $IMAGE
|
||||
done
|
||||
;;
|
||||
|
||||
help)
|
||||
cat<<EOF | pluginhook commands help | sort
|
||||
help Print the list of commands
|
||||
plugins Print active plugins
|
||||
plugins-install Install active plugins
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
pluginhook commands "$@"
|
||||
;;
|
||||
|
||||
esac
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
APP="$1"; PORT="$2"; HOSTNAME="$3"
|
||||
cat<<EOF
|
||||
upstream $APP { server 127.0.0.1:$PORT; }
|
||||
server {
|
||||
listen 80;
|
||||
server_name $HOSTNAME;
|
||||
location / { proxy_pass http://$APP; }
|
||||
}
|
||||
EOF
|
||||
@@ -1,4 +0,0 @@
|
||||
script
|
||||
echo | sudo -u git nc -l -U /home/git/reload-nginx && /etc/init.d/nginx reload
|
||||
end script
|
||||
respawn
|
||||
10
plugins/00_dokku-standard/backup-export
Executable file
10
plugins/00_dokku-standard/backup-export
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
cat;
|
||||
[[ -f $BASE_DIR/.sshcommand ]] && echo "$BASE_DIR/.sshcommand"
|
||||
[[ -f $BASE_DIR/.ssh/authorized_keys ]] && echo "$BASE_DIR/.ssh/authorized_keys"
|
||||
[[ -f $BASE_DIR/HOSTNAME ]] && echo "$BASE_DIR/HOSTNAME"
|
||||
[[ -f $BASE_DIR/VHOST ]] && echo "$BASE_DIR/VHOST"
|
||||
15
plugins/00_dokku-standard/backup-import
Executable file
15
plugins/00_dokku-standard/backup-import
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
|
||||
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
||||
mkdir $TARGET_DIR/.ssh
|
||||
mv $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys
|
||||
chmod 0700 $TARGET_DIR/.ssh
|
||||
chmod 0600 $TARGET_DIR/.ssh/*
|
||||
fi
|
||||
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME
|
||||
[[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST
|
||||
79
plugins/00_dokku-standard/commands
Executable file
79
plugins/00_dokku-standard/commands
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
case "$1" in
|
||||
delete)
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Please specify an app to delete"
|
||||
exit 1
|
||||
fi
|
||||
APP="$2"; IMAGE="app/$APP";
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pluginhook pre-delete $APP
|
||||
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
|
||||
|
||||
docker stop $ID > /dev/null
|
||||
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
|
||||
docker rm $ID > /dev/null
|
||||
|
||||
pluginhook post-delete $APP
|
||||
;;
|
||||
|
||||
logs)
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Please specify an app to run the command on"
|
||||
exit 1
|
||||
fi
|
||||
APP="$2";
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
|
||||
docker logs $CONTAINER | tail -n 100
|
||||
if [[ $3 == "-t" ]]; then
|
||||
docker attach $CONTAINER
|
||||
fi
|
||||
;;
|
||||
|
||||
run)
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Please specify an app to run the command on"
|
||||
exit 1
|
||||
fi
|
||||
APP="$2"; IMAGE="app/$APP"
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
docker run -i -t -a stdout -a stderr $IMAGE /exec "$@"
|
||||
;;
|
||||
|
||||
url)
|
||||
APP="$2";
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
||||
echo $(< "$DOKKU_ROOT/$APP/URL")
|
||||
fi
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
delete <app> Delete an application
|
||||
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 URL for an application
|
||||
EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
cat
|
||||
21
plugins/00_dokku-standard/install
Executable file
21
plugins/00_dokku-standard/install
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
sed -i 's/docker -d$/docker -d -r=true/' /etc/init/docker.conf
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||
fi
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
# redeploys all apps after a reboot
|
||||
cat<<EOF > /etc/init/dokku-redeploy.conf
|
||||
description "Dokku app redeploy service"
|
||||
|
||||
start on (started docker)
|
||||
|
||||
script
|
||||
sleep 2 # give docker some time
|
||||
sudo -i -u dokku /usr/local/bin/dokku deploy:all
|
||||
end script
|
||||
EOF
|
||||
3
plugins/00_dokku-standard/post-delete
Executable file
3
plugins/00_dokku-standard/post-delete
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
[[ -n $1 ]] && rm -r "$DOKKU_ROOT/$1" > /dev/null
|
||||
2
plugins/WARNING
Normal file
2
plugins/WARNING
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
Please note that the hooks in Dokku are experimental and are likely to change quite a bit.
|
||||
78
plugins/backup/commands
Executable file
78
plugins/backup/commands
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
CURRENT_BACKUP_VERSION=1
|
||||
set -e; case "$1" in
|
||||
backup:export)
|
||||
OUTPUT_FILE="$2"
|
||||
BACKUP_DIR="$DOKKU_ROOT"
|
||||
|
||||
BACKUP_TMP_DIR=$(mktemp -d)
|
||||
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
|
||||
|
||||
pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
|
||||
|
||||
pushd $BACKUP_DIR > /dev/null
|
||||
ls -d */ | grep -oE '[^/]+' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
popd > /dev/null
|
||||
|
||||
# we want to insert the files in the root of the tar
|
||||
pushd $BACKUP_TMP_DIR > /dev/null
|
||||
echo $CURRENT_BACKUP_VERSION > .dokku_backup_version
|
||||
tar --append -f $BACKUP_TMP_FILE .dokku_backup_version
|
||||
tar --append -f $BACKUP_TMP_FILE .dokku_backup_apps
|
||||
popd > /dev/null
|
||||
|
||||
# if no file specified, output to stdout
|
||||
if [[ -z $OUTPUT_FILE ]]; then
|
||||
cat $BACKUP_TMP_FILE
|
||||
else
|
||||
mv $BACKUP_TMP_FILE $OUTPUT_FILE
|
||||
fi
|
||||
|
||||
rm -rf $BACKUP_TMP_DIR
|
||||
;;
|
||||
|
||||
backup:import)
|
||||
INPUT_FILE="$2"
|
||||
[[ -z $INPUT_FILE ]] && INPUT_FILE="-"
|
||||
|
||||
BACKUP_TMP_DIR=$(mktemp -d)
|
||||
|
||||
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
|
||||
|
||||
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
|
||||
echo "Unable to determine backup version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
|
||||
if [[ $VERSION -ne 1 ]]; then
|
||||
echo "Unknown format version $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Importing a version $VERSION backup..."
|
||||
|
||||
BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
|
||||
TARGET_DIR="$DOKKU_ROOT"
|
||||
|
||||
# create all the app directories
|
||||
while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps > /dev/null
|
||||
|
||||
# have the plugins import their stuff
|
||||
pluginhook backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
|
||||
rm -rf $BACKUP_TMP_DIR
|
||||
|
||||
echo "Import complete."
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
backup:export [file] Export dokku configuration files
|
||||
backup:import [file] Import dokku configuration files
|
||||
EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
cat
|
||||
6
plugins/config/backup-export
Executable file
6
plugins/config/backup-export
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
cat; find $BASE_DIR -regex ".*/ENV"
|
||||
10
plugins/config/backup-import
Executable file
10
plugins/config/backup-import
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
cd $IMPORT_DIR
|
||||
for file in `find . -regex ".*/ENV"`; do
|
||||
cp $file "$TARGET_DIR/$file"
|
||||
done
|
||||
176
plugins/config/commands
Executable file
176
plugins/config/commands
Executable file
@@ -0,0 +1,176 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# Check if name is specified
|
||||
if [[ $1 == config ]] || [[ $1 == config:* ]]; then
|
||||
if [[ -z $2 ]]; then
|
||||
echo "You must specify an app name"
|
||||
exit 1
|
||||
else
|
||||
APP="$2"
|
||||
ENV_FILE="$DOKKU_ROOT/$APP/ENV"
|
||||
|
||||
# Check if app exists with the same name
|
||||
if [ ! -d "$DOKKU_ROOT/$APP" ]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -f $ENV_FILE ] || {
|
||||
echo "-----> Creating $ENV_FILE"
|
||||
touch $ENV_FILE
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
config_styled_hash () {
|
||||
vars=`echo -e "$1"`
|
||||
|
||||
longest=""
|
||||
for word in $vars; do
|
||||
KEY=`echo $word | cut -d"=" -f1`
|
||||
if [ ${#KEY} -gt ${#longest} ]; then
|
||||
longest=$KEY
|
||||
fi
|
||||
done
|
||||
|
||||
for word in $vars; do
|
||||
KEY=`echo $word | cut -d"=" -f1`
|
||||
VALUE=`echo $word | cut -d"=" -f2-`
|
||||
|
||||
num_zeros=$((${#longest} - ${#KEY}))
|
||||
zeros=" "
|
||||
while [ $num_zeros -gt 0 ]; do
|
||||
zeros="$zeros "
|
||||
num_zeros=$(($num_zeros - 1))
|
||||
done
|
||||
echo "$KEY:$zeros$VALUE"
|
||||
done
|
||||
}
|
||||
|
||||
config_restart_app() {
|
||||
APP="$1"; IMAGE="app/$APP"
|
||||
|
||||
echo "-----> Releasing $APP ..."
|
||||
dokku release $APP $IMAGE
|
||||
echo "-----> Release complete!"
|
||||
echo "-----> Deploying $APP ..."
|
||||
dokku deploy $APP $IMAGE
|
||||
echo "-----> Deploy complete!"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
config)
|
||||
APP="$2"
|
||||
|
||||
if [ ! -f $ENV_FILE ] || [ ! -s $ENV_FILE ] ; then
|
||||
echo "$APP has no config vars"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VARS=`cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | cut -d" " -f2`
|
||||
|
||||
for var in "$@"; do
|
||||
if [[ "$var" == "--shell" ]]; then
|
||||
echo $VARS
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "=== $APP Config Vars"
|
||||
config_styled_hash "$VARS"
|
||||
;;
|
||||
|
||||
config:get)
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:get APP KEY"
|
||||
echo "Must specify KEY."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $ENV_FILE ] || [ ! -s $ENV_FILE ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KEY="$3"
|
||||
|
||||
cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | cut -d" " -f2 | grep "^$KEY=" | cut -d"=" -f2-
|
||||
;;
|
||||
|
||||
config:set)
|
||||
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
|
||||
|
||||
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
|
||||
ENV_ADD=""
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
ID=$(< "$APP_DIR/CONTAINER")
|
||||
RESTART=false
|
||||
VARS="${*:3}"
|
||||
|
||||
for var in $VARS; do
|
||||
if [[ $var != *"="* ]]; then
|
||||
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
|
||||
echo "Must specify KEY and VALUE to set."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for var in $VARS; do
|
||||
KEY=`echo ${var} | cut -d"=" -f1`
|
||||
VALUE=`echo ${var} | cut -d"=" -f2-`
|
||||
|
||||
if [[ $KEY == [a-zA-Z_][a-zA-Z0-9_]* ]]; then
|
||||
RESTART_APP=true
|
||||
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $KEY=/ d")
|
||||
ENV_TEMP="${ENV_TEMP}\nexport ${var}"
|
||||
ENV_ADD=$(echo -e "${ENV_ADD}" | sed "/^$KEY=/ d")
|
||||
ENV_ADD="${ENV_ADD}\n${var}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $RESTART_APP ]; then
|
||||
echo "-----> Setting config vars and restarting $APP"
|
||||
config_styled_hash "$ENV_ADD"
|
||||
|
||||
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE
|
||||
config_restart_app $APP
|
||||
fi
|
||||
;;
|
||||
|
||||
config:unset)
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
|
||||
echo "Must specify KEY to unset."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
ID=$(< "$APP_DIR/CONTAINER")
|
||||
VARS="${*:3}"
|
||||
|
||||
for var in $VARS; do
|
||||
echo "-----> Unsetting $var and restarting $APP"
|
||||
ENV_TEMP=$(echo -e "${ENV_TEMP}" | sed "/^export $var=/ d")
|
||||
|
||||
echo -e "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE
|
||||
config_restart_app $APP
|
||||
done
|
||||
;;
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
config <app> display the config vars for an app
|
||||
config:get <app> KEY display a config value for an app
|
||||
config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] set one or more config vars
|
||||
config:unset <app> KEY1 [KEY2 ...] unset one or more config vars
|
||||
EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
cat
|
||||
18
plugins/git/backup-import
Executable file
18
plugins/git/backup-import
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
APPS="$4"
|
||||
|
||||
while read APP; do
|
||||
APP_PATH="$TARGET_DIR/$APP";
|
||||
git init --bare $APP_PATH > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > $PRERECEIVE_HOOK <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e; set -o pipefail;
|
||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||
EOF
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
done < $APPS > /dev/null
|
||||
40
plugins/git/commands
Executable file
40
plugins/git/commands
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
git-hook)
|
||||
APP=$2
|
||||
|
||||
while read oldrev newrev refname
|
||||
do
|
||||
# Only run this script for the master branch. You can remove this
|
||||
# if block if you wish to run it for others as well.
|
||||
if [[ $refname = "refs/heads/master" ]] ; then
|
||||
git archive $newrev | dokku receive $APP | sed -u "s/^/"$'\e[1G'"/"
|
||||
fi
|
||||
|
||||
done
|
||||
;;
|
||||
|
||||
git-*)
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d $APP_PATH ]]; then
|
||||
git init --bare $APP_PATH > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > $PRERECEIVE_HOOK <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e; set -o pipefail;
|
||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||
EOF
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
fi
|
||||
|
||||
args=$@
|
||||
git-shell -c "$args"
|
||||
;;
|
||||
|
||||
esac
|
||||
cat
|
||||
|
||||
6
plugins/nginx-vhosts/backup-export
Executable file
6
plugins/nginx-vhosts/backup-export
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
cat; find $BASE_DIR -regex ".*ssl/server\(.crt\|.key\)";
|
||||
12
plugins/nginx-vhosts/backup-import
Executable file
12
plugins/nginx-vhosts/backup-import
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
cd $IMPORT_DIR
|
||||
|
||||
for file in `find . -regex ".*ssl/server\(.crt\|.key\)"`; do
|
||||
mkdir -p $(dirname $TARGET_DIR$file)
|
||||
cp $file $TARGET_DIR$file
|
||||
done
|
||||
3
plugins/nginx-vhosts/commands
Executable file
3
plugins/nginx-vhosts/commands
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
cat
|
||||
25
plugins/nginx-vhosts/install
Executable file
25
plugins/nginx-vhosts/install
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# latest stable NGINX 1.4.x with websocket support
|
||||
add-apt-repository -y ppa:nginx/stable
|
||||
apt-get update
|
||||
apt-get install -y nginx dnsutils
|
||||
|
||||
if ! grep -q dokku-nginx-reload "/etc/sudoers"; then
|
||||
touch /etc/sudoers.tmp
|
||||
cp /etc/sudoers /tmp/sudoers.new
|
||||
echo "%dokku ALL=(ALL)NOPASSWD:/etc/init.d/nginx reload # dokku-nginx-reload" >> /tmp/sudoers.new
|
||||
EDITOR="cp /tmp/sudoers.new" visudo
|
||||
rm /tmp/sudoers.new
|
||||
fi
|
||||
|
||||
echo "include $DOKKU_ROOT/*/nginx.conf;" > /etc/nginx/conf.d/dokku.conf
|
||||
|
||||
sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
fi
|
||||
|
||||
/etc/init.d/nginx start
|
||||
3
plugins/nginx-vhosts/post-delete
Executable file
3
plugins/nginx-vhosts/post-delete
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
83
plugins/nginx-vhosts/post-deploy
Executable file
83
plugins/nginx-vhosts/post-deploy
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; PORT="$2"
|
||||
WILDCARD_SSL="$DOKKU_ROOT/ssl"
|
||||
SSL="$DOKKU_ROOT/$APP/ssl"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
VHOST=$(< "$DOKKU_ROOT/VHOST")
|
||||
SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
else
|
||||
hostname="${APP/\//-}.$VHOST"
|
||||
fi
|
||||
|
||||
if [[ -f "$SSL/server.crt" ]] && [[ -f "$SSL/server.key" ]]; then
|
||||
SSL_INUSE="$SSL"
|
||||
elif [[ -f "$WILDCARD_SSL/server.crt" ]] && [[ -f "$WILDCARD_SSL/server.key" ]] && [[ $hostname = `openssl x509 -in $WILDCARD_SSL/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-` ]]; then
|
||||
SSL_INUSE="$WILDCARD_SSL"
|
||||
fi
|
||||
|
||||
# ssl based nginx.conf
|
||||
if [[ -n "$SSL_INUSE" ]]; then
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
|
||||
upstream $APP { server 127.0.0.1:$PORT; }
|
||||
server {
|
||||
listen 80;
|
||||
server_name $hostname;
|
||||
return 301 https://\$host\$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
server_name $hostname;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate $SSL_INUSE/server.crt;
|
||||
ssl_certificate_key $SSL_INUSE/server.key;
|
||||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!CAMELLIA;
|
||||
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
location / {
|
||||
proxy_pass http://$APP;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host \$http_host;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||
proxy_set_header X-Forwarded-Port \$server_port;
|
||||
proxy_set_header X-Request-Start \$msec;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL"
|
||||
else
|
||||
# default nginx.conf
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
|
||||
upstream $APP { server 127.0.0.1:$PORT; }
|
||||
server {
|
||||
listen 80;
|
||||
server_name $hostname;
|
||||
location / {
|
||||
proxy_pass http://$APP;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host \$http_host;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_set_header X-Forwarded-For \$remote_addr;
|
||||
proxy_set_header X-Forwarded-Port \$server_port;
|
||||
proxy_set_header X-Request-Start \$msec;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "http://$hostname" > "$DOKKU_ROOT/$APP/URL"
|
||||
fi
|
||||
pluginhook nginx-pre-reload $APP
|
||||
sudo /etc/init.d/nginx reload > /dev/null
|
||||
fi
|
||||
14
receiver
14
receiver
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
APP="$1"
|
||||
CONTAINER="app/$APP"
|
||||
|
||||
echo "-----> Building $APP ..."
|
||||
cat | $HOME/buildstep $CONTAINER
|
||||
echo "-----> Build complete!"
|
||||
|
||||
echo "-----> Deploying $APP ..."
|
||||
$HOME/deploystep $APP $CONTAINER
|
||||
echo "-----> Application deployed:"
|
||||
echo " http://$(< "$HOME/$APP/HOSTNAME")"
|
||||
echo
|
||||
1
tests/apps/.go.disabled/.godir
Normal file
1
tests/apps/.go.disabled/.godir
Normal file
@@ -0,0 +1 @@
|
||||
web
|
||||
1
tests/apps/.go.disabled/Procfile
Normal file
1
tests/apps/.go.disabled/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: web
|
||||
2
tests/apps/.go.disabled/check_deploy
Executable file
2
tests/apps/.go.disabled/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; test "$(curl -s $1)" == "go"
|
||||
20
tests/apps/.go.disabled/web.go
Normal file
20
tests/apps/.go.disabled/web.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", hello)
|
||||
fmt.Println("listening...")
|
||||
err := http.ListenAndServe(":"+os.Getenv("PORT"), nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func hello(res http.ResponseWriter, req *http.Request) {
|
||||
fmt.Fprintln(res, "go")
|
||||
}
|
||||
1
tests/apps/.websocket.disabled/Procfile
Normal file
1
tests/apps/.websocket.disabled/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: node app.js
|
||||
1
tests/apps/.websocket.disabled/README.md
Normal file
1
tests/apps/.websocket.disabled/README.md
Normal file
@@ -0,0 +1 @@
|
||||
node websocket demo
|
||||
75
tests/apps/.websocket.disabled/app.js
Normal file
75
tests/apps/.websocket.disabled/app.js
Normal file
@@ -0,0 +1,75 @@
|
||||
var express = require('express')
|
||||
, exphbs = require('express3-handlebars')
|
||||
, http = require('http')
|
||||
, connect = require('connect')
|
||||
, io = require('socket.io');
|
||||
|
||||
|
||||
|
||||
var app = express();
|
||||
|
||||
app.engine('handlebars',exphbs({extname: ".html", layoutsDir:"views/", defaultLayout: 'layout'}));
|
||||
app.set('view engine', 'handlebars');
|
||||
/* NOTE: We'll need to refer to the sessionStore container later. To
|
||||
* accomplish this, we'll create our own and pass it to Express
|
||||
* rather than letting it create its own. */
|
||||
var sessionStore = new connect.session.MemoryStore();
|
||||
/* NOTE: We'll need the site secret later too, so let's factor it out.
|
||||
* The security implications of this are left to the reader. */
|
||||
var SITE_SECRET = 'I am not wearing any pants';
|
||||
|
||||
|
||||
// app.configure(function(){
|
||||
// app.set('view engine', 'handlebars');
|
||||
// // app.set("view options", { layout: false })
|
||||
// });
|
||||
|
||||
app.set('views', __dirname + '/views');
|
||||
// app.register('.html', require('handlebars'));
|
||||
/*
|
||||
* ... skipping some of your app settings ...
|
||||
*/
|
||||
app.use(express.bodyParser());
|
||||
/* NOTE: Pass the cookieParser the site secret. It used to be that
|
||||
* express.session() got the secret, but in Express 3 that's
|
||||
* no longer the case. */
|
||||
app.use(express.cookieParser(SITE_SECRET));
|
||||
/* NOTE: We'll need to know the key used to store the session, so
|
||||
* we explicitly define what it should be. Also, we pass in
|
||||
* our sessionStore container here. */
|
||||
app.use(express.session({
|
||||
key: 'express.sid'
|
||||
, store: sessionStore
|
||||
}));
|
||||
|
||||
app.use(express.static('public'));
|
||||
/*
|
||||
* ... skipping the rest of your app settings ...
|
||||
*/
|
||||
|
||||
app.get('/', function(req, res){
|
||||
res.render('index', {socket_url:"ciaourl"});
|
||||
});
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
var app_port = process.env.PORT || 3000;
|
||||
server.listen(app_port, function(){
|
||||
console.log("Express server listening on port "+ app_port);
|
||||
});
|
||||
|
||||
/**
|
||||
* Socket.io
|
||||
*/
|
||||
var sio = io.listen(server);
|
||||
|
||||
|
||||
sio.sockets.on('connection', function (socket) {
|
||||
|
||||
// temperature
|
||||
setInterval(function () {
|
||||
var val = (new Date).getTime();
|
||||
socket.emit('new value', { val: "I'm a websocket message: "+val });
|
||||
}, 2000);
|
||||
|
||||
});
|
||||
2
tests/apps/.websocket.disabled/check_deploy
Executable file
2
tests/apps/.websocket.disabled/check_deploy
Executable file
@@ -0,0 +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"
|
||||
16
tests/apps/.websocket.disabled/package.json
Normal file
16
tests/apps/.websocket.disabled/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "node-websocket-app",
|
||||
"version": "0.0.0",
|
||||
"description": "a basic webscket demo",
|
||||
"author": "Luigi Maselli",
|
||||
"dependencies": {
|
||||
"express": "3.1.x",
|
||||
"connect": "*",
|
||||
"handlebars": "~1.0.9",
|
||||
"socket.io": "~0.9.13",
|
||||
"express3-handlebars": "~0.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.x"
|
||||
}
|
||||
}
|
||||
2
tests/apps/.websocket.disabled/public/jquery.min.js
vendored
Normal file
2
tests/apps/.websocket.disabled/public/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
tests/apps/.websocket.disabled/views/index.handlebars
Normal file
5
tests/apps/.websocket.disabled/views/index.handlebars
Normal file
@@ -0,0 +1,5 @@
|
||||
<h2>I'm a static HTTP message</h2>
|
||||
<h1 id="display">
|
||||
No messages
|
||||
</h1>
|
||||
<p>If you get many GET messages in your console it isn't websocket but socket.io fallback mode</p>
|
||||
25
tests/apps/.websocket.disabled/views/layout.html
Normal file
25
tests/apps/.websocket.disabled/views/layout.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Websocket demo Socket.io</title>
|
||||
<script src="./socket.io/socket.io.js"></script>
|
||||
<script src="./jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var socket = io.connect( window.location.origin ); // transparent HTTP / Websocket upgrade
|
||||
|
||||
socket.on('new value', function (data) {
|
||||
console.log("RECV:"+ JSON.stringify(data));
|
||||
$('#display').html(data.val);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
{{{body}}}
|
||||
</body>
|
||||
</html>
|
||||
2
tests/apps/nodejs-express/check_deploy
Executable file
2
tests/apps/nodejs-express/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "nodejs/express"
|
||||
2
tests/apps/php/check_deploy
Executable file
2
tests/apps/php/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "<html><h3>php</h3></html>"
|
||||
1
tests/apps/php/index.php
Normal file
1
tests/apps/php/index.php
Normal file
@@ -0,0 +1 @@
|
||||
<html><?php echo '<h3>php</h3>'; ?></html>
|
||||
1
tests/apps/python-flask/Procfile
Normal file
1
tests/apps/python-flask/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: gunicorn hello:app
|
||||
2
tests/apps/python-flask/check_deploy
Executable file
2
tests/apps/python-flask/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "python/flask"
|
||||
8
tests/apps/python-flask/hello.py
Normal file
8
tests/apps/python-flask/hello.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import os
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def hello():
|
||||
return 'python/flask'
|
||||
5
tests/apps/python-flask/requirements.txt
Normal file
5
tests/apps/python-flask/requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Flask==0.9
|
||||
Jinja2==2.6
|
||||
Werkzeug==0.8.3
|
||||
gunicorn==0.17.2
|
||||
|
||||
36
tests/ci/receiver
Executable file
36
tests/ci/receiver
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
export PATH=/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/bin:/usr/local/bin
|
||||
unset GIT_DIR
|
||||
|
||||
if [[ $2 == *dokku* ]]; then
|
||||
rm -rf /tmp/build
|
||||
mkdir /tmp/build
|
||||
cd /tmp/build
|
||||
tar -xf -
|
||||
echo "-----> Installing dependencies"
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y git make curl software-properties-common
|
||||
echo "-----> Set hostname to dokku.me"
|
||||
hostname dokku.me
|
||||
echo "-----> Enabling tracing"
|
||||
mkdir -p /home/dokku
|
||||
echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc
|
||||
echo "-----> Running make install"
|
||||
DEBIAN_FRONTEND=noninteractive make install
|
||||
echo "-----> Generating keypair..."
|
||||
echo -e "y\n" | ssh-keygen -f /root/.ssh/id_rsa -t rsa -N ''
|
||||
echo "-----> Installing SSH public key..."
|
||||
cat /root/.ssh/id_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
|
||||
echo "-----> Running tests"
|
||||
cd tests
|
||||
for app_path in apps/*; do
|
||||
app=$(basename $app_path)
|
||||
echo "-----> Running test deploy of $app..."
|
||||
./test_deploy $app_path dokku.me $FORWARDED_PORT
|
||||
done
|
||||
else
|
||||
echo "-----> Repository invalid."
|
||||
fi
|
||||
27
tests/ci/setup.sh
Executable file
27
tests/ci/setup.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get install -y git make curl
|
||||
|
||||
cd /tmp
|
||||
|
||||
wget http://j.mp/godeb
|
||||
tar -zxvf ./godeb
|
||||
./godeb install 1.1.2
|
||||
|
||||
export GOPATH=/root/go
|
||||
git clone https://github.com/flynn/gitreceive-next.git
|
||||
cd gitreceive-next && make install
|
||||
|
||||
ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
|
||||
|
||||
cat<<EOF > /etc/init/gitreceived.conf
|
||||
start on runlevel [2345]
|
||||
exec /usr/local/bin/gitreceived -p 2022 -n /root/.ssh/id_rsa /tmp/receiver
|
||||
EOF
|
||||
|
||||
cat<<EOF > /etc/rc.local
|
||||
curl https://raw.github.com/progrium/dokku/master/tests/ci/receiver -s > /tmp/receiver
|
||||
chmod +x /tmp/receiver
|
||||
EOF
|
||||
@@ -1,18 +1,19 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
KEYNAME="$1"
|
||||
indent() { sed "s/^/ /"; }
|
||||
echo "-----> Booting EC2 instance..."
|
||||
start=$(ec2-run-instances -k $1 ami-f3d1bb9a 2>/dev/null)
|
||||
start=$(ec2-run-instances -k $1 ami-f3d1bb9a 2>&1 )
|
||||
if [[ $? > 0 ]]; then
|
||||
echo "$start"
|
||||
exit
|
||||
echo "$start" | indent
|
||||
exit 3
|
||||
fi
|
||||
INSTANCE=$(echo "$start" | awk '/^INSTANCE/ {print $2}')
|
||||
terminate() {
|
||||
echo "-----> Terminating $INSTANCE..."
|
||||
ec2-terminate-instances $INSTANCE &>/dev/null && echo " Shutting down"
|
||||
}
|
||||
trap "terminate" EXIT
|
||||
[[ $NOCLEANUP ]] || trap "terminate" EXIT
|
||||
sleep 30
|
||||
status=""
|
||||
while [[ "$status" != "running" ]]; do
|
||||
@@ -27,6 +28,17 @@ while [[ "$status" != "running" ]]; do
|
||||
done
|
||||
PUBLIC_IP=$(echo "$info" | awk '{print $14}')
|
||||
echo "-----> Waiting for SSH at $PUBLIC_IP..."
|
||||
sleep 10
|
||||
echo "-----> Connecting and running boostrap script..."
|
||||
cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent
|
||||
while [[ ! $(echo | nc $PUBLIC_IP 22) ]]; do
|
||||
sleep 5
|
||||
echo " Waiting..."
|
||||
done
|
||||
set -e
|
||||
echo "-----> Connecting and running bootstrap script..."
|
||||
cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent
|
||||
echo "-----> Installing SSH public keys..."
|
||||
cat ~/.ssh/id_rsa.pub | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "sudo sshcommand acl-add dokku test" > /dev/null
|
||||
for app_path in apps/*; do
|
||||
app=$(basename $app_path)
|
||||
echo "-----> Running test deploy of $app..."
|
||||
./test_deploy $app_path $PUBLIC_IP
|
||||
done
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
SELF=`which $0`
|
||||
VAGRANT_SSH_PORT=${$VAGRANT_SSH_PORT:-"2222"}
|
||||
PUBLIC_KEY=${PUBLIC_KEY:-"~/.ssh/id_rsa.pub"}
|
||||
VAGRANT_SSH_PORT=${VAGRANT_SSH_PORT:-"2222"}
|
||||
PUBLIC_KEY=${PUBLIC_KEY:-"$HOME/.ssh/id_rsa.pub"}
|
||||
FORWARDED_PORT=${FORWARDED_PORT:-":8080"}
|
||||
indent() { sed "s/^/ /"; }
|
||||
if [[ ! $(cat ~/.ssh/config 2>/dev/null | grep dokku.me) ]]; then
|
||||
echo "-----> Configuring SSH to use $VAGRANT_SSH_PORT for dokku.me..."
|
||||
@@ -11,4 +13,13 @@ if [[ ! $(cat ~/.ssh/config 2>/dev/null | grep dokku.me) ]]; then
|
||||
fi
|
||||
echo "-----> Ensuring Vagrant is running..."
|
||||
cd "$(dirname $SELF)/.." && vagrant up | indent
|
||||
cat $PUBLIC_KEY | ssh -o "StrictHostKeyChecking=no" -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo gitreceive upload-key test"
|
||||
cd "$(dirname $SELF)"
|
||||
|
||||
echo "-----> Installing SSH public keys..."
|
||||
cat $PUBLIC_KEY | ssh -o "StrictHostKeyChecking=no" -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo sshcommand acl-add dokku test"
|
||||
|
||||
for app_path in apps/*; do
|
||||
app=$(basename $app_path)
|
||||
echo "-----> Running test deploy of $app..."
|
||||
./test_deploy $app_path dokku.me $FORWARDED_PORT
|
||||
done
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#!/bin/bash
|
||||
# set -e
|
||||
SELF=`which $0`; APP="$1"; TARGET="$2"
|
||||
TMP=$(mktemp -d -t $TARGET)
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
SELF=`which $0`; APP="$1"; TARGET="$2"; FORWARDED_PORT="$3"
|
||||
TMP=$(mktemp -d -t "$TARGET.XXXXX")
|
||||
trap "rm -rf $TMP" EXIT
|
||||
cp -r $(dirname $SELF)/$APP/* $TMP
|
||||
rmdir $TMP && cp -r $(dirname $SELF)/$APP $TMP
|
||||
cd $TMP
|
||||
git init
|
||||
git config user.email "robot@example.com"
|
||||
git config user.name "Test Robot"
|
||||
git add .
|
||||
git commit -m 'initial commit'
|
||||
REPO="test-$RANDOM"
|
||||
git remote add target git@$TARGET:$REPO
|
||||
URL_FILE=$(mktemp -t url)
|
||||
git push target master 2>&1 | while read line; do
|
||||
echo "$line"
|
||||
[[ $(echo "$line" | grep $TARGET | grep remote) ]] && echo "$line" | awk '{print $2}' > $URL_FILE
|
||||
done
|
||||
set -x
|
||||
URL=$(<$URL_FILE)
|
||||
curl -v "$URL:8080" # GAHAHHHHH WHY DOESNT THIS WORK
|
||||
rm $URL_FILE
|
||||
REPO="test-$(basename $APP)-$RANDOM"
|
||||
git remote add target dokku@$TARGET:$REPO
|
||||
git push target master
|
||||
URL=$(ssh dokku@$TARGET url $REPO)$FORWARDED_PORT
|
||||
sleep 2
|
||||
./check_deploy $URL && echo "-----> Deploy success!" || {
|
||||
sleep 4
|
||||
./check_deploy $URL && echo "-----> Deploy success!"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user