Pārlūkot izejas kodu

feat: mount music directory in container

Fela Maslen 5 gadi atpakaļ
vecāks
revīzija
5b2b04c677
3 mainītis faili ar 18 papildinājumiem un 1 dzēšanām
  1. 1 1
      Jenkinsfile
  2. 1 0
      k8s/deploy.sh
  3. 16 0
      k8s/manifest.yml

+ 1 - 1
Jenkinsfile

@@ -56,7 +56,7 @@ node {
 
     stage('Deploy') {
       if (env.BRANCH_NAME == "master") {
-        sh './k8s/deploy.sh'
+        sh 'LIBRARY_DIRECTORY=/data/user/music/ogg ./k8s/deploy.sh'
       }
     }
   }

+ 1 - 0
k8s/deploy.sh

@@ -12,6 +12,7 @@ namespace="gmus"
 cat ./manifest.yml \
   | sed -e "s/docker\.fela\.space\/gmus-backend\:0/$(echo $IMAGE_BACKEND | sed -e 's/\//\\\//')/g" \
   | sed -e "s/docker\.fela\.space\/gmus-web\:0/$(echo $IMAGE_WEB | sed -e 's/\//\\\//')/g" \
+  | sed -e "s/LIBRARY_DIRECTORY/$(echo $LIBRARY_DIRECTORY | sed -e 's/\//\\\//g')/g" \
   > ./manifest_with_image.yml
 
 echo "Updating deployment..."

+ 16 - 0
k8s/manifest.yml

@@ -60,6 +60,10 @@ spec:
                 secretKeyRef:
                   name: postgres-pass
                   key: password
+          volumeMounts:
+            - name: gmus-library
+              mountPath: /music
+              readOnly: true
           livenessProbe:
             initialDelaySeconds: 5
             periodSeconds: 5
@@ -72,6 +76,10 @@ spec:
             httpGet:
               path: /readiness
               port: 8080
+      volumes:
+        - name: gmus-library
+          hostPath:
+            path: LIBRARY_DIRECTORY
 ---
 apiVersion: apps/v1
 kind: Deployment
@@ -269,4 +277,12 @@ spec:
                     secretKeyRef:
                       name: postgres-pass
                       key: password
+              volumeMounts:
+                - name: gmus-library
+                  mountPath: /music
+                  readOnly: true
           restartPolicy: Never
+          volumes:
+            - name: gmus-library
+              hostPath:
+                path: LIBRARY_DIRECTORY