Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Name Last commit Last update
..
docs
maven
src
README.md
lombok.config
pom.xml

Running Locally

Requirements

In order to run this service locally, you will need the following:

General Tips

Environment Variable Management The following tools make environment variable configuration simpler

Lombok This project uses Lombok for code generation. You may need to configure your IDE to take advantage of this tool.

Environment Variables

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

Note The following command can be useful to pull secrets from keyvault:

az keyvault secret show --vault-name $KEY_VAULT_NAME --name $KEY_VAULT_SECRET_NAME --query value -otsv

Required to run service

name value description sensitive? source
LOG_PREFIX notification Logging prefix no -
app.entitlements ex https://foo-entitlements.azurewebsites.net Entitlements API endpoint no output of infrastructure deployment
app.register ex https://foo-register.azurewebsites.net Registration Service API endpoint no output of infrastructure deployment
AUTHORIZE_API_KEY ******** The API key clients will need to use when calling the entitlements yes --
azure.application-insights.instrumentation-key ******** API Key for App Insights yes output of infrastructure deployment
azure.activedirectory.client-id ******** AAD client application ID yes output of infrastructure deployment
azure.activedirectory.AppIdUri api://${azure.activedirectory.client-id} URI for AAD Application no --
azure.activedirectory.session-stateless true Flag run in stateless mode (needed by AAD dependency) no --
KEYVAULT_URI ex https://foo-keyvault.vault.azure.net/ URI of KeyVault that holds application secrets no output of infrastructure deployment
PARTITION_API ex https://foo-partition.azurewebsites.net Partition Service API endpoint no output of infrastructure deployment
azure.activedirectory.app-resource-id ******** AAD client application ID yes output of infrastructure deployment

Configure Maven

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="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>os-core</id>
            <username>mvn-pat</username>
            <!-- Treat this auth token like a password. Do not share it with anyone, including Microsoft support. -->
            <password>$PERSONAL_ACCESS_TOKEN_GOES_HERE</password>
        </server>
    </servers>
</settings>

Build and run the application

After configuring your environment as specified above, you can follow these steps to build and run the application.

  1. Navigate to the root of the schema project, os-schema. For building the project using command line, run below command :
    mvn clean install
    This will build the core project as well as all the underlying projects. If we want to build projects for specific cloud vendor, we can use mvn --projects command. For example, if we want to build only for Azure, we can use below command :
    mvn --projects notification-core,provider/notification-azure clean install
  2. Run schema service in command line. We need to select which cloud vendor specific schema-service we want to run. For example, if we want to run schema-service for Azure, run the below command :
    # Running Azure : 
    java -jar  provider\schema-azure\target\os-notification-azure-0.0.1-SNAPSHOT-spring-boot.jar
  3. The port and path for the service endpoint can be configured in application.properties in the provider folder as following. If not specified, then the web container (ex. Tomcat) default is used:
    server.servlet.contextPath=/api/notification/v1/
    server.port=8080

Debugging

Jet Brains - the authors of Intellij IDEA, have written an excellent guide on how to debug java programs.

Deploying service

TBD

License

Copyright © Microsoft Corporation

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.