-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMR-8965: Create script to update legacy providers to new system (CMR) (
#1880) Adds a migration script to create metadata for each of the
- Loading branch information
1 parent
62f9697
commit 6664ab9
Showing
3 changed files
with
515 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Legacy Service Migration for Providers | ||
|
||
Provider Legacy Service Migration holds the migration scripts for migrating providers from CMR Legacy Service to CMR. | ||
|
||
The data migrated are all of the providers from legacy services. | ||
|
||
The data calls the legacy services REST api parses those values into metadata documents inside of a subdirectory called providerMetadata. These can then be ingested into the CMR utilizing the new providers interface. This will enable us to store metadata on these providers and change this metadata by versioning a schema against it. | ||
|
||
# Development Environment | ||
|
||
## Prerequisites | ||
* [Python](https://www.python.org/) | ||
|
||
## Installation | ||
* brew install python3 | ||
|
||
## Environment Variables | ||
Due to needing system tokens to be able to retrieve all provider data please align your env variables in the following format where env is either uat, sit, or prod. Alternatively you may use ops instead of prod if you prefer that | ||
* export CMR_<ENV>_TOKEN=<SYSTEM_TOKEN_FOR_CMR> | ||
|
||
* Install the needed python packages using pip | ||
pip install validators | ||
|
||
## Ingesting into local CMR: | ||
To validate the generated metadata you must have a running CMR instance. Please see https://github.com/nasa/Common-Metadata-Repository for how to setup CMR and what dependencies are needed. Alternatively you can validate the metadata a different way if you prefer after it is generated. Note that you should of course reset your CMR between runs where you ingest all of the provider metadata otherwise you will receive errors from CMR that you are trying to ingest duplicate providers. | ||
|
||
## Run Migration Without Ingesting | ||
|
||
Copy this ./provider directory locally. Make sure that you are connected to the VPN for SIT and UAT migrations | ||
|
||
`python3 migrate.py --env sit` | ||
|
||
## Run Migration over a specific CMR environment | ||
|
||
We should pass a flag to indicate which cmr env we want to pass. This will also align your system token for the given env as long as it was named in the proper way (see section on environment variables) | ||
|
||
This example will generate the provider metadata for providers in uat | ||
`python3 migrate.py --env uat` | ||
|
||
Note: that if you don't specify an env such as the call below;the default is the SIT environment | ||
`python3 migrate.py` | ||
|
||
|
||
## Run Migration With Ingesting to validate metadata | ||
|
||
We pass a flag for the migration script to try to ingest the provider metadata documents into a CMR env | ||
Note: this is always done locally for validation purposes and so a CMR env/instance must be running on your machine. | ||
|
||
The example below would attempt to ingest all of the sit providers from legacy services into your local CMR (sit is default with the env flag) | ||
`python3 migrate.py --ingest` | ||
|
||
|
||
## Run Migration With logging levels | ||
Logging levels for user cmd line output can be specified by passing the --logging or -log flags. Please only use valid logging allowed by the python logging library: | ||
debug, warning, info, or error. The default logging is info if one is not specified | ||
|
||
|
||
# Migration Report | ||
After a successful migration, a report file `provider_migration_log_file.txt` will be created | ||
this contains data on how many legacy-services providers were migrated how many were in CMR but, not in legacy services and vice-versa | ||
## License | ||
|
||
Copyright © 2023 NASA |
Oops, something went wrong.