Improve the demo feature of the project
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: demo-clone-VIRTUAL_TENANT_ID
|
||||
namespace: bakery-ia
|
||||
labels:
|
||||
app: demo-clone
|
||||
component: runtime
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 3600 # Clean up after 1 hour
|
||||
backoffLimit: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-clone
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: clone-data
|
||||
image: bakery/inventory-service:latest # Uses inventory image which has all scripts
|
||||
command: ["python", "/app/scripts/demo/clone_demo_tenant.py"]
|
||||
env:
|
||||
- name: VIRTUAL_TENANT_ID
|
||||
value: "VIRTUAL_TENANT_ID"
|
||||
- name: DEMO_ACCOUNT_TYPE
|
||||
value: "DEMO_ACCOUNT_TYPE"
|
||||
- name: INVENTORY_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: INVENTORY_DATABASE_URL
|
||||
- name: SALES_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: SALES_DATABASE_URL
|
||||
- name: ORDERS_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: ORDERS_DATABASE_URL
|
||||
- name: TENANT_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: TENANT_DATABASE_URL
|
||||
- name: LOG_LEVEL
|
||||
value: "INFO"
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
@@ -0,0 +1,63 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: demo-seed-recipes
|
||||
namespace: bakery-ia
|
||||
labels:
|
||||
app: demo-seed
|
||||
component: initialization
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-weight": "20"
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 3600
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-seed-recipes
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-recipes-migration
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 30 seconds for recipes-migration to complete..."
|
||||
sleep 30
|
||||
- name: wait-for-inventory-seed
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 15 seconds for demo-seed-inventory to complete..."
|
||||
sleep 15
|
||||
containers:
|
||||
- name: seed-recipes
|
||||
image: bakery/recipes-service:latest
|
||||
command: ["python", "/app/scripts/demo/seed_demo_recipes.py"]
|
||||
env:
|
||||
- name: RECIPES_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: RECIPES_DATABASE_URL
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: RECIPES_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
|
||||
63
infrastructure/kubernetes/base/jobs/demo-seed-sales-job.yaml
Normal file
63
infrastructure/kubernetes/base/jobs/demo-seed-sales-job.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: demo-seed-sales
|
||||
namespace: bakery-ia
|
||||
labels:
|
||||
app: demo-seed
|
||||
component: initialization
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-weight": "25"
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 3600
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-seed-sales
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-sales-migration
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 30 seconds for sales-migration to complete..."
|
||||
sleep 30
|
||||
- name: wait-for-inventory-seed
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 15 seconds for demo-seed-inventory to complete..."
|
||||
sleep 15
|
||||
containers:
|
||||
- name: seed-sales
|
||||
image: bakery/sales-service:latest
|
||||
command: ["python", "/app/scripts/demo/seed_demo_sales.py"]
|
||||
env:
|
||||
- name: SALES_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: SALES_DATABASE_URL
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: SALES_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
|
||||
@@ -0,0 +1,56 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: demo-seed-subscriptions
|
||||
namespace: bakery-ia
|
||||
labels:
|
||||
app: demo-seed
|
||||
component: initialization
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-weight": "15"
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 3600
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-seed-subscriptions
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-tenant-migration
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 30 seconds for tenant-migration to complete..."
|
||||
sleep 30
|
||||
- name: wait-for-tenant-seed
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 15 seconds for demo-seed-tenants to complete..."
|
||||
sleep 15
|
||||
containers:
|
||||
- name: seed-subscriptions
|
||||
image: bakery/tenant-service:latest
|
||||
command: ["python", "/app/scripts/demo/seed_demo_subscriptions.py"]
|
||||
env:
|
||||
- name: TENANT_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: TENANT_DATABASE_URL
|
||||
- name: LOG_LEVEL
|
||||
value: "INFO"
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
restartPolicy: OnFailure
|
||||
serviceAccountName: demo-seed-sa
|
||||
@@ -0,0 +1,63 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: demo-seed-suppliers
|
||||
namespace: bakery-ia
|
||||
labels:
|
||||
app: demo-seed
|
||||
component: initialization
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-weight": "20"
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 3600
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-seed-suppliers
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-suppliers-migration
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 30 seconds for suppliers-migration to complete..."
|
||||
sleep 30
|
||||
- name: wait-for-inventory-seed
|
||||
image: busybox:1.36
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting 15 seconds for demo-seed-inventory to complete..."
|
||||
sleep 15
|
||||
containers:
|
||||
- name: seed-suppliers
|
||||
image: bakery/suppliers-service:latest
|
||||
command: ["python", "/app/scripts/demo/seed_demo_suppliers.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
|
||||
@@ -36,7 +36,11 @@ resources:
|
||||
- jobs/demo-seed-rbac.yaml
|
||||
- jobs/demo-seed-users-job.yaml
|
||||
- jobs/demo-seed-tenants-job.yaml
|
||||
- jobs/demo-seed-subscriptions-job.yaml
|
||||
- jobs/demo-seed-inventory-job.yaml
|
||||
- jobs/demo-seed-recipes-job.yaml
|
||||
- jobs/demo-seed-suppliers-job.yaml
|
||||
- jobs/demo-seed-sales-job.yaml
|
||||
- jobs/demo-seed-ai-models-job.yaml
|
||||
|
||||
# External data initialization job (v2.0)
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/alert-processor:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "alert_processor"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "alert_processor"]
|
||||
env:
|
||||
- name: ALERT_PROCESSOR_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/auth-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "auth"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "auth"]
|
||||
env:
|
||||
- name: AUTH_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
- name: migrate
|
||||
image: bakery/demo-session-service:latest
|
||||
imagePullPolicy: Never
|
||||
command: ["python", "/app/scripts/run_migrations.py", "demo_session"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "demo_session"]
|
||||
env:
|
||||
- name: DEMO_SESSION_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/external-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "external"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "external"]
|
||||
env:
|
||||
- name: EXTERNAL_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/forecasting-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "forecasting"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "forecasting"]
|
||||
env:
|
||||
- name: FORECASTING_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/inventory-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "inventory"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "inventory"]
|
||||
env:
|
||||
- name: INVENTORY_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/notification-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "notification"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "notification"]
|
||||
env:
|
||||
- name: NOTIFICATION_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/orders-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "orders"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "orders"]
|
||||
env:
|
||||
- name: ORDERS_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/pos-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "pos"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "pos"]
|
||||
env:
|
||||
- name: POS_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/production-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "production"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "production"]
|
||||
env:
|
||||
- name: PRODUCTION_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/recipes-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "recipes"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "recipes"]
|
||||
env:
|
||||
- name: RECIPES_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/sales-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "sales"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "sales"]
|
||||
env:
|
||||
- name: SALES_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/suppliers-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "suppliers"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "suppliers"]
|
||||
env:
|
||||
- name: SUPPLIERS_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/tenant-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "tenant"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "tenant"]
|
||||
env:
|
||||
- name: TENANT_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -30,7 +30,7 @@ spec:
|
||||
containers:
|
||||
- name: migrate
|
||||
image: bakery/training-service:dev
|
||||
command: ["python", "/app/scripts/run_migrations.py", "training"]
|
||||
command: ["python", "/app/shared/scripts/run_migrations.py", "training"]
|
||||
env:
|
||||
- name: TRAINING_DATABASE_URL
|
||||
valueFrom:
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: demo-internal-api-key
|
||||
namespace: bakery-ia
|
||||
type: Opaque
|
||||
stringData:
|
||||
# IMPORTANT: Replace this with a secure randomly generated key in production
|
||||
# Generate with: python3 -c "import secrets; print(secrets.token_urlsafe(32))"
|
||||
INTERNAL_API_KEY: "REPLACE_WITH_SECURE_RANDOM_KEY_IN_PRODUCTION"
|
||||
Reference in New Issue
Block a user