Improve the frontend

This commit is contained in:
Urtzi Alfaro
2025-10-21 19:50:07 +02:00
parent 05da20357d
commit 8d30172483
105 changed files with 14699 additions and 4630 deletions

View File

@@ -0,0 +1,112 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: alert-processor-api
namespace: bakery-ia
labels:
app.kubernetes.io/name: alert-processor-api
app.kubernetes.io/component: api
app.kubernetes.io/part-of: bakery-ia
spec:
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: alert-processor-api
app.kubernetes.io/component: api
template:
metadata:
labels:
app.kubernetes.io/name: alert-processor-api
app.kubernetes.io/component: api
spec:
initContainers:
- name: wait-for-migration
image: postgres:17-alpine
command:
- sh
- -c
- |
echo "Waiting for alert-processor database and migrations to be ready..."
until pg_isready -h $ALERT_PROCESSOR_DB_HOST -p $ALERT_PROCESSOR_DB_PORT -U $ALERT_PROCESSOR_DB_USER; do
echo "Database not ready yet, waiting..."
sleep 2
done
echo "Database is ready!"
echo "Waiting for migrations to complete..."
sleep 10
echo "Ready to start API service"
env:
- name: ALERT_PROCESSOR_DB_HOST
valueFrom:
configMapKeyRef:
name: bakery-config
key: ALERT_PROCESSOR_DB_HOST
- name: ALERT_PROCESSOR_DB_PORT
valueFrom:
configMapKeyRef:
name: bakery-config
key: DB_PORT
- name: ALERT_PROCESSOR_DB_USER
valueFrom:
secretKeyRef:
name: database-secrets
key: ALERT_PROCESSOR_DB_USER
containers:
- name: alert-processor-api
image: bakery/alert-processor:latest
command: ["python", "-m", "uvicorn", "app.api_server:app", "--host", "0.0.0.0", "--port", "8010"]
ports:
- containerPort: 8010
name: http
envFrom:
- configMapRef:
name: bakery-config
- secretRef:
name: database-secrets
- secretRef:
name: redis-secrets
- secretRef:
name: jwt-secrets
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
readinessProbe:
httpGet:
path: /health
port: 8010
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet:
path: /health
port: 8010
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
---
apiVersion: v1
kind: Service
metadata:
name: alert-processor-api
namespace: bakery-ia
labels:
app.kubernetes.io/name: alert-processor-api
app.kubernetes.io/component: api
app.kubernetes.io/part-of: bakery-ia
spec:
selector:
app.kubernetes.io/name: alert-processor-api
app.kubernetes.io/component: api
ports:
- name: http
port: 8010
targetPort: 8010
protocol: TCP
type: ClusterIP

View File

@@ -14,6 +14,10 @@ data:
DEBUG: "false"
LOG_LEVEL: "INFO"
# Observability Settings
# Set to "true" when Jaeger/monitoring stack is deployed
ENABLE_TRACING: "false"
# Database initialization settings
# IMPORTANT: Services NEVER run migrations - they only verify DB is ready
# Migrations are handled by dedicated migration jobs
@@ -89,6 +93,7 @@ data:
POS_SERVICE_URL: "http://pos-service:8000"
ORDERS_SERVICE_URL: "http://orders-service:8000"
PRODUCTION_SERVICE_URL: "http://production-service:8000"
ALERT_PROCESSOR_SERVICE_URL: "http://alert-processor-api:8010"
# ================================================================
# AUTHENTICATION & SECURITY SETTINGS

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-pos-configs
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "35" # After orders (30)
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-pos-configs
spec:
initContainers:
- name: wait-for-pos-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for pos-migration to complete..."
sleep 30
- name: wait-for-orders-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 20 seconds for demo-seed-orders to complete..."
sleep 20
containers:
- name: seed-pos-configs
image: bakery/pos-service:latest
command: ["python", "/app/scripts/demo/seed_demo_pos_configs.py"]
env:
- name: POS_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: POS_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,55 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-purchase-orders
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "21"
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-purchase-orders
spec:
initContainers:
- name: wait-for-suppliers-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 45 seconds for demo-seed-suppliers to complete..."
sleep 45
containers:
- name: seed-purchase-orders
image: bakery/suppliers-service:latest
command: ["python", "/app/scripts/demo/seed_demo_purchase_orders.py"]
env:
- name: SUPPLIERS_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: SUPPLIERS_DATABASE_URL
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: SUPPLIERS_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -46,6 +46,7 @@ resources:
- jobs/demo-seed-inventory-job.yaml
- jobs/demo-seed-recipes-job.yaml
- jobs/demo-seed-suppliers-job.yaml
- jobs/demo-seed-purchase-orders-job.yaml
- jobs/demo-seed-sales-job.yaml
- jobs/demo-seed-ai-models-job.yaml
- jobs/demo-seed-stock-job.yaml
@@ -56,6 +57,7 @@ resources:
- jobs/demo-seed-orders-job.yaml
- jobs/demo-seed-procurement-job.yaml
- jobs/demo-seed-forecasts-job.yaml
- jobs/demo-seed-pos-configs-job.yaml
# External data initialization job (v2.0)
- jobs/external-data-init-job.yaml
@@ -113,6 +115,7 @@ resources:
- components/orders/orders-service.yaml
- components/production/production-service.yaml
- components/alert-processor/alert-processor-service.yaml
- components/alert-processor/alert-processor-api.yaml
# Frontend
- components/frontend/frontend-service.yaml

View File

@@ -11,6 +11,8 @@ metadata:
nginx.ingress.kubernetes.io/cors-allow-headers: "Content-Type, Authorization, X-Requested-With, Accept, Origin, Cache-Control"
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/enable-cors: "true"
# Prevent nginx from redirecting to add trailing slashes
nginx.ingress.kubernetes.io/use-regex: "true"
# Development, SSE and WebSocket annotations
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"