Skip to content

Commit

Permalink
Merge branch 'uce-biofid-demo-12/24' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
TheItCrOw committed Dec 15, 2024
2 parents 55812aa + 3b0044e commit 075f4bb
Show file tree
Hide file tree
Showing 74 changed files with 2,115 additions and 479 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ build/
/rag/env
/rag/src/cBERT/data
/rag/src/cBERT/models
__pycache__
__pycache__
3 changes: 3 additions & 0 deletions database/createGinIndexes.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS btree_gin;

-- Some standard indexes on title and such
CREATE INDEX IF NOT EXISTS idx_metadatatitleinfo_title ON metadatatitleinfo (title);
CREATE INDEX IF NOT EXISTS idx_metadatatitleinfo_published ON metadatatitleinfo (published);
Expand Down
33 changes: 30 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# version: '3.8'

services:

uce-fuseki-sparql:
build:
context: ./sparql
dockerfile: ./Dockerfile
args:
JENA_VERSION: 5.2.0
image: fuseki
ports:
- "8030:5430"
volumes:
- ./../sparql/run/databases/biofid-search:/fuseki/databases/biofid-search
command: --update --tdb2 --port 5430 --loc /fuseki/databases/biofid-search /biofid-search
networks:
- app_net

uce-rag-service:
build:
context: .
Expand All @@ -9,6 +25,8 @@ services:
- "8080:5678"
depends_on:
- uce-postgresql-db
networks:
- app_net

uce-web:
build:
Expand All @@ -18,17 +36,26 @@ services:
- "8008:4567"
depends_on:
- uce-postgresql-db
networks:
- app_net
volumes:
- "./../releases/uceConfig.json:/app/config/uceConfig.json"
command: ["java", "-jar", "./target/webportal-jar-with-dependencies.jar", "-cf", "/app/config/uceConfig.json"]

uce-postgresql-db:
image: pgvector/pgvector:pg16
environment:
POSTGRES_DB: uce-gerparcor
POSTGRES_DB: uce
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1234
ports:
- "8002:5432"
#volumes:
# - pgdata:/var/lib/uce-gerparcor-eval/data
networks:
- app_net

networks:
app_net:
driver: bridge

volumes:
pgdata:
4 changes: 4 additions & 0 deletions rag/src/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ def rag_complete():
print(ex)
return jsonify(result)

@app.route('/', methods=['GET'])
def hello():
return 'RAGServer running.'

def get_embedding_model():
'''Gets the embedding model from the app's cache'''
if 'embedding_model' not in current_app.config:
Expand Down
124 changes: 124 additions & 0 deletions sparql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

## Apache Jena Fuseki server Dockerfile.

## This Dockefile builds a reduced footprint container.

ARG JAVA_VERSION=21

ARG ALPINE_VERSION=3.20.3
ARG JENA_VERSION=""

# Internal, passed between stages.
ARG FUSEKI_DIR=/fuseki
ARG FUSEKI_JAR=jena-fuseki-server-${JENA_VERSION}.jar
ARG JAVA_MINIMAL=/opt/java-minimal

## ---- Stage: Download and build java.
FROM eclipse-temurin:${JAVA_VERSION}-alpine AS base

ARG JAVA_MINIMAL
ARG JENA_VERSION
ARG FUSEKI_DIR
ARG FUSEKI_JAR
ARG REPO=https://repo1.maven.org/maven2
ARG JAR_URL=${REPO}/org/apache/jena/jena-fuseki-server/${JENA_VERSION}/${FUSEKI_JAR}

RUN [ "${JENA_VERSION}" != "" ] || { echo -e '\n**** Set JENA_VERSION ****\n' ; exit 1 ; }
RUN echo && echo "==== Docker build for Apache Jena Fuseki ${JENA_VERSION} ====" && echo

# Alpine: For objcopy used in jlink
RUN apk add --no-cache curl binutils

## -- Fuseki installed and runs in /fuseki.
WORKDIR $FUSEKI_DIR

## -- Download the jar file.
COPY download.sh .
RUN chmod a+x download.sh

# Download, with check of the SHA1 checksum.
RUN ./download.sh --chksum sha1 "$JAR_URL"

## -- Alternatives to download : copy already downloaded.
## COPY ${FUSEKI_JAR} .

## Use Docker ADD - does not retry, does not check checksum, and may run every build.
## ADD "$JAR_URL"

## -- Make reduced Java JDK

ARG JDEPS_EXTRA="jdk.crypto.cryptoki,jdk.crypto.ec"
RUN \
JDEPS="$(jdeps --multi-release base --print-module-deps --ignore-missing-deps ${FUSEKI_JAR})" && \
jlink \
--compress 2 --strip-debug --no-header-files --no-man-pages \
--output "${JAVA_MINIMAL}" \
--add-modules "${JDEPS},${JDEPS_EXTRA}"

ADD entrypoint.sh .
ADD log4j2.properties .

## ---- Stage: Build runtime
FROM alpine:${ALPINE_VERSION}

## Import ARGs
ARG JENA_VERSION
ARG JAVA_MINIMAL
ARG FUSEKI_DIR
ARG FUSEKI_JAR

COPY --from=base /opt/java-minimal /opt/java-minimal
COPY --from=base /fuseki /fuseki

WORKDIR $FUSEKI_DIR

ARG LOGS=${FUSEKI_DIR}/logs
ARG DATA=${FUSEKI_DIR}/databases

ARG JENA_USER=fuseki
ARG JENA_GROUP=$JENA_USER
ARG JENA_GID=1000
ARG JENA_UID=1000

# Run as this user
# -H : no home directory
# -D : no password
RUN addgroup -g "${JENA_GID}" "${JENA_GROUP}" && \
adduser "${JENA_USER}" -G "${JENA_GROUP}" -s /bin/ash -u "${JENA_UID}" -H -D

RUN mkdir --parents "${FUSEKI_DIR}" && \
chown -R $JENA_USER ${FUSEKI_DIR}

USER $JENA_USER

RUN \
mkdir -p $LOGS && \
mkdir -p $DATA && \
chmod a+x entrypoint.sh

## Default environment variables.
ENV \
JAVA_HOME=${JAVA_MINIMAL} \
JAVA_OPTIONS="-Xmx2048m -Xms2048m" \
JENA_VERSION=${JENA_VERSION} \
FUSEKI_JAR="${FUSEKI_JAR}" \
FUSEKI_DIR="${FUSEKI_DIR}"

EXPOSE 5430

ENTRYPOINT ["./entrypoint.sh" ]
CMD []
Loading

0 comments on commit 075f4bb

Please sign in to comment.