mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
@@ -28,11 +28,11 @@ domains_setup() {
|
||||
|
||||
if [[ ! -f $APP_VHOST_PATH ]]; then
|
||||
if [[ -n "$DEFAULT_VHOSTS" ]]; then
|
||||
dokku_log_info1 "Creating new app virtual host file..."
|
||||
dokku_log_info1_quiet "Creating new app virtual host file..."
|
||||
echo "$DEFAULT_VHOSTS" >"$APP_VHOST_PATH"
|
||||
chown "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "$APP_VHOST_PATH"
|
||||
else
|
||||
dokku_log_info2 "Global server virtual host not set, disabling app vhost..."
|
||||
dokku_log_info1_quiet "Global server virtual host not set, disabling app vhost..."
|
||||
disable_app_vhost "$APP" --no-restart
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
|
||||
trigger-domains-post-app-clone-setup() {
|
||||
declare desc="removes domain files when setting up a clone"
|
||||
@@ -9,6 +10,7 @@ trigger-domains-post-app-clone-setup() {
|
||||
local APP_ROOT="$DOKKU_ROOT/$NEW_APP"
|
||||
|
||||
rm -rf "$APP_ROOT/VHOST"
|
||||
DOKKU_QUIET_OUTPUT=1 domains_setup "$NEW_APP"
|
||||
}
|
||||
|
||||
trigger-domains-post-app-clone-setup "$@"
|
||||
|
||||
@@ -78,6 +78,11 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "https://github.com/heroku/heroku-buildpack-ruby.git"
|
||||
run /bin/bash -c "dokku domains:report great-test-name --domains-app-vhosts"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "great-test-name.$DOKKU_DOMAIN"
|
||||
run /bin/bash -c "dokku git:report great-test-name --git-deploy-branch"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -158,23 +163,24 @@ teardown() {
|
||||
run [ -d /home/dokku/great-test-name/tls ]
|
||||
assert_failure
|
||||
run [ -f /home/dokku/great-test-name/VHOST ]
|
||||
assert_failure
|
||||
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url $TEST_APP) | grep 200"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku url great-test-name"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url great-test-name) | grep 404"
|
||||
assert_output "http://great-test-name.$DOKKU_DOMAIN"
|
||||
run /bin/bash -c "dokku url $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_success
|
||||
assert_output "http://$TEST_APP.$DOKKU_DOMAIN"
|
||||
assert_http_localhost_response "http" "$TEST_APP.$DOKKU_DOMAIN" "80" "/hello"
|
||||
assert_http_localhost_response "http" "great-test-name.dokku.me" "80" "/hello" "" "404"
|
||||
run /bin/bash -c "dokku --force apps:destroy great-test-name"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url $TEST_APP) | grep 200"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_http_localhost_response "http" "$TEST_APP.$DOKKU_DOMAIN" "80" "/hello"
|
||||
}
|
||||
|
||||
@test "(apps) apps:clone --ignore-existing" {
|
||||
|
||||
@@ -41,10 +41,10 @@ teardown() {
|
||||
check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:3003"
|
||||
check_urls "http://www.test.app.${DOKKU_DOMAIN}:3000"
|
||||
check_urls "http://www.test.app.${DOKKU_DOMAIN}:3003"
|
||||
assert_http_localhost_success "http" "${TEST_APP}.${DOKKU_DOMAIN}" "3000"
|
||||
assert_http_localhost_success "http" "${TEST_APP}.${DOKKU_DOMAIN}" "3003"
|
||||
assert_http_localhost_success "http" "www.test.app.${DOKKU_DOMAIN}" "3000"
|
||||
assert_http_localhost_success "http" "www.test.app.${DOKKU_DOMAIN}" "3003"
|
||||
assert_http_localhost_response "http" "${TEST_APP}.${DOKKU_DOMAIN}" "3000"
|
||||
assert_http_localhost_response "http" "${TEST_APP}.${DOKKU_DOMAIN}" "3003"
|
||||
assert_http_localhost_response "http" "www.test.app.${DOKKU_DOMAIN}" "3000"
|
||||
assert_http_localhost_response "http" "www.test.app.${DOKKU_DOMAIN}" "3003"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) proxy:build-config (multiple networks)" {
|
||||
|
||||
@@ -54,7 +54,7 @@ teardown() {
|
||||
assert_success
|
||||
|
||||
assert_nonssl_domain "www.test.app.${DOKKU_DOMAIN}"
|
||||
assert_http_localhost_success "http" "customtemplate.${DOKKU_DOMAIN}"
|
||||
assert_http_localhost_response "http" "customtemplate.${DOKKU_DOMAIN}"
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
|
||||
@@ -43,7 +43,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_success "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
@test "(openresty) multiple domains" {
|
||||
@@ -67,8 +67,8 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_success "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
assert_http_localhost_success "http" "$TEST_APP-2.dokku.me" "80" "" "python/http.server"
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
assert_http_localhost_response "http" "$TEST_APP-2.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
@test "(openresty) ssl" {
|
||||
@@ -86,7 +86,7 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_http_localhost_success "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map-detected"
|
||||
echo "output: $output"
|
||||
|
||||
@@ -222,13 +222,13 @@ assert_http_success() {
|
||||
assert_output "200"
|
||||
}
|
||||
|
||||
assert_http_localhost_success() {
|
||||
local scheme="$1" domain="$2" port="${3:-80}" path="${4:-}" content="${5:-}"
|
||||
assert_http_localhost_response() {
|
||||
local scheme="$1" domain="$2" port="${3:-80}" path="${4:-}" content="${5:-}" status_code="${6:-200}"
|
||||
run curl --connect-to "$domain:$port:localhost:$port" -kSso /dev/null -w "%{http_code}" "$scheme://$domain:$port$path"
|
||||
echo "curl: curl --connect-to $domain:$port:localhost:$port -kSso /dev/null -w %{http_code} $scheme://$domain:$port$path"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "200"
|
||||
assert_output "$status_code"
|
||||
|
||||
if [[ -n "$content" ]]; then
|
||||
run curl --connect-to "$domain:$port:localhost:$port" -kSs "$scheme://$domain:$port$path"
|
||||
|
||||
Reference in New Issue
Block a user