Skip to content

Commit

Permalink
Merge pull request #66 from qbicsoftware/release/1.1.0
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
christopher-mohr authored Dec 6, 2022
2 parents 2308d84 + fa23dc1 commit 95e8eed
Show file tree
Hide file tree
Showing 144 changed files with 10,662 additions and 8,477 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci_test_build_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# # This workflow runs all available tests and builds the .jar files
name: Varianstore CI

# Trigger the workflow on push and pull request activity
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.1.0

# set up JDK 11
- name: Set up JDK 11
uses: actions/setup-java@v3.6.0
with:
distribution: 'corretto'
java-version: '11'
cache: maven

# build with maven and run tests with Postgresql
- name: Build with Maven and run tests with PostgreSQL
run: mvn --batch-mode -Dmicronaut.environments=test-postgres -Dtest='!life.qbic.db.mariadb.**' verify

# build with maven and run tests with MariaDB
- name: Build with Maven and run tests with MariaDB
run: mvn --batch-mode -Dmicronaut.environments=test-mariadb -Dtest='!life.qbic.db.postgres.**' verify
46 changes: 46 additions & 0 deletions .github/workflows/create_publish_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Create and publish a Docker image

on:
push:
branches: ['release']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ GITHUB_REPOSITORY_OWNER }}/variantstore

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 3 additions & 3 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* --------------------------------------------------------------------------
*
* The following people contributed to Variantstore.
* - Christopher Mohr
* - Lukas Heumos
* - Sven Fillinger
* - Christopher Mohr (https://github.com/christopher-mohr)
* - Lukas Heumos (https://github.com/zethson)
* - Sven Fillinger (https://github.com/sven1103)
*/
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,46 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.1.0 - The Proline Depot - 2022-12-06

### `Added`

- [#57](https://github.com/qbicsoftware/variantstore-service/pull/57) Add GitHub Actions to create and publish Docker image
- [#50](https://github.com/qbicsoftware/variantstore-service/pull/50) Add Database interface for PostgreSQL ([#37](https://github.com/qbicsoftware/variantstore-service/issues/37), [#38](https://github.com/qbicsoftware/variantstore-service/issues/38))
- [#50](https://github.com/qbicsoftware/variantstore-service/pull/50) Use [Micronaut Data](https://micronaut-projects.github.io/micronaut-data/latest/guide/)
- [#50](https://github.com/qbicsoftware/variantstore-service/pull/50) Factory classes for entities
- [#52](https://github.com/qbicsoftware/variantstore-service/pull/52) Transaction repository for MariaDB
- [#53](https://github.com/qbicsoftware/variantstore-service/pull/53) Ensembl gene import for PostgreSQL
- [#58](https://github.com/qbicsoftware/variantstore-service/pull/58) Server-side view for Variantstore status
- [#59](https://github.com/qbicsoftware/variantstore-service/pull/59) Documentation on OAuth 2.0 configuration
- [#62](https://github.com/qbicsoftware/variantstore-service/pull/62) Endpoint/Controller for `project` entity

### `Changed`

- [#50](https://github.com/qbicsoftware/variantstore-service/pull/50) Update Micronaut version to `3.x`
- [#50](https://github.com/qbicsoftware/variantstore-service/pull/50) Use [Testcontainers](https://www.testcontainers.org) for tests
- [#50](https://github.com/qbicsoftware/variantstore-service/pull/50) Use [Flyway](https://flywaydb.org) for database migration
- [#50](https://github.com/qbicsoftware/variantstore-service/pull/50) Adapt configuration to work with MariaDB OR PostgreSQL
- [#55](https://github.com/qbicsoftware/variantstore-service/pull/55), [#56](https://github.com/qbicsoftware/variantstore-service/pull/56) Extend documentation
- [#64](https://github.com/qbicsoftware/variantstore-service/pull/64) Update dependencies, remove `log4j`

### `Fixed`

- [#52](https://github.com/qbicsoftware/variantstore-service/pull/52) Transaction registration during VCF import
- [#59](https://github.com/qbicsoftware/variantstore-service/pull/59) OAuth 2.0 configuration
- [#61](https://github.com/qbicsoftware/variantstore-service/pull/61) Variant import bug ([#60](https://github.com/qbicsoftware/variantstore-service/issues/60))

## v1.0.1 - 2021-03-26

### `Added`

### `Changed`

- Extend usage documentation and add examples
- [#43](https://github.com/qbicsoftware/variantstore-service/pull/43) - Prevent the creation of duplicate gene entries in the database ([#40](https://github.com/qbicsoftware/variantstore-service/issues/40))

### `Fixed`

- [#43](https://github.com/qbicsoftware/variantstore-service/pull/43) - Fix parsing of Ensembl version ([#42](https://github.com/qbicsoftware/variantstore-service/issues/42))
- [#43](https://github.com/qbicsoftware/variantstore-service/pull/43) - Fix `EnsemblParser` bug caused by missing `Gene` constructor ([#41](https://github.com/qbicsoftware/variantstore-service/issues/41))

Expand Down
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing guide

Thank you for investing your time in contributing to our project! We appreciate any bug reports, feature requests or feedback in general.

## Issues

If you find a bug or have a feature request, feel free to open an [issue](<https://github.com/qbicsoftware/variantstore-service/issues>).

## Pull Requests

If you want to contribute with changes to the code or documentation, feel free to open a pull request (PR) against the [development branch](https://github.com/qbicsoftware/variantstore-service/tree/development).
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Variantstore

[![Varianstore CI](https://github.com/qbicsoftware/variantstore-service/actions/workflows/ci_test_build_package.yml/badge.svg?branch=development)](https://github.com/qbicsoftware/variantstore-service/actions/workflows/ci_test_build_package.yml)
[![release](https://img.shields.io/github/v/release/qbicsoftware/variantstore-service?include_prereleases)](https://github.com/qbicsoftware/variantstore-service/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Introduction

The **Variantstore** is a Java/Groovy-based service application implemented using the [Micronaut framework](https://micronaut.io) and enables storage and access to information on genomic variants and metadata from a connected database *via* a RESTful API.

## Features

- Import variants as Variant Call Format (VCF) files, annotated using [SnpEff](http://snpeff.sourceforge.net) or [VEP](https://www.ensembl.org/info/docs/tools/vep/index.html>)
- Import metadata in JSON together with variants (see [Usage](/docs/USAGE..md) for details)
- Import gene information (Ensembl, GFF3 files)
- Support for [MariaDB](https://mariadb.com) and [PostgreSQL](https://www.postgresql.org) backend
- Query information on variants, genes, and cases via (secured) REST endpoints
- Ask Beacon endpoint if a specific variant exists in the store
- Export variants in Variant Call Format (VCF) and [FHIR](https://www.hl7.org/fhir/)

## Full Documentation

See [Documentation](/docs/README.md) for the full detailed installation, run and configuration instructions.

Detailed documentation of the RESTful API is additionally available on [SwaggerHub](https://app.swaggerhub.com/apis/christopher-mohr/variantstore/).

## Database

In the current version, the **Variantstore** service can be used with a MariaDB and PostgreSQL database. If you want to use a different DBMS, you have to provide an implementation for the `VariantstoreStorage` interface, make sure to use the same database model and set up the datasource accordingly in the `application.yml`.

## Contributions and Support

If you would like to contribute to this pipeline or, please see the [contributing guidelines](/CONTRIBUTING.md).

For further information or help, don't hesitate to get in touch with us via [mail](mailto:christopher.mohr@uni-tuebingen.de) or [Twitter](https://twitter.com/cmohr_tue).

## Credits

The Variantstore was created within the [DIFUTURE](https://difuture.de) (Data Integration for Future Medicine) Consortium.

This service was designed and implemented by [Christopher Mohr](https://github.com/christopher-mohr).
For a full list of authors, please refer to the file [AUTHORS](AUTHORS).
51 changes: 0 additions & 51 deletions README.rst

This file was deleted.

106 changes: 106 additions & 0 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Configuration

The configuration of the Variantstore instance is essentially done by setting the environment variables which are used in the [application.yml](../src/main/resources/application.yml). If you want/need to set other properties, please refer to the [Micronaut Documentation](https://docs.micronaut.io/latest/guide/#introduction).

## Server

You can set the port on which the Variantstore instance is supposed to run by setting the optional environment variable `VARIANTSTORE_PORT`(default: `8080`).

```yml
server:
port: ${variantstore-port:8080}
```
In addition, you can enable HTTPS support by setting `VARIANTSTORE_SSL_ENABLED` to `true` and enable the generation of a self-isgned certificate by Micronaut (`VARIANTSTORE_SSL_SELFSIGNED`).

## Security (Authentication and Authorization)

Security (authentication and authorization) is enabled by default but you can deactivate it by setting the environment variable `VARIANTSTORE_SECURITY_ENABLED` to `false`. If security is enabled all protected endpoints (i.e. all endpoints except the `/beacon` endpoint) can only be accessed by authenticated users.

In addition to that, the Variantstore supports authentication with OAuth 2.0 servers. This includes support for the OpenID standard. Authentication using Keycloak as provider has been tested. However, other provider that support OpenID such as [Okta](https://developer.okta.com/), [AWS Cognito](https://aws.amazon.com/cognito), and [Google](https://developers.google.com/identity/protocols/OpenIDConnect) should work as well when configured properly.

Authentication mode is set to `idtoken` by default. The mode can be changed by setting the environment variable `VARIANTSTORE_AUTHENTICATION_MODE`. Please refer to the official Micronaut [docs](https://micronaut-projects.github.io/micronaut-security/latest/guide/#authenticationStrategy) for valid values.

In order to enable authentication with OAuth 2.0 servers, set `VARIANTSTORE_OAUTH2_ENABLED` to `true` and provide all necessary details using the following environment variables:

* `VARIANTSTORE_OAUTH2_CLIENT_ID`
* `VARIANTSTORE_OAUTH2_CLIENT_SECRET`
* `VARIANTSTORE_OAUTH2_ISSUER`
* `VARIANTSTORE_OAUTH2_AUTH_URL`
* `VARIANTSTORE_OAUTH2_TOKEN_URL`

> You can check out the official Micronaut security [docs](https://micronaut-projects.github.io/micronaut-security/latest/guide/#oauth) for configuration examples.

## Database

In the current version, the **Variantstore** service can be used with a PostgreSQL or MariaDB database instance. If you would like to use a different DBMS, you have to provide an implementation for the `VariantstoreStorage` interface, make sure to use the same database model as provided and set up the data source accordingly in the `application.yml`.

The main database [model](/models/) expected by the **Variantstore** looks like the following for the currently supported two database systems:

<details>
<summary>PostgreSQL schema</summary>

![Variantstore model diagram](images/variantstore-model-diagram-postgresql.png)
</details>

<details>
<summary>MariaDB schema</summary>

![Variantstore model diagram](images/variantstore-model-diagram.png)
</details>

\
Additionally, a database with the following [table](/models/transaction-db.sql) is needed to track the import transactions in the Variantstore:

![Variantstore transaction model diagram](images/transaction-model-diagram-postgresql.png)

The `Variantstore` data source can be configured by setting the following environment variables: `DB_HOST` (database host address), `DB_NAME` (database name), `DB_USER` (database user) and `DB_PWD` (database password). In addition, `DB_TRANSACTION_HOST`, `DB_TRANSACTION_NAME`, `DB_TRANSACTION_USER`, and `DB_TRANSACTION_PW` have to be specified for the transaction database.

If you need to change or add additional properties to the JDBC database connection URL, please do so in the `application.yml`.

```yml
datasources:
variantstore_postgres:
url: jdbc:postgresql://${db-host:""}/${db-name:""}
username: ${db-user:""}
password: ${db-pwd:""}
driverClassName: org.postgresql.Driver
transactions:
url: jdbc:postgresql://${db-transaction-host:""}/${db-transaction-name:""}?...
username: ${db-transaction-user:""}
password: ${db-transaction-pwd:""}
driverClassName: org.postgresql.Driver
#variantstore_mariadb:
# url: jdbc:mariadb://${db-host:""}/${db-name:""}?...
# username: ${db-user:""}
# password: ${db-pwd:""}
# driverClassName: org.mariadb.jdbc.Driver
#transactions_mariadb:
# url: jdbc:mariadb://${db-transaction-host:""}/${db-transaction-name:""}?...
# username: ${db-transaction-user:""}
# password: ${db-transaction-pwd:""}
# driverClassName: org.mariadb.jdbc.Driver
```

The data source configuration is set to PostgreSQL by default. If you want to use a MariaDB database comment out `variantstore_postgres` and `transactions` and uncomment `variantstore_mariadb` and `transactions_mariadb`. Further, `database.specifier` has to be set to `variantstore-mariadb`. Default:

```yml
database:
specifier: variantstore-postgres
```

Additionally, you have to enable (`enabled: true`) Flyway migration for the MariaDB data sources and disable it for the PostgreSQL data sources (`enabled: false`) below in the Flyway block:

```yml
flyway:
datasources:
...
```

## Import

The import of variants to the store happens in batches (default: 250.000). If you would like to change the default batch size, you can use the environment variable `MAX_NUMBER_VARIANTS_PER_BATCH`.

## Logging

All requests to the Variantstore are logged. The default location is ``/tmp`` but you can specify a different location by setting the environment variable ``SERVICES_LOG_PATH``. The generated log file is called ``variantstore.log`` whereas older log files follow the following naming scheme: ``variantstore.%d{dd-MMM}.log.gz"``
44 changes: 44 additions & 0 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Installation

The following describes the minimal steps that have to be taken in order to install a Variantstore instance. You can either [build](#Build) the project from scratch or [run](#Run) the prebuilt `JAR` file.

## Requirements

Variantstore runs on Java 11. Building Variantstore requires Maven, however note that a maven wrapper is provided under the folder [.mvn](/.mvn).

### Database

The complete installation of the Variantstore includes setting up and configuring the databases to store the genomic information. Details can be found under [CONFIGURATION](CONFIGURATION.md).

## Build

To compile and run the project:

```bash
git clone git@github.com:qbicsoftware/variantstore-service.git
cd variantstore-service/
mvn clean compile
mvn exec:exec
```

To build the project:

```bash
git clone git@github.com:qbicsoftware/variantstore-service.git
cd variantstore-service/
mvn clean package
```

This command will create an executable `JAR` in your current working directory under `/target`.

## Run

To run a prebuilt Variantstore instance, download the [latest](https://github.com/qbicsoftware/variantstore-service/releases/latest/) Variantstore release and execute.

```bash
java -jar variantstore-{version}.jar
```

## Docker

Docker images are created for [Releases](https://github.com/qbicsoftware/variantstore-service/releases) and are available under [Packages](https://github.com/orgs/qbicsoftware/packages?repo_name=variantstore-service).
Loading

0 comments on commit 95e8eed

Please sign in to comment.