Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5606a308b6 | ||
|
|
9980b74688 | ||
|
|
414b1fd744 | ||
|
|
b99e26811b | ||
|
|
2e69ff6041 | ||
|
|
d9a989d6b0 | ||
|
|
75180f7f9b | ||
|
|
fc466e2c05 | ||
|
|
a54f9ebc7c | ||
|
|
c5337cf6a2 | ||
|
|
b0189049b7 | ||
|
|
fc4699dee9 | ||
|
|
d9334900fb | ||
|
|
f92d8d9a6a | ||
|
|
b836c1f65a | ||
|
|
02277cc411 | ||
|
|
495994daf0 | ||
|
|
56d0af02c4 | ||
|
|
1a70dd1707 | ||
|
|
e9ddde8a82 | ||
|
|
da92419023 | ||
|
|
4aa970ace8 | ||
|
|
a36aaab686 | ||
|
|
c1d901723d | ||
|
|
952ff31189 | ||
|
|
713a8d4f31 | ||
|
|
42712f8896 | ||
|
|
e0adfd035f | ||
|
|
379ee525a8 | ||
|
|
b9e7a09f4c | ||
|
|
a6c7cc50ce | ||
|
|
981e857ab1 | ||
|
|
c8c4a6a0c6 | ||
|
|
383deb2b1b | ||
|
|
9fdff11687 | ||
|
|
2f0f2889db | ||
|
|
dce031d38d | ||
|
|
31fafe55d3 | ||
|
|
833f308d2f | ||
|
|
0c715d4b39 | ||
|
|
a529f6fce8 | ||
|
|
0d838d1248 | ||
|
|
3d2af158ff | ||
|
|
5968e81b17 | ||
|
|
3aa5231f7e | ||
|
|
3c056527e8 | ||
|
|
0fe3d92fd7 | ||
|
|
2b8ea890ad | ||
|
|
9242a5dd31 | ||
|
|
d960b9c246 | ||
|
|
9f7a33ca3e | ||
|
|
4d7671dee3 | ||
|
|
f55e047619 | ||
|
|
661b6706de | ||
|
|
a8f08bd5a8 | ||
|
|
b299f66c28 | ||
|
|
b5495ed0c3 | ||
|
|
99c9bb2863 | ||
|
|
d6aa8d59f1 | ||
|
|
d9d3a16e5c | ||
|
|
5105c4f71d | ||
|
|
23a6656566 | ||
|
|
a2ed0ef2b6 | ||
|
|
e2d3107e8a | ||
|
|
0e5bc10ae7 | ||
|
|
b3053fe392 | ||
|
|
12ee6953bb | ||
|
|
9dfa7ccee6 | ||
|
|
45e53d3d9d | ||
|
|
ea7e3dc61d | ||
|
|
50fe9e39ad | ||
|
|
9312a99664 | ||
|
|
d8f69746bb | ||
|
|
e45db108d8 | ||
|
|
845c7e7dea | ||
|
|
e33d17b7dd | ||
|
|
96c6d46dd1 | ||
|
|
30f9ab740d | ||
|
|
5224a6c678 | ||
|
|
bc8750ebe3 |
1
AUTHORS
1
AUTHORS
@@ -1,6 +1,7 @@
|
||||
# If you're submitting a patch, please add your name here in alphabetical order as part of the patch.
|
||||
# This file lists all individuals having contributed content to the repository.
|
||||
#
|
||||
3onyc <3onyc@x3tech.com>
|
||||
Alexander <iam.asm89@gmail.com>
|
||||
Alexander Beletsky <alexander.beletsky@gmail.com>
|
||||
Alexis Gavoty <kload@kload.fr>
|
||||
|
||||
26
HISTORY.md
26
HISTORY.md
@@ -1,5 +1,31 @@
|
||||
# History
|
||||
|
||||
## 0.3.18
|
||||
|
||||
- #1111: @michaelhobbs Call pre-build-dockerfile before docker build
|
||||
- #1119: @joshco Logging info suggesting tuned CHECKS
|
||||
- #1120: @josegonzalez [docs] Add freenode shield to readme
|
||||
- #1121: @josegonzalez Prompt users to run the web installer via MOTD. Closes #943
|
||||
- #1129: @josegonzalez Validate nginx configuration before restarting nginx
|
||||
- #1137: @YellowApple [docs] Safer installation method
|
||||
- #1138: @chrisbutcher [docs] Include tip about using sshcommand acl-add
|
||||
- #1140: @NigelThorne [docs] Replaced reference to gitreceive with sshcommand as per #746
|
||||
- #1144: @protonet Allow git-remote with different port
|
||||
- #1145: @michaelhobbs allow docker-options over ssh. plus test. closes #1135
|
||||
- #1146: @michaelhobbs Don't re-deploy on domains:add. allow multple domains on command line. Closes #1142
|
||||
- #1147: @michaelhobbs Utilize all 4 free CircleCI containers
|
||||
- #1148: @TheEmpty [docs] Add information about 444 for nginx in default_sever.
|
||||
- #1150: @cjblomqvist [docs] Add monit plugin
|
||||
- #1151: @LTe Do not kill docker container with SIGKILL
|
||||
- #1153: @econya [docs] Add README-section: how to contribute
|
||||
- #1058: @josegonzalez Move bootstrap script to use debian package where possible
|
||||
- #1171: @josegonzalez Use debconf for package configuration
|
||||
- #1172: @michaelhobbs unify default and custom nginx template processing
|
||||
- #1173: @josegonzalez [docs] standardize readme badges
|
||||
- #1178: @jagandecapri [docs] Update plugins.md
|
||||
- #1189: @vincentfretin wait 30 seconds and not 30 minutes
|
||||
- #1190: @josegonzalez Fix docker gpg key installation
|
||||
|
||||
## 0.3.17
|
||||
|
||||
- #1056: @joshco New check retries feature
|
||||
|
||||
12
Makefile
12
Makefile
@@ -14,7 +14,7 @@ ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
|
||||
$(eval $(RUN_ARGS):;@:)
|
||||
endif
|
||||
|
||||
.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
.PHONY: all apt-update install copyfiles man-db version plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
|
||||
|
||||
include tests.mk
|
||||
include deb.mk
|
||||
@@ -61,12 +61,18 @@ plugin-dependencies: pluginhook
|
||||
plugins: pluginhook docker
|
||||
dokku plugins-install
|
||||
|
||||
dependencies: sshcommand pluginhook docker help2man
|
||||
dependencies: apt-update sshcommand pluginhook docker help2man man-db
|
||||
$(MAKE) -e stack
|
||||
|
||||
apt-update:
|
||||
apt-get update
|
||||
|
||||
help2man:
|
||||
apt-get install -qq -y help2man
|
||||
|
||||
man-db:
|
||||
apt-get install -qq -y man-db
|
||||
|
||||
sshcommand:
|
||||
wget -qO /usr/local/bin/sshcommand ${SSHCOMMAND_URL}
|
||||
chmod +x /usr/local/bin/sshcommand
|
||||
@@ -80,7 +86,7 @@ docker: aufs
|
||||
apt-get install -qq -y curl
|
||||
egrep -i "^docker" /etc/group || groupadd docker
|
||||
usermod -aG docker dokku
|
||||
curl --silent https://get.docker.com/gpg | apt-key add -
|
||||
curl -sSL https://get.docker.com/gpg | apt-key add -
|
||||
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
|
||||
apt-get update
|
||||
ifdef DOCKER_VERSION
|
||||
|
||||
13
README.md
13
README.md
@@ -1,4 +1,4 @@
|
||||
# Dokku [](https://circleci.com/gh/progrium/dokku/tree/master) [](https://packagecloud.io/dokku/dokku)
|
||||
# Dokku [](https://circleci.com/gh/progrium/dokku/tree/master) [](https://packagecloud.io/dokku/dokku) [](https://webchat.freenode.net/?channels=dokku) [](http://progrium.viewdocs.io/dokku/index)
|
||||
|
||||
Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. Sponsored by our friends at [Deis](http://deis.io/).
|
||||
|
||||
@@ -8,9 +8,10 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S
|
||||
|
||||
## Installing
|
||||
|
||||
To install the latest stable release, you can run the following command as a user that has access to `sudo`:
|
||||
To install the latest stable release, you can run the following commands as a user that has access to `sudo`:
|
||||
|
||||
wget -qO- https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh | sudo DOKKU_TAG=v0.3.17 bash
|
||||
wget https://raw.github.com/progrium/dokku/v0.3.18/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.3.18 bash bootstrap.sh
|
||||
|
||||
### Upgrading
|
||||
|
||||
@@ -24,6 +25,12 @@ Full documentation - including advanced installation docs - are available online
|
||||
|
||||
You can use [Github Issues](https://github.com/progrium/dokku/issues), check [Troubleshooting](http://progrium.viewdocs.io/dokku/troubleshooting) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku)
|
||||
|
||||
## Contribution
|
||||
|
||||
After checking [Github Issues](https://github.com/progrium/dokku/issues), the [Troubleshooting Guide](http://progrium.viewdocs.io/dokku/troubleshooting) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request.
|
||||
|
||||
While we may not merge your PR as is, they serve to start conversations and improve the general dokku experience for all users.
|
||||
|
||||
## Sponsors
|
||||
|
||||
Dokku is currently sponsored by the enterprise grade, multi-host PaaS project [Deis](http://deis.io/).
|
||||
|
||||
10
Vagrantfile
vendored
10
Vagrantfile
vendored
@@ -1,8 +1,7 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
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_NAME = ENV["BOX_NAME"] || "chef/ubuntu-14.04"
|
||||
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
|
||||
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
|
||||
DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2"
|
||||
@@ -19,7 +18,6 @@ Vagrant::configure("2") do |config|
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
config.vm.box = BOX_NAME
|
||||
config.vm.box_url = BOX_URI
|
||||
config.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
@@ -36,12 +34,12 @@ Vagrant::configure("2") do |config|
|
||||
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
|
||||
vm.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
vm.vm.network :private_network, ip: DOKKU_IP
|
||||
vm.vm.provision :shell, :inline => "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make dokku-installer"
|
||||
end
|
||||
|
||||
config.vm.define "dokku-deb", autostart: false do |vm|
|
||||
vm.vm.network :forwarded_port, guest: 80, host: ENV['FORWARDED_PORT']
|
||||
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
|
||||
vm.vm.hostname = "#{DOKKU_DOMAIN}"
|
||||
vm.vm.network :private_network, ip: DOKKU_IP
|
||||
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
|
||||
@@ -54,6 +52,6 @@ Vagrant::configure("2") do |config|
|
||||
|
||||
if Pathname.new(PUBLIC_KEY_PATH).exist?
|
||||
config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub'
|
||||
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
|
||||
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && mkdir -p /root/.ssh && sudo cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
|
||||
end
|
||||
end
|
||||
|
||||
68
bootstrap.sh
68
bootstrap.sh
@@ -1,37 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
#
|
||||
# A script to bootstrap dokku.
|
||||
# It expects to be run on Ubuntu 14.04 via 'sudo'
|
||||
# If installing a tag higher than 0.3.13, it may install dokku via a package (so long as the package is higher than 0.3.13)
|
||||
# It checks out the dokku source code from Github into ~/dokku and then runs 'make install' from dokku source.
|
||||
|
||||
set -eo pipefail
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/progrium/dokku.git"}
|
||||
|
||||
if ! command -v apt-get &>/dev/null
|
||||
then
|
||||
if ! command -v apt-get &>/dev/null; then
|
||||
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 help2man
|
||||
|
||||
[[ $(lsb_release -sr) == "12.04" ]] && apt-get install -qq -y python-software-properties
|
||||
|
||||
cd ~
|
||||
test -d dokku || git clone $DOKKU_REPO
|
||||
cd dokku
|
||||
git fetch origin
|
||||
dokku_install_source() {
|
||||
apt-get install -qq -y git make software-properties-common
|
||||
cd /root
|
||||
if [ ! -d /root/dokku ]; then
|
||||
git clone $DOKKU_REPO /root/dokku
|
||||
fi
|
||||
|
||||
cd /root/dokku
|
||||
git fetch origin
|
||||
git checkout $DOKKU_CHECKOUT
|
||||
make install
|
||||
}
|
||||
|
||||
dokku_install_package() {
|
||||
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -qq -y "linux-image-extra-$(uname -r)" apt-transport-https
|
||||
|
||||
if [[ -n $DOKKU_CHECKOUT ]]; then
|
||||
sudo apt-get install -qq -y dokku=$DOKKU_CHECKOUT
|
||||
else
|
||||
sudo apt-get install -qq -y dokku
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -n $DOKKU_BRANCH ]]; then
|
||||
git checkout origin/$DOKKU_BRANCH
|
||||
export DOKKU_CHECKOUT="origin/$DOKKU_BRANCH"
|
||||
dokku_install_source
|
||||
elif [[ -n $DOKKU_TAG ]]; then
|
||||
git checkout $DOKKU_TAG
|
||||
export DOKKU_SEMVER="${DOKKU_TAG//v}"
|
||||
major=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[1]}')
|
||||
minor=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[2]}')
|
||||
patch=$(echo $DOKKU_SEMVER | awk '{split($0,a,"."); print a[3]}')
|
||||
|
||||
# 0.3.13 was the first version with a debian package
|
||||
if [[ "$major" -eq "0" ]] && [[ "$minor" -lt "4" ]] && [[ "$patch" -lt "13" ]]; then
|
||||
export DOKKU_CHECKOUT="$DOKKU_TAG"
|
||||
dokku_install_source
|
||||
else
|
||||
export DOKKU_CHECKOUT="$DOKKU_SEMVER"
|
||||
dokku_install_package
|
||||
fi
|
||||
else
|
||||
dokku_install_package
|
||||
fi
|
||||
|
||||
make install
|
||||
|
||||
echo
|
||||
echo "Almost done! For next steps on configuration:"
|
||||
echo " http://progrium.viewdocs.io/dokku/advanced-installation#user-content-configuring"
|
||||
|
||||
|
||||
14
circle.yml
14
circle.yml
@@ -5,19 +5,9 @@ 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.5.0 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
|
||||
- ./tests/ci/parallel_runner.sh setup: { timeout: 300 }
|
||||
post:
|
||||
- sudo -E make -e lint
|
||||
test:
|
||||
override:
|
||||
- ./tests/ci/parallel_runner.sh: { parallel: true, timeout: 1800 }
|
||||
- ./tests/ci/parallel_runner.sh testing: { parallel: true, timeout: 1800 }
|
||||
|
||||
@@ -21,7 +21,7 @@ if ARGV[0] == "onboot"
|
||||
exit
|
||||
end
|
||||
|
||||
version = "v0.3.17"
|
||||
version = "v0.3.18"
|
||||
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
|
||||
|
||||
@@ -137,10 +137,10 @@ function install_prerequisites {
|
||||
sudo apt-get install -qq -y curl > /dev/null 2>&1
|
||||
|
||||
logit "Installing docker gpg key"
|
||||
curl --silent https://get.docker.com/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
curl -sSL https://get.docker.com/gpg 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
logit "Installing dokku gpg key"
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
curl -sSL https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - > /dev/null 2>&1
|
||||
|
||||
logit "Running apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
|
||||
6
deb.mk
6
deb.mk
@@ -31,10 +31,10 @@ GOPATH = /home/vagrant/gocode
|
||||
install-from-deb:
|
||||
echo "--> Initial apt-get update"
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -y apt-transport-https
|
||||
sudo apt-get install -y apt-transport-https curl
|
||||
|
||||
echo "--> Installing docker gpg key"
|
||||
curl --silent https://get.docker.com/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
curl -sSL https://get.docker.com/gpg | apt-key add -
|
||||
|
||||
echo "--> Installing dokku gpg key"
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
@@ -61,7 +61,7 @@ deb-all: deb-buildstep deb-dokku deb-gems deb-pluginhook deb-sshcommand
|
||||
deb-setup:
|
||||
echo "-> Updating deb repository and installing build requirements"
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -qq -y git ruby1.9.1-dev 2>&1 > /dev/null
|
||||
sudo apt-get install -qq -y gcc git ruby1.9.1-dev 2>&1 > /dev/null
|
||||
command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
|
||||
ssh -o StrictHostKeyChecking=no git@github.com || true
|
||||
|
||||
|
||||
21
debian/config
vendored
Executable file
21
debian/config
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
readonly ACTION="${1:-configure}"
|
||||
readonly VERSION="${2:-dev}"
|
||||
|
||||
db_input "high" "dokku/web_config" || true
|
||||
db_go || true
|
||||
|
||||
db_get "dokku/web_config"
|
||||
if [ $RET = "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
db_input "high" "dokku/hostname" || true
|
||||
db_input "high" "dokku/vhost_enable" || true
|
||||
if [ "$ACTION" != "reconfigure" ]; then
|
||||
db_input "high" "dokku/key_file" || true
|
||||
fi
|
||||
db_go || true
|
||||
25
debian/postinst
vendored
25
debian/postinst
vendored
@@ -1,6 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
|
||||
|
||||
case "$1" in
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
@@ -19,6 +23,27 @@ case "$1" in
|
||||
if [ -f /etc/init/dokku-installer.conf ] && service dokku-installer status 2> /dev/null | grep waiting; then
|
||||
sudo service dokku-installer start
|
||||
fi
|
||||
|
||||
db_get "dokku/web_config"
|
||||
if [ "$RET" = "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
db_get "dokku/vhost_enable"
|
||||
if [ "$RET" = "true" ]; then
|
||||
db_get "dokku/hostname"
|
||||
echo "$RET" > "${DOKKU_ROOT}/VHOST"
|
||||
else
|
||||
rm -f "${DOKKU_ROOT}/VHOST"
|
||||
fi
|
||||
|
||||
db_get "dokku/hostname"
|
||||
echo "$RET" > "${DOKKU_ROOT}/HOSTNAME"
|
||||
|
||||
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
|
||||
db_get "dokku/key_file"
|
||||
sshcommand acl-add dokku default < "$RET"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
17
debian/preinst
vendored
17
debian/preinst
vendored
@@ -1,8 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
case "$1" in
|
||||
install)
|
||||
if [ -z "${DEBCONF_RECONFIGURE}" ]; then
|
||||
db_get "dokku/key_file"
|
||||
if [ ! -f "$RET" ]; then
|
||||
echo "Error: keyfile '$RET' not found."
|
||||
echo " you can enter a new keyfile path when you restart the installation."
|
||||
db_reset "dokku/key_file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
db_get "dokku/web_config"
|
||||
if [ "$RET" = "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
INIT_CONF="/etc/init/dokku-installer.conf"
|
||||
NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf"
|
||||
|
||||
|
||||
19
debian/templates
vendored
Normal file
19
debian/templates
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Template: dokku/web_config
|
||||
Description: Use the web-based config page?
|
||||
Type: boolean
|
||||
Default: true
|
||||
|
||||
Template: dokku/vhost_enable
|
||||
Description: Use vhost based deployments?
|
||||
Type: boolean
|
||||
Default: false
|
||||
|
||||
Template: dokku/hostname
|
||||
Description: Machine's hostname or IP
|
||||
Type: string
|
||||
Default: dokku.me
|
||||
|
||||
Template: dokku/key_file
|
||||
Description: Keyfile for initial user
|
||||
Type: string
|
||||
Default: /root/.ssh/id_rsa.pub
|
||||
@@ -3,7 +3,7 @@
|
||||
You can always install dokku straight from the latest - potentially unstable - master release via the following bash command:
|
||||
|
||||
```shell
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
|
||||
wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo DOKKU_BRANCH=master bash
|
||||
```
|
||||
|
||||
## Development
|
||||
@@ -19,7 +19,7 @@ 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
|
||||
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
|
||||
```
|
||||
|
||||
## Bootstrap a server from your own repository
|
||||
@@ -29,7 +29,7 @@ The bootstrap script allows the dokku repository URL to be overridden to bootstr
|
||||
```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
|
||||
sudo DOKKU_REPO=https://github.com/yourusername/dokku.git DOKKU_BRANCH=master ./bootstrap.sh
|
||||
```
|
||||
|
||||
## Custom buildstep build
|
||||
|
||||
@@ -28,6 +28,14 @@ Dokku only supports deploying from its master branch, so if you'd like to deploy
|
||||
Right now Buildstep supports buildpacks for Node.js, Ruby, Python, [and more](https://github.com/progrium/buildstep#supported-buildpacks). It's not hard to add more, [go add more](https://github.com/progrium/buildstep#adding-buildpacks)!
|
||||
Please check the documentation for your particular build pack as you may need to include configuration files (such as a Procfile) in your project root.
|
||||
|
||||
## Deploying to server over SSH
|
||||
|
||||
Pushing to the dokku remote may prompt you to input a password for the dokku user. It's preferable, however, to use key-based authentication, and you can add your public key to the dokku user's authorized_keys file with:
|
||||
|
||||
```
|
||||
cat ~/.ssh/id_rsa.pub | ssh [sudouser]@[yourdomain].com "sudo sshcommand acl-add dokku [description]"
|
||||
```
|
||||
|
||||
## Deploying with private git submodules
|
||||
|
||||
Dokku uses git locally (i.e. not a docker image) to build its own copy of your app repo, including submodules. This is done as the `dokku` user. Therefore, in order to deploy private git submodules, you'll need to drop your deploy key in `~dokku/.ssh` and potentially add github.com (or your VCS host key) into `~dokku/.ssh/known_hosts`. A decent test like this should help confirm you've done it correctly.
|
||||
|
||||
@@ -20,7 +20,7 @@ that include the hostname, for example:
|
||||
You can also specify the protocol to explicitly check HTTPS requests.
|
||||
|
||||
The default behavior is to wait for 5 seconds before running the first check,
|
||||
and timeout each check to 30 minutes.
|
||||
and timeout each check to 30 seconds.
|
||||
|
||||
By default, checks will be attempted 5 times. (Retried 4 times)
|
||||
|
||||
|
||||
36
docs/getting-started/install/debian.md
Normal file
36
docs/getting-started/install/debian.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Debian Package Installation Notes
|
||||
|
||||
As of 0.3.18, dokku defaults to being installed via debian package. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script:
|
||||
|
||||
```shell
|
||||
curl --silent https://get.docker.io/gpg 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
curl --silent https://packagecloud.io/gpg.key 2> /dev/null | apt-key add - 2>&1 >/dev/null
|
||||
|
||||
echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list
|
||||
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ trusty main" > /etc/apt/sources.list.d/dokku.list
|
||||
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get install -qq -y linux-image-extra-`uname -r` apt-transport-https
|
||||
sudo apt-get install -qq -y dokku
|
||||
```
|
||||
|
||||
## Unattended installation
|
||||
|
||||
In case you want to perform an unattended installation of dokku, this is made possible through [debconf](https://en.wikipedia.org/wiki/Debconf_%28software_package%29), which allows you to configure a package before installing it.
|
||||
|
||||
You can set any of the below options through the `debconf-set-selections` command, for example to enable vhost-based deployments:
|
||||
|
||||
```bash
|
||||
echo "dokku dokku/vhost_enable boolean true" | debconf-set-selections
|
||||
```
|
||||
|
||||
After setting the desired options, proceed with the installation as described above.
|
||||
|
||||
### debconf options
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------------ | ------- | --------------------- | ------------------------------------------------------------------------ |
|
||||
| dokku/web_config | boolean | true | Use web-based config for below options |
|
||||
| dokku/vhost_enable | boolean | false | Use vhost-based deployments (e.g. <app>.dokku.me) |
|
||||
| dokku/hostname | string | dokku.me | Hostname, used as vhost domain and for showing app URL after deploy |
|
||||
| dokku/key_file | string | /root/.ssh/id_rsa.pub | SSH key to add to the Dokku user (Will be ignored on `dpkg-reconfigure`) |
|
||||
@@ -11,13 +11,9 @@ 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
|
||||
# This may need to be run twice
|
||||
wget -qO- https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh | sudo DOKKU_TAG=v0.3.17 bash
|
||||
|
||||
# Install the web installer. See `Configuring` under
|
||||
# `Advanced Install Customization` if you wish to perform the
|
||||
# rest of the install via CLI
|
||||
cd /root/dokku && make dokku-installer
|
||||
# installs dokku via apt-get
|
||||
wget https://raw.github.com/progrium/dokku/v0.3.18/bootstrap.sh
|
||||
sudo DOKKU_TAG=v0.3.18 bash bootstrap.sh
|
||||
|
||||
# Go to your server's IP and follow the web installer
|
||||
```
|
||||
@@ -29,5 +25,6 @@ For various reasons, certain hosting providers may have other steps that should
|
||||
|
||||
As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started:
|
||||
|
||||
- [Debian Package Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/debian)
|
||||
- [Vagrant Installation Notes](http://progrium.viewdocs.io/dokku/getting-started/install/vagrant)
|
||||
- [Advanced Install Customization](http://progrium.viewdocs.io/dokku/advanced-installation)
|
||||
|
||||
@@ -77,6 +77,12 @@ server {
|
||||
|
||||
The above is a sample http configuration that adds an `X-Served-By` header to requests. The template file **must** be owned by the user `dokku:dokku`.
|
||||
|
||||
A few tips for custom nginx templates:
|
||||
|
||||
- Special characters - dollar signs, spaces inside of quotes, etc. - should be escaped with a single backslash or can cause deploy failures.
|
||||
- Templated files will be validated via `nginx -t`.
|
||||
- Application environment variables can be used within your nginx configuration.
|
||||
|
||||
## Customizing hostnames
|
||||
|
||||
Applications typically have the following structure for their hostname:
|
||||
@@ -161,7 +167,7 @@ d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a mi
|
||||
|
||||
# Default site
|
||||
|
||||
By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to nginx. This will catch all unknown HOST header values and return a `410 Gone` response.
|
||||
By default, dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to nginx. This will catch all unknown HOST header values and return a `410 Gone` response. You can replace the `return 410;` with `return 444;` which will cause nginx to not respond to requests that do not match known domains (connection refused).
|
||||
|
||||
```
|
||||
server {
|
||||
|
||||
@@ -37,6 +37,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[cameron-martin]: https://github.com/cameron-martin
|
||||
[cedricziel]: https://github.com/cedricziel
|
||||
[cef]: https://github.com/cef
|
||||
[cjblomqvist]: https://github.com/cjblomqvist
|
||||
[darkpixel]: https://github.com/darkpixel
|
||||
[dyson]: https://github.com/dyson
|
||||
[F4-Group]: https://github.com/F4-Group
|
||||
@@ -79,6 +80,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
[Flink]: https://github.com/Flink
|
||||
[ribot]: https://github.com/ribot
|
||||
[Benjamin-Dobell]: https://github.com/Benjamin-Dobell
|
||||
[jagandecapri]: https://github.com/jagandecapri
|
||||
|
||||
### Datastores
|
||||
|
||||
@@ -140,6 +142,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| [Supervisord](https://github.com/statianzo/dokku-supervisord) | [statianzo][] | Compatible with 0.2.0 |
|
||||
| [Logging Supervisord](https://github.com/sehrope/dokku-logging-supervisord) | [sehrope][] | Works with dokku @ [c77cbf1][] - no 0.2.0 compatibility |
|
||||
| [Forego](https://github.com/iskandar/dokku-forego) | [iskandar][] | Compatible with 0.2.x |
|
||||
| [Monit](https://github.com/cjblomqvist/dokku-monit) | [cjblomqvist][] | |
|
||||
|
||||
[c77cbf1]: https://github.com/progrium/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147
|
||||
[28de3ec]: https://github.com/progrium/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40
|
||||
@@ -192,6 +195,7 @@ Note: The following plugins have been supplied by our community and may not have
|
||||
| [Bower install](https://github.com/alexanderbeletsky/dokku-bower-install) | [alexanderbeletsky][] | |
|
||||
| [Bower/Grunt](https://github.com/thrashr888/dokku-bower-grunt-build-plugin) | [thrashr888][] | |
|
||||
| [Bower/Gulp](https://github.com/gdi2290/dokku-bower-gulp-build-plugin) | [gdi2290][] | |
|
||||
| [Bower/Gulp](https://github.com/jagandecapri/dokku-bower-gulp-build-plugin) | [jagandecapri][] | |
|
||||
| [HipChat Notifications](https://github.com/cef/dokku-hipchat) | [cef][] | |
|
||||
| [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | |
|
||||
| [Graphite/statsd](https://github.com/jlachowski/dokku-graphite-plugin) | [jlachowski][] | |
|
||||
|
||||
@@ -141,3 +141,31 @@ When specifying your port you may want to use something similar to:
|
||||
|
||||
Please see https://github.com/progrium/dokku/issues/282
|
||||
|
||||
***
|
||||
|
||||
__Symptom:__ Deployment fails because of slow internet connection, messages shows `gzip: stdin: unexpected end of file`
|
||||
|
||||
__Solution:__
|
||||
|
||||
If you see output similar this when deploying:
|
||||
|
||||
```
|
||||
Command: 'set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/ruby-2.0.0-p451-default-cache.tgz -s -o - | tar zxf -' failed unexpectedly:
|
||||
!
|
||||
! gzip: stdin: unexpected end of file
|
||||
! tar: Unexpected EOF in archive
|
||||
! tar: Unexpected EOF in archive
|
||||
! tar: Error is not recoverable: exiting now
|
||||
```
|
||||
|
||||
it might that the curl command that is supposed to fetch the buildpack (anything in the low megabyte file size range) takes too long to finish, due to slowish connection. To overwrite the default values (connection timeout: 3 seconds, total maximum time for operation: 30 seconds), edit `/home/dokku/ENV` like the following:
|
||||
|
||||
```
|
||||
#/home/dokku/ENV
|
||||
export CURL_TIMEOUT=600
|
||||
export CURL_CONNECT_TIMEOUT=30
|
||||
```
|
||||
|
||||
References
|
||||
* https://github.com/progrium/dokku/issues/509
|
||||
* https://github.com/dokku-alt/dokku-alt/issues/169
|
||||
|
||||
@@ -1,73 +1,62 @@
|
||||
# Upgrading
|
||||
|
||||
Dokku is in active development. You can update the deployment step and the build step separately.
|
||||
This document covers upgrades for the 0.3.0 series and up. If upgrading from previous versions, we recommend [a fresh install](http://progrium.viewdocs.io/dokku/installation) on a new server.
|
||||
|
||||
**Note**: If you are upgrading from a revision prior to [27d4bc8c3c](https://github.com/progrium/dokku/commit/27d4bc8c3c19fe580ef3e65f2f85b85101cd83e4), follow the instructions in [this wiki entry](https://github.com/progrium/dokku/wiki/Migrating-to-Dokku-0.2.0).
|
||||
> As of 0.3.18, dokku is installed by default via a debian package. Source-based installations are still available, though not recommended.
|
||||
|
||||
To update the deploy step (this is updated less frequently):
|
||||
## Dokku
|
||||
|
||||
If dokku was installed via a debian package, you can upgrade dokku via the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install dokku
|
||||
```
|
||||
|
||||
For unattended upgrades, you may run the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install -qq -y dokku
|
||||
```
|
||||
|
||||
If you have installed dokku from source, you may run the following commands to upgrade:
|
||||
|
||||
```shell
|
||||
cd ~/dokku
|
||||
git pull --tags origin master
|
||||
|
||||
# continue to install from source
|
||||
sudo DOKKU_BRANCH=master make install
|
||||
|
||||
# upgrade to debian package-based installation
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Nothing needs to be restarted. Changes will take effect on the next push / deployment.
|
||||
|
||||
To update the build step:
|
||||
All changes will take effect upon next application deployment. To trigger a rebuild of every application, simply run the following command:
|
||||
|
||||
```shell
|
||||
dokku ps:rebuildall
|
||||
```
|
||||
|
||||
## Buildstep image
|
||||
|
||||
If dokku was installed via a debian package, you can upgrade buildstep via the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install buildstep
|
||||
```
|
||||
|
||||
For unattended upgrades, you may run the following command:
|
||||
|
||||
```shell
|
||||
sudo apt-get install -qq -y buildstep
|
||||
```
|
||||
|
||||
In some cases, it may be desirable to run a specific version of buildstep. To install/upgrade buildstep from source, run the following commands:
|
||||
|
||||
```shell
|
||||
cd /tmp
|
||||
git clone https://github.com/progrium/buildstep.git
|
||||
cd buildstep
|
||||
git pull origin master
|
||||
sudo make build
|
||||
```
|
||||
|
||||
This will build a fresh Ubuntu Quantal image, install a number of packages, and
|
||||
eventually replace the Docker image for buildstep.
|
||||
|
||||
## Migrating from 0.1.0 to 0.2.0
|
||||
|
||||
This should be summary of breaking changes between 0.1 and 0.2 version with instructions to upgrade.
|
||||
|
||||
### software-properties-common
|
||||
|
||||
software-properties-common is now a dependency for plugins. Before running dokku install script, make sure it is installed.
|
||||
|
||||
```shell
|
||||
> sudo apt-get install software-properties-common
|
||||
```
|
||||
|
||||
### Gitreceive removed
|
||||
|
||||
PR [#270](https://github.com/progrium/dokku/pull/270).
|
||||
|
||||
Starting with Dokku 0.2.0, [Gitrecieve](https://github.com/progrium/gitreceive) is replaced by a `git` plugin.
|
||||
|
||||
Dokku no longer uses the `git` user. Everything is done with the `dokku` user account.
|
||||
|
||||
This causes the remote url to change. Instead of pushing to `git@hostname:app`, you should now push to `dokku@hostname:app`.
|
||||
The url must be modified using the `git remote set-url` command :
|
||||
|
||||
git remote set-url deploy dokku@hostname:app
|
||||
|
||||
Where `deploy` is the name of the remote.
|
||||
|
||||
Additionally, the repositiories on the server must be migrated to work with dokku 0.2.0
|
||||
|
||||
There is an upgrade [script](https://gist.github.com/plietar/7201430), which is meant to automate this migration. To use it:
|
||||
|
||||
1. run the script as root
|
||||
2. `git pull` to get the latest version of dokku
|
||||
3. make install
|
||||
4. `dokku ps:restartall`
|
||||
|
||||
TDB.
|
||||
|
||||
### Cache directory
|
||||
|
||||
Commit [#6350f373](https://github.com/progrium/dokku/commit/6350f373be2cef4f3bb90912099e1be6196522d1)
|
||||
|
||||
Buildstep have to be re-installed in order to support cache directory.
|
||||
|
||||
TDB.
|
||||
|
||||
5
dokku
5
dokku
@@ -37,7 +37,7 @@ fi
|
||||
|
||||
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
|
||||
export -n SSH_ORIGINAL_COMMAND
|
||||
if [[ $1 =~ config-* ]];then
|
||||
if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]];then
|
||||
xargs $0 <<<$SSH_ORIGINAL_COMMAND
|
||||
exit $?
|
||||
else
|
||||
@@ -91,7 +91,7 @@ case "$1" in
|
||||
|
||||
# if we can't post-deploy successfully, kill new container
|
||||
kill_new() {
|
||||
docker inspect $id &> /dev/null && docker kill $id > /dev/null
|
||||
docker inspect $id &> /dev/null && docker stop $id > /dev/null && docker kill $id > /dev/null
|
||||
trap - INT TERM EXIT
|
||||
kill -9 $$
|
||||
}
|
||||
@@ -120,6 +120,7 @@ case "$1" in
|
||||
exec >/dev/null 2>/dev/null </dev/null
|
||||
trap '' INT HUP
|
||||
sleep $WAIT
|
||||
docker stop $oldid
|
||||
docker kill $oldid
|
||||
) & disown -a
|
||||
# Use trap since disown/nohup don't seem to keep child alive
|
||||
|
||||
@@ -38,10 +38,11 @@ case "$1" in
|
||||
DOCKERFILE_PORT=$(grep EXPOSE Dockerfile | head -1 | awk '{ print $2 }' || true)
|
||||
[[ -n "$DOCKERFILE_PORT" ]] && dokku config:set-norestart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
|
||||
|
||||
# sticking with same pattern of building app image before pre-build for now.
|
||||
docker build -t "$IMAGE" .
|
||||
# buildstep pluginhooks don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||
pluginhook pre-build-dockerfile "$APP"
|
||||
|
||||
docker build -t "$IMAGE" .
|
||||
|
||||
pluginhook post-build-dockerfile "$APP"
|
||||
;;
|
||||
|
||||
|
||||
@@ -41,3 +41,18 @@ WantedBy=multi-user.target
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
cat<<EOF > /etc/update-motd.d/99-dokku
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "/home/dokku/HOSTNAME" ]; then
|
||||
echo "\nTo avoid cli-based dokku configuration, use the web installer"
|
||||
echo "Debian-based installs should have this running and available"
|
||||
echo "on port 80. You can also install it via the following commands:"
|
||||
echo ""
|
||||
echo " cd /root/dokku"
|
||||
echo " sudo make dokku-installer\n"
|
||||
fi
|
||||
EOF
|
||||
chmod +x /etc/update-motd.d/99-dokku
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
# You can also specify the protocol to explicitly check HTTPS requests.
|
||||
#
|
||||
# The default behavior is to wait for 5 seconds before running the first check,
|
||||
# and timeout each check to 30 minutes.
|
||||
# and timeout each check to 30 seconds.
|
||||
#
|
||||
# By default, checks will be retried 5 times.
|
||||
|
||||
@@ -78,7 +78,10 @@ cleanup() {
|
||||
trap cleanup EXIT
|
||||
|
||||
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
||||
dokku_log_verbose "CHECKS file not found in container: running simple container check..."
|
||||
dokku_log_verbose "For more efficient zero downtime deployments, create a file CHECKS."
|
||||
dokku_log_verbose "See http://progrium.viewdocs.io/dokku/checks-examples.md for examples"
|
||||
dokku_log_verbose "CHECKS file not found in container: Running simple container check..."
|
||||
|
||||
rm -rf $TMPDIR
|
||||
|
||||
# simple default check to see if the container stuck around
|
||||
|
||||
@@ -104,6 +104,7 @@ dokku_container_log_verbose_quiet() {
|
||||
|
||||
verify_app_name() {
|
||||
local APP="$1"
|
||||
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
||||
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
|
||||
IMAGE="dokku/$APP"
|
||||
return 0
|
||||
|
||||
@@ -45,7 +45,7 @@ case "$1" in
|
||||
VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
fi
|
||||
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then
|
||||
echo "unsupported vhost config found. disabling vhost support"
|
||||
dokku_log_info2 "unsupported vhost config found. disabling vhost support"
|
||||
dokku config:set-norestart $APP NO_VHOST=1
|
||||
else
|
||||
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
@@ -71,8 +71,8 @@ case "$1" in
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku $1 $APP DOMAIN"
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
|
||||
echo "Must specify DOMAIN."
|
||||
exit 1
|
||||
fi
|
||||
@@ -82,12 +82,17 @@ case "$1" in
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
dokku domains:setup $APP
|
||||
echo "$3" >> "$DOKKU_ROOT/$APP/VHOST"
|
||||
for DOMAIN in "$@";do
|
||||
echo "$DOMAIN" >> "$DOKKU_ROOT/$APP/VHOST"
|
||||
done
|
||||
# we need to restart the app to make sure we're binding to the appropriate network interface
|
||||
dokku ps:restart $APP
|
||||
dokku nginx:build-config $APP
|
||||
pluginhook post-domains-update $APP
|
||||
dokku_log_info1 "Added $3 to $APP"
|
||||
for DOMAIN in "$@";do
|
||||
dokku_log_info1 "Added $DOMAIN to $APP"
|
||||
done
|
||||
|
||||
;;
|
||||
|
||||
@@ -108,16 +113,21 @@ case "$1" in
|
||||
verify_app_name "$2"
|
||||
APP="$2"
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
echo "Usage: dokku $1 $2 DOMAIN"
|
||||
if [[ -z "${*:3}" ]]; then
|
||||
echo "Usage: dokku $1 $APP DOMAIN [DOMAIN ...]"
|
||||
echo "Must specify DOMAIN."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift 2
|
||||
dokku domains:setup $APP
|
||||
sed -i "/^$3$/d" "$DOKKU_ROOT/$APP/VHOST"
|
||||
for DOMAIN in "$@";do
|
||||
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
|
||||
done
|
||||
pluginhook post-domains-update $APP
|
||||
dokku_log_info1 "Removed $3 from $APP"
|
||||
for DOMAIN in "$@";do
|
||||
dokku_log_info1 "Removed $DOMAIN from $APP"
|
||||
done
|
||||
|
||||
;;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
git-*)
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
|
||||
APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||
@@ -87,7 +87,11 @@ EOF
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
fi
|
||||
|
||||
args=$*
|
||||
if [[ $1 == "git-receive-pack" ]]; then
|
||||
args="$1 '$APP_PATH'"
|
||||
else
|
||||
args=$*
|
||||
fi
|
||||
git-shell -c "$args"
|
||||
;;
|
||||
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$(dirname $0)/../common/functions"
|
||||
|
||||
validate_nginx () {
|
||||
set +e
|
||||
sudo /usr/sbin/nginx -t > /dev/null 2>&1
|
||||
exit_code=$?
|
||||
set -e
|
||||
if [[ "$exit_code" -ne "0" ]]; then
|
||||
sudo /usr/sbin/nginx -t
|
||||
exit "$exit_code"
|
||||
fi
|
||||
}
|
||||
|
||||
restart_nginx () {
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
@@ -17,10 +28,12 @@ restart_nginx () {
|
||||
case "$1" in
|
||||
nginx:build-config)
|
||||
APP="$2"; DOKKU_APP_LISTEN_PORT="$3"; DOKKU_APP_LISTEN_IP="${4}"
|
||||
verify_app_name "$APP"
|
||||
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
|
||||
URLS_PATH="$DOKKU_ROOT/$APP/URLS"
|
||||
WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||
SSL="$DOKKU_ROOT/$APP/tls"
|
||||
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
|
||||
|
||||
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
|
||||
DOKKU_APP_LISTEN_PORT=$(< "$DOKKU_ROOT/$APP/PORT")
|
||||
@@ -31,6 +44,7 @@ case "$1" in
|
||||
|
||||
[[ -f "$DOKKU_ROOT/ENV" ]] && source $DOKKU_ROOT/ENV
|
||||
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
|
||||
[[ -f "$APP_NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$APP_NGINX_TEMPLATE" && NGINX_CUSTOM_TEMPLATE="true" && dokku_log_info1 'Overriding default nginx.conf with detected nginx.conf.template'
|
||||
|
||||
if [[ ! -n "$NO_VHOST" ]] && [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
|
||||
NONSSL_VHOSTS=$(cat $VHOST_PATH)
|
||||
@@ -51,6 +65,7 @@ EOF
|
||||
if [[ -n "$SSL_INUSE" ]]; then
|
||||
SCHEME="https"
|
||||
|
||||
[[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
|
||||
SSL_HOSTNAME=$(openssl x509 -in $SSL_INUSE/server.crt -noout -subject | tr '/' '\n' | grep CN= | cut -c4-)
|
||||
if [[ -n "$SSL_HOSTNAME" ]]; then
|
||||
SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g')
|
||||
@@ -64,9 +79,8 @@ EOF
|
||||
fi
|
||||
|
||||
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
|
||||
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME}$|^${SSL_HOSTNAME_ALT}$" $VHOST_PATH || exit 0)
|
||||
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $VHOST_PATH || exit 0)
|
||||
|
||||
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template"
|
||||
while read line; do
|
||||
dokku_log_info1 "Configuring SSL for $line..."
|
||||
SSL_SERVER_NAME=$line
|
||||
@@ -75,14 +89,10 @@ EOF
|
||||
done <<< "$SSL_VHOSTS"
|
||||
fi
|
||||
|
||||
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
|
||||
APP_NGINX_TEMPLATE="$DOKKU_ROOT/$APP/nginx.conf.template"
|
||||
if [[ -f $APP_NGINX_TEMPLATE ]]; then
|
||||
dokku_log_info1 "Overriding default nginx.conf with detected nginx.conf.template"
|
||||
eval "cat <<< \"$(< $APP_NGINX_TEMPLATE)\" > $NGINX_CONF"
|
||||
elif [[ -n "$NONSSL_VHOSTS" ]]; then
|
||||
if [[ -n "$NONSSL_VHOSTS" ]]; then
|
||||
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
|
||||
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
|
||||
NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template"
|
||||
[[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template"
|
||||
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
|
||||
fi
|
||||
|
||||
@@ -97,7 +107,8 @@ EOF
|
||||
dokku_log_info1 "Running nginx-pre-reload"
|
||||
pluginhook nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
|
||||
|
||||
echo " Reloading nginx"
|
||||
dokku_log_verbose "Reloading nginx"
|
||||
validate_nginx
|
||||
restart_nginx
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f /etc/sudoers.d/dokku-nginx ]]; then
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
case "$DOKKU_DISTRO" in
|
||||
ubuntu)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/etc/init.d/nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
|
||||
opensuse)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload" >> /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
esac
|
||||
opensuse)
|
||||
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
|
||||
;;
|
||||
esac
|
||||
|
||||
chmod 0440 /etc/sudoers.d/dokku-nginx
|
||||
fi
|
||||
chmod 0440 /etc/sudoers.d/dokku-nginx
|
||||
|
||||
# if dokku.conf has not been created, create it
|
||||
if [[ ! -f /etc/nginx/conf.d/dokku.conf ]]; then
|
||||
|
||||
13
tests.mk
13
tests.mk
@@ -28,8 +28,15 @@ endif
|
||||
@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
|
||||
echo "Host 127.0.0.1 \\r\\n Port 22333 \\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
|
||||
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
||||
endif
|
||||
|
||||
ifeq ($(shell grep 22333 /etc/ssh/sshd_config),)
|
||||
sed --in-place "s:^Port 22:Port 22 \\nPort 22333:g" /etc/ssh/sshd_config
|
||||
restart ssh
|
||||
endif
|
||||
|
||||
@echo "-----> Installing SSH public key..."
|
||||
@@ -38,6 +45,7 @@ endif
|
||||
|
||||
@echo "-----> Intitial SSH connection to populate known_hosts..."
|
||||
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
|
||||
ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help > /dev/null
|
||||
|
||||
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
|
||||
@echo "-----> Setting default VHOST to dokku.me..."
|
||||
@@ -61,7 +69,11 @@ lint:
|
||||
|
||||
unit-tests:
|
||||
@echo running unit tests...
|
||||
ifndef UNIT_TEST_BATCH
|
||||
@$(QUIET) bats tests/unit
|
||||
else
|
||||
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
|
||||
endif
|
||||
|
||||
deploy-test-clojure:
|
||||
@echo deploying config app...
|
||||
@@ -125,7 +137,6 @@ deploy-test-static:
|
||||
|
||||
deploy-tests:
|
||||
@echo running deploy tests...
|
||||
# @$(QUIET) bats tests/deploy
|
||||
@$(QUIET) $(MAKE) deploy-test-config
|
||||
@$(QUIET) $(MAKE) deploy-test-clojure
|
||||
@$(QUIET) $(MAKE) deploy-test-dockerfile
|
||||
|
||||
@@ -1,20 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
MODE="$1"; MODE=${MODE:="testing"}
|
||||
|
||||
setup_circle() {
|
||||
MAKE_ENV="CI=true DOCKER_VERSION=1.5.0"
|
||||
[[ "$1" == "buildstack" ]] && MAKE_ENV+=" BUILD_STACK=true "
|
||||
echo "setting up with MAKE_ENV: $MAKE_ENV"
|
||||
sudo -E CI=true make -e sshcommand
|
||||
# need to add the dokku user to the docker group
|
||||
sudo usermod -G docker dokku
|
||||
#### 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 --in-place 's:/home/ubuntu:/root:g' ~root/.ssh/config
|
||||
####
|
||||
sudo -E $MAKE_ENV make -e install
|
||||
sudo -E make -e setup-deploy-tests
|
||||
make -e ci-dependencies
|
||||
}
|
||||
|
||||
case "$CIRCLE_NODE_INDEX" in
|
||||
0)
|
||||
echo "=====> make unit-tests"
|
||||
sudo -E make -e unit-tests
|
||||
echo "=====> make unit-tests (1/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
|
||||
sudo -E UNIT_TEST_BATCH=1 make -e unit-tests
|
||||
;;
|
||||
|
||||
1)
|
||||
echo "=====> make deploy-tests (buildstep release)"
|
||||
sudo -E make -e deploy-tests
|
||||
echo "=====> make unit-tests (2/2) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
|
||||
sudo -E UNIT_TEST_BATCH=2 make -e unit-tests
|
||||
;;
|
||||
|
||||
2)
|
||||
echo "=====> make deploy-tests (buildstep master)"
|
||||
docker rmi -f progrium/buildstep && \
|
||||
sudo -E BUILD_STACK=true make -e stack && \
|
||||
echo "=====> make deploy-tests (buildstep release) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
[[ "$MODE" == "setup" ]] && setup_circle && exit 0
|
||||
sudo -E make -e deploy-tests
|
||||
;;
|
||||
|
||||
3)
|
||||
echo "=====> make deploy-tests (buildstep master) on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
[[ "$MODE" == "setup" ]] && setup_circle buildstack && exit 0
|
||||
sudo -E make -e deploy-tests
|
||||
;;
|
||||
esac
|
||||
|
||||
37
tests/ci/unit_test_runner.sh
Executable file
37
tests/ci/unit_test_runner.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
is_number() {
|
||||
local NUMBER=$1; local NUM_RE='^[0-9]+$'
|
||||
if [[ $NUMBER =~ $NUM_RE ]];then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 1|2"
|
||||
exit 0
|
||||
}
|
||||
|
||||
BATCH_NUM="$1"
|
||||
is_number $BATCH_NUM || usage
|
||||
|
||||
TESTS=($(find "$(dirname $0)"/../unit -maxdepth 1 -name "*.bats"))
|
||||
HALF_TESTS=$(( ${#TESTS[@]} / 2 ))
|
||||
FIRST_HALF=("${TESTS[@]:0:${HALF_TESTS}}")
|
||||
LAST_HALF=("${TESTS[@]:${HALF_TESTS}:${#TESTS[@]}}")
|
||||
|
||||
case "$BATCH_NUM" in
|
||||
1)
|
||||
bats "${FIRST_HALF[@]}"
|
||||
;;
|
||||
|
||||
2)
|
||||
bats "${LAST_HALF[@]}"
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
@@ -115,3 +115,9 @@ build_nginx_config() {
|
||||
assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://dokku.example.com"
|
||||
}
|
||||
|
||||
@test "(core) git-remote (off-port)" {
|
||||
run deploy_app nodejs-express ssh://dokku@127.0.0.1:22333/$TEST_APP
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@@ -97,7 +97,12 @@ teardown() {
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
|
||||
run dokku ps:restart $TEST_APP
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
|
||||
@@ -149,3 +149,14 @@ teardown() {
|
||||
assert_success
|
||||
deploy_app
|
||||
}
|
||||
|
||||
@test "docker-options:add (all phases over SSH)" {
|
||||
run ssh dokku@dokku.me docker-options:add $TEST_APP build,deploy,run \"-v /tmp\"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run /bin/bash -c "dokku docker-options $TEST_APP | egrep '\-v /tmp' | wc -l | grep -q 3"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@@ -28,6 +28,13 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(domains) domains:add (multiple)" {
|
||||
run dokku domains:add $TEST_APP www.test.app.dokku.me test.app.dokku.me
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(domains) domains:remove" {
|
||||
run dokku domains:add $TEST_APP test.app.dokku.me
|
||||
echo "output: "$output
|
||||
|
||||
@@ -72,12 +72,29 @@ assert_http_success() {
|
||||
assert_nonssl_domain "www.test.dokku.me"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx:build-config (wildcard SSL & custom nginx template)" {
|
||||
setup_test_tls_wildcard
|
||||
add_domain "wildcard1.dokku.me"
|
||||
add_domain "wildcard2.dokku.me"
|
||||
custom_ssl_nginx_template
|
||||
deploy_app
|
||||
assert_ssl_domain "wildcard1.dokku.me"
|
||||
assert_ssl_domain "wildcard2.dokku.me"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx:build-config (with SSL CN mismatch)" {
|
||||
setup_test_tls
|
||||
deploy_app
|
||||
assert_ssl_domain "node-js-app.dokku.me"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx:build-config (with SSL CN mismatch & custom nginx template)" {
|
||||
setup_test_tls
|
||||
custom_ssl_nginx_template
|
||||
deploy_app
|
||||
assert_ssl_domain "node-js-app.dokku.me"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx:build-config (with SSL and Multiple SANs)" {
|
||||
setup_test_tls_with_sans
|
||||
deploy_app
|
||||
@@ -86,6 +103,13 @@ assert_http_success() {
|
||||
assert_ssl_domain "www.test.app.dokku.me"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx:build-config (custom nginx template)" {
|
||||
add_domain "www.test.app.dokku.me"
|
||||
custom_nginx_template
|
||||
deploy_app
|
||||
assert_nonssl_domain "www.test.app.dokku.me"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx:build-config (no global VHOST and domains:add)" {
|
||||
destroy_app
|
||||
rm "$DOKKU_ROOT/VHOST"
|
||||
@@ -94,3 +118,12 @@ assert_http_success() {
|
||||
deploy_app
|
||||
assert_nonssl_domain "www.test.app.dokku.me"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx:build-config (validate_nginx)" {
|
||||
deploy_app
|
||||
echo "some lame nginx config" > "$DOKKU_ROOT/$TEST_APP/nginx.conf.template"
|
||||
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@@ -89,7 +89,9 @@ create_app() {
|
||||
}
|
||||
|
||||
destroy_app() {
|
||||
RC="$1"; RC=${RC:=0}
|
||||
echo $TEST_APP | dokku apps:destroy $TEST_APP
|
||||
return $RC
|
||||
}
|
||||
|
||||
add_domain() {
|
||||
@@ -98,18 +100,20 @@ add_domain() {
|
||||
|
||||
deploy_app() {
|
||||
APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"}
|
||||
GIT_REMOTE="$2"; GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
|
||||
TMP=$(mktemp -d -t "$TARGET.XXXXX")
|
||||
rmdir $TMP && cp -r ./tests/apps/$APP_TYPE $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
|
||||
echo "setting up remote: $GIT_REMOTE"
|
||||
git remote add target $GIT_REMOTE
|
||||
|
||||
[[ -f gitignore ]] && mv gitignore .gitignore
|
||||
git add .
|
||||
git commit -m 'initial commit'
|
||||
git push target master || destroy_app
|
||||
git push target master || destroy_app $?
|
||||
}
|
||||
|
||||
setup_client_repo() {
|
||||
@@ -156,3 +160,63 @@ disable_tls_wildcard() {
|
||||
-e "s:^ssl_certificate_key $DOKKU_ROOT/tls/server.key;:# ssl_certificate_key $DOKKU_ROOT/tls/server.key;:g" /etc/nginx/conf.d/dokku.conf
|
||||
kill -HUP "$(< /var/run/nginx.pid)"; sleep 5
|
||||
}
|
||||
|
||||
custom_ssl_nginx_template() {
|
||||
APP="$1"
|
||||
[[ -z "$APP" ]] && APP="$TEST_APP"
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf.template
|
||||
server {
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
server_name \$NOSSL_SERVER_NAME;
|
||||
return 301 https://\$SSL_SERVER_NAME\\\$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:443 ssl spdy;
|
||||
listen 443 ssl spdy;
|
||||
server_name \$SSL_SERVER_NAME;
|
||||
\$SSL_DIRECTIVES
|
||||
|
||||
keepalive_timeout 70;
|
||||
add_header Alternate-Protocol 443:npn-spdy/2;
|
||||
location / {
|
||||
proxy_pass http://\$APP;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \\\$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host \\\$http_host;
|
||||
proxy_set_header X-Forwarded-Proto \\\$scheme;
|
||||
proxy_set_header X-Forwarded-For \\\$remote_addr;
|
||||
proxy_set_header X-Forwarded-Port \\\$server_port;
|
||||
proxy_set_header X-Request-Start \\\$msec;
|
||||
}
|
||||
include \$DOKKU_ROOT/\$APP/nginx.conf.d/*.conf;
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
custom_nginx_template() {
|
||||
APP="$1"
|
||||
[[ -z "$APP" ]] && APP="$TEST_APP"
|
||||
cat<<EOF > $DOKKU_ROOT/$APP/nginx.conf.template
|
||||
server {
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
server_name \$NOSSL_SERVER_NAME;
|
||||
|
||||
location / {
|
||||
proxy_pass http://\$APP;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \\\$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host \\\$http_host;
|
||||
proxy_set_header X-Forwarded-Proto \\\$scheme;
|
||||
proxy_set_header X-Forwarded-For \\\$remote_addr;
|
||||
proxy_set_header X-Forwarded-Port \\\$server_port;
|
||||
proxy_set_header X-Request-Start \\\$msec;
|
||||
}
|
||||
include \$DOKKU_ROOT/\$APP/nginx.conf.d/*.conf;
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user