mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #821 from expa/mh-unit-tests
use wercker for automated testing
This commit is contained in:
@@ -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
|
||||
|
||||
15
Makefile
15
Makefile
@@ -3,7 +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
|
||||
PREBUILT_STACK_URL ?= https://github.com/progrium/buildstep/releases/download/2014-12-16/2014-12-16_42bd9f4aab.tar.gz
|
||||
DOKKU_ROOT ?= /home/dokku
|
||||
PLUGINS_PATH ?= /var/lib/dokku/plugins
|
||||
|
||||
@@ -17,6 +17,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 +29,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
|
||||
@@ -72,7 +74,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 +110,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://app.wercker.com/project/bykey/029900380b7e5f31bbf4392725067769)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
|
||||
|
||||
|
||||
@@ -16,9 +16,10 @@ 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
|
||||
|
||||
|
||||
28
dokku
28
dokku
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
|
||||
export DOKKU_IMAGE=${DOKKU_IMAGE:="progrium/buildstep"}
|
||||
@@ -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)
|
||||
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
|
||||
@@ -143,8 +149,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 +169,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 +182,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -24,7 +24,7 @@ case "$1" in
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
|
||||
if [[ ! -n "$NO_VHOST" ]]; then
|
||||
NONSSL_VHOSTS=`cat $VHOST_PATH`
|
||||
NONSSL_VHOSTS=$(cat $VHOST_PATH)
|
||||
if [[ -e "$SSL/server.crt" ]] && [[ -e "$SSL/server.key" ]]; then
|
||||
SSL_INUSE="$SSL"
|
||||
SSL_DIRECTIVES=$(cat <<EOF
|
||||
@@ -43,10 +43,10 @@ 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')
|
||||
SSL_VHOSTS=$(egrep ^"$SSL_HOSTNAME"$ $VHOST_PATH)
|
||||
NONSSL_VHOSTS=$(egrep -v ^"$SSL_HOSTNAME"$ $VHOST_PATH || exit 0)
|
||||
|
||||
while read line; do
|
||||
echo "-----> Configuring SSL for $line..."
|
||||
@@ -61,9 +61,9 @@ 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
|
||||
@@ -95,7 +95,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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
116
tests.mk
Normal file
116
tests.mk
Normal file
@@ -0,0 +1,116 @@
|
||||
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\" >> /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),)
|
||||
@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
|
||||
@echo linting...
|
||||
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | xargs shellcheck -e SC2034,SC2086,SC2143
|
||||
|
||||
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 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 app...
|
||||
cd tests && ./test_deploy ./apps/nodejs-express 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-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
|
||||
# broken with new buildstep.
|
||||
# ref: https://github.com/progrium/dokku/issues/832
|
||||
# ref: https://github.com/heroku/heroku-buildpack-ruby/pull/319
|
||||
# @$(QUIET) $(MAKE) deploy-test-multi
|
||||
@$(QUIET) $(MAKE) deploy-test-nodejs-express
|
||||
@$(QUIET) $(MAKE) deploy-test-php
|
||||
@$(QUIET) $(MAKE) deploy-test-python-flask
|
||||
@$(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
|
||||
@@ -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/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>"
|
||||
|
||||
9
tests/apps/php/composer.json
Normal file
9
tests/apps/php/composer.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"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"
|
||||
|
||||
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 -eo 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
|
||||
|
||||
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
|
||||
# }
|
||||
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() {
|
||||
deploy_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
|
||||
}
|
||||
103
tests/unit/test_helper.bash
Normal file
103
tests/unit/test_helper.bash
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# constants
|
||||
TEST_APP=my-cool-guy-test-app
|
||||
|
||||
# test functions
|
||||
flunk() {
|
||||
{ if [ "$#" -eq 0 ]; then cat -
|
||||
else echo "$*"
|
||||
fi
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
assert_success() {
|
||||
if [ "$status" -ne 0 ]; then
|
||||
flunk "command failed with exit status $status"
|
||||
elif [ "$#" -gt 0 ]; then
|
||||
assert_output "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_failure() {
|
||||
if [ "$status" -eq 0 ]; then
|
||||
flunk "expected failed exit status"
|
||||
elif [ "$#" -gt 0 ]; then
|
||||
assert_output "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
assert_equal() {
|
||||
if [ "$1" != "$2" ]; then
|
||||
{ echo "expected: $1"
|
||||
echo "actual: $2"
|
||||
} | flunk
|
||||
fi
|
||||
}
|
||||
|
||||
assert_output() {
|
||||
local expected
|
||||
if [ $# -eq 0 ]; then expected="$(cat -)"
|
||||
else expected="$1"
|
||||
fi
|
||||
assert_equal "$expected" "$output"
|
||||
}
|
||||
|
||||
assert_line() {
|
||||
if [ "$1" -ge 0 ] 2>/dev/null; then
|
||||
assert_equal "$2" "${lines[$1]}"
|
||||
else
|
||||
local line
|
||||
for line in "${lines[@]}"; do
|
||||
if [ "$line" = "$1" ]; then return 0; fi
|
||||
done
|
||||
flunk "expected line \`$1'"
|
||||
fi
|
||||
}
|
||||
|
||||
refute_line() {
|
||||
if [ "$1" -ge 0 ] 2>/dev/null; then
|
||||
local num_lines="${#lines[@]}"
|
||||
if [ "$1" -lt "$num_lines" ]; then
|
||||
flunk "output has $num_lines lines"
|
||||
fi
|
||||
else
|
||||
local line
|
||||
for line in "${lines[@]}"; do
|
||||
if [ "$line" = "$1" ]; then
|
||||
flunk "expected to not find line \`$line'"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
assert() {
|
||||
if ! "$*"; then
|
||||
flunk "failed: $*"
|
||||
fi
|
||||
}
|
||||
|
||||
# dokku functions
|
||||
create_app() {
|
||||
dokku apps:create $TEST_APP
|
||||
}
|
||||
|
||||
destroy_app() {
|
||||
echo $TEST_APP | dokku apps:destroy $TEST_APP
|
||||
}
|
||||
|
||||
deploy_app() {
|
||||
TMP=$(mktemp -d -t "$TARGET.XXXXX")
|
||||
rmdir $TMP && cp -r ./tests/apps/config $TMP
|
||||
cd $TMP
|
||||
git init
|
||||
git config user.email "robot@example.com"
|
||||
git config user.name "Test Robot"
|
||||
git remote add target dokku@dokku.me:$TEST_APP
|
||||
|
||||
[[ -f gitignore ]] && mv gitignore .gitignore
|
||||
git add .
|
||||
git commit -m 'initial commit'
|
||||
git push target master || destroy_app
|
||||
}
|
||||
33
wercker.yml
Normal file
33
wercker.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
box: wercker-labs/docker
|
||||
no-response-timeout: 20
|
||||
build:
|
||||
steps:
|
||||
- script:
|
||||
name: install os requirements
|
||||
code: |-
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y make software-properties-common git wget man-db
|
||||
- script:
|
||||
name: ci dependencies
|
||||
code: make -e ci-dependencies
|
||||
- script:
|
||||
name: install dokku
|
||||
code: sudo -E CI=true DOCKER_VERSION=1.4.0 make -e install
|
||||
- script:
|
||||
name: setup deploy tests
|
||||
code: sudo -E make -e setup-deploy-tests
|
||||
- script:
|
||||
name: lint
|
||||
code: sudo -E make -e lint
|
||||
- script:
|
||||
name: unit tests
|
||||
code: sudo -E make -e unit-tests
|
||||
- script:
|
||||
name: deploy tests (against buildstep release)
|
||||
code: sudo -E make -e deploy-tests
|
||||
- script:
|
||||
name: deploy tests (against buildstep master)
|
||||
code: |-
|
||||
sudo docker rmi -f progrium/buildstep
|
||||
sudo -E BUILD_STACK=true make -e stack
|
||||
sudo -E make -e deploy-tests
|
||||
Reference in New Issue
Block a user