Commit 2e6164ec authored by Duo Chen's avatar Duo Chen
Browse files

Merge branch 'slb/dchen/update_readme' into 'master'

docs: Update the README.md

See merge request !247
parents dcbf666e 2036e5d5
Pipeline #75316 failed with stages
in 9 minutes and 32 seconds
# Introduction # Introduction
This project will provide restful APIs to access SEGY file headers. This project will provide the restful APIs to access SEGY file headers.
# Getting Started There are 3 ways to build and test this service: local, docker and GitLab.
# Local
## Getting Started
1. Installation process 1. Installation process
- Install Python virtual environment if not - Install Python virtual environment if not
`pip install virtualenv` `pip install virtualenv`
...@@ -14,12 +17,15 @@ This project will provide restful APIs to access SEGY file headers. ...@@ -14,12 +17,15 @@ This project will provide restful APIs to access SEGY file headers.
- `pip install keyring artifacts-keyring` - required for login and to access Azure artifacts - `pip install keyring artifacts-keyring` - required for login and to access Azure artifacts
- - create `pip.ini` (Windows) or `pip.conf` (Mac/Linux) with Azure package source under your virtualenv - Create `pip.ini` (Windows) or `pip.conf` (Mac/Linux) with Azure package source under your virtualenv directory.
``` ```
[global] [global]
extra-index-url=https://pkgs.dev.azure.com/slb1-swt/_packaging/SegyLibraryFeed%40Local/pypi/simple/ extra-index-url=https://SegyLibraryFeed%40Local:<your-PAT-key>@pkgs.dev.azure.com/slb1-swt/_packaging/SegyLibraryFeed%40Local/pypi/simple/
``` ```
Note: the personal access token (PAT) in pip.conf only lasts for one year. It started on 10/27/2021.
For more details, please visit [Get started with Python packages in Azure Artifacts](https://docs.microsoft.com/en-us/azure/devops/artifacts/quickstarts/python-packages?view=azure-devops)
- Install dependencies - Install dependencies
`pip install -r requirements.txt` `pip install -r requirements.txt`
...@@ -32,31 +38,46 @@ This project will provide restful APIs to access SEGY file headers. ...@@ -32,31 +38,46 @@ This project will provide restful APIs to access SEGY file headers.
2. Software dependencies 2. Software dependencies
- fastapi - fastapi
- uvicorn - uvicorn
- segysdk-python==<latest version> - segysdk-python==`<latest version>`
Note: you can find the latest version of segysdk-python on the following link: The latestion version of segysdk-python is `0.0.4028456`
https://dev.azure.com/slb1-swt/Petrel/_packaging?_a=feed&feed=SegyLibraryFeed%40Local Note: you can find the latest version of segysdk-python on the following [link](
https://dev.azure.com/slb1-swt/Petrel/_packaging?_a=feed&feed=SegyLibraryFeed%40Local).
3. Latest releases 3. Latest releases
4. API references 4. API references
# Build ## Build and Test
1. set environment variable `SDMS_SERVICE_HOST` to the url of seismic store service 1. set environment variable `SDMS_SERVICE_HOST` to the url of [seismic store service](https://slb-swt.visualstudio.com/carbon/_wiki/wikis/carbon.wiki/12539/SDMS-Core-Services).
For QA: `https://evt-mvp.managed-osdu.cloud.slb-ds.com/seistore-svc/api/v3`
2. `python main.py` 2. `python main.py`
3. Open `http://localhost:8000/seismic-file-metadata/api/v1/swagger-ui.html` in web browser 3. Open `http://localhost:8000/seismic-file-metadata/api/v1/swagger-ui.html` in web browser
- Enter bearer token and appkey for authorization - Enter bearer token (you can get it from Delfi Portal) and appkey for authorization
- Enter sdpath i.e. `sd://slb/sandbox/l10f1.sgy` - Enter sdpath i.e. `sd://opendes/dchentest/test.sgy`
# Docker image # Docker
## Getting Started
1. Build the docker image. `docker build -t segyimage . ` 1. Build the docker image. `docker build -t segyimage . `
2. Run the docker image. `docker run -d -it --rm --name segycontainer -p 8080:8000 segyimage`
3. Launch the web site. `http://localhost:8000/seismic-file-metadata/api/v1/swagger-ui.html`
4. Note: the personal access token in pip.conf only lasts for 90 days. It started on 7/26/2021.
## Build and Test
1. Run the docker image. `docker run --env SDMS_SERVICE_HOST=<SDMS_SERVICE_HOST> -d -it --rm --name segycontainer -p 8080:8000 segyimage`
Replace environment variable `<SDMS_SERVICE_HOST>` with the url of [seismic store service](https://slb-swt.visualstudio.com/carbon/_wiki/wikis/carbon.wiki/12539/SDMS-Core-Services).
For QA(P4D):
`docker run --env SDMS_SERVICE_HOST=https://evt-mvp.managed-osdu.cloud.slb-ds.com/seistore-svc/api/v3 -d -it --rm --name segycontainer -p 8080:8000 segyimage`
2. Open `http://localhost:8080/seismic-file-metadata/api/v1/swagger-ui.html` in web browser
- Enter bearer token (you can get it from Delfi Portal) and appkey for authorization
- Enter sdpath i.e. `sd://opendes/dchentest/test.sgy`
# GitLab
## Build and Test
1. [CI/CD Pipeline](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-service/-/pipelines)
2. `SDMS_SERVICE_HOST` is defined in `devops\azure\chart\templates\configmap.yaml`
3. [Test web url](https://osdu-glab.msft-osdu-test.org/seismic-file-metadata/api/v1/swagger-ui.html)
# Test # Run Unit Tests
1. Set the following environment variables 1. Set the following environment variables
`TOKEN_SVC_URL` `TOKEN_SVC_URL`
`SAUTH_SVC_ACC_SECRET` `SAUTH_SVC_ACC_SECRET`
......
import uvicorn import uvicorn
from fastapi import FastAPI, Request from fastapi import FastAPI, Request
from fastapi.exceptions import RequestValidationError from fastapi.exceptions import RequestValidationError
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
......
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