forked from pivotal-cf/docs-ops-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitching-domains.html.md.erb
82 lines (55 loc) · 4.03 KB
/
switching-domains.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
title: Switching Application Domains
owner: Routing
---
<strong><%= modified_date %></strong>
This topic describes how to change the domain of an existing [Pivotal Cloud Foundry](https://network.pivotal.io/products/pivotal-cf) (PCF) installation, using an example domain change from `myapps.mydomain.com` to `newapps.mydomain.com`.
1. In PCF Ops Manager, select the **Pivotal Elastic Runtime** tile.
1. Select **Domains** from the menu to see the current **Apps Domain** for your Elastic Runtime deployment. In the following example it is `myapps.mydomain.com`.
<%= image_tag '../images/switching_domains/er17-switchdomains-before.png'%>
1. In the terminal, run `cf login -a YOUR_API_ENDPOINT`. The cf CLI prompts you for your PCF username and password, as well as the org and space you want to access. See [Identifying the API Endpoint for your Elastic Runtime Instance](../opsguide/api-endpoint.html) if you don’t know your API endpoint.
1. Run `cf domains` to view the domains in the space. If you have more than one shared domain, ensure that the domain you want to change is at the top of the list before you apply the new domain to your Elastic Runtime tile configuration. You can delete and re-create the other shared domains as necessary to push the domain you want to change to the top of the list. If you do this, make sure to [re-map the routes for each domain]
(../devguide/deploy-apps/routes-domains.html).
<pre class="terminal">
$ cf domains
Getting domains in org my-org as admin...
name status
myapps.mydomain.com shared
</pre>
1. Run `cf routes` to confirm that your apps are assigned to the domain you plan to change.
<pre class='terminal'>
$ cf routes
Getting routes as admin ...
space host domain apps
my-space myapp myapps.mydomain.com myapp
</pre>
1. Run `cf create-shared-domain YOUR_DESIRED_NEW_DOMAIN` to create the new domain you want to use:
<pre class='terminal'>
$ cf create-shared-domain newapps.mydomain.com
Creating shared domain newapps.mydomain.com as admin...
OK
</pre>
1. Run `cf map-route APP_NAME NEW_DOMAIN -n HOST_NAME` to map the new domain to your app. In this example both the `NEW_DOMAIN` and `HOST_NAME` arguments are `myapp`, since this is both the name of the app to which we are mapping a route, and the intended hostname for the URL.
<pre class='terminal'>
$ cf map-route myapp newapps.mydomain.com -n myapp
Creating route myapp.newapps.mydomain.com for org my-org / space my-space as admin...
OK
Adding route myapp.newapps.mydomain.com to app myapp in org my-org / space my-space as admin...
OK
</pre>
1. Repeat the previous step for each app in this space. Afterwards, check Apps Manager to confirm that the route URL has updated correctly for each app:
<%= image_tag '../images/switching_domains/new_domain_confirmed1.png'%>
1. Repeat the above steps for each space in your PCF installation except for the System org, beginning with logging into the org and space and ending with confirming the URL update.
<p class='note'><strong>Note</strong>: Ordinarily the System org contains only PCF apps that perform utility functions for your installation. Pivotal does not recommend pushing apps to this org. However, if you have pushed apps to System, you must also repeat the above steps for these apps.</p>
1. Once you have confirmed that every app in every space has been mapped to the new domain, delete the old domain by running `cf delete-shared-domain OLD_DOMAIN_TO_DELETE`:
<pre class='terminal'>
$ cf delete-shared-domain myapps.mydomain.com
Deleting domain myapps.mydomain.com as admin...
This domain is shared across all orgs.
Deleting it will remove all associated routes, and will make any app with this domain unreachable.
Are you sure you want to delete the domain myapps.mydomain.com?
> yes
OK
</pre>
1. Configure your Elastic Runtime tile to use the new domain, and apply changes. Apps that you push after your update finishes use this new domain.
<%= image_tag '../images/switching_domains/er17-switchdomains-after.png'%>