Fix DB issue 2s
This commit is contained in:
@@ -20,6 +20,39 @@ spec:
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for alert-processor database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
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!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start 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
|
||||
- name: wait-for-database
|
||||
image: busybox:1.36
|
||||
command:
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: auth-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for auth database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $AUTH_DB_HOST -p $AUTH_DB_PORT -U $AUTH_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: AUTH_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: AUTH_DB_HOST
|
||||
- name: AUTH_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: AUTH_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: AUTH_DB_USER
|
||||
containers:
|
||||
- name: auth-service
|
||||
image: bakery/auth-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: external-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for external database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $EXTERNAL_DB_HOST -p $EXTERNAL_DB_PORT -U $EXTERNAL_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: EXTERNAL_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: EXTERNAL_DB_HOST
|
||||
- name: EXTERNAL_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: EXTERNAL_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: EXTERNAL_DB_USER
|
||||
containers:
|
||||
- name: external-service
|
||||
image: bakery/external-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: forecasting-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for forecasting database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $FORECASTING_DB_HOST -p $FORECASTING_DB_PORT -U $FORECASTING_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: FORECASTING_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: FORECASTING_DB_HOST
|
||||
- name: FORECASTING_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: FORECASTING_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: FORECASTING_DB_USER
|
||||
containers:
|
||||
- name: forecasting-service
|
||||
image: bakery/forecasting-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: inventory-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for inventory database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $INVENTORY_DB_HOST -p $INVENTORY_DB_PORT -U $INVENTORY_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: INVENTORY_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: INVENTORY_DB_HOST
|
||||
- name: INVENTORY_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: INVENTORY_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: INVENTORY_DB_USER
|
||||
containers:
|
||||
- name: inventory-service
|
||||
image: bakery/inventory-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: notification-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for notification database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $NOTIFICATION_DB_HOST -p $NOTIFICATION_DB_PORT -U $NOTIFICATION_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: NOTIFICATION_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: NOTIFICATION_DB_HOST
|
||||
- name: NOTIFICATION_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: NOTIFICATION_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: NOTIFICATION_DB_USER
|
||||
containers:
|
||||
- name: notification-service
|
||||
image: bakery/notification-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: orders-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for orders database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $ORDERS_DB_HOST -p $ORDERS_DB_PORT -U $ORDERS_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: ORDERS_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: ORDERS_DB_HOST
|
||||
- name: ORDERS_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: ORDERS_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: ORDERS_DB_USER
|
||||
containers:
|
||||
- name: orders-service
|
||||
image: bakery/orders-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: pos-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for pos database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $POS_DB_HOST -p $POS_DB_PORT -U $POS_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: POS_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: POS_DB_HOST
|
||||
- name: POS_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: POS_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: POS_DB_USER
|
||||
containers:
|
||||
- name: pos-service
|
||||
image: bakery/pos-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: production-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for production database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $PRODUCTION_DB_HOST -p $PRODUCTION_DB_PORT -U $PRODUCTION_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: PRODUCTION_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: PRODUCTION_DB_HOST
|
||||
- name: PRODUCTION_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: PRODUCTION_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: PRODUCTION_DB_USER
|
||||
containers:
|
||||
- name: production-service
|
||||
image: bakery/production-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: recipes-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for recipes database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $RECIPES_DB_HOST -p $RECIPES_DB_PORT -U $RECIPES_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: RECIPES_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: RECIPES_DB_HOST
|
||||
- name: RECIPES_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: RECIPES_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: RECIPES_DB_USER
|
||||
containers:
|
||||
- name: recipes-service
|
||||
image: bakery/recipes-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: sales-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for sales database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $SALES_DB_HOST -p $SALES_DB_PORT -U $SALES_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: SALES_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: SALES_DB_HOST
|
||||
- name: SALES_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: SALES_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: SALES_DB_USER
|
||||
containers:
|
||||
- name: sales-service
|
||||
image: bakery/sales-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: suppliers-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for suppliers database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $SUPPLIERS_DB_HOST -p $SUPPLIERS_DB_PORT -U $SUPPLIERS_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: SUPPLIERS_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: SUPPLIERS_DB_HOST
|
||||
- name: SUPPLIERS_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: SUPPLIERS_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: SUPPLIERS_DB_USER
|
||||
containers:
|
||||
- name: suppliers-service
|
||||
image: bakery/suppliers-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: tenant-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for tenant database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $TENANT_DB_HOST -p $TENANT_DB_PORT -U $TENANT_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: TENANT_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: TENANT_DB_HOST
|
||||
- name: TENANT_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: TENANT_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: TENANT_DB_USER
|
||||
containers:
|
||||
- name: tenant-service
|
||||
image: bakery/tenant-service:latest
|
||||
|
||||
@@ -19,6 +19,40 @@ spec:
|
||||
app.kubernetes.io/name: training-service
|
||||
app.kubernetes.io/component: microservice
|
||||
spec:
|
||||
initContainers:
|
||||
- name: wait-for-migration
|
||||
image: postgres:15-alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
echo "Waiting for training database and migrations to be ready..."
|
||||
# Wait for database to be accessible
|
||||
until pg_isready -h $TRAINING_DB_HOST -p $TRAINING_DB_PORT -U $TRAINING_DB_USER; do
|
||||
echo "Database not ready yet, waiting..."
|
||||
sleep 2
|
||||
done
|
||||
echo "Database is ready!"
|
||||
# Give migrations extra time to complete after DB is ready
|
||||
echo "Waiting for migrations to complete..."
|
||||
sleep 10
|
||||
echo "Ready to start service"
|
||||
env:
|
||||
- name: TRAINING_DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: TRAINING_DB_HOST
|
||||
- name: TRAINING_DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: bakery-config
|
||||
key: DB_PORT
|
||||
- name: TRAINING_DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: database-secrets
|
||||
key: TRAINING_DB_USER
|
||||
containers:
|
||||
- name: training-service
|
||||
image: bakery/training-service:79c869aaa529b2aaf2bbe77d2a2506e3ebdaf2abac3c83505ddfad29f3dbf99e
|
||||
|
||||
Reference in New Issue
Block a user