Compare commits
101 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e220da491 | ||
|
|
e0c49ec724 | ||
|
|
938a16de53 | ||
|
|
80d13c0005 | ||
|
|
d1f358c6fb | ||
|
|
f5f7b8dd7e | ||
|
|
795da11d24 | ||
|
|
c63be44989 | ||
|
|
17271b6132 | ||
|
|
82b700d635 | ||
|
|
da465a61dd | ||
|
|
875da5211f | ||
|
|
fc8e8484c6 | ||
|
|
7ebdcaa2e5 | ||
|
|
8e5c8c0832 | ||
|
|
4abccf0119 | ||
|
|
dd9ef4866c | ||
|
|
8502881633 | ||
|
|
43e9e6ddb6 | ||
|
|
471a5fa087 | ||
|
|
f95ad79fc4 | ||
|
|
896ce50c93 | ||
|
|
cbbc63d0f8 | ||
|
|
1f73b58340 | ||
|
|
881a700e99 | ||
|
|
9d81dda524 | ||
|
|
566cc15081 | ||
|
|
f1827a86a4 | ||
|
|
fc1762156d | ||
|
|
343ee24c46 | ||
|
|
441d212ef2 | ||
|
|
bc072e1db3 | ||
|
|
ab7f9f1161 | ||
|
|
e95d1e8602 | ||
|
|
948d7902f2 | ||
|
|
8535900f9d | ||
|
|
152b060901 | ||
|
|
464ef4d879 | ||
|
|
156e987300 | ||
|
|
8abb9ec408 | ||
|
|
97734cc242 | ||
|
|
93a01fb763 | ||
|
|
2a51301a5d | ||
|
|
1d6d5755d4 | ||
|
|
6fed503024 | ||
|
|
95914d1c13 | ||
|
|
92c18fa664 | ||
|
|
7bd5df0e25 | ||
|
|
9b5abeac4d | ||
|
|
de09260c33 | ||
|
|
7cf28ee01f | ||
|
|
e04b90c416 | ||
|
|
5e1b5b2900 | ||
|
|
416dac6d2b | ||
|
|
9a04104bb9 | ||
|
|
43fe6edb04 | ||
|
|
3a850fa05e | ||
|
|
097bdecfac | ||
|
|
1d4cc0b991 | ||
|
|
3e62b1acce | ||
|
|
c2911c94a8 | ||
|
|
f5a5f7702b | ||
|
|
5f2a5fe2bc | ||
|
|
50208862b2 | ||
|
|
283432f214 | ||
|
|
d1e94f6c91 | ||
|
|
dbb6560b1e | ||
|
|
f3535292b3 | ||
|
|
568902302b | ||
|
|
cddcf997e1 | ||
|
|
f2bd2b8541 | ||
|
|
6bb01404ec | ||
|
|
e8b4bd5a89 | ||
|
|
2695d957ac | ||
|
|
051b286a62 | ||
|
|
67b7fa6263 | ||
|
|
c697c65508 | ||
|
|
85f9bb3aae | ||
|
|
c5c0ae00ba | ||
|
|
0dec01c324 | ||
|
|
3827e38caa | ||
|
|
14a7cac686 | ||
|
|
9322200eae | ||
|
|
ee32b05a36 | ||
|
|
3b41d6d16f | ||
|
|
8aef43b3ae | ||
|
|
e45455b73f | ||
|
|
356acdd08d | ||
|
|
f9b7d5378d | ||
|
|
58d0bc983a | ||
|
|
81aefba305 | ||
|
|
8f5c5d5ae2 | ||
|
|
8025657a38 | ||
|
|
779808f832 | ||
|
|
d3e18d3362 | ||
|
|
606bbda66c | ||
|
|
3706392e65 | ||
|
|
ab7c313411 | ||
|
|
f797ff77f4 | ||
|
|
c2736c7c7a | ||
|
|
2464bc0458 |
@@ -9,3 +9,8 @@ indent_size = 2
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.mk]
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
2
AUTHORS
2
AUTHORS
@@ -4,6 +4,7 @@
|
||||
Alexander <iam.asm89@gmail.com>
|
||||
Alexander Beletsky <alexander.beletsky@gmail.com>
|
||||
Alexis Gavoty <kload@kload.fr>
|
||||
Christian Joudrey <cmallette@gmail.com>
|
||||
Felipe Coury <felipe.coury@gmail.com>
|
||||
Jeff Lindsay <progrium@gmail.com>
|
||||
Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
|
||||
@@ -11,6 +12,7 @@ Leo Unbekandt <leo@unbekandt.eu>
|
||||
Ludovic Perrine <jazzzz@gmail.com>
|
||||
Luigi Maselli <grigio.org@gmail.com>
|
||||
Martin Weiss <kornnflake@gmail.com>
|
||||
Michael Hobbs <github@psudo.net>
|
||||
Paul Lietar <paul@lietar.net>
|
||||
Rajiv Makhijani <rajiv@blue-tech.org>
|
||||
rhy-jot <rhy-jot@myeml.net>
|
||||
|
||||
36
HISTORY.md
36
HISTORY.md
@@ -1,5 +1,41 @@
|
||||
# History
|
||||
|
||||
## 0.3.13
|
||||
|
||||
- #815: @abossard Added wordpress installation helper to plugin index
|
||||
- #858: @josegonzalez Disable server tokens in nginx. Closes #857
|
||||
- #859: @josegonzalez Pass command being executed when retrieving DOCKER_ARGS via pluginhook.
|
||||
- #861: @josegonzalez Default DOKKU_ROOT to ~dokku if unspecified. Closes #587
|
||||
- #863: @josegonzalez Add missing properties to the php composer.json
|
||||
- #864: @michaelhobbs bind docker container to internal port if using vhosts
|
||||
- #867: @michaelhobbs silent grep stderr. closes #862
|
||||
- #868: @michaelhobbs use circleci for automated testing
|
||||
- #872: @michaelhobbs fix/enable multi buildpack test
|
||||
- #873: @michaelhobbs support pre deployment usage of domains plugin. fixes interface binding issue
|
||||
- #874: @josegonzalez Add advanced installation docs that were removed in #706. Closes #869
|
||||
- #876: @vincentfretin give CACHE_PATH env variable for forward compatibility with herokuish
|
||||
- #877: @michaelhobbs add MH to AUTHORS
|
||||
- #880: @michaelhobbs disable VHOST deployment if global VHOST file is missing and an app domain has not been added
|
||||
- #881: @jomo troubleshooting typo: 64 != 46
|
||||
- #884: @michaelhobbs IP and PORT are likely to get clobbered. rename them
|
||||
- #885: @michaelhobbs test deploy node app without procfile
|
||||
|
||||
## 0.3.12
|
||||
|
||||
- #846: @michaelhobbs add certificate CN to app VHOST if it's not already
|
||||
- #847: @leonardodino Update bootstrap.sh: new docs url
|
||||
- #849: @cjoudrey Add docs for CHECKS
|
||||
- #850: @michaelhobbs test scala deployment
|
||||
|
||||
## 0.3.11
|
||||
|
||||
- #821: @michaelhobbs use wercker for automated testing
|
||||
- #833: @michaelhobbs auto remove the cache dir cleanup container
|
||||
- #835: @michaelhobbs make sure we match the specific string in VHOST
|
||||
- #838: @michaelhobbs quote build_env vars to allow for spaces in config
|
||||
- #839: @michaelhobbs notify irc on builds
|
||||
- #844: @michaelhobbs build app urls based on wildcard ssl or app ssl
|
||||
|
||||
## 0.3.10
|
||||
|
||||
- #783: @josegonzalez New domains plugin and nginx extension
|
||||
|
||||
18
Makefile
18
Makefile
@@ -3,8 +3,7 @@ DOKKU_VERSION = master
|
||||
SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand
|
||||
PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb
|
||||
STACK_URL ?= https://github.com/progrium/buildstep.git
|
||||
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-03-08/2014-03-08_429d4a9deb.tar.gz
|
||||
DOKKU_ROOT ?= /home/dokku
|
||||
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-12-16/2014-12-16_42bd9f4aab.tar.gz
|
||||
PLUGINS_PATH ?= /var/lib/dokku/plugins
|
||||
|
||||
# If the first argument is "vagrant-dokku"...
|
||||
@@ -17,6 +16,8 @@ endif
|
||||
|
||||
.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
|
||||
include tests.mk
|
||||
|
||||
all:
|
||||
# Type "make install" to install.
|
||||
|
||||
@@ -27,10 +28,10 @@ copyfiles: addman
|
||||
mkdir -p ${PLUGINS_PATH}
|
||||
find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf
|
||||
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
|
||||
rm -Rf ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
||||
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
||||
done
|
||||
rm -Rf ${PLUGINS_PATH}/$$plugin && \
|
||||
cp -R plugins/$$plugin ${PLUGINS_PATH} && \
|
||||
touch ${PLUGINS_PATH}/$$plugin/.core; \
|
||||
done
|
||||
|
||||
addman:
|
||||
mkdir -p /usr/local/share/man/man1
|
||||
@@ -38,7 +39,7 @@ addman:
|
||||
mandb
|
||||
|
||||
version:
|
||||
git describe --tags > ${DOKKU_ROOT}/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ${DOKKU_ROOT}/VERSION
|
||||
git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION
|
||||
|
||||
plugin-dependencies: pluginhook
|
||||
dokku plugins-install-dependencies
|
||||
@@ -72,7 +73,9 @@ endif
|
||||
sleep 2 # give docker a moment i guess
|
||||
|
||||
aufs:
|
||||
ifndef CI
|
||||
lsmod | grep aufs || modprobe aufs || apt-get install -qq -y linux-image-extra-`uname -r` > /dev/null
|
||||
endif
|
||||
|
||||
stack:
|
||||
@echo "Start building buildstep"
|
||||
@@ -106,3 +109,4 @@ vagrant-acl-add:
|
||||
|
||||
vagrant-dokku:
|
||||
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Dokku [](https://travis-ci.org/progrium/dokku)
|
||||
# Dokku [](https://circleci.com/gh/progrium/dokku/tree/master)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
|
||||
|
||||
@@ -10,7 +10,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
|
||||
|
||||
To install the latest stable version of dokku, you can run the following bootstrapper command:
|
||||
|
||||
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.10/bootstrap.sh | sudo DOKKU_TAG=v0.3.10 bash
|
||||
$ wget -qO- https://raw.github.com/progrium/dokku/v0.3.13/bootstrap.sh | sudo DOKKU_TAG=v0.3.13 bash
|
||||
|
||||
### Upgrading
|
||||
|
||||
|
||||
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@@ -3,7 +3,7 @@
|
||||
|
||||
BOX_NAME = ENV["BOX_NAME"] || "trusty"
|
||||
BOX_URI = ENV["BOX_URI"] || "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
BOX_MEMORY = ENV["BOX_MEMORY"] || "512"
|
||||
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
|
||||
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
|
||||
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
|
||||
PREBUILT_STACK_URL = File.exist?("#{File.dirname(__FILE__)}/stack.tgz") ? 'file:///root/dokku/stack.tgz' : nil
|
||||
|
||||
@@ -9,16 +9,17 @@ export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"}
|
||||
|
||||
if ! command -v apt-get &>/dev/null
|
||||
then
|
||||
echo "This installation script requires apt-get. For manual installation instructions, consult https://github.com/progrium/dokku ."
|
||||
echo "This installation script requires apt-get. For manual installation instructions, consult http://progrium.viewdocs.io/dokku/advanced-installation ."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -qq -y git make curl software-properties-common man-db
|
||||
|
||||
[[ `lsb_release -sr` == "12.04" ]] && apt-get install -qq -y python-software-properties
|
||||
[[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties
|
||||
|
||||
cd ~ && test -d dokku || git clone $DOKKU_REPO
|
||||
cd ~
|
||||
test -d dokku || git clone $DOKKU_REPO
|
||||
cd dokku
|
||||
git fetch origin
|
||||
|
||||
@@ -32,4 +33,4 @@ make install
|
||||
|
||||
echo
|
||||
echo "Almost done! For next steps on configuration:"
|
||||
echo " https://github.com/progrium/dokku#configuring"
|
||||
echo " http://progrium.viewdocs.io/dokku/installation#user-content-configuring"
|
||||
|
||||
28
circle.yml
Normal file
28
circle.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
machine:
|
||||
services:
|
||||
- docker
|
||||
dependencies:
|
||||
cache_directories:
|
||||
- "~/docker"
|
||||
override:
|
||||
# need to add the dokku user to the docker group
|
||||
- sudo -E CI=true make -e sshcommand
|
||||
- sudo usermod -G docker dokku
|
||||
- sudo -E CI=true DOCKER_VERSION=1.4.1 make -e install: { timeout: 300 }
|
||||
- make -e ci-dependencies
|
||||
#### circle does some weird *expletive* with regards to root and gh auth (needed for gitsubmodules test)
|
||||
- sudo rsync -a ~ubuntu/.ssh/ ~root/.ssh/
|
||||
- sudo chown -R root:root ~root/.ssh/
|
||||
- sudo sed -e 's:/home/ubuntu:/root:g' ~root/.ssh/config
|
||||
####
|
||||
- sudo -E make -e setup-deploy-tests
|
||||
test:
|
||||
override:
|
||||
- sudo -E make -e lint
|
||||
- sudo -E make -e unit-tests
|
||||
### deploy tests (against buildstep release) ####
|
||||
- sudo -E make -e deploy-tests: { timeout: 1800 }
|
||||
### deploy tests (against buildstep master) ####
|
||||
- sudo docker rmi -f progrium/buildstep
|
||||
- sudo -E BUILD_STACK=true make -e stack
|
||||
- sudo -E make -e deploy-tests: { timeout: 1800 }
|
||||
@@ -21,7 +21,7 @@ if ARGV[0] == "onboot"
|
||||
exit
|
||||
end
|
||||
|
||||
version = "v0.3.10"
|
||||
version = "v0.3.13"
|
||||
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
|
||||
|
||||
37
docs/advanced-installation.md
Normal file
37
docs/advanced-installation.md
Normal file
@@ -0,0 +1,37 @@
|
||||
#Advanced installation
|
||||
|
||||
## Development
|
||||
|
||||
If you plan on developing dokku, the easiest way to install from your own repository is cloning the repository and calling the install script. Example:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/yourusername/dokku.git
|
||||
cd dokku
|
||||
sudo make install
|
||||
```
|
||||
|
||||
The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example:
|
||||
|
||||
```shell
|
||||
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/gitreceive make install
|
||||
```
|
||||
|
||||
## Bootstrap a server from your own repository
|
||||
|
||||
The bootstrap script allows the dokku repository URL to be overridden to bootstrap a host from your own clone of dokku using the `DOKKU_REPO` environment variable. Example:
|
||||
|
||||
```shell
|
||||
wget https://raw.github.com/progrium/dokku/master/bootstrap.sh
|
||||
chmod +x bootstrap.sh
|
||||
sudo DOKKU_REPO=https://github.com/yourusername/dokku.git ./bootstrap.sh
|
||||
```
|
||||
|
||||
## Custom buildstep build
|
||||
|
||||
Dokku ships with a pre-built version of version of the [buildstep](https://github.com/progrium/buildstep) component by default. If you want to build your own version you can specify that with an env variable.
|
||||
|
||||
```shell
|
||||
git clone https://github.com/progrium/dokku.git
|
||||
cd dokku
|
||||
sudo BUILD_STACK=true make install
|
||||
```
|
||||
@@ -81,6 +81,26 @@ This is in particular useful, then you want to deploy to root domain, as
|
||||
remote: -----> Application deployed:
|
||||
remote: http://dokku.me
|
||||
|
||||
# Zero downtime deploy
|
||||
|
||||
Following a deploy Dokku's default behaviour is to switch new traffic over to the new container immediately.
|
||||
|
||||
This can be problematic for applications that take some time to boot up and can lead to `502 Bad Gateway` errors.
|
||||
|
||||
Dokku provides a way to run a set of checks against the new container, and only switch traffic over if all checks complete successfully.
|
||||
|
||||
To specify checks, add a `CHECKS` file to the root of your project directory. This is a text file with one line per check. Empty lines and lines starting with `#` are ignored.
|
||||
|
||||
A check is a relative URL and may be followed by expected content from the page, for example:
|
||||
|
||||
```
|
||||
/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_WAIT_TO_RETIRE` seconds (default: `60`) before stopping the old container such that no existing connections to it are dropped.
|
||||
|
||||
# Removing a deployed app
|
||||
|
||||
SSH onto the server, then execute:
|
||||
|
||||
@@ -11,7 +11,7 @@ Ubuntu 14.04 x64 x64. Ideally have a domain ready to point to your host. It's de
|
||||
To install the latest stable version of dokku, you can run the following bootstrapper command:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/v0.3.10/bootstrap.sh | sudo DOKKU_TAG=v0.3.10 bash
|
||||
wget -qO- https://raw.github.com/progrium/dokku/v0.3.13/bootstrap.sh | sudo DOKKU_TAG=v0.3.13 bash
|
||||
```
|
||||
|
||||
## Configuring
|
||||
|
||||
@@ -136,3 +136,25 @@ dokku domains:clear myapp
|
||||
# remove a custom domain from app
|
||||
dokku domains:remove myapp example.com
|
||||
```
|
||||
|
||||
### Container network interface binding
|
||||
|
||||
> New as of 0.3.13
|
||||
|
||||
The deployed docker container running your app's web process will bind to either the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`) or an external interface (i.e. 0.0.0.0) depending on dokku's VHOST configuration. Dokku will attempt to bind to the internal docker network interface unless you specifically set NO_VHOST for the given app or your dokku installation is not setup to use VHOSTS (i.e. $DOKKU_ROOT/VHOST is missing or $DOKKU_ROOT/HOSTNAME is set to an IPv4 or IPv6 address)
|
||||
|
||||
```shell
|
||||
# container bound to docker interface
|
||||
root@dokku:~/dokku# docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute goofy_albattani
|
||||
|
||||
root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' goofy_albattani
|
||||
172.17.0.6
|
||||
|
||||
# container bound to all interfaces (previous default)
|
||||
root@dokku:/home/dokku# docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp nostalgic_tesla
|
||||
|
||||
```
|
||||
|
||||
@@ -228,6 +228,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
|
||||
| Plugin | Author | Compatibility |
|
||||
| ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- |
|
||||
| [Wordpress](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | Dokku dev, mariadb, volume, domains |
|
||||
| [Node](https://github.com/pnegahdar/dokku-node) | [pnegahdar][] | |
|
||||
| [Node](https://github.com/ademuk/dokku-nodejs) | [ademuk][] | |
|
||||
| [Chef cookbooks](https://github.com/fgrehm/chef-dokku) | [fgrehm][] | |
|
||||
|
||||
@@ -22,7 +22,7 @@ http {
|
||||
```
|
||||
|
||||
Note that the `server_names_hash_bucket_size` setting defines the maximum domain name length.
|
||||
A value of 64 would allow domains with up to 46 characters. Set it to 128 if you need longer ones.
|
||||
A value of 64 would allow domains with up to 64 characters. Set it to 128 if you need longer ones.
|
||||
|
||||
Save the file and try stopping nginx and starting it again:
|
||||
|
||||
|
||||
52
dokku
52
dokku
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
|
||||
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
|
||||
export DOKKU_ROOT=${DOKKU_ROOT:="/home/dokku"}
|
||||
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
|
||||
|
||||
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"}
|
||||
export DOKKU_NOT_IMPLEMENTED_EXIT=10
|
||||
@@ -21,8 +22,13 @@ fi
|
||||
|
||||
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
|
||||
export -n SSH_ORIGINAL_COMMAND
|
||||
$0 $SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
if [[ $1 =~ config-* ]];then
|
||||
xargs $0 <<<$SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
else
|
||||
$0 $SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
@@ -37,20 +43,20 @@ case "$1" in
|
||||
echo "-----> Deploying $APP ..."
|
||||
dokku deploy $APP
|
||||
echo "=====> Application deployed:"
|
||||
echo "$(dokku urls $APP | sed "s/^/ /")"
|
||||
dokku urls $APP | sed "s/^/ /"
|
||||
echo
|
||||
;;
|
||||
|
||||
build)
|
||||
APP="$2"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
id=$(cat | docker run -i -a stdin $DOKKU_IMAGE /bin/bash -c "mkdir -p /app && tar -xC /app")
|
||||
test $(docker wait $id) -eq 0
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
|
||||
pluginhook pre-build $APP
|
||||
id=$(docker run -d -v $CACHE_DIR:/cache $IMAGE /build/builder)
|
||||
id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $IMAGE /build/builder)
|
||||
docker attach $id
|
||||
test $(docker wait $id) -eq 0
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
pluginhook post-build $APP
|
||||
;;
|
||||
@@ -59,8 +65,8 @@ case "$1" in
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
pluginhook pre-release $APP
|
||||
if [[ -f "$DOKKU_ROOT/$APP/ENV" ]]; then
|
||||
id=$(cat "$DOKKU_ROOT/$APP/ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/app-env.sh")
|
||||
test $(docker wait $id) -eq 0
|
||||
id=$(docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/app-env.sh" < "$DOKKU_ROOT/$APP/ENV")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
fi
|
||||
pluginhook post-release $APP
|
||||
@@ -75,9 +81,19 @@ case "$1" in
|
||||
fi
|
||||
|
||||
# start the app
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP)
|
||||
id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE /bin/bash -c "/start web")
|
||||
port=$(docker port $id 5000 | sed 's/[0-9.]*://')
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy)
|
||||
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP)
|
||||
|
||||
if [[ "$BIND_EXTERNAL" = "false" ]];then
|
||||
port=5000
|
||||
id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE /bin/bash -c "/start web")
|
||||
ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id)
|
||||
else
|
||||
id=$(docker run -d -p 5000 -e PORT=5000 $DOCKER_ARGS $IMAGE /bin/bash -c "/start web")
|
||||
port=$(docker port $id 5000 | sed 's/[0-9.]*://')
|
||||
ipaddr=127.0.0.1
|
||||
fi
|
||||
echo $ipaddr > "$DOKKU_ROOT/$APP/IP"
|
||||
|
||||
# if we can't post-deploy successfully, kill new container
|
||||
function kill_new {
|
||||
@@ -89,7 +105,7 @@ case "$1" in
|
||||
# run checks first, then post-deploy hooks, which switches Nginx traffic
|
||||
trap kill_new INT TERM EXIT
|
||||
echo "-----> Running pre-flight checks"
|
||||
pluginhook check-deploy $id $APP $port
|
||||
pluginhook check-deploy $id $APP $port ${ipaddr:-localhost}
|
||||
|
||||
# now using the new container
|
||||
echo $id > "$DOKKU_ROOT/$APP/CONTAINER"
|
||||
@@ -97,7 +113,7 @@ case "$1" in
|
||||
echo "http://$(< "$DOKKU_ROOT/HOSTNAME"):$port" > "$DOKKU_ROOT/$APP/URL"
|
||||
|
||||
echo "-----> Running post-deploy"
|
||||
pluginhook post-deploy $APP $port
|
||||
pluginhook post-deploy $APP $port $ipaddr
|
||||
trap - INT TERM EXIT
|
||||
|
||||
# kill the old container
|
||||
@@ -143,8 +159,8 @@ case "$1" in
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
deploy:all)
|
||||
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
|
||||
APP=$(basename $(dirname $app));
|
||||
for app in $DOKKU_ROOT/*/CONTAINER; do
|
||||
APP=$(basename "$(dirname $app)");
|
||||
dokku deploy $APP
|
||||
done
|
||||
;;
|
||||
@@ -163,7 +179,7 @@ EOF
|
||||
|
||||
*)
|
||||
implemented=0
|
||||
for script in $(ls -d $PLUGIN_PATH/*/commands); do
|
||||
for script in $PLUGIN_PATH/*/commands; do
|
||||
set +e; $script "$@" ; exit_code=$? ; set -e
|
||||
if [ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]; then
|
||||
continue
|
||||
@@ -176,7 +192,7 @@ EOF
|
||||
done
|
||||
|
||||
if [ "$implemented" -eq 0 ]; then
|
||||
echo " ! \`$@\` is not a dokku command."
|
||||
echo " ! \`$*\` is not a dokku command."
|
||||
echo " ! See \`dokku help\` for a list of available commands."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -8,7 +8,7 @@ TARGET_DIR="$3"
|
||||
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
|
||||
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
||||
mkdir -p $TARGET_DIR/.ssh
|
||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
|
||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > tmpfile && mv tmpfile $TARGET_DIR/.ssh/authorized_keys
|
||||
chmod 0700 $TARGET_DIR/.ssh
|
||||
chmod 0600 $TARGET_DIR/.ssh/*
|
||||
fi
|
||||
|
||||
@@ -48,16 +48,16 @@ case "$1" in
|
||||
|
||||
shift 2
|
||||
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP)
|
||||
DOCKER_ARGS=$(: | pluginhook docker-args $APP run)
|
||||
docker run -i -t $DOCKER_ARGS $IMAGE /exec "$@"
|
||||
;;
|
||||
|
||||
url | urls)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
[[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1
|
||||
APP="$2"; SCHEME="http"; SSL="$DOKKU_ROOT/$APP/tls"
|
||||
APP="$2"; SCHEME="http"; SSL="$DOKKU_ROOT/$APP/tls"; WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||
|
||||
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
|
||||
if [[ -e "$SSL/server.crt" && -e "$SSL/server.key" ]] || [[ -e "$WILDCARD_SSL/server.crt" && -e "$WILDCARD_SSL/server.key" ]]; then
|
||||
SCHEME="https"
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||
hostname -f > $DOKKU_ROOT/HOSTNAME
|
||||
fi
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
|
||||
fi
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
|
||||
@@ -3,5 +3,5 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
|
||||
if [[ -d $CACHE_DIR ]]; then
|
||||
docker run -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \;
|
||||
docker run --rm -v "$CACHE_DIR:/cache" "$IMAGE" find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
fi
|
||||
|
||||
@@ -14,7 +14,7 @@ case "$1" in
|
||||
: | pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
|
||||
|
||||
pushd $BACKUP_DIR > /dev/null
|
||||
ls -d */ | grep -oE '[^/]+' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
popd > /dev/null
|
||||
|
||||
# we want to insert the files in the root of the tar
|
||||
|
||||
@@ -5,8 +5,8 @@ APP="$1"; IMAGE="dokku/$APP"; BUILD_ENV=""
|
||||
|
||||
[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && rm "$DOKKU_ROOT/BUILD_ENV"
|
||||
|
||||
[[ ! $(grep CURL_CONNECT_TIMEOUT "$DOKKU_ROOT/ENV") ]] && echo "export CURL_CONNECT_TIMEOUT=5" >> "$DOKKU_ROOT/ENV"
|
||||
[[ ! $(grep CURL_TIMEOUT "$DOKKU_ROOT/ENV") ]] && echo "export CURL_TIMEOUT=30" >> "$DOKKU_ROOT/ENV"
|
||||
! (grep -q CURL_CONNECT_TIMEOUT "$DOKKU_ROOT/ENV" > /dev/null 2>&1) && echo "export CURL_CONNECT_TIMEOUT=5" >> "$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
|
||||
BUILD_ENV+=$(< "$DOKKU_ROOT/ENV")
|
||||
@@ -20,12 +20,12 @@ if [[ ! -z "$BUILD_ENV" ]]; then
|
||||
echo "-----> Adding BUILD_ENV to build environment..."
|
||||
# create build env files for use in buildpacks like this:
|
||||
# https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34
|
||||
id=$(echo $BUILD_ENV |sed 's@export @@g'| docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in `cat`; do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \2 >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
|
||||
test $(docker wait $id) -eq 0
|
||||
id=$(echo $BUILD_ENV |sed 's@export @@g'| docker run -i -a stdin $IMAGE /bin/bash -c "for ENV_VAR in $(cat); do echo \$ENV_VAR |sed 's@^\([^=]*\)=\(.*\)\$@echo \\\"\2\\\" >/tmp/env/\1@g' >>/tmp/set_env.sh; done && mkdir -p /tmp/env && /bin/bash /tmp/set_env.sh")
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
|
||||
# create build env for 'old style' buildpacks and dokku plugins
|
||||
id=$(echo "$BUILD_ENV" | docker run -i -a stdin $IMAGE /bin/bash -c "cat >> /app/.env")
|
||||
test $(docker wait $id) -eq 0
|
||||
test "$(docker wait $id)" -eq 0
|
||||
docker commit $id $IMAGE > /dev/null
|
||||
fi
|
||||
|
||||
@@ -56,20 +56,20 @@ sleep $WAIT
|
||||
# --location Follow redirects
|
||||
CURL_OPTIONS="-q --compressed --fail --location --max-time 30"
|
||||
|
||||
cat "$FILENAME" | while read PATHNAME EXPECTED ; do
|
||||
while read PATHNAME EXPECTED; do
|
||||
# Ignore empty lines and lines starting with #
|
||||
[[ -z "$PATHNAME" || "$PATHNAME" =~ ^\# ]] && continue
|
||||
[[ -z "$PATHNAME" || "$PATHNAME" =~ ^# ]] && continue
|
||||
|
||||
URL="http://$HOSTNAME:$PORT$PATHNAME"
|
||||
|
||||
echo "checking with: curl $CURL_OPTIONS $URL"
|
||||
HTML=$(curl $CURL_OPTIONS $URL)
|
||||
if [[ -n "$EXPECTED" && ! "$HTML" =~ "$EXPECTED" ]] ; then
|
||||
if [[ -n "$EXPECTED" && ! "$HTML" =~ $EXPECTED ]] ; then
|
||||
echo -e "\033[31m\033[1m$URL: expected to but did not find: \"$EXPECTED\"\033[0m"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\033[32m\033[1m$URL => \"$EXPECTED\"\033[0m"
|
||||
fi
|
||||
done
|
||||
done < "$FILENAME"
|
||||
|
||||
echo -e "\033[32m\033[1mAll checks successful!\033[0m"
|
||||
|
||||
@@ -15,21 +15,21 @@ config_styled_hash () {
|
||||
|
||||
longest=""
|
||||
while read -r word; do
|
||||
KEY=`echo $word | cut -d"=" -f1`
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
if [ ${#KEY} -gt ${#longest} ]; then
|
||||
longest=$KEY
|
||||
fi
|
||||
done <<< "$vars"
|
||||
|
||||
while read -r word; do
|
||||
KEY=`echo $word | cut -d"=" -f1`
|
||||
VALUE=`echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"`
|
||||
KEY=$(echo $word | cut -d"=" -f1)
|
||||
VALUE=$(echo $word | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//")
|
||||
|
||||
num_zeros=$((${#longest} - ${#KEY}))
|
||||
zeros=" "
|
||||
while [ $num_zeros -gt 0 ]; do
|
||||
zeros="$zeros "
|
||||
num_zeros=$(($num_zeros - 1))
|
||||
num_zeros=$((num_zeros - 1))
|
||||
done
|
||||
echo "$prefix$KEY:$zeros$VALUE"
|
||||
done <<< "$vars"
|
||||
@@ -68,7 +68,7 @@ case "$1" in
|
||||
config_create
|
||||
[[ ! -s $ENV_FILE ]] && echo "$APP has no config vars" && exit 1
|
||||
|
||||
VARS=`cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | cut -d" " -f2-`
|
||||
VARS=$(grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | cut -d" " -f2-)
|
||||
|
||||
for var in "$@"; do
|
||||
if [[ "$var" == "--shell" ]]; then
|
||||
@@ -99,7 +99,7 @@ case "$1" in
|
||||
|
||||
KEY="$3"
|
||||
|
||||
cat $ENV_FILE | grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
|
||||
grep -Eo "export ([a-zA-Z_][a-zA-Z0-9_]*=.*)" $ENV_FILE | grep "^export $KEY=" | cut -d"=" -f2- | sed -e "s/^'//" -e "s/'$//"
|
||||
;;
|
||||
|
||||
config:set)
|
||||
@@ -115,7 +115,7 @@ case "$1" in
|
||||
|
||||
config_create
|
||||
ENV_ADD=""
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
RESTART_APP=false
|
||||
shift 2
|
||||
|
||||
@@ -128,8 +128,8 @@ case "$1" in
|
||||
done
|
||||
|
||||
for var; do
|
||||
KEY=`echo ${var} | cut -d"=" -f1`
|
||||
VALUE=`echo ${var} | cut -d"=" -f2-`
|
||||
KEY=$(echo ${var} | cut -d"=" -f1)
|
||||
VALUE=$(echo ${var} | cut -d"=" -f2-)
|
||||
|
||||
if [[ $KEY =~ [a-zA-Z_][a-zA-Z0-9_]* ]]; then
|
||||
RESTART_APP=true
|
||||
@@ -162,7 +162,7 @@ ${var}"
|
||||
fi
|
||||
|
||||
config_create
|
||||
ENV_TEMP=`cat "${ENV_FILE}"`
|
||||
ENV_TEMP=$(cat "${ENV_FILE}")
|
||||
VARS="${*:3}"
|
||||
|
||||
for var in $VARS; do
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
|
||||
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
|
||||
domains_restart_app() {
|
||||
APP="$1";
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
|
||||
echo "-----> Releasing $APP ..."
|
||||
dokku release $APP
|
||||
echo "-----> Release complete!"
|
||||
echo "-----> Deploying $APP ..."
|
||||
dokku deploy $APP
|
||||
echo "-----> Deploy complete!"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
domains)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
@@ -23,22 +51,24 @@ case "$1" in
|
||||
else
|
||||
VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
fi
|
||||
if [[ "$VHOST" =~ ([0-9]{1,3}[\.]){3}[0-9]{1,3} ]];then
|
||||
echo "ip found as hostname. disabling vhost support"
|
||||
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
|
||||
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"
|
||||
else
|
||||
echo "-----> Creating new $VHOST_PATH..."
|
||||
SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
|
||||
if [[ ! -n $hostname ]]; then
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
else
|
||||
hostname="${APP/\//-}.$VHOST"
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
echo "-----> Creating new $VHOST_PATH..."
|
||||
SUBDOMAIN=${APP/%\.${VHOST}/}
|
||||
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST)
|
||||
if [[ ! -n $hostname ]]; then
|
||||
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
|
||||
hostname="${APP/\//-}"
|
||||
else
|
||||
hostname="${APP/\//-}.$VHOST"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$hostname" > $VHOST_PATH
|
||||
echo "$hostname" > $VHOST_PATH
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
@@ -54,13 +84,15 @@ case "$1" in
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $(grep $3 "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
if [[ $(egrep ^"$3"$ "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then
|
||||
echo "$3 is already defined for $APP"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dokku domains:setup $APP
|
||||
echo "$3" >> "$DOKKU_ROOT/$APP/VHOST"
|
||||
# we need to restart the app to make sure we're binding to the appropriate network interface
|
||||
domains_restart_app $APP
|
||||
pluginhook post-domains-update $APP
|
||||
echo "-----> Added $3 to $APP"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
shopt -s nullglob
|
||||
|
||||
for app in $(ls -d $DOKKU_ROOT/*/CONTAINER); do
|
||||
APP=$(basename $(dirname $app));
|
||||
for app in $DOKKU_ROOT/*/CONTAINER; do
|
||||
APP=$(basename "$(dirname $app)");
|
||||
dokku domains:setup $APP
|
||||
done
|
||||
|
||||
@@ -57,7 +57,7 @@ EOF
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
fi
|
||||
|
||||
args=$@
|
||||
args=$*
|
||||
git-shell -c "$args"
|
||||
;;
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ TARGET_DIR="$3"
|
||||
cd $IMPORT_DIR
|
||||
|
||||
for file in */tls/server.*; do
|
||||
mkdir -p $(dirname $TARGET_DIR$file)
|
||||
mkdir -p "$(dirname $TARGET_DIR$file)"
|
||||
cp $file $TARGET_DIR$file
|
||||
done
|
||||
|
||||
34
plugins/nginx-vhosts/bind-external-ip
Executable file
34
plugins/nginx-vhosts/bind-external-ip
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"
|
||||
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
|
||||
|
||||
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
|
||||
|
||||
RE_IPV6="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" # TEST: 1:2:3:4:5:6:7:8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,7}:|" # TEST: 1:: 1:2:3:4:5:6:7::
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|" # TEST: 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|" # TEST: 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|" # TEST: 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|" # TEST: 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|" # TEST: 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8
|
||||
RE_IPV6="${RE_IPV6}[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|" # TEST: 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8
|
||||
RE_IPV6="${RE_IPV6}:((:[0-9a-fA-F]{1,4}){1,7}|:)|" # TEST: ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
|
||||
RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: fe08::7:8%eth0 fe08::7:8%1 (link-local IPv6 addresses with zone index)
|
||||
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
|
||||
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
|
||||
|
||||
[[ -f "$DOKKU_ROOT/VHOST" ]] && GLOBAL_VHOST=$(< "$DOKKU_ROOT/VHOST")
|
||||
|
||||
if [[ -n "$NO_VHOST" ]]; then
|
||||
echo true # bind to external ip. VHOST is disabled
|
||||
elif [[ "$GLOBAL_VHOST" =~ $RE_IPV4 ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV6 ]]; then
|
||||
echo true # bind to external ip. GLOBAL_VHOST is somehow an IPv4 or IPv6 address
|
||||
elif [[ -z "$GLOBAL_VHOST" ]] && [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo true # bind to external ip. no GLOBAL_VHOST and no app vhost
|
||||
elif [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo false # bind to docker ip. this app has a vhost defined
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
@@ -15,16 +15,22 @@ restart_nginx () {
|
||||
|
||||
case "$1" in
|
||||
nginx:build-config)
|
||||
APP="$2"; PORT="$3"
|
||||
[[ -z "$PORT" ]] && PORT=$(< "$DOKKU_ROOT/$APP/PORT")
|
||||
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="${4}"
|
||||
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||
SSL="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
DOKKU_APP_LISTEN_PORT=$(< "$DOKKU_ROOT/$APP/PORT")
|
||||
fi
|
||||
if [[ -z "$DOKKU_APP_LISTEN_IP" ]] && [[ -f "$DOKKU_ROOT/$APP/IP" ]]; then
|
||||
DOKKU_APP_LISTEN_IP=$(< "$DOKKU_ROOT/$APP/IP")
|
||||
fi
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
|
||||
if [[ ! -n "$NO_VHOST" ]]; then
|
||||
NONSSL_VHOSTS=`cat $VHOST_PATH`
|
||||
if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
NONSSL_VHOSTS=$(cat $VHOST_PATH)
|
||||
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
|
||||
SSL_INUSE="$SSL"
|
||||
SSL_DIRECTIVES=$(cat <<EOF
|
||||
@@ -43,10 +49,12 @@ EOF
|
||||
NGINX_CONF="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf"
|
||||
SCHEME="https"
|
||||
|
||||
SSL_HOSTNAME=`openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-`
|
||||
SSL_HOSTNAME=`echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g'`
|
||||
SSL_VHOSTS=`egrep ^"$SSL_HOSTNAME"$ $VHOST_PATH`
|
||||
NONSSL_VHOSTS=`egrep -v ^"$SSL_HOSTNAME"$ $VHOST_PATH || exit 0`
|
||||
SSL_HOSTNAME=$(openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
|
||||
SSL_HOSTNAME=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\.\*/g')
|
||||
|
||||
[[ -z "$(egrep ^"$SSL_HOSTNAME"$ $VHOST_PATH)" ]] && echo "$SSL_HOSTNAME" | sed 's/\\./\./g' >> $VHOST_PATH
|
||||
SSL_VHOSTS=$(egrep ^"$SSL_HOSTNAME"$ $VHOST_PATH || exit 0)
|
||||
NONSSL_VHOSTS=$(egrep -v ^"$SSL_HOSTNAME"$ $VHOST_PATH || exit 0)
|
||||
|
||||
while read line; do
|
||||
echo "-----> Configuring SSL for $line..."
|
||||
@@ -61,29 +69,31 @@ EOF
|
||||
NGINX_CONF=$APP_NGINX_TEMPLATE
|
||||
fi
|
||||
|
||||
cat $VHOST_PATH | xargs -i echo "-----> Configuring {}..."
|
||||
xargs -i echo "-----> Configuring {}..." < $VHOST_PATH
|
||||
# Include SSL_VHOSTS so we can redirect http to https on that hostname as well
|
||||
NOSSL_SERVER_NAME=`echo $NONSSL_VHOSTS $SSL_VHOSTS| tr '\n' ' '`
|
||||
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS $SSL_VHOSTS| tr '\n' ' ')
|
||||
|
||||
echo "-----> Creating $SCHEME nginx.conf"
|
||||
echo "upstream $APP { server 127.0.0.1:$PORT; }" > $DOKKU_ROOT/$APP/nginx.conf
|
||||
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
|
||||
if [[ -n "$DOKKU_APP_LISTEN_PORT" ]] && [[ -n "$DOKKU_APP_LISTEN_IP" ]]; then
|
||||
echo "-----> Creating $SCHEME nginx.conf"
|
||||
echo "upstream $APP { server $DOKKU_APP_LISTEN_IP:$DOKKU_APP_LISTEN_PORT; }" > $DOKKU_ROOT/$APP/nginx.conf
|
||||
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
echo "-----> Running nginx-pre-reload"
|
||||
pluginhook nginx-pre-reload $APP $PORT
|
||||
echo "-----> Running nginx-pre-reload"
|
||||
pluginhook nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
|
||||
|
||||
echo " Reloading nginx"
|
||||
restart_nginx
|
||||
echo " Reloading nginx"
|
||||
restart_nginx
|
||||
fi
|
||||
else
|
||||
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
echo "-----> NO_VHOST set, deleting $APP/VHOST"
|
||||
echo "-----> VHOST support disabled, deleting $APP/VHOST"
|
||||
rm "$DOKKU_ROOT/$APP/VHOST"
|
||||
fi
|
||||
if [[ -f "$DOKKU_ROOT/$APP/nginx.conf" ]]; then
|
||||
echo "-----> NO_VHOST set, deleting nginx.conf"
|
||||
echo "-----> VHOST support disabled, deleting nginx.conf"
|
||||
rm "$DOKKU_ROOT/$APP/nginx.conf"
|
||||
|
||||
echo "-----> NO_VHOST set, reloading nginx after nginx.conf deletion"
|
||||
echo "-----> VHOST support disabled, reloading nginx after nginx.conf deletion"
|
||||
restart_nginx
|
||||
fi
|
||||
fi
|
||||
@@ -95,7 +105,7 @@ EOF
|
||||
[[ -t 0 ]] && echo "Tar archive containing server.crt and server.key expected on stdin" && exit 1
|
||||
APP="$2"
|
||||
|
||||
TEMP_DIR=`mktemp -d`
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
cd $TEMP_DIR
|
||||
tar xvf - <&0
|
||||
[[ ! -f "$TEMP_DIR/server.crt" ]] && echo "Tar archive missing server.crt" && exit 1
|
||||
|
||||
@@ -3,7 +3,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
apt-get install -qq -y software-properties-common python-software-properties
|
||||
[[ -z "$CIRCLECI" ]] && apt-get install -qq -y software-properties-common python-software-properties
|
||||
[[ -n "$CIRCLECI" ]] && aptitude install -q -y software-properties-common python-software-properties
|
||||
add-apt-repository -y ppa:nginx/stable
|
||||
apt-get update
|
||||
apt-get install -qq -y nginx dnsutils
|
||||
|
||||
@@ -25,10 +25,12 @@ ssl_session_timeout 10m;
|
||||
|
||||
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
|
||||
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
# this is already defined in the base nginx.conf and causes nginx reloads/starts to fail
|
||||
# when its defined twice
|
||||
# ssl_prefer_server_ciphers on;
|
||||
|
||||
#ssl_certificate $DOKKU_ROOT/tls/server.crt;
|
||||
#ssl_certificate_key $DOKKU_ROOT/tls/server.key;
|
||||
# ssl_certificate $DOKKU_ROOT/tls/server.crt;
|
||||
# ssl_certificate_key $DOKKU_ROOT/tls/server.key;
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -42,6 +44,7 @@ events {
|
||||
}
|
||||
|
||||
http {
|
||||
server_tokens off;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
APP="$1"; PORT="$2"
|
||||
APP="$1"; PORT="$2"; IP="$3"
|
||||
|
||||
set +e; NO_VHOST=$(dokku config:get $APP NO_VHOST); set -e
|
||||
|
||||
@@ -11,4 +11,4 @@ elif [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
dokku domains:setup $APP
|
||||
fi
|
||||
|
||||
dokku nginx:build-config $APP $PORT
|
||||
dokku nginx:build-config $APP $PORT $IP
|
||||
|
||||
124
tests.mk
Normal file
124
tests.mk
Normal file
@@ -0,0 +1,124 @@
|
||||
shellcheck:
|
||||
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127)
|
||||
ifeq ($(shell uname),Darwin)
|
||||
brew install shellcheck
|
||||
else
|
||||
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
|
||||
sudo apt-get update && sudo apt-get install -y shellcheck
|
||||
endif
|
||||
endif
|
||||
|
||||
ci-dependencies: shellcheck bats
|
||||
|
||||
setup-deploy-tests:
|
||||
mkdir -p /home/dokku
|
||||
ifdef ENABLE_DOKKU_TRACE
|
||||
echo "-----> Enabling tracing"
|
||||
echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc
|
||||
endif
|
||||
@echo "Setting dokku.me in /etc/hosts"
|
||||
sudo /bin/bash -c "[[ `ping -c1 dokku.me > /dev/null 2>&1; echo $$?` -eq 0 ]] || echo \"127.0.0.1 dokku.me *.dokku.me www.test.app.dokku.me\" >> /etc/hosts"
|
||||
|
||||
@echo "-----> Generating keypair..."
|
||||
mkdir -p /root/.ssh
|
||||
rm -f /root/.ssh/dokku_test_rsa*
|
||||
echo -e "y\n" | ssh-keygen -f /root/.ssh/dokku_test_rsa -t rsa -N ''
|
||||
chmod 600 /root/.ssh/dokku_test_rsa*
|
||||
|
||||
@echo "-----> Setting up ssh config..."
|
||||
ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0)
|
||||
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
else ifeq ($(shell grep dokku.me /root/.ssh/config),)
|
||||
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
endif
|
||||
|
||||
@echo "-----> Installing SSH public key..."
|
||||
sudo sshcommand acl-remove dokku test
|
||||
cat /root/.ssh/dokku_test_rsa.pub | sudo sshcommand acl-add dokku test
|
||||
|
||||
@echo "-----> Intitial SSH connection to populate known_hosts..."
|
||||
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
|
||||
|
||||
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
|
||||
@echo "-----> Setting default VHOST to dokku.me..."
|
||||
echo "dokku.me" > /home/dokku/VHOST
|
||||
endif
|
||||
|
||||
bats:
|
||||
git clone https://github.com/sstephenson/bats.git /tmp/bats
|
||||
cd /tmp/bats && sudo ./install.sh /usr/local
|
||||
rm -rf /tmp/bats
|
||||
|
||||
lint:
|
||||
# these are disabled due to their expansive existence in the codebase. we should clean it up though
|
||||
# SC2034: VAR appears unused - https://github.com/koalaman/shellcheck/wiki/SC2034
|
||||
# SC2086: Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086
|
||||
# SC2143: Instead of [ -n $(foo | grep bar) ], use foo | grep -q bar - https://github.com/koalaman/shellcheck/wiki/SC2143
|
||||
# SC2001: See if you can use ${variable//search/replace} instead. - https://github.com/koalaman/shellcheck/wiki/SC2001
|
||||
@echo linting...
|
||||
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001
|
||||
|
||||
unit-tests:
|
||||
@echo running unit tests...
|
||||
@$(QUIET) bats tests/unit
|
||||
|
||||
deploy-test-config:
|
||||
@echo deploying config app...
|
||||
cd tests && ./test_deploy ./apps/config dokku.me
|
||||
|
||||
deploy-test-gitsubmodules:
|
||||
@echo deploying gitsubmodules app...
|
||||
cd tests && ./test_deploy ./apps/gitsubmodules dokku.me
|
||||
|
||||
deploy-test-go:
|
||||
@echo deploying go app...
|
||||
cd tests && ./test_deploy ./apps/go dokku.me
|
||||
|
||||
deploy-test-java:
|
||||
@echo deploying java app...
|
||||
cd tests && ./test_deploy ./apps/java dokku.me
|
||||
|
||||
deploy-test-multi:
|
||||
@echo deploying multi app...
|
||||
cd tests && ./test_deploy ./apps/multi dokku.me
|
||||
|
||||
deploy-test-nodejs-express:
|
||||
@echo deploying nodejs-express app...
|
||||
cd tests && ./test_deploy ./apps/nodejs-express dokku.me
|
||||
|
||||
deploy-test-nodejs-express-noprocfile:
|
||||
@echo deploying nodejs-express app with no Procfile...
|
||||
cd tests && ./test_deploy ./apps/nodejs-express-noprocfile dokku.me
|
||||
|
||||
deploy-test-php:
|
||||
@echo deploying php app...
|
||||
cd tests && ./test_deploy ./apps/php dokku.me
|
||||
|
||||
deploy-test-python-flask:
|
||||
@echo deploying python-flask app...
|
||||
cd tests && ./test_deploy ./apps/python-flask dokku.me
|
||||
|
||||
deploy-test-scala:
|
||||
@echo deploying scala app...
|
||||
cd tests && ./test_deploy ./apps/scala dokku.me
|
||||
|
||||
deploy-test-static:
|
||||
@echo deploying static app...
|
||||
cd tests && ./test_deploy ./apps/static dokku.me
|
||||
|
||||
deploy-tests:
|
||||
@echo running deploy tests...
|
||||
# @$(QUIET) bats tests/deploy
|
||||
@$(QUIET) $(MAKE) deploy-test-config
|
||||
@$(QUIET) $(MAKE) deploy-test-gitsubmodules
|
||||
@$(QUIET) $(MAKE) deploy-test-go
|
||||
@$(QUIET) $(MAKE) deploy-test-java
|
||||
@$(QUIET) $(MAKE) deploy-test-multi
|
||||
@$(QUIET) $(MAKE) deploy-test-nodejs-express
|
||||
@$(QUIET) $(MAKE) deploy-test-nodejs-express-noprocfile
|
||||
@$(QUIET) $(MAKE) deploy-test-php
|
||||
@$(QUIET) $(MAKE) deploy-test-python-flask
|
||||
@$(QUIET) $(MAKE) deploy-test-scala
|
||||
@$(QUIET) $(MAKE) deploy-test-static
|
||||
|
||||
test: setup-deploy-tests lint unit-tests deploy-tests
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: $1\" -H \"Origin: $1\" $1 -m 2)"; echo $output; test "$output" == "bazingaa"
|
||||
set -e; output="$(curl -s -S -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: $1\" -H \"Origin: $1\" $1 -m 2)"; echo $output; test "$output" == "bazingaa"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/bin/bash
|
||||
set -e;
|
||||
|
||||
base_url="$1"
|
||||
test_url / "config-test"
|
||||
test_url /hello "Hello world"
|
||||
|
||||
test_url () {
|
||||
path="$1"
|
||||
expected_output="$2"
|
||||
url="$base_url$path"
|
||||
output="$(curl -s $url)"
|
||||
echo $output
|
||||
output="$(curl -s -S "$url")"
|
||||
echo "$output"
|
||||
test "$output" == "$expected_output"
|
||||
}
|
||||
}
|
||||
|
||||
base_url="$1"
|
||||
test_url / "config-test"
|
||||
test_url /hello "Hello world"
|
||||
|
||||
@@ -4,5 +4,6 @@ set -ex;
|
||||
REMOTE=$1
|
||||
REPO=$2
|
||||
|
||||
ssh $REMOTE config:set $REPO CONFTEST=config-test HELLO=\"Hello world\"
|
||||
|
||||
# setting config variables with spaces is broken at the moment. ref: 820
|
||||
# ssh "$REMOTE" config:set "$REPO" CONFTEST=config-test HELLO=\"Hello world\"
|
||||
dokku config:set "$REPO" CONFTEST=config-test HELLO="Hello world"
|
||||
|
||||
1
tests/apps/gitsubmodules/CHECKS
Normal file
1
tests/apps/gitsubmodules/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ Hello
|
||||
@@ -1 +1 @@
|
||||
web: node node-js-sample/web.js
|
||||
web: node node-js-sample/index.js
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "Hello World!"
|
||||
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!"
|
||||
|
||||
1
tests/apps/go/CHECKS
Normal file
1
tests/apps/go/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ go
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; test "$(curl -s $1)" == "go"
|
||||
set -e; test "$(curl -s -S "$1")" == "go"
|
||||
|
||||
1
tests/apps/java/CHECKS
Normal file
1
tests/apps/java/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ Hello from Java
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "Hello from Java!"
|
||||
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello from Java!"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
https://github.com/heroku/heroku-buildpack-ruby
|
||||
https://github.com/heroku/heroku-buildpack-nodejs
|
||||
https://github.com/heroku/heroku-buildpack-python
|
||||
https://github.com/heroku/heroku-buildpack-python.git
|
||||
|
||||
1
tests/apps/multi/CHECKS
Normal file
1
tests/apps/multi/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ Heroku Multi Buildpack on Dokku
|
||||
@@ -2,5 +2,5 @@ source "https://rubygems.org"
|
||||
|
||||
ruby '1.9.3'
|
||||
|
||||
gem 'compass'
|
||||
gem 'compass', ">= 1.0.1"
|
||||
gem 'sass-globbing'
|
||||
|
||||
@@ -1,19 +1,31 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
chunky_png (1.3.0)
|
||||
compass (0.12.3)
|
||||
chunky_png (1.3.3)
|
||||
compass (1.0.1)
|
||||
chunky_png (~> 1.2)
|
||||
fssm (>= 0.2.7)
|
||||
sass (= 3.2.14)
|
||||
fssm (0.2.10)
|
||||
sass (3.2.14)
|
||||
sass-globbing (1.1.0)
|
||||
compass-core (~> 1.0.1)
|
||||
compass-import-once (~> 1.0.5)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
sass (>= 3.3.13, < 3.5)
|
||||
compass-core (1.0.1)
|
||||
multi_json (~> 1.0)
|
||||
sass (>= 3.3.0, < 3.5)
|
||||
compass-import-once (1.0.5)
|
||||
sass (>= 3.2, < 3.5)
|
||||
ffi (1.9.6)
|
||||
multi_json (1.10.1)
|
||||
rb-fsevent (0.9.4)
|
||||
rb-inotify (0.9.5)
|
||||
ffi (>= 0.5.0)
|
||||
sass (3.4.9)
|
||||
sass-globbing (1.1.1)
|
||||
sass (>= 3.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
compass
|
||||
compass (>= 1.0.1)
|
||||
sass-globbing
|
||||
|
||||
@@ -1 +1 @@
|
||||
web: python app.py
|
||||
web: gunicorn app:app
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; curl -s $1 | grep -q "Heroku Multi Buildpack on Dokku"
|
||||
set -e; curl -s -S "$1" | grep -q "Heroku Multi Buildpack on Dokku"
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
{
|
||||
"name": "test-buildpack-multi",
|
||||
"version": "0.0.0",
|
||||
"description": "Test application for heroku multi buildpack.",
|
||||
"author": "Al Johri",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bower": "~1.2.8",
|
||||
"grunt": "~0.4.1",
|
||||
"bower": "^1.3.1",
|
||||
"grunt": "~0.4.5",
|
||||
"grunt-cli": "~0.1.13",
|
||||
"load-grunt-tasks": "~0.2.0",
|
||||
"grunt-contrib-compass": "~0.6.0"
|
||||
"grunt-contrib-compass": "~1.0.1",
|
||||
"load-grunt-tasks": "~1.0.0",
|
||||
"tmp": "0.0.23"
|
||||
},
|
||||
"description": "Test application for heroku multi buildpack.",
|
||||
"engines": {
|
||||
"node": "~0.10.30"
|
||||
},
|
||||
"license": "ISC",
|
||||
"name": "test-buildpack-multi",
|
||||
"scripts": {
|
||||
"postinstall": "./node_modules/bower/bin/bower --allow-root install && ./node_modules/grunt-cli/bin/grunt heroku"
|
||||
}
|
||||
"postinstall": "echo $PATH && ./node_modules/bower/bin/bower install --allow-root && ./node_modules/grunt-cli/bin/grunt --verbose --debug heroku"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Flask==0.10.1
|
||||
gunicorn==18.0
|
||||
|
||||
1
tests/apps/nodejs-express-noprocfile/CHECKS
Normal file
1
tests/apps/nodejs-express-noprocfile/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ nodejs/express
|
||||
2
tests/apps/nodejs-express-noprocfile/check_deploy
Executable file
2
tests/apps/nodejs-express-noprocfile/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "nodejs/express"
|
||||
14
tests/apps/nodejs-express-noprocfile/package.json
Normal file
14
tests/apps/nodejs-express-noprocfile/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "2.5.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.8.x",
|
||||
"npm": "1.1.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node web.js"
|
||||
}
|
||||
}
|
||||
12
tests/apps/nodejs-express-noprocfile/web.js
Normal file
12
tests/apps/nodejs-express-noprocfile/web.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var express = require('express');
|
||||
|
||||
var app = express.createServer(express.logger());
|
||||
|
||||
app.get('/', function(request, response) {
|
||||
response.send('nodejs/express');
|
||||
});
|
||||
|
||||
var port = process.env.PORT || 5000;
|
||||
app.listen(port, function() {
|
||||
console.log("Listening on " + port);
|
||||
});
|
||||
1
tests/apps/nodejs-express/CHECKS
Normal file
1
tests/apps/nodejs-express/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ nodejs/express
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "nodejs/express"
|
||||
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "nodejs/express"
|
||||
|
||||
1
tests/apps/php/CHECKS
Normal file
1
tests/apps/php/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ <html><h3>php</h3></html>
|
||||
1
tests/apps/php/Procfile
Normal file
1
tests/apps/php/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: vendor/heroku/heroku-buildpack-php/bin/heroku-php-apache2 web/
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "<html><h3>php</h3></html>"
|
||||
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "<html><h3>php</h3></html>"
|
||||
|
||||
11
tests/apps/php/composer.json
Normal file
11
tests/apps/php/composer.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "test-php-app",
|
||||
"description": "a test php app for dokku",
|
||||
"require": {
|
||||
"monolog/monolog": "~1.7",
|
||||
"silex/silex": "~1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"heroku/heroku-buildpack-php": "*"
|
||||
}
|
||||
}
|
||||
609
tests/apps/php/composer.lock
generated
Normal file
609
tests/apps/php/composer.lock
generated
Normal file
@@ -0,0 +1,609 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"aliases": [],
|
||||
"hash": "be309b690b78816cf842ab863c0c7590",
|
||||
"minimum-stability": "stable",
|
||||
"packages": [
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "http://seld.be",
|
||||
"name": "Jordi Boggiano"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"dist": {
|
||||
"reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/ec3961874c43840e96da3a8a1ed20d8c73d7e5aa"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.11.x-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "monolog/monolog",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0.0"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "~2.4, >2.4.8",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"graylog2/gelf-php": "~1.0",
|
||||
"phpunit/phpunit": "~3.7.0",
|
||||
"raven/raven": "~0.5",
|
||||
"ruflin/elastica": "0.90.*",
|
||||
"videlalvaro/php-amqplib": "~2.4"
|
||||
},
|
||||
"source": {
|
||||
"reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa",
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"raven/raven": "Allow sending log messages to a Sentry server",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
||||
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
|
||||
},
|
||||
"time": "2014-09-30 13:30:58",
|
||||
"type": "library",
|
||||
"version": "1.11.0"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"name": "Fabien Potencier",
|
||||
"role": "Lead Developer"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Pimple": "lib/"
|
||||
}
|
||||
},
|
||||
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
|
||||
"dist": {
|
||||
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fabpot/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://pimple.sensiolabs.org",
|
||||
"keywords": [
|
||||
"container",
|
||||
"dependency injection"
|
||||
],
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "pimple/pimple",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"source": {
|
||||
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
|
||||
"type": "git",
|
||||
"url": "https://github.com/fabpot/Pimple.git"
|
||||
},
|
||||
"time": "2013-11-22 08:30:29",
|
||||
"type": "library",
|
||||
"version": "v1.1.1"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"homepage": "http://www.php-fig.org/",
|
||||
"name": "PHP-FIG"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Psr\\Log\\": ""
|
||||
}
|
||||
},
|
||||
"description": "Common interface for logging libraries",
|
||||
"dist": {
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b"
|
||||
},
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "psr/log",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"source": {
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git"
|
||||
},
|
||||
"time": "2012-12-21 11:40:51",
|
||||
"type": "library",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"email": "fabien@symfony.com",
|
||||
"name": "Fabien Potencier"
|
||||
},
|
||||
{
|
||||
"email": "igor@wiedler.ch",
|
||||
"name": "Igor Wiedler"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Silex": "src/"
|
||||
}
|
||||
},
|
||||
"description": "The PHP micro-framework based on the Symfony2 Components",
|
||||
"dist": {
|
||||
"reference": "8c5e86eb97f3eee633729b22e950082fb5591328",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/silexphp/Silex/zipball/8c5e86eb97f3eee633729b22e950082fb5591328"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://silex.sensiolabs.org",
|
||||
"keywords": [
|
||||
"microframework"
|
||||
],
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "silex/silex",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"pimple/pimple": "~1.0",
|
||||
"symfony/event-dispatcher": ">=2.3,<2.6-dev",
|
||||
"symfony/http-foundation": ">=2.3,<2.6-dev",
|
||||
"symfony/http-kernel": ">=2.3,<2.6-dev",
|
||||
"symfony/routing": ">=2.3,<2.6-dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "~2.2",
|
||||
"monolog/monolog": "~1.4,>=1.4.1",
|
||||
"phpunit/phpunit": "~3.7",
|
||||
"swiftmailer/swiftmailer": "5.*",
|
||||
"symfony/browser-kit": ">=2.3,<2.6-dev",
|
||||
"symfony/config": ">=2.3,<2.6-dev",
|
||||
"symfony/css-selector": ">=2.3,<2.6-dev",
|
||||
"symfony/debug": ">=2.3,<2.6-dev",
|
||||
"symfony/dom-crawler": ">=2.3,<2.6-dev",
|
||||
"symfony/finder": ">=2.3,<2.6-dev",
|
||||
"symfony/form": ">=2.3,<2.6-dev",
|
||||
"symfony/locale": ">=2.3,<2.6-dev",
|
||||
"symfony/monolog-bridge": ">=2.3,<2.6-dev",
|
||||
"symfony/options-resolver": ">=2.3,<2.6-dev",
|
||||
"symfony/process": ">=2.3,<2.6-dev",
|
||||
"symfony/security": ">=2.3,<2.6-dev",
|
||||
"symfony/serializer": ">=2.3,<2.6-dev",
|
||||
"symfony/translation": ">=2.3,<2.6-dev",
|
||||
"symfony/twig-bridge": ">=2.3,<2.6-dev",
|
||||
"symfony/validator": ">=2.3,<2.6-dev",
|
||||
"twig/twig": ">=1.8.0,<2.0-dev"
|
||||
},
|
||||
"source": {
|
||||
"reference": "8c5e86eb97f3eee633729b22e950082fb5591328",
|
||||
"type": "git",
|
||||
"url": "https://github.com/silexphp/Silex.git"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/browser-kit": ">=2.3,<2.6-dev",
|
||||
"symfony/css-selector": ">=2.3,<2.6-dev",
|
||||
"symfony/dom-crawler": ">=2.3,<2.6-dev",
|
||||
"symfony/form": ">=2.3,<2.6-dev"
|
||||
},
|
||||
"time": "2014-09-26 09:32:30",
|
||||
"type": "library",
|
||||
"version": "v1.2.2"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"homepage": "http://symfony.com/contributors",
|
||||
"name": "Symfony Community"
|
||||
},
|
||||
{
|
||||
"email": "fabien@symfony.com",
|
||||
"name": "Fabien Potencier"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Debug\\": ""
|
||||
}
|
||||
},
|
||||
"description": "Symfony Debug Component",
|
||||
"dist": {
|
||||
"reference": "08b529b4c0aa3e746d187fe2a63f08cb955a3566",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Debug/zipball/08b529b4c0aa3e746d187fe2a63f08cb955a3566"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://symfony.com",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "symfony/debug",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-foundation": "~2.1",
|
||||
"symfony/http-kernel": "~2.1"
|
||||
},
|
||||
"source": {
|
||||
"reference": "08b529b4c0aa3e746d187fe2a63f08cb955a3566",
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Debug.git"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/http-foundation": "",
|
||||
"symfony/http-kernel": ""
|
||||
},
|
||||
"target-dir": "Symfony/Component/Debug",
|
||||
"time": "2014-12-02 20:19:20",
|
||||
"type": "library",
|
||||
"version": "v2.6.1"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"homepage": "http://symfony.com/contributors",
|
||||
"name": "Symfony Community"
|
||||
},
|
||||
{
|
||||
"email": "fabien@symfony.com",
|
||||
"name": "Fabien Potencier"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\EventDispatcher\\": ""
|
||||
}
|
||||
},
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"dist": {
|
||||
"reference": "c0a15f7c45efc6506077c728658c16b579929bf8",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/c0a15f7c45efc6506077c728658c16b579929bf8"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://symfony.com",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "symfony/event-dispatcher",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.0",
|
||||
"symfony/dependency-injection": "~2.0,<2.6.0",
|
||||
"symfony/stopwatch": "~2.2"
|
||||
},
|
||||
"source": {
|
||||
"reference": "c0a15f7c45efc6506077c728658c16b579929bf8",
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/EventDispatcher.git"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/dependency-injection": "",
|
||||
"symfony/http-kernel": ""
|
||||
},
|
||||
"target-dir": "Symfony/Component/EventDispatcher",
|
||||
"time": "2014-12-02 20:15:53",
|
||||
"type": "library",
|
||||
"version": "v2.5.8"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"homepage": "http://symfony.com/contributors",
|
||||
"name": "Symfony Community"
|
||||
},
|
||||
{
|
||||
"email": "fabien@symfony.com",
|
||||
"name": "Fabien Potencier"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"Symfony/Component/HttpFoundation/Resources/stubs"
|
||||
],
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\HttpFoundation\\": ""
|
||||
}
|
||||
},
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"dist": {
|
||||
"reference": "44dfbeb4fa64582d46c7bd59e325245d0b2b9fff",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/44dfbeb4fa64582d46c7bd59e325245d0b2b9fff"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://symfony.com",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "symfony/http-foundation",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/expression-language": "~2.4"
|
||||
},
|
||||
"source": {
|
||||
"reference": "44dfbeb4fa64582d46c7bd59e325245d0b2b9fff",
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/HttpFoundation.git"
|
||||
},
|
||||
"target-dir": "Symfony/Component/HttpFoundation",
|
||||
"time": "2014-12-02 20:15:53",
|
||||
"type": "library",
|
||||
"version": "v2.5.8"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"homepage": "http://symfony.com/contributors",
|
||||
"name": "Symfony Community"
|
||||
},
|
||||
{
|
||||
"email": "fabien@symfony.com",
|
||||
"name": "Fabien Potencier"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\HttpKernel\\": ""
|
||||
}
|
||||
},
|
||||
"description": "Symfony HttpKernel Component",
|
||||
"dist": {
|
||||
"reference": "c16051a1f3d259f806115fd9897430ae162d19a0",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/HttpKernel/zipball/c16051a1f3d259f806115fd9897430ae162d19a0"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://symfony.com",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "symfony/http-kernel",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"psr/log": "~1.0",
|
||||
"symfony/debug": "~2.5",
|
||||
"symfony/event-dispatcher": "~2.5",
|
||||
"symfony/http-foundation": "~2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/browser-kit": "~2.2",
|
||||
"symfony/class-loader": "~2.1",
|
||||
"symfony/config": "~2.0",
|
||||
"symfony/console": "~2.2",
|
||||
"symfony/dependency-injection": "~2.0",
|
||||
"symfony/expression-language": "~2.4",
|
||||
"symfony/finder": "~2.0",
|
||||
"symfony/process": "~2.0",
|
||||
"symfony/routing": "~2.2",
|
||||
"symfony/stopwatch": "~2.2",
|
||||
"symfony/templating": "~2.2"
|
||||
},
|
||||
"source": {
|
||||
"reference": "c16051a1f3d259f806115fd9897430ae162d19a0",
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/HttpKernel.git"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/browser-kit": "",
|
||||
"symfony/class-loader": "",
|
||||
"symfony/config": "",
|
||||
"symfony/console": "",
|
||||
"symfony/dependency-injection": "",
|
||||
"symfony/finder": ""
|
||||
},
|
||||
"target-dir": "Symfony/Component/HttpKernel",
|
||||
"time": "2014-12-03 14:18:17",
|
||||
"type": "library",
|
||||
"version": "v2.5.8"
|
||||
},
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"homepage": "http://symfony.com/contributors",
|
||||
"name": "Symfony Community"
|
||||
},
|
||||
{
|
||||
"email": "fabien@symfony.com",
|
||||
"name": "Fabien Potencier"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Routing\\": ""
|
||||
}
|
||||
},
|
||||
"description": "Symfony Routing Component",
|
||||
"dist": {
|
||||
"reference": "9b7d9f6121e45243cc18e4ed682d8faa418d04bc",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Routing/zipball/9b7d9f6121e45243cc18e4ed682d8faa418d04bc"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"homepage": "http://symfony.com",
|
||||
"keywords": [
|
||||
"router",
|
||||
"routing",
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "symfony/routing",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "~1.0",
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/expression-language": "~2.4",
|
||||
"symfony/http-foundation": "~2.3",
|
||||
"symfony/yaml": "~2.0"
|
||||
},
|
||||
"source": {
|
||||
"reference": "9b7d9f6121e45243cc18e4ed682d8faa418d04bc",
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Routing.git"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/annotations": "For using the annotation loader",
|
||||
"symfony/config": "For using the all-in-one router or any loader",
|
||||
"symfony/expression-language": "For using expression matching",
|
||||
"symfony/yaml": "For using the YAML loader"
|
||||
},
|
||||
"target-dir": "Symfony/Component/Routing",
|
||||
"time": "2014-12-02 20:15:53",
|
||||
"type": "library",
|
||||
"version": "v2.5.8"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"authors": [
|
||||
{
|
||||
"email": "dz@heroku.com",
|
||||
"name": "David Zuelke"
|
||||
}
|
||||
],
|
||||
"bin": [
|
||||
"bin/heroku-hhvm-apache2",
|
||||
"bin/heroku-hhvm-nginx",
|
||||
"bin/heroku-php-apache2",
|
||||
"bin/heroku-php-nginx"
|
||||
],
|
||||
"description": "Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP/HHVM and Apache2/Nginx as on Heroku",
|
||||
"dist": {
|
||||
"reference": "dcfaa2445bdd977c7ea8b38059a86ee2265e9699",
|
||||
"shasum": "",
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/dcfaa2445bdd977c7ea8b38059a86ee2265e9699"
|
||||
},
|
||||
"homepage": "http://github.com/heroku/heroku-buildpack-php",
|
||||
"keywords": [
|
||||
"apache",
|
||||
"apache2",
|
||||
"foreman",
|
||||
"heroku",
|
||||
"hhvm",
|
||||
"nginx",
|
||||
"php"
|
||||
],
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"name": "heroku/heroku-buildpack-php",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"source": {
|
||||
"reference": "dcfaa2445bdd977c7ea8b38059a86ee2265e9699",
|
||||
"type": "git",
|
||||
"url": "https://github.com/heroku/heroku-buildpack-php.git"
|
||||
},
|
||||
"time": "2014-12-11 00:24:11",
|
||||
"type": "library",
|
||||
"version": "v50"
|
||||
}
|
||||
],
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"prefer-lowest": false,
|
||||
"prefer-stable": false,
|
||||
"stability-flags": []
|
||||
}
|
||||
1
tests/apps/python-flask/CHECKS
Normal file
1
tests/apps/python-flask/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ python/flask
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "python/flask"
|
||||
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "python/flask"
|
||||
|
||||
21
tests/apps/scala/LICENSE
Normal file
21
tests/apps/scala/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Joe Kutner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
1
tests/apps/scala/Procfile
Normal file
1
tests/apps/scala/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: target/universal/stage/bin/scala-getting-started
|
||||
33
tests/apps/scala/README.md
Normal file
33
tests/apps/scala/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# scala-getting-started
|
||||
|
||||
A barebones Scala app, which can easily be deployed to Heroku.
|
||||
|
||||
This application support the [Getting Started with Scala on Heroku](https://devcenter.heroku.com/articles/getting-started-with-scala) article - check it out.
|
||||
|
||||
## Running Locally
|
||||
|
||||
Make sure you have Scala and sbt installed. Also, install the [Heroku Toolbelt](https://toolbelt.heroku.com/).
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/heroku/scala-getting-started.git
|
||||
$ cd scala-getting-started
|
||||
$ sbt compile stage
|
||||
$ foreman start web
|
||||
```
|
||||
|
||||
Your app should now be running on [localhost:5000](http://localhost:5000/).
|
||||
|
||||
## Deploying to Heroku
|
||||
|
||||
```sh
|
||||
$ heroku create
|
||||
$ git push heroku master
|
||||
$ heroku open
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
For more information about using Scala on Heroku, see these Dev Center articles:
|
||||
|
||||
- [Scala on Heroku](https://devcenter.heroku.com/categories/scala)
|
||||
|
||||
14
tests/apps/scala/build.sbt
Normal file
14
tests/apps/scala/build.sbt
Normal file
@@ -0,0 +1,14 @@
|
||||
import NativePackagerKeys._
|
||||
|
||||
packageArchetype.java_application
|
||||
|
||||
name := """scala-getting-started"""
|
||||
|
||||
version := "1.0"
|
||||
|
||||
scalaVersion := "2.10.4"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"com.twitter" % "finagle-http_2.10" % "6.18.0",
|
||||
"postgresql" % "postgresql" % "9.0-801.jdbc4"
|
||||
)
|
||||
2
tests/apps/scala/check_deploy
Executable file
2
tests/apps/scala/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello from Scala!"
|
||||
4
tests/apps/scala/project/build.properties
Normal file
4
tests/apps/scala/project/build.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
#Activator-generated Properties
|
||||
#Wed Aug 13 09:36:12 CDT 2014
|
||||
template.uuid=a855816c-0367-44ba-9adb-6a903f6ad599
|
||||
sbt.version=0.13.5
|
||||
1
tests/apps/scala/project/plugins.sbt
Normal file
1
tests/apps/scala/project/plugins.sbt
Normal file
@@ -0,0 +1 @@
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.4")
|
||||
65
tests/apps/scala/src/main/scala/com/example/Server.scala
Normal file
65
tests/apps/scala/src/main/scala/com/example/Server.scala
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.example
|
||||
|
||||
import com.twitter.finagle.{Http, Service}
|
||||
import com.twitter.util.{Await, Future}
|
||||
import com.twitter.finagle.http.Response
|
||||
import java.net.InetSocketAddress
|
||||
import org.jboss.netty.handler.codec.http._
|
||||
import util.Properties
|
||||
import java.net.URI
|
||||
import java.sql.Connection
|
||||
import java.sql.DriverManager
|
||||
|
||||
object Server {
|
||||
def main(args: Array[String]) {
|
||||
val port = Properties.envOrElse("PORT", "8080").toInt
|
||||
println("Starting on port: "+port)
|
||||
|
||||
val server = Http.serve(":" + port, new Hello)
|
||||
Await.ready(server)
|
||||
}
|
||||
}
|
||||
|
||||
class Hello extends Service[HttpRequest, HttpResponse] {
|
||||
def apply(request: HttpRequest): Future[HttpResponse] = {
|
||||
if (request.getUri.endsWith("/db")) {
|
||||
showDatabase(request);
|
||||
} else {
|
||||
showHome(request);
|
||||
}
|
||||
}
|
||||
|
||||
def showHome(request: HttpRequest): Future[HttpResponse] = {
|
||||
val response = Response()
|
||||
response.setStatusCode(200)
|
||||
response.setContentString("Hello from Scala!")
|
||||
Future(response)
|
||||
}
|
||||
|
||||
def showDatabase(request: HttpRequest): Future[HttpResponse] = {
|
||||
val connection = getConnection
|
||||
val stmt = connection.createStatement
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)")
|
||||
stmt.executeUpdate("INSERT INTO ticks VALUES (now())")
|
||||
|
||||
val rs = stmt.executeQuery("SELECT tick FROM ticks")
|
||||
|
||||
var out = ""
|
||||
while (rs.next) {
|
||||
out += "Read from DB: " + rs.getTimestamp("tick") + "\n"
|
||||
}
|
||||
|
||||
val response = Response()
|
||||
response.setStatusCode(200)
|
||||
response.setContentString(out)
|
||||
Future(response)
|
||||
}
|
||||
|
||||
def getConnection(): Connection = {
|
||||
val dbUri = new URI(System.getenv("DATABASE_URL"))
|
||||
val username = dbUri.getUserInfo.split(":")(0)
|
||||
val password = dbUri.getUserInfo.split(":")(1)
|
||||
val dbUrl = "jdbc:postgresql://" + dbUri.getHost + dbUri.getPath
|
||||
DriverManager.getConnection(dbUrl, username, password)
|
||||
}
|
||||
}
|
||||
1
tests/apps/scala/system.properties
Normal file
1
tests/apps/scala/system.properties
Normal file
@@ -0,0 +1 @@
|
||||
java.runtime.version=1.7
|
||||
1
tests/apps/static/.env
Normal file
1
tests/apps/static/.env
Normal file
@@ -0,0 +1 @@
|
||||
export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx
|
||||
1
tests/apps/static/CHECKS
Normal file
1
tests/apps/static/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ Static Page
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
set -e; output="$(curl -s $1)"; echo $output; test "$output" == "<html><h3>Static Page</h3></html>"
|
||||
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "<html><h3>Static Page</h3></html>"
|
||||
|
||||
@@ -22,7 +22,8 @@ if [[ $2 == *dokku* ]]; then
|
||||
echo "-----> Generating keypair..."
|
||||
echo -e "y\n" | ssh-keygen -f /root/.ssh/id_rsa -t rsa -N ''
|
||||
echo "-----> Installing SSH public key..."
|
||||
cat /root/.ssh/id_rsa.pub | sudo sshcommand acl-add dokku test
|
||||
PUBLIC_KEY=$(< /root/.ssh/id_rsa.pub)
|
||||
echo $PUBLIC_KEY | sudo sshcommand acl-add dokku test
|
||||
echo "-----> Intitial SSH connection to populate known_hosts..."
|
||||
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
|
||||
echo "-----> Running tests"
|
||||
|
||||
10
tests/deploy/config.bats
Normal file
10
tests/deploy/config.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy config app" {
|
||||
run bash -c "cd tests && ./test_deploy ./apps/config dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
10
tests/deploy/gitsubmodules.bats
Normal file
10
tests/deploy/gitsubmodules.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy gitsubmodules app" {
|
||||
run bash -c "cd tests && ./test_deploy ./apps/gitsubmodules dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
10
tests/deploy/go.bats
Normal file
10
tests/deploy/go.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy go app" {
|
||||
run bash -c "cd tests && ./test_deploy ./apps/go dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
10
tests/deploy/java.bats
Normal file
10
tests/deploy/java.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy java app" {
|
||||
run bash -c "cd tests && ./test_deploy ./apps/java dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
10
tests/deploy/multi.bats
Normal file
10
tests/deploy/multi.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy multi app" {
|
||||
run bash -c "cd tests && ./test_deploy ./apps/multi dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
10
tests/deploy/nodejs-express.bats
Normal file
10
tests/deploy/nodejs-express.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy nodejs-express app" {
|
||||
run bash -c "cd tests && ./test_deploy ./apps/nodejs-express dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
11
tests/deploy/php.bats
Normal file
11
tests/deploy/php.bats
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy php app" {
|
||||
skip "fails. ref: https://github.com/progrium/buildstep/issues/126"
|
||||
run bash -c "cd tests && ./test_deploy ./apps/php dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
10
tests/deploy/python-flask.bats
Normal file
10
tests/deploy/python-flask.bats
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy python-flask app" {
|
||||
run bash -c "cd tests && ./test_deploy ./apps/python-flask dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
11
tests/deploy/static.bats
Normal file
11
tests/deploy/static.bats
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load ../unit/test_helper
|
||||
|
||||
@test "deploy static app" {
|
||||
skip "fails on apt-get update..."
|
||||
run bash -c "cd tests && ./test_deploy ./apps/static dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
@@ -4,7 +4,7 @@ KEYNAME="$1"
|
||||
indent() { sed "s/^/ /"; }
|
||||
echo "-----> Booting EC2 instance..."
|
||||
start=$(ec2-run-instances -k $1 ami-f3d1bb9a 2>&1 )
|
||||
if [[ $? > 0 ]]; then
|
||||
if [[ $? -gt 0 ]]; then
|
||||
echo "$start" | indent
|
||||
exit 3
|
||||
fi
|
||||
@@ -34,9 +34,10 @@ while [[ ! $(echo | nc $PUBLIC_IP 22) ]]; do
|
||||
done
|
||||
set -e
|
||||
echo "-----> Connecting and running bootstrap script..."
|
||||
cat ../bootstrap.sh | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=$PUBLIC_IP sudo bash" 2>&1 | indent
|
||||
ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "HOSTNAME=\$PUBLIC_IP sudo bash" < ../bootstrap.sh 2>&1 | indent
|
||||
echo "-----> Installing SSH public keys..."
|
||||
cat ~/.ssh/id_rsa.pub | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "sudo sshcommand acl-add dokku test" > /dev/null
|
||||
PUBLIC_KEY=$(< ~/.ssh/id_rsa.pub)
|
||||
echo $PUBLIC_KEY | ssh -o "StrictHostKeyChecking=no" ubuntu@$PUBLIC_IP "sudo sshcommand acl-add dokku test" > /dev/null
|
||||
for app_path in apps/*; do
|
||||
app=$(basename $app_path)
|
||||
echo "-----> Running test deploy of $app..."
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
SELF=`which $0`
|
||||
SELF=$(which $0)
|
||||
VAGRANT_SSH_PORT=${VAGRANT_SSH_PORT:-"2222"}
|
||||
PUBLIC_KEY=${PUBLIC_KEY:-"$HOME/.ssh/id_rsa.pub"}
|
||||
FORWARDED_PORT=${FORWARDED_PORT:-":8080"}
|
||||
indent() { sed "s/^/ /"; }
|
||||
if [[ ! $(cat ~/.ssh/config 2>/dev/null | grep dokku.me) ]]; then
|
||||
if ! grep dokku.me ~/.ssh/config 2>/dev/null; then
|
||||
echo "-----> Configuring SSH to use $VAGRANT_SSH_PORT for dokku.me..."
|
||||
touch ~/.ssh/config
|
||||
echo "Host dokku.me" >> ~/.ssh/config
|
||||
echo " Port $VAGRANT_SSH_PORT" >> ~/.ssh/config
|
||||
echo " RequestTTY yes" >> ~/.ssh/config
|
||||
{
|
||||
echo "Host dokku.me"
|
||||
echo " Port $VAGRANT_SSH_PORT"
|
||||
echo " RequestTTY yes"
|
||||
} >> ~/.ssh/config
|
||||
fi
|
||||
echo "-----> Ensuring Vagrant is running..."
|
||||
pushd $PWD > /dev/null
|
||||
cd "$(dirname $SELF)/.." && vagrant up | indent
|
||||
cd "$(dirname $SELF)"
|
||||
popd > /dev/null
|
||||
|
||||
echo "-----> Installing SSH public keys..."
|
||||
cat $PUBLIC_KEY | ssh -o "StrictHostKeyChecking=no" -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo sshcommand acl-add dokku test"
|
||||
ssh -o "StrictHostKeyChecking=no" -i ~/.vagrant.d/insecure_private_key vagrant@dokku.me "sudo sshcommand acl-add dokku test" < $PUBLIC_KEY
|
||||
|
||||
for app_path in apps/*; do
|
||||
app=$(basename $app_path)
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -exo pipefail
|
||||
SELF=`which $0`; APP="$1"; TARGET="$2"; FORWARDED_PORT="$3"
|
||||
set -xeo pipefail
|
||||
|
||||
SELF=$(which $0); APP="$1"; TARGET="$2"; FORWARDED_PORT="$3"
|
||||
REMOTE="dokku@$TARGET"
|
||||
REPO="test-$(basename $APP)-$RANDOM"
|
||||
|
||||
destroy_app(){
|
||||
echo $REPO | ssh $REMOTE apps:destroy $REPO
|
||||
}
|
||||
|
||||
failed(){
|
||||
echo "************ $1 failed ************"
|
||||
dokku logs $REPO
|
||||
destroy_app
|
||||
exit 1
|
||||
}
|
||||
|
||||
TMP=$(mktemp -d -t "$TARGET.XXXXX")
|
||||
trap "rm -rf $TMP" EXIT
|
||||
rmdir $TMP && cp -r $(dirname $SELF)/$APP $TMP
|
||||
rmdir $TMP && cp -r "$(dirname "$SELF")"/$APP $TMP
|
||||
cd $TMP
|
||||
git init
|
||||
git config user.email "robot@example.com"
|
||||
@@ -18,14 +29,23 @@ git add .
|
||||
|
||||
[[ -x pre-commit ]] && ./pre-commit $REMOTE $REPO
|
||||
git commit -m 'initial commit'
|
||||
git push target master
|
||||
[[ -x post-deploy ]] && ./post-deploy $REMOTE $REPO
|
||||
git push target master || failed git-push
|
||||
if [[ -x post-deploy ]]; then
|
||||
./post-deploy $REMOTE $REPO || failed post-deploy
|
||||
fi
|
||||
|
||||
URL=$(ssh $REMOTE url $REPO)$FORWARDED_PORT
|
||||
URL=$(dokku url $REPO)$FORWARDED_PORT
|
||||
sleep 2
|
||||
./check_deploy $URL && echo "-----> Deploy success!" || {
|
||||
if (./check_deploy $URL); then
|
||||
echo "-----> Deploy success!"
|
||||
else
|
||||
sleep 4
|
||||
./check_deploy $URL && echo "-----> Deploy success!"
|
||||
}
|
||||
if (./check_deploy $URL); then
|
||||
echo "-----> Deploy success!"
|
||||
else
|
||||
failed check-deploy
|
||||
fi
|
||||
fi
|
||||
|
||||
ssh $REMOTE delete $REPO
|
||||
dokku logs $REPO
|
||||
destroy_app
|
||||
|
||||
37
tests/unit/00_dokku-standard.bats
Normal file
37
tests/unit/00_dokku-standard.bats
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf /home/dokku/$TEST_APP/tls /home/dokku/tls
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "urls (non-ssl)" {
|
||||
run bash -c "dokku urls $TEST_APP | grep dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output "http://dokku.me"
|
||||
}
|
||||
|
||||
@test "urls (app ssl)" {
|
||||
mkdir -p /home/dokku/$TEST_APP/tls
|
||||
touch /home/dokku/$TEST_APP/tls/server.crt /home/dokku/$TEST_APP/tls/server.key
|
||||
run bash -c "dokku urls $TEST_APP | grep dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output "https://dokku.me"
|
||||
}
|
||||
|
||||
@test "urls (wildcard ssl)" {
|
||||
mkdir -p /home/dokku/tls
|
||||
touch /home/dokku/tls/server.crt /home/dokku/tls/server.key
|
||||
run bash -c "dokku urls $TEST_APP | grep dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output "https://dokku.me"
|
||||
}
|
||||
26
tests/unit/apps.bats
Executable file
26
tests/unit/apps.bats
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
APP=lifecycle-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 "echo $APP | dokku apps:destroy $APP"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
20
tests/unit/backup.bats
Normal file
20
tests/unit/backup.bats
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
# load test_helper
|
||||
|
||||
# setup() {
|
||||
# create_app
|
||||
# backup_file=$(mktemp /tmp/backup.XXXXXX)
|
||||
# rm $backup_file
|
||||
# }
|
||||
|
||||
# teardown() {
|
||||
# destroy_app
|
||||
# }
|
||||
|
||||
# @test "backup:export" {
|
||||
# run dokku backup:export $backup_file
|
||||
# echo "output: "$output
|
||||
# echo "status: "$status
|
||||
# assert_success
|
||||
# }
|
||||
21
tests/unit/build-env.bats
Normal file
21
tests/unit/build-env.bats
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "build-env with special chars" {
|
||||
run dokku config:set $TEST_APP NEWRELIC_APP_NAME="$TEST_APP (Staging)"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
deploy_app
|
||||
run dokku config $TEST_APP
|
||||
assert_success
|
||||
}
|
||||
44
tests/unit/config.bats
Normal file
44
tests/unit/config.bats
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "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" {
|
||||
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
run dokku config:get $TEST_APP test_var2
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output 'hello world'
|
||||
}
|
||||
|
||||
@test "config:unset" {
|
||||
run ssh dokku@dokku.me config:set $TEST_APP test_var=true test_var2=\"hello world\"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
run dokku config:get $TEST_APP test_var
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
run dokku config:unset $TEST_APP test_var
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
run dokku config:get $TEST_APP test_var
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output ""
|
||||
}
|
||||
51
tests/unit/domains.bats
Normal file
51
tests/unit/domains.bats
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "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" {
|
||||
run dokku domains:add $TEST_APP www.test.app.dokku.me
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run dokku domains:add $TEST_APP test.app.dokku.me
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "domains:remove" {
|
||||
run dokku domains:add $TEST_APP test.app.dokku.me
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run dokku domains:remove $TEST_APP test.app.dokku.me
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
refute_line "test.app.dokku.me"
|
||||
}
|
||||
|
||||
@test "domains:clear" {
|
||||
run dokku domains:add $TEST_APP test.app.dokku.me
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run dokku domains:clear $TEST_APP
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
48
tests/unit/nginx-vhosts.bats
Normal file
48
tests/unit/nginx-vhosts.bats
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
[[ -f "$DOKKU_ROOT/VHOST" ]] && cp -f "$DOKKU_ROOT/VHOST" "$DOKKU_ROOT/VHOST.bak"
|
||||
[[ -f "$DOKKU_ROOT/HOSTNAME" ]] && cp -f "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/HOSTNAME.bak"
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST"
|
||||
[[ -f "$DOKKU_ROOT/HOSTNAME.bak" ]] && mv "$DOKKU_ROOT/HOSTNAME.bak" "$DOKKU_ROOT/HOSTNAME"
|
||||
}
|
||||
|
||||
@test "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
|
||||
echo "status: "$status
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "nginx:build-config (with SSL CN mismatch)" {
|
||||
setup_test_tls
|
||||
deploy_app
|
||||
run /bin/bash -c "dokku domains $TEST_APP | grep node-js-app.dokku.me"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output "node-js-app.dokku.me"
|
||||
}
|
||||
|
||||
@test "nginx:build-config (no global VHOST and domains:add)" {
|
||||
destroy_app
|
||||
rm "$DOKKU_ROOT/VHOST"
|
||||
create_app
|
||||
run dokku domains:add $TEST_APP www.test.app.dokku.me
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
deploy_app
|
||||
sleep 5 # wait for nginx to reload
|
||||
run bash -c "response=\"$(curl -s -S www.test.app.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user