Skip to content

Commit

Permalink
add docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry committed Nov 13, 2023
1 parent 6d726d2 commit 501c9bb
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -41,7 +41,7 @@ jobs:
env:
MAVEN_USERNAME: gitlab-bsc-maven
MAVEN_PASSWORD: ${{ secrets.BSC_GITLAB_MAVEN_REPO }}

- name: Log into the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
if: github.ref_type == 'tag'
Expand Down
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

7 changes: 2 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Beacon Network 2.0 image
FROM quay.io/wildfly/wildfly:30.0.0.Final-jdk17

# patch WildFly with latest yasson library
COPY ./docker/yasson $JBOSS_HOME/modules/system/layers/base/org/eclipse/yasson/

# add PostgreSQL java driver and latest Yasson snapshot
COPY ./docker/postgresql $JBOSS_HOME/modules/system/layers/base/org/postgresql/
COPY ./docker/wildfly/modules/postgresql $JBOSS_HOME/modules/system/layers/base/org/postgresql/
COPY ./docker/wildfly/modules/yasson $JBOSS_HOME/modules/system/layers/base/org/eclipse/yasson/

# configure Beacon Network datasource
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=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)\n \
Expand Down
40 changes: 40 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3.9'

networks:
beacon-network:

x-environment: &postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_BN_DATABASE=beacon-network
- BEACON_NETWORK_CONFIG_DIR=/wildfly/BEACON-INF
- BEACON_NETWORK_DB_CONNECTION_URL=jdbc:postgresql://postgres:5432/beacon-network
- BEACON_NETWORK_DB_USERNAME=beacon
- BEACON_NETWORK_DB_PASSWORD=beacon

services:
postgres:
image: postgres:16.0-alpine
restart: always
environment: *postgres
volumes:
- ./postgresql/data:/var/lib/postgresql/data
- ./postgresql/init.sh:/docker-entrypoint-initdb.d/init.sh:ro
networks:
- beacon-network
wildfly:
image: ghcr.io/elixir-europe/beacon-network-backend:latest
container_name: "wildfly-beacon-network"
depends_on:
- postgres
restart: always
volumes:
- ./wildfly/BEACON-INF:/wildfly/BEACON-INF
hostname: wildfly
networks:
- beacon-network
ports:
- '9080:8080'
- '9009:8009'
- '9443:8443'
environment: *postgres
8 changes: 8 additions & 0 deletions docker/postgresql/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 <<-EOSQL
CREATE USER $BEACON_NETWORK_DB_USERNAME WITH ENCRYPTED PASSWORD '$BEACON_NETWORK_DB_PASSWORD';
GRANT ALL ON SCHEMA public TO $BEACON_NETWORK_DB_USERNAME;
CREATE DATABASE "$POSTGRES_BN_DATABASE" OWNER $BEACON_NETWORK_DB_USERNAME;
EOSQL
5 changes: 5 additions & 0 deletions docker/wildfly/BEACON-INF/beacon-network.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"https://beacons.bsc.es/beacon/v2.0.0",
"https://beacon-apis-demo.ega-archive.org/api",
"https://progenetix.org/beacon"
]
File renamed without changes.
File renamed without changes.

0 comments on commit 501c9bb

Please sign in to comment.