Skip to content

Commit c09174d

Browse files
authored
Merge pull request #3 from texttechnologylab/feature/auto-deploy
Add Kustomization and GitHub Actions for UDAV deployment and image au…
2 parents 3697f26 + 44e57a8 commit c09174d

9 files changed

Lines changed: 260 additions & 0 deletions

File tree

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
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

clusters/homelab/udav-source.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: source.toolkit.fluxcd.io/v1
2+
kind: GitRepository
3+
metadata:
4+
name: udav-repo
5+
namespace: flux-system
6+
spec:
7+
interval: 1m
8+
ref:
9+
branch: main
10+
secretRef:
11+
name: udav-repo-auth
12+
url: https://github.com/texttechnologylab/Unified-Dynamic-Annotation-Visualizer.git
13+

0 commit comments

Comments
 (0)