Merge pull request #5019 from dokku/4965-global-domain-renames
Only rename app domains associated with a global domain
This commit is contained in:
13
docs/appendices/0.27.0-migration-guide.md
Normal file
13
docs/appendices/0.27.0-migration-guide.md
Normal file
@@ -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
|
||||
```
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user