Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
README.md 7.88 KiB

legal-gcp

os-legal-gcp is a Spring Boot service that hosts CRUD APIs that enable management of legal tags within the OSDU R2 ecosystem.

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.

Prerequisites

Installation

  • Setup Apache Maven
  • Setup AdoptOpenJDK
  • Setup GCloud SDK
  • Install Eclipse (or other IDE) to run applications
  • Set up environment variables for Apache Maven and AdoptOpenJDK. For example M2_HOME, JAVA_HOME, etc.
  • Add a configuration for build project in Eclipse(or other IDE)

Run Locally

Environment Variables

In order to run the service locally, you will need to have the following environment variables defined.

name value description sensitive? source
LOG_PREFIX legal Logging prefix no -
AUTHORIZE_API https://entitlements.com/entitlements/v1 Entitlements API endpoint no output of infrastructure deployment
LEGAL_HOSTNAME-NAME ex os-legal-dot-opendes.appspot.com Legal hostname no -
GCLOUD_PROJECT ex osdu-cicd-epam Google cloud project id no --
GOOGLE_AUDIENCES ex *****.apps.googleusercontent.com Client ID for getting access to cloud resources yes https://console.cloud.google.com/apis/credentials
GOOGLE_APPLICATION_CREDENTIALS ex /path/to/directory/service-key.json Service account credentials, you only need this if running locally yes https://console.cloud.google.com/iam-admin/serviceaccounts
RECORDS_ROOT_URL ex https://os-storage-dot-nice-etching-277309.uc.r.appspot.com/api/storage/v2 / Storage API endpoint no output of infrastructure deployment
REDIS_GROUP_HOST ex 127.0.0.1 Redis host for groups no https://console.cloud.google.com/memorystore/redis/instances
REDIS_STORAGE_HOST ex 127.0.0.1 Redis host for storage no https://console.cloud.google.com/memorystore/redis/instances
REDIS_GROUP_PORT ex 6379 Redis port for groups no https://console.cloud.google.com/memorystore/redis/instances
REDIS_STORAGE_PORT ex 6379 Redis port for storage no https://console.cloud.google.com/memorystore/redis/instances
PARTITION_API ex http://localhost:8081/api/partition/v1 Partition service endpoint no -
ENABLE_FULL_BUCKET_NAME ex true Full bucket name no -

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 may need to configure access to the remote maven repository that holds the OSDU dependencies. This file should live within ~/.mvn/community-maven.settings.xml:

$ cat ~/.m2/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>community-maven-via-private-token</id>
            <!-- Treat this auth token like a password. Do not share it with anyone, including Microsoft support. -->
            <!-- The generated token expires on or before 11/14/2019 -->
             <configuration>
              <httpHeaders>
                  <property>
                      <name>Private-Token</name>
                      <value>${env.COMMUNITY_MAVEN_TOKEN}</value>
                  </property>
              </httpHeaders>
             </configuration>
        </server>
    </servers>
</settings>
  • Update the Google cloud SDK to the latest version:
gcloud components update
  • Set Google Project Id:
gcloud config set project <YOUR-PROJECT-ID>