Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.0 #54

Merged
merged 90 commits into from
Sep 7, 2023
Merged

v4.0 #54

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
93077e5
chore: remove middleware, routes
brouillette Jun 5, 2023
b9254f8
chore: removed dtos, constants, index/pseudo-fk,
brouillette Jun 5, 2023
c47d426
patch: metadata schema
brouillette Jun 5, 2023
aeedbf5
chore: removed tables es layer
brouillette Jun 5, 2023
3fe7247
chore: patch ingestion, santitation, workflows
brouillette Jun 5, 2023
7796caa
patch: readme
brouillette Jun 5, 2023
db59ca8
chore: begin associating variants with a dataset
brouillette Jun 6, 2023
1a0e59f
chore: add dataset to response object type
brouillette Jun 6, 2023
3a47884
chore: add datasets to variants overview
brouillette Jun 6, 2023
315170a
chore: dataset summary
brouillette Jun 8, 2023
2c2df96
chore: optimize dataset summary
brouillette Jun 8, 2023
cba7a57
chore: type safe dataset qp
brouillette Jun 8, 2023
1c6cd61
Merge branch 'master' into features/remove-tables
brouillette Jun 13, 2023
df72857
patch: fix auto-merge errors
brouillette Jun 13, 2023
32930bc
patch: readme
brouillette Jun 13, 2023
9253047
Merge branch 'master' into features/remove-tables
brouillette Jun 17, 2023
d66ed4f
Merge branch 'master' into releases/v4.0
brouillette Jun 17, 2023
c0a102b
chore: simple service-info unit test
brouillette Jun 13, 2023
d319318
patch: api internal port env
brouillette Jun 13, 2023
bb9c2da
chore: begin api test ci
brouillette Jun 14, 2023
434fd8d
patch: typo
brouillette Jun 14, 2023
6c5adec
patch: trigger ci
brouillette Jun 14, 2023
584bde9
patch: test includes env
brouillette Jun 14, 2023
6882d16
patch: include init in test-api
brouillette Jun 14, 2023
c4fd72f
patch: lowering default es resources
brouillette Jun 14, 2023
9df8332
patch: rename test job
brouillette Jun 14, 2023
60f665d
patch: unit tests, debug false, logs
brouillette Jun 14, 2023
dd7fa00
patch remove codecov
brouillette Jun 14, 2023
e8b5ef1
chore: include test drs
brouillette Jun 14, 2023
6170481
chore: build tests
brouillette Jun 14, 2023
bc6c80a
patch: install tabix on test host
brouillette Jun 14, 2023
f526e38
patch: sudo
brouillette Jun 14, 2023
e5f933e
patch: ingestion test error handling
brouillette Jun 14, 2023
153b7bc
patch: - temp file ownership setting, testing only
brouillette Jun 14, 2023
f5f6485
chore: testing drs logs on error
brouillette Jun 17, 2023
d397358
patch: rearranging try to catch test errors
brouillette Jun 17, 2023
d67e715
patch: init drs db and obj dirs
brouillette Jun 17, 2023
e974058
chore: refactoring test functions
brouillette Jun 18, 2023
106b220
chore: refactoring build tests, common tooling
brouillette Jun 18, 2023
5c60e79
chore: refactoring integration/build tests
brouillette Jun 18, 2023
793696b
chore: build/integration test refactoring
brouillette Jun 18, 2023
d9510fa
chore: build test get variants in order
brouillette Jun 18, 2023
a5976fd
chore: genes ingestion build test
brouillette Jun 19, 2023
ed9761b
patch: vcf/gtf data path permissions
brouillette Jun 19, 2023
6838d5d
chore: move genes integration tests to build
brouillette Jun 19, 2023
2fd22ea
patch: small pause, triggering and checking ingest
brouillette Jun 19, 2023
3d87c26
chore: test refactoring - var ingestion requests
brouillette Jul 3, 2023
acb2a53
patch: genes test touchup
brouillette Jul 3, 2023
d102203
chore: more variants build test refactoring
brouillette Jul 3, 2023
edd300d
patch: checkup logging typos
brouillette Jul 3, 2023
7f1cb52
chore: variants wildcard tests refactor
brouillette Jul 3, 2023
5c13d59
Merge pull request #52 from bento-platform/features/test-upgrade
brouillette Jul 7, 2023
d51c8b3
Merge branch 'releases/v4.0' into features/remove-tables
brouillette Jul 7, 2023
2773477
patch: tableId dataset typos
brouillette Jul 7, 2023
f4ed1dd
patch|test: dataset uuid ingestion patch and test
brouillette Jul 7, 2023
82939ff
test: variant overview content check
brouillette Jul 7, 2023
2340082
chore: dataset query test coverage
brouillette Jul 10, 2023
1048d3f
chore: improved datset query coverage
brouillette Jul 10, 2023
241d2c6
patch|chore: dataset http middleware, repo query
brouillette Jul 10, 2023
5682d71
nodemon hot reload
v-rocheleau Aug 14, 2023
dc3493f
add missing image dev.Dockerfile
v-rocheleau Aug 14, 2023
4a93253
node image
v-rocheleau Aug 14, 2023
db1e78e
go reload with air
v-rocheleau Aug 14, 2023
0a7d027
dev dockerfile use builder base
v-rocheleau Aug 14, 2023
a277830
dev dockerfil fix
v-rocheleau Aug 14, 2023
5660468
air config
v-rocheleau Aug 14, 2023
7546185
test air install
v-rocheleau Aug 14, 2023
9ef94a1
working air conf
v-rocheleau Aug 15, 2023
0612589
fix missing workflows from path
v-rocheleau Aug 15, 2023
6cffa72
dev container uses workflow mount
v-rocheleau Aug 16, 2023
1130879
vcf_gz.wdl calls gohan using access token
v-rocheleau Aug 16, 2023
b10044d
wes client token in workflow
v-rocheleau Aug 16, 2023
5afd1c6
fix authz header in curl
v-rocheleau Aug 17, 2023
d7d7de7
vscode go debug config and doc
v-rocheleau Aug 17, 2023
0213c1a
removed private url path prefix for drs ingest calls
v-rocheleau Aug 17, 2023
217cf8f
wes client auth
v-rocheleau Aug 21, 2023
8cfdc2a
gohan url from config
v-rocheleau Aug 22, 2023
7075ca3
uniform dataset responses
v-rocheleau Aug 23, 2023
485d66a
fix dataset routes
v-rocheleau Aug 23, 2023
eff15b6
variants count by dataset endpoint
v-rocheleau Aug 24, 2023
93b5dad
metadata_schema in data type response
v-rocheleau Aug 25, 2023
b324c00
delete variants by dataset id endpoint
v-rocheleau Aug 28, 2023
afda847
chore: add dev-container metadata to dev image
v-rocheleau Aug 28, 2023
f55926e
chore: update drs version, authz disabled
v-rocheleau Aug 29, 2023
299e20e
chore: set bento_user and git in dev image
v-rocheleau Aug 30, 2023
0a9836a
chore: bump base image version
v-rocheleau Aug 30, 2023
5c86809
chore: use bento golang base image
v-rocheleau Aug 30, 2023
cca5188
minimize prod image size with 2 stages
v-rocheleau Aug 30, 2023
8e45d95
Merge pull request #49 from bento-platform/features/remove-tables
v-rocheleau Aug 30, 2023
48bacac
fix dev container entrypopint dir
v-rocheleau Sep 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/api.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:
cp ./etc/example.env .env
source .env
echo "GOHAN_API_BUILDER_BASE_IMAGE=$GOHAN_API_BUILDER_BASE_IMAGE" >> $GITHUB_ENV
echo "GOHAN_API_BASE_IMAGE=$GOHAN_API_BASE_IMAGE" >> $GITHUB_ENV
echo "GOHAN_API_DEV_BASE_IMAGE=$GOHAN_API_DEV_BASE_IMAGE" >> $GITHUB_ENV
echo "GOHAN_API_PROD_BASE_IMAGE=$GOHAN_API_PROD_BASE_IMAGE" >> $GITHUB_ENV

- name: Load environment variables from .env file
uses: xom9ikk/dotenv@v2
Expand All @@ -41,10 +42,11 @@ jobs:
context: "{{defaultContext}}:src/api"
build-args: |
BUILDER_BASE_IMAGE=${{ env.GOHAN_API_BUILDER_BASE_IMAGE }}
BASE_IMAGE=${{ env.GOHAN_API_BASE_IMAGE }}
BASE_DEV_IMAGE=${{ env.GOHAN_API_DEV_BASE_IMAGE }}
BASE_PROD_IMAGE=${{ env.GOHAN_API_PROD_BASE_IMAGE }}
registry: ghcr.io
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
image-name: ghcr.io/bento-platform/gohan-api
development-dockerfile: Dockerfile
development-dockerfile: dev.Dockerfile
dockerfile: Dockerfile
47 changes: 47 additions & 0 deletions .github/workflows/api.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test gohan-api

on:
push:
branches:
- "**" # TEMP
pull_request:
branches:
- "features/**" # temp

jobs:
build-test:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Gather default environment variables
id: envx
run: |
cp ./etc/example.env .env
source .env

- name: Load environment variables from .env file
uses: xom9ikk/dotenv@v2

# - name: Run Bento build action
# uses: bento-platform/[email protected]
# with:
# context: "{{defaultContext}}:src/api"
# build-args: |
# BASE_IMAGE=${{ env.GOHAN_API_BASE_IMAGE }}
# registry: ghcr.io
# registry-username: ${{ github.actor }}
# registry-password: ${{ secrets.GITHUB_TOKEN }}
# image-name: ghcr.io/bento-platform/gohan-api
# development-dockerfile: Dockerfile
# dockerfile: Dockerfile
- name: API Test
run: |
sudo apt-get install -y tabix
make test-api
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
.vscode/*
!.vscode/launch.json
.DS_store
.idea

Expand All @@ -12,6 +13,7 @@ data/
data-x/

# vcfs
vcfs/*
*/vcfs/*.txt
*/vcfs/*.vcf
*/vcfs/*.vcf.gz
Expand Down
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to PID (Bento)",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 0,
}
]
}
47 changes: 41 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,29 @@ init-vendor:
init-data-dirs:
mkdir -p ${GOHAN_API_DRS_BRIDGE_HOST_DIR}
chown -R ${HOST_USER_UID}:${HOST_USER_GID} ${GOHAN_API_DRS_BRIDGE_HOST_DIR}
chmod -R 770 ${GOHAN_API_DRS_BRIDGE_HOST_DIR}
chmod -R 777 ${GOHAN_API_DRS_BRIDGE_HOST_DIR}

mkdir -p ${GOHAN_DRS_DATA_DIR}
mkdir -p ${GOHAN_DRS_DATA_DIR}/db
mkdir -p ${GOHAN_DRS_DATA_DIR}/obj
chown -R ${HOST_USER_UID}:${HOST_USER_GID} ${GOHAN_DRS_DATA_DIR}
chmod -R 770 ${GOHAN_DRS_DATA_DIR}
chmod -R 777 ${GOHAN_DRS_DATA_DIR}

mkdir -p ${GOHAN_ES_DATA_DIR}
chown -R ${HOST_USER_UID}:${HOST_USER_GID} ${GOHAN_ES_DATA_DIR}
chmod -R 770 ${GOHAN_ES_DATA_DIR}
chmod -R 777 ${GOHAN_ES_DATA_DIR}

@# tmp:
@# (setup for when gohan needs to preprocess vcf's at ingestion time):
mkdir -p ${GOHAN_API_VCF_PATH}
mkdir -p ${GOHAN_API_VCF_PATH}/tmp
chown -R ${HOST_USER_UID}:${HOST_USER_GID} ${GOHAN_API_VCF_PATH}
chmod -R 770 ${GOHAN_API_VCF_PATH}/tmp
chmod -R 777 ${GOHAN_API_VCF_PATH}

mkdir -p ${GOHAN_API_GTF_PATH}
mkdir -p ${GOHAN_API_GTF_PATH}/tmp
chown -R ${HOST_USER_UID}:${HOST_USER_GID} ${GOHAN_API_GTF_PATH}
chmod -R 770 ${GOHAN_API_GTF_PATH}/tmp
chmod -R 777 ${GOHAN_API_GTF_PATH}

@echo ".. done!"

Expand Down Expand Up @@ -196,17 +198,50 @@ clean-api-drs-bridge-data:


## Tests
test-api-dev: prepare-test-config
test-api: init prepare-test-config
# # @# Run the tests directly from the api source directory
# # cd src/api && \
# # go clean -cache && \
# # go test ./tests/unit/... -v

@# restart any running containers and print
docker compose -f docker-compose.test.yaml down
docker compose -f docker-compose.test.yaml up -d

@# run build tests
@# - print api and drs logs in the
@# event of a failued
cd src/api && \
go clean -cache && \
(go test ./tests/build/... -v || ((docker logs gohan-api | tail -n 100) && (docker logs gohan-drs | tail -n 100) && exit 1)) && \
cd ../..

@# shut down the containers and print
@# the tail end of the
@# api and elasticsearch logs
docker compose -f docker-compose.test.yaml stop
docker logs gohan-api | tail -n 50
docker logs elasticsearch | tail -n 50


test-api-dev: prepare-dev-config
@# Run the tests
cd src/api && \
go clean -cache && \
go test ./tests/integration/... -v


prepare-test-config:
@# Prepare environment variables dynamically via a JSON file
@# since xUnit doens't support loading env variables natively
envsubst < ./etc/test.yml.tpl > ./src/api/tests/common/test.config.yml

prepare-dev-config:
@# Prepare environment variables dynamically via a JSON file
@# since xUnit doens't support loading env variables natively
envsubst < ./etc/test.config.yml.tpl > ./src/api/tests/common/test.config.yml


clean-tests:
@# Clean up
rm ./src/api/tests/common/test.config.yml
145 changes: 9 additions & 136 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,10 @@
# view catalogue
curl -k https://gohan.local/genes/overview


# create table
DATA='{
"name": "Gohan Box Test Table",
"data_type": "variant",
"dataset": "00000000-0000-0000-0000-000000000000",
"metadata": {}
}'
curl -k -0 -v -X POST https://gohan.local/tables \
-H 'Content-Type:application/json' \
--data "$(echo $DATA)" | jq

# <obtain the table "id">


# move vcf.gz files to `$GOHAN_API_VCF_PATH`

# ingest vcf.gz
curl -k https://gohan.local/variants/ingestion/run\?fileNames=<filename>\&assemblyId=GRCh37\&filterOutReferences=true\&tableId=<table id>
curl -k https://gohan.local/variants/ingestion/run\?fileNames=<filename>\&assemblyId=GRCh37\&filterOutReferences=true\&dataset=00000000-0000-0000-0000-000000000000

# monitor progress:
curl -k https://gohan.local/variants/ingestion/requests
Expand Down Expand Up @@ -483,126 +468,6 @@ Response
<br />


**`/tables`**

<br />


Request
> &nbsp;&nbsp;**GET** `/tables`<br/>

<br/>

Response
>```json
> [
> {
> "id": `string`,
> "name": `string`,
> "data_type": `string`,
> "dataset": `string`,
> "assembly_ids": `[]string`,
> "metadata": {...},
> "schema": {...},
> },
> ...
> ]
> ```

<br />
<br />


Request
> &nbsp;&nbsp;**POST** `/tables`<br/>
>```json
> {
> "name": `string`,
> "data_type": `string`,
> "dataset": `string`,
> "metadata": {...},
> }
> ```

<br/>

Response
>```json
> {
> "id": `string`,
> "name": `string`,
> "data_type": `string`,
> "dataset": `string`,
> "assembly_ids": `[]string`,
> "metadata": {...},
> "schema": {...},
> }
> ```


<br />
<br />


Request
> &nbsp;&nbsp;**GET** `/tables/:id`<br/>
> &nbsp;&nbsp;&nbsp;path params:
> - id : **string (UUID)** `(required)`

<br/>

Response
>```json
> {
> "id": `string`,
> "name": `string`,
> "data_type": `string`,
> "dataset": `string`,
> "assembly_ids": `[]string`,
> "metadata": {...},
> "schema": {...},
> }
> ```

<br />
<br />


Request
> &nbsp;&nbsp;**GET** `/tables/:id/summary`<br/>
> &nbsp;&nbsp;&nbsp;path params:
> - id : **string (UUID)** `(required)`

<br/>

Response
>```json
> {
> "count": `int`,
> "data_type_specific": {...},
> }
> ```

<br />
<br />


Request
> &nbsp;&nbsp;**DELETE** `/tables/:id`<br/>
> &nbsp;&nbsp;&nbsp;path params:
> - id : **string (UUID)** `(required)`

<br/>

Response

`Status Code:` **204**

<br />
<br />




## Deployments :

Expand Down Expand Up @@ -630,3 +495,11 @@ Once `elasticsearch`, `drs`, the `api`, and the `gateway` are up, run
make test-api-dev
```

## Dev Container debug

Interactive debug in VSCode is only possible When using the development image of gohan-api.

Using the "Attach to PID(Bento)" debug config, select the PID associated with the following path:
```
/gohan-api/src/api/tmp/main
```
28 changes: 28 additions & 0 deletions docker-compose.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# # Test-only (!) compose file for the Gohan

networks:
bridge-net:
external: true

services:
api:
ports:
- "${GOHAN_API_EXTERNAL_PORT}:${GOHAN_API_INTERNAL_PORT}"
extends:
file: docker-compose.yaml
service: api


elasticsearch:
ports:
- ${GOHAN_ES_EXTERNAL_PORT_1}:${GOHAN_ES_INTERNAL_PORT_1}
extends:
file: docker-compose.yaml
service: elasticsearch

drs:
ports:
- "${GOHAN_DRS_EXTERNAL_PORT}:${GOHAN_DRS_INTERNAL_PORT}"
extends:
file: docker-compose.yaml
service: drs
Loading