Merge branch 'master' into kilianc_hotfix-#1259
This commit is contained in:
@@ -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
|
||||
|
||||
68
docs/development/release-process.md
Normal file
68
docs/development/release-process.md
Normal 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
|
||||
```
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)<sup>1</sup> | [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)<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) |
|
||||
|
||||
25
dokku
25
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<<EOF | pluginhook commands help | sort
|
||||
help Print the list of commands
|
||||
plugins Print active plugins
|
||||
plugins-install Install active plugins
|
||||
plugins-update Update active plugins
|
||||
help Print the list of commands
|
||||
plugins Print active plugins
|
||||
plugins-install Install active plugins
|
||||
plugins-update Update active plugins
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -180,6 +180,8 @@ case "$1" in
|
||||
verify_app_name "$2"
|
||||
APP="$2";
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source "$DOKKU_ROOT/$APP/ENV"
|
||||
|
||||
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then
|
||||
case "$1" in
|
||||
url)
|
||||
@@ -198,7 +200,7 @@ case "$1" in
|
||||
SCHEME="https"
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]] && [[ "$NO_VHOST" != "1" ]]; then
|
||||
echo "$SCHEME://$(< "$DOKKU_ROOT/VHOST")"
|
||||
else
|
||||
for PORT_FILE in $DOKKU_ROOT/$APP/PORT.*; do
|
||||
@@ -216,12 +218,12 @@ case "$1" in
|
||||
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
ls Pretty listing of deployed applications and containers
|
||||
logs <app> [-t] Show the last logs for an application (-t follows)
|
||||
run <app> <cmd> Run a command in the environment of an application
|
||||
url <app> Show the first URL for an application (compatibility)
|
||||
urls <app> Show all URLs for an application
|
||||
version Print dokku's version
|
||||
ls Pretty listing of deployed applications and containers
|
||||
logs <app> [-t] Show the last logs for an application (-t follows)
|
||||
run <app> <cmd> Run a command in the environment of an application
|
||||
url <app> Show the first URL for an application (compatibility)
|
||||
urls <app> Show all URLs for an application
|
||||
version Print dokku's version
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ case "$1" in
|
||||
|
||||
help | events:help)
|
||||
cat && cat<<EOF
|
||||
events [-t] Show the last events (-t follows)
|
||||
events:list List logged events
|
||||
events:on Enable events logger
|
||||
events:off Disable events logger
|
||||
events [-t] Show the last events (-t follows)
|
||||
events:list List logged events
|
||||
events:on Enable events logger
|
||||
events:off Disable events logger
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ case "$1" in
|
||||
|
||||
help | apps:help)
|
||||
cat && cat<<EOF
|
||||
apps List your apps
|
||||
apps:create <app> Create a new app
|
||||
apps:destroy <app> Permanently destroy an app
|
||||
apps List your apps
|
||||
apps:create <app> Create a new app
|
||||
apps:destroy <app> Permanently destroy an app
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ case "$1" in
|
||||
|
||||
help | backup:help)
|
||||
cat && cat<<EOF
|
||||
backup:export [file] Export dokku configuration files
|
||||
backup:import [file] Import dokku configuration files
|
||||
backup:export [file] Export dokku configuration files
|
||||
backup:import [file] Import dokku configuration files
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -79,6 +79,10 @@ cleanup() {
|
||||
trap cleanup EXIT
|
||||
|
||||
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 "See http://progrium.viewdocs.io/dokku/checks-examples.md for examples"
|
||||
dokku_log_verbose "CHECKS file not found in container: Running simple container check..."
|
||||
@@ -125,6 +129,11 @@ do
|
||||
# --location Follow redirects
|
||||
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"
|
||||
while read CHECK_URL EXPECTED ; do
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
ENV_FILE="$DOKKU_ROOT/$2/ENV"
|
||||
ENV_FILE_TEMP="$DOKKU_ROOT/$2/ENV.tmp"
|
||||
config_create () {
|
||||
[ -f $ENV_FILE ] || {
|
||||
touch $ENV_FILE
|
||||
@@ -24,7 +22,7 @@ config_styled_hash () {
|
||||
|
||||
while read -r word; do
|
||||
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}))
|
||||
zeros=" "
|
||||
@@ -38,6 +36,8 @@ config_styled_hash () {
|
||||
|
||||
config_write() {
|
||||
ENV_TEMP="$1"
|
||||
ENV_FILE_TEMP="${ENV_FILE}.tmp"
|
||||
|
||||
echo "$ENV_TEMP" | sed '/^$/d' | sort > $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<<EOF
|
||||
config <app> Display the config vars for an app
|
||||
config:get <app> KEY Display a config value for an app
|
||||
config:set <app> KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars
|
||||
config:unset <app> KEY1 [KEY2 ...] Unset one or more config vars
|
||||
config (<app>|--global) Display all global or app-specific config vars
|
||||
config:get (<app>|--global) KEY Display a global or app-specific config value
|
||||
config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...] Set one or more config vars
|
||||
config:unset (<app>|--global) KEY1 [KEY2 ...] Unset one or more config vars
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -141,10 +141,10 @@ case "$1" in
|
||||
# Display usage help
|
||||
help)
|
||||
cat && cat<<EOF
|
||||
docker-options <app> Display apps docker options for all phases
|
||||
docker-options <app> <phase(s)> Display apps docker options for phase (comma seperated phase list)
|
||||
docker-options:add <app> <phase(s)> OPTION Add docker option to app for phase (comma seperated phase list)
|
||||
docker-options:remove <app> <phase(s)> OPTION Remove docker option from app for phase (comma seperated phase list)
|
||||
docker-options <app> Display apps docker options for all phases
|
||||
docker-options <app> <phase(s)> Display apps docker options for phase (comma seperated phase list)
|
||||
docker-options:add <app> <phase(s)> OPTION Add docker option to app for phase (comma seperated phase list)
|
||||
docker-options:remove <app> <phase(s)> OPTION Remove docker option from app for phase (comma seperated phase list)
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -133,10 +133,10 @@ case "$1" in
|
||||
|
||||
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
|
||||
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
|
||||
;;
|
||||
|
||||
|
||||
@@ -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<<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
|
||||
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
|
||||
;;
|
||||
|
||||
|
||||
@@ -105,14 +105,14 @@ case "$1" in
|
||||
|
||||
help | ps:help)
|
||||
cat && cat<<EOF
|
||||
ps <app> List processes running in app container(s)
|
||||
ps:scale <app> <proc>=<count> [<proc>=<count>] Set how many processes of a given process to run
|
||||
ps:start <app> Start app container(s)
|
||||
ps:stop <app> Stop app container(s)
|
||||
ps:rebuild <app> Rebuild an app
|
||||
ps:rebuildall Rebuild all apps
|
||||
ps:restart <app> Restart app container(s)
|
||||
ps:restartall Restart all deployed app containers
|
||||
ps <app> List processes running in app container(s)
|
||||
ps:scale <app> <proc>=<count> [<proc>=<count>] Set how many processes of a given process to run
|
||||
ps:start <app> Start app container(s)
|
||||
ps:stop <app> Stop app container(s)
|
||||
ps:rebuild <app> Rebuild an app
|
||||
ps:rebuildall Rebuild all apps
|
||||
ps:restart <app> Restart app container(s)
|
||||
ps:restartall Restart all deployed app containers
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ case "$1" in
|
||||
|
||||
help | shell:help)
|
||||
cat && cat<<EOF
|
||||
shell Spawn dokku shell
|
||||
shell Spawn dokku shell
|
||||
EOF
|
||||
;;
|
||||
|
||||
|
||||
@@ -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
|
||||
# }
|
||||
@@ -3,13 +3,55 @@
|
||||
load test_helper
|
||||
|
||||
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"
|
||||
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" {
|
||||
|
||||
@@ -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)" {
|
||||
|
||||
Reference in New Issue
Block a user