|
7 | 7 | Upgrading Deis |
8 | 8 | ============== |
9 | 9 |
|
10 | | -This guide provides some general information and considerations around upgrading a Deis cluster. |
11 | | -Additional tooling around upgrading Deis is planned for a future Deis release |
12 | | -(tracked in `#710`_). The upgrade strategies outlined below |
13 | | -reflect the current state of the Deis platform - they are certainly not ideal, and significant work |
14 | | -is planned to make upgrading Deis much less painful for future releases. |
| 10 | +There are currently two strategies for upgrading a Deis cluster: |
15 | 11 |
|
16 | | -The current recommended upgrade paths for Deis are either to provision a new cluster and cut over |
17 | | -DNS to point to new application endpoints, or to perform an in-place upgrade of Deis components. |
| 12 | +* In-place Upgrade (recommended) |
| 13 | +* Migration Upgrade |
18 | 14 |
|
19 | | -Deploying a New Cluster |
20 | | ------------------------ |
| 15 | +In-place Upgrade |
| 16 | +---------------- |
21 | 17 |
|
22 | | -This upgrade method provisions a new cluster running in parallel to the old one. Applications are |
23 | | -pushed to this new cluster one-by-one, and DNS records are updated to cut over traffic on a |
24 | | -per-application basis. This results in a no-downtime controlled upgrade, but has the caveat that no |
25 | | -data from the old cluster (users, releases, etc.) is retained. Future upgrade tooling will have |
26 | | -facilities to export and import cluster data. |
27 | | - |
28 | | -Provision servers |
29 | | -^^^^^^^^^^^^^^^^^ |
30 | | -A new cluster can be provisioned by following the release's README or contrib/ directory tooling. |
31 | | -Be sure to use a new etcd discovery URL so that the new cluster doesn't interfere with the running one. |
32 | | - |
33 | | -Upgrade Deis client and fleetctl |
34 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
35 | | -The latest Deis client should be installed. You can either use pip or download a pre-compiled binary. |
36 | | -See the release notes or the release's README for a link to the latest client. |
37 | | - |
38 | | -Also, new Deis releases frequently require upgrades to the fleetctl client. Again, see the release |
39 | | -notes for the new release to see if an upgrade is necessary. |
| 18 | +An in-place upgrade swaps out platform containers for newer versions on the same set of hosts, |
| 19 | +leaving your applications and platform data intact. This is the easiest and least disruptive upgrade strategy. |
| 20 | +The general approach is to use ``deisctl`` to uninstall all platform components, update the platform version |
| 21 | +and then reinstall platform components. |
40 | 22 |
|
41 | | -Before upgrading the client, we should logout with the old client: |
42 | | - |
43 | | -.. code-block:: console |
| 23 | +.. note:: |
44 | 24 |
|
45 | | - dev $ deis logout |
| 25 | + In-place upgrades are supported starting from Deis version 0.14.0 |
46 | 26 |
|
47 | | -Register and login to the new controller |
48 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
49 | | -Register an account on the new controller and login. |
| 27 | +Use the following steps to perform an in-place upgrade of your Deis cluster. |
50 | 28 |
|
51 | 29 | .. code-block:: console |
52 | 30 |
|
53 | | - dev $ deis register http://deis.newcluster.example.org |
54 | | - dev $ deis login http://deis.newcluster.example.org |
55 | | - dev $ deis keys:add |
| 31 | + $ deisctl uninstall platform |
| 32 | + $ deisctl config platform set version=v0.14.0 |
| 33 | + $ deisctl install platform |
| 34 | + $ deisctl start platform |
56 | 35 |
|
57 | | -Push apps to the new cluster |
58 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
59 | | -Each application will need to be deployed to the new cluster. You can use ``deis apps:list`` to help |
60 | | -enumerate all existing applications. |
| 36 | +.. attention:: |
61 | 37 |
|
62 | | -For each existing application, rename the existing deis remote, and create a new application. |
63 | | - |
64 | | -.. code-block:: console |
| 38 | + In-place upgrades incur approximately 10-30 minutes of downtime for deployed applications, the router mesh |
| 39 | + and the platform control plane. Please plan your maintenance windows accordingly. |
65 | 40 |
|
66 | | - dev $ git remote rename deis deis-old |
67 | | - dev $ deis create |
68 | | - dev $ git push deis master |
69 | 41 |
|
70 | | -Note that you'll also need to ``deis config:set`` for each environment variable an application |
71 | | -references - use ``deis config:list`` to enumerate these. |
| 42 | +Migration Upgrade |
| 43 | +----------------- |
72 | 44 |
|
73 | | -Now each application is running on the new cluster, but they are still running (and serving traffic) |
74 | | -on the old cluster. |
| 45 | +This upgrade method provisions a new cluster running in parallel to the old one. Applications are |
| 46 | +migrated to this new cluster one-by-one, and DNS records are updated to cut over traffic on a |
| 47 | +per-application basis. This results in a no-downtime controlled upgrade, but has the caveat that no |
| 48 | +data from the old cluster (users, releases, etc.) is retained. Future ``deisctl`` tooling will have |
| 49 | +facilities to export and import this platform data. |
75 | 50 |
|
76 | | -We need to tell Deis that this application can be accessed by its old name: |
| 51 | +.. note:: |
77 | 52 |
|
78 | | -.. code-block:: console |
| 53 | + Migration upgrades are useful for moving Deis to a new set of hosts, |
| 54 | + but should otherwise be avoided due to the amount of manual work involved. |
79 | 55 |
|
80 | | - dev $ deis domains:add oldappname.oldcluster.example.org |
| 56 | +.. important:: |
81 | 57 |
|
82 | | -Test applications |
83 | | -^^^^^^^^^^^^^^^^^ |
84 | | -Test to make sure applications work as expected on the new Deis cluster. |
| 58 | + In order to migrate applications, your new cluster must have network access |
| 59 | + to the registry component on the old cluster |
85 | 60 |
|
86 | | -Update DNS records |
87 | | -^^^^^^^^^^^^^^^^^^ |
88 | | -For each application, create CNAME records to point the old application names to the new. Note that |
89 | | -once these records propagate, the new cluster is serving live traffic. You can perform cutover on a |
90 | | -per-application basis and slowly retire the old cluster. |
| 61 | +Enumerate Existing Applications |
| 62 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 63 | +Each application will need to be deployed to the new cluster manually. |
| 64 | +Log in to the existing cluster as an admin user and use the ``deis`` client to |
| 65 | +gather information about your deployed applications. |
91 | 66 |
|
92 | | -If an application is named 'happy-bandit' on the old Deis cluster and 'jumping-cuddlefish' on the |
93 | | -new cluster, you would create a DNS record that looks like the following: |
| 67 | +List all applications with: |
94 | 68 |
|
95 | 69 | .. code-block:: console |
96 | 70 |
|
97 | | - happy-bandit.oldcluster.example.org. CNAME jumping-cuddlefish.newcluster.example.org |
| 71 | + $ deis apps:list |
98 | 72 |
|
99 | | -Retire the old cluster |
100 | | -^^^^^^^^^^^^^^^^^^^^^^ |
101 | | -Once all applications have been validated, the old cluster can be retired. |
| 73 | +Gather each application's version with: |
102 | 74 |
|
103 | | -Deploying a new Cluster with External Components |
104 | | ------------------------------------------------- |
| 75 | +.. code-block:: console |
105 | 76 |
|
106 | | -If you're upgrading from a cluster where you have outsourced your components outside of |
107 | | -Deis (such as migrating deis-database onto Amazon Relational Database Services), you have |
108 | | -the benefit of preserving existing data, but you still need to update DNS records and the |
109 | | -like. |
| 77 | + $ deis apps:info -a <app-name> |
110 | 78 |
|
111 | | -Provision Servers |
| 79 | +Provision servers |
112 | 80 | ^^^^^^^^^^^^^^^^^ |
| 81 | +Follow the Deis documentation to provision a new cluster using your desired target release. |
| 82 | +Be sure to use a new etcd discovery URL so that the new cluster doesn't interfere with the running one. |
113 | 83 |
|
114 | | -Provision the CoreOS cluster as you normally would with any release of Deis. However, do |
115 | | -not install any components onto this cluster. We need to point etcd to the components |
116 | | -which are running outside of the cluster. |
117 | | - |
118 | | -Export Etcd Keys |
119 | | -^^^^^^^^^^^^^^^^ |
| 84 | +Upgrade Deis clients |
| 85 | +^^^^^^^^^^^^^^^^^^^^ |
| 86 | +If changing versions, make sure you upgrade your ``deis`` and ``deisctl`` clients |
| 87 | +to match the cluster's release. |
120 | 88 |
|
121 | | -To migrate over, start by pointing the new cluster at the old cluster's endpoints: |
| 89 | +Register and login to the new controller |
| 90 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 91 | +Register an account on the new controller and login. |
122 | 92 |
|
123 | 93 | .. code-block:: console |
124 | 94 |
|
125 | | - $ deisctl config database set host pqsl.example.org |
126 | | - $ deisctl config database set port 1234 |
127 | | - ... |
| 95 | + $ deis register http://deis.newcluster.example.org |
| 96 | + $ deis login http://deis.newcluster.example.org |
128 | 97 |
|
129 | | -Next, you'll also want to migrate over the application directories: |
130 | | - |
131 | | - $ etcdctl mkdir /deis/services/appname |
132 | | - |
133 | | -Start new Components |
| 98 | +Migrate applications |
134 | 99 | ^^^^^^^^^^^^^^^^^^^^ |
| 100 | +The ``deis pull`` command makes it easy to migrate existing applications from |
| 101 | +one cluster to another. However, you must have network access to the existing |
| 102 | +cluster's registry component. |
135 | 103 |
|
136 | | -The Makefile takes care of this logic for us: |
| 104 | +Migrate a single application with: |
137 | 105 |
|
138 | 106 | .. code-block:: console |
139 | 107 |
|
140 | | - dev $ make run |
| 108 | + $ deis create <app-name> |
| 109 | + $ deis pull registry.oldcluster.example.org:5000/<app-name>:<version> |
141 | 110 |
|
142 | | -Re-deploy Apps to the new Cluster |
143 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 111 | +This will move the application's Docker image across clusters, ensuring the application |
| 112 | +is migrated bit-for-bit with an identical build and configuration. |
144 | 113 |
|
145 | | -With this process, re-deploying apps couldn't be easier. Just scale the processes down to |
146 | | -0 for each application, then scale back up. |
| 114 | +Now each application is running on the new cluster, but they are still running (and serving traffic) |
| 115 | +on the old cluster. Use ``deis domains:add`` to tell Deis that this application can be accessed |
| 116 | +by its old name: |
147 | 117 |
|
148 | 118 | .. code-block:: console |
149 | 119 |
|
150 | | - $ deis scale --app example web=0 |
151 | | - $ deis scale --app example web=3 |
| 120 | + $ deis domains:add oldappname.oldcluster.example.org |
152 | 121 |
|
153 | | -.. note:: |
154 | | - |
155 | | - Support for ``deis ps:restart`` is being tracked in `#467`_. |
| 122 | +Repeat for each application. |
156 | 123 |
|
157 | 124 | Test applications |
158 | 125 | ^^^^^^^^^^^^^^^^^ |
159 | | - |
160 | 126 | Test to make sure applications work as expected on the new Deis cluster. |
161 | 127 |
|
162 | 128 | Update DNS records |
163 | 129 | ^^^^^^^^^^^^^^^^^^ |
| 130 | +For each application, create CNAME records to point the old application names to the new. Note that |
| 131 | +once these records propagate, the new cluster is serving live traffic. You can perform cutover on a |
| 132 | +per-application basis and slowly retire the old cluster. |
164 | 133 |
|
165 | | -Once you've finished migrating over to the new cluster, just update your wildcard DNS to |
166 | | -point at your new load balancer. The application names are all the same, so no CNAME |
167 | | -modification needs to occur. |
| 134 | +If an application is named 'happy-bandit' on the old Deis cluster and 'jumping-cuddlefish' on the |
| 135 | +new cluster, you would create a DNS record that looks like the following: |
168 | 136 |
|
169 | | -.. _`#710`: https://github.com/deis/deis/issues/710 |
170 | | -.. _`#467`: https://github.com/deis/deis/issues/467 |
| 137 | +.. code-block:: console |
| 138 | +
|
| 139 | + happy-bandit.oldcluster.example.org. CNAME jumping-cuddlefish.newcluster.example.org |
| 140 | +
|
| 141 | +Retire the old cluster |
| 142 | +^^^^^^^^^^^^^^^^^^^^^^ |
| 143 | +Once all applications have been validated, the old cluster can be retired. |
0 commit comments