Skip to content

Commit cec0a4c

Browse files
Updates Migration Docs
1 parent 72d33ea commit cec0a4c

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ are three options if you have an existing deployment that uses Elasticsearch:
142142
6. Deploy the 0.5.x stac-server code with the updated serverless.yml file
143143
7. Through the AWS Console, upgrade the OpenSearch Service domain from Elasticsearch 7.10
144144
to OpenSearch 1.3, retaining the compatibilty mode enabled configuration.
145-
8. Upgrade the OpenSearch 1.3 domain to OpenSearch 2.3.
145+
8. Upgrade the OpenSearch 1.3 domain to OpenSearch 2.5.
146146
9. Re-deploy the stack without the ES_COMPAT_MODE environment variable set.
147147
3. (Preferred) Disconnect the Elasticsearch domain from the stac-server CF Stack, deploy a new stac-server CF Stack,
148148
upgrade the Elasticsearch domain to OpenSearch, and connect the domain to the new CF Stack.
@@ -155,7 +155,7 @@ renamed `OPENSEARCH_HOST`.
155155

156156
**Note! The migration must be done carefully to avoid losing the database!**
157157

158-
The major part of this migration is the use of OpenSearch 2.3 instead of Elasticsearch
158+
The major part of this migration is the use of OpenSearch 2.5 instead of Elasticsearch
159159
7.10. Confusingly, both of these are options in the AWS OpenSearch Service, but the Elasticsearch option
160160
is no longer being updated by AWS in favor of OpenSearch.
161161

@@ -166,42 +166,44 @@ can't "migrate" between these resource types. So, the approach is to upgrade the
166166
to OpenSearch in compatibility mode, then clone the CloudFormation Stack, and import
167167
the OpenSearch domain into it.
168168

169-
With the 0.4.x codebase, change the serverless.yml file to add to the AWS::Elasticsearch::Domain definition at the same
170-
level as the `Type` attribute these two attributes:
169+
1. With the 0.4.x codebase, change the serverless.yml file to add `DeletionPolicy: Retain` and `UpdateReplacePolicy: Retain` to the `AWS::Elasticsearch::Domain` definition at the same level as the `Type` and deploy. See instructions for deploying [here](https://github.com/stac-utils/stac-server/blob/main/README.md#deployment).
171170

172171
```yaml
173-
DeletionPolicy: Retain
174-
UpdateReplacePolicy: Retain
172+
Type: AWS::Elasticsearch::Domain
173+
DeletionPolicy: Retain
174+
UpdateReplacePolicy: Retain
175+
Properties:
176+
. . .
175177
```
176178
177-
and deploy.
178-
179-
The existing Elasticsearch domain must be manually migrated to OpenSearch. Prior to
179+
2. The existing Elasticsearch domain must be manually migrated to OpenSearch. Prior to
180180
re-deploying the stack, use the AWS Console to manually upgrade the
181181
Elasticsearch domain (`Actions->Upgrade`) to OpenSearch 1.3. Select "Enable
182182
compatibility mode" to support the existing stac-server 0.4.x code using the Elasticsearch
183183
JavaScript client library (@elastic/elasticsearch version 7.9.0). After this upgrade to
184-
OpenSearch 1.3, then upgrade the domain to OpenSearch 2.3.
184+
OpenSearch 1.3, then upgrade the domain to OpenSearch 2.5.
185185

186-
Create a clone of the stac-server 0.5.x code. Copy and update the serverless.yml file used for the 0.4.0 deployment with these changes:
186+
3. Create a clone of the stac-server 0.5.x code. Copy and update the serverless.yml file used for the 0.4.0 deployment with these changes:
187187

188188
- `ElasticSearchInstance` should be renamed to `OpenSearchInstance`
189189
- The `Type` of this resource should be changed from `AWS::Elasticsearch::Domain` to
190190
`AWS::OpenSearchService::Domain`
191191
- `ElasticsearchClusterConfig` is now `ClusterConfig`
192192
- `InstanceType` values have changed, e.g., t3.small.elasticsearch is now t3.small.search
193-
- `ElasticsearchVersion` is replaced with `EngineVersion` and set to `OpenSearch_2.3`
193+
- `ElasticsearchVersion` is replaced with `EngineVersion` and set to `OpenSearch_2.5`
194194
- `EsEndpoint` should be renamed to `OpenSearchEndpoint` and the exported name suffixed
195195
with `-os-endpoint` instead of `-es-endpoint`
196196
- Environment variable `STAC_API_VERSION` should be removed to instead defer to the current default version
197197

198-
You can also compare it with the serverless.example.yml file. The `DomainName` value
198+
- The `DomainName` value
199199
**must** remain the same as it is for the current deployment so
200200
the CloudFormation deployment will import the existing resource. Instead of a parameterized
201201
value of `${self:service}-${self:provider.stage}` as in the example serverless.yml file,
202202
it would have a hard-coded service name and `-es` suffix, e.g., `my-stac-server-${self:provider.stage}-es`.
203203

204-
Run `npm run package` to generate the CloudFormation templates in the `.serverless` directory.
204+
- Note: these changes can be checked against the [serverless.example.yml](https://github.com/stac-utils/stac-server/blob/main/serverless.example.yml) file.
205+
206+
4. Run `npm run package` to generate the CloudFormation templates in the `.serverless` directory.
205207
Extract from the file `.serverless/cloudformation-template-update-stack.json` a template
206208
that only has the OpenSearchInstance resource in it. For example:
207209

@@ -240,15 +242,14 @@ that only has the OpenSearchInstance resource in it. For example:
240242
}
241243
```
242244

243-
Within CloudFormation, choose `Create stack` and `With existing resources (import resources)`.
244-
Upload the template that contains only the OpenSearch resource. Choose a new stack name for this similar to the old one, e.g., `my-stac-server-2` and update `service` name in the serverless.yml file with this name. When prompted for the name of the OpenSearch Domain, put in the name of the existing one, e.g., `my-stac-server-dev-es`.
245+
5. Within CloudFormation, choose `Create stack` and `With existing resources (import resources)`.
246+
Upload the template that contains only the OpenSearch resource. Choose a new stack name for this similar to the old one, e.g., `my-stac-server-2-{deploy-stage}` and update `service` name in the serverless.yml file with this name without the deploy stage e.g., `my-stac-server-2`. When prompted for the name of the OpenSearch Domain, put in the name of the existing one, e.g., `my-stac-server-dev-es`.
245247

246-
Deploy the new stack with `npm run deploy`. This should appear as an update to the CloudFormation stack that was just created manually, and should use the existing Open
247-
Search domain.
248+
6. Deploy the new stack with `npm run deploy -- --stage {deploy-stage}`. This should appear as an update to the CloudFormation stack that was just created manually, and should use the existing OpenSearch domain.
248249

249-
Switch the DNS entry for the domain name to the API Gateway endpoint for the new Stack.
250+
7. Switch the DNS entry for the domain name to the API Gateway endpoint for the new Stack. See instructions [here](https://github.com/stac-utils/stac-server/blob/main/README.md#proxying-stac-server-through-cloudfront).
250251

251-
Double-check that the `DeletionPolicy: Retain` is set on the old Stack for the Elasticsearch/OpenSearch resource, and then delete the old Stack.
252+
8. Double-check that the `DeletionPolicy: Retain` is set on the old Stack for the Elasticsearch/OpenSearch resource, and then delete the old Stack.
252253

253254
#### Granting Access for Thumbnails
254255

0 commit comments

Comments
 (0)