From f23639e9240013fd94e563ae7416ac8d5e6cbd1c Mon Sep 17 00:00:00 2001
From: Steffen Illium <steffen.illium@gmail.com>
Date: Fri, 3 May 2024 10:43:03 +0200
Subject: [PATCH] adjustments

---
 apps/immich/deployment/kustomization.yaml    |  1 -
 apps/immich/deployment/machine-learning.yaml |  5 +++
 apps/immich/deployment/microservices.yaml    | 40 --------------------
 apps/immich/deployment/server.yaml           | 22 ++++++++++-
 apps/immich/service/kustomization.yaml       |  1 +
 apps/immich/service/machine-learning.yaml    | 13 +++++++
 apps/immich/service/server.yaml              |  5 ++-
 7 files changed, 44 insertions(+), 43 deletions(-)
 delete mode 100644 apps/immich/deployment/microservices.yaml
 create mode 100644 apps/immich/service/machine-learning.yaml

diff --git a/apps/immich/deployment/kustomization.yaml b/apps/immich/deployment/kustomization.yaml
index 256a77e..4c337c3 100644
--- a/apps/immich/deployment/kustomization.yaml
+++ b/apps/immich/deployment/kustomization.yaml
@@ -3,6 +3,5 @@ kind: Kustomization
 resources:
 - database.yaml
 - machine-learning.yaml
-- microservices.yaml
 - redis.yaml
 - server.yaml
diff --git a/apps/immich/deployment/machine-learning.yaml b/apps/immich/deployment/machine-learning.yaml
index 3809a03..dd83fc2 100644
--- a/apps/immich/deployment/machine-learning.yaml
+++ b/apps/immich/deployment/machine-learning.yaml
@@ -20,6 +20,11 @@ spec:
         - image: ghcr.io/immich-app/immich-machine-learning:release
           name: immich-machine-learning
           resources: {}
+          ports:
+            - name: http
+              containerPort: 3003
+              hostPort: 3003
+              protocol: TCP          
           volumeMounts:
             - mountPath: /cache
               name: model-cache
diff --git a/apps/immich/deployment/microservices.yaml b/apps/immich/deployment/microservices.yaml
deleted file mode 100644
index a7cfe18..0000000
--- a/apps/immich/deployment/microservices.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  labels:
-    app: microservices
-  name: microservices
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: microservices
-  strategy:
-    type: Recreate
-  template:
-    metadata:
-      labels:
-        app: microservices
-    spec:
-      containers:
-        - args:
-            - start.sh
-            - microservices
-          envFrom:
-            - secretRef:
-                name: immich-secret
-          image: ghcr.io/immich-app/immich-server:release
-          name: microservices
-          resources: {}
-          volumeMounts:
-            - mountPath: /usr/src/app/upload
-              name: photos
-              subPath: upload
-            - mountPath: /usr/src/app/external
-              name: photos
-      restartPolicy: Always
-      volumes:
-        - name: photos
-          nfs:
-            server: 192.168.178.4
-            path: /mnt/photos
\ No newline at end of file
diff --git a/apps/immich/deployment/server.yaml b/apps/immich/deployment/server.yaml
index 9610ff0..e4a0f59 100644
--- a/apps/immich/deployment/server.yaml
+++ b/apps/immich/deployment/server.yaml
@@ -17,6 +17,26 @@ spec:
         app: server
     spec:
       containers:
+        - args:
+            - start.sh
+            - microservices
+          envFrom:
+            - secretRef:
+                name: immich-secret
+          image: ghcr.io/immich-app/immich-server:release
+          name: microservices
+          ports:
+            - name: http
+              containerPort: 3002
+              hostPort: 3002
+              protocol: TCP
+          resources: {}
+          volumeMounts:
+            - mountPath: /usr/src/app/upload
+              name: photos
+              subPath: upload
+            - mountPath: /usr/src/app/external
+              name: photos
         - args:
             - start.sh
             - immich
@@ -43,4 +63,4 @@ spec:
           nfs:
             server: 192.168.178.4
             path: /mnt/photos
-            readOnly: true
\ No newline at end of file
+            readOnly: true
diff --git a/apps/immich/service/kustomization.yaml b/apps/immich/service/kustomization.yaml
index 02111a2..867e539 100644
--- a/apps/immich/service/kustomization.yaml
+++ b/apps/immich/service/kustomization.yaml
@@ -4,3 +4,4 @@ resources:
 - database.yaml
 - redis.yaml
 - server.yaml
+- machine-learning.yaml
\ No newline at end of file
diff --git a/apps/immich/service/machine-learning.yaml b/apps/immich/service/machine-learning.yaml
new file mode 100644
index 0000000..7eb4f49
--- /dev/null
+++ b/apps/immich/service/machine-learning.yaml
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: machine-learning
+  name: machine-learning
+spec:
+  ports:
+    - name: "http"
+      port: 3003
+      targetPort: 3003
+  selector:
+    app: machine-learning
\ No newline at end of file
diff --git a/apps/immich/service/server.yaml b/apps/immich/service/server.yaml
index c3a612d..6f663e9 100644
--- a/apps/immich/service/server.yaml
+++ b/apps/immich/service/server.yaml
@@ -7,7 +7,10 @@ metadata:
 spec:
   ports:
     - name: "http"
-      port: 2283
+      port: 3001
       targetPort: 3001
+    - name: "http"
+      port: 3002
+      targetPort: 3002
   selector:
     app: server
\ No newline at end of file