Compare commits

...

137 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
416dac6d2b Release 0.3.11 2014-12-23 17:17:36 -05:00
Jose Diaz-Gonzalez
9a04104bb9 Merge pull request #844 from progrium/mh-fix-ssl-urls
build app urls based on wildcard ssl or app ssl
2014-12-23 17:13:40 -05:00
Michael Hobbs
43fe6edb04 build app urls based on wildcard ssl or app ssl 2014-12-23 13:52:50 -08:00
Michael Hobbs
3a850fa05e fix typo in nickname. aka i cannot spell 2014-12-23 05:31:27 -08:00
Jose Diaz-Gonzalez
097bdecfac Merge pull request #839 from progrium/mh-irc-build-notifications
notify irc on builds
2014-12-23 01:30:56 -05:00
Michael Hobbs
1d4cc0b991 notify irc on builds 2014-12-22 22:07:43 -08:00
Jose Diaz-Gonzalez
3e62b1acce Merge pull request #838 from expa/mh-build-env-special-chars
quote build_env vars
2014-12-23 00:35:53 -05:00
Michael Hobbs
c2911c94a8 quote build_env vars 2014-12-22 15:52:54 -08:00
Jose Diaz-Gonzalez
f5a5f7702b Merge pull request #833 from expa/mh-fix-orphaned-app-image
auto remove the cache dir cleanup container
2014-12-22 10:22:47 -05:00
Jose Diaz-Gonzalez
5f2a5fe2bc Merge pull request #821 from expa/mh-unit-tests
use wercker for automated testing
2014-12-22 10:21:17 -05:00
Michael Hobbs
50208862b2 revert to florianheinemann's nginx buildpack for static sites 2014-12-21 14:51:42 -08:00
Michael Hobbs
283432f214 domains plugin unit tests and fix for errant substring match 2014-12-21 14:51:42 -08:00
Michael Hobbs
d1e94f6c91 use buildpack fork that preserves CHECKS file location 2014-12-21 14:51:42 -08:00
Michael Hobbs
dbb6560b1e fix static site test 2014-12-21 14:51:42 -08:00
Michael Hobbs
f3535292b3 reference issues for disabled deploy tests 2014-12-21 14:51:42 -08:00
Michael Hobbs
568902302b echo out deploy test type correctly 2014-12-21 14:51:42 -08:00
Michael Hobbs
cddcf997e1 make sure we test the check-deploy plugin 2014-12-21 14:51:42 -08:00
Michael Hobbs
f2bd2b8541 nullglob. closes: #822 2014-12-21 14:51:42 -08:00
Michael Hobbs
6bb01404ec poor lint fix choice. let's not do that. 2014-12-21 14:51:42 -08:00
Michael Hobbs
e8b4bd5a89 lintball 2014-12-21 14:51:42 -08:00
Michael Hobbs
2695d957ac add wercker status to readme 2014-12-21 14:51:41 -08:00
Michael Hobbs
051b286a62 disable multipack buildpack test for now 2014-12-21 14:51:41 -08:00
Michael Hobbs
67b7fa6263 handle config with spaces over ssh 2014-12-21 14:51:41 -08:00
Michael Hobbs
c697c65508 WIP 2014-12-21 14:51:41 -08:00
Michael Hobbs
85f9bb3aae disable SC2143 2014-12-21 14:51:41 -08:00
Michael Hobbs
c5c0ae00ba show logs in deploy tests 2014-12-21 14:51:41 -08:00
Michael Hobbs
0dec01c324 fix php test 2014-12-21 14:51:41 -08:00
Michael Hobbs
3827e38caa set nullglob 2014-12-21 14:51:41 -08:00
Michael Hobbs
14a7cac686 update php and static tests 2014-12-21 14:51:41 -08:00
Michael Hobbs
9322200eae lintball 2014-12-21 14:51:41 -08:00
Michael Hobbs
ee32b05a36 test against both buildstep release and master 2014-12-21 14:51:41 -08:00
Michael Hobbs
3b41d6d16f create build env for both dokku and new style buildpacks 2014-12-21 14:51:41 -08:00
Jose Diaz-Gonzalez
8aef43b3ae Release 0.3.8 2014-12-21 14:51:41 -08:00
Jose Diaz-Gonzalez
e45455b73f Ensure makefiles are properly formatted 2014-12-21 14:51:41 -08:00
Joel Van Horn
356acdd08d Point users to upgrade guides 2014-12-21 14:51:41 -08:00
Michael Hobbs
f9b7d5378d lintball in build-env 2014-12-21 14:51:41 -08:00
Michael Hobbs
58d0bc983a don't use bats for deploy tests 2014-12-21 14:51:41 -08:00
Michael Hobbs
81aefba305 fix multipack app deploy test 2014-12-21 14:51:41 -08:00
Michael Hobbs
8f5c5d5ae2 reference opened issue with buildstep 2014-12-21 14:51:40 -08:00
Michael Hobbs
8025657a38 save error in output if curl errors 2014-12-21 14:51:40 -08:00
Michael Hobbs
779808f832 make sure we set the default VHOST to match test env 2014-12-21 14:51:40 -08:00
Michael Hobbs
d3e18d3362 fix failure output 2014-12-21 14:51:40 -08:00
Michael Hobbs
606bbda66c make tests work 2014-12-21 14:51:40 -08:00
Michael Hobbs
3706392e65 test with wercker 2014-12-21 14:51:40 -08:00
Michael Hobbs
ab7c313411 Merge pull request #835 from expa/mh-fix-substring-match
[domains] make sure we match the specific string in VHOST
2014-12-21 14:51:25 -08:00
Michael Hobbs
f797ff77f4 make sure we match the specific string in VHOST 2014-12-21 13:57:45 -08:00
Michael Hobbs
c2736c7c7a auto remove the cache dir cleanup container 2014-12-20 17:20:32 -08:00
Jose Diaz-Gonzalez
af671b2aba Release 0.3.10 2014-12-19 15:17:17 -05:00
Jose Diaz-Gonzalez
45b2f87b15 Merge pull request #831 from progrium/nginx-docs
Nginx docs
2014-12-19 15:13:14 -05:00
Jose Diaz-Gonzalez
3d6727a1b8 Add documentation for configuring the nginx domains and vhosts 2014-12-19 15:10:10 -05:00
Jose Diaz-Gonzalez
bf4781a5d7 Use shell keyword for codeblock guard 2014-12-19 15:09:38 -05:00
Michael Hobbs
2d48d81d09 Merge pull request #828 from andrewsomething/port
Display the port for an app when falling back to the ip address.
2014-12-18 14:10:11 -08:00
Andrew Starr-Bochicchio
294b419da5 Display the port for an app when falling back to the ip address. 2014-12-17 21:20:18 -05:00
Jose Diaz-Gonzalez
f1bfb3ed3a Merge pull request #827 from expa/mh-mv-default-vhost-to-core
Handle IP only access
2014-12-17 19:53:59 -05:00
Michael Hobbs
56472bd08c VHOST fallback 2014-12-16 23:01:32 -08:00
Michael Hobbs
e99e2201cb mv default VHOST creation to core install 2014-12-16 20:25:44 -08:00
Jose Diaz-Gonzalez
5bf1ba7ed7 Merge pull request #783 from progrium/nginx-cleanup
New domains plugin and nginx extension
2014-12-16 17:15:30 -05:00
Jose Diaz-Gonzalez
5d014d0a8e Merge pull request #823 from expa/nginx-cleanup
show URLS with scheme. now with bug fixes!!!
2014-12-16 16:26:47 -05:00
Michael Hobbs
59f047bb45 include SSL_VHOSTS in NOSSL_SERVER_NAME so we can redirect from http to https on the secure hostname as well 2014-12-16 12:15:10 -08:00
Michael Hobbs
1b208778f3 bugfixes
- don't match substrings in VHOSTS
 - handle case where NOSSL_SERVER_NAME is \' \'
 - rebuild nginx config on ssl import
 - prevent cwd errors after we rm the temp dir
2014-12-15 18:10:14 -08:00
Michael Hobbs
a6cdae5abf reset VHOST to default upon domains:clear 2014-12-15 18:04:00 -08:00
Michael Hobbs
50115d3640 print out urls with scheme 2014-12-15 18:02:57 -08:00
Michael Hobbs
78d3921a6f don't break other nginx plugins like nginx-alt 2014-12-15 13:15:40 -08:00
Jose Diaz-Gonzalez
23d4224beb Merge pull request #818 from expa/nginx-cleanup
rebuild nginx config on domain change
2014-12-14 18:31:43 -05:00
Michael Hobbs
4e0670f1ac rebuild nginx config on domain change 2014-12-12 17:53:30 -08:00
Jose Diaz-Gonzalez
0bd8d71bb9 Release 0.3.9 2014-12-12 09:58:02 -05:00
Jose Diaz-Gonzalez
12ee9bc3e7 Merge pull request #816 from progrium/build-env-docs
Add documentation for user-env feature
2014-12-12 09:56:46 -05:00
Jose Diaz-Gonzalez
a991c450be Remove user-env-compile plugins from docs 2014-12-12 09:55:41 -05:00
Jose Diaz-Gonzalez
a900aa45d6 Add documentation for the recent build-env feature addition 2014-12-12 09:54:26 -05:00
Jose Diaz-Gonzalez
3c8b3cedea Merge pull request #814 from progrium/dokku-env-vars
Source files in $DOKKU_ROOT/.dokkurc directory and add `dokku trace` command
2014-12-12 09:25:51 -05:00
Jose Diaz-Gonzalez
dec8056ef5 Link to gist.github.com 2014-12-12 01:10:10 -05:00
Jose Diaz-Gonzalez
784e2cfd5e Add a note about enabling dokku trace via the cli 2014-12-12 01:09:59 -05:00
Jose Diaz-Gonzalez
b9b9d6303a Add a dokku trace command to allow easy toggling of the DOKKU_TRACE option 2014-12-12 01:07:43 -05:00
Jose Diaz-Gonzalez
39912ce5db Allow sourcing in any file in .dokkurc
This allows us to configure dokku env-vars individually. Such a feature is useful if a developer would like to enable or disable DOKKU_TRACE without parsing a dokkurc file.
2014-12-12 01:07:08 -05:00
Jose Diaz-Gonzalez
7d8ec62a86 Merge pull request #787 from progrium/build-env
Official user-env-compile plugin
2014-12-11 21:15:45 -05:00
Jose Diaz-Gonzalez
8cd4863126 Merge pull request #813 from expa/build-env
build-env todos
2014-12-11 18:18:26 -05:00
Michael Hobbs
7c8feb9e0d build-env todos 2014-12-11 14:56:25 -08:00
Jose Diaz-Gonzalez
d6ef5e3447 Merge pull request #812 from expa/build-env
create build env for both dokku and new style buildpacks
2014-12-11 16:33:28 -05:00
Michael Hobbs
498e250e2e link to commit id and line in comment 2014-12-11 12:52:04 -08:00
Michael Hobbs
7d5e0ba5aa create build env for both dokku and new style buildpacks 2014-12-11 12:05:55 -08:00
Jose Diaz-Gonzalez
a7b8eb5581 Merge pull request #811 from abossard/patch-1
Please increase the server_names_hash_bucket_size
2014-12-11 10:22:44 -05:00
Andre Bossard
79788e5690 Please increase the server_names_hash_bucket_size
I use Dokku in a private environment with very long hostname.... 64 was always a lot to short.
2014-12-11 09:59:13 +01:00
Jose Diaz-Gonzalez
ae61ef3f1e Add backup support to nginx.conf.template files 2014-12-11 02:40:20 -05:00
Jose Diaz-Gonzalez
1d45ca0cdd Add backup export/import hooks for associated VHOST files 2014-12-11 02:38:08 -05:00
Jose Diaz-Gonzalez
b4c864bea7 Use sed to indent output of dokku url command 2014-12-11 02:34:24 -05:00
Jose Diaz-Gonzalez
01e7f1cdb6 Output *all* hosts on multiple lines 2014-12-11 02:34:08 -05:00
Jose Diaz-Gonzalez
0865ff3f79 Use updated VHOST file instead of URL file when outputting the current URL to an app
Note that this may include more than one URL to an app
2014-12-11 02:16:52 -05:00
Jose Diaz-Gonzalez
11b126a845 Do not overwrite URL file 2014-12-11 02:14:52 -05:00
Jose Diaz-Gonzalez
605ba27eeb Use a one-liner for the "Configuring" echo statement 2014-12-11 02:12:46 -05:00
Jose Diaz-Gonzalez
8109c9c569 Delete the VHOST file, not the URL file, when NO_VHOST is set
The URL file is useful for understanding what port docker decided to host our app internally on.
2014-12-11 02:10:49 -05:00
Jose Diaz-Gonzalez
9111902542 Fix issue where VHOST was not properly being set
The URL file is being rewritten on every deploy by `dokku deploy` and thus that file was incorrect. Instead, we just reuse the old logic from the nginx-vhosts plugin to handle creation of the VHOST file
2014-12-11 02:09:54 -05:00
Jose Diaz-Gonzalez
4955f9c600 Fix test for file 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
976dc3009c Use a normal conditional 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
0b4b2b29a8 Add missing env var 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
e84526490e Move VHOST file creation to a single domains:setup command
This helps remove duplication and also ensures that all hosts have a proper setup after running `make copyfiles`

Note that this command is not exposed in help as it is not generally useful to developers
2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
66171551d8 Add domains plugin as written in https://github.com/jtangelder/dokku-nginx-alt
This plugin conforms to the heroku api for setting and removing domains. Note that it does not yet update the URL file for a given application.
2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
f23809e75f Implement the ability to set multiple server names for a given application
Adding a hostname to the $APP/VHOST file will enable it as a virtualhost for the application.

In addition, any hostname set that matches an associated ssl certificate will also be set as an ssl host. Note that if a hostname does not have a matching SSL host, then it will result in an erroring application.

For the moment, running `dokku url` on an app may not correctly display the current hostnames for said app.
2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
b967514c55 Allow overriding of the nginx.conf template via nginx.conf.template 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
a6c34ddd6f Use a template to create an application's nginx.conf 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
8f0e794893 Remove extra dash 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
68a1d1af38 one-liner 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
eeff3d52eb Combine calls to restart nginx into a single command 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
8aa196c660 Remove extra reload command 2014-12-11 01:36:44 -05:00
Jose Diaz-Gonzalez
d9d66c58ab Fix reference to $APP 2014-12-08 22:16:05 -05:00
Jose Diaz-Gonzalez
155f4e9aba Release 0.3.8 2014-12-08 22:14:03 -05:00
Jose Diaz-Gonzalez
1bfbdb449b Merge pull request #808 from progrium/proper-editorconfig
Ensure makefiles are properly formatted
2014-12-08 22:12:21 -05:00
Jose Diaz-Gonzalez
b3ca3368e8 Ensure makefiles are properly formatted 2014-12-08 22:12:04 -05:00
Jose Diaz-Gonzalez
04921d6876 Merge pull request #807 from progrium/799-force-nginx-conf
#799: Force nginx conf
2014-12-08 22:05:17 -05:00
Jose Diaz-Gonzalez
a915b8888f Ensure ruby is installed when running the dokku-installer 2014-12-08 21:57:10 -05:00
Jose Diaz-Gonzalez
129a5fd33d Force install a default nginx.conf. Closes #799 2014-12-08 21:20:54 -05:00
Jose Diaz-Gonzalez
e567ce1a90 Merge pull request #806 from progrium/fix-remote-user
Dokku pushes now happen as the dokku user, not git. Refs #796
2014-12-08 20:59:22 -05:00
Jose Diaz-Gonzalez
489f131ffc Dokku pushes now happen as the dokku user, not git. Refs #796 2014-12-08 20:58:50 -05:00
Jose Diaz-Gonzalez
45ec8df7be Merge pull request #805 from ademuk/patch-1
Fixed import-ssl server.crt/key check
2014-12-08 20:36:18 -05:00
Adem Gaygusuz
469d1e3f49 Fix crt/key check 2014-12-09 00:37:47 +00:00
Jose Diaz-Gonzalez
7ca2f49d78 Merge pull request #801 from joelvh/patch-1
Point users to upgrade guides
2014-12-02 08:55:48 -05:00
Joel Van Horn
69176d2d9a Point users to upgrade guides 2014-12-02 00:33:44 -05:00
Jose Diaz-Gonzalez
ad030b21d4 Merge pull request #796 from progrium/795-better-docs
795 better docs
2014-11-27 15:13:31 -05:00
Jose Diaz-Gonzalez
8c8f5e17f1 Tell users to change directory to dokku before running vagrant up. Refs #795 2014-11-27 15:10:33 -05:00
Jose Diaz-Gonzalez
e0b994c415 Standardize on dokku.me as the test hostname. Refs #795 2014-11-27 15:09:46 -05:00
Jose Diaz-Gonzalez
a12b1e2b56 Release 0.3.7 2014-11-25 15:46:48 -05:00
Jose Diaz-Gonzalez
590c5fc017 Merge pull request #789 from mmerickel/fix.deploy-vhost 2014-11-25 15:44:19 -05:00
Michael Merickel
ee5c35dd9d do not output message when creating ENV file
This fixes a bug introduced when deploying apps where the
nginx-vhosts plugin runs ``dokku config:get $APP NO_VHOST``. The initial
run of this actually was creating the ``ENV`` file and dumping to
stdout the value "NO_VHOST=-----> Creating /home/dokku/foo/ENV". This
was obviously no good because nginx-vhosts was considering this to be a
value of true.

I've modified this to simply not return anything when the value does not
exist. A better update may be to output the messages to stderr instead
of stdout.
2014-11-25 15:43:36 -05:00
Jose Diaz-Gonzalez
42a1363996 Merge pull request #788 from mmerickel/fix.apps-plugin
fix apps plugin issues in 0.3.6
2014-11-25 13:28:17 -05:00
Michael Merickel
4ae8cf8180 fix search for apps if DOKKU_ROOT is a symlink 2014-11-25 11:56:05 -06:00
Michael Merickel
aef3a68d2b fix app plugin that was always searching for empty app name 2014-11-25 11:55:25 -06:00
Jose Diaz-Gonzalez
6ddc7275dd First pass at official user-env-compile plugin
- Uses ENV and APP/ENV files
- Supports old BUILD_ENV files (which are likely in wide-use)
- Allows user's to override globals with app-specific configuration

Closes #284
Closes #683
Closes #763

Refs #503
Refs #678
2014-11-25 11:24:58 -05:00
Jose Diaz-Gonzalez
58ca13e838 Release 0.3.6 2014-11-25 10:44:32 -05:00
Jose Diaz-Gonzalez
7c2f21fd2a Merge pull request #782 from progrium/simplified-config
Simplified config
2014-11-24 13:17:27 -05:00
Jose Diaz-Gonzalez
887637fb6b Merge pull request #785 from lsde/master
fix missing semicolon in nginx config
2014-11-24 10:33:26 -05:00
Jonas Svatos
c706344a94 fix missing semicolon in nginx config 2014-11-24 13:22:50 +01:00
Jose Diaz-Gonzalez
407436b4cc Exit 0 if there is no configuration
heroku config:get exits 0 in this case
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
04dbe31919 Unify the way in which all error messages are specified
Other parts of dokku use one-liners where possible, so these parts should as well
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
56185fc1c2 Correct plugin example
$APP is not available until after the if guards
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
303bd77226 Simplify if statement 2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
c6e39c08f0 Simplify env var checking in config plugin
All checks are now done within the commands, and we only need to ensure the config file exists.
2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
12194e2cc8 Add proper error handling to each config command 2014-11-23 23:32:42 -05:00
Jose Diaz-Gonzalez
a3b3a6a12a Unify missing app error messages 2014-11-23 23:32:42 -05:00
89 changed files with 1938 additions and 373 deletions

View File

@@ -4,3 +4,13 @@ root = true
insert_final_newline = true
indent_style = space
indent_size = 2
[Makefile]
insert_final_newline = true
indent_style = tab
indent_size = 4
[*.mk]
insert_final_newline = true
indent_style = tab
indent_size = 4

View File

@@ -1,5 +1,53 @@
# History
## 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
- #818: @michaelhobbs rebuild nginx config on domain change
- #827: @michaelhobbs Handle IP only access
- #828: @michaelhobbs Display the port for an app when falling back to the ip address
## 0.3.9
- #787: @josegonzalez/@michaelhobbs Official user-env-compile plugin
- Uses ENV and APP/ENV files
- Supports old `BUILD_ENV` files (which are likely in wide-use)
- Allows user's to override globals with app-specific configuration
- Migrate `$DOKKU_ROOT/BUILD_ENV` to `$DOKKU_ROOT/ENV` if the former exists and the latter does not
- Drop `BUILD_ENV` support in favor of just `ENV` via a `mv` command
- Add default ENV with `CURL_TIMEOUT` and `CURL_CONNECT_TIMEOUT`
- #811: @abossard Increased `server_names_hash_bucket_size` in nginx.conf to 512
- #814: @josegonzalez Source files in $DOKKU_ROOT/.dokkurc directory and add `dokku trace` command
- #816: @josegonzalez Add documentation for user-env feature
## 0.3.8
- #796: @josegonzalez Better vagrant documentation
- #801: @joelvh Point users to upgrade guides
- #805: @ademuk Fixed import-ssl server.crt/key check
- #806: @josegonzalez Dokku pushes now happen as the dokku user, not git. Refs #796
- #807: @josegonzalez Write proper nginx conf upon installation. Closes #799
- #808: @josegonzalez Ensure makefiles are properly formatted
## 0.3.7
- #788: @mmerickel fix apps plugin issues in 0.3.6
- #789: @mmerickel do not output message when creating ENV file
## 0.3.6
- #782: @josegonzalez Simplified config checking
- #785: @lsde fix missing semicolon in nginx config
## 0.3.5
- #784: @josegonzalez Fix NO_VHOST check

View File

@@ -3,7 +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
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-12-16/2014-12-16_42bd9f4aab.tar.gz
DOKKU_ROOT ?= /home/dokku
PLUGINS_PATH ?= /var/lib/dokku/plugins
@@ -17,6 +17,8 @@ endif
.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
include tests.mk
all:
# Type "make install" to install.
@@ -27,10 +29,10 @@ copyfiles: addman
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
addman:
mkdir -p /usr/local/share/man/man1
@@ -72,7 +74,9 @@ 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:
@echo "Start building buildstep"
@@ -91,6 +95,7 @@ count:
@find tests -type f | xargs cat | wc -l
dokku-installer:
apt-get install -qq -y ruby
test -f /var/lib/dokku/.dokku-installer-created || gem install rack -v 1.5.2 --no-rdoc --no-ri
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
@@ -105,3 +110,4 @@ vagrant-acl-add:
vagrant-dokku:
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"

View File

@@ -1,4 +1,4 @@
# Dokku [![Build Status](https://travis-ci.org/progrium/dokku.png?branch=master)](https://travis-ci.org/progrium/dokku)
# Dokku [![Build Status](https://app.wercker.com/status/029900380b7e5f31bbf4392725067769/s/master "Build Status")](https://app.wercker.com/project/bykey/029900380b7e5f31bbf4392725067769)
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
@@ -10,7 +10,11 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
To install the latest stable version of dokku, you can run the following bootstrapper command:
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.5/bootstrap.sh | sudo DOKKU_TAG=v0.3.5 bash
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.11/bootstrap.sh | sudo DOKKU_TAG=v0.3.11 bash
### Upgrading
[View the docs for upgrading](http://progrium.viewdocs.io/dokku/upgrading) from an older version of Dokku.
## Documentation

View File

@@ -16,9 +16,10 @@ 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
cd ~ && test -d dokku || git clone $DOKKU_REPO
cd ~
test -d dokku || git clone $DOKKU_REPO
cd dokku
git fetch origin

View File

@@ -21,7 +21,7 @@ if ARGV[0] == "onboot"
exit
end
version = "v0.3.5"
version = "v0.3.11"
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

View File

@@ -4,8 +4,8 @@ Now you can deploy apps on your Dokku. Let's deploy the [Heroku Node.js sample a
```
$ cd node-js-sample
$ git remote add progrium dokku@progriumapp.com:node-js-app
$ git push progrium master
$ git remote add dokku dokku@dokku.me:node-js-app
$ git push dokku master
Counting objects: 296, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (254/254), done.
@@ -18,12 +18,12 @@ Total 296 (delta 25), reused 276 (delta 13)
... blah blah blah ...
-----> Application deployed:
http://node-js-app.progriumapp.com
http://node-js-app.dokku.me
```
You're done!
Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push progrium <local branch>:master```
Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku <local branch>:master```
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.
@@ -53,38 +53,38 @@ Alternatively, you may push an app to your dokku host with a name like "00-defau
The name of remote repository is used as the name of application to be deployed, as for example above:
$ git remote add progrium git@progriumapp.com:node-js-app
$ git push progrium master
$ git remote add dokku dokku@dokku.me:node-js-app
$ git push dokku master
Is deployed to,
remote: -----> Application deployed:
remote: http://node-js-app.progriumapp.com
remote: http://node-js-app.dokku.me
You can also specify fully qualified names, say `app.progrium.com`, as
You can also specify fully qualified names, say `app.dokku.me`, as
$ git remote add progrium git@progriumapp.com:app.progrium.com
$ git push progrium master
$ git remote add dokku dokku@dokku.me:app.dokku.me
$ git push dokku master
So, after deployment the application will be available at,
remote: -----> Application deployed:
remote: http://app.progrium.com
remote: http://app.dokku.me
This is in particular useful, then you want to deploy to root domain, as
$ git remote add progrium git@progriumapp.com:progrium.com
$ git push progrium master
$ git remote add dokku dokku@dokku.me:dokku.me
$ git push dokku master
... deployment ...
remote: -----> Application deployed:
remote: http://progrium.com
remote: http://dokku.me
# Removing a deployed app
SSH onto the server, then execute:
```bash
```shell
dokku delete myapp
```

View File

@@ -11,4 +11,6 @@ config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] - set one or more config vars
config:unset <app> KEY1 [KEY2 ...] - unset one or more config vars
```
The variables are by default available only at run time, i.e. not when the application is being built/compiled. However there are [plugins](http://progrium.viewdocs.io/dokku/plugins) that can change that.
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.

View File

@@ -10,8 +10,8 @@ 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:
```bash
wget -qO- https://raw.github.com/progrium/dokku/v0.3.5/bootstrap.sh | sudo DOKKU_TAG=v0.3.5 bash
```shell
wget -qO- https://raw.github.com/progrium/dokku/v0.3.11/bootstrap.sh | sudo DOKKU_TAG=v0.3.11 bash
```
## Configuring
@@ -20,7 +20,7 @@ Set up a domain and a wildcard domain pointing to that host. Make sure `/home/do
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 progriumapp.com "sudo sshcommand acl-add dokku progrium"
$ cat ~/.ssh/id_rsa.pub | ssh dokku.me "sudo sshcommand acl-add dokku $USER"
That's it!
@@ -28,7 +28,7 @@ That's it!
### Development via bash script
```bash
```shell
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
```
@@ -41,7 +41,7 @@ You may also wish to take a look at the [advanced installation](http://progrium.
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:
```bash
```shell
git clone https://github.com/yourusername/dokku.git
cd dokku
sudo make install
@@ -52,7 +52,7 @@ repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_UR
environment variables may be set to override the defaults (see the `Makefile` for how these
apply). Example:
```bash
```shell
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
```
@@ -61,7 +61,7 @@ sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcom
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:
```bash
```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
@@ -73,7 +73,7 @@ Dokku ships with a pre-built version of the [buildstep](https://github.com/progr
default. If you want to build your own version you can specify that with an env
variable.
```bash
```shell
git clone https://github.com/progrium/dokku.git
cd dokku
sudo BUILD_STACK=true make install
@@ -110,6 +110,7 @@ sudo BUILD_STACK=true make install
# - `BOX_MEMORY`
# - `DOKKU_DOMAIN`
# - `DOKKU_IP`.
cd path/to/dokku
vagrant up
```
@@ -140,7 +141,7 @@ Deploy using the following StackScript:
* Run the following commands:
```bash
```shell
apt-get update
apt-get install lxc wget bsdtar linux-image-extra-$(uname -r)
@@ -149,6 +150,6 @@ Deploy using the following StackScript:
```
* After this, you can install dokku the default way:
```bash
```shell
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
```

View File

@@ -43,15 +43,39 @@ dokku nginx:import-ssl myapp < archive-of-certs.tar
This archive should is expanded via `tar xvf`. It should contain `server.crt` and `server.key`.
## Disabling VHOSTS
## Customizing the nginx configuration
If desired, it is possible to disable vhosts by setting the `NO_VHOST` environment variable:
> New as of 0.3.10
```bash
dokku config:set myapp NO_VHOST=1
Dokku currently templates out an nginx configuration that is included in the `nginx-vhosts` plugin. If you'd like to provide a custom template for your application, you should copy the existing template - ssl or non-ssl - into your `$DOKKU_ROOT/$APP` directory at the file `nginx.conf.template`.
For instance - assuming defaults - to customize the nginx template in use for the `myapp` application, create a file at `/home/dokku/myapp/nginx.conf.template` with the following contents:
```
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
# set a custom header for requests
add_header X-Served-By www-ec2-01;
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;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}
```
On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable.
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`.
## Customizing hostnames
@@ -65,7 +89,7 @@ The `subdomain` is inferred from the pushed application name, while the `domain`
You can optionally override this in a plugin by implementing the `nginx-hostname` pluginhook. For example, you can reverse the subdomain with the following sample `nginx-hostname` pluginhook:
```bash
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
@@ -76,3 +100,39 @@ echo "$NEW_SUBDOMAIN.$VHOST"
```
If the `nginx-hostname` has no output, the normal hostname algorithm will be executed.
You can also use the built-in `domains` plugin to handle:
### Disabling VHOSTS
If desired, it is possible to disable vhosts by setting the `NO_VHOST` environment variable:
```shell
dokku config:set myapp NO_VHOST=1
```
On subsequent deploys, the nginx virtualhost will be discarded. This is useful when deploying internal-facing services that should not be publicly routeable.
### Domains plugin
> New as of 0.3.10
The domains plugin allows you to specify custom domains for applications. This plugin is aware of any ssl certificates that are imported via `nginx:import-ssl`. Be aware that setting `NO_VHOST` will override any custom domains.
Custom domains are also backed up via the built-in `backup` plugin
```shell
# where `myapp` is the name of your app
# add a domain to an app
dokku domains:add myapp example.com
# list custom domains for app
dokku domains myapp
# clear all custom domains for app
dokku domains:clear myapp
# remove a custom domain from app
dokku domains:remove myapp example.com
```

View File

@@ -11,7 +11,7 @@ Let's take a quick look at the current dokku nginx plugin that's shipped with do
## Installing a plugin
```bash
```shell
cd /var/lib/dokku/plugins
git clone <git url>
dokku plugins-install
@@ -32,14 +32,14 @@ If you create your own plugin:
The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file:
```bash
```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/$APP" ]] && echo "App $APP does not exist" && exit 1
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
APP="$2";
echo "Hello $APP"
@@ -208,8 +208,6 @@ Note: The following plugins have been supplied by our community and may not have
| [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 |
| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>1</sup> | [musicglue][] | Compatible with dokku master branch |
| [user-env-compile](https://github.com/motin/dokku-user-env-compile)<sup>1</sup> | [motin][] | Compatible with 0.2.1 |
| [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 |
@@ -218,8 +216,6 @@ Note: The following plugins have been supplied by our community and may not have
[98332de]: https://github.com/dyson/dokku-persistent-storage/commit/98332de4b5b640610bee535f4d5260263074e18b
[a043e98]: https://github.com/stuartpb/dokku-bind-port/commit/a043e9892f4815b6525c850131e09fd64db5c1fa
<sup>1</sup> Similar to the heroku-labs feature (see https://devcenter.heroku.com/articles/labs-user-env-compile)
<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)

View File

@@ -1,11 +1,11 @@
# Remote commands
Dokku commands can be run over ssh. Anywhere you would run `dokku <command>`, just run `ssh -t dokku@progriumapp.com <command>`
Dokku commands can be run over ssh. Anywhere you would run `dokku <command>`, just run `ssh -t dokku@dokku.me <command>`
The `-t` is used to request a pty. It is highly recommended to do so.
To avoid the need to type the `-t` option each time, simply create/modify a section in the `.ssh/config` on the client side, as follows:
```
Host progriumapp.com
Host dokku.me
RequestTTY yes
```
@@ -13,7 +13,7 @@ RequestTTY yes
It's possible to run commands in the environment of the deployed application:
```bash
```shell
dokku run node-js-app ls -alh
dokku run <app> <cmd>
```

View File

@@ -43,11 +43,16 @@ __Solution:__
The `remote rejected` error does not give enough information. Anything could have failed.
Create a `/home/dokku/dokkurc` file containing the following :
To enable dokku tracing, simply run the following command:
# Since 0.3.9
dokku trace
In versions older than 0.3.9, you can create a `/home/dokku/dokkurc` file containing the following :
export DOKKU_TRACE=1
This will trace all of dokku's activity. If this does not help you create a pastebin or a gist containing the full log, and create an issue.
This will trace all of dokku's activity. If this does not help you, create a [gist](https://gist.github.com) containing the full log, and create an issue.
***

View File

@@ -6,7 +6,7 @@ Dokku is in active development. You can update the deployment step and the build
To update the deploy step (this is updated less frequently):
```bash
```shell
cd ~/dokku
git pull origin master
sudo make install
@@ -16,7 +16,7 @@ Nothing needs to be restarted. Changes will take effect on the next push / deplo
To update the build step:
```bash
```shell
git clone https://github.com/progrium/buildstep.git
cd buildstep
git pull origin master
@@ -34,7 +34,7 @@ This should be summary of breaking changes between 0.1 and 0.2 version with inst
software-properties-common is now a dependency for plugins. Before running dokku install script, make sure it is installed.
```bash
```shell
> sudo apt-get install software-properties-common
```

29
dokku
View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail
shopt -s nullglob
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
@@ -10,6 +11,7 @@ export DOKKU_NOT_IMPLEMENTED_EXIT=10
export DOKKU_VALID_EXIT=0
[[ -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
@@ -20,8 +22,13 @@ fi
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
export -n SSH_ORIGINAL_COMMAND
$0 $SSH_ORIGINAL_COMMAND
exit $?
if [[ $1 =~ config-* ]];then
xargs $0 <<<$SSH_ORIGINAL_COMMAND
exit $?
else
$0 $SSH_ORIGINAL_COMMAND
exit $?
fi
fi
case "$1" in
@@ -36,20 +43,20 @@ case "$1" in
echo "-----> Deploying $APP ..."
dokku deploy $APP
echo "=====> Application deployed:"
echo " $(dokku url $APP)"
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
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
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
pluginhook post-build $APP
;;
@@ -58,8 +65,8 @@ case "$1" in
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
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/app-env.sh" < "$DOKKU_ROOT/$APP/ENV")
test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null
fi
pluginhook post-release $APP
@@ -142,8 +149,8 @@ case "$1" in
# temporary hack for https://github.com/progrium/dokku/issues/82
deploy:all)
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 deploy $APP
done
;;
@@ -162,7 +169,7 @@ 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
continue
@@ -175,7 +182,7 @@ EOF
done
if [ "$implemented" -eq 0 ]; then
echo " ! \`$@\` is not a dokku command."
echo " ! \`$*\` is not a dokku command."
echo " ! See \`dokku help\` for a list of available commands."
exit 1
fi

View File

@@ -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

View File

@@ -2,20 +2,32 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
trace)
[[ -d $DOKKU_ROOT/.dokkurc ]] || mkdir -p $DOKKU_ROOT/.dokkurc
[[ "$2" == "on" ]] || [[ "$2" == "off" ]] || {
echo "Valid trace options are [on/off]"
exit 1
}
if [[ "$2" == "on" ]]; then
echo "Enabling dokku trace"
echo "export DOKKU_TRACE=1" > $DOKKU_ROOT/.dokkurc/DOKKU_TRACE
fi
if [[ "$2" == "off" ]]; then
echo "Disabling dokku trace"
rm -f $DOKKU_ROOT/.dokkurc/DOKKU_TRACE
fi
;;
delete)
dokku apps:destroy $2
;;
logs)
if [[ -z $2 ]]; then
echo "Please specify an app to run the command on"
exit 1
fi
[[ -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";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
@@ -30,30 +42,40 @@ case "$1" in
;;
run)
if [[ -z $2 ]]; then
echo "Please specify an app to run the command on"
exit 1
fi
[[ -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"; IMAGE="dokku/$APP"
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
shift 2
DOCKER_ARGS=$(: | pluginhook docker-args $APP)
docker run -i -t $DOCKER_ARGS $IMAGE /exec "$@"
;;
url)
APP="$2";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
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"; 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/URL" ]]; then
echo $(< "$DOKKU_ROOT/$APP/URL")
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
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
else
echo "$SCHEME://$(< "$DOKKU_ROOT/HOSTNAME"):$(< "$DOKKU_ROOT/$APP/PORT")"
fi
;;
@@ -68,7 +90,8 @@ case "$1" in
cat && cat<<EOF
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
url <app> Show the first URL for an application (compatibility)
urls <app> Show all URLs for an application
version Print dokku's version
EOF
;;

View File

@@ -2,7 +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"
fi
# temporary hack for https://github.com/progrium/dokku/issues/82

View File

@@ -4,39 +4,23 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
apps)
echo "=== My Apps"
find $DOKKU_ROOT -maxdepth 1 -type d \( ! -iname ".*" \) -not -path $DOKKU_ROOT/tls | sed 's|^\./||g' | sed 's|'$DOKKU_ROOT'\/||' | tail -n +2 | sort
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)
if [[ -z $2 ]]; then
echo "Please specify an app to create"
exit 1
fi
[[ -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
APP="$2"
if [[ -d "$DOKKU_ROOT/$APP" ]]; then
echo " ! Name is already taken"
exit 1
fi
mkdir -p "$DOKKU_ROOT/$APP"
echo "Creating $APP... done"
;;
apps:destroy)
if [[ -z $2 ]]; then
echo "Please specify an app to delete"
exit 1
fi
[[ -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
[[ "$2" == "tls" ]] && echo "Unable to destroy tls directory" && exit 1
APP="$2"; IMAGE="dokku/$APP";
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
if [[ "$APP" == "tls" ]]; then
echo "Unable to destroy tls directory"
exit 1
fi
echo " ! WARNING: Potentially Destructive Action"
echo " ! This command will destroy $APP (including all add-ons)."

View File

@@ -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 {} \;
fi

View File

@@ -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

31
plugins/build-env/pre-build Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
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 -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+=$(< "$DOKKU_ROOT/ENV")
fi
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
BUILD_ENV+=" "
BUILD_ENV+=$(< "$DOKKU_ROOT/$APP/ENV")
fi
if [[ ! -z "$BUILD_ENV" ]]; then
echo "-----> 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
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
docker commit $id $IMAGE > /dev/null
fi

View File

@@ -56,20 +56,20 @@ sleep $WAIT
# --location Follow redirects
CURL_OPTIONS="-q --compressed --fail --location --max-time 30"
cat "$FILENAME" | while read PATHNAME EXPECTED ; do
while read PATHNAME EXPECTED; do
# Ignore empty lines and lines starting with #
[[ -z "$PATHNAME" || "$PATHNAME" =~ ^\# ]] && continue
[[ -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
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"
fi
done
done < "$FILENAME"
echo -e "\033[32m\033[1mAll checks successful!\033[0m"

View File

@@ -1,28 +1,13 @@
#!/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"
ENV_FILE_TEMP="$DOKKU_ROOT/$APP/ENV.tmp"
# 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
ENV_FILE="$DOKKU_ROOT/$2/ENV"
ENV_FILE_TEMP="$DOKKU_ROOT/$2/ENV.tmp"
config_create () {
[ -f $ENV_FILE ] || {
touch $ENV_FILE
}
}
config_styled_hash () {
vars="$1"
@@ -30,21 +15,21 @@ 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"
@@ -76,14 +61,14 @@ 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
APP="$2"
if [ ! -f $ENV_FILE ] || [ ! -s $ENV_FILE ] ; then
echo "$APP has no config vars"
exit 1
fi
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
@@ -97,31 +82,40 @@ case "$1" in
;;
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
APP="$2"
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
config_create
if [[ ! -s $ENV_FILE ]] ; then
exit 0
fi
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
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
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
config_create
ENV_ADD=""
ENV_TEMP=`cat "${ENV_FILE}"`
ENV_TEMP=$(cat "${ENV_FILE}")
RESTART_APP=false
shift 2
@@ -134,8 +128,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
@@ -157,14 +151,18 @@ ${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
APP="$2"
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}"`
config_create
ENV_TEMP=$(cat "${ENV_FILE}")
VARS="${*:3}"
for var in $VARS; do

9
plugins/domains/backup-export Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
BASE_DIR="$2"
cat; for i in $BASE_DIR/*/VHOST; do echo $i; done
cat; for i in $BASE_DIR/*/nginx.conf.template; do echo $i; done

15
plugins/domains/backup-import Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
VERSION="$1"
IMPORT_DIR="$2"
TARGET_DIR="$3"
cd $IMPORT_DIR
for file in */VHOST; do
cp $file "$TARGET_DIR/$file"
done
for file in */nginx.conf.template; do
cp $file "$TARGET_DIR/$file"
done

112
plugins/domains/commands Executable file
View File

@@ -0,0 +1,112 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
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
APP="$2"
dokku domains:setup $APP
echo "=== $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
APP="$2"; VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
if [[ ! -f $VHOST_PATH ]]; then
if [[ -f "$DOKKU_ROOT/VHOST" ]];then
VHOST=$(< "$DOKKU_ROOT/VHOST")
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"
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"
fi
fi
echo "$hostname" > $VHOST_PATH
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
APP="$2"
if [[ -z $3 ]]; then
echo "Usage: dokku $1 $APP DOMAIN"
echo "Must specify DOMAIN."
exit 1
fi
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
dokku domains:setup $APP
echo "$3" >> "$DOKKU_ROOT/$APP/VHOST"
pluginhook post-domains-update $APP
echo "-----> Added $3 to $APP"
;;
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
APP="$2"
rm -f "$DOKKU_ROOT/$APP/VHOST"
dokku domains:setup $APP
pluginhook post-domains-update $APP
echo "-----> 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
APP="$2"
if [[ -z $3 ]]; then
echo "Usage: dokku $1 $2 DOMAIN"
echo "Must specify DOMAIN."
exit 1
fi
dokku domains:setup $APP
sed -i "/^$3$/d" "$DOKKU_ROOT/$APP/VHOST"
pluginhook post-domains-update $APP
echo "-----> Removed $3 from $APP"
;;
help | domains:help)
cat && cat<<EOF
domains <app> List custom domains for app
domains:add <app> DOMAIN Add a custom domain to app
domains:clear <app> Clear all custom domains for app
domains:remove <app> DOMAIN Remove a custom domain from app
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

8
plugins/domains/install Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
shopt -s nullglob
for app in $DOKKU_ROOT/*/CONTAINER; do
APP=$(basename "$(dirname $app)");
dokku domains:setup $APP
done

View File

@@ -57,7 +57,7 @@ EOF
chmod +x $PRERECEIVE_HOOK
fi
args=$@
args=$*
git-shell -c "$args"
;;

View File

@@ -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

View File

@@ -1,43 +1,118 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
nginx:import-ssl)
if [[ -z $2 ]]; then
echo "Please specify an app to create"
exit 1
fi
APP="$2"
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
echo "App $APP does not exist"
exit 1
fi
if [[ -t 0 ]]; then
echo "Tar archive containing server.crt and server.key expected on stdin"
exit 1
fi
restart_nginx () {
case "$DOKKU_DISTRO" in
ubuntu)
sudo /etc/init.d/nginx reload > /dev/null
;;
TEMP_DIR=`mktemp -d`
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;
esac
}
case "$1" in
nginx:build-config)
APP="$2"; PORT="$3"
[[ -z "$PORT" ]] && PORT=$(< "$DOKKU_ROOT/$APP/PORT")
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
WILDCARD_SSL="$DOKKU_ROOT/tls"
SSL="$DOKKU_ROOT/$APP/tls"
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
if [[ ! -n "$NO_VHOST" ]]; then
NONSSL_VHOSTS=$(cat $VHOST_PATH)
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
SSL_INUSE="$SSL"
SSL_DIRECTIVES=$(cat <<EOF
ssl_certificate $SSL_INUSE/server.crt;
ssl_certificate_key $SSL_INUSE/server.key;
EOF
)
elif [[ -e "$WILDCARD_SSL/server.crt" ]] && [[ -e "$WILDCARD_SSL/server.key" ]]; then
SSL_INUSE="$WILDCARD_SSL"
SSL_DIRECTIVES=""
fi
NGINX_CONF="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf"
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)
while read line; do
echo "-----> Configuring SSL for $line..."
SSL_SERVER_NAME=$line
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/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
fi
xargs -i echo "-----> Configuring {}..." < $VHOST_PATH
# 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' ' ')
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"
echo "-----> Running nginx-pre-reload"
pluginhook nginx-pre-reload $APP $PORT
echo " Reloading nginx"
restart_nginx
else
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
echo "-----> NO_VHOST set, deleting $APP/VHOST"
rm "$DOKKU_ROOT/$APP/VHOST"
fi
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
echo "-----> NO_VHOST set, deleting nginx.conf"
rm "$DOKKU_ROOT/$APP/nginx.conf"
echo "-----> NO_VHOST set, reloading nginx after nginx.conf deletion"
restart_nginx
fi
fi
;;
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
[[ -t 0 ]] && echo "Tar archive containing server.crt and server.key expected on stdin" && exit 1
APP="$2"
TEMP_DIR=$(mktemp -d)
cd $TEMP_DIR
tar xvf - <&0
if [[ -f "$TEMP_DIR/server.crt" ]]; then
echo "Tar archive missing server.crt"
exit 1
fi
if [[ -f "$TEMP_DIR/server.key" ]]; then
echo "Tar archive missing server.key"
exit 1
fi
[[ ! -f "$TEMP_DIR/server.crt" ]] && echo "Tar archive missing server.crt" && exit 1
[[ ! -f "$TEMP_DIR/server.key" ]] && echo "Tar archive missing server.key" && exit 1
mkdir -p "$DOKKU_ROOT/$APP/tls"
mv "$TEMP_DIR/server.crt" "$DOKKU_ROOT/$APP/tls/server.crt"
mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key"
cd $DOKKU_ROOT
rm -rf $TEMP_DIR
dokku nginx:build-config $APP
;;
help | nginx:help)
cat && cat<<EOF
nginx:import-ssl <app> Imports a tarball from stdin; should contain server.crt and server.key
nginx:build-config <app> (Re)builds nginx config for given app
EOF
;;

View File

@@ -25,18 +25,46 @@ ssl_session_timeout 10m;
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_prefer_server_ciphers on;
# this is already defined in the base nginx.conf and causes nginx reloads/starts to fail
# when its defined twice
# 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
echo 'server_names_hash_bucket_size 64' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
cat<<EOF > /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
fi
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
EOF
echo 'server_names_hash_bucket_size 512;' >| /etc/nginx/conf.d/server_names_hash_bucket_size.conf
case "$DOKKU_DISTRO" in
ubuntu)

View File

@@ -2,134 +2,13 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; PORT="$2"
WILDCARD_SSL="$DOKKU_ROOT/tls"
SSL="$DOKKU_ROOT/$APP/tls"
set +e
NO_VHOST=$(dokku config:get $APP NO_VHOST)
set -e
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
if [[ -n "$NO_VHOST" ]]; then
echo "-----> NO_VHOST config detected"
elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
dokku domains:setup $APP
fi
if [[ -f "$DOKKU_ROOT/VHOST" && ! -n "$NO_VHOST" ]]; then
VHOST=$(< "$DOKKU_ROOT/VHOST")
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
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
SSL_INUSE="$SSL"
SSL_DIRECTIVES=$(cat <<EOF
ssl_certificate $SSL_INUSE/server.crt;
ssl_certificate_key $SSL_INUSE/server.key;
EOF
)
elif [[ -e "$WILDCARD_SSL/server.crt" ]] && [[ -e "$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"
SSL_DIRECTIVES=""
fi
if [[ -n "$SSL_INUSE" ]]; then
echo "-----> Creating ssl nginx.conf"
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
upstream $APP { server 127.0.0.1:$PORT; }
server {
listen [::]:80;
listen 80;
server_name $hostname;
return 301 https://\$host\$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name $hostname;
$SSL_DIRECTIVES
keepalive_timeout 70;
add_header Alternate-Protocol 443:npn-spdy/2;
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;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}
EOF
echo "https://$hostname" > "$DOKKU_ROOT/$APP/URL"
else
echo "-----> Creating non-ssl nginx.conf"
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf
upstream $APP { server 127.0.0.1:$PORT; }
server {
listen [::]:80;
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;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}
EOF
echo "http://$hostname" > "$DOKKU_ROOT/$APP/URL"
fi
echo "-----> Running nginx-pre-reload"
pluginhook nginx-pre-reload $APP $PORT
echo " Reloading nginx"
case "$DOKKU_DISTRO" in
ubuntu)
sudo /etc/init.d/nginx reload > /dev/null
;;
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;
esac
else
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
echo "------> NO_VHOST set, deleting $APP/URL"
rm "$DOKKU_ROOT/$APP/URL"
fi
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
echo "------> NO_VHOST set, deleting $APP/nginx.conf"
rm "$DOKKU_ROOT/$APP/nginx.conf"
echo "------> NO_VHOST set, reloading nginx after nginx.conf deletion"
case "$DOKKU_DISTRO" in
ubuntu)
sudo /etc/init.d/nginx reload > /dev/null
;;
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;
esac
sudo /etc/init.d/nginx reload > /dev/null
fi
fi
dokku nginx:build-config $APP $PORT

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"
dokku nginx:build-config $APP

View File

@@ -0,0 +1,17 @@
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
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;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}

View File

@@ -0,0 +1,28 @@
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
return 301 https://$SSL_SERVER_NAME\$request_uri;
}
server {
listen [::]:443 ssl spdy;
listen 443 ssl spdy;
server_name $SSL_SERVER_NAME;
$SSL_DIRECTIVES
keepalive_timeout 70;
add_header Alternate-Protocol 443:npn-spdy/2;
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;
}
include $DOKKU_ROOT/$APP/nginx.conf.d/*.conf;
}

116
tests.mk Normal file
View File

@@ -0,0 +1,116 @@
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\" >> /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
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
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
ifeq ($(shell grep dokku.me /home/dokku/VHOST),)
@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
@echo linting...
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | xargs shellcheck -e SC2034,SC2086,SC2143
unit-tests:
@echo running unit tests...
@$(QUIET) bats tests/unit
deploy-test-config:
@echo deploying config app...
cd tests && ./test_deploy ./apps/config 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 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 app...
cd tests && ./test_deploy ./apps/nodejs-express 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-static:
@echo deploying static app...
cd tests && ./test_deploy ./apps/static dokku.me
deploy-tests:
@echo running deploy tests...
# @$(QUIET) bats tests/deploy
@$(QUIET) $(MAKE) deploy-test-config
@$(QUIET) $(MAKE) deploy-test-gitsubmodules
@$(QUIET) $(MAKE) deploy-test-go
@$(QUIET) $(MAKE) deploy-test-java
# broken with new buildstep.
# ref: https://github.com/progrium/dokku/issues/832
# ref: https://github.com/heroku/heroku-buildpack-ruby/pull/319
# @$(QUIET) $(MAKE) deploy-test-multi
@$(QUIET) $(MAKE) deploy-test-nodejs-express
@$(QUIET) $(MAKE) deploy-test-php
@$(QUIET) $(MAKE) deploy-test-python-flask
@$(QUIET) $(MAKE) deploy-test-static
test: setup-deploy-tests lint unit-tests deploy-tests

View File

@@ -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"
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"

View File

@@ -1,15 +1,15 @@
#!/bin/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"

View File

@@ -4,5 +4,6 @@ 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"

View File

@@ -0,0 +1 @@
/ Hello

View File

@@ -1 +1 @@
web: node node-js-sample/web.js
web: node node-js-sample/index.js

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "Hello World!"
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!"

1
tests/apps/go/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ go

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; test "$(curl -s $1)" == "go"
set -e; test "$(curl -s -S "$1")" == "go"

1
tests/apps/java/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ Hello from Java

View File

@@ -1,2 +1,2 @@
#!/usr/bin/env bash
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "Hello from Java!"
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello from Java!"

View File

@@ -1,3 +1,3 @@
https://github.com/heroku/heroku-buildpack-ruby
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-python
https://github.com/heroku/heroku-buildpack-python.git

1
tests/apps/multi/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ Heroku Multi Buildpack on Dokku

View File

@@ -1 +1 @@
web: python app.py
web: gunicorn app:app

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; curl -s $1 | grep -q "Heroku Multi Buildpack on Dokku"
set -e; curl -s -S "$1" | grep -q "Heroku Multi Buildpack on Dokku"

View File

@@ -1,17 +1,21 @@
{
"name": "test-buildpack-multi",
"version": "0.0.0",
"description": "Test application for heroku multi buildpack.",
"author": "Al Johri",
"license": "ISC",
"dependencies": {
"bower": "~1.2.8",
"grunt": "~0.4.1",
"bower": "^1.3.1",
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"load-grunt-tasks": "~0.2.0",
"grunt-contrib-compass": "~0.6.0"
"grunt-contrib-compass": "~1.0.1",
"load-grunt-tasks": "~1.0.0",
"tmp": "0.0.23"
},
"description": "Test application for heroku multi buildpack.",
"engines": {
"node": "~0.10.30"
},
"license": "ISC",
"name": "test-buildpack-multi",
"scripts": {
"postinstall": "./node_modules/bower/bin/bower --allow-root install && ./node_modules/grunt-cli/bin/grunt heroku"
}
"postinstall": "echo $PATH && ./node_modules/bower/bin/bower install --allow-root && ./node_modules/grunt-cli/bin/grunt --verbose --debug heroku"
},
"version": "0.0.0"
}

View File

@@ -1 +1,2 @@
Flask==0.10.1
gunicorn==18.0

View File

@@ -0,0 +1 @@
/ nodejs/express

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "nodejs/express"
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "nodejs/express"

1
tests/apps/php/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ <html><h3>php</h3></html>

1
tests/apps/php/Procfile Normal file
View File

@@ -0,0 +1 @@
web: vendor/heroku/heroku-buildpack-php/bin/heroku-php-apache2 web/

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "<html><h3>php</h3></html>"
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "<html><h3>php</h3></html>"

View File

@@ -0,0 +1,9 @@
{
"require": {
"monolog/monolog": "~1.7",
"silex/silex": "~1.1"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}

609
tests/apps/php/composer.lock generated Normal file
View File

@@ -0,0 +1,609 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"aliases": [],
"hash": "be309b690b78816cf842ab863c0c7590",
"minimum-stability": "stable",
"packages": [
{
"authors": [
{
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be",
"name": "Jordi Boggiano"
}
],
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"dist": {
"reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/ec3961874c43840e96da3a8a1ed20d8c73d7e5aa"
},
"extra": {
"branch-alias": {
"dev-master": "1.11.x-dev"
}
},
"homepage": "http://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"license": [
"MIT"
],
"name": "monolog/monolog",
"notification-url": "https://packagist.org/downloads/",
"provide": {
"psr/log-implementation": "1.0.0"
},
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0"
},
"require-dev": {
"aws/aws-sdk-php": "~2.4, >2.4.8",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
"phpunit/phpunit": "~3.7.0",
"raven/raven": "~0.5",
"ruflin/elastica": "0.90.*",
"videlalvaro/php-amqplib": "~2.4"
},
"source": {
"reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa",
"type": "git",
"url": "https://github.com/Seldaek/monolog.git"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"raven/raven": "Allow sending log messages to a Sentry server",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
},
"time": "2014-09-30 13:30:58",
"type": "library",
"version": "1.11.0"
},
{
"authors": [
{
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"name": "Fabien Potencier",
"role": "Lead Developer"
}
],
"autoload": {
"psr-0": {
"Pimple": "lib/"
}
},
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
"dist": {
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/fabpot/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d"
},
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"homepage": "http://pimple.sensiolabs.org",
"keywords": [
"container",
"dependency injection"
],
"license": [
"MIT"
],
"name": "pimple/pimple",
"notification-url": "https://packagist.org/downloads/",
"require": {
"php": ">=5.3.0"
},
"source": {
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
"type": "git",
"url": "https://github.com/fabpot/Pimple.git"
},
"time": "2013-11-22 08:30:29",
"type": "library",
"version": "v1.1.1"
},
{
"authors": [
{
"homepage": "http://www.php-fig.org/",
"name": "PHP-FIG"
}
],
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
}
},
"description": "Common interface for logging libraries",
"dist": {
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"keywords": [
"log",
"psr",
"psr-3"
],
"license": [
"MIT"
],
"name": "psr/log",
"notification-url": "https://packagist.org/downloads/",
"source": {
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"type": "git",
"url": "https://github.com/php-fig/log.git"
},
"time": "2012-12-21 11:40:51",
"type": "library",
"version": "1.0.0"
},
{
"authors": [
{
"email": "fabien@symfony.com",
"name": "Fabien Potencier"
},
{
"email": "igor@wiedler.ch",
"name": "Igor Wiedler"
}
],
"autoload": {
"psr-0": {
"Silex": "src/"
}
},
"description": "The PHP micro-framework based on the Symfony2 Components",
"dist": {
"reference": "8c5e86eb97f3eee633729b22e950082fb5591328",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/silexphp/Silex/zipball/8c5e86eb97f3eee633729b22e950082fb5591328"
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"homepage": "http://silex.sensiolabs.org",
"keywords": [
"microframework"
],
"license": [
"MIT"
],
"name": "silex/silex",
"notification-url": "https://packagist.org/downloads/",
"require": {
"php": ">=5.3.3",
"pimple/pimple": "~1.0",
"symfony/event-dispatcher": ">=2.3,<2.6-dev",
"symfony/http-foundation": ">=2.3,<2.6-dev",
"symfony/http-kernel": ">=2.3,<2.6-dev",
"symfony/routing": ">=2.3,<2.6-dev"
},
"require-dev": {
"doctrine/dbal": "~2.2",
"monolog/monolog": "~1.4,>=1.4.1",
"phpunit/phpunit": "~3.7",
"swiftmailer/swiftmailer": "5.*",
"symfony/browser-kit": ">=2.3,<2.6-dev",
"symfony/config": ">=2.3,<2.6-dev",
"symfony/css-selector": ">=2.3,<2.6-dev",
"symfony/debug": ">=2.3,<2.6-dev",
"symfony/dom-crawler": ">=2.3,<2.6-dev",
"symfony/finder": ">=2.3,<2.6-dev",
"symfony/form": ">=2.3,<2.6-dev",
"symfony/locale": ">=2.3,<2.6-dev",
"symfony/monolog-bridge": ">=2.3,<2.6-dev",
"symfony/options-resolver": ">=2.3,<2.6-dev",
"symfony/process": ">=2.3,<2.6-dev",
"symfony/security": ">=2.3,<2.6-dev",
"symfony/serializer": ">=2.3,<2.6-dev",
"symfony/translation": ">=2.3,<2.6-dev",
"symfony/twig-bridge": ">=2.3,<2.6-dev",
"symfony/validator": ">=2.3,<2.6-dev",
"twig/twig": ">=1.8.0,<2.0-dev"
},
"source": {
"reference": "8c5e86eb97f3eee633729b22e950082fb5591328",
"type": "git",
"url": "https://github.com/silexphp/Silex.git"
},
"suggest": {
"symfony/browser-kit": ">=2.3,<2.6-dev",
"symfony/css-selector": ">=2.3,<2.6-dev",
"symfony/dom-crawler": ">=2.3,<2.6-dev",
"symfony/form": ">=2.3,<2.6-dev"
},
"time": "2014-09-26 09:32:30",
"type": "library",
"version": "v1.2.2"
},
{
"authors": [
{
"homepage": "http://symfony.com/contributors",
"name": "Symfony Community"
},
{
"email": "fabien@symfony.com",
"name": "Fabien Potencier"
}
],
"autoload": {
"psr-0": {
"Symfony\\Component\\Debug\\": ""
}
},
"description": "Symfony Debug Component",
"dist": {
"reference": "08b529b4c0aa3e746d187fe2a63f08cb955a3566",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/symfony/Debug/zipball/08b529b4c0aa3e746d187fe2a63f08cb955a3566"
},
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
}
},
"homepage": "http://symfony.com",
"license": [
"MIT"
],
"name": "symfony/debug",
"notification-url": "https://packagist.org/downloads/",
"require": {
"php": ">=5.3.3",
"psr/log": "~1.0"
},
"require-dev": {
"symfony/http-foundation": "~2.1",
"symfony/http-kernel": "~2.1"
},
"source": {
"reference": "08b529b4c0aa3e746d187fe2a63f08cb955a3566",
"type": "git",
"url": "https://github.com/symfony/Debug.git"
},
"suggest": {
"symfony/http-foundation": "",
"symfony/http-kernel": ""
},
"target-dir": "Symfony/Component/Debug",
"time": "2014-12-02 20:19:20",
"type": "library",
"version": "v2.6.1"
},
{
"authors": [
{
"homepage": "http://symfony.com/contributors",
"name": "Symfony Community"
},
{
"email": "fabien@symfony.com",
"name": "Fabien Potencier"
}
],
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher\\": ""
}
},
"description": "Symfony EventDispatcher Component",
"dist": {
"reference": "c0a15f7c45efc6506077c728658c16b579929bf8",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/c0a15f7c45efc6506077c728658c16b579929bf8"
},
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"homepage": "http://symfony.com",
"license": [
"MIT"
],
"name": "symfony/event-dispatcher",
"notification-url": "https://packagist.org/downloads/",
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.0",
"symfony/dependency-injection": "~2.0,<2.6.0",
"symfony/stopwatch": "~2.2"
},
"source": {
"reference": "c0a15f7c45efc6506077c728658c16b579929bf8",
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"target-dir": "Symfony/Component/EventDispatcher",
"time": "2014-12-02 20:15:53",
"type": "library",
"version": "v2.5.8"
},
{
"authors": [
{
"homepage": "http://symfony.com/contributors",
"name": "Symfony Community"
},
{
"email": "fabien@symfony.com",
"name": "Fabien Potencier"
}
],
"autoload": {
"classmap": [
"Symfony/Component/HttpFoundation/Resources/stubs"
],
"psr-0": {
"Symfony\\Component\\HttpFoundation\\": ""
}
},
"description": "Symfony HttpFoundation Component",
"dist": {
"reference": "44dfbeb4fa64582d46c7bd59e325245d0b2b9fff",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/44dfbeb4fa64582d46c7bd59e325245d0b2b9fff"
},
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"homepage": "http://symfony.com",
"license": [
"MIT"
],
"name": "symfony/http-foundation",
"notification-url": "https://packagist.org/downloads/",
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/expression-language": "~2.4"
},
"source": {
"reference": "44dfbeb4fa64582d46c7bd59e325245d0b2b9fff",
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git"
},
"target-dir": "Symfony/Component/HttpFoundation",
"time": "2014-12-02 20:15:53",
"type": "library",
"version": "v2.5.8"
},
{
"authors": [
{
"homepage": "http://symfony.com/contributors",
"name": "Symfony Community"
},
{
"email": "fabien@symfony.com",
"name": "Fabien Potencier"
}
],
"autoload": {
"psr-0": {
"Symfony\\Component\\HttpKernel\\": ""
}
},
"description": "Symfony HttpKernel Component",
"dist": {
"reference": "c16051a1f3d259f806115fd9897430ae162d19a0",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpKernel/zipball/c16051a1f3d259f806115fd9897430ae162d19a0"
},
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"homepage": "http://symfony.com",
"license": [
"MIT"
],
"name": "symfony/http-kernel",
"notification-url": "https://packagist.org/downloads/",
"require": {
"php": ">=5.3.3",
"psr/log": "~1.0",
"symfony/debug": "~2.5",
"symfony/event-dispatcher": "~2.5",
"symfony/http-foundation": "~2.5"
},
"require-dev": {
"symfony/browser-kit": "~2.2",
"symfony/class-loader": "~2.1",
"symfony/config": "~2.0",
"symfony/console": "~2.2",
"symfony/dependency-injection": "~2.0",
"symfony/expression-language": "~2.4",
"symfony/finder": "~2.0",
"symfony/process": "~2.0",
"symfony/routing": "~2.2",
"symfony/stopwatch": "~2.2",
"symfony/templating": "~2.2"
},
"source": {
"reference": "c16051a1f3d259f806115fd9897430ae162d19a0",
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git"
},
"suggest": {
"symfony/browser-kit": "",
"symfony/class-loader": "",
"symfony/config": "",
"symfony/console": "",
"symfony/dependency-injection": "",
"symfony/finder": ""
},
"target-dir": "Symfony/Component/HttpKernel",
"time": "2014-12-03 14:18:17",
"type": "library",
"version": "v2.5.8"
},
{
"authors": [
{
"homepage": "http://symfony.com/contributors",
"name": "Symfony Community"
},
{
"email": "fabien@symfony.com",
"name": "Fabien Potencier"
}
],
"autoload": {
"psr-0": {
"Symfony\\Component\\Routing\\": ""
}
},
"description": "Symfony Routing Component",
"dist": {
"reference": "9b7d9f6121e45243cc18e4ed682d8faa418d04bc",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/symfony/Routing/zipball/9b7d9f6121e45243cc18e4ed682d8faa418d04bc"
},
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"homepage": "http://symfony.com",
"keywords": [
"router",
"routing",
"uri",
"url"
],
"license": [
"MIT"
],
"name": "symfony/routing",
"notification-url": "https://packagist.org/downloads/",
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"doctrine/annotations": "~1.0",
"psr/log": "~1.0",
"symfony/config": "~2.2",
"symfony/expression-language": "~2.4",
"symfony/http-foundation": "~2.3",
"symfony/yaml": "~2.0"
},
"source": {
"reference": "9b7d9f6121e45243cc18e4ed682d8faa418d04bc",
"type": "git",
"url": "https://github.com/symfony/Routing.git"
},
"suggest": {
"doctrine/annotations": "For using the annotation loader",
"symfony/config": "For using the all-in-one router or any loader",
"symfony/expression-language": "For using expression matching",
"symfony/yaml": "For using the YAML loader"
},
"target-dir": "Symfony/Component/Routing",
"time": "2014-12-02 20:15:53",
"type": "library",
"version": "v2.5.8"
}
],
"packages-dev": [
{
"authors": [
{
"email": "dz@heroku.com",
"name": "David Zuelke"
}
],
"bin": [
"bin/heroku-hhvm-apache2",
"bin/heroku-hhvm-nginx",
"bin/heroku-php-apache2",
"bin/heroku-php-nginx"
],
"description": "Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP/HHVM and Apache2/Nginx as on Heroku",
"dist": {
"reference": "dcfaa2445bdd977c7ea8b38059a86ee2265e9699",
"shasum": "",
"type": "zip",
"url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/dcfaa2445bdd977c7ea8b38059a86ee2265e9699"
},
"homepage": "http://github.com/heroku/heroku-buildpack-php",
"keywords": [
"apache",
"apache2",
"foreman",
"heroku",
"hhvm",
"nginx",
"php"
],
"license": [
"MIT"
],
"name": "heroku/heroku-buildpack-php",
"notification-url": "https://packagist.org/downloads/",
"source": {
"reference": "dcfaa2445bdd977c7ea8b38059a86ee2265e9699",
"type": "git",
"url": "https://github.com/heroku/heroku-buildpack-php.git"
},
"time": "2014-12-11 00:24:11",
"type": "library",
"version": "v50"
}
],
"platform": [],
"platform-dev": [],
"prefer-lowest": false,
"prefer-stable": false,
"stability-flags": []
}

View File

@@ -0,0 +1 @@
/ python/flask

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "python/flask"
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "python/flask"

1
tests/apps/static/.env Normal file
View File

@@ -0,0 +1 @@
export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx

1
tests/apps/static/CHECKS Normal file
View File

@@ -0,0 +1 @@
/ Static Page

View File

@@ -1,2 +1,2 @@
#!/bin/bash
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "<html><h3>Static Page</h3></html>"
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "<html><h3>Static Page</h3></html>"

View File

@@ -22,7 +22,8 @@ if [[ $2 == *dokku* ]]; then
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
PUBLIC_KEY=$(< /root/.ssh/id_rsa.pub)
echo $PUBLIC_KEY | 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"

10
tests/deploy/config.bats Normal file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy config app" {
run bash -c "cd tests && ./test_deploy ./apps/config dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy gitsubmodules app" {
run bash -c "cd tests && ./test_deploy ./apps/gitsubmodules dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

10
tests/deploy/go.bats Normal file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy go app" {
run bash -c "cd tests && ./test_deploy ./apps/go dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

10
tests/deploy/java.bats Normal file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy java app" {
run bash -c "cd tests && ./test_deploy ./apps/java dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

10
tests/deploy/multi.bats Normal file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy multi app" {
run bash -c "cd tests && ./test_deploy ./apps/multi dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy nodejs-express app" {
run bash -c "cd tests && ./test_deploy ./apps/nodejs-express dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

11
tests/deploy/php.bats Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy php app" {
skip "fails. ref: https://github.com/progrium/buildstep/issues/126"
run bash -c "cd tests && ./test_deploy ./apps/php dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy python-flask app" {
run bash -c "cd tests && ./test_deploy ./apps/python-flask dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

11
tests/deploy/static.bats Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bats
load ../unit/test_helper
@test "deploy static app" {
skip "fails on apt-get update..."
run bash -c "cd tests && ./test_deploy ./apps/static dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}

View File

@@ -4,7 +4,7 @@ KEYNAME="$1"
indent() { sed "s/^/ /"; }
echo "-----> Booting EC2 instance..."
start=$(ec2-run-instances -k $1 ami-f3d1bb9a 2>&1 )
if [[ $? > 0 ]]; then
if [[ $? -gt 0 ]]; then
echo "$start" | indent
exit 3
fi
@@ -34,9 +34,10 @@ while [[ ! $(echo | nc $PUBLIC_IP 22) ]]; do
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
ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=\$PUBLIC_IP sudo bash" < ../bootstrap.sh 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
PUBLIC_KEY=$(< ~/.ssh/id_rsa.pub)
echo $PUBLIC_KEY | 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..."

View File

@@ -1,23 +1,26 @@
#!/usr/bin/env bash
set -eo pipefail
SELF=`which $0`
SELF=$(which $0)
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
if ! grep dokku.me ~/.ssh/config 2>/dev/null; then
echo "-----> Configuring SSH to use $VAGRANT_SSH_PORT for dokku.me..."
touch ~/.ssh/config
echo "Host dokku.me" >> ~/.ssh/config
echo " Port $VAGRANT_SSH_PORT" >> ~/.ssh/config
echo " RequestTTY yes" >> ~/.ssh/config
{
echo "Host dokku.me"
echo " Port $VAGRANT_SSH_PORT"
echo " RequestTTY yes"
} >> ~/.ssh/config
fi
echo "-----> Ensuring Vagrant is running..."
pushd $PWD > /dev/null
cd "$(dirname $SELF)/.." && vagrant up | indent
cd "$(dirname $SELF)"
popd > /dev/null
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"
ssh -o "StrictHostKeyChecking=no" -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo sshcommand acl-add dokku test" < $PUBLIC_KEY
for app_path in apps/*; do
app=$(basename $app_path)

View File

@@ -1,12 +1,23 @@
#!/usr/bin/env bash
set -exo pipefail
SELF=`which $0`; APP="$1"; TARGET="$2"; FORWARDED_PORT="$3"
set -eo pipefail
SELF=$(which $0); APP="$1"; TARGET="$2"; FORWARDED_PORT="$3"
REMOTE="dokku@$TARGET"
REPO="test-$(basename $APP)-$RANDOM"
destroy_app(){
echo $REPO | ssh $REMOTE apps:destroy $REPO
}
failed(){
echo "************ $1 failed ************"
dokku logs $REPO
destroy_app
exit 1
}
TMP=$(mktemp -d -t "$TARGET.XXXXX")
trap "rm -rf $TMP" EXIT
rmdir $TMP && 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"
@@ -18,14 +29,23 @@ git add .
[[ -x pre-commit ]] && ./pre-commit $REMOTE $REPO
git commit -m 'initial commit'
git push target master
[[ -x post-deploy ]] && ./post-deploy $REMOTE $REPO
git push target master || failed git-push
if [[ -x post-deploy ]]; then
./post-deploy $REMOTE $REPO || failed post-deploy
fi
URL=$(ssh $REMOTE url $REPO)$FORWARDED_PORT
URL=$(dokku url $REPO)$FORWARDED_PORT
sleep 2
./check_deploy $URL && echo "-----> Deploy success!" || {
if (./check_deploy $URL); then
echo "-----> Deploy success!"
else
sleep 4
./check_deploy $URL && echo "-----> Deploy success!"
}
if (./check_deploy $URL); then
echo "-----> Deploy success!"
else
failed check-deploy
fi
fi
ssh $REMOTE delete $REPO
dokku logs $REPO
destroy_app

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bats
load test_helper
setup() {
create_app
}
teardown() {
rm -rf /home/dokku/$TEST_APP/tls /home/dokku/tls
destroy_app
}
@test "urls (non-ssl)" {
run bash -c "dokku urls $TEST_APP | grep dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "http://dokku.me"
}
@test "urls (app ssl)" {
mkdir -p /home/dokku/$TEST_APP/tls
touch /home/dokku/$TEST_APP/tls/server.crt /home/dokku/$TEST_APP/tls/server.key
run bash -c "dokku urls $TEST_APP | grep dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "https://dokku.me"
}
@test "urls (wildcard ssl)" {
mkdir -p /home/dokku/tls
touch /home/dokku/tls/server.crt /home/dokku/tls/server.key
run bash -c "dokku urls $TEST_APP | grep dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "https://dokku.me"
}

26
tests/unit/apps.bats Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bats
load test_helper
APP=lifecycle-app
@test "apps:create" {
run dokku apps:create $APP
echo "output: "$output
echo "status: "$status
assert_success
}
@test "apps" {
run bash -c "dokku apps | grep $APP"
echo "output: "$output
echo "status: "$status
assert_output $APP
}
@test "apps:destroy" {
run bash -c "echo $APP | dokku apps:destroy $APP"
echo "output: "$output
echo "status: "$status
assert_success
}

20
tests/unit/backup.bats Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bats
# load test_helper
# setup() {
# create_app
# backup_file=$(mktemp /tmp/backup.XXXXXX)
# rm $backup_file
# }
# teardown() {
# destroy_app
# }
# @test "backup:export" {
# run dokku backup:export $backup_file
# echo "output: "$output
# echo "status: "$status
# assert_success
# }

21
tests/unit/build-env.bats Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bats
load test_helper
setup() {
create_app
}
teardown() {
destroy_app
}
@test "build-env with special chars" {
run dokku config:set $TEST_APP NEWRELIC_APP_NAME="$TEST_APP (Staging)"
echo "output: "$output
echo "status: "$status
assert_success
deploy_app
run dokku config $TEST_APP
assert_success
}

44
tests/unit/config.bats Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bats
load test_helper
setup() {
create_app
}
teardown() {
destroy_app
}
@test "config:set" {
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "config:get" {
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
run dokku config:get $TEST_APP test_var2
echo "output: "$output
echo "status: "$status
assert_output 'hello world'
}
@test "config:unset" {
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
run dokku config:get $TEST_APP test_var
echo "output: "$output
echo "status: "$status
run dokku config:unset $TEST_APP test_var
echo "output: "$output
echo "status: "$status
run dokku config:get $TEST_APP test_var
echo "output: "$output
echo "status: "$status
assert_output ""
}

51
tests/unit/domains.bats Normal file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bats
load test_helper
setup() {
deploy_app
}
teardown() {
destroy_app
}
@test "domains" {
run bash -c "dokku domains $TEST_APP | grep ${TEST_APP}.dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "${TEST_APP}.dokku.me"
}
@test "domains:add" {
run dokku domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
}
@test "domains:remove" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
run dokku domains:remove $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
refute_line "test.app.dokku.me"
}
@test "domains:clear" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
assert_success
run dokku domains:clear $TEST_APP
echo "output: "$output
echo "status: "$status
assert_success
}

103
tests/unit/test_helper.bash Normal file
View File

@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# constants
TEST_APP=my-cool-guy-test-app
# test functions
flunk() {
{ if [ "$#" -eq 0 ]; then cat -
else echo "$*"
fi
}
return 1
}
assert_success() {
if [ "$status" -ne 0 ]; then
flunk "command failed with exit status $status"
elif [ "$#" -gt 0 ]; then
assert_output "$1"
fi
}
assert_failure() {
if [ "$status" -eq 0 ]; then
flunk "expected failed exit status"
elif [ "$#" -gt 0 ]; then
assert_output "$1"
fi
}
assert_equal() {
if [ "$1" != "$2" ]; then
{ echo "expected: $1"
echo "actual: $2"
} | flunk
fi
}
assert_output() {
local expected
if [ $# -eq 0 ]; then expected="$(cat -)"
else expected="$1"
fi
assert_equal "$expected" "$output"
}
assert_line() {
if [ "$1" -ge 0 ] 2>/dev/null; then
assert_equal "$2" "${lines[$1]}"
else
local line
for line in "${lines[@]}"; do
if [ "$line" = "$1" ]; then return 0; fi
done
flunk "expected line \`$1'"
fi
}
refute_line() {
if [ "$1" -ge 0 ] 2>/dev/null; then
local num_lines="${#lines[@]}"
if [ "$1" -lt "$num_lines" ]; then
flunk "output has $num_lines lines"
fi
else
local line
for line in "${lines[@]}"; do
if [ "$line" = "$1" ]; then
flunk "expected to not find line \`$line'"
fi
done
fi
}
assert() {
if ! "$*"; then
flunk "failed: $*"
fi
}
# dokku functions
create_app() {
dokku apps:create $TEST_APP
}
destroy_app() {
echo $TEST_APP | dokku apps:destroy $TEST_APP
}
deploy_app() {
TMP=$(mktemp -d -t "$TARGET.XXXXX")
rmdir $TMP && cp -r ./tests/apps/config $TMP
cd $TMP
git init
git config user.email "robot@example.com"
git config user.name "Test Robot"
git remote add target dokku@dokku.me:$TEST_APP
[[ -f gitignore ]] && mv gitignore .gitignore
git add .
git commit -m 'initial commit'
git push target master || destroy_app
}

39
wercker.yml Normal file
View File

@@ -0,0 +1,39 @@
box: wercker-labs/docker
no-response-timeout: 20
build:
steps:
- script:
name: install os requirements
code: |-
sudo apt-get update
sudo apt-get install -y make software-properties-common git wget man-db
- script:
name: ci dependencies
code: make -e ci-dependencies
- script:
name: install dokku
code: sudo -E CI=true DOCKER_VERSION=1.4.0 make -e install
- script:
name: setup deploy tests
code: sudo -E make -e setup-deploy-tests
- script:
name: lint
code: sudo -E make -e lint
- script:
name: unit tests
code: sudo -E make -e unit-tests
- script:
name: deploy tests (against buildstep release)
code: sudo -E make -e deploy-tests
- script:
name: deploy tests (against buildstep master)
code: |-
sudo docker rmi -f progrium/buildstep
sudo -E BUILD_STACK=true make -e stack
sudo -E make -e deploy-tests
after-steps:
- wouter/irc-notify:
server: irc.freenode.net
port: 6667
nickname: dokku-wercker
channel: dokku