Fix DB issues

This commit is contained in:
Urtzi Alfaro
2025-09-30 13:32:51 +02:00
parent ec6bcb4c7d
commit 147893015e
51 changed files with 341 additions and 1032 deletions

13
bakery-ia-ca.crt Normal file
View File

@@ -0,0 +1,13 @@
-----BEGIN CERTIFICATE-----
MIIB9zCCAZ2gAwIBAgIRAI7sDPtvGTOEyP9+ob3PKD4wCgYIKoZIzj0EAwIwWzEL
MAkGA1UEBhMCVVMxEjAQBgNVBAoTCUJha2VyeSBJQTEbMBkGA1UECxMSQmFrZXJ5
IElBIExvY2FsIENBMRswGQYDVQQDExJiYWtlcnktaWEtbG9jYWwtY2EwHhcNMjUw
OTMwMTA1NTAyWhcNMjYwOTMwMTA1NTAyWjBbMQswCQYDVQQGEwJVUzESMBAGA1UE
ChMJQmFrZXJ5IElBMRswGQYDVQQLExJCYWtlcnkgSUEgTG9jYWwgQ0ExGzAZBgNV
BAMTEmJha2VyeS1pYS1sb2NhbC1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
BN1KZxIbllpM6asXLzkxmv58oIzEoqA6mnO/RsJTO3OupO6v2ndcP3QOVWAuaBZn
iKEe053LoVKiCI+Pa8UJ99ajQjBAMA4GA1UdDwEB/wQEAwICpDAPBgNVHRMBAf8E
BTADAQH/MB0GA1UdDgQWBBQinxdZ+q8nCCQ6a/hr2IJXqokLJDAKBggqhkjOPQQD
AgNIADBFAiA2ZRl4ohMOkVjcCWAOSHsAmlFsgow5Rn4A8nXtnv7fPwIhAIlsvohK
/exCO949h1xXK6FGyaNr40iXeFZkBeCy8oHW
-----END CERTIFICATE-----

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: alert-processor-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/alert-processor-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: alert-processor-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: alert-processor-db app.kubernetes.io/name: alert-processor-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: alert-processor-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: alert-processor-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: auth-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/auth-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: auth-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -127,20 +106,3 @@ spec:
selector: selector:
app.kubernetes.io/name: auth-db app.kubernetes.io/name: auth-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: auth-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: auth-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: external-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/external-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: external-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: external-db app.kubernetes.io/name: external-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: external-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: external-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: forecasting-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/forecasting-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: forecasting-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: forecasting-db app.kubernetes.io/name: forecasting-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: forecasting-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: forecasting-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: inventory-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/inventory-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: inventory-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: inventory-db app.kubernetes.io/name: inventory-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: inventory-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: inventory-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: notification-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/notification-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: notification-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: notification-db app.kubernetes.io/name: notification-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: notification-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: notification-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: orders-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/orders-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: orders-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: orders-db app.kubernetes.io/name: orders-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: orders-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: orders-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: pos-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/pos-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: pos-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: pos-db app.kubernetes.io/name: pos-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pos-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: pos-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: production-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/production-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: production-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: production-db app.kubernetes.io/name: production-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: production-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: production-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: recipes-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/recipes-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: recipes-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: recipes-db app.kubernetes.io/name: recipes-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: recipes-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: recipes-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: sales-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/sales-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: sales-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: sales-db app.kubernetes.io/name: sales-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sales-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: sales-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: suppliers-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/suppliers-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: suppliers-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: suppliers-db app.kubernetes.io/name: suppliers-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: suppliers-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: suppliers-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: tenant-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/tenant-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: tenant-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -127,20 +106,3 @@ spec:
selector: selector:
app.kubernetes.io/name: tenant-db app.kubernetes.io/name: tenant-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: tenant-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: tenant-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -1,19 +1,3 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: training-db-pv
labels:
app.kubernetes.io/component: database
app.kubernetes.io/part-of: bakery-ia
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/bakery-data/training-db"
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
@@ -79,11 +63,9 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 30 initialDelaySeconds: 30
timeoutSeconds: 5 timeoutSeconds: 5
periodSeconds: 10 periodSeconds: 10
@@ -91,19 +73,16 @@ spec:
readinessProbe: readinessProbe:
exec: exec:
command: command:
- pg_isready - sh
- -U - -c
- $(POSTGRES_USER) - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
- -d
- $(POSTGRES_DB)
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
periodSeconds: 5 periodSeconds: 5
failureThreshold: 3 failureThreshold: 3
volumes: volumes:
- name: postgres-data - name: postgres-data
persistentVolumeClaim: emptyDir: {}
claimName: training-db-pvc
- name: init-scripts - name: init-scripts
configMap: configMap:
name: postgres-init-config name: postgres-init-config
@@ -128,19 +107,3 @@ spec:
app.kubernetes.io/name: training-db app.kubernetes.io/name: training-db
app.kubernetes.io/component: database app.kubernetes.io/component: database
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: training-db-pvc
namespace: bakery-ia
labels:
app.kubernetes.io/name: training-db
app.kubernetes.io/component: database
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

View File

@@ -25,7 +25,7 @@ data:
ALERT_PROCESSOR_DB_USER: YWxlcnRfcHJvY2Vzc29yX3VzZXI= # alert_processor_user ALERT_PROCESSOR_DB_USER: YWxlcnRfcHJvY2Vzc29yX3VzZXI= # alert_processor_user
# Database Passwords (base64 encoded from .env) # Database Passwords (base64 encoded from .env)
AUTH_DB_PASSWORD: YXV0aF9wYXNzMTIz # auth_pass123 AUTH_DB_PASSWORD: YXV0aF9wYXNzMTIz # auth_pass123
TENANT_DB_PASSWORD: dGVuYW50X3Bhc3MxMjM= # tenant_pass123 TENANT_DB_PASSWORD: dGVuYW50X3Bhc3MxMjM= # tenant_pass123
TRAINING_DB_PASSWORD: dHJhaW5pbmdfcGFzczEyMw== # training_pass123 TRAINING_DB_PASSWORD: dHJhaW5pbmdfcGFzczEyMw== # training_pass123
FORECASTING_DB_PASSWORD: Zm9yZWNhc3RpbmdfcGFzczEyMw== # forecasting_pass123 FORECASTING_DB_PASSWORD: Zm9yZWNhc3RpbmdfcGFzczEyMw== # forecasting_pass123
@@ -40,6 +40,22 @@ data:
PRODUCTION_DB_PASSWORD: cHJvZHVjdGlvbl9wYXNzMTIz # production_pass123 PRODUCTION_DB_PASSWORD: cHJvZHVjdGlvbl9wYXNzMTIz # production_pass123
ALERT_PROCESSOR_DB_PASSWORD: YWxlcnRfcHJvY2Vzc29yX3Bhc3MxMjM= # alert_processor_pass123 ALERT_PROCESSOR_DB_PASSWORD: YWxlcnRfcHJvY2Vzc29yX3Bhc3MxMjM= # alert_processor_pass123
# Database URLs (base64 encoded)
AUTH_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vYXV0aF91c2VyOmF1dGhfcGFzczEyM0BhdXRoLWRiLXNlcnZpY2U6NTQzMi9hdXRoX2Ri # postgresql+asyncpg://auth_user:auth_pass123@auth-db-service:5432/auth_db
TENANT_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vdGVuYW50X3VzZXI6dGVuYW50X3Bhc3MxMjNAdGVuYW50LWRiLXNlcnZpY2U6NTQzMi90ZW5hbnRfZGIK # postgresql+asyncpg://tenant_user:tenant_pass123@tenant-db-service:5432/tenant_db
TRAINING_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vdHJhaW5pbmdfdXNlcjp0cmFpbmluZ19wYXNzMTIzQHRyYWluaW5nLWRiLXNlcnZpY2U6NTQzMi90cmFpbmluZ19kYg== # postgresql+asyncpg://training_user:training_pass123@training-db-service:5432/training_db
FORECASTING_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vZm9yZWNhc3RpbmdfdXNlcjpmb3JlY2FzdGluZ19wYXNzMTIzQGZvcmVjYXN0aW5nLWRiLXNlcnZpY2U6NTQzMi9mb3JlY2FzdGluZ19kYg== # postgresql+asyncpg://forecasting_user:forecasting_pass123@forecasting-db-service:5432/forecasting_db
SALES_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vc2FsZXNfdXNlcjpzYWxlc19wYXNzMTIzQHNhbGVzLWRiLXNlcnZpY2U6NTQzMi9zYWxlc19kYg== # postgresql+asyncpg://sales_user:sales_pass123@sales-db-service:5432/sales_db
EXTERNAL_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vZXh0ZXJuYWxfdXNlcjpleHRlcm5hbF9wYXNzMTIzQGV4dGVybmFsLWRiLXNlcnZpY2U6NTQzMi9leHRlcm5hbF9kYg== # postgresql+asyncpg://external_user:external_pass123@external-db-service:5432/external_db
NOTIFICATION_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vbm90aWZpY2F0aW9uX3VzZXI6bm90aWZpY2F0aW9uX3Bhc3MxMjNAbm90aWZpY2F0aW9uLWRiLXNlcnZpY2U6NTQzMi9ub3RpZmljYXRpb25fZGI= # postgresql+asyncpg://notification_user:notification_pass123@notification-db-service:5432/notification_db
INVENTORY_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vaW52ZW50b3J5X3VzZXI6aW52ZW50b3J5X3Bhc3MxMjNAaW52ZW50b3J5LWRiLXNlcnZpY2U6NTQzMi9pbnZlbnRvcnlfZGI= # postgresql+asyncpg://inventory_user:inventory_pass123@inventory-db-service:5432/inventory_db
RECIPES_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vcmVjaXBlc191c2VyOnJlY2lwZXNfcGFzczEyM0ByZWNpcGVzLWRiLXNlcnZpY2U6NTQzMi9yZWNpcGVzX2Ri # postgresql+asyncpg://recipes_user:recipes_pass123@recipes-db-service:5432/recipes_db
SUPPLIERS_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vc3VwcGxpZXJzX3VzZXI6c3VwcGxpZXJzX3Bhc3MxMjNAc3VwcGxpZXJzLWRiLXNlcnZpY2U6NTQzMi9zdXBwbGllcnNfZGI= # postgresql+asyncpg://suppliers_user:suppliers_pass123@suppliers-db-service:5432/suppliers_db
POS_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vcG9zX3VzZXI6cG9zX3Bhc3MxMjNAcG9zLWRiLXNlcnZpY2U6NTQzMi9wb3NfZGI= # postgresql+asyncpg://pos_user:pos_pass123@pos-db-service:5432/pos_db
ORDERS_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vb3JkZXJzX3VzZXI6b3JkZXJzX3Bhc3MxMjNAb3JkZXJzLWRiLXNlcnZpY2U6NTQzMi9vcmRlcnNfZGI= # postgresql+asyncpg://orders_user:orders_pass123@orders-db-service:5432/orders_db
PRODUCTION_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vcHJvZHVjdGlvbl91c2VyOnByb2R1Y3Rpb25fcGFzczEyM0Bwcm9kdWN0aW9uLWRiLXNlcnZpY2U6NTQzMi9wcm9kdWN0aW9uX2Ri # postgresql+asyncpg://production_user:production_pass123@production-db-service:5432/production_db
ALERT_PROCESSOR_DATABASE_URL: cG9zdGdyZXNxbCthc3luY3BnOi8vYWxlcnRfcHJvY2Vzc29yX3VzZXI6YWxlcnRfcHJvY2Vzc29yX3Bhc3MxMjNAYWxlcnQtcHJvY2Vzc29yLWRiLXNlcnZpY2U6NTQzMi9hbGVydF9wcm9jZXNzb3JfZGI= # postgresql+asyncpg://alert_processor_user:alert_processor_pass123@alert-processor-db-service:5432/alert_processor_db
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@@ -175,4 +191,4 @@ metadata:
app.kubernetes.io/component: notifications app.kubernetes.io/component: notifications
type: Opaque type: Opaque
data: data:
WHATSAPP_API_KEY: eW91ci13aGF0c2FwcC1hcGkta2V5LWhlcmU= # your-whatsapp-api-key-here WHATSAPP_API_KEY: eW91ci13aGF0c2FwcC1hcGkta2V5LWhlcmU= # your-whatsapp-api-key-here

View File

@@ -17,6 +17,13 @@ COPY shared/ /app/shared/
# Copy application code # Copy application code
COPY services/alert_processor/app/ /app/app/ COPY services/alert_processor/app/ /app/app/
# Copy migrations and alembic config
COPY services/alert_processor/migrations/ /app/migrations/
COPY services/alert_processor/alembic.ini /app/alembic.ini
# Copy scripts directory
COPY scripts/ /app/scripts/
# Create non-root user # Create non-root user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser USER appuser

View File

@@ -1 +1,15 @@
# services/alert_processor/app/models/__init__.py """
Alert Processor Service Models Package
Import all models to ensure they are registered with SQLAlchemy Base.
"""
# Import all models to register them with the Base metadata
from .alerts import Alert, AlertStatus, AlertSeverity
# List all models for easier access
__all__ = [
"Alert",
"AlertStatus",
"AlertSeverity",
]

View File

@@ -1,29 +0,0 @@
"""Initial alert-processor service tables
Revision ID: 001_initial_alert_processor
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_alert_processor'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for alert_processor service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for alert_processor service
pass

View File

@@ -1,29 +0,0 @@
"""Initial auth service tables
Revision ID: 001_initial_auth
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_auth'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for alert_processor service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for alert_processor service
pass

View File

@@ -20,6 +20,10 @@ COPY shared/ /app/shared/
# Copy application code # Copy application code
COPY services/external/app/ /app/app/ COPY services/external/app/ /app/app/
# Copy migrations and alembic config
COPY services/external/migrations/ /app/migrations/
COPY services/external/alembic.ini /app/alembic.ini
# Copy scripts directory # Copy scripts directory
COPY scripts/ /app/scripts/ COPY scripts/ /app/scripts/

View File

@@ -1,29 +0,0 @@
"""Initial external service tables
Revision ID: 001_initial_external
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_external'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for external service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for external service
pass

View File

@@ -26,6 +26,9 @@ COPY --from=shared /shared /app/shared
# Copy application code # Copy application code
COPY services/forecasting/ . COPY services/forecasting/ .
# Copy scripts directory
COPY scripts/ /app/scripts/
# Add shared libraries to Python path # Add shared libraries to Python path
ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}" ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}"

View File

@@ -0,0 +1,16 @@
"""
Forecasting Service Models Package
Import all models to ensure they are registered with SQLAlchemy Base.
"""
# Import all models to register them with the Base metadata
from .forecasts import Forecast
from .predictions import ModelPerformanceMetric, PredictionCache
# List all models for easier access
__all__ = [
"Forecast",
"ModelPerformanceMetric",
"PredictionCache",
]

View File

@@ -1,28 +0,0 @@
"""Initial forecasting service tables
Revision ID: 001_initial_forecasting
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_forecasting'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for forecasting service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for forecasting service
pass

View File

@@ -19,6 +19,10 @@ COPY shared/ /app/shared/
# Copy application code # Copy application code
COPY services/inventory/app/ /app/app/ COPY services/inventory/app/ /app/app/
# Copy migrations and alembic config
COPY services/inventory/migrations/ /app/migrations/
COPY services/inventory/alembic.ini /app/alembic.ini
# Copy scripts directory # Copy scripts directory
COPY scripts/ /app/scripts/ COPY scripts/ /app/scripts/

View File

@@ -1,28 +0,0 @@
"""Initial inventory service tables
Revision ID: 001_initial_inventory
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_inventory'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for inventory service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for inventory service
pass

View File

@@ -26,6 +26,9 @@ COPY --from=shared /shared /app/shared
# Copy application code # Copy application code
COPY services/notification/ . COPY services/notification/ .
# Copy scripts directory
COPY scripts/ /app/scripts/
# Add shared libraries to Python path # Add shared libraries to Python path
ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}" ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}"

View File

@@ -0,0 +1,31 @@
"""
Notification Service Models Package
Import all models to ensure they are registered with SQLAlchemy Base.
"""
# Import all models to register them with the Base metadata
from .notifications import (
Notification,
NotificationType,
NotificationStatus,
NotificationPriority,
NotificationPreference,
NotificationLog,
)
from .templates import (
EmailTemplate,
WhatsAppTemplate,
)
# List all models for easier access
__all__ = [
"Notification",
"NotificationType",
"NotificationStatus",
"NotificationPriority",
"NotificationPreference",
"NotificationLog",
"EmailTemplate",
"WhatsAppTemplate",
]

View File

@@ -1,29 +0,0 @@
"""Initial notification service tables
Revision ID: 001_initial_notification
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_notification'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for notification service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for notification service
pass

View File

@@ -18,6 +18,13 @@ COPY shared/ ./shared/
# Copy application code # Copy application code
COPY services/orders/app/ ./app/ COPY services/orders/app/ ./app/
# Copy migrations and alembic config
COPY services/orders/migrations/ /app/migrations/
COPY services/orders/alembic.ini /app/alembic.ini
# Copy scripts directory
COPY scripts/ ./scripts/
# Create logs directory # Create logs directory
RUN mkdir -p logs RUN mkdir -p logs

View File

@@ -110,7 +110,7 @@ async def test_procurement_scheduler():
else: else:
return {"error": "Scheduler service not available"} return {"error": "Scheduler service not available"}
except Exception as e: except Exception as e:
logger.error("Error testing procurement scheduler", error=str(e)) service.logger.error("Error testing procurement scheduler", error=str(e))
return {"error": f"Failed to trigger scheduler test: {str(e)}"} return {"error": f"Failed to trigger scheduler test: {str(e)}"}
@@ -118,17 +118,17 @@ async def test_procurement_scheduler():
async def logging_middleware(request: Request, call_next): async def logging_middleware(request: Request, call_next):
"""Add request logging middleware""" """Add request logging middleware"""
import time import time
start_time = time.time() start_time = time.time()
response = await call_next(request) response = await call_next(request)
process_time = time.time() - start_time process_time = time.time() - start_time
logger.info("HTTP request processed", service.logger.info("HTTP request processed",
method=request.method, method=request.method,
url=str(request.url), url=str(request.url),
status_code=response.status_code, status_code=response.status_code,
process_time=round(process_time, 4)) process_time=round(process_time, 4))
return response return response

View File

@@ -0,0 +1,21 @@
"""
Orders Service Models Package
Import all models to ensure they are registered with SQLAlchemy Base.
"""
# Import all models to register them with the Base metadata
from .customer import Customer, CustomerContact
from .order import CustomerOrder, OrderItem, OrderStatusHistory
from .procurement import ProcurementPlan, ProcurementRequirement
# List all models for easier access
__all__ = [
"Customer",
"CustomerContact",
"CustomerOrder",
"OrderItem",
"OrderStatusHistory",
"ProcurementPlan",
"ProcurementRequirement"
]

View File

@@ -1,29 +0,0 @@
"""Initial orders service tables
Revision ID: 001_initial_orders
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_orders'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for orders service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for orders service
pass

View File

@@ -15,6 +15,13 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY services/pos/app ./app COPY services/pos/app ./app
COPY shared ./shared COPY shared ./shared
# Copy migrations and alembic config
COPY services/pos/migrations/ /app/migrations/
COPY services/pos/alembic.ini /app/alembic.ini
# Copy scripts directory
COPY scripts ./scripts
# Create necessary directories # Create necessary directories
RUN mkdir -p logs RUN mkdir -p logs

View File

@@ -1,28 +0,0 @@
"""Initial POS service tables
Revision ID: 001_initial_pos
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_pos'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for POS service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for POS service
pass

View File

@@ -18,6 +18,13 @@ COPY shared/ ./shared/
# Copy application code # Copy application code
COPY services/production/app/ ./app/ COPY services/production/app/ ./app/
# Copy migrations and alembic config
COPY services/production/migrations/ /app/migrations/
COPY services/production/alembic.ini /app/alembic.ini
# Copy scripts directory
COPY scripts/ ./scripts/
# Create logs directory # Create logs directory
RUN mkdir -p logs RUN mkdir -p logs

View File

@@ -9,12 +9,26 @@ from .production import (
ProductionBatch, ProductionBatch,
ProductionSchedule, ProductionSchedule,
ProductionCapacity, ProductionCapacity,
QualityCheck QualityCheckTemplate,
QualityCheck,
Equipment,
ProductionStatus,
ProductionPriority,
EquipmentStatus,
ProcessStage,
EquipmentType,
) )
__all__ = [ __all__ = [
"ProductionBatch", "ProductionBatch",
"ProductionSchedule", "ProductionSchedule",
"ProductionCapacity", "ProductionCapacity",
"QualityCheck" "QualityCheckTemplate",
"QualityCheck",
"Equipment",
"ProductionStatus",
"ProductionPriority",
"EquipmentStatus",
"ProcessStage",
"EquipmentType",
] ]

View File

@@ -1,29 +0,0 @@
"""Initial production service tables
Revision ID: 001_initial_production
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_production'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for production service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for production service
pass

View File

@@ -18,6 +18,13 @@ COPY shared/ ./shared/
# Copy application code # Copy application code
COPY services/recipes/app/ ./app/ COPY services/recipes/app/ ./app/
# Copy migrations and alembic config
COPY services/recipes/migrations/ /app/migrations/
COPY services/recipes/alembic.ini /app/alembic.ini
# Copy scripts directory
COPY scripts/ ./scripts/
# Create logs directory # Create logs directory
RUN mkdir -p logs RUN mkdir -p logs

View File

@@ -1,29 +0,0 @@
"""Initial ecipes service tables
Revision ID: 001_initial_recipes
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_recipes'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for ecipes service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for ecipes service
pass

View File

@@ -19,6 +19,13 @@ COPY shared/ /app/shared/
# Copy application code # Copy application code
COPY services/sales/app/ /app/app/ COPY services/sales/app/ /app/app/
# Copy migrations and alembic config
COPY services/sales/migrations/ /app/migrations/
COPY services/sales/alembic.ini /app/alembic.ini
# Copy scripts directory
COPY scripts/ /app/scripts/
# Set Python path to include shared modules # Set Python path to include shared modules
ENV PYTHONPATH=/app ENV PYTHONPATH=/app

View File

@@ -1,29 +0,0 @@
"""Initial sales service tables
Revision ID: 001_initial_sales
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_sales'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for sales service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for sales service
pass

View File

@@ -19,6 +19,13 @@ COPY shared/ /app/shared/
# Copy application code # Copy application code
COPY services/suppliers/app/ /app/app/ COPY services/suppliers/app/ /app/app/
# Copy migrations and alembic config
COPY services/suppliers/migrations/ /app/migrations/
COPY services/suppliers/alembic.ini /app/alembic.ini
# Copy scripts directory
COPY scripts/ /app/scripts/
# Set Python path to include shared modules # Set Python path to include shared modules
ENV PYTHONPATH=/app ENV PYTHONPATH=/app

View File

@@ -1,29 +0,0 @@
"""Initial supplioers service tables
Revision ID: 001_initial_suppliers
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_suppliers'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for suppliers service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for suppliers service
pass

View File

@@ -26,6 +26,9 @@ COPY --from=shared /shared /app/shared
# Copy application code # Copy application code
COPY services/tenant/ . COPY services/tenant/ .
# Copy scripts directory
COPY scripts/ /app/scripts/
# Add shared libraries to Python path # Add shared libraries to Python path
ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}" ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}"

View File

@@ -0,0 +1,15 @@
"""
Tenant Service Models Package
Import all models to ensure they are registered with SQLAlchemy Base.
"""
# Import all models to register them with the Base metadata
from .tenants import Tenant, TenantMember, Subscription
# List all models for easier access
__all__ = [
"Tenant",
"TenantMember",
"Subscription",
]

View File

@@ -1,29 +0,0 @@
"""Initial tenant service tables
Revision ID: 001_initial_tenant
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_tenant'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for tenant service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for teannt service
pass

View File

@@ -26,6 +26,9 @@ COPY --from=shared /shared /app/shared
# Copy application code # Copy application code
COPY services/training/ . COPY services/training/ .
# Copy scripts directory
COPY scripts/ /app/scripts/
# Add shared libraries to Python path # Add shared libraries to Python path
ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}" ENV PYTHONPATH="/app:/app/shared:${PYTHONPATH:-}"

View File

@@ -0,0 +1,23 @@
"""
Training Service Models Package
Import all models to ensure they are registered with SQLAlchemy Base.
"""
# Import all models to register them with the Base metadata
from .training import (
TrainedModel,
ModelTrainingLog,
ModelPerformanceMetric,
TrainingJobQueue,
ModelArtifact,
)
# List all models for easier access
__all__ = [
"TrainedModel",
"ModelTrainingLog",
"ModelPerformanceMetric",
"TrainingJobQueue",
"ModelArtifact",
]

View File

@@ -1,29 +0,0 @@
"""Initial training service tables
Revision ID: 001_initial_training
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '001_initial_training'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# TODO: Add table creation statements for training service
# This is a placeholder migration - replace with actual table definitions
pass
def downgrade() -> None:
# TODO: Add table drop statements for training service
pass