Skip to content

Commit b005f15

Browse files
authored
Merge pull request #4 from texttechnologylab/develop
Develop
2 parents 319f90e + c09174d commit b005f15

91 files changed

Lines changed: 20277 additions & 2532 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# UDAV Environment Configuration Example
2+
# Copy this file to .env and modify values as needed
3+
4+
# ============================================
5+
# Database Configuration
6+
# ============================================
7+
DB_URL=jdbc:postgresql://postgres:5432/udav
8+
DB_USER=postgres
9+
DB_PASS=postgres
10+
DB_SCHEMA=public
11+
DB_DIALECT=POSTGRES
12+
# Batch size for database inserts (default: 5000)
13+
# Higher = fewer DB roundtrips, more memory. Range: 1000-15000
14+
DB_BATCH_SIZE=5000
15+
# Max identifier length (PostgreSQL: 63, MySQL: 64, MSSQL: 128)
16+
DB_MAX_IDENT=255
17+
18+
# ============================================
19+
# DUUI Importer Configuration
20+
# ============================================
21+
# Enable/disable DUUI importer
22+
DUUI_IMPORTER=false
23+
# Path to input files
24+
DUUI_IMPORTER_PATH=/app/data/input
25+
# File extension: .xmi (uncompressed) or .gz (gzip compressed)
26+
DUUI_IMPORTER_FILE_ENDING=.xmi
27+
# Number of parallel workers (default: 4, rule: 1 per CPU core)
28+
DUUI_IMPORTER_WORKERS=4
29+
# UIMA CAS pool size (default: 2×workers)
30+
DUUI_IMPORTER_CAS_POOL_SIZE=8
31+
# Optional: External TypeSystem XML file path (auto-detected from XMI if not set)
32+
DUUI_IMPORTER_TYPE_SYSTEM_PATH=
33+
34+
# ============================================
35+
# Application Configuration
36+
# ============================================
37+
APP_INPUT_DIR=/app/data/input
38+
39+
# ============================================
40+
# Pipeline Configuration
41+
# ============================================
42+
PIPELINE_IMPORTER=true
43+
PIPELINE_IMPORTER_FOLDER=/app/data/pipelines
44+
PIPELINE_IMPORTER_REPLACE_IF_DIFFERENT=false
45+
46+
# ============================================
47+
# Source Builder
48+
# ============================================
49+
SROUCE_BUILDER=false
50+
51+
# ============================================
52+
# LLM API Configuration (optional)
53+
# ============================================
54+
LLM_BASE_URL=http://your-llm-server:8000
55+
LLM_API_TOKEN=your-api-token-here
56+
57+
# ============================================
58+
# Java Options
59+
# ============================================
60+
# Adjust memory based on your system and data size
61+
JAVA_OPTS=-Xmx2048m -Xms1024m
62+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: build-and-push
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
# Only rebuild when app/build-relevant files change.
7+
# Do NOT rebuild when Flux only updates manifests under clusters/.
8+
paths-ignore:
9+
- 'clusters/**'
10+
- '**/*.md'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
build:
19+
# Extra safety: skip commits created by Flux bot
20+
if: github.actor != 'fluxcdbot'
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: docker/setup-buildx-action@v3
27+
28+
- uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Compute image tag
35+
id: meta
36+
shell: bash
37+
run: |
38+
ts=$(date -u +%Y%m%d%H%M%S)
39+
echo "tag=${ts}-${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
40+
41+
- name: Build and push
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
push: true
46+
tags: |
47+
ghcr.io/texttechnologylab/unified-dynamic-annotation-visualizer:${{ steps.meta.outputs.tag }}
48+
ghcr.io/texttechnologylab/unified-dynamic-annotation-visualizer:latest

Dockerfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Multi-stage build to minimize final image size
2+
FROM eclipse-temurin:21-jdk-alpine AS builder
3+
4+
WORKDIR /build
5+
6+
# Copy pom.xml and download dependencies
7+
COPY pom.xml .
8+
RUN apk add --no-cache maven && \
9+
mvn dependency:go-offline -B
10+
11+
# Copy source code and build application
12+
COPY src ./src
13+
RUN mvn clean package -DskipTests -B
14+
15+
# Runtime stage
16+
FROM eclipse-temurin:21-jre-alpine
17+
18+
WORKDIR /app
19+
20+
# Create non-root user for security
21+
RUN addgroup -g 1000 appuser && \
22+
adduser -D -u 1000 -G appuser appuser
23+
24+
# Copy JAR from builder stage
25+
COPY --from=builder /build/target/UDAV-1.0.jar app.jar
26+
27+
# Create directories for input data
28+
RUN mkdir -p /app/data/input && \
29+
chown -R appuser:appuser /app
30+
31+
# Switch to non-root user
32+
USER appuser
33+
34+
# Health check
35+
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
36+
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1
37+
38+
# Expose port
39+
EXPOSE 8080
40+
41+
# Environment variables with defaults
42+
ENV JAVA_OPTS="-Xmx1024m -Xms512m"
43+
44+
# Database Configuration
45+
ENV DB_URL="jdbc:postgresql://postgres:5432/udav"
46+
ENV DB_USER="postgres"
47+
ENV DB_PASS="postgres"
48+
ENV DB_SCHEMA="public"
49+
ENV DB_BATCH_SIZE="5000"
50+
ENV DB_MAX_IDENT="255"
51+
ENV DB_DIALECT="POSTGRES"
52+
53+
# DUUI Importer Configuration
54+
ENV DUUI_IMPORTER="false"
55+
ENV DUUI_IMPORTER_PATH="/app/data/input"
56+
ENV DUUI_IMPORTER_WORKERS="4"
57+
ENV DUUI_IMPORTER_CAS_POOL_SIZE="8"
58+
59+
# Application Configuration
60+
ENV APP_INPUT_DIR="/app/data/input"
61+
ENV SROUCE_BUILDER="false"
62+
ENV PIPELINE_IMPORTER="true"
63+
ENV PIPELINE_IMPORTER_FOLDER="/app/pipelines"
64+
65+
# LLM Configuration (optional, set as needed)
66+
ENV LLM_BASE_URL=""
67+
ENV LLM_API_TOKEN=""
68+
69+
# Run the application
70+
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar"]
71+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: kustomize.toolkit.fluxcd.io/v1
2+
kind: Kustomization
3+
metadata:
4+
name: apps
5+
namespace: flux-system
6+
spec:
7+
interval: 5m
8+
path: ./clusters/homelab
9+
prune: true
10+
wait: true
11+
sourceRef:
12+
kind: GitRepository
13+
name: flux-system
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../apps-kustomization.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- namespace.yaml
5+
- udav-source.yaml
6+
- udav-configmap.yaml
7+
- udav-deployment.yaml
8+
- udav-image-automation.yaml

clusters/homelab/namespace.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: uni
5+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: udav-config
5+
namespace: uni
6+
data:
7+
# Database configuration (non-sensitive)
8+
DB_URL: "jdbc:postgresql://pg-postgresql.dlti.svc.cluster.local:5432/udav"
9+
DB_SCHEMA: "public"
10+
DB_BATCH_SIZE: "5000"
11+
DB_MAX_IDENT: "255"
12+
DB_DIALECT: "POSTGRES"
13+
14+
# DUUI Importer Configuration
15+
DUUI_IMPORTER: "false"
16+
DUUI_IMPORTER_PATH: "/app/data/input"
17+
DUUI_IMPORTER_WORKERS: "4"
18+
DUUI_IMPORTER_CAS_POOL_SIZE: "8"
19+
20+
# Application Configuration
21+
APP_INPUT_DIR: "/app/data/input"
22+
SROUCE_BUILDER: "false"
23+
PIPELINE_IMPORTER: "true"
24+
PIPELINE_IMPORTER_FOLDER: "/app/pipelines"
25+
26+
# JVM options
27+
JAVA_OPTS: "-Xmx1024m -Xms512m"
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: udav
5+
namespace: uni
6+
labels:
7+
app: udav
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: udav
13+
template:
14+
metadata:
15+
labels:
16+
app: udav
17+
spec:
18+
imagePullSecrets:
19+
- name: ghcr-secret
20+
containers:
21+
- name: app
22+
image: ghcr.io/texttechnologylab/unified-dynamic-annotation-visualizer:latest # {"$imagepolicy": "flux-system:udav"}
23+
imagePullPolicy: IfNotPresent
24+
ports:
25+
- name: http
26+
containerPort: 8080
27+
envFrom:
28+
- configMapRef:
29+
name: udav-config
30+
- secretRef:
31+
name: udav-secrets
32+
readinessProbe:
33+
httpGet:
34+
path: /actuator/health
35+
port: http
36+
initialDelaySeconds: 30
37+
periodSeconds: 10
38+
livenessProbe:
39+
httpGet:
40+
path: /actuator/health
41+
port: http
42+
initialDelaySeconds: 60
43+
periodSeconds: 20
44+
resources:
45+
requests:
46+
memory: "512Mi"
47+
cpu: "250m"
48+
limits:
49+
memory: "1.5Gi"
50+
cpu: "1000m"
51+
---
52+
apiVersion: v1
53+
kind: Service
54+
metadata:
55+
name: udav
56+
namespace: uni
57+
labels:
58+
app: udav
59+
spec:
60+
selector:
61+
app: udav
62+
ports:
63+
- name: http
64+
port: 80
65+
targetPort: http
66+
type: ClusterIP
67+
---
68+
apiVersion: networking.k8s.io/v1
69+
kind: Ingress
70+
metadata:
71+
name: udav-ingress
72+
namespace: uni
73+
annotations:
74+
traefik.ingress.kubernetes.io/router.entrypoints: websecure
75+
spec:
76+
ingressClassName: traefik
77+
tls:
78+
- hosts:
79+
- udav.example.com # TODO: replace with your actual hostname
80+
secretName: udav-tls
81+
rules:
82+
- host: udav.example.com # TODO: replace with your actual hostname
83+
http:
84+
paths:
85+
- path: /
86+
pathType: Prefix
87+
backend:
88+
service:
89+
name: udav
90+
port:
91+
name: http
92+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apiVersion: image.toolkit.fluxcd.io/v1
2+
kind: ImageRepository
3+
metadata:
4+
name: udav
5+
namespace: flux-system
6+
spec:
7+
image: ghcr.io/texttechnologylab/unified-dynamic-annotation-visualizer
8+
interval: 1m
9+
secretRef:
10+
name: ghcr-credentials
11+
---
12+
apiVersion: image.toolkit.fluxcd.io/v1
13+
kind: ImagePolicy
14+
metadata:
15+
name: udav
16+
namespace: flux-system
17+
spec:
18+
imageRepositoryRef:
19+
name: udav
20+
filterTags:
21+
# Match tags like: 20260226205739-ccfd3df13de72a194bb4be9bc34465dd4939ab6b
22+
pattern: '^[0-9]{14}-[0-9a-z]{40}$'
23+
policy:
24+
alphabetical:
25+
order: asc
26+
---
27+
apiVersion: image.toolkit.fluxcd.io/v1
28+
kind: ImageUpdateAutomation
29+
metadata:
30+
name: udav
31+
namespace: flux-system
32+
spec:
33+
interval: 5m
34+
sourceRef:
35+
kind: GitRepository
36+
name: udav-repo
37+
git:
38+
checkout:
39+
ref:
40+
branch: main
41+
commit:
42+
author:
43+
name: fluxcdbot
44+
email: fluxcdbot@users.noreply.github.com
45+
messageTemplate: "chore(udav): update image"
46+
push:
47+
branch: main
48+
update:
49+
path: ./clusters/homelab
50+
strategy: Setters

0 commit comments

Comments
 (0)