Compare commits

...

53 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
aee2d9ca64 Release 0.3.17 2015-04-14 12:38:44 -04:00
Jose Diaz-Gonzalez
1a151ddabe Merge pull request #1056 from joshco/feature/retries
Review: Feature/retries
2015-04-13 17:18:00 -04:00
Josh Cohen
b5eef489fd linting fixes 2015-04-13 20:22:14 +00:00
Jose Diaz-Gonzalez
580bab491f Merge pull request #1107 from Benjamin-Dobell/master
Added Dokku Graduate to the list of known plugins
2015-04-11 17:24:08 -04:00
Benjamin Dobell
41db33696f Added Dokku Graduate to the list of known plugins 2015-04-12 03:35:36 +10:00
Josh Cohen
33eca97c87 Merge branch 'feature/retries' of github.com:joshco/dokku into feature/retries 2015-04-11 01:11:11 +00:00
Josh Cohen
cc565661e3 fix linting issues
rename UNCHECKED -> FAILEDCHECKS
2015-04-11 01:10:14 +00:00
Michael Hobbs
6225a4113c Merge pull request #1102 from kblcuk/master
Sourcing app-specific ENV during check-deploy
2015-04-09 09:10:18 -07:00
Alexei Mikhailov
b388c2ce1e Sourcing app-specific ENV during check-deploy, which gone missing in 052e3e88c8. 2015-04-09 18:54:08 +03:00
Jose Diaz-Gonzalez
d16a5aede6 Merge pull request #1097 from progrium/1041_mh-use-config-set-no-restart
use config:set-norestart in domains plugin. config:get for dockerfile port. closes #1041
2015-04-08 18:06:32 -04:00
Michael Hobbs
62774b156d use config:set-norestart in domains plugin. config:get for dockerfile port. closes #1041 2015-04-07 20:49:34 -07:00
Jose Diaz-Gonzalez
59b9e5335b Merge pull request #1075 from Flink/dokku-client-ssh-tty
TTY and Compression for SSH
2015-04-07 18:34:54 -04:00
Loïc Guitaut
d701c99c72 TTY option for SSH
When using commands requiring a TTY (such as Rails console), this
script won’t work.
So enabling a TTY resolves the issue.
2015-04-08 00:29:00 +02:00
Josh Cohen
132c0b1c81 Merge remote-tracking branch 'origin/master' into feature/retries 2015-04-07 18:27:55 +00:00
Josh Cohen
4e6a980bc6 update documentation for ATTEMPTS change 2015-04-07 11:02:34 -04:00
Josh Cohen
95334ed3fe Merge branch 'feature/retries' of github.com:joshco/dokku into feature/retries 2015-04-07 14:54:56 +00:00
Josh Cohen
61270967c1 Change "RETRIES" to (MAX) "ATTEMPTS" as this better reflects behavior.
ATTEMPTS=0 means don't run the checks.  Useful if you want to skip the checks and can be overridden by DOKKU_CHECKS_ATTEMPTS
ATTEMPTS=1 means run only once
2015-04-07 14:51:49 +00:00
Jose Diaz-Gonzalez
705c04504c Merge pull request #1088 from progrium/1083_mh-dockerfile-noexpose
support dockerfiles without expose command. closes #1083
2015-04-03 15:56:58 -04:00
Jose Diaz-Gonzalez
2aeb298663 Merge pull request #1065 from progrium/mh-dev-env-bugs
minor dev env cleanup
2015-04-03 15:18:59 -04:00
Jose Diaz-Gonzalez
7df1642e4a Merge pull request #1060 from progrium/nginx-conf-template
Add .template suffix to nginx configuration templates. Refs #1054
2015-04-03 15:18:29 -04:00
Jose Diaz-Gonzalez
29023927f5 Merge pull request #1081 from progrium/1063_mh-test-env-sans-newline
force testing .env with no newline and actually fix #1025 and #1026. closes #1063
2015-04-03 15:18:17 -04:00
Jose Diaz-Gonzalez
6ac59dcdfc Merge pull request #1084 from awendt/avoid-port-collisions
Make port forwarding configurable
2015-04-03 15:18:00 -04:00
Michael Hobbs
c2053d5322 support dockerfiles without expose command. closes #1083 2015-04-03 12:13:39 -07:00
Michael Hobbs
5c938fee8a Merge pull request #1087 from progrium/mh-docker-options-ni-exit
make docker-options adhere to DOKKU_NOT_IMPLEMENTED_EXIT pattern
2015-04-03 11:32:24 -07:00
Michael Hobbs
ba33c161f5 make docker-options adhere to DOKKU_NOT_IMPLEMENTED_EXIT pattern 2015-04-03 10:51:23 -07:00
Jose Diaz-Gonzalez
6374178046 Merge pull request #1082 from progrium/mh-test-updates
test cleanup with slight performance boost
2015-04-02 11:23:02 -04:00
André Wendt
295c897b7e Make port forwarding configurable 2015-04-02 09:27:10 +02:00
Jose Diaz-Gonzalez
814c2a39c5 Merge pull request #1080 from progrium/1062_mh-docker-options
initial pass at including docker-options plugin. closes #1062
2015-04-02 00:57:07 -04:00
Michael Hobbs
7e7eb1dc87 docs update 2015-04-01 17:50:40 -07:00
Michael Hobbs
4e472c39e3 uniform unit test labels 2015-04-01 17:44:34 -07:00
Michael Hobbs
6d0b4ef4ec test cleanup with slight performance boost 2015-04-01 17:30:09 -07:00
Michael Hobbs
1bad26426e force testing .env with no newline and actually fix #1025 and #1026. closes #1063 2015-04-01 13:49:55 -07:00
Michael Hobbs
df8f4fb882 initial pass at including docker-options plugin. closes #1062 2015-04-01 12:57:06 -07:00
Jose Diaz-Gonzalez
89af9cf5db Merge pull request #1079 from rorykoehler/correcting-post-install-link
corrected configuration link in bootstrap.sh
2015-04-01 11:45:00 -04:00
Rory
0f4ee909d5 corrected configuration link in bootstrap.sh 2015-04-01 13:44:49 +02:00
Jose Diaz-Gonzalez
48132aa658 Merge pull request #1077 from Flink/dokku-psql-single-container-plugin
Add dokku-psql-single-container to plugins
2015-03-30 17:31:02 -04:00
Loïc Guitaut
af924efe17 Add dokku-psql-single-container to plugins 2015-03-30 23:24:34 +02:00
Jose Diaz-Gonzalez
79366216cc Merge pull request #1074 from Flink/dokku-client-better-remote-detection
Better detection of dokku remote
2015-03-30 10:54:25 -04:00
Loïc Guitaut
61136e2591 Better detection of dokku remote
Previously this script was matching for a remote named 'dokku' even
when DOKKU_HOST is provided and completely custom. I have a case where
I have 2 remotes with dokku, one on a staging server and another on a
production server.
So by matching for 'dokku@$DOKKU_HOST' instead, the script can determine
correctly which remote to use.
2015-03-30 11:25:33 +02:00
Jose Diaz-Gonzalez
5ecfc7bb91 Merge pull request #1064 from progrium/mh-testing-docs
[ci skip] document test suite
2015-03-30 01:33:26 -04:00
Jose Diaz-Gonzalez
020215ac0a Merge pull request #1068 from matiaskorhonen/rc.local-fix
Fixes escaping in the rc.local script in the Linode StackScript
2015-03-29 18:30:27 -04:00
Matias Korhonen
bb54f845aa Fixes escaping in the rc.local script
`uname -r` was getting executed before the kernel change
2015-03-29 18:40:23 +03:00
Jose Diaz-Gonzalez
802c183b56 Merge pull request #1067 from martinAnsty/docs-nginx-wording
Fix nginx docs wording around config template eg
2015-03-27 18:57:44 -04:00
Martin Ansty
c4d0d37113 Fix nginx docs wording around config template eg 2015-03-27 22:38:13 +00:00
Michael Hobbs
2b59c4b8eb [ci skip] document test suite 2015-03-27 14:36:40 -07:00
Michael Hobbs
e1672b2764 call make stack in subprocess 2015-03-27 14:26:21 -07:00
Michael Hobbs
b6ce856acb set DEBIAN_FRONTEND appropriately to avoid warnings 2015-03-27 14:25:52 -07:00
Josh
b33aebcae2 sanitize example app name 2015-03-26 19:13:45 -04:00
Josh Cohen
f90c7b9524 docs tweak 2015-03-26 18:32:50 -04:00
Josh Cohen
4a0c0eab25 add documentation 2015-03-26 18:29:39 -04:00
Jose Diaz-Gonzalez
50f7b4236b Add .template suffix to nginx configuration templates. Refs #1054 2015-03-26 14:33:27 -04:00
Josh
48f76bcfef Indentation
Indentation for new outer loop
2015-03-24 23:26:31 -04:00
Josh Cohen
3b252d43c6 Add RETRIES feature to checks.
The system will loop through checks RETRIES times until they succeed.
if they do not eventually succeed, it will fail the deployment
2015-03-25 03:17:44 +00:00
53 changed files with 1013 additions and 256 deletions

View File

@@ -1,5 +1,27 @@
# History # History
## 0.3.17
- #1056: @joshco New check retries feature
- #1060: @josegonzalez Add .template suffix to nginx configuration templates. Refs #1054
- #1064: @michaelhobbs [docs] Document test suite
- #1065: @michaelhobbs Minor dev env cleanup
- #1067: @martinAntsy Fix nginx docs wording around config template eg
- #1068: @matiaskorhonen Fix escaping in the rc.local script in the Linode StackScript
- #1074: @Flink Better detection of dokku remote in dokku_client.sh
- #1075: @Flink Use TTY option for SSH
- #1077: @Flink [docs] Add dokku-psql-single-container to plugins
- #1079: @rorykoehler Corrected configuration link in bootstrap.sh
- #1080: @michaelhobbs Include official docker-options plugin. closes #1062
- #1081: @michaelhobbs Force testing .env with no newline. Closes #1025, #1026, #1063
- #1082: @michaelhobbs Test cleanup with slight performance boost
- #1084: @awendt Make port forwarding configurable
- #1087: @michaelhobbs Make docker-options adhere to DOKKU_NOT_IMPLEMENTED_EXIT pattern
- #1088: @michaelhobbs Support dockerfiles without expose command. closes #1083
- #1097: @michaelhobbs Use config:set-norestart in domains plugin. config:get for dockerfile port. closes #1041
- #1102: @kblcuk Source app-specific ENV during check-deploy
- #1107: @Benjamin-Dobell [docs] Added Dokku Graduate to the list of known plugins
## 0.3.16 ## 0.3.16
- #974: @michaelhobbs Don't use set to guard against pipefail - #974: @michaelhobbs Don't use set to guard against pipefail

View File

@@ -22,7 +22,7 @@ include deb.mk
all: all:
# Type "make install" to install. # 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 release: deb-all package_cloud packer
@@ -61,7 +61,8 @@ plugin-dependencies: pluginhook
plugins: pluginhook docker plugins: pluginhook docker
dokku plugins-install dokku plugins-install
dependencies: sshcommand pluginhook docker stack help2man dependencies: sshcommand pluginhook docker help2man
$(MAKE) -e stack
help2man: help2man:
apt-get install -qq -y help2man apt-get install -qq -y help2man

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`: 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.16/bootstrap.sh | sudo DOKKU_TAG=v0.3.16 bash wget -qO- https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh | sudo DOKKU_TAG=v0.3.17 bash
### Upgrading ### Upgrading

11
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" BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me" DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2" 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 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" 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 if PREBUILT_STACK_URL
make_cmd = "PREBUILT_STACK_URL='#{PREBUILT_STACK_URL}' #{make_cmd}" make_cmd = "PREBUILT_STACK_URL='#{PREBUILT_STACK_URL}' #{make_cmd}"
end end
@@ -32,22 +33,22 @@ Vagrant::configure("2") do |config|
config.vm.define "empty", autostart: false config.vm.define "empty", autostart: false
config.vm.define "dokku", primary: true do |vm| 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.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP 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" vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
end end
config.vm.define "dokku-deb", autostart: false do |vm| 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.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb" vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
end end
config.vm.define "build", autostart: false do |vm| 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" vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
end end

View File

@@ -33,4 +33,5 @@ make install
echo echo
echo "Almost done! For next steps on configuration:" 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 exit
end end
version = "v0.3.16" version = "v0.3.17"
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku" dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip

View File

@@ -46,7 +46,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
appname="" appname=""
if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then
set +e 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 set -e
else else
echo "This is not a git repository" echo "This is not a git repository"
@@ -94,7 +94,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
fi fi
if [[ -z "$donotshift" ]]; then if [[ -z "$donotshift" ]]; then
ssh "dokku@$DOKKU_HOST" "$@" ssh -t "dokku@$DOKKU_HOST" "$@"
exit $? exit $?
fi fi
@@ -116,7 +116,7 @@ if [[ ! -z $DOKKU_HOST ]]; then
fi fi
fi fi
# shellcheck disable=SC2086 # shellcheck disable=SC2086
ssh "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}" ssh -t "dokku@$DOKKU_HOST" $long_args "$verb" "$appname" "${args[@]}"
} }
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]]; then if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]]; then

View File

@@ -115,7 +115,7 @@ function setup_linode {
update-grub update-grub
cp /etc/rc.local /etc/rc.local-bak cp /etc/rc.local /etc/rc.local-bak
cat << EOF > /etc/rc.local cat << "EOF" > /etc/rc.local
#!/bin/sh -e #!/bin/sh -e
sudo apt-get update >> /root/setup_linode.txt 2>&1 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 sudo apt-get install -y linux-image-extra-"$(uname -r)" >> /root/setup_linode.txt 2>&1

View File

@@ -107,10 +107,14 @@ A check is a relative URL and may be followed by expected content from the page,
/about Our Amazing Team /about Our Amazing Team
``` ```
Dokku will wait `DOKKU_CHECKS_WAIT` seconds (default: `5`) before running the checks to give server time to start. For shorter/longer wait, change the `DOKKU_CHECKS_WAIT` environment variable. Dokku will wait `DOKKU_CHECKS_WAIT` seconds (default: `5`) before running the checks to give server time to start. For shorter/longer wait, change the `DOKKU_CHECKS_WAIT` environment variable. This can be overridden in the CHECKS file by setting WAIT=nn.
Dokku will wait `DOKKU_WAIT_TO_RETIRE` seconds (default: `60`) before stopping the old container such that no existing connections to it are dropped. Dokku will wait `DOKKU_WAIT_TO_RETIRE` seconds (default: `60`) before stopping the old container such that no existing connections to it are dropped.
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.
See [checks-examples.md](checks-examples.md) for examples and output.
# Removing a deployed app # Removing a deployed app
SSH onto the server, then execute: SSH onto the server, then execute:

203
docs/checks-examples.md Normal file
View File

@@ -0,0 +1,203 @@
# Checks Examples
The CHECKS file may contain empty lines, comments (lines starting with #),
settings (NAME=VALUE) and check instructions.
The format of a check instruction is a path, optionally followed by the
expected content. For example:
/ My Amazing App
/stylesheets/index.css .body
/scripts/index.js $(function()
/images/logo.png
To check an application that supports multiple hostnames, use relative URLs
that include the hostname, for example:
//admin.example.com Admin Dashboard
//static.example.com/logo.png
You can also specify the protocol to explicitly check HTTPS requests.
The default behavior is to wait for 5 seconds before running the first check,
and timeout each check to 30 minutes.
By default, checks will be attempted 5 times. (Retried 4 times)
You can change these by setting WAIT, TIMEOUT and ATTEMPTS to different values, for
example:
WAIT=30 # Wait 1/2 minute
TIMEOUT=60 # Timeout after a minute
ATTEMPTS=10 # attempt checks 10 times
# Example: Successful Rails Deployment
In this example, a rails applicaiton is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful.
ATTEMPTS is set to 6, but the third attempt succeeds.
## CHECKS file
````
WAIT=5
ATTEMPTS=6
/check.txt simple_check
````
> check.txt is a text file returning the string 'simple_check'
## Deploy Output
> Note: The output has been trimmed for brevity
````
git push dokku master
-----> Cleaning up...
-----> Building myapp from buildstep...
-----> Adding BUILD_ENV to build environment...
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
.....
-----> Discovering process types
Procfile declares types -> web
-----> Releasing myapp...
-----> Deploying myapp...
-----> Running pre-flight checks
-----> Attempt 1/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/check.txt => "simple_check"
!
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
! Check attempt 1/6 failed.
-----> Attempt 2/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/check.txt => "simple_check"
!
curl: (7) Failed to connect to 172.17.0.155 port 5000: Connection refused
! Check attempt 2/6 failed.
-----> Attempt 3/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/check.txt => "simple_check"
-----> All checks successful!
=====> myapp container output:
=> Booting Thin
=> Rails 4.2.0 application starting in production on http://0.0.0.0:5000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:5000, CTRL+C to stop
=====> end myapp container output
-----> Running post-deploy
-----> Configuring myapp.dokku.example.com...
-----> Creating http nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
-----> Shutting down old container in 60 seconds
=====> Application deployed:
http://myapp.dokku.example.com
````
# Example: Failing Rails Deployment
In this example, a Rails application fails to deploy. The reason for the failure is that the postgres database connection fails. The initial checks will fail while we wait for the server to start up, just like in the above example. However, once the server does start accepting connections, we will see an error 500 due to the postgres database connection failure.
Once the attempts have been exceeded, the deployment fails and we see the container output, which shows the Postgres connection errors.
## CHECKS file
````
WAIT=5
ATTEMPTS=6
/
````
> The check to the root url '/' would normally access the database.
## Deploy Output
> Note: The output has been trimmed for brevity
````
git push dokku master
-----> Cleaning up...
-----> Building myapp from buildstep...
-----> Adding BUILD_ENV to build environment...
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
.....
Discovering process types
Procfile declares types -> web
Releasing myapp...
Deploying myapp...
Running pre-flight checks
-----> Attempt 1/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
! Check attempt 1/6 failed.
-----> Attempt 2/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (7) Failed to connect to 172.17.0.188 port 5000: Connection refused
! Check attempt 2/6 failed.
-----> Attempt 3/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (22) The requested URL returned error: 500 Internal Server Error
! Check attempt 3/6 failed.
-----> Attempt 4/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (22) The requested URL returned error: 500 Internal Server Error
! Check attempt 4/6 failed.
-----> Attempt 5/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (22) The requested URL returned error: 500 Internal Server Error
! Check attempt 5/6 failed.
-----> Attempt 6/6 Waiting for 5 seconds ...
CHECKS expected result:
http://localhost/ => ""
!
curl: (22) The requested URL returned error: 500 Internal Server Error
Could not start due to 1 failed checks.
! Check attempt 6/6 failed.
=====> myapp container output:
=> Booting Thin
=> Rails 4.2.0 application starting in production on http://0.0.0.0:5000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:5000, CTRL+C to stop
Started GET "/" for 172.17.42.1 at 2015-03-26 21:36:47 +0000
Is the server running on host "172.17.42.1" and accepting
TCP/IP connections on port 5431?
PG::ConnectionBad (could not connect to server: Connection refused
Is the server running on host "172.17.42.1" and accepting
TCP/IP connections on port 5431?
):
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection
=====> end myapp container output
/usr/local/bin/dokku: line 49: 23409 Killed dokku deploy "$APP"
To dokku@dokku.example.com:myapp
! [remote rejected] dokku -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@dokku.example.com:myapp'
````

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_URI`
# - `BOX_MEMORY` # - `BOX_MEMORY`
# - `DOKKU_DOMAIN` # - `DOKKU_DOMAIN`
# - `DOKKU_IP`. # - `DOKKU_IP`
# - `FORWARDED_PORT`.
cd path/to/dokku cd path/to/dokku
vagrant up 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) - [DNS Configuration](http://progrium.viewdocs.io/dokku/dns)
- [Nginx Configuration](http://progrium.viewdocs.io/dokku/nginx) - [Nginx Configuration](http://progrium.viewdocs.io/dokku/nginx)
- [Running Remote commands](http://progrium.viewdocs.io/dokku/remote-commands) - [Running Remote commands](http://progrium.viewdocs.io/dokku/remote-commands)
- [Container Options](http://progrium.viewdocs.io/dokku/docker-options)
### Community Contributions ### 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) - [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)
## Things this project won't do ## 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 ```shell
# This may need to be run twice # This may need to be run twice
wget -qO- https://raw.github.com/progrium/dokku/v0.3.16/bootstrap.sh | sudo DOKKU_TAG=v0.3.16 bash wget -qO- https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh | sudo DOKKU_TAG=v0.3.17 bash
# Install the web installer. See `Configuring` under # Install the web installer. See `Configuring` under
# `Advanced Install Customization` if you wish to perform the # `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 ## Customizing hostnames

View File

@@ -78,6 +78,7 @@ Note: The following plugins have been supplied by our community and may not have
[sekjun9878]: https://github.com/sekjun9878 [sekjun9878]: https://github.com/sekjun9878
[Flink]: https://github.com/Flink [Flink]: https://github.com/Flink
[ribot]: https://github.com/ribot [ribot]: https://github.com/ribot
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell
### Datastores ### Datastores
@@ -93,6 +94,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](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/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/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][] | | | [PostGIS](https://github.com/fermuch/dokku-pg-plugin) | [fermuch][] | |
#### Caching #### Caching
@@ -148,10 +150,10 @@ 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 | | [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 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 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][] | | | [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 | | [git rev-parse HEAD in env](https://github.com/nornagon/dokku-git-rev) | [nornagon][] | Compatible with 0.2.0 |
| [Graduate (Environment Management)](https://github.com/glassechidna/dokku-graduate) | [Benjamin-Dobell][] | dokku >= v0.3.14 |
| [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 | | [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 |
| [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | dokku >= [c77cbf1][]. 2014-02-17: [a043e98][] targeting dokku @ [latest][217d00a] | | [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | dokku >= [c77cbf1][]. 2014-02-17: [a043e98][] targeting dokku @ [latest][217d00a] |
| [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | | | [Hostname](https://github.com/michaelshobbs/dokku-hostname) | [michaelshobbs][] | |
@@ -206,15 +208,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. The following plugins have been removed as their functionality is now in Dokku Core.
| Plugin | Author | In Dokku Since | | Plugin | Author | In Dokku Since |
| ------------------------------------------------------------------------------------------------- | --------------------- | ------------------------- | | ------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------- |
| [Custom Domains](https://github.com/neam/dokku-custom-domains) | [motin][] | v0.3.10 (domains plugin) | | [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) | | [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) | | [Docker Options](https://github.com/dyson/dokku-docker-options) | [dyson][] | v0.3.17 (docker-options plugin) |
| [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) | | [Multiple Domains](https://github.com/wmluke/dokku-domains-plugin)<sup>1</sup> | [wmluke][] | v0.3.10 (domains 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) | | [Rebuild application](https://github.com/scottatron/dokku-rebuild) | [scottatron][] | v0.3.14 (ps plugin) |
| [user-env-compile](https://github.com/musicglue/dokku-user-env-compile)<sup>2</sup> | [musicglue][] | 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/motin/dokku-user-env-compile)<sup>2</sup> | [motin][] | 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>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) <sup>2</sup> Similar to the heroku-labs feature (see https://devcenter.heroku.com/articles/labs-user-env-compile)

8
dokku
View File

@@ -77,7 +77,7 @@ case "$1" in
is_image_buildstep_based "$IMAGE" && DOKKU_BUILDSTEP=true is_image_buildstep_based "$IMAGE" && DOKKU_BUILDSTEP=true
[[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start web" [[ -n "$DOKKU_BUILDSTEP" ]] && START_CMD="/start web"
[[ -z "$DOKKU_BUILDSTEP" ]] && eval "$(grep DOKKU_DOCKERFILE_PORT $DOKKU_ROOT/$APP/ENV)" [[ -z "$DOKKU_BUILDSTEP" ]] && DOKKU_DOCKERFILE_PORT=$(dokku config:get $APP DOKKU_DOCKERFILE_PORT || true)
if [[ "$BIND_EXTERNAL" = "false" ]];then if [[ "$BIND_EXTERNAL" = "false" ]];then
port=${DOKKU_DOCKERFILE_PORT:=5000} port=${DOKKU_DOCKERFILE_PORT:=5000}
@@ -177,17 +177,17 @@ EOF
implemented=0 implemented=0
for script in $PLUGIN_PATH/*/commands; do for script in $PLUGIN_PATH/*/commands; do
set +e; $script "$@" ; exit_code=$? ; set -e 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 continue
fi fi
implemented=1 implemented=1
if [ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]; then if [[ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]]; then
exit $exit_code exit $exit_code
fi fi
done done
if [ "$implemented" -eq 0 ]; then if [[ "$implemented" -eq 0 ]]; then
dokku_log_warn "\`$*\` is not a dokku command." dokku_log_warn "\`$*\` is not a dokku command."
dokku_log_warn "See \`dokku help\` for a list of available commands." dokku_log_warn "See \`dokku help\` for a list of available commands."
exit 1 exit 1

View File

@@ -35,7 +35,7 @@ case "$1" in
dockerfile) dockerfile)
# extract first port from 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 [[ -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. # 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" ! (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 if [[ -f "$DOKKU_ROOT/ENV" ]]; then
BUILD_ENV+=$'\n'
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV") BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
BUILD_ENV+=$'\n' BUILD_ENV+=$'\n'
fi fi

View File

@@ -24,11 +24,14 @@
# The default behavior is to wait for 5 seconds before running the first check, # The default behavior is to wait for 5 seconds before running the first check,
# and timeout each check to 30 minutes. # and timeout each check to 30 minutes.
# #
# You can change these by setting WAIT and TIMEOUT to different values, for # By default, checks will be retried 5 times.
# You can change these by setting WAIT, TIMEOUT and ATTEMPTS to different values, for
# example: # example:
# #
# WAIT=30 # Wait 1/2 minute # WAIT=30 # Wait 1/2 minute
# TIMEOUT=60 # Timeout after a minute # TIMEOUT=60 # Timeout after a minute
# ATTEMPTS=10 # retry checks 10 times
# #
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
@@ -46,13 +49,16 @@ if [[ -z "$DOKKU_APP_CONTAINER_ID" ]] && [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]];
fi fi
# source in app env to get DOKKU_CHECKS_WAIT and any other necessary vars # source global and in-app envs to get DOKKU_CHECKS_WAIT and any other necessary vars
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV [[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
# Wait this many seconds (default 5) for server to start before running checks. # Wait this many seconds (default 5) for server to start before running checks.
WAIT="${DOKKU_CHECKS_WAIT:-5}" WAIT="${DOKKU_CHECKS_WAIT:-5}"
# Wait this many seconds (default 30) for each response. # Wait this many seconds (default 30) for each response.
TIMEOUT="${DOKKU_CHECKS_TIMEOUT:-30}" TIMEOUT="${DOKKU_CHECKS_TIMEOUT:-30}"
# use this number of retries for checks
ATTEMPTS="${DOKKU_CHECKS_ATTEMPTS:-5}"
# try to copy CHECKS from container if not in APP dir & quit gracefully if it doesn't exist # try to copy CHECKS from container if not in APP dir & quit gracefully if it doesn't exist
# docker cp exits with status 1 when run as non-root user when it tries to chown the file # docker cp exits with status 1 when run as non-root user when it tries to chown the file
@@ -95,73 +101,92 @@ while read LINE ; do
VALUE=${TRIM#*=} VALUE=${TRIM#*=}
[[ "$NAME" = "WAIT" ]] && WAIT=$VALUE [[ "$NAME" = "WAIT" ]] && WAIT=$VALUE
[[ "$NAME" = "TIMEOUT" ]] && TIMEOUT=$VALUE [[ "$NAME" = "TIMEOUT" ]] && TIMEOUT=$VALUE
[[ "$NAME" = "ATTEMPTS" ]] && ATTEMPTS=$VALUE
fi fi
done done
ATTEMPT=0
dokku_log_info1 "Waiting for $WAIT seconds ..." until [[ $SUCCESS == 1 || $ATTEMPT -ge $ATTEMPTS ]]
sleep $WAIT do
FAILEDCHECKS=0
ATTEMPT=$(( ATTEMPT + 1 ))
# -q do not use .curlrc (must come first) dokku_log_info1 "Attempt $ATTEMPT/$ATTEMPTS Waiting for $WAIT seconds ..."
# --compressed Test compression handled correctly sleep $WAIT
# --fail Fail on server errors (4xx, 5xx)
# --location Follow redirects
CURL_OPTIONS="-q --compressed --fail --location --max-time $TIMEOUT" # -q do not use .curlrc (must come first)
# --compressed Test compression handled correctly
# --fail Fail on server errors (4xx, 5xx)
exec < "$FILENAME" # --location Follow redirects
while read CHECK_URL EXPECTED ; do CURL_OPTIONS="-q --compressed --fail --location --max-time $TIMEOUT"
# Ignore empty lines and lines starting with #
# shellcheck disable=SC1001
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue exec < "$FILENAME"
# Ignore variables while read CHECK_URL EXPECTED ; do
[[ "$CHECK_URL" =~ ^.+= ]] && continue # Ignore empty lines and lines starting with #
# shellcheck disable=SC1001
if [[ "$CHECK_URL" =~ ^https?: ]] ; then [[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
URL_PROTOCOL=${CHECK_URL%:*} # Ignore variables
CHECK_URL=${CHECK_URL#*:} [[ "$CHECK_URL" =~ ^.+= ]] && continue
else
URL_PROTOCOL="http" if [[ "$CHECK_URL" =~ ^https?: ]] ; then
fi URL_PROTOCOL=${CHECK_URL%:*}
CHECK_URL=${CHECK_URL#*:}
if [[ "$CHECK_URL" =~ ^//.+ ]] ; then else
# To test a URL with specific host name, we still make request to localhost, URL_PROTOCOL="http"
# but we set Host header to $SEND_HOST.
#
# The pattern is
# //SEND_HOST/PATHNAME
UNPREFIXED=${CHECK_URL#//}
URL_HOSTNAME=${UNPREFIXED%%/*}
URL_PATHNAME=${UNPREFIXED#$URL_HOSTNAME}
HEADERS="-H Host:$URL_HOSTNAME"
else
URL_HOSTNAME=localhost
URL_PATHNAME=$CHECK_URL
fi
# This URL will show up in the messages
LOG_URL="$URL_PROTOCOL://$URL_HOSTNAME$URL_PATHNAME"
# And how we formulate the CURL request
CURL_ARGS="$CURL_OPTIONS $URL_PROTOCOL://$DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT$URL_PATHNAME $HEADERS"
dokku_log_verbose "CHECKS expected result:"
dokku_log_verbose "$LOG_URL => \"$EXPECTED\""
[[ $DOKKU_TRACE ]] && dokku_log_verbose "$ curl $CURL_ARGS"
# Capture HTTP response or CURL error message
if OUTPUT=$(curl -# $CURL_ARGS 2>&1) ; then
# OUTPUT contains the HTTP response
if [[ ! "$OUTPUT" =~ $EXPECTED ]] ; then
dokku_log_fail "$LOG_URL: expected to but did not find: \"$EXPECTED\""
exit 1
fi fi
if [[ "$CHECK_URL" =~ ^//.+ ]] ; then
# To test a URL with specific host name, we still make request to localhost,
# but we set Host header to $SEND_HOST.
#
# The pattern is
# //SEND_HOST/PATHNAME
UNPREFIXED=${CHECK_URL#//}
URL_HOSTNAME=${UNPREFIXED%%/*}
URL_PATHNAME=${UNPREFIXED#$URL_HOSTNAME}
HEADERS="-H Host:$URL_HOSTNAME"
else
URL_HOSTNAME=localhost
URL_PATHNAME=$CHECK_URL
fi
# This URL will show up in the messages
LOG_URL="$URL_PROTOCOL://$URL_HOSTNAME$URL_PATHNAME"
# And how we formulate the CURL request
CURL_ARGS="$CURL_OPTIONS $URL_PROTOCOL://$DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT$URL_PATHNAME $HEADERS"
dokku_log_verbose "CHECKS expected result:"
dokku_log_verbose "$LOG_URL => \"$EXPECTED\""
[[ $DOKKU_TRACE ]] && dokku_log_verbose "$ curl $CURL_ARGS"
# Capture HTTP response or CURL error message
if OUTPUT=$(curl -# $CURL_ARGS 2>&1) ; then
# OUTPUT contains the HTTP response
if [[ ! "$OUTPUT" =~ $EXPECTED ]] ; then
dokku_log_warn "$LOG_URL: expected to but did not find: \"$EXPECTED\""
FAILEDCHECKS=$(( FAILEDCHECKS + 1 ))
fi
else
# Failed to connect/no response, OUTPUT contains error message
dokku_log_warn "$OUTPUT"
FAILEDCHECKS=$(( FAILEDCHECKS + 1 ))
fi
done
if [ $FAILEDCHECKS -gt 0 ]; then
dokku_log_warn "Check attempt $ATTEMPT/$ATTEMPTS failed."
SUCCESS=0
else else
# Failed to connect/no response, OUTPUT contains error message SUCCESS=1
dokku_log_fail "$OUTPUT"
exit 2
fi fi
done done
if [ $FAILEDCHECKS -gt 0 ]; then
dokku_log_fail "Could not start due to $FAILEDCHECKS failed checks."
exit 1
fi
dokku_log_info1 "All checks successful!" dokku_log_info1 "All checks successful!"

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

@@ -46,7 +46,7 @@ case "$1" in
fi fi
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
echo "unsupported vhost config found. disabling vhost support" echo "unsupported vhost config found. disabling vhost support"
[[ ! $(grep -q NO_VHOST "$DOKKU_ROOT/$APP/ENV") ]] && echo "export NO_VHOST='1'" >> "$DOKKU_ROOT/$APP/ENV" dokku config:set-norestart $APP NO_VHOST=1
else else
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
dokku_log_info1 "Creating new $VHOST_PATH..." dokku_log_info1 "Creating new $VHOST_PATH..."

View File

@@ -66,7 +66,7 @@ EOF
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0) 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) 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 while read line; do
dokku_log_info1 "Configuring SSL for $line..." dokku_log_info1 "Configuring SSL for $line..."
SSL_SERVER_NAME=$line SSL_SERVER_NAME=$line
@@ -82,7 +82,7 @@ EOF
eval "cat <<< \"$(< $APP_NGINX_TEMPLATE)\" > $NGINX_CONF" eval "cat <<< \"$(< $APP_NGINX_TEMPLATE)\" > $NGINX_CONF"
elif [[ -n "$NONSSL_VHOSTS" ]]; then elif [[ -n "$NONSSL_VHOSTS" ]]; then
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS" 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" eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
fi fi

View File

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

View File

@@ -5,7 +5,7 @@
"express": "2.5.x" "express": "2.5.x"
}, },
"engines": { "engines": {
"node": "0.8.x", "node": "0.10.x",
"npm": "1.1.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": { "engines": {
"node": "0.10.x", "node": "0.10.x",
"npm": "1.3.x" "npm": "2.7.x"
} }
} }

View File

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

View File

@@ -5,7 +5,7 @@
"express": "2.5.x" "express": "2.5.x"
}, },
"engines": { "engines": {
"node": "0.8.x", "node": "0.10.x",
"npm": "1.1.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 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" { @test "(apps) apps:create" {
run dokku apps:create $APP run dokku apps:create $TEST_APP
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
} destroy_app
}
@test "apps" {
run bash -c "dokku apps | grep $APP" @test "(apps) apps:destroy" {
echo "output: "$output create_app
echo "status: "$status run bash -c "dokku --force apps:destroy $TEST_APP"
assert_output $APP
}
@test "apps:destroy" {
run bash -c "dokku --force apps:destroy $APP"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success

View File

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

View File

@@ -10,7 +10,7 @@ teardown() {
destroy_app 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)" run dokku config:set $TEST_APP NEWRELIC_APP_NAME="$TEST_APP (Staging)"
echo "output: "$output echo "output: "$output
echo "status: "$status 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 unset DOKKU_HOST
} }
@test "dokku client (unconfigured DOKKU_HOST)" { @test "(client) unconfigured DOKKU_HOST" {
unset DOKKU_HOST unset DOKKU_HOST
run ./contrib/dokku_client.sh apps run ./contrib/dokku_client.sh apps
echo "output: "$output echo "output: "$output
@@ -20,14 +20,14 @@ teardown() {
assert_exit_status 20 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>.*'" run /bin/bash -c "./contrib/dokku_client.sh | head -1 | egrep -q '^Usage: dokku \[.+\] COMMAND <app>.*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
} }
@test "dokku client (apps:create AND apps:destroy)" { @test "(client) apps:create AND apps:destroy" {
setup_client_repo setup_client_repo
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create" run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh apps:create"
echo "output: "$output echo "output: "$output
@@ -39,7 +39,7 @@ teardown() {
assert_success 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\" run ./contrib/dokku_client.sh config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -50,7 +50,7 @@ teardown() {
assert_success 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\" run ./contrib/dokku_client.sh config:set $TEST_APP test_var=true test_var2=\"hello world\"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -69,14 +69,14 @@ teardown() {
assert_failure 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" run bash -c "./contrib/dokku_client.sh domains $TEST_APP | grep -q ${TEST_APP}.dokku.me"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success 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 run ./contrib/dokku_client.sh domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -87,7 +87,7 @@ teardown() {
assert_success assert_success
} }
@test "dokku client (domains:remove)" { @test "(client) domains:remove" {
run ./contrib/dokku_client.sh domains:add $TEST_APP test.app.dokku.me run ./contrib/dokku_client.sh domains:add $TEST_APP test.app.dokku.me
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -98,7 +98,7 @@ teardown() {
refute_line "test.app.dokku.me" 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 run ./contrib/dokku_client.sh domains:add $TEST_APP test.app.dokku.me
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -109,7 +109,7 @@ teardown() {
assert_success assert_success
} }
# @test "dokku client (ps)" { # @test "(client) ps" {
# # CI support: 'Ah. I just spoke with our Docker expert -- # # CI support: 'Ah. I just spoke with our Docker expert --
# # looks like docker exec is built to work with docker-under-libcontainer, # # 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 # # 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 # assert_success
# } # }
@test "dokku client (ps:start)" { @test "(client) ps:start" {
deploy_app deploy_app
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:stop $TEST_APP" run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:stop $TEST_APP"
echo "output: "$output echo "output: "$output
@@ -137,7 +137,7 @@ teardown() {
assert_success assert_success
} }
@test "dokku client (ps:stop)" { @test "(client) ps:stop" {
deploy_app deploy_app
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:stop $TEST_APP" run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:stop $TEST_APP"
echo "output: "$output echo "output: "$output
@@ -149,7 +149,7 @@ teardown() {
assert_failure assert_failure
} }
@test "dokku client (ps:restart)" { @test "(client) ps:restart" {
deploy_app deploy_app
run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:restart $TEST_APP" run bash -c "${BATS_TEST_DIRNAME}/../../contrib/dokku_client.sh ps:restart $TEST_APP"
echo "output: "$output echo "output: "$output

View File

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

View File

@@ -26,7 +26,33 @@ build_nginx_config() {
dokku nginx:build-config $TEST_APP 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 deploy_app
run /bin/bash -c "dokku run $TEST_APP ls /app/package.json" run /bin/bash -c "dokku run $TEST_APP ls /app/package.json"
echo "output: "$output echo "output: "$output
@@ -34,7 +60,7 @@ build_nginx_config() {
assert_success assert_success
} }
@test "run (without tty)" { @test "(core) run (without tty)" {
deploy_app deploy_app
run /bin/bash -c ": |dokku run $TEST_APP ls /app/package.json" run /bin/bash -c ": |dokku run $TEST_APP ls /app/package.json"
echo "output: "$output echo "output: "$output
@@ -42,7 +68,7 @@ build_nginx_config() {
assert_success assert_success
} }
@test "run (with --options)" { @test "(core) run (with --options)" {
deploy_app deploy_app
run /bin/bash -c "dokku --force --quiet run $TEST_APP node --version" run /bin/bash -c "dokku --force --quiet run $TEST_APP node --version"
echo "output: "$output echo "output: "$output
@@ -50,7 +76,18 @@ build_nginx_config() {
assert_success 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" assert_urls "http://dokku.me"
build_nginx_config build_nginx_config
assert_urls "http://${TEST_APP}.dokku.me" 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" assert_urls "http://${TEST_APP}.dokku.me" "http://test.dokku.me"
} }
@test "urls (app ssl)" { @test "(core) urls (app ssl)" {
setup_test_tls setup_test_tls
assert_urls "https://dokku.me" assert_urls "https://dokku.me"
build_nginx_config 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" 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 setup_test_tls_wildcard
assert_urls "https://dokku.me" assert_urls "https://dokku.me"
build_nginx_config build_nginx_config
@@ -77,3 +114,4 @@ build_nginx_config() {
add_domain "dokku.example.com" add_domain "dokku.example.com"
assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://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" [[ -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" 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=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
@@ -23,7 +23,7 @@ teardown() {
assert_failure 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" rm "$DOKKU_ROOT/VHOST"
echo "dokku.me" > "$DOKKU_ROOT/HOSTNAME" echo "dokku.me" > "$DOKKU_ROOT/HOSTNAME"
deploy_app deploy_app
@@ -34,7 +34,7 @@ teardown() {
assert_success assert_success
} }
@test "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 }') CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
@@ -44,7 +44,7 @@ teardown() {
assert_success 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" rm "$DOKKU_ROOT/VHOST"
echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME" echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME"
deploy_app deploy_app
@@ -55,7 +55,7 @@ teardown() {
assert_success 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" 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
@@ -66,7 +66,7 @@ teardown() {
assert_success assert_success
} }
@test "port exposure (pre-deploy domains:add)" { @test "(core) port exposure (pre-deploy domains:add)" {
create_app create_app
run dokku domains:add $TEST_APP www.test.app.dokku.me run dokku domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output echo "output: "$output
@@ -88,7 +88,7 @@ teardown() {
assert_success 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" rm "$DOKKU_ROOT/VHOST"
deploy_app deploy_app
@@ -109,7 +109,7 @@ teardown() {
assert_success assert_success
} }
@test "dockerfile port exposure" { @test "(core) dockerfile port exposure" {
deploy_app dockerfile deploy_app dockerfile
run bash -c "grep upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000" run bash -c "grep upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000"
echo "output: "$output echo "output: "$output
@@ -117,7 +117,7 @@ teardown() {
assert_success 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" echo "127.0.0.1.xip.io" > "$DOKKU_ROOT/VHOST"
deploy_app 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 destroy_app
} }
@test "domains" { @test "(domains) domains" {
run bash -c "dokku domains $TEST_APP | grep ${TEST_APP}.dokku.me" run bash -c "dokku domains $TEST_APP | grep ${TEST_APP}.dokku.me"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_output "${TEST_APP}.dokku.me" assert_output "${TEST_APP}.dokku.me"
} }
@test "domains:add" { @test "(domains) domains:add" {
run dokku domains:add $TEST_APP www.test.app.dokku.me run dokku domains:add $TEST_APP www.test.app.dokku.me
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -28,7 +28,7 @@ teardown() {
assert_success assert_success
} }
@test "domains:remove" { @test "(domains) domains:remove" {
run dokku domains:add $TEST_APP test.app.dokku.me run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -39,7 +39,7 @@ teardown() {
refute_line "test.app.dokku.me" refute_line "test.app.dokku.me"
} }
@test "domains:clear" { @test "(domains) domains:clear" {
run dokku domains:add $TEST_APP test.app.dokku.me run dokku domains:add $TEST_APP test.app.dokku.me
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status

View File

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

View File

@@ -10,7 +10,7 @@ teardown() {
destroy_app destroy_app
} }
# @test "ps (buildstep)" { # @test "(ps) buildstep" {
# # CI support: 'Ah. I just spoke with our Docker expert -- # # CI support: 'Ah. I just spoke with our Docker expert --
# # looks like docker exec is built to work with docker-under-libcontainer, # # 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 # # 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 # assert_success
# } # }
@test "ps:start (buildstep)" { @test "(ps) 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)" {
run bash -c "dokku ps:stop $TEST_APP" run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -45,9 +30,16 @@ teardown() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure 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" run bash -c "dokku ps:restart $TEST_APP"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -56,9 +48,7 @@ teardown() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
}
@test "ps:rebuild (buildstep)" {
run bash -c "dokku ps:rebuild $TEST_APP" run bash -c "dokku ps:rebuild $TEST_APP"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status

View File

@@ -10,33 +10,18 @@ teardown() {
destroy_app destroy_app
} }
@test "ps (dockerfile)" { # @test "(ps) dockerfile" {
# CI support: 'Ah. I just spoke with our Docker expert -- # # CI support: 'Ah. I just spoke with our Docker expert --
# looks like docker exec is built to work with docker-under-libcontainer, # # 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 # # 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." # skip "circleci does not support docker exec at the moment."
run bash -c "dokku ps $TEST_APP | grep -q \"node web.js\"" # run bash -c "dokku ps $TEST_APP | grep -q \"node web.js\""
echo "output: "$output # echo "output: "$output
echo "status: "$status # echo "status: "$status
assert_success # assert_success
} # }
@test "ps:start (dockerfile)" { @test "(ps) 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)" {
run bash -c "dokku ps:stop $TEST_APP" run bash -c "dokku ps:stop $TEST_APP"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -45,9 +30,16 @@ teardown() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure 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" run bash -c "dokku ps:restart $TEST_APP"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
@@ -56,9 +48,7 @@ teardown() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
}
@test "ps:rebuild (dockerfile)" {
run bash -c "dokku ps:rebuild $TEST_APP" run bash -c "dokku ps:rebuild $TEST_APP"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status