Skip to content

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
redmitry committed Feb 1, 2024
2 parents defbc6d + 4fbffe8 commit 3a7ca5b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 27 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ jobs:
packages: write

steps:
- name: Deploy to BSC GitLab Maven Repository
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
MAVEN_USERNAME: gitlab-bsc-maven
MAVEN_PASSWORD: ${{ secrets.BSC_GITLAB_MAVEN_REPO }}
- name: Checkout
uses: actions/checkout@v3

- name: Log into the Container registry
uses: docker/login-action@v3
Expand Down
76 changes: 54 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,51 @@ The implementation is developed and deployed on the [WildFly 30.0.0](http://wild
###### Beacon v2 Java implementation
The implementation uses [Beacon v2 Java beacon-framework](https://github.com/elixir-europe/java-beacon-v2.api) model classes.

###### SQL Database
The Beacon Network Aggregator uses [Jakarta Persistence 3.1](https://jakarta.ee/specifications/persistence/3.1/) for logging.
The connection is defined in [persistence.xml](https://github.com/elixir-europe/beacon-network-backend/blob/master/src/main/resources/META-INF/persistence.xml).
Although the Aggregator may be used with any SQL database, it is configured to be used with [PostgreSQL](https://www.postgresql.org/) database.
## Installation

###### Docker Image
This repository is configured to automatically generate docker images on release tags ('vX.Y.Z').
https://github.com/elixir-europe/beacon-network-backend/pkgs/container/beacon-network-backend
The image is based on official WildFly image that is extended with PostgreSQL driver and predeployed Beacon Network application.
There is also a [docker-compose.yaml](https://github.com/elixir-europe/beacon-network-backend/blob/master/docker/docker-compose.yaml) receipe which provides easy deployment.
### Docker Image (recommended)
This repository is configured to automatically generate [docker images](https://github.com/elixir-europe/beacon-network-backend/pkgs/container/beacon-network-backend) on release tags ('vX.Y.Z'). The image is based on official WildFly image that is extended with PostgreSQL driver and predeployed Beacon Network application.

###### Apache Maven build system
To have an easy deployment, go to the [docker folder](./docker) and run [docker compose](https://docs.docker.com/compose/):

```
docker-compose up -d
```

### Manual installation

#### Apache Maven build system
The build process is based on [Apache Maven](https://maven.apache.org/).

Compiling:
```shell
>git clone https://github.com/elixir-europe/beacon-network-backend.git
>cd beacon-network-backend
>mvn install
git clone https://github.com/elixir-europe/beacon-network-backend.git
cd beacon-network-backend
mvn install
```
This must create `beacon-network-v2-x.x.x.war` (**W**eb application **AR**chive) application in the `/target` directory.
This must create `beacon-network-v2-x.x.x.war` (**W**eb application **AR**chive) application in the `/target` directory. Alternatively, you can find this file in the Barcelona Supercomputing Center's [maven repository](https://inb.bsc.es/maven/es/bsc/inb/ga4gh/beacon-network-v2/0.0.9/beacon-network-v2-0.0.9.war).

#### WilfFly server
WildFly is a free opensource JEE server and may be easy downloaded from it's website: http://wildfly.org/.
Nevertheless, the sever requires some configuration which in a case of docker image is done by the [Dcokerfile](https://github.com/elixir-europe/beacon-network-backend/blob/2d42fa703742de713c238a3c2e2e3e5bc6e2c4c7/docker/Dockerfile#L15) recipe.

The implementation relies on JSON-B 3.0 [Eclipse Yasson<sup>TM</sup>](https://github.com/eclipse-ee4j/yasson) implementation, but requires yet **unreleased 3.0.4** version [yasson-3.0.4-SNAPSHOT.jar](https://jakarta.oss.sonatype.org/content/repositories/snapshots/org/eclipse/yasson/3.0.4-SNAPSHOT/). Once WildFly is updated to the 3.0.4 version of Yasson<sup>TM</sup> this step would be unneccessary.

The Beacon Network logging is implemented using [Jakarta Persistence 3.1](https://jakarta.ee/specifications/persistence/3.1/) and relies on [PostgreSQL](https://www.postgresql.org/) database.
The server must be pre-configured for the PostgreSQL and the PosgreSQL JDBC driver must be intalled into the WildFly (docker image recipe does this job).

###### BSC Maven Repository
In addition to the provided docker images, artifacts are stored on the Barcelona Supercomputing Center's maven repository:
https://inb.bsc.es/maven/es/bsc/inb/ga4gh/beacon-network-v2/0.0.9/beacon-network-v2-0.0.9.war
The deployment is as simple:

###### Configuration
There are three configuration files in the `/BEACON-INF` directory:
```shell
# Copy .war file to wildfly
cp target/beacon-network-v2-x.x.x.war $WILDFLY_HOME/standalone/deployments/
# Run the application server
./$WILDFLY_HOME/bin/standalone.sh
```

## Configuration

There are three default configuration files in the `/BEACON-INF` directory:
* `configuration.json` - standard beacon configuration file: [beaconConfigurationResponse.json](https://github.com/ga4gh-beacon/beacon-v2/blob/main/framework/json/responses/beaconConfigurationResponse.json)
* `beacon-info.json` - standard beacon information file: [beaconInfoResponse.json](https://github.com/ga4gh-beacon/beacon-v2/blob/main/framework/json/responses/beaconInfoResponse.json)
* `beacon-network.json` - Json Array of backed Beacons' endpoints
Expand All @@ -45,11 +62,26 @@ The example of the `beacon-network.json`:
"https://ega-archive.org/test-beacon-apis/cineca"
]
```
Note that the **W**eb application **AR**chive (WAR) is just a usual ZIP file so one can edit these configurations manually without the need to rebuild the application.
Note that the **W**eb application **AR**chive (WAR) is just a usual ZIP file so one can edit these configurations manually without the need to rebuild the application. The same with Docker, it is automatically updated with new beacons.

It is also possible to define external directory for the `beacon-network.json` configuration.
It is also possible to define external directory for the configuration.
```bash
export BEACON_NETWORK_CONFIG_DIR=/wildfly/BEACON-INF
```
When the `BEACON_NETWORK_CONFIG_DIR` is set, the aggregator monitors the `$BEACON_NETWORK_CONFIG_DIR/beacon-network.json` to dynamically update the configuration.
When the `BEACON_NETWORK_CONFIG_DIR` is set, the aggregator monitors the `$BEACON_NETWORK_CONFIG_DIR/beacon-network.json` to dynamically update the configuration.
It also looks (but not actively monitoring) the `$BEACON_NETWORK_CONFIG_DIR/beacon-info.json` so deployers may change the beacon identifier and other metatada.

### SQL Database

The Beacon Network Aggregator uses [Jakarta Persistence 3.1](https://jakarta.ee/specifications/persistence/3.1/) for logging.
The connection is defined in [persistence.xml](https://github.com/elixir-europe/beacon-network-backend/blob/master/src/main/resources/META-INF/persistence.xml).
Although the Aggregator may be used with any SQL database, it is configured to be used with [PostgreSQL](https://www.postgresql.org/) database.

The application provides simple SQL logging which level may be confirured via `BEACON_NETWORK_LOG_LEVEL` environment variable.
The possible values are "**NONE**", "**METADATA**", "**REQUESTS**", "**RESPONSES**", "**ALL**"
- "**NONE**" : No logging at all.
- "**METADATA**" : Only backed beacons' metadata is logged (good for debugging).
- "**REQUESTS**" : Beacon Network Request quieries are logged. It also logs response codes (but not the data).
- "**RESPONSES**" : Logs all Requests with Responses as well as possible error messages.
- "**ALL**" : Maximum logging level. Currently same as "**RESPONSES**"

1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY ./docker/wildfly/modules/yasson $JBOSS_HOME/modules/system/layers/base/org/

RUN /bin/sh -c 'echo -e "embed-server --std-out=echo\n \
/subsystem=undertow/server=default-server/ajp-listener=ajp:add(socket-binding=ajp, scheme=https, redirect-socket=https, enabled=true)\n \
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding, value=true)\n \
/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)\n \
/subsystem=datasources/data-source=BeaconNetwork:add(driver-name=postgresql,jndi-name=java:jboss/datasources/BeaconNetwork,connection-url=\${env.BEACON_NETWORK_DB_CONNECTION_URL},user-name=\${env.BEACON_NETWORK_DB_USERNAME},password=\${env.BEACON_NETWORK_DB_PASSWORD})\n \
stop-embedded-server" > $JBOSS_HOME/bin/wildfly-config.cli'
Expand Down

0 comments on commit 3a7ca5b

Please sign in to comment.