diff --git a/docs/appendices/0.27.0-migration-guide.md b/docs/appendices/0.27.0-migration-guide.md new file mode 100644 index 000000000..0f161bdf1 --- /dev/null +++ b/docs/appendices/0.27.0-migration-guide.md @@ -0,0 +1,13 @@ +# 0.27.0 Migration Guide + +## Changes + +- Renaming an application will now only rename domains that are associated with global domains. As an example: + ```shell + dokku domains:set-global dokku.me + dokku apps:create node-js-app + dokku domains:set node-js-app node-js-app.dokku.me node-js-app.dokku.com + dokku apps:rename node-js-app other-name + dokku domains:report node-js-app --domains-app-vhosts + # output: other-name.dokku.me node-js-app.dokku.com + ``` diff --git a/docs/getting-started/upgrading.md b/docs/getting-started/upgrading.md index a32332b2f..98be5a4f9 100644 --- a/docs/getting-started/upgrading.md +++ b/docs/getting-started/upgrading.md @@ -19,6 +19,7 @@ Docker releases updates periodically to their engine. We recommend reading their Before upgrading, check the migration guides to get comfortable with new features and prepare your deployment to be upgraded. +- [Upgrading to 0.27](/docs/appendices/0.27.0-migration-guide.md) - [Upgrading to 0.26](/docs/appendices/0.26.0-migration-guide.md) - [Upgrading to 0.25](/docs/appendices/0.25.0-migration-guide.md) - [Upgrading to 0.24](/docs/appendices/0.24.0-migration-guide.md) diff --git a/plugins/domains/post-app-rename-setup b/plugins/domains/post-app-rename-setup index 7a2d2a5ff..9b710ac9a 100755 --- a/plugins/domains/post-app-rename-setup +++ b/plugins/domains/post-app-rename-setup @@ -7,11 +7,12 @@ trigger-domains-post-app-rename-setup() { declare trigger="post-app-rename-setup" declare OLD_APP="$1" NEW_APP="$2" - if [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]]; then - sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS" - fi + rm -f "$DOKKU_ROOT/$NEW_APP/URLS" + if [[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]]; then - sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST" + while read -r VHOST || [[ -n "$VHOST" ]]; do + sed -i -e "s/$OLD_APP.$VHOST/$NEW_APP.$VHOST/g" "$DOKKU_ROOT/$NEW_APP/VHOST" + done <"$DOKKU_ROOT/VHOST" fi } diff --git a/tests/unit/domains.bats b/tests/unit/domains.bats index 96743cfd7..f37f88ff4 100644 --- a/tests/unit/domains.bats +++ b/tests/unit/domains.bats @@ -327,3 +327,31 @@ teardown() { dokku --force apps:destroy test.dokku.test } + +@test "(domains) app rename only renames domains associated with global domains" { + run /bin/bash -c "dokku domains:set-global dokku.me" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku domains:set $TEST_APP $TEST_APP.dokku.me $TEST_APP.dokku.test" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku apps:rename $TEST_APP other-name" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku domains:report other-name --domains-app-vhosts" + echo "output: $output" + echo "status: $status" + assert_success + assert_output "other-name.dokku.me $TEST_APP.dokku.test" + + run /bin/bash -c "dokku apps:rename other-name $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success +}