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

WIP: Feature/environment preconfiguration #148

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- master
- develop
- feature/environmentPreconfiguration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. If you file a PR, the branch will be build.

tags:
- 'v*.*.*'
pull_request:
Expand Down Expand Up @@ -93,6 +94,7 @@ jobs:
with:
context: .
file: ./Dockerfile
target: ${{matrix.project}}
platforms: linux/amd64,linux/arm64
build-args: |
PROJECT=${{matrix.project_context}}
Expand Down
65 changes: 64 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ADD target/connector.war /connector/connector.war
RUN mkdir -p /connector/extracted && \
unzip /connector/connector.war -d /connector/extracted/

FROM tomcat:9-jre8-temurin
FROM tomcat:9-jre8-temurin as docker-build

## Define for which project this image is build
ARG PROJECT=samply
Expand Down Expand Up @@ -43,3 +43,66 @@ ENV JAVA_OPTS "-Dlog4j.configurationFile=${CATALINA_HOME}/conf/log4j2.xml"
ADD src/docker/start.sh /docker/
RUN chmod +x /docker/start.sh
CMD ["sh", "-c", "/docker/start.sh"]

ENV TZ="Europe/Berlin"

# Stage used by ci for dktk images (--target=dktk)
FROM docker-build as dktk
ENV TEST_PROJECT="dktk"
ENV POSTGRES_PORT="5432"
ENV CCP_CENTRALSEARCH_URL="https://centralsearch-test.dktk.dkfz.de/"
ENV CCP_DECENTRALSEARCH_URL="https://decentralsearch-test.ccp-it.dktk.dkfz.de/"
ENV CONNECTOR_ENABLE_METRICS="false"
ENV POSTGRES_DB="share_v2"
ENV POSTGRES_USER="samplyweb"
ENV PROTOCOL="http"
ENV PORT="8080"
ENV DEPLOYMENT_CONTEXT="dktk-connector"
ENV feature_BBMRI_DIRECTORY_SYNC="false"
ENV feature_DKTK_CENTRAL_SEARCH="false"
ENV feature_NNGM_CTS="false"
ENV LOG_LEVEL="info"
ENV MDR_URL="https://mdr.ccp-it.dktk.dkfz.de/v3/api/mdr"
ENV POSTGRES_HOST="bridgehead_dktk_connector_db"
ENV QUERY_LANGUAGE="QUERY"
ENV PATIENTLIST_URL="http://bridgehead_patientlist:8080/Patientlist"
ENV ID_MANAGER_URL="http://bridgehead_id-manager:8080"


# Stage used by ci for gbn images (--target=gbn)
FROM docker-build as gbn
ENV TEST_PROJECT="gbn"
ENV CONNECTOR_ENABLE_METRICS="false"
ENV POSTGRES_DB="samply.connector"
ENV POSTGRES_HOST="bridgehead_gbn_connector_db"
ENV POSTGRES_USER="samply"
ENV QUERY_LANGUAGE="CQL"
ENV DEPLOYMENT_CONTEXT="gbn-connector"
ENV LOG_LEVEL="info"
ENV STORE_URL="http://bridgehead_gbn_blaze_store:8080"
ENV MDR_URL="https://mdr.germanbiobanknode.de/v3/api/mdr"
ENV PROTOCOL="http"
ENV PORT="8080"

# Stage used by ci for c4 images (--target=c4)
FROM docker-build as c4
ENV TEST_PROJECT="c4"
ENV POSTGRES_PORT="5432"
ENV CCP_CENTRALSEARCH_URL="https://centralsearch-test.dktk.dkfz.de/"
ENV CCP_DECENTRALSEARCH_URL="https://decentralsearch-test.ccp-it.dktk.dkfz.de/"
ENV CONNECTOR_ENABLE_METRICS="false"
ENV POSTGRES_DB="share_v2"
ENV POSTGRES_USER="samplyweb"
ENV CONNECTOR_SHARE_URL="${PROTOCOL}://${HOST}:${PORT}"
ENV DEPLOYMENT_CONTEXT="dktk-connector"
ENV feature_BBMRI_DIRECTORY_SYNC="false"
ENV feature_DKTK_CENTRAL_SEARCH="false"
ENV feature_NNGM_CTS="false"
ENV LOG_LEVEL="info"
ENV MDR_URL="https://mdr.ccp-it.dktk.dkfz.de/v3/api/mdr"
ENV POSTGRES_HOST="bridgehead_dktk_connector_db"
ENV PROTOCOL="http"
ENV QUERY_LANGUAGE="QUERY"

# This stage is build when defining no target
FROM docker-build as vanilla
4 changes: 3 additions & 1 deletion src/docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if [ -n "$HTTP_PROXY" ]; then
HTTPS_PROXY_PASSWORD=$PROXY_PASS;
fi

export CONNECTOR_SHARE_URL="${PROTOCOL}://${HOST}:${PORT}"

file=${CATALINA_HOME}/conf/Catalina/localhost/ROOT.xml
if [ -n "$DEPLOYMENT_CONTEXT" ]; then
echo "INFO: preparing deployment in context ${DEPLOYMENT_CONTEXT}"
Expand All @@ -25,7 +27,7 @@ sed -i "s/{postgres-host}/${POSTGRES_HOST}/" "$file"
sed -i "s/{postgres-port}/${POSTGRES_PORT:-5432}/" "$file"
sed -i "s/{postgres-db}/${POSTGRES_DB}/" "$file"
sed -i "s/{postgres-user}/${POSTGRES_USER}/" "$file"
sed -i "s/{postgres-pass}/${POSTGRES_PASS}/" "$file"
sed -i "s/{postgres-pass}/${POSTGRES_PASSWORD}/" "$file"

file=${CATALINA_HOME}/conf/${PROJECT}_common_config.xml
sed -i "s|{http-proxy-url}|${HTTP_PROXY_URL:-}|" "$file"
Expand Down