Commit bf98a0a2 authored by Riabokon Stanislav(EPAM)[GCP]'s avatar Riabokon Stanislav(EPAM)[GCP]
Browse files

Added for GCP.

parent fd7ab659
Pipeline #10856 failed with stage
in 34 seconds
......@@ -106,3 +106,8 @@ requires the following environment variables:
| ENTITLEMENT_URL | Required |
| client-id | Required, Azure AAD client id |
| CRS_CATALOG_FILENAME | Required, e.g. `{path_to_the_catalog}/crs-catalog-service/data/crs_catalog_v2.json` |
## GCP
Instructions for running the Google Cloud Platform implementation locally can be found [here](./provider/crs-catalog-gcp/crs-catalog-gke/
# Spatial Reference Catalog Service
The main goals of the Spatial Reference Catalog service are to offer
- *Coordinate Reference Systems* (CRSs) to enable end-users to
make a CRS selection.
- Search for CRSs given a number of constraints.
- Download of the entire catalog for local caching and when the cache
has to be refreshed.
- Access to various sub-sets of the catalog.
- Once a CRS is found, produce a persistable reference to be stored with
the data, which fully describes the CRS; this persistable reference string
becomes catalog independent. This means any consumer will be able to
understand the CRS definition even if a different catalog is used in the
future context.
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
### Requirements
* Java 8
* [Maven 3.6.0+](
* GCloud command line tool
* GCloud access to opendes project
### General Tips
**Environment Variable Management**
The following tools make environment variable configuration simpler
- [direnv]( - for a shell/terminal environment
- [EnvFile]( - for [Intellij IDEA](
This project uses [Lombok]( for code generation. You may need to configure your IDE to take advantage of this tool.
- [Intellij configuration](
- [VSCode configuration](
### Installation
In order to run the service locally or remotely, you will need to have the following environment variables defined.
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `LOG_PREFIX` | `service` | Logging prefix | no | - |
| `SERVER_SERVLET_CONTEXPATH` | `/api/crs/catalog/` | CRS Catalog service context path | no | - |
| `osdu.entitlement.url` | ex `` | Entitlements API endpoint | no | output of infrastructure deployment |
| `` | ex `C:\\osdu-delfi\\os-crs-catalog-service\\data\\crs_catalog_v2.json` | Crs Catalog V2 file | no | output of infrastructure deployment |
| `CRS_CATALOG_HOSTNAME` | ex `` | CRS Catalog host| no | output of infrastructure deployment |
| `AUDIENCES` | ex `*****` | Client ID for getting access to cloud resources | yes | |
| `PROJECT_ID` | ex `opendes` | Google Cloud Project Id| no | output of infrastructure deployment |
### Run Locally
Check that maven is installed:
$ mvn --version
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 1.8.0_212, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u212-b04/jre
You will need to configure access to the remote maven repository that holds the OSDU dependencies. This file should live within `~/.m2/settings.xml`:
$ cat ~/.m2/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns=""
<!-- Treat this auth token like a password. Do not share it with anyone, including Microsoft support. -->
* Update the Google cloud SDK to the latest version:
gcloud components update
* Set Google Project Id:
gcloud config set project <YOUR-PROJECT-ID>
* Perform a basic authentication in the selected project:
gcloud auth application-default login
* Navigate to CRS Catalog service root folder and run:
mvn jetty:run
## Testing
* Navigate to CRS Catalog service root folder and run:
mvn clean install
* If you wish to see the coverage report then go to testing/target/site/jacoco-aggregate and open index.html
* If you wish to build the project without running tests
mvn clean install -DskipTests
After configuring your environment as specified above, you can follow these steps to build and run the application. These steps should be invoked from the *repository root.*
cd provider/crs-catalog-gcp/crs-catalog-gke/ && mvn spring-boot:run
## Testing
Navigate to CRS Catalog service root folder and run all the tests:
# build + test + install core service code
$ (cd crs-catalog-core/ && mvn clean install)
## Test the application
After the service has started it should be accessible via a web browser by visiting [http://localhost:8080/api/crs/catalog/swagger-ui.html](http://localhost:8080/api/crs/catalog/swagger-ui.html). If the request does not fail, you can then run the integration tests.
### Running E2E Tests
This section describes how to run cloud OSDU E2E tests (testing/catalog_test_gcp/
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `INTEGRATION_TESTER` | `********` | A base64 encoded google service account json credentials authorization for OSDU services | yes | output of infrastructure deployment |
| `GOOGLE_AUDIENCES` | ex `*****` | Client ID for getting access to cloud resources | yes | |
## Tests core (testing/catalog_test_core/
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `BASE_URL` | ex `/api/crs/catalog/v2` | CRS Catalog service context path | yes | output of infrastructure deployment |
| `VIRTUAL_SERVICE_HOST_NAME` | ex `` | - | false | output of infrastructure deployment |
| `MY_TENANT` | ex `opendes` | Current Tenant | false | output of infrastructure deployment |
| --- |
| users<br/>service.entitlements.user<br/>data.test1<br/>data.integration.test<br/>users@{tenant1}@{domain}.com |
Execute following command to build code and run all the integration tests:
## Building/running
This integration test uses a swagger generated Python client to test a
deployed crs-catalog service.
The python client code is automatically generated. The latest online version (May 2018)
created incorrect impost statements for cyclic class references. Therefore the current
code is generated using [swagger-codegen-cli-2.2.3.jar](
The command to create the python code is:
cd testing
java -jar ~/swagger-codegen-cli-2.2.3.jar generate -i catalog_test_core/api_spec/crs-catalog-openapi-v2.json -l python -o catalog_test_core/v2
Go to the provider folder:
cd catalog_test_$PROVIDER_NAME/ # e.g. catalog_test_sauth
To set up a virtual environment:
virtualenv venv
To activate the venv:
venv\Scripts\activate (on Windows)
source venv/bin/activate (on Linux)
Install runtime dependencies in venv
python3 -m pip install -r requirements.txt
To run:
**Note:** To simulate a runtime exactly as that of the vsts build agent, you can simply exec into the docker image we use for the build agent, and run the tests from inside it. To know how to do this, please follow [this]( documentation.
## Deployment
See Google Documentation:
## Licence
Copyright © Google LLC
Copyright © EPAM Systems
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment