New enterprise feature2

This commit is contained in:
Urtzi Alfaro
2025-11-30 16:29:38 +01:00
parent 972db02f6d
commit 0da0470786
18 changed files with 698 additions and 76 deletions

View File

@@ -23,34 +23,31 @@ spec:
app: demo-cleanup
spec:
containers:
- name: cleanup
image: bakery/demo-session-service:latest
- name: cleanup-trigger
image: curlimages/curl:latest
command:
- python
- sh
- -c
- |
import asyncio
import httpx
async def cleanup():
async with httpx.AsyncClient() as client:
response = await client.post("http://demo-session-service:8000/api/v1/demo/operations/cleanup")
print(response.json())
asyncio.run(cleanup())
env:
- name: DEMO_SESSION_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: DEMO_SESSION_DATABASE_URL
- name: REDIS_URL
value: "redis://redis-service:6379/0"
- name: LOG_LEVEL
value: "INFO"
echo "Triggering demo session cleanup..."
response=$(curl -s -w "\n%{http_code}" -X POST http://demo-session-service:8000/api/v1/demo/operations/cleanup)
http_code=$(echo "$response" | tail -n 1)
body=$(echo "$response" | sed '$d')
echo "Response: $body"
echo "HTTP Status: $http_code"
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
echo "Cleanup job enqueued successfully"
exit 0
else
echo "Failed to enqueue cleanup job"
exit 1
fi
resources:
requests:
memory: "128Mi"
cpu: "50m"
memory: "32Mi"
cpu: "10m"
limits:
memory: "256Mi"
cpu: "200m"
memory: "64Mi"
cpu: "50m"
restartPolicy: OnFailure
activeDeadlineSeconds: 30

View File

@@ -0,0 +1,96 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-cleanup-worker
namespace: bakery-ia
labels:
app: demo-cleanup-worker
component: background-jobs
service: demo-session
spec:
replicas: 2
selector:
matchLabels:
app: demo-cleanup-worker
template:
metadata:
labels:
app: demo-cleanup-worker
component: background-jobs
service: demo-session
spec:
containers:
- name: worker
image: bakery/demo-session-service:latest
imagePullPolicy: IfNotPresent
command:
- python
- -m
- app.jobs.cleanup_worker
env:
- name: DEMO_SESSION_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: DEMO_SESSION_DATABASE_URL
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secrets
key: REDIS_PASSWORD
- name: REDIS_URL
value: "rediss://:$(REDIS_PASSWORD)@redis-service:6379/0?ssl_cert_reqs=none"
- name: LOG_LEVEL
value: "INFO"
- name: INTERNAL_API_KEY
valueFrom:
secretKeyRef:
name: demo-internal-api-key
key: INTERNAL_API_KEY
- name: INVENTORY_SERVICE_URL
value: "http://inventory-service:8000"
- name: RECIPES_SERVICE_URL
value: "http://recipes-service:8000"
- name: SALES_SERVICE_URL
value: "http://sales-service:8000"
- name: ORDERS_SERVICE_URL
value: "http://orders-service:8000"
- name: PRODUCTION_SERVICE_URL
value: "http://production-service:8000"
- name: SUPPLIERS_SERVICE_URL
value: "http://suppliers-service:8000"
- name: POS_SERVICE_URL
value: "http://pos-service:8000"
- name: PROCUREMENT_SERVICE_URL
value: "http://procurement-service:8000"
- name: DISTRIBUTION_SERVICE_URL
value: "http://distribution-service:8000"
- name: FORECASTING_SERVICE_URL
value: "http://forecasting-service:8000"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
exec:
command:
- python
- -c
- "import sys; sys.exit(0)"
initialDelaySeconds: 30
periodSeconds: 60
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
exec:
command:
- python
- -c
- "import sys; sys.exit(0)"
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 5
restartPolicy: Always

View File

@@ -15,6 +15,7 @@ resources:
- configmaps/postgres-logging-config.yaml
- secrets/postgres-tls-secret.yaml
- secrets/redis-tls-secret.yaml
- secrets/demo-internal-api-key-secret.yaml
# Additional configs
- configs/postgres-init-config.yaml
@@ -127,6 +128,9 @@ resources:
- components/demo-session/service.yaml
- components/demo-session/deployment.yaml
# Demo cleanup worker (background job processor)
- deployments/demo-cleanup-worker.yaml
# Microservices
- components/auth/auth-service.yaml
- components/tenant/tenant-service.yaml