changeset 1:9dc67ae8b507

update
author drewp@bigasterisk.com
date Sat, 14 Jan 2023 18:18:35 -0800
parents 1e65c0f57ff6
children 781290b4a683
files deploy.yaml ingress.yaml initial_indexing.sh skaffold.yaml update.sh
diffstat 5 files changed, 98 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/deploy.yaml	Mon Dec 06 22:34:49 2021 -0800
+++ b/deploy.yaml	Sat Jan 14 18:18:35 2023 -0800
@@ -1,4 +1,3 @@
----
 apiVersion: v1
 kind: PersistentVolume
 metadata:
@@ -6,11 +5,12 @@
   labels: { type: local }
 spec:
   storageClassName: manual
-  hostPath: { path: "/opt/photoprism/storage" }
+  hostPath: { path: "/d4/photoprism" }
   capacity: { storage: 5Gi }
   accessModes: ["ReadWriteOnce"]
   persistentVolumeReclaimPolicy: Retain
   claimRef: { namespace: default, name: photoprism-storage }
+
 ---
 apiVersion: v1
 kind: PersistentVolume
@@ -19,11 +19,12 @@
   labels: { type: local }
 spec:
   storageClassName: manual
-  hostPath: { path: "/my/pic/phonecam" }
+  hostPath: { path: "/my/pic" }
   capacity: { storage: 5Gi }
   accessModes: ["ReadWriteOnce"]
   persistentVolumeReclaimPolicy: Retain
   claimRef: { namespace: default, name: photoprism-originals }
+
 ---
 apiVersion: v1
 kind: PersistentVolumeClaim
@@ -33,6 +34,7 @@
   volumeName: "photoprism-storage"
   accessModes: ["ReadWriteOnce"]
   resources: { requests: { storage: 5Gi } }
+
 ---
 apiVersion: v1
 kind: PersistentVolumeClaim
@@ -42,6 +44,7 @@
   volumeName: "photoprism-originals"
   accessModes: ["ReadWriteOnce"]
   resources: { requests: { storage: 5Gi } }
+
 ---
 apiVersion: apps/v1
 kind: Deployment
@@ -56,28 +59,72 @@
     metadata:
       labels:
         app: photoprism
+      annotations:
+        prometheus.io/scrape: "false"
     spec:
       volumes:
         - { name: photoprism-storage, persistentVolumeClaim: { claimName: photoprism-storage } }
         - { name: photoprism-originals, persistentVolumeClaim: { claimName: photoprism-originals } }
+        - { name: run-mysqld, emptyDir: {}}
       containers:
         - name: photoprism
-          image: photoprism/photoprism
+          # https://github.com/photoprism/photoprism/releases
+          image: docker.io/photoprism/photoprism:221118-jammy
           env:
             - { name: PHOTOPRISM_UPLOAD_NSFW, value: "true" }
             - { name: PHOTOPRISM_READONLY, value: "true" }
             - { name: PHOTOPRISM_LOG_LEVEL, value: "info" }
             - { name: PHOTOPRISM_SITE_URL, value: "https://bigasterisk.com/photoprism/" }
+            - { name: PHOTOPRISM_AUTH_MODE, value: "public" }
+            - { name: PHOTOPRISM_WORKERS, value: "4" }
+   
+            - { name: PHOTOPRISM_DISABLE_WEBDAV, value: "true" }
+            - { name: PHOTOPRISM_DISABLE_CLASSIFICATION, value: "true" }
+            - { name: PHOTOPRISM_DISABLE_RAW, value: "true" }
+            - { name: PHOTOPRISM_JPEG_SIZE, value: "720" }
+            - { name: PHOTOPRISM_THUMB_SIZE, value: "720" }
+   
+            - { name: PHOTOPRISM_DATABASE_DRIVER, value: "mysql" }
+            - { name: PHOTOPRISM_DATABASE_SERVER, value: "/run/mysqld/mysqld.sock" }
+            - { name: PHOTOPRISM_DATABASE_NAME, value: "photoprism" }
+            - { name: PHOTOPRISM_DATABASE_USER, value: "photoprism" }
+            - { name: PHOTOPRISM_DATABASE_PASSWORD, value: "insecure" }
+
           ports:
             - containerPort: 2342
           volumeMounts:
             - { name: photoprism-storage, mountPath: "/photoprism/storage" }
             - { name: photoprism-originals, mountPath: "/photoprism/originals" }
+            - { name: run-mysqld, mountPath: "/run/mysqld" }
           resources:
             limits:
               # tensorflow analysis goes to like 1200Mi
               memory: 2500Mi
-
+        - name: mariadb
+          image: docker.io/mariadb:10.10.2
+          securityContext:
+            runAsUser: 1000
+            # let https://github.com/MariaDB/mariadb-docker/blob/749c720c63306d1572849afc6ab1cfa02fd08338/10.8/docker-entrypoint.sh 
+            # do the startup. We could write to /etc/mysql/mariadb.conf.d if we really needed to config things.
+          # command: suggested from photoprism docs
+          #   - mysqld
+          #   - --innodb-buffer-pool-size=512M
+          #   - --transaction-isolation=READ-COMMITTED
+          #   - --character-set-server=utf8mb4
+          #   - --collation-server=utf8mb4_unicode_ci
+          #   - --max-connections=512
+          #   - --innodb-rollback-on-timeout=OFF
+          #   - --innodb-lock-wait-timeout=120
+          volumeMounts:
+            - { name: photoprism-storage, subPath: "mariadb", mountPath: "/var/lib/mysql" }
+            - { name: run-mysqld, mountPath: "/run/mysqld" }
+          env:
+            - { name: MARIADB_AUTO_UPGRADE, value: "1" }
+            - { name: MARIADB_INITDB_SKIP_TZINFO, value: "1" }
+            - { name: MARIADB_DATABASE, value: "photoprism" }
+            - { name: MARIADB_USER, value: "photoprism" }
+            - { name: MARIADB_PASSWORD, value: "insecure" }
+            - { name: MARIADB_ROOT_PASSWORD, value: "insecure" }
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
@@ -86,6 +133,7 @@
                   - key: "kubernetes.io/hostname"
                     operator: In
                     values: ["bang"]
+
 ---
 apiVersion: v1
 kind: Service
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ingress.yaml	Sat Jan 14 18:18:35 2023 -0800
@@ -0,0 +1,28 @@
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: photoprism
+  annotations:
+    cert-manager.io/cluster-issuer: letsencrypt-prod
+    ingress.pomerium.io/allow_public_unauthenticated_access: "false"
+    ingress.pomerium.io/pass_identity_headers: "true"
+    ingress.pomerium.io/preserve_host_header: "true"
+    ingress.pomerium.io/policy: |
+      allow:
+        or: 
+          - { email: { is: "drewpca@gmail.com" }}
+          - { email: { is: "kelsimp@gmail.com" }}
+    ingress.pomerium.io/prefix_rewrite: "/photoprism/"
+    ingress.pomerium.io/allow_websockets: "true"
+spec:
+  ingressClassName: pomerium
+  rules:
+    - host: "bigasterisk.com"
+      http:
+        paths:
+          - pathType: Prefix
+            path: /photoprism/
+            backend: { service: { name: photoprism, port: { number: 80 } } }
+  tls:
+    - hosts: [bigasterisk.com]
+      secretName: bigasterisk.com-tls
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/initial_indexing.sh	Sat Jan 14 18:18:35 2023 -0800
@@ -0,0 +1,7 @@
+#!/bin/zsh
+cd /my/pic/
+{
+for x (phonecam/{de,dn,ki,kt}*) {
+        print print `ls $x | wc -l` files\; kubectl exec -it -c photoprism deploy/photoprism -- photoprism index $x
+} 
+} | sort -n -k 1.6
\ No newline at end of file
--- a/skaffold.yaml	Mon Dec 06 22:34:49 2021 -0800
+++ b/skaffold.yaml	Sat Jan 14 18:18:35 2023 -0800
@@ -6,3 +6,4 @@
   kubectl:
     manifests:
     - deploy.yaml
+    - ingress.yaml
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/update.sh	Sat Jan 14 18:18:35 2023 -0800
@@ -0,0 +1,9 @@
+#!/bin/zsh
+
+date
+/my/pda/note10/copy_photos
+
+date
+kubectl exec -it deploy/photoprism -- photoprism index
+
+touch /my/pda/note10/photos_updated