diff --git a/AUTHORS b/AUTHORS index 374428a14..2c4693bd6 100644 --- a/AUTHORS +++ b/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 Alexander Beletsky Alexis Gavoty diff --git a/HISTORY.md b/HISTORY.md index 5b7c03ba3..93b7e404f 100644 --- a/HISTORY.md +++ b/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 diff --git a/Makefile b/Makefile index c05456e65..cd7b59f24 100644 --- a/Makefile +++ b/Makefile @@ -86,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 diff --git a/README.md b/README.md index e7daafe53..68e77ed31 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dokku [![Build Status](https://circleci.com/gh/progrium/dokku/tree/master.svg?style=svg&circle-token=eec5b442dda53a4d229911dd97d4214853acc262 "Build Status")](https://circleci.com/gh/progrium/dokku/tree/master) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) [![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) +# Dokku [![Build Status](https://img.shields.io/circleci/project/progrium/dokku.svg "Build Status")](https://circleci.com/gh/progrium/dokku/tree/master) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) [![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) [![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg "Viewdocs")](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/). @@ -10,8 +10,8 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. S To install the latest stable release, you can run the following commands as a user that has access to `sudo`: - wget https://raw.github.com/progrium/dokku/v0.3.17/bootstrap.sh - sudo DOKKU_TAG=v0.3.17 bash bootstrap.sh + wget https://raw.github.com/progrium/dokku/v0.3.18/bootstrap.sh + sudo DOKKU_TAG=v0.3.18 bash bootstrap.sh ### Upgrading diff --git a/Vagrantfile b/Vagrantfile index af60cf386..f3e56c6ee 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -39,7 +39,7 @@ Vagrant::configure("2") do |config| 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" diff --git a/contrib/dokku-installer.rb b/contrib/dokku-installer.rb index b5b319e0f..251686b6d 100755 --- a/contrib/dokku-installer.rb +++ b/contrib/dokku-installer.rb @@ -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 diff --git a/contrib/stackscript.sh b/contrib/stackscript.sh index 6fe9da858..df1676eff 100644 --- a/contrib/stackscript.sh +++ b/contrib/stackscript.sh @@ -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 diff --git a/deb.mk b/deb.mk index a2e4460c7..ae8733455 100644 --- a/deb.mk +++ b/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 diff --git a/debian/config b/debian/config new file mode 100755 index 000000000..8b294e076 --- /dev/null +++ b/debian/config @@ -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 diff --git a/debian/postinst b/debian/postinst index 231c1a20d..d9d94b818 100755 --- a/debian/postinst +++ b/debian/postinst @@ -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 ;; *) diff --git a/debian/preinst b/debian/preinst index 198b8aee6..998338eb9 100755 --- a/debian/preinst +++ b/debian/preinst @@ -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" diff --git a/debian/templates b/debian/templates new file mode 100644 index 000000000..e63a3e859 --- /dev/null +++ b/debian/templates @@ -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 diff --git a/docs/checks-examples.md b/docs/checks-examples.md index a77f56e37..733674bc8 100644 --- a/docs/checks-examples.md +++ b/docs/checks-examples.md @@ -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) diff --git a/docs/getting-started/install/debian.md b/docs/getting-started/install/debian.md index 42374c7ef..40d4748a8 100644 --- a/docs/getting-started/install/debian.md +++ b/docs/getting-started/install/debian.md @@ -13,3 +13,24 @@ 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. .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`) | diff --git a/docs/installation.md b/docs/installation.md index 420cffb73..da96ae292 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -12,7 +12,8 @@ To install the latest stable version of dokku, you can run the following bootstr ```shell # installs dokku via apt-get -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 # Go to your server's IP and follow the web installer ``` diff --git a/docs/plugins.md b/docs/plugins.md index b6ec82968..5d37635ca 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -29,6 +29,7 @@ Note: The following plugins have been supplied by our community and may not have [agco-adm]: https://github.com/agco-adm [ademuk]: https://github.com/ademuk +[alessio]: https://github.com/alessio [alex-sherwin]: https://github.com/alex-sherwin [alexanderbeletsky]: https://github.com/alexanderbeletsky [Aomitayo]: https://github.com/Aomitayo @@ -37,7 +38,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 +[cjblomqvist]: https://github.com/cjblomqvist [darkpixel]: https://github.com/darkpixel [dyson]: https://github.com/dyson [F4-Group]: https://github.com/F4-Group @@ -80,6 +81,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 @@ -154,7 +156,8 @@ Note: The following plugins have been supplied by our community and may not have | [Docker Direct](https://github.com/heichblatt/dokku-docker-direct) | [heichblatt][] | | | [Dokku Name](https://github.com/alex-sherwin/dokku-name) | [alex-sherwin][] | dokku >= [c77cbf1][] | | [Dokku Registry](https://github.com/agco-adm/dokku-registry)1 | [agco-adm][] | | -| [git rev-parse HEAD in env](https://github.com/nornagon/dokku-git-rev) | [nornagon][] | Compatible with 0.2.0 | +| [Events Logger](https://github.com/alessio/dokku-events) | [alessio][] | dokku >= v0.3.13 | +| [git rev-parse HEAD in env](https://github.com/cjblomqvist/dokku-git-rev) | [cjblomqvist][] | Compatible with 0.3.0 | | [Graduate (Environment Management)](https://github.com/glassechidna/dokku-graduate) | [Benjamin-Dobell][] | dokku >= v0.3.14 | | [HTTP Auth Secure Apps](https://github.com/matto1990/dokku-secure-apps) | [matto1990][] | Works with v0.2.3 | | [Host Port binding](https://github.com/stuartpb/dokku-bind-port) | [stuartpb][] | dokku >= [c77cbf1][]. 2014-02-17: [a043e98][] targeting dokku @ [latest][217d00a] | @@ -194,6 +197,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][] | | diff --git a/plugins/checks/check-deploy b/plugins/checks/check-deploy index eda9d54f9..dbeac5b0a 100755 --- a/plugins/checks/check-deploy +++ b/plugins/checks/check-deploy @@ -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. @@ -131,8 +131,9 @@ do # Ignore empty lines and lines starting with # # shellcheck disable=SC1001 [[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue - # Ignore variables - [[ "$CHECK_URL" =~ ^.+= ]] && continue + # Ignore if it's not a URL in a supported format + # shellcheck disable=SC1001 + ! [[ "$CHECK_URL" =~ ^(http(s)?:)?\/.+ ]] && continue if [[ "$CHECK_URL" =~ ^https?: ]] ; then URL_PROTOCOL=${CHECK_URL%:*} diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 12ac262f6..197086f03 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -33,6 +33,7 @@ case "$1" in 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" ]] && [[ -z "$DOKKU_APP_LISTEN_IP" ]]; then shopt -s nullglob @@ -50,6 +51,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) @@ -70,6 +72,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') @@ -85,7 +88,6 @@ EOF SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$|^${SSL_HOSTNAME_ALT_REGEX}$" $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 @@ -94,14 +96,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 diff --git a/tests/unit/nginx-vhosts.bats b/tests/unit/nginx-vhosts.bats index 66838c126..281e64801 100644 --- a/tests/unit/nginx-vhosts.bats +++ b/tests/unit/nginx-vhosts.bats @@ -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" diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index ca91b02a3..1a8faa162 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -160,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< $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< $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 +}