feat: Enhance project and scenario creation with monitoring metrics
Some checks failed
CI / lint (push) Failing after 1m14s
CI / test (push) Has been skipped
CI / build (push) Has been skipped

- Added monitoring metrics for project creation success and error handling in `ProjectRepository`.
- Implemented similar monitoring for scenario creation in `ScenarioRepository`.
- Refactored `run_monte_carlo` function in `simulation.py` to include timing and success/error metrics.
- Introduced new CSS styles for headers, alerts, and navigation buttons in `main.css` and `projects.css`.
- Created a new JavaScript file for navigation logic to handle chevron buttons.
- Updated HTML templates to include new navigation buttons and improved styling for buttons.
- Added tests for reporting service and routes to ensure proper functionality and access control.
- Removed unused imports and optimized existing test files for better clarity and performance.
This commit is contained in:
2025-11-12 10:36:24 +01:00
parent f68321cd04
commit ce9c174b53
61 changed files with 2124 additions and 308 deletions

14
k8s/configmap.yaml Normal file
View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: calminer-config
data:
DATABASE_HOST: "calminer-db"
DATABASE_PORT: "5432"
DATABASE_USER: "calminer"
DATABASE_NAME: "calminer_db"
DATABASE_DRIVER: "postgresql"
CALMINER_EXPORT_MAX_ROWS: "10000"
CALMINER_EXPORT_METADATA: "true"
CALMINER_IMPORT_STAGING_TTL: "300"
CALMINER_IMPORT_MAX_ROWS: "50000"

54
k8s/deployment.yaml Normal file
View File

@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: calminer-app
labels:
app: calminer
spec:
replicas: 3
selector:
matchLabels:
app: calminer
template:
metadata:
labels:
app: calminer
spec:
containers:
- name: calminer
image: registry.example.com/calminer:latest
ports:
- containerPort: 8003
envFrom:
- configMapRef:
name: calminer-config
- secretRef:
name: calminer-secrets
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 8003
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 8003
initialDelaySeconds: 5
periodSeconds: 5
initContainers:
- name: wait-for-db
image: postgres:17
command:
[
"sh",
"-c",
"until pg_isready -h calminer-db -p 5432; do echo waiting for database; sleep 2; done;",
]

18
k8s/ingress.yaml Normal file
View File

@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: calminer-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: calminer.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: calminer-service
port:
number: 80

13
k8s/postgres-service.yaml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: calminer-db
labels:
app: calminer-db
spec:
selector:
app: calminer-db
ports:
- port: 5432
targetPort: 5432
clusterIP: None # Headless service for StatefulSet

48
k8s/postgres.yaml Normal file
View File

@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: calminer-db
spec:
serviceName: calminer-db
replicas: 1
selector:
matchLabels:
app: calminer-db
template:
metadata:
labels:
app: calminer-db
spec:
containers:
- name: postgres
image: postgres:17
ports:
- containerPort: 5432
env:
- name: POSTGRES_USER
value: "calminer"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: calminer-secrets
key: DATABASE_PASSWORD
- name: POSTGRES_DB
value: "calminer_db"
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: postgres-storage
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi

8
k8s/secret.yaml Normal file
View File

@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: calminer-secrets
type: Opaque
data:
DATABASE_PASSWORD: Y2FsbWluZXJfcGFzc3dvcmQ= # base64 encoded 'calminer_password'
CALMINER_SEED_ADMIN_PASSWORD: Q2hhbmdlTWUxMjMh # base64 encoded 'ChangeMe123!'

14
k8s/service.yaml Normal file
View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: calminer-service
labels:
app: calminer
spec:
selector:
app: calminer
ports:
- port: 80
targetPort: 8003
protocol: TCP
type: ClusterIP