Merge remote-tracking branch 'origin/master' into feature/retries

This commit is contained in:
Josh Cohen
2015-04-07 18:27:55 +00:00
51 changed files with 749 additions and 194 deletions

View File

@@ -1,5 +1,53 @@
# History
## 0.3.16
- #974: @michaelhobbs Don't use set to guard against pipefail
- #975: @michaelhobbs Simplify SSL hostname handling and avoid overwriting variables. refs #971
- #978: @michaelhobbs Add apparmor and cgroup-lite as pre-dependencies for dokku debian package
- #980: @josegonzalez [docs] Add documentation for pluginhooks
- #981: @josegonzalez Remove old files
- #982: @josegonzalez [docs] Add documentation for existing clients. Closes #977
- #983: @josegonzalez [docs] Update installation documentation
- #984: @josegonzalez [docs] Clarify installation instructions
- #988: @josegonzalez [docs] Add deprecated plugins section and where to get help
- #989: @josegonzalez [docs] Add more clients
- #986: @josegonzalez Switch to yabawock's static nginx buildpack for tests
- #987: @techniq Improve Dockerfile example/test
- #967: @alessio Really clean-up containers and images a-la-Docker
- #992: @josegonzalez [docs] Fix digital ocean docs. Closes #991
- #994: @alessio Fix quoting in container termination. Closes #249
- #996: @pmvieira [docs] Minor typo fix in the pluginhooks documentation
- #1003: @michaelhobbs Remove quoting around cleanup and disable lint for those lines
- #1001: @sekjun9878 [docs] Add sekjun9878/dokku-redis-plugin to plugins.md
- #1004: @michaelhobbs Remove quoting from dockerfile env. closes #1002
- #1018: @michaelhobbs Confine arg shifting to between dokku and command. closes #1017
- #1022: @Flink [docs] Add dokku-maintenance to plugins
- #1008: @lmars Support multiple domains using a wildcard TLS certificate
- #1013: @lmars Fix URL schemes in `dokku urls` output
- #1027: @nickstenning [docs] Add webhooks plugin to documentation
- #1026: @michaelhobbs Ensure we have newlines around our config. closes #1025
- #1010: @michaelhobbs Don't run create/destroy twice in tests
- #1028: @Flink [docs] Add rails-logs to plugins
- #1031: @michaelhobbs Upgrade docker in CI to 1.5.0
- #1029: @assaf Added several enhancements for CHECKS file:
- Specify how long to wait before running first check
- Specify timeout for each check
- Check specific hosts, e.g. http://signin.example.com
- Check both HTTP and HTTPS resources
- #1032: @cameron-martin Updated dokku-installer to use relative path
- #1035: @Flink [docs] Add dokku-http-auth to plugins
- #1040: @ebeigarts [docs] Add dokku-slack plugin information
- #1038: @michaelhobbs Default container check. closes #1020
- #1036: @michaelhobbs Create config set/unset without restart. closes #908
- #1009: @michaelhobbs Extract first port from Dockerfile and set config variable for use in deploy phase. closes #993
- #1042: @michaelhobbs Update to Support xip.io wildcard DNS as a VHOST
- #1043: @michaelhobbs Use upstart config from docker docs. closes #1015
- #1047: @michaelhobbs Show logs on deploy success and failure
- #1049: @ebeigarts [docs] Change Slack Notifications link
- #1051: @Flink [docs] Add dokku-airbrake-deploy to plugins
- #1057: @josegonzalez Updated deb packaging
## 0.3.15
- #950: @michaelhobbs Do not count blank lines in `make count`

View File

@@ -22,7 +22,7 @@ include deb.mk
all:
# Type "make install" to install.
install: dependencies stack copyfiles plugin-dependencies plugins version
install: dependencies copyfiles plugin-dependencies plugins version
release: deb-all package_cloud packer
@@ -61,7 +61,8 @@ plugin-dependencies: pluginhook
plugins: pluginhook docker
dokku plugins-install
dependencies: sshcommand pluginhook docker stack help2man
dependencies: sshcommand pluginhook docker help2man
$(MAKE) -e stack
help2man:
apt-get install -qq -y help2man
@@ -79,7 +80,7 @@ docker: aufs
apt-get install -qq -y curl
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
curl --silent https://get.docker.io/gpg | apt-key add -
curl --silent https://get.docker.com/gpg | apt-key add -
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-get update
ifdef DOCKER_VERSION

View File

@@ -10,7 +10,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
To install the latest stable release, you can run the following command as a user that has access to `sudo`:
wget -qO- https://raw.github.com/progrium/dokku/v0.3.15/bootstrap.sh | sudo DOKKU_TAG=v0.3.15 bash
wget -qO- https://raw.github.com/progrium/dokku/v0.3.16/bootstrap.sh | sudo DOKKU_TAG=v0.3.16 bash
### Upgrading

13
Vagrantfile vendored
View File

@@ -6,10 +6,11 @@ BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/trusty/curr
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
FORWARDED_PORT = (ENV["FORWARDED_PORT"] || '8080').to_i
PREBUILT_STACK_URL = File.exist?("#{File.dirname(__FILE__)}/stack.tgz") ? 'file:///root/dokku/stack.tgz' : nil
PUBLIC_KEY_PATH = "#{Dir.home}/.ssh/id_rsa.pub"
make_cmd = "make install"
make_cmd = "DEBIAN_FRONTEND=noninteractive make -e install"
if PREBUILT_STACK_URL
make_cmd = "PREBUILT_STACK_URL='#{PREBUILT_STACK_URL}' #{make_cmd}"
end
@@ -32,27 +33,27 @@ Vagrant::configure("2") do |config|
config.vm.define "empty", autostart: false
config.vm.define "dokku", primary: true do |vm|
vm.vm.network :forwarded_port, guest: 80, host: 8080
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
end
config.vm.define "dokku-deb", autostart: false do |vm|
vm.vm.network :forwarded_port, guest: 80, host: 8080
vm.vm.network :forwarded_port, guest: 80, host: ENV['FORWARDED_PORT']
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
end
config.vm.define "build", autostart: false do |vm|
vm.vm.provision :shell, :inline => "apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
end
if Pathname.new(PUBLIC_KEY_PATH).exist?
config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub'
config.vm.provision :shell, :inline => "rm /root/.ssh/authorized_keys && mv /tmp/id_rsa.pub /root/.ssh/authorized_keys"
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
end
end

View File

@@ -33,4 +33,5 @@ make install
echo
echo "Almost done! For next steps on configuration:"
echo " http://progrium.viewdocs.io/dokku/installation#user-content-configuring"
echo " http://progrium.viewdocs.io/dokku/advanced-installation#user-content-configuring"

View File

@@ -21,7 +21,7 @@ if ARGV[0] == "onboot"
exit
end
version = "v0.3.15"
version = "v0.3.16"
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip

View File

@@ -46,7 +46,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
appname=""
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
set +e
appname=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
set -e
else
echo "This is not a git repository"

View File

@@ -115,7 +115,7 @@ function setup_linode {
update-grub
cp /etc/rc.local /etc/rc.local-bak
cat << EOF > /etc/rc.local
cat << "EOF" > /etc/rc.local
#!/bin/sh -e
sudo apt-get update >> /root/setup_linode.txt 2>&1
sudo apt-get install -y linux-image-extra-"$(uname -r)" >> /root/setup_linode.txt 2>&1
@@ -137,7 +137,7 @@ function install_prerequisites {
sudo apt-get install -qq -y curl > /dev/null 2>&1
logit "Installing docker gpg key"
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
curl --silent https://get.docker.com/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
logit "Installing dokku gpg key"
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1

8
deb.mk
View File

@@ -29,8 +29,12 @@ GOPATH = /home/vagrant/gocode
.PHONY: install-from-deb deb-all deb-buildstep deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand
install-from-deb:
echo "--> Initial apt-get update"
sudo apt-get update > /dev/null
sudo apt-get install -y apt-transport-https
echo "--> Installing docker gpg key"
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
curl --silent https://get.docker.com/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
echo "--> Installing dokku gpg key"
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
@@ -43,7 +47,7 @@ install-from-deb:
sudo apt-get update > /dev/null
echo "--> Installing pre-requisites"
sudo apt-get install -y linux-image-extra-`uname -r` apt-transport-https
sudo apt-get install -y linux-image-extra-`uname -r`
echo "--> Installing dokku"
sudo apt-get install -y dokku

2
debian/postinst vendored
View File

@@ -13,6 +13,8 @@ case "$1" in
egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku
dokku plugins-install
rm -f /home/dokku/VERSION
cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION
if [ -f /etc/init/dokku-installer.conf ] && service dokku-installer status 2> /dev/null | grep waiting; then
sudo service dokku-installer start

View File

@@ -0,0 +1,36 @@
# Dokku test suite
Dokku now has a full test suite to assist in quick iterating development. These tests include a linter using [shellcheck](https://github.com/koalaman/shellcheck), functional unit tests using the [bats testing framework](https://github.com/sstephenson/bats), and a deployment suite of example apps that use the most popular languages and frameworks.
Bats tests can be found here:
```
tests/unit/*.bats
```
Example apps can be found here:
```
tests/apps/
```
### Executing tests locally
- Setup dokku in a [vagrant vm](http://progrium.viewdocs.io/dokku/getting-started/install/vagrant)
- Test setup and execution
```shell
$ vagrant ssh
$ sudo su -
$ cd ~/dokku
$ make ci-dependencies setup-deploy-tests
$ make test # run the entire test suite (linter, bats tests, and app deployment tests)
$
$ make lint # linter
$ make unit-tests # bats tests
$ make deploy-tests # app deployment tests
```
- Additionally you may run a specific app deployment tests with a target similar to:
```shell
make deploy-test-nodejs-express
```
- For a full list of test make targets check out `tests.mk` in the root of the dokku repository.

60
docs/docker-options.md Normal file
View File

@@ -0,0 +1,60 @@
docker-options
========================
Usage
-----
```bash
$ dokku help
...
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)
...
````
Add some options
```bash
$ dokku docker-options:add myapp deploy "-v /host/path:/container/path"
$ dokku docker-options:add myapp run "-v /another/container/path"
$ dokku docker-options:add myapp "-link container_name:alias"
```
Check what we added
```bash
$ dokku docker-options myapp
-link container_name:alias
-v /host/path:/container/path
-v /another/container/path
```
Remove an option
```bash
$ dokku docker-options:remove myapp "-link container_name:alias"
```
Advanced Usage (avoid if possible)
------------
In your applications folder (/home/dokku/app_name) create a file called DOCKER_OPTIONS.
Inside this file list one docker option per line. For example:
```bash
-link container_name:alias
-v /host/path:/container/path
-v /another/container/path
```
The above example will result in the following options being passed to docker during deploy and docker run:
```bash
-link container_name:alias -v /host/path:/container/path -v /another/container/path
```
You may also include comments (lines beginning with a #) and blank lines in the DOCKER_OPTIONS file.
Move information on docker options can be found here: http://docs.docker.io/en/latest/reference/run/ .

View File

@@ -21,7 +21,8 @@
# - `BOX_URI`
# - `BOX_MEMORY`
# - `DOKKU_DOMAIN`
# - `DOKKU_IP`.
# - `DOKKU_IP`
# - `FORWARDED_PORT`.
cd path/to/dokku
vagrant up
```

View File

@@ -17,6 +17,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen.
- [DNS Configuration](http://progrium.viewdocs.io/dokku/dns)
- [Nginx Configuration](http://progrium.viewdocs.io/dokku/nginx)
- [Running Remote commands](http://progrium.viewdocs.io/dokku/remote-commands)
- [Container Options](http://progrium.viewdocs.io/dokku/docker-options)
### Community Contributions
@@ -27,6 +28,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)
## Things this project won't do

View File

@@ -12,7 +12,7 @@ To install the latest stable version of dokku, you can run the following bootstr
```shell
# This may need to be run twice
wget -qO- https://raw.github.com/progrium/dokku/v0.3.15/bootstrap.sh | sudo DOKKU_TAG=v0.3.15 bash
wget -qO- https://raw.github.com/progrium/dokku/v0.3.16/bootstrap.sh | sudo DOKKU_TAG=v0.3.16 bash
# Install the web installer. See `Configuring` under
# `Advanced Install Customization` if you wish to perform the

View File

@@ -75,7 +75,7 @@ server {
}
```
The above is a sample, http configuration that adds an `X-Served-By` header to requests. The template is manually uploaded this template file and **must** it owned by `dokku:dokku`.
The above is a sample http configuration that adds an `X-Served-By` header to requests. The template file **must** be owned by the user `dokku:dokku`.
## Customizing hostnames

View File

@@ -93,6 +93,7 @@ Note: The following plugins have been supplied by our community and may not have
| [PostgreSQL](https://github.com/jlachowski/dokku-pg-plugin) | [jlachowski][] | IP & PORT available directly in linked app container env variables (requires link plugin)|
| [PostgreSQL (single container)](https://github.com/jeffutter/dokku-postgresql-plugin) | [jeffutter][] | This plugin creates a single postgresql container that all your apps can use. Thus only one instance of postgresql running (good for servers without a ton of memory). |
| [PostgreSQL (single container)](https://github.com/ohardy/dokku-psql) | [ohardy][] | Compatible with 0.2.0 |
| [PostgreSQL (single container)](https://github.com/Flink/dokku-psql-single-container) | [Flink][] | Single Postgresql container with official Postgresql docker image. Compatible with 0.3.16 |
| [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | |
#### Caching
@@ -148,7 +149,6 @@ Note: The following plugins have been supplied by our community and may not have
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
| [app-url](https://github.com/mikecsh/dokku-app-url) | [mikecsh][] | Works with 0.2.0 |
| [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | |
| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | dokku >= [c77cbf1][] |
| [Dokku Name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | dokku >= [c77cbf1][] |
| [Dokku Registry](https://github.com/agco-adm/dokku-registry)<sup>1</sup> | [agco-adm][] | |
| [git rev-parse HEAD in env](https://github.com/nornagon/dokku-git-rev) | [nornagon][] | Compatible with 0.2.0 |
@@ -206,15 +206,16 @@ Note: The following plugins have been supplied by our community and may not have
The following plugins have been removed as their functionality is now in Dokku Core.
| Plugin | Author | In Dokku Since |
| ------------------------------------------------------------------------------------------------- | --------------------- | ------------------------- |
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | v0.3.10 (domains plugin) |
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | v0.3.9 (trace command) |
| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>1</sup> | [wmluke][] | v0.3.10 (domains 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) |
| [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/motin/dokku-user-env-compile)<sup>2</sup> | [motin][] | v0.3.9 (build-env plugin) |
| Plugin | Author | In Dokku Since |
| ------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------- |
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | v0.3.10 (domains plugin) |
| [Debug](https://github.com/heichblatt/dokku-debug) | [heichblatt][] | v0.3.9 (trace command) |
| [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | v0.3.17 (docker-options plugin) |
| [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>1</sup> | [wmluke][] | v0.3.10 (domains 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) |
| [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/motin/dokku-user-env-compile)<sup>2</sup> | [motin][] | v0.3.9 (build-env plugin) |
<sup>1</sup> Conflicts with [VHOSTS Custom Configuration](https://github.com/neam/dokku-nginx-vhosts-custom-configuration)
<sup>2</sup> Similar to the heroku-labs feature (see https://devcenter.heroku.com/articles/labs-user-env-compile)

6
dokku
View File

@@ -177,17 +177,17 @@ EOF
implemented=0
for script in $PLUGIN_PATH/*/commands; do
set +e; $script "$@" ; exit_code=$? ; set -e
if [ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]; then
if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then
continue
fi
implemented=1
if [ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]; then
if [[ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]]; then
exit $exit_code
fi
done
if [ "$implemented" -eq 0 ]; then
if [[ "$implemented" -eq 0 ]]; then
dokku_log_warn "\`$*\` is not a dokku command."
dokku_log_warn "See \`dokku help\` for a list of available commands."
exit 1

View File

@@ -35,7 +35,7 @@ case "$1" in
dockerfile)
# extract first port from Dockerfile
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }')
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true)
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
# sticking with same pattern of building app image before pre-build for now.

View File

@@ -10,6 +10,7 @@ APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
! (grep -q CURL_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_TIMEOUT=30" >> "$DOKKU_ROOT/ENV"
if [[ -f "$DOKKU_ROOT/ENV" ]]; then
BUILD_ENV+=$'\n'
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
BUILD_ENV+=$'\n'
fi

153
plugins/docker-options/commands Executable file
View File

@@ -0,0 +1,153 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
PHASES=(build deploy run)
FILE_PREFIX="DOCKER_OPTIONS_"
get_app() {
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$1"
APP="$1"
}
get_phases() {
local passed_phases_list=$1
local phase
if [[ -n $passed_phases_list ]]; then
IFS=',' read -ra passed_phases <<< "$passed_phases_list"
for phase in "${passed_phases[@]}"; do
verify_phase $phase
done
fi
}
verify_phase() {
local phase
for phase in "${PHASES[@]}"; do
if [[ "$phase" = "$1" ]]; then
return 0
fi
done
dokku_log_fail "Phase(s) must be one of [${PHASES[@]}]"
}
get_phase_file_path() {
local phase=$1
phase_file_path="${DOKKU_ROOT}/${APP}/${FILE_PREFIX}${phase^^}"
}
create_phase_file_if_required() {
local phase_file_path=$1
[[ -f $phase_file_path ]] || {
touch $phase_file_path
}
}
display_phase_options() {
local phase=$1
local phase_file_path=$2
echo "${phase^} options:"
sed -e 's/^/ /' $phase_file_path
}
display_all_phases_options() {
for phase in "${PHASES[@]}"; do
get_phase_file_path $phase
if [[ -s $phase_file_path ]] ; then
display_phase_options $phase $phase_file_path
fi
done
}
display_passed_phases_options() {
local passed_phases=("${!1}")
local phase
for phase in "${passed_phases[@]}"; do
get_phase_file_path $phase
if [ ! -s $phase_file_path ] ; then
echo "${phase^} options: none"
else
display_phase_options $phase $phase_file_path
fi
done
}
get_passed_docker_option() {
[[ -z "$@" ]] && dokku_log_fail "Please specify docker options to add to the phase"
passed_docker_option=("$@")
}
add_passed_docker_option() {
local passed_phases=("${!1}")
local passed_option_string=$2
local phase
for phase in "${passed_phases[@]}"; do
get_phase_file_path $phase
create_phase_file_if_required $phase_file_path
echo "${passed_option_string}" >> $phase_file_path
all_phase_options=$(< $phase_file_path)
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u > $phase_file_path
done
}
remove_passed_docker_option() {
local passed_phases=("${!1}")
local passed_option_string=$2
local phase
for phase in "${passed_phases[@]}"; do
get_phase_file_path $phase
[[ ! -s $phase_file_path ]] || {
all_phase_options=$(< $phase_file_path)
all_phase_options=$(echo -e "${all_phase_options}" | sed "s#^${passed_option_string}\$##")
echo -e "${all_phase_options}" | sed '/^$/d' | sort -u > $phase_file_path
}
done
}
case "$1" in
# Display applications docker options
docker-options)
get_app $2
get_phases $3
if [[ ! "${passed_phases[@]}" ]]; then
display_all_phases_options
else
display_passed_phases_options passed_phases[@]
fi
;;
# Add a docker option to application
docker-options:add)
get_app $2
get_phases $3
shift 3 # everything else passed is the docker option
get_passed_docker_option "$@"
add_passed_docker_option passed_phases[@] "${passed_docker_option[@]}"
;;
# Remove a docker option from application
docker-options:remove)
get_app $2
get_phases $3
shift 3 # everything else passed is the docker option
get_passed_docker_option "$@"
remove_passed_docker_option passed_phases[@] "${passed_docker_option[@]}"
;;
# 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)
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac

View File

@@ -0,0 +1 @@
docker-args-deploy

View File

@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
STDIN=$(cat)
APP="$1"
case "$0" in
*docker-args-build)
PHASE=BUILD
;;
*docker-args-deploy)
PHASE=DEPLOY
;;
*docker-args-run)
PHASE=RUN
;;
esac
FILE_PREFIX="DOCKER_OPTIONS_"
PHASE_FILE_PATH="${DOKKU_ROOT}/${APP}/${FILE_PREFIX}${PHASE}"
output=""
if [[ -f "$PHASE_FILE_PATH" ]]; then
DONE=false
until $DONE; do
read line || DONE=true
[[ ! -n "$line" ]] && continue
# shellcheck disable=SC1001
case "$line" in
\#*)
continue
;;
*)
output="$output $line"
;;
esac
done < $PHASE_FILE_PATH
fi
echo "$STDIN$output"

View File

@@ -0,0 +1 @@
docker-args-deploy

View File

@@ -66,7 +66,7 @@ EOF
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0)
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf"
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
while read line; do
dokku_log_info1 "Configuring SSL for $line..."
SSL_SERVER_NAME=$line
@@ -82,7 +82,7 @@ EOF
eval "cat <<< \"$(< $APP_NGINX_TEMPLATE)\" > $NGINX_CONF"
elif [[ -n "$NONSSL_VHOSTS" ]]; then
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf"
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template"
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
fi

View File

@@ -75,6 +75,10 @@ deploy-test-dockerfile:
@echo deploying dockerfile app...
cd tests && ./test_deploy ./apps/dockerfile dokku.me
deploy-test-dockerfile-noexpose:
@echo deploying dockerfile-noexpose app...
cd tests && ./test_deploy ./apps/dockerfile-noexpose dokku.me
deploy-test-gitsubmodules:
@echo deploying gitsubmodules app...
cd tests && ./test_deploy ./apps/gitsubmodules dokku.me
@@ -125,6 +129,7 @@ deploy-tests:
@$(QUIET) $(MAKE) deploy-test-config
@$(QUIET) $(MAKE) deploy-test-clojure
@$(QUIET) $(MAKE) deploy-test-dockerfile
@$(QUIET) $(MAKE) deploy-test-dockerfile-noexpose
@$(QUIET) $(MAKE) deploy-test-gitsubmodules
@$(QUIET) $(MAKE) deploy-test-go
@$(QUIET) $(MAKE) deploy-test-java

View File

@@ -5,7 +5,7 @@
"express": "2.5.x"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
"node": "0.10.x",
"npm": "2.7.x"
}
}
}

View File

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

View File

@@ -0,0 +1,13 @@
FROM ubuntu:trusty
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update
RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git
COPY . /app
WORKDIR /app
RUN npm install
CMD npm start

View File

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

View File

@@ -0,0 +1,13 @@
var express = require('express')
var app = express();
app.set('port', (process.env.PORT || 5000))
app.use(express.static(__dirname + '/public'))
app.get('/', function(request, response) {
response.send('Hello World!')
})
app.listen(app.get('port'), function() {
console.log("Node app is running at localhost:" + app.get('port'))
})

View File

@@ -0,0 +1,29 @@
{
"name": "node-js-sample",
"version": "0.1.0",
"description": "A sample Node.js app using Express 4",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "^4.0.0"
},
"engines": {
"node": "0.10.x"
},
"repository": {
"type": "git",
"url": "https://github.com/heroku/node-js-sample"
},
"keywords": [
"node",
"heroku",
"express"
],
"author": "Mark Pundsack",
"contributors": [
"Zeke Sikelianos <zeke@sikelianos.com> (http://zeke.sikelianos.com)"
],
"license": "MIT"
}

View File

@@ -6,6 +6,6 @@
},
"engines": {
"node": "0.10.x",
"npm": "1.3.x"
"npm": "2.7.x"
}
}
}

View File

@@ -5,8 +5,8 @@
"express": "2.5.x"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
"node": "0.10.x",
"npm": "2.7.x"
},
"scripts": {
"start": "node web.js"

View File

@@ -5,7 +5,7 @@
"express": "2.5.x"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
"node": "0.10.x",
"npm": "2.7.x"
}
}
}

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

@@ -0,0 +1 @@
export BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby#v129

36
tests/unit/apps.bats Executable file → Normal file
View File

@@ -2,24 +2,26 @@
load test_helper
APP=lifecycle-app
@test "(apps) apps" {
create_app
run bash -c "dokku apps | grep $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_output $TEST_APP
destroy_app
}
@test "apps:create" {
run dokku apps:create $APP
echo "output: "$output
echo "status: "$status
assert_success
}
@test "apps" {
run bash -c "dokku apps | grep $APP"
echo "output: "$output
echo "status: "$status
assert_output $APP
}
@test "apps:destroy" {
run bash -c "dokku --force apps:destroy $APP"
@test "(apps) apps:create" {
run dokku apps:create $TEST_APP
echo "output: "$output
echo "status: "$status
assert_success
destroy_app
}
@test "(apps) apps:destroy" {
create_app
run bash -c "dokku --force apps:destroy $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success

View File

@@ -12,7 +12,7 @@
# destroy_app
# }
# @test "backup:export" {
# @test "(backup) backup:export" {
# run dokku backup:export $backup_file
# echo "output: "$output
# echo "status: "$status

View File

@@ -10,7 +10,7 @@ teardown() {
destroy_app
}
@test "build-env with special chars" {
@test "(build-env) special characters" {
run dokku config:set $TEST_APP NEWRELIC_APP_NAME="$TEST_APP (Staging)"
echo "output: "$output
echo "status: "$status

View File

@@ -1,36 +0,0 @@
#!/usr/bin/env bats
load test_helper
setup() {
deploy_app
}
teardown() {
destroy_app
}
@test "remove exited containers" {
# make sure we have many exited containers of the same 'type'
run bash -c "for cnt in 1 2 3; do dokku run $TEST_APP hostname; done"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -a -f 'status=exited' --no-trunc=false | grep '/exec hostname'"
echo "output: "$output
echo "status: "$status
assert_success
run dokku cleanup
echo "output: "$output
echo "status: "$status
assert_success
sleep 5 # wait for dokku cleanup to happen in the background
run bash -c "docker ps -a -f 'status=exited' --no-trunc=false | grep '/exec hostname'"
echo "output: "$output
echo "status: "$status
assert_failure
run bash -c "docker ps -a -f 'status=exited' -q --no-trunc=false"
echo "output: "$output
echo "status: "$status
assert_output ""
}

View File

@@ -12,7 +12,7 @@ teardown() {
unset DOKKU_HOST
}
@test "dokku client (unconfigured DOKKU_HOST)" {
@test "(client) unconfigured DOKKU_HOST" {
unset DOKKU_HOST
run ./contrib/dokku_client.sh apps
echo "output: "$output
@@ -20,14 +20,14 @@ teardown() {
assert_exit_status 20
}
@test "dokku client (no args should print help)" {
@test "(client) no args should print help" {
run /bin/bash -c "./contrib/dokku_client.sh | head -1 | egrep -q '^Usage: dokku \[.+\] COMMAND <app>.*'"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "dokku client (apps:create AND apps:destroy)" {
@test "(client) apps:create AND apps:destroy" {
setup_client_repo
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create"
echo "output: "$output
@@ -39,7 +39,7 @@ teardown() {
assert_success
}
@test "dokku client (config:set)" {
@test "(client) config:set" {
run ./contrib/dokku_client.sh config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
@@ -50,7 +50,7 @@ teardown() {
assert_success
}
@test "dokku client (config:unset)" {
@test "(client) config:unset" {
run ./contrib/dokku_client.sh config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
@@ -69,14 +69,14 @@ teardown() {
assert_failure
}
@test "dokku client (domains)" {
@test "(client) domains" {
run bash -c "./contrib/dokku_client.sh domains $TEST_APP | grep -q ${TEST_APP}.dokku.me"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "dokku client (domains:add)" {
@test "(client) domains:add" {
run ./contrib/dokku_client.sh domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output
echo "status: "$status
@@ -87,7 +87,7 @@ teardown() {
assert_success
}
@test "dokku client (domains:remove)" {
@test "(client) domains:remove" {
run ./contrib/dokku_client.sh domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
@@ -98,7 +98,7 @@ teardown() {
refute_line "test.app.dokku.me"
}
@test "dokku client (domains:clear)" {
@test "(client) domains:clear" {
run ./contrib/dokku_client.sh domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
@@ -109,7 +109,7 @@ teardown() {
assert_success
}
# @test "dokku client (ps)" {
# @test "(client) ps" {
# # CI support: 'Ah. I just spoke with our Docker expert --
# # looks like docker exec is built to work with docker-under-libcontainer,
# # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
@@ -121,7 +121,7 @@ teardown() {
# assert_success
# }
@test "dokku client (ps:start)" {
@test "(client) ps:start" {
deploy_app
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:stop $TEST_APP"
echo "output: "$output
@@ -137,7 +137,7 @@ teardown() {
assert_success
}
@test "dokku client (ps:stop)" {
@test "(client) ps:stop" {
deploy_app
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:stop $TEST_APP"
echo "output: "$output
@@ -149,7 +149,7 @@ teardown() {
assert_failure
}
@test "dokku client (ps:restart)" {
@test "(client) ps:restart" {
deploy_app
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:restart $TEST_APP"
echo "output: "$output

View File

@@ -12,14 +12,14 @@ teardown() {
rm -f "$DOKKU_ROOT/ENV"
}
@test "config:set" {
@test "(config) config:set" {
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "config:get" {
@test "(config) config:get" {
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
@@ -30,7 +30,7 @@ teardown() {
assert_output 'hello world'
}
@test "config:unset" {
@test "(config) config:unset" {
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output
echo "status: "$status
@@ -49,7 +49,7 @@ teardown() {
assert_output ""
}
@test "global config (buildstep)" {
@test "(config) global config (buildstep)" {
deploy_app
run bash -c "dokku run $TEST_APP env | egrep '^global_test=true'"
echo "output: "$output
@@ -57,7 +57,7 @@ teardown() {
assert_success
}
@test "global config (dockerfile)" {
@test "(config) global config (dockerfile)" {
deploy_app dockerfile
run bash -c "dokku run $TEST_APP env | egrep '^global_test=true'"
echo "output: "$output

View File

@@ -26,7 +26,33 @@ build_nginx_config() {
dokku nginx:build-config $TEST_APP
}
@test "run (with tty)" {
@test "(core) remove exited containers" {
deploy_app
# make sure we have many exited containers of the same 'type'
run bash -c "for cnt in 1 2 3; do dokku run $TEST_APP hostname; done"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -a -f 'status=exited' --no-trunc=false | grep '/exec hostname'"
echo "output: "$output
echo "status: "$status
assert_success
run dokku cleanup
echo "output: "$output
echo "status: "$status
assert_success
sleep 5 # wait for dokku cleanup to happen in the background
run bash -c "docker ps -a -f 'status=exited' --no-trunc=false | grep '/exec hostname'"
echo "output: "$output
echo "status: "$status
assert_failure
run bash -c "docker ps -a -f 'status=exited' -q --no-trunc=false"
echo "output: "$output
echo "status: "$status
assert_output ""
}
@test "(core) run (with tty)" {
deploy_app
run /bin/bash -c "dokku run $TEST_APP ls /app/package.json"
echo "output: "$output
@@ -34,7 +60,7 @@ build_nginx_config() {
assert_success
}
@test "run (without tty)" {
@test "(core) run (without tty)" {
deploy_app
run /bin/bash -c ": |dokku run $TEST_APP ls /app/package.json"
echo "output: "$output
@@ -42,7 +68,7 @@ build_nginx_config() {
assert_success
}
@test "run (with --options)" {
@test "(core) run (with --options)" {
deploy_app
run /bin/bash -c "dokku --force --quiet run $TEST_APP node --version"
echo "output: "$output
@@ -50,7 +76,18 @@ build_nginx_config() {
assert_success
}
@test "urls (non-ssl)" {
@test "(core) unknown command" {
run /bin/bash -c "dokku fakecommand"
echo "output: "$output
echo "status: "$status
assert_failure
run /bin/bash -c "dokku fakecommand | grep -q 'is not a dokku command'"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "(core) urls (non-ssl)" {
assert_urls "http://dokku.me"
build_nginx_config
assert_urls "http://${TEST_APP}.dokku.me"
@@ -58,7 +95,7 @@ build_nginx_config() {
assert_urls "http://${TEST_APP}.dokku.me" "http://test.dokku.me"
}
@test "urls (app ssl)" {
@test "(core) urls (app ssl)" {
setup_test_tls
assert_urls "https://dokku.me"
build_nginx_config
@@ -67,7 +104,7 @@ build_nginx_config() {
assert_urls "https://node-js-app.dokku.me" "http://${TEST_APP}.dokku.me" "http://test.dokku.me"
}
@test "urls (wildcard ssl)" {
@test "(core) urls (wildcard ssl)" {
setup_test_tls_wildcard
assert_urls "https://dokku.me"
build_nginx_config
@@ -77,3 +114,4 @@ build_nginx_config() {
add_domain "dokku.example.com"
assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://dokku.example.com"
}

View File

@@ -13,7 +13,7 @@ teardown() {
[[ -f "$DOKKU_ROOT/HOSTNAME.bak" ]] && mv "$DOKKU_ROOT/HOSTNAME.bak" "$DOKKU_ROOT/HOSTNAME"
}
@test "port exposure (with global VHOST)" {
@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 }')
@@ -23,7 +23,7 @@ teardown() {
assert_failure
}
@test "port exposure (without global VHOST and real HOSTNAME)" {
@test "(core) port exposure (without global VHOST and real HOSTNAME)" {
rm "$DOKKU_ROOT/VHOST"
echo "dokku.me" > "$DOKKU_ROOT/HOSTNAME"
deploy_app
@@ -34,7 +34,7 @@ teardown() {
assert_success
}
@test "port exposure (with NO_VHOST set)" {
@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 }')
@@ -44,7 +44,7 @@ teardown() {
assert_success
}
@test "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"
echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME"
deploy_app
@@ -55,7 +55,7 @@ teardown() {
assert_success
}
@test "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"
echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" > "$DOKKU_ROOT/HOSTNAME"
deploy_app
@@ -66,7 +66,7 @@ teardown() {
assert_success
}
@test "port exposure (pre-deploy domains:add)" {
@test "(core) port exposure (pre-deploy domains:add)" {
create_app
run dokku domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output
@@ -88,7 +88,7 @@ teardown() {
assert_success
}
@test "port exposure (no global VHOST and domains:add post deploy)" {
@test "(core) port exposure (no global VHOST and domains:add post deploy)" {
rm "$DOKKU_ROOT/VHOST"
deploy_app
@@ -109,7 +109,7 @@ teardown() {
assert_success
}
@test "dockerfile port exposure" {
@test "(core) dockerfile port exposure" {
deploy_app dockerfile
run bash -c "grep upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000"
echo "output: "$output
@@ -117,7 +117,7 @@ teardown() {
assert_success
}
@test "port exposure (xip.io style hostnames)" {
@test "(core) port exposure (xip.io style hostnames)" {
echo "127.0.0.1.xip.io" > "$DOKKU_ROOT/VHOST"
deploy_app

View File

@@ -0,0 +1,151 @@
#!/usr/bin/env bats
load test_helper
setup() {
create_app
}
teardown() {
destroy_app
}
@test "docker-options:add (all phases)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP build,deploy,run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP | egrep '\-v /tmp' | wc -l | grep -q 3"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "docker-options:add (build phase)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP build \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP build | egrep '\-v /tmp' | wc -l | grep -q 1"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "docker-options:add (deploy phase)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP deploy \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP deploy | egrep '\-v /tmp' | wc -l | grep -q 1"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "docker-options:add (run phase)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP run | egrep '\-v /tmp' | wc -l | grep -q 1"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "docker-options:remove (all phases)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP build,deploy,run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP | egrep '\-v /tmp' | wc -l | grep -q 3"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options:remove $TEST_APP build,deploy,run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP | wc -l | grep -q 0"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "docker-options:remove (build phase)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP build,deploy,run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP | egrep '\-v /tmp' | wc -l | grep -q 3"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options:remove $TEST_APP build \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP build"
echo "output: "$output
echo "status: "$status
assert_output "Build options: none"
}
@test "docker-options:remove (deploy phase)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP build,deploy,run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP deploy | egrep '\-v /tmp' | wc -l | grep -q 1"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options:remove $TEST_APP deploy \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP deploy"
echo "output: "$output
echo "status: "$status
assert_output "Deploy options: none"
}
@test "docker-options:remove (run phase)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP build,deploy,run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP run | egrep '\-v /tmp' | wc -l | grep -q 1"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options:remove $TEST_APP run \"-v /tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP run"
echo "output: "$output
echo "status: "$status
assert_output "Run options: none"
}
@test "docker-options (deploy with options)" {
run /bin/bash -c "dokku docker-options:add $TEST_APP deploy \"-v /var/tmp\""
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "echo '-v /tmp' >> $DOKKU_ROOT/$TEST_APP/DOCKER_OPTIONS_DEPLOY"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "echo '# comment' >> $DOKKU_ROOT/$TEST_APP/DOCKER_OPTIONS_DEPLOY"
echo "output: "$output
echo "status: "$status
assert_success
run /bin/bash -c "dokku docker-options $TEST_APP deploy | egrep '\-v /tmp' | wc -l | grep -q 1"
echo "output: "$output
echo "status: "$status
assert_success
deploy_app
}

View File

@@ -10,14 +10,14 @@ teardown() {
destroy_app
}
@test "domains" {
@test "(domains) domains" {
run bash -c "dokku domains $TEST_APP | grep ${TEST_APP}.dokku.me"
echo "output: "$output
echo "status: "$status
assert_output "${TEST_APP}.dokku.me"
}
@test "domains:add" {
@test "(domains) domains:add" {
run dokku domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output
echo "status: "$status
@@ -28,7 +28,7 @@ teardown() {
assert_success
}
@test "domains:remove" {
@test "(domains) domains:remove" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status
@@ -39,7 +39,7 @@ teardown() {
refute_line "test.app.dokku.me"
}
@test "domains:clear" {
@test "(domains) domains:clear" {
run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output
echo "status: "$status

View File

@@ -53,7 +53,7 @@ assert_http_success() {
assert_output "200"
}
@test "nginx (no server tokens)" {
@test "(nginx-vhosts) nginx (no server tokens)" {
deploy_app
run /bin/bash -c "curl -s -D - $(dokku url $TEST_APP) -o /dev/null | egrep '^Server' | egrep '[0-9]+'"
echo "output: "$output
@@ -61,7 +61,7 @@ assert_http_success() {
assert_failure
}
@test "nginx:build-config (wildcard SSL)" {
@test "(nginx-vhosts) nginx:build-config (wildcard SSL)" {
setup_test_tls_wildcard
add_domain "wildcard1.dokku.me"
add_domain "wildcard2.dokku.me"
@@ -72,13 +72,13 @@ assert_http_success() {
assert_nonssl_domain "www.test.dokku.me"
}
@test "nginx:build-config (with SSL CN mismatch)" {
@test "(nginx-vhosts) nginx:build-config (with SSL CN mismatch)" {
setup_test_tls
deploy_app
assert_ssl_domain "node-js-app.dokku.me"
}
@test "nginx:build-config (with SSL and Multiple SANs)" {
@test "(nginx-vhosts) nginx:build-config (with SSL and Multiple SANs)" {
setup_test_tls_with_sans
deploy_app
assert_ssl_domain "test.dokku.me"
@@ -86,7 +86,7 @@ assert_http_success() {
assert_ssl_domain "www.test.app.dokku.me"
}
@test "nginx:build-config (no global VHOST and domains:add)" {
@test "(nginx-vhosts) nginx:build-config (no global VHOST and domains:add)" {
destroy_app
rm "$DOKKU_ROOT/VHOST"
create_app

View File

@@ -10,7 +10,7 @@ teardown() {
destroy_app
}
# @test "ps (buildstep)" {
# @test "(ps) buildstep" {
# # CI support: 'Ah. I just spoke with our Docker expert --
# # looks like docker exec is built to work with docker-under-libcontainer,
# # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
@@ -21,22 +21,7 @@ teardown() {
# assert_success
# }
@test "ps:start (buildstep)" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku ps:start $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "ps:stop (buildstep)" {
@test "(ps) buildstep" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
@@ -45,9 +30,16 @@ teardown() {
echo "output: "$output
echo "status: "$status
assert_failure
}
@test "ps:restart (buildstep)" {
run bash -c "dokku ps:start $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku ps:restart $TEST_APP"
echo "output: "$output
echo "status: "$status
@@ -56,9 +48,7 @@ teardown() {
echo "output: "$output
echo "status: "$status
assert_success
}
@test "ps:rebuild (buildstep)" {
run bash -c "dokku ps:rebuild $TEST_APP"
echo "output: "$output
echo "status: "$status

View File

@@ -10,33 +10,18 @@ teardown() {
destroy_app
}
@test "ps (dockerfile)" {
# CI support: 'Ah. I just spoke with our Docker expert --
# looks like docker exec is built to work with docker-under-libcontainer,
# but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
skip "circleci does not support docker exec at the moment."
run bash -c "dokku ps $TEST_APP | grep -q \"node web.js\""
echo "output: "$output
echo "status: "$status
assert_success
}
# @test "(ps) dockerfile" {
# # CI support: 'Ah. I just spoke with our Docker expert --
# # looks like docker exec is built to work with docker-under-libcontainer,
# # but we're using docker-under-lxc. I don't have an estimated time for the fix, sorry
# skip "circleci does not support docker exec at the moment."
# run bash -c "dokku ps $TEST_APP | grep -q \"node web.js\""
# echo "output: "$output
# echo "status: "$status
# assert_success
# }
@test "ps:start (dockerfile)" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku ps:start $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_success
}
@test "ps:stop (dockerfile)" {
@test "(ps) dockerfile" {
run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output
echo "status: "$status
@@ -45,9 +30,16 @@ teardown() {
echo "output: "$output
echo "status: "$status
assert_failure
}
@test "ps:restart (dockerfile)" {
run bash -c "dokku ps:start $TEST_APP"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "docker ps -q --no-trunc | grep -q $(< $DOKKU_ROOT/$TEST_APP/CONTAINER)"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku ps:restart $TEST_APP"
echo "output: "$output
echo "status: "$status
@@ -56,9 +48,7 @@ teardown() {
echo "output: "$output
echo "status: "$status
assert_success
}
@test "ps:rebuild (dockerfile)" {
run bash -c "dokku ps:rebuild $TEST_APP"
echo "output: "$output
echo "status: "$status