Skip to content

alliance-genome/agr_mati

Repository files navigation

agr_mati: Minting and Tracking Identifiers (MaTI)

Test MaTI on alpha and beta environments

Running the application in dev mode

MP_JWT_VERIFY_ISSUER=https://dev-$$$$$$.okta.com/oauth2/default
MP_JWT_VERIFY_PUBLICKEY_LOCATION=https://dev-$$$$$$.okta.com/oauth2/default/v1/keys
OKTA_TOKEN_URL=https://dev-$$$$$$.okta.com/oauth2/default/v1/token
OKTA_CLIENT_ID=??????????
OKTA_CLIENT_SECRET=?????????????????????????????????
OKTA_SCOPES=?????????
QUARKUS_DATASOURCE_USER=????????
QUARKUS_DATASOURCE_PASSWORD=????????
  • Run MaTI in dev mode using:
./mvnw compile quarkus:dev
export OKTA_CLIENT_ID=0000
export OKTA_CLIENT_SECRET=0000000
export OKTA_SCOPES=someScope
export OKTA_URL=https://dev-0000.okta.com

Then, do

make integration-test

Creating new subdomains

A new subdomain is created with a migration file in:

src/main/resources/db/migration/

like V0002__SCRUM-1493.sql or V0003__SCRUM-2024.sql

The sql for a new PostgreSQL sequence and a new record in the table subdomain must be written, for example:

INSERT INTO subdomain (code, name, description)
VALUES ('200', 'newSubdomain', 'Description of new Subdomain');
CREATE SEQUENCE subdomain_newSubdomain_seq;

Also, please add integration tests in class IdentifierResourceITCase for the new subdomain.

Releases

To Beta environment

After fetching information, check the existing tags

git fetch --all
git tag 

Now, create a pre-release tag, incrementing the last tag (example):

git tag -a v0.8.0-rc1 -m "MaTi pre-release"

Push the tag:

git push origin --tags

Draft a release in GitHub (marking Set as pre-release) selecting the tag created and publish. This will trigger the GitHub action to do a beta deployment.

To Production environment

After testing in beta, create a release tag:

git tag -a v0.8.0 -m "MaTi release"

Push the tag:

git push origin --tags

Draft a release in GitHub selecting the tag created and publish. This will trigger the GitHub action to do a production deployment.

Developing a client for the MaTI API

The example is in Python, it can be adapted to other languages. It requires the .env file and MaTI running on local

  • Fetch a valid token from okta
import requests
from decouple import config

OKTA_CLIENT_ID = config('OKTA_CLIENT_ID')
OKTA_CLIENT_SECRET = config('OKTA_CLIENT_SECRET')
OKTA_SCOPES = config('OKTA_SCOPES')
OKTA_TOKEN_URL = config('OKTA_TOKEN_URL')

payload = {'grant_type': 'client_credentials',
           'scope': OKTA_SCOPES}
headers = {'Accept': 'application/json',
           'Cache-Control': 'no-cache',
           'Content-Type': 'application/x-www-form-urlencoded'}

response = requests.request(
    'POST', OKTA_TOKEN_URL, data=payload, headers=headers,
    auth=(OKTA_CLIENT_ID, OKTA_CLIENT_SECRET))
token = response.json()['access_token']
  • Put the token and parameters in a request header
# Get value
url = 'http://localhost:8080/api/identifier'
headers = {'Authorization': 'Bearer ' + token,
           'subdomain': 'disease_annotation'}
response = requests.request("GET", url, headers=headers)
print(response.json())