Update oramap

This commit is contained in:
dvirlabs 2026-03-24 10:31:01 +02:00
parent ef09c75482
commit d9a32e3bc3
15 changed files with 584 additions and 58 deletions

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,24 @@
apiVersion: v2
name: oramap
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View File

@ -0,0 +1,11 @@
{{- define "oramap.name" -}}
{{ .Chart.Name }}
{{- end }}
{{- define "oramap.fullname" -}}
{{ include "oramap.name" . }}-{{ .Release.Name }}
{{- end }}
{{- define "oramap.chart" -}}
{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
{{- end }}

View File

@ -0,0 +1,42 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "oramap.fullname" . }}
labels:
app: {{ include "oramap.name" . }}
chart: {{ include "oramap.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "oramap.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ include "oramap.name" . }}
release: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.containerPort }}
name: http
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}

View File

@ -0,0 +1,33 @@
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "oramap.fullname" . }}
annotations:
{{- if .Values.ingress.className }}
kubernetes.io/ingress.class: {{ .Values.ingress.className }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ include "oramap.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- toYaml .Values.ingress.tls | nindent 4 }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "oramap.fullname" . }}
labels:
app: {{ include "oramap.name" . }}
chart: {{ include "oramap.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.containerPort }}
protocol: TCP
name: http
selector:
app: {{ include "oramap.name" . }}
release: {{ .Release.Name }}

View File

@ -0,0 +1,24 @@
replicaCount: 1
imagePullSecrets: []
image:
repository: harbor.dvirlabs.com/shay/oramap
tag: "1"
pullPolicy: IfNotPresent
containerPort: 3000
service:
type: ClusterIP
port: 80
ingress:
enabled: true
className: "traefik"
hosts:
- host: oramap.dvirlabs.com
paths:
- path: /
pathType: Prefix
tls: []

View File

@ -1,24 +1,11 @@
apiVersion: v2 apiVersion: v2
name: oramap name: oramap
description: A Helm chart for Kubernetes description: Ora Map - Family Location Mapping Application (Microservices Architecture)
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application type: application
# This is the chart version. This version number should be incremented each time you make changes # Chart version
# to the chart and its templates, including the app version. version: 0.2.0
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be # Application version
# incremented each time you make changes to the application. Versions are not expected to appVersion: "1.0.0"
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View File

@ -0,0 +1,169 @@
# Ora Map Helm Chart
Helm chart for deploying Ora Map application in Kubernetes with microservices architecture.
## Architecture
This chart deploys two main components:
- **Backend**: Node.js Express API server (Port 3000)
- **Frontend**: Nginx serving static files (Port 80)
## Installation
### Prerequisites
- Kubernetes cluster 1.19+
- Helm 3.0+
- Docker images built and pushed to Harbor registry
### Install Chart
```bash
# From the repository root
helm install oramap ./oramap
# Or with custom values
helm install oramap ./oramap -f custom-values.yaml
# Install in a specific namespace
helm install oramap ./oramap -n my-namespace --create-namespace
```
### Upgrade Chart
```bash
helm upgrade oramap ./oramap
```
### Uninstall Chart
```bash
helm uninstall oramap
```
## Configuration
The following table lists the configurable parameters and their default values:
| Parameter | Description | Default |
|-----------|-------------|---------|
| `backend.image.repository` | Backend image repository | `harbor.dvirlabs.com/my-apps/oramap-backend` |
| `backend.image.tag` | Backend image tag | `latest` |
| `backend.replicaCount` | Number of backend replicas | `1` |
| `backend.containerPort` | Backend container port | `3000` |
| `backend.resources.limits.cpu` | Backend CPU limit | `500m` |
| `backend.resources.limits.memory` | Backend memory limit | `512Mi` |
| `frontend.image.repository` | Frontend image repository | `harbor.dvirlabs.com/my-apps/oramap-frontend` |
| `frontend.image.tag` | Frontend image tag | `latest` |
| `frontend.replicaCount` | Number of frontend replicas | `1` |
| `frontend.containerPort` | Frontend container port | `80` |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `ingress.enabled` | Enable ingress | `true` |
| `ingress.className` | Ingress class name | `traefik` |
| `ingress.hosts[0].host` | Ingress hostname | `oramap.dvirlabs.com` |
### Example Custom Values
```yaml
# custom-values.yaml
backend:
image:
tag: "v1.0.0"
replicaCount: 3
frontend:
image:
tag: "v1.0.0"
replicaCount: 2
ingress:
hosts:
- host: oramap.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: oramap-tls
hosts:
- oramap.example.com
```
## Deployment Components
### Backend Deployment
- Runs Express.js API server
- Health checks on `/api/health`
- Configurable resources and replicas
### Frontend Deployment
- Runs Nginx serving static files
- Proxies `/api/*` requests to backend service
- Uses ConfigMap for nginx configuration
- Health checks on `/`
### Services
- **Backend Service**: Internal ClusterIP service on port 3000
- **Frontend Service**: ClusterIP service on port 80 (exposed via Ingress)
### Ingress
- Routes external traffic to frontend service
- TLS/SSL termination support
- Configurable hostname and paths
## CI/CD Integration
The Woodpecker CI pipeline automatically:
1. Builds backend and frontend Docker images
2. Tags with branch name and commit SHA
3. Pushes to Harbor registry
4. Updates this chart's values in the GitOps repository
## Accessing the Application
After installation, the application will be available at:
- **External**: https://oramap.dvirlabs.com (via Ingress)
- **Internal Backend API**: http://oramap-backend:3000
- **Internal Frontend**: http://oramap-frontend:80
## Troubleshooting
### Check Pod Status
```bash
kubectl get pods -l release=oramap
```
### View Logs
```bash
# Backend logs
kubectl logs -l app=oramap-backend
# Frontend logs
kubectl logs -l app=oramap-frontend
```
### Check Services
```bash
kubectl get svc -l release=oramap
```
### Test Backend Health
```bash
kubectl port-forward svc/oramap-backend 3000:3000
curl http://localhost:3000/api/health
```
## Version History
- **0.2.0**: Microservices architecture with separate backend and frontend
- **0.1.0**: Initial monolithic deployment

View File

@ -0,0 +1,45 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "oramap.fullname" . }}-nginx-config
labels:
app: {{ include "oramap.name" . }}-frontend
chart: {{ include "oramap.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
default.conf: |
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Main location
location / {
try_files $uri $uri/ /index.html;
}
# API proxy to backend service in Kubernetes
location /api/ {
proxy_pass http://{{ include "oramap.fullname" . }}-backend:{{ .Values.service.backend.port }};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Cache static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}

View File

@ -1,42 +1,107 @@
---
# Backend Deployment
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ include "oramap.fullname" . }} name: {{ include "oramap.fullname" . }}-backend
labels: labels:
app: {{ include "oramap.name" . }} app: {{ include "oramap.name" . }}-backend
chart: {{ include "oramap.chart" . }} chart: {{ include "oramap.chart" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
component: backend
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.backend.replicaCount }}
selector: selector:
matchLabels: matchLabels:
app: {{ include "oramap.name" . }} app: {{ include "oramap.name" . }}-backend
release: {{ .Release.Name }} release: {{ .Release.Name }}
component: backend
template: template:
metadata: metadata:
labels: labels:
app: {{ include "oramap.name" . }} app: {{ include "oramap.name" . }}-backend
release: {{ .Release.Name }} release: {{ .Release.Name }}
component: backend
spec: spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: backend
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
ports: ports:
- containerPort: {{ .Values.containerPort }} - containerPort: {{ .Values.backend.containerPort }}
name: http name: http
env:
- name: NODE_ENV
value: "production"
- name: PORT
value: "{{ .Values.backend.containerPort }}"
livenessProbe:
httpGet:
path: /api/health
port: http
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /api/health
port: http
initialDelaySeconds: 5
periodSeconds: 10
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
---
# Frontend Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "oramap.fullname" . }}-frontend
labels:
app: {{ include "oramap.name" . }}-frontend
chart: {{ include "oramap.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: frontend
spec:
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
app: {{ include "oramap.name" . }}-frontend
release: {{ .Release.Name }}
component: frontend
template:
metadata:
labels:
app: {{ include "oramap.name" . }}-frontend
release: {{ .Release.Name }}
component: frontend
spec:
containers:
- name: frontend
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
ports:
- containerPort: {{ .Values.frontend.containerPort }}
name: http
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
port: http port: http
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /
port: http port: http
initialDelaySeconds: 5
periodSeconds: 10
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.frontend.resources | nindent 12 }}
volumes:
- name: nginx-config
configMap:
name: {{ include "oramap.fullname" . }}-nginx-config

View File

@ -21,9 +21,9 @@ spec:
pathType: {{ .pathType }} pathType: {{ .pathType }}
backend: backend:
service: service:
name: {{ include "oramap.fullname" $ }} name: {{ include "oramap.fullname" $ }}-frontend
port: port:
number: {{ $.Values.service.port }} number: {{ $.Values.service.frontend.port }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.ingress.tls }} {{- if .Values.ingress.tls }}

View File

@ -1,19 +1,46 @@
---
# Backend Service
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ include "oramap.fullname" . }} name: {{ include "oramap.fullname" . }}-backend
labels: labels:
app: {{ include "oramap.name" . }} app: {{ include "oramap.name" . }}-backend
chart: {{ include "oramap.chart" . }} chart: {{ include "oramap.chart" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
component: backend
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: {{ .Values.service.port }} - port: {{ .Values.service.backend.port }}
targetPort: {{ .Values.containerPort }} targetPort: {{ .Values.service.backend.targetPort }}
protocol: TCP protocol: TCP
name: http name: http
selector: selector:
app: {{ include "oramap.name" . }} app: {{ include "oramap.name" . }}-backend
release: {{ .Release.Name }} release: {{ .Release.Name }}
component: backend
---
# Frontend Service
apiVersion: v1
kind: Service
metadata:
name: {{ include "oramap.fullname" . }}-frontend
labels:
app: {{ include "oramap.name" . }}-frontend
chart: {{ include "oramap.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: frontend
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.frontend.port }}
targetPort: {{ .Values.service.frontend.targetPort }}
protocol: TCP
name: http
selector:
app: {{ include "oramap.name" . }}-frontend
release: {{ .Release.Name }}
component: frontend

View File

@ -1,17 +1,45 @@
replicaCount: 1 replicaCount: 1
imagePullSecrets: [] # Backend API configuration
backend:
image: image:
repository: harbor.dvirlabs.com/shay/oramap repository: harbor.dvirlabs.com/my-apps/oramap-backend
tag: "1" tag: "latest"
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
containerPort: 3000
replicaCount: 1
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
containerPort: 3000 # Frontend Nginx configuration
frontend:
image:
repository: harbor.dvirlabs.com/my-apps/oramap-frontend
tag: "latest"
pullPolicy: IfNotPresent
containerPort: 80
replicaCount: 1
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 50m
memory: 64Mi
service: service:
type: ClusterIP type: ClusterIP
backend:
port: 3000
targetPort: 3000
frontend:
port: 80 port: 80
targetPort: 80
ingress: ingress:
enabled: true enabled: true

View File

@ -1,14 +1,46 @@
imagePullSecrets:
- name: harbor-regcred
replicaCount: 1 replicaCount: 1
image:
repository: harbor.dvirlabs.com/shay/oramap # Backend API configuration
tag: "3" backend:
image:
repository: harbor.dvirlabs.com/my-apps/oramap-backend
tag: "latest"
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
containerPort: 3000 containerPort: 3000
replicaCount: 1
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi
# Frontend Nginx configuration
frontend:
image:
repository: harbor.dvirlabs.com/my-apps/oramap-frontend
tag: "latest"
pullPolicy: IfNotPresent
containerPort: 80
replicaCount: 1
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 50m
memory: 64Mi
service: service:
type: ClusterIP type: ClusterIP
backend:
port: 3000
targetPort: 3000
frontend:
port: 80 port: 80
targetPort: 80
ingress: ingress:
enabled: true enabled: true
className: "traefik" className: "traefik"
@ -18,6 +50,3 @@ ingress:
- path: / - path: /
pathType: Prefix pathType: Prefix
tls: [] tls: []
backend:
image:
tag: master-fccd8a0