diff options
Diffstat (limited to 'roles/photos')
-rw-r--r-- | roles/photos/defaults/main.yaml | 9 | ||||
-rw-r--r-- | roles/photos/files/core/Chart.yaml | 6 | ||||
-rw-r--r-- | roles/photos/files/core/templates/ingress.yaml | 33 | ||||
-rw-r--r-- | roles/photos/files/core/templates/pv.yaml | 16 | ||||
-rw-r--r-- | roles/photos/files/core/templates/pvc.yaml | 14 | ||||
-rw-r--r-- | roles/photos/files/postgres/Chart.yaml | 6 | ||||
-rw-r--r-- | roles/photos/files/postgres/templates/database.yaml | 37 | ||||
-rw-r--r-- | roles/photos/files/postgres/templates/pv.yaml | 16 | ||||
-rw-r--r-- | roles/photos/files/postgres/templates/pvc.yaml | 14 | ||||
-rw-r--r-- | roles/photos/files/postgres/templates/service.yaml | 12 | ||||
-rw-r--r-- | roles/photos/tasks/main.yaml | 60 |
11 files changed, 223 insertions, 0 deletions
diff --git a/roles/photos/defaults/main.yaml b/roles/photos/defaults/main.yaml new file mode 100644 index 0000000..5c85766 --- /dev/null +++ b/roles/photos/defaults/main.yaml @@ -0,0 +1,9 @@ +immich: + version: v1.119.0 + postgres: + image: tensorchord/pgvecto-rs + user: postgres + nfs: + path: /mnt/nfs/k3s/immich/db +nfs: + path: /mnt/nfs/k3s/immich/data diff --git a/roles/photos/files/core/Chart.yaml b/roles/photos/files/core/Chart.yaml new file mode 100644 index 0000000..7cb306b --- /dev/null +++ b/roles/photos/files/core/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: immich-core +description: Core for immich +type: application + +version: 0.1.0 diff --git a/roles/photos/files/core/templates/ingress.yaml b/roles/photos/files/core/templates/ingress.yaml new file mode 100644 index 0000000..c883185 --- /dev/null +++ b/roles/photos/files/core/templates/ingress.yaml @@ -0,0 +1,33 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: immich + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" +spec: + ingressClassName: traefik + tls: + - hosts: + - photos.aadityadhruv.com + secretName: immich-tls + rules: + - host: photos.home + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: immich-server + port: + number: 2283 + - host: photos.aadityadhruv.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: immich-server + port: + number: 2283 diff --git a/roles/photos/files/core/templates/pv.yaml b/roles/photos/files/core/templates/pv.yaml new file mode 100644 index 0000000..cacdcf9 --- /dev/null +++ b/roles/photos/files/core/templates/pv.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: "immich-pv" + labels: + app: "immich-pv" +spec: + storageClassName: nfs + capacity: + storage: 200Gi + accessModes: + - ReadWriteMany + nfs: + server: {{ .Values.nfs.server }} + path: {{ .Values.nfs.path }} + readOnly: false diff --git a/roles/photos/files/core/templates/pvc.yaml b/roles/photos/files/core/templates/pvc.yaml new file mode 100644 index 0000000..6ce8f0c --- /dev/null +++ b/roles/photos/files/core/templates/pvc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: immich-pvc +spec: + storageClassName: nfs + accessModes: + - ReadWriteMany + resources: + requests: + storage: 200Gi + selector: + matchLabels: + app: "immich-pv" diff --git a/roles/photos/files/postgres/Chart.yaml b/roles/photos/files/postgres/Chart.yaml new file mode 100644 index 0000000..f64d74d --- /dev/null +++ b/roles/photos/files/postgres/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: pgvectors +description: Postgres chart with pgvector extension +type: application + +version: 0.1.0 diff --git a/roles/photos/files/postgres/templates/database.yaml b/roles/photos/files/postgres/templates/database.yaml new file mode 100644 index 0000000..098a410 --- /dev/null +++ b/roles/photos/files/postgres/templates/database.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "immich-postgres-deployment" + labels: + app: "immich-db" +spec: + replicas: 1 + selector: + matchLabels: + app: "immich-db" + template: + metadata: + labels: + app: "immich-db" + spec: + containers: + - name: immich-db + image: "{{ .Values.image }}:{{ .Values.version }}" + env: + - name: POSTGRES_USER + value: {{ .Values.user }} + - name: POSTGRES_DB + value: immich + - name: POSTGRES_PASSWORD + value: {{ .Values.password }} + - name: PGDATA + value: /var/lib/postgresql/data/_data + ports: + - containerPort: 5432 + volumeMounts: + - mountPath: "/var/lib/postgresql/data" + name: "immich-database-volume" + volumes: + - name: "immich-database-volume" + persistentVolumeClaim: + claimName: "immich-db-pvc" diff --git a/roles/photos/files/postgres/templates/pv.yaml b/roles/photos/files/postgres/templates/pv.yaml new file mode 100644 index 0000000..14b5aa2 --- /dev/null +++ b/roles/photos/files/postgres/templates/pv.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: "immich-db-pv" + labels: + app: "immich-db-pv" +spec: + storageClassName: nfs + capacity: + storage: 10Gi + accessModes: + - ReadWriteMany + nfs: + server: {{ .Values.nfs.server }} + path: {{ .Values.nfs.path }} + readOnly: false diff --git a/roles/photos/files/postgres/templates/pvc.yaml b/roles/photos/files/postgres/templates/pvc.yaml new file mode 100644 index 0000000..4b3aca7 --- /dev/null +++ b/roles/photos/files/postgres/templates/pvc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: immich-db-pvc +spec: + storageClassName: nfs + accessModes: + - ReadWriteMany + resources: + requests: + storage: 10Gi + selector: + matchLabels: + app: "immich-db-pv" diff --git a/roles/photos/files/postgres/templates/service.yaml b/roles/photos/files/postgres/templates/service.yaml new file mode 100644 index 0000000..8fb9a49 --- /dev/null +++ b/roles/photos/files/postgres/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: immich-db-service +spec: + type: ClusterIP + selector: + app: immich-db + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 diff --git a/roles/photos/tasks/main.yaml b/roles/photos/tasks/main.yaml new file mode 100644 index 0000000..1faca34 --- /dev/null +++ b/roles/photos/tasks/main.yaml @@ -0,0 +1,60 @@ +- name: Add Immich remote chart + kubernetes.core.helm_repository: + name: immich + repo_url: https://immich-app.github.io/immich-charts + delegate_to: localhost + run_once: true + +- name: Deploy Immich Postgres Chart + kubernetes.core.helm: + state: "{%- if immich.enabled -%} present {%- else -%} absent {%- endif -%}" + name: immich-postgres + chart_ref: "{{ lookup('env', 'PWD') }}/roles/photos/files/postgres" + values: + image: "{{ immich.postgres.image }}" + version: "{{ immich.postgres.version }}" + user: "{{ immich.postgres.user }}" + password: "{{ immich.postgres.password }}" + nfs: + server: "{{ nfs.server }}" + path: "{{ immich.postgres.nfs.path }}" + namespace: default + delegate_to: localhost + run_once: true + +- name: Deploy Immich Core + kubernetes.core.helm: + state: "{%- if immich.enabled -%} present {%- else -%} absent {%- endif -%}" + name: immich-core + chart_ref: "{{ lookup('env', 'PWD') }}/roles/photos/files/core" + values: + nfs: + server: "{{ nfs.server }}" + path: "{{ nfs.path }}" + namespace: default + delegate_to: localhost + run_once: true + + +- name: Deploy Immich + kubernetes.core.helm: + state: "{%- if immich.enabled -%} present {%- else -%} absent {%- endif -%}" + name: immich + chart_ref: immich/immich + values: + env: + DB_USERNAME: "{{ immich.postgres.user }}" + DB_PASSWORD: "{{ immich.postgres.password }}" + DB_DATABASE_NAME: immich + DB_HOSTNAME: immich-db-service + image: + tag: "{{ immich.version }}" + immich: + persistence: + library: + existingClaim: "immich-pvc" + redis: + enabled: true + namespace: default + delegate_to: localhost + run_once: true |