Merge branch 'master' into kilianc_hotfix-#1259

This commit is contained in:
Michael Hobbs committed 2015-07-12 16:27:10 -07:00
commit 3e58824377
15 files changed
+266 -98

No files matched your search

+2
View File
@@ -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. 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. See [checks-examples.md](checks-examples.md) for examples and output.
# Removing a deployed app # Removing a deployed app
+68
View File
@@ -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
```
File renamed without changes.
+1
View File
@@ -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) - [Plugin Creation](http://progrium.viewdocs.io/dokku/development/plugin-creation)
- [Pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) - [Pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks)
- [Test Suite](http://progrium.viewdocs.io/dokku/development/testing) - [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 ## Things this project won't do
+2 -1
View File
@@ -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 wget https://raw.github.com/progrium/dokku/v0.3.21/bootstrap.sh
sudo DOKKU_TAG=v0.3.21 bash 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: 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:
+3 -1
View File
@@ -56,7 +56,7 @@ This archive should is expanded via `tar xvf`. It should contain `server.crt` an
> New as of 0.3.10 > 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: 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`. - Templated files will be validated via `nginx -t`.
- Application environment variables can be used within your nginx configuration. - 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 ## Customizing hostnames
Applications typically have the following structure for their hostname: Applications typically have the following structure for their hostname:
+6 -1
View File
@@ -82,6 +82,9 @@ Note: The following plugins have been supplied by our community and may not have
[ribot]: https://github.com/ribot [ribot]: https://github.com/ribot
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell [Benjamin-Dobell]: https://github.com/Benjamin-Dobell
[jagandecapri]: https://github.com/jagandecapri [jagandecapri]: https://github.com/jagandecapri
[mixxorz]: https://github.com/mixxorz
[Maciej Łebkowski]: https://github.com/mlebkowski
[abossard]: https://github.com/dudagroup
### Datastores ### 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/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/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290][] | |
| [Bower/Gulp](https://github.com/jagandecapri/dokku-bower-gulp-build-plugin) | [jagandecapri][] | | | [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][] | | | [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | |
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | | | [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | |
| [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | | | [Logspout](https://github.com/michaelshobbs/dokku-logspout) | [michaelshobbs][] | |
| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | | | [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | |
| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | | | [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][] | | | [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][] | | | [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | |
| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | | | [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | |
| [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | | | [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)<sup>1</sup> | [wmluke][] | v0.3.10 (domains plugin) | | [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>1</sup> | [wmluke][] | v0.3.10 (domains plugin) |
| [Nginx-Alt](https://github.com/mikexstudios/dokku-nginx-alt) | [mikexstudios][] | 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) | | [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) | | [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) |
| [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)<sup>2</sup> | [cameron-martin][] | v0.3.9 (build-env plugin) | | [Supply env vars to buildpacks](https://github.com/cameron-martin/dokku-build-env)<sup>2</sup> | [cameron-martin][] | v0.3.9 (build-env plugin) |
| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>2</sup> | [musicglue][] | v0.3.9 (build-env plugin) | | [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>2</sup> | [musicglue][] | v0.3.9 (build-env plugin) |
+8 -1
View File
@@ -73,6 +73,9 @@ case "$1" in
DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
oldids=$(get_container_ids $APP) 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" ] while read line || [ -n "$line" ]
do do
PROC_TYPE=${line%%=*} PROC_TYPE=${line%%=*}
@@ -118,10 +121,14 @@ case "$1" in
} }
# run checks first, then post-deploy hooks, which switches Nginx traffic # run checks first, then post-deploy hooks, which switches Nginx traffic
if [[ "$DOKKU_SKIP_ALL_CHECKS" = "true" ]]; then
dokku_log_info1 "Skipping pre-flight checks"
else
trap kill_new INT TERM EXIT trap kill_new INT TERM EXIT
dokku_log_info1 "Running pre-flight checks" dokku_log_info1 "Running pre-flight checks"
pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr
trap - INT TERM EXIT trap - INT TERM EXIT
fi
# now using the new container # now using the new container
[[ -n "$id" ]] && echo $id > "$DOKKU_CONTAINER_ID_FILE" [[ -n "$id" ]] && echo $id > "$DOKKU_CONTAINER_ID_FILE"
@@ -174,7 +181,7 @@ case "$1" in
cleanup) cleanup)
# delete all non-running container # delete all non-running container
# shellcheck disable=SC2046 # 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 # delete unused images
# shellcheck disable=SC2046 # shellcheck disable=SC2046
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null & docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
+3 -1
View File
@@ -180,6 +180,8 @@ case "$1" in
verify_app_name "$2" verify_app_name "$2"
APP="$2"; APP="$2";
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source "$DOKKU_ROOT/$APP/ENV"
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then
case "$1" in case "$1" in
url) url)
@@ -198,7 +200,7 @@ case "$1" in
SCHEME="https" SCHEME="https"
fi fi
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then if [[ -f "$DOKKU_ROOT/VHOST" ]] && [[ "$NO_VHOST" != "1" ]]; then
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")" echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
else else
for PORT_FILE in $DOKKU_ROOT/$APP/PORT.*; do for PORT_FILE in $DOKKU_ROOT/$APP/PORT.*; do
+9
View File
@@ -79,6 +79,10 @@ cleanup() {
trap cleanup EXIT trap cleanup EXIT
if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]]; then if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]]; then
if [[ "$DOKKU_SKIP_DEFAULT_CHECKS" = "true" ]]; then
dokku_log_verbose "Skipping default check..."
exit 0
fi
dokku_log_verbose "For more efficient zero downtime deployments, create a file CHECKS." dokku_log_verbose "For more efficient zero downtime deployments, create a file CHECKS."
dokku_log_verbose "See http://progrium.viewdocs.io/dokku/checks-examples.md for examples" dokku_log_verbose "See http://progrium.viewdocs.io/dokku/checks-examples.md for examples"
dokku_log_verbose "CHECKS file not found in container: Running simple container check..." dokku_log_verbose "CHECKS file not found in container: Running simple container check..."
@@ -125,6 +129,11 @@ do
# --location Follow redirects # --location Follow redirects
CURL_OPTIONS="-q --compressed --fail --location --max-time $TIMEOUT" CURL_OPTIONS="-q --compressed --fail --location --max-time $TIMEOUT"
# Set X-Forwarded-Proto header if TLS is enabled.
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
CURL_OPTIONS+=" -H X-Forwarded-Proto:https"
fi
exec < "$FILENAME" exec < "$FILENAME"
while read CHECK_URL EXPECTED ; do while read CHECK_URL EXPECTED ; do
+70 -56
View File
@@ -2,8 +2,6 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions" source "$(dirname $0)/../common/functions"
ENV_FILE="$DOKKU_ROOT/$2/ENV"
ENV_FILE_TEMP="$DOKKU_ROOT/$2/ENV.tmp"
config_create () { config_create () {
[ -f $ENV_FILE ] || { [ -f $ENV_FILE ] || {
touch $ENV_FILE touch $ENV_FILE
@@ -24,7 +22,7 @@ config_styled_hash () {
while read -r word; do while read -r word; do
KEY=$(echo $word | cut -d"=" -f1) KEY=$(echo $word | cut -d"=" -f1)
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//") VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//" -e "s/\$$//g")
num_zeros=$((${#longest} - ${#KEY})) num_zeros=$((${#longest} - ${#KEY}))
zeros=" " zeros=" "
@@ -38,6 +36,8 @@ config_styled_hash () {
config_write() { config_write() {
ENV_TEMP="$1" ENV_TEMP="$1"
ENV_FILE_TEMP="${ENV_FILE}.tmp"
echo "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP echo "$ENV_TEMP" | sed '/^$/d' | sort > $ENV_FILE_TEMP
if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then if ! cmp -s $ENV_FILE $ENV_FILE_TEMP; then
cp -f $ENV_FILE_TEMP $ENV_FILE cp -f $ENV_FILE_TEMP $ENV_FILE
@@ -46,14 +46,43 @@ config_write() {
rm -f $ENV_FILE_TEMP 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 case "$1" in
config) config)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 parse_config_args "$@"
verify_app_name "$2"
APP="$2"
config_create 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-) VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
@@ -64,14 +93,13 @@ case "$1" in
fi fi
done done
dokku_log_info2_quiet "$APP config vars"
dokku_log_info2_quiet "$DOKKU_CONFIG_TYPE config vars"
config_styled_hash "$VARS" config_styled_hash "$VARS"
;; ;;
config:get) config:get)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 parse_config_args "$@"
verify_app_name "$2"
APP="$2"
if [[ -z $3 ]]; then if [[ -z $3 ]]; then
echo "Usage: dokku config:get APP KEY" echo "Usage: dokku config:get APP KEY"
@@ -90,26 +118,8 @@ case "$1" in
;; ;;
config:set) config:set)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 parse_config_args "$@"
verify_app_name "$2" [[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
APP="$2"
if [[ -z "${*:3}" ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
echo "Must specify KEY and VALUE to set."
exit 1
fi
shift 2
dokku config:set-norestart $APP "$@"
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
;;
config:set-norestart)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"
if [[ -z "${*:3}" ]]; then if [[ -z "${*:3}" ]]; then
echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]" echo "Usage: dokku config:set APP KEY1=VALUE1 [KEY2=VALUE2 ...]"
@@ -153,29 +163,16 @@ ${var}"
config_write "$ENV_TEMP" config_write "$ENV_TEMP"
fi fi
if [[ "$DOKKU_CONFIG_RESTART" == "true" ]]; then
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
fi
;; ;;
config:unset) config:unset)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 parse_config_args "$@"
verify_app_name "$2" [[ "$2" = "--no-restart" ]] && set -- "${@:1:1}" "${@:3}"
APP="$2"
if [[ -z $3 ]]; then
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
echo "Must specify KEY to unset."
exit 1
fi
shift 2
dokku config:unset-norestart $APP "$@"
dokku_log_info1 "Restarting app $APP"
dokku ps:restart $APP
;;
config:unset-norestart)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"
if [[ -z $3 ]]; then if [[ -z $3 ]]; then
echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]" echo "Usage: dokku config:unset APP KEY1 [KEY2 ...]"
@@ -193,14 +190,31 @@ ${var}"
config_write "$ENV_TEMP" config_write "$ENV_TEMP"
done 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) help | config:help)
cat && cat<<EOF cat && cat<<EOF
config <app> Display the config vars for an app config (<app>|--global) Display all global or app-specific config vars
config:get <app> KEY Display a config value for an app config:get (<app>|--global) KEY Display a global or app-specific config value
config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars
config:unset <app> KEY1 [KEY2 ...] Unset one or more config vars config:unset (<app>|--global) KEY1 [KEY2 ...] Unset one or more config vars
EOF EOF
;; ;;
+4
View File
@@ -133,6 +133,10 @@ EOF
dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST" dokku_log_info1 "VHOST support disabled, deleting $APP/VHOST"
rm "$DOKKU_ROOT/$APP/VHOST" rm "$DOKKU_ROOT/$APP/VHOST"
fi 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 if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
dokku_log_info1 "VHOST support disabled, deleting nginx.conf" dokku_log_info1 "VHOST support disabled, deleting nginx.conf"
rm "$DOKKU_ROOT/$APP/nginx.conf" rm "$DOKKU_ROOT/$APP/nginx.conf"
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env bats
# load test_helper
# setup() {
# create_app
# backup_file=$(mktemp /tmp/backup.XXXXXX)
# rm $backup_file
# }
# teardown() {
# destroy_app
# }
# @test "(backup) backup:export" {
# run dokku backup:export $backup_file
# echo "output: "$output
# echo "status: "$status
# assert_success
# }
+43 -1
View File
@@ -3,13 +3,55 @@
load test_helper load test_helper
setup() { setup() {
[[ -f $DOKKU_ROOT/ENV ]] && mv -f $DOKKU_ROOT/ENV $DOKKU_ROOT/ENV.bak
sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > $DOKKU_ROOT/ENV" sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > $DOKKU_ROOT/ENV"
create_app create_app
} }
teardown() { teardown() {
destroy_app 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" { @test "(config) config:set" {
+47 -16
View File
@@ -14,57 +14,80 @@ teardown() {
[[ -f "$DOKKU_ROOT/HOSTNAME.bak" ]] && mv "$DOKKU_ROOT/HOSTNAME.bak" "$DOKKU_ROOT/HOSTNAME" [[ -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)" { @test "(core) port exposure (with global VHOST)" {
echo "dokku.me" > "$DOKKU_ROOT/VHOST" echo "dokku.me" > "$DOKKU_ROOT/VHOST"
deploy_app deploy_app
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure assert_failure
check_urls http://${TEST_APP}.dokku.me
} }
@test "(core) port exposure (without global VHOST and real HOSTNAME)" { @test "(core) port exposure (without global VHOST and real HOSTNAME)" {
rm "$DOKKU_ROOT/VHOST" rm "$DOKKU_ROOT/VHOST"
echo "dokku.me" > "$DOKKU_ROOT/HOSTNAME" echo "${TEST_APP}.dokku.me" > "$DOKKU_ROOT/HOSTNAME"
deploy_app deploy_app
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
check_urls http://${HOSTNAME}:[0-9]+
} }
@test "(core) port exposure (with NO_VHOST set)" { @test "(core) port exposure (with NO_VHOST set)" {
deploy_app deploy_app
dokku config:set $TEST_APP NO_VHOST=1 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) CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
check_urls http://${HOSTNAME}:[0-9]+
} }
@test "(core) port exposure (without global VHOST and IPv4 address as HOSTNAME)" { @test "(core) port exposure (without global VHOST and IPv4 address as HOSTNAME)" {
rm "$DOKKU_ROOT/VHOST" rm "$DOKKU_ROOT/VHOST"
echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME" echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME"
deploy_app deploy_app
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
check_urls http://${HOSTNAME}:[0-9]+
} }
@test "(core) port exposure (without global VHOST and IPv6 address as HOSTNAME)" { @test "(core) port exposure (without global VHOST and IPv6 address as HOSTNAME)" {
rm "$DOKKU_ROOT/VHOST" rm "$DOKKU_ROOT/VHOST"
echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" > "$DOKKU_ROOT/HOSTNAME" echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" > "$DOKKU_ROOT/HOSTNAME"
deploy_app deploy_app
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
check_urls http://${HOSTNAME}:[0-9]+
} }
@test "(core) port exposure (pre-deploy domains:add)" { @test "(core) port exposure (pre-deploy domains:add)" {
@@ -77,8 +100,8 @@ teardown() {
deploy_app deploy_app
sleep 5 # wait for nginx to reload sleep 5 # wait for nginx to reload
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }') CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure assert_failure
@@ -87,6 +110,8 @@ teardown() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
check_urls http://www.test.app.dokku.me
} }
@test "(core) port exposure (no global VHOST and domains:add post deploy)" { @test "(core) port exposure (no global VHOST and domains:add post deploy)" {
@@ -103,8 +128,8 @@ teardown() {
echo "status: "$status echo "status: "$status
assert_success assert_success
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1) CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure assert_failure
@@ -113,14 +138,18 @@ teardown() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
check_urls http://www.test.app.dokku.me
} }
@test "(core) dockerfile port exposure" { @test "(core) dockerfile port exposure" {
deploy_app dockerfile 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 "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
check_urls http://${TEST_APP}.dokku.me
} }
@test "(core) port exposure (xip.io style hostnames)" { @test "(core) port exposure (xip.io style hostnames)" {
@@ -131,6 +160,8 @@ teardown() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
check_urls http://my-cool-guy-test-app.127.0.0.1.xip.io
} }
@test "(core) port exposure (dockerfile raw port)" { @test "(core) port exposure (dockerfile raw port)" {