Merge branch 'master' into mh-ps-scale
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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<<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