Improve demo seed
This commit is contained in:
91
Tiltfile
91
Tiltfile
@@ -186,59 +186,110 @@ k8s_resource('alert-processor-db', labels=['databases'])
|
||||
# =============================================================================
|
||||
# Demo seed jobs run in strict order to ensure data consistency across services:
|
||||
#
|
||||
# Order & Dependencies:
|
||||
# 1. demo-seed-users → Creates demo user accounts in auth service
|
||||
# 2. demo-seed-tenants → Creates demo tenant records (depends on users)
|
||||
# 3. demo-seed-subscriptions → Creates enterprise subscriptions for demo tenants (depends on tenants)
|
||||
# 4. demo-seed-inventory → Creates ingredients & finished products (depends on tenants)
|
||||
# 5. demo-seed-recipes → Creates recipes using ingredient IDs (depends on inventory)
|
||||
# 6. demo-seed-suppliers → Creates suppliers with price lists for ingredients (depends on inventory)
|
||||
# 7. demo-seed-sales → Creates historical sales data using finished product IDs (depends on inventory)
|
||||
# 8. demo-seed-ai-models → Creates fake AI model entries (depends on inventory)
|
||||
#
|
||||
# Note: Recipes, Suppliers, and Sales can run in parallel after Inventory completes,
|
||||
# as they all depend on inventory data but not on each other.
|
||||
# Helm Hook Weight Order (5-40):
|
||||
# Weight 5: demo-seed-users → Creates demo user accounts (with staff) in auth service
|
||||
# Weight 10: demo-seed-tenants → Creates demo tenant records (depends on users)
|
||||
# Weight 15: demo-seed-tenant-members → Links staff users to tenants (depends on users & tenants)
|
||||
# Weight 10: demo-seed-subscriptions → Creates enterprise subscriptions for demo tenants
|
||||
# Weight 15: demo-seed-inventory → Creates ingredients & finished products (depends on tenants)
|
||||
# Weight 15: demo-seed-recipes → Creates recipes using ingredient IDs (depends on inventory)
|
||||
# Weight 15: demo-seed-suppliers → Creates suppliers with price lists for ingredients (depends on inventory)
|
||||
# Weight 15: demo-seed-sales → Creates historical sales data using finished product IDs (depends on inventory)
|
||||
# Weight 15: demo-seed-ai-models → Creates fake AI model entries (depends on inventory)
|
||||
# Weight 20: demo-seed-stock → Creates stock batches with expiration dates (depends on inventory)
|
||||
# Weight 22: demo-seed-quality-templates → Creates quality check templates (depends on production migration)
|
||||
# Weight 25: demo-seed-customers → Creates customer records (depends on orders migration)
|
||||
# Weight 25: demo-seed-equipment → Creates production equipment (depends on production migration)
|
||||
# Weight 30: demo-seed-production-batches → Creates production batches (depends on recipes, equipment)
|
||||
# Weight 30: demo-seed-orders → Creates orders with line items (depends on customers)
|
||||
# Weight 35: demo-seed-procurement → Creates procurement plans (depends on orders migration)
|
||||
# Weight 40: demo-seed-forecasts → Creates demand forecasts (depends on forecasting migration)
|
||||
|
||||
# Step 1: Seed users (auth service)
|
||||
# Weight 5: Seed users (auth service) - includes staff users
|
||||
k8s_resource('demo-seed-users',
|
||||
resource_deps=['auth-migration'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Step 2: Seed tenants (tenant service)
|
||||
# Weight 10: Seed tenants (tenant service)
|
||||
k8s_resource('demo-seed-tenants',
|
||||
resource_deps=['tenant-migration', 'demo-seed-users'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Step 2.5: Seed subscriptions (creates enterprise subscriptions for demo tenants)
|
||||
# Weight 15: Seed tenant members (links staff users to tenants)
|
||||
k8s_resource('demo-seed-tenant-members',
|
||||
resource_deps=['tenant-migration', 'demo-seed-tenants', 'demo-seed-users'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 10: Seed subscriptions (creates enterprise subscriptions for demo tenants)
|
||||
k8s_resource('demo-seed-subscriptions',
|
||||
resource_deps=['tenant-migration', 'demo-seed-tenants'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Step 3: Seed inventory - CRITICAL: All other seeds depend on this
|
||||
# Weight 15: Seed inventory - CRITICAL: All other seeds depend on this
|
||||
k8s_resource('demo-seed-inventory',
|
||||
resource_deps=['inventory-migration', 'demo-seed-tenants'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Step 4: Seed recipes (uses ingredient IDs from inventory)
|
||||
# Weight 15: Seed recipes (uses ingredient IDs from inventory)
|
||||
k8s_resource('demo-seed-recipes',
|
||||
resource_deps=['recipes-migration', 'demo-seed-inventory'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Step 5: Seed suppliers (uses ingredient IDs for price lists)
|
||||
# Weight 15: Seed suppliers (uses ingredient IDs for price lists)
|
||||
k8s_resource('demo-seed-suppliers',
|
||||
resource_deps=['suppliers-migration', 'demo-seed-inventory'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Step 6: Seed sales (uses finished product IDs from inventory)
|
||||
# Weight 15: Seed sales (uses finished product IDs from inventory)
|
||||
k8s_resource('demo-seed-sales',
|
||||
resource_deps=['sales-migration', 'demo-seed-inventory'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Step 7: Seed AI models (creates training/forecasting model records)
|
||||
# Weight 15: Seed AI models (creates training/forecasting model records)
|
||||
k8s_resource('demo-seed-ai-models',
|
||||
resource_deps=['training-migration', 'demo-seed-inventory'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 20: Seed stock batches (inventory service)
|
||||
k8s_resource('demo-seed-stock',
|
||||
resource_deps=['inventory-migration', 'demo-seed-inventory'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 22: Seed quality check templates (production service)
|
||||
k8s_resource('demo-seed-quality-templates',
|
||||
resource_deps=['production-migration', 'demo-seed-tenants'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 25: Seed customers (orders service)
|
||||
k8s_resource('demo-seed-customers',
|
||||
resource_deps=['orders-migration', 'demo-seed-tenants'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 25: Seed equipment (production service)
|
||||
k8s_resource('demo-seed-equipment',
|
||||
resource_deps=['production-migration', 'demo-seed-tenants', 'demo-seed-quality-templates'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 30: Seed production batches (production service)
|
||||
k8s_resource('demo-seed-production-batches',
|
||||
resource_deps=['production-migration', 'demo-seed-recipes', 'demo-seed-equipment'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 30: Seed orders with line items (orders service)
|
||||
k8s_resource('demo-seed-orders',
|
||||
resource_deps=['orders-migration', 'demo-seed-customers'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 35: Seed procurement plans (orders service)
|
||||
k8s_resource('demo-seed-procurement',
|
||||
resource_deps=['orders-migration', 'demo-seed-tenants'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# Weight 40: Seed demand forecasts (forecasting service)
|
||||
k8s_resource('demo-seed-forecasts',
|
||||
resource_deps=['forecasting-migration', 'demo-seed-tenants'],
|
||||
labels=['demo-init'])
|
||||
|
||||
# =============================================================================
|
||||
# SERVICES
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user