diff --git a/docs/application-deployment.md b/docs/application-deployment.md index 7cb332b20..74a079a98 100644 --- a/docs/application-deployment.md +++ b/docs/application-deployment.md @@ -143,6 +143,8 @@ Dokku will wait `DOKKU_WAIT_TO_RETIRE` seconds (default: `60`) before stopping t Dokku will retry the checks DOKKU_CHECKS_ATTEMPTS times until the checks are successful or DOKKU_CHECKS_ATTEMPTS is exceeded. In the latter case, the deployment is considered failed. This can be overridden in the CHECKS file by setting ATTEMPTS=nn. +Checks can be skipped entirely by setting `DOKKU_SKIP_ALL_CHECKS` to `true` either globally or per application. You can choose to skip only default checks by setting `DOKKU_SKIP_DEFAULT_CHECKS` to `true` either globally or per application. + See [checks-examples.md](checks-examples.md) for examples and output. # Removing a deployed app diff --git a/docs/development/release-process.md b/docs/development/release-process.md new file mode 100644 index 000000000..a50e85303 --- /dev/null +++ b/docs/development/release-process.md @@ -0,0 +1,68 @@ +# Release Process + +Dokku is released in intervals *at most* three weeks apart, though may be released much quicker. + +To propose a release, the following tasks need to be performed: + +- The installable version must be changed in the `docs/installation.md` file. +- The installable version must be changed in the `README.md` file. +- The installable version must be changed in the `contrib/dokku-installer.rb` file. +- A list of changes must be made in the `HISTORY.md`. +- A tag must be created locally with your release version +- Debian packages *must* be created via `vagrant up build` +- The packages should be uploaded to packagecloud.io +- All changes are pushed to master and the tag should be turned into a release which will contain the changelog. + +## Versioning + +Dokku follows semver standards. As we are not yet at a stable release, breaking changes will require *only* a minor release, while all other changes only require a patch release. Once we hit stable, breaking changes will require a major release. + +Tags should be created via the following method: + +```shell +git tag v0.9.9 +``` + +At the moment, tags need not be signed, though that may change in the future. + +## Debian Packages + +The `build` target in the dokku `Vagrantfile` creates debian packages for dokku at a point in time. The version will be based upon the latest local tag - you may create your own, internal tags/releases if that is so desired. + +Debian package information is held in the `debian` directory of the dokku project. + +For the public project, releases should be pushed to packagecloud.io *after* a tag is created but *before* said tag is pushed to github. The following may be the release workflow: + + +```shell +git tag v0.9.9 +vagrant up build +export PACKAGECLOUD_TOKEN=SOME_TOKEN +package_cloud push dokku/dokku/ubuntu/trusty dokku_0.9.9_amd64.deb +``` + +If new versions of other packages were created, these should also be pushed at this time. + +> If you are a maintainer and need the PACKAGECLOUD_TOKEN in order to make a release, please contact @josegonzalez to get this information. + +## Changelog format + +The `HISTORY.md` should be added to based on the changes made since the previous release. This can be done by reviewing all merged pull requests to the master branch on github. The format is as follows: + +``` +## 0.9.9 + +Some description concerning major changes in this release, or potential incompatibilities. + +### New Features + +- #SOME_ID: @pull-request-creator Description + +### Bug Fixes + +- #SOME_ID: @pull-request-creator Description + +### Docs Changes + +- #SOME_ID: @pull-request-creator Description +``` diff --git a/docs/dokku-event-logs.md b/docs/dokku-events-logs.md similarity index 100% rename from docs/dokku-event-logs.md rename to docs/dokku-events-logs.md diff --git a/docs/index.md b/docs/index.md index 8ecec63ef..851a2fc6f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -30,6 +30,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. - [Plugin Creation](http://progrium.viewdocs.io/dokku/development/plugin-creation) - [Pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) - [Test Suite](http://progrium.viewdocs.io/dokku/development/testing) +- [Release Process](http://progrium.viewdocs.io/dokku/development/release-process) ## Things this project won't do diff --git a/docs/installation.md b/docs/installation.md index 4f905eb99..1f8833aba 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -15,7 +15,8 @@ To install the latest stable version of dokku, you can run the following bootstr wget https://raw.github.com/progrium/dokku/v0.3.21/bootstrap.sh sudo DOKKU_TAG=v0.3.21 bash bootstrap.sh -# Go to your server's IP and follow the web installer +# By default, this will do cli-based setup, though you may *also* +# go to your server's IP and follow the web installer ``` For various reasons, certain hosting providers may have other steps that should be preferred to the above. If hosted on any of the following popular hosts, please follow the linked to instructions: diff --git a/docs/nginx.md b/docs/nginx.md index 6f87d4bbb..154dc3635 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -56,7 +56,7 @@ This archive should is expanded via `tar xvf`. It should contain `server.crt` an > New as of 0.3.10 -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`. +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`. If you followed the default installation path, the original templates are found in `/var/lib/dokku/plugins/nginx-vhosts/templates/nginx{.ssl,}.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: @@ -94,6 +94,8 @@ A few tips for custom nginx templates: - Templated files will be validated via `nginx -t`. - Application environment variables can be used within your nginx configuration. +After your changes a `dokku deploy myapp` will regenerate the `/home/dokku/myapp/nginx.conf` file which is then used. + ## Customizing hostnames Applications typically have the following structure for their hostname: diff --git a/docs/plugins.md b/docs/plugins.md index 4204b554c..d78f1fb97 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -82,6 +82,9 @@ Note: The following plugins have been supplied by our community and may not have [ribot]: https://github.com/ribot [Benjamin-Dobell]: https://github.com/Benjamin-Dobell [jagandecapri]: https://github.com/jagandecapri +[mixxorz]: https://github.com/mixxorz +[Maciej Łebkowski]: https://github.com/mlebkowski +[abossard]: https://github.com/dudagroup ### Datastores @@ -189,13 +192,14 @@ Note: The following plugins have been supplied by our community and may not have | [Bower/Grunt](https://github.com/thrashr888/dokku-bower-grunt-build-plugin) | [thrashr888][] | | | [Bower/Gulp](https://github.com/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290][] | | | [Bower/Gulp](https://github.com/jagandecapri/dokku-bower-gulp-build-plugin) | [jagandecapri][] | | +| [Docker auto volumes](https://github.com/Flink/dokku-docker-auto-volumes) | [Flink][] | 0.3.17+, auto-persist docker volumes | | [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | | | [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | | | [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | | | [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | | | [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | | -| [PrimeCache](https://github.com/darkpixel/dokku-prime-cache) | [darkpixel][] | | | [Rails logs](https://github.com/Flink/dokku-rails-logs) | [Flink][] | | +| [Reset mtime](https://github.com/mixxorz/dokku-docker-reset-mtime) | [mixxorz][] | 0.3.15+, Dockerfile support | | [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | | | [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | | | [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | | @@ -217,6 +221,7 @@ The following plugins have been removed as their functionality is now in Dokku C | [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)1 | [wmluke][] | v0.3.10 (domains plugin) | | [Nginx-Alt](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | v0.3.10 (domains plugin) | | [Persistent Storage](https://github.com/dyson/dokku-persistent-storage) | [dyson][] | v0.3.17 (docker-options plugin) | +| [PrimeCache](https://github.com/darkpixel/dokku-prime-cache) | [darkpixel][] | v0.3.0 (zero downtime deploys) | | [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) | | [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)2 | [cameron-martin][] | v0.3.9 (build-env plugin) | | [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)2 | [musicglue][] | v0.3.9 (build-env plugin) | diff --git a/dokku b/dokku index 15a1ccdd4..7d4e0f566 100755 --- a/dokku +++ b/dokku @@ -73,6 +73,9 @@ case "$1" in DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" oldids=$(get_container_ids $APP) + [[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV + [[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV + while read line || [ -n "$line" ] do PROC_TYPE=${line%%=*} @@ -118,10 +121,14 @@ case "$1" in } # run checks first, then post-deploy hooks, which switches Nginx traffic - trap kill_new INT TERM EXIT - dokku_log_info1 "Running pre-flight checks" - pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr - trap - INT TERM EXIT + if [[ "$DOKKU_SKIP_ALL_CHECKS" = "true" ]]; then + dokku_log_info1 "Skipping pre-flight checks" + else + trap kill_new INT TERM EXIT + dokku_log_info1 "Running pre-flight checks" + pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr + trap - INT TERM EXIT + fi # now using the new container [[ -n "$id" ]] && echo $id > "$DOKKU_CONTAINER_ID_FILE" @@ -174,7 +181,7 @@ case "$1" in cleanup) # delete all non-running container # shellcheck disable=SC2046 - docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null & + docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true # delete unused images # shellcheck disable=SC2046 docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null & @@ -208,10 +215,10 @@ case "$1" in echo "Options:" cat< [-t] Show the last logs for an application (-t follows) - run Run a command in the environment of an application - url Show the first URL for an application (compatibility) - urls Show all URLs for an application - version Print dokku's version + ls Pretty listing of deployed applications and containers + logs [-t] Show the last logs for an application (-t follows) + run Run a command in the environment of an application + url Show the first URL for an application (compatibility) + urls Show all URLs for an application + version Print dokku's version EOF ;; diff --git a/plugins/20_events/commands b/plugins/20_events/commands index 62f0ea475..ad96119e5 100755 --- a/plugins/20_events/commands +++ b/plugins/20_events/commands @@ -40,10 +40,10 @@ case "$1" in help | events:help) cat && cat< Create a new app - apps:destroy Permanently destroy an app + apps List your apps + apps:create Create a new app + apps:destroy Permanently destroy an app EOF ;; diff --git a/plugins/backup/commands b/plugins/backup/commands index 3eacdde2a..8d44e1438 100755 --- a/plugins/backup/commands +++ b/plugins/backup/commands @@ -87,8 +87,8 @@ case "$1" in help | backup:help) cat && cat< $ENV_FILE_TEMP if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then cp -f $ENV_FILE_TEMP $ENV_FILE @@ -46,14 +46,43 @@ config_write() { rm -f $ENV_FILE_TEMP } +parse_config_args() { + case "$2" in + --global) + ENV_FILE="$DOKKU_ROOT/ENV" + DOKKU_CONFIG_TYPE="global" + DOKKU_CONFIG_RESTART=false + ;; + --no-restart) + APP="$3" + ENV_FILE="$DOKKU_ROOT/$APP/ENV" + DOKKU_CONFIG_RESTART=false + DOKKU_CONFIG_TYPE="app" + set -- "${@:1:1}" "${@:3}" + esac + + APP=${APP:="$2"} + ENV_FILE=${ENV_FILE:="$DOKKU_ROOT/$APP/ENV"} + DOKKU_CONFIG_TYPE=${DOKKU_CONFIG_TYPE:="app"} + DOKKU_CONFIG_RESTART=${DOKKU_CONFIG_RESTART:=true} + + if [[ "$DOKKU_CONFIG_TYPE" = "app" ]]; then + if [[ -z $APP ]]; then + echo "Please specify an app to run the command on" >&2 && exit 1 + else + verify_app_name "$2" + fi + fi + export APP ENV_FILE DOKKU_CONFIG_TYPE DOKKU_CONFIG_RESTART +} + case "$1" in config) - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 - verify_app_name "$2" - APP="$2" - + parse_config_args "$@" config_create - [[ ! -s $ENV_FILE ]] && echo "$APP has no config vars" && exit 1 + + [[ "$APP" ]] && DOKKU_CONFIG_TYPE=$APP + [[ ! -s $ENV_FILE ]] && echo "no config vars for $DOKKU_CONFIG_TYPE" && exit 1 VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-) @@ -64,14 +93,13 @@ case "$1" in fi done - dokku_log_info2_quiet "$APP config vars" + + dokku_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars" config_styled_hash "$VARS" ;; config:get) - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 - verify_app_name "$2" - APP="$2" + parse_config_args "$@" if [[ -z $3 ]]; then echo "Usage: dokku config:get APP KEY" @@ -90,26 +118,8 @@ case "$1" in ;; config:set) - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 - verify_app_name "$2" - APP="$2" - - if [[ -z "${*:3}" ]]; then - echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]" - echo "Must specify KEY and VALUE to set." - exit 1 - fi - - shift 2 - dokku config:set-norestart $APP "$@" - dokku_log_info1 "Restarting app $APP" - dokku ps:restart $APP - ;; - - config:set-norestart) - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 - verify_app_name "$2" - APP="$2" + parse_config_args "$@" + [[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}" if [[ -z "${*:3}" ]]; then echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]" @@ -153,29 +163,16 @@ ${var}" config_write "$ENV_TEMP" fi + + if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then + dokku_log_info1 "Restarting app $APP" + dokku ps:restart $APP + fi ;; config:unset) - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 - verify_app_name "$2" - APP="$2" - - if [[ -z $3 ]]; then - echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]" - echo "Must specify KEY to unset." - exit 1 - fi - - shift 2 - dokku config:unset-norestart $APP "$@" - dokku_log_info1 "Restarting app $APP" - dokku ps:restart $APP - ;; - - config:unset-norestart) - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 - verify_app_name "$2" - APP="$2" + parse_config_args "$@" + [[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}" if [[ -z $3 ]]; then echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]" @@ -193,14 +190,31 @@ ${var}" config_write "$ENV_TEMP" done + + if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then + dokku_log_info1 "Restarting app $APP" + dokku ps:restart $APP + fi + ;; + + config:set-norestart) + dokku_log_info2 "$1 is deprecated as of v0.3.22" + shift 1 + dokku config:set --no-restart "$@" + ;; + + config:unset-norestart) + dokku_log_info2 "$1 is deprecated as of v0.3.22" + shift 1 + dokku config:unset --no-restart "$@" ;; help | config:help) cat && cat< Display the config vars for an app - config:get KEY Display a config value for an app - config:set KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars - config:unset KEY1 [KEY2 ...] Unset one or more config vars + config (|--global) Display all global or app-specific config vars + config:get (|--global) KEY Display a global or app-specific config value + config:set (|--global) KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars + config:unset (|--global) KEY1 [KEY2 ...] Unset one or more config vars EOF ;; diff --git a/plugins/docker-options/commands b/plugins/docker-options/commands index d3eb5a9eb..377fcfd5d 100755 --- a/plugins/docker-options/commands +++ b/plugins/docker-options/commands @@ -141,10 +141,10 @@ case "$1" in # Display usage help help) cat && cat< Display apps docker options for all phases - docker-options Display apps docker options for phase (comma seperated phase list) - docker-options:add OPTION Add docker option to app for phase (comma seperated phase list) - docker-options:remove OPTION Remove docker option from app for phase (comma seperated phase list) + docker-options Display apps docker options for all phases + docker-options Display apps docker options for phase (comma seperated phase list) + docker-options:add OPTION Add docker option to app for phase (comma seperated phase list) + docker-options:remove OPTION Remove docker option from app for phase (comma seperated phase list) EOF ;; diff --git a/plugins/domains/commands b/plugins/domains/commands index 5de0f426d..4b2297bdf 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -133,10 +133,10 @@ case "$1" in help | domains:help) cat && cat< List custom domains for app - domains:add DOMAIN Add a custom domain to app - domains:clear Clear all custom domains for app - domains:remove DOMAIN Remove a custom domain from app + domains List custom domains for app + domains:add DOMAIN Add a custom domain to app + domains:clear Clear all custom domains for app + domains:remove DOMAIN Remove a custom domain from app EOF ;; diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 126c096cd..3600965e0 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -133,6 +133,10 @@ EOF dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST" rm "$DOKKU_ROOT/$APP/VHOST" fi + if [[ -f "$DOKKU_ROOT/$APP/URLS" ]]; then + dokku_log_info1 "VHOST support disabled, deleting $APP/URLS" + rm "$DOKKU_ROOT/$APP/URLS" + fi if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then dokku_log_info1 "VHOST support disabled, deleting nginx.conf" rm "$DOKKU_ROOT/$APP/nginx.conf" @@ -167,8 +171,8 @@ EOF help | nginx:help) cat && cat< Imports a tarball from stdin; should contain server.crt and server.key - nginx:build-config (Re)builds nginx config for given app + nginx:import-ssl Imports a tarball from stdin; should contain server.crt and server.key + nginx:build-config (Re)builds nginx config for given app EOF ;; diff --git a/plugins/ps/commands b/plugins/ps/commands index 92e28d1cc..f5b824643 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -105,14 +105,14 @@ case "$1" in help | ps:help) cat && cat< List processes running in app container(s) - ps:scale = [=] Set how many processes of a given process to run - ps:start Start app container(s) - ps:stop Stop app container(s) - ps:rebuild Rebuild an app - ps:rebuildall Rebuild all apps - ps:restart Restart app container(s) - ps:restartall Restart all deployed app containers + ps List processes running in app container(s) + ps:scale = [=] Set how many processes of a given process to run + ps:start Start app container(s) + ps:stop Stop app container(s) + ps:rebuild Rebuild an app + ps:rebuildall Rebuild all apps + ps:restart Restart app container(s) + ps:restartall Restart all deployed app containers EOF ;; diff --git a/plugins/shell/commands b/plugins/shell/commands index c6dca6ffe..3b1d6d60b 100755 --- a/plugins/shell/commands +++ b/plugins/shell/commands @@ -48,7 +48,7 @@ case "$1" in help | shell:help) cat && cat< $DOKKU_ROOT/ENV" create_app } teardown() { destroy_app - rm -f "$DOKKU_ROOT/ENV" + [[ -f $DOKKU_ROOT/ENV.bak ]] && mv -f $DOKKU_ROOT/ENV.bak $DOKKU_ROOT/ENV +} + +@test "(config) config:set --global" { + run ssh dokku@dokku.me config:set --global test_var=true test_var2=\"hello world\" + echo "output: "$output + echo "status: "$status + assert_success +} + +@test "(config) config:get --global" { + run ssh dokku@dokku.me config:set --global test_var=true test_var2=\"hello world\" test_var3=\"with\\nnewline\" + echo "output: "$output + echo "status: "$status + assert_success + run dokku config:get --global test_var2 + echo "output: "$output + echo "status: "$status + assert_output 'hello world' + run dokku config:get --global test_var3 + echo "output: "$output + echo "status: "$status + assert_output 'with\nnewline' +} + +@test "(config) config:unset --global" { + run ssh dokku@dokku.me config:set --global test_var=true test_var2=\"hello world\" + echo "output: "$output + echo "status: "$status + assert_success + run dokku config:get --global test_var + echo "output: "$output + echo "status: "$status + assert_success + run dokku config:unset --global test_var + echo "output: "$output + echo "status: "$status + assert_success + run dokku config:get --global test_var + echo "output: "$output + echo "status: "$status + assert_output "" } @test "(config) config:set" { diff --git a/tests/unit/core_ports.bats b/tests/unit/core_ports.bats index 1fdf76097..696159ce8 100644 --- a/tests/unit/core_ports.bats +++ b/tests/unit/core_ports.bats @@ -14,57 +14,80 @@ teardown() { [[ -f "$DOKKU_ROOT/HOSTNAME.bak" ]] && mv "$DOKKU_ROOT/HOSTNAME.bak" "$DOKKU_ROOT/HOSTNAME" } + +check_urls() { + local PATTERN="$1" + run bash -c "dokku --quiet urls $TEST_APP | egrep \"${1}\"" + echo "output: "$output + echo "status: "$status + assert_success +} + @test "(core) port exposure (with global VHOST)" { echo "dokku.me" > "$DOKKU_ROOT/VHOST" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_failure + + check_urls http://${TEST_APP}.dokku.me } @test "(core) port exposure (without global VHOST and real HOSTNAME)" { rm "$DOKKU_ROOT/VHOST" - echo "dokku.me" > "$DOKKU_ROOT/HOSTNAME" + echo "${TEST_APP}.dokku.me" > "$DOKKU_ROOT/HOSTNAME" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success + + HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME") + check_urls http://${HOSTNAME}:[0-9]+ } @test "(core) port exposure (with NO_VHOST set)" { deploy_app dokku config:set $TEST_APP NO_VHOST=1 - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1) - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success + + HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME") + check_urls http://${HOSTNAME}:[0-9]+ } @test "(core) port exposure (without global VHOST and IPv4 address as HOSTNAME)" { rm "$DOKKU_ROOT/VHOST" echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success + + HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME") + check_urls http://${HOSTNAME}:[0-9]+ } @test "(core) port exposure (without global VHOST and IPv6 address as HOSTNAME)" { rm "$DOKKU_ROOT/VHOST" echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" > "$DOKKU_ROOT/HOSTNAME" deploy_app - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_success + + HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME") + check_urls http://${HOSTNAME}:[0-9]+ } @test "(core) port exposure (pre-deploy domains:add)" { @@ -77,8 +100,8 @@ teardown() { deploy_app sleep 5 # wait for nginx to reload - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_failure @@ -87,6 +110,8 @@ teardown() { echo "output: "$output echo "status: "$status assert_success + + check_urls http://www.test.app.dokku.me } @test "(core) port exposure (no global VHOST and domains:add post deploy)" { @@ -103,8 +128,8 @@ teardown() { echo "status: "$status assert_success - CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1) - run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" + CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1) + run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'" echo "output: "$output echo "status: "$status assert_failure @@ -113,14 +138,18 @@ teardown() { echo "output: "$output echo "status: "$status assert_success + + check_urls http://www.test.app.dokku.me } @test "(core) dockerfile port exposure" { deploy_app dockerfile - run bash -c "grep -A1 upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000" + run bash -c "grep -A1 upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep -q 3000" echo "output: "$output echo "status: "$status assert_success + + check_urls http://${TEST_APP}.dokku.me } @test "(core) port exposure (xip.io style hostnames)" { @@ -131,6 +160,8 @@ teardown() { echo "output: "$output echo "status: "$status assert_success + + check_urls http://my-cool-guy-test-app.127.0.0.1.xip.io } @test "(core) port exposure (dockerfile raw port)" {