Copyright 2017-2019, Schlumberger
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Spatial Reference Catalog Service
This repository contains
- The Java implementation of the Spatial Reference Catalog (aka crs-catalog). The Java code is located in the
src
folder. To open the Java project, openpom.xml
. - Tests are located in
src/test/java/org/opengroup/osdu/crs/...
- The openapi specification file is crs_catalog_openapi.json.
- Python integration and health tests in the
testing
folder. See also the test's README.md
Prerequisites
- The project builds with maven. Make sure maven is installed locally.
- The project requires the Lombok plug-in installed for your IDE.
Build service and run unit tests
mvn clean install
Running Azure Catalog Service locally
Build and run Catalog Service locally using bash
- Set the required environments described in Release/deployment section
- Navigate to the Catalog Service's root folder
crs-catalog-service
- Build core and run unit tests in command line:
mvn clean install
# To run without tests add -Dmaven.test.skip=true
- Navigate to the Catalog Service's root folder
crs-catalog-service
- Run application with command
java -Dclient-id=${aad_client_id} -jar provider/crs-catalog-azure/crs-catalog-aks/target/crs-catalog-aks-1.0.0.jar
Running Azure Catalog Service using IntelliJ IDEA
Navigate to the Create Run/Debug Configuration tool Select 'Add New Configuration' and select Application
Type the next commands into the suggested fields:
- Working directory:
{path_to_the_catalog}/crs-catalog-service
- Main class:
org.opengroup.osdu.crs.CrsAksApplication
- Use classpath of module:
crs-catalog-aks
Note: If you don't see "crs-catalog-aks" in the dropdown menu - find appropriate pom.xml and click "Add as a Maven project" - Environment variables: Set the required environments described in Release/deployment section
Execute Run or Debug for configured Application
Debug locally - e.g. using Postman
In the Postman Settings / General, turn SSL certificate validation off when running locally.
Similarly, when not using Postman but client code, set the configuration verify_ssl
false (see instructions)
Run application using debug mode and use Postman to send a GET request to obtaining the Swagger API documentation
http://localhost:8080/api/crs/catalog/v2/swagger.json
or send a Get request to catalog:
http://localhost:8080/api/crs/catalog/v2
Open the Swagger-UI:
http://localhost:8080/api/crs/catalog/swagger-ui.html
Headers for Postman:
Key | Value |
---|---|
Authorization | Bearer <token>
|
data-partition-id | $MY_TENANT (see testing\README.md) |
Build and run the Docker container locally
- Run the
maven run
command to have the .jar file generated. - Have the Azure subscription set up
- Open a Powershell
- Install the Azure CLI locally
- Authenticate yourself to Azure Container Registry (acr) with the following command:
az acr login --name delfi
- Execute the following command to build the container image:
docker build -t crs-catalog .
- Execute the following command to build the container image:
docker run -t --rm -p 8080:8080 crs-catalog
- Use Postman or curl to try out the endpoints
Release/deployment
VSTS release definition is located at provider\crs-catalog-azure\crs-catalog-aks\devops, which requires the following environment variables:
Variable | Contents |
---|---|
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.