From 3a8cca53f3823b259e9cba0bb1b9e9bde2638f62 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Mon, 27 Feb 2023 11:51:28 -0800 Subject: [PATCH] Update photoprism and use new storage path --- ansible_playbooks/ansible_hosts.yml | 11 +++++++++++ services/backups/jobs/photoprism.hcl | 24 +++++++++++++----------- services/main.tf | 21 ++++++++++++++------- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/ansible_playbooks/ansible_hosts.yml b/ansible_playbooks/ansible_hosts.yml index 26add34..a4b448e 100644 --- a/ansible_playbooks/ansible_hosts.yml +++ b/ansible_playbooks/ansible_hosts.yml @@ -28,6 +28,11 @@ all: owner: "nobody" group: "bin" read_only: false + - name: photoprism-storage + path: /srv/volumes/moxy/photoprism-storage + owner: "nobody" + group: "bin" + read_only: false n2.thefij: nfs_mounts: - src: 10.50.250.2:/srv/volumes @@ -61,6 +66,12 @@ all: group: "bin" mode: "0755" read_only: false + - name: photoprism-storage + path: /srv/volumes/moxy/photoprism-storage + owner: "nobody" + group: "bin" + mode: "0755" + read_only: false # n3.thefij: # nomad_node_class: ingress # nomad_node_role: both diff --git a/services/backups/jobs/photoprism.hcl b/services/backups/jobs/photoprism.hcl index 266c0c2..6495069 100644 --- a/services/backups/jobs/photoprism.hcl +++ b/services/backups/jobs/photoprism.hcl @@ -12,8 +12,8 @@ job "photoprism" { } } - task "Backup database" { - mysql "Backup database" { + task "Dump database" { + mysql "Dump database" { hostname = env("MYSQL_HOST") port = env("MYSQL_PORT") database = "photoprism" @@ -24,16 +24,18 @@ job "photoprism" { } } - # NOTE: Right now the cache and sidecar files are stored in the task local - # storage and not in a volume that can be backed up. This was done to allow - # Photoprism to be moved between hosts. If this directory becomes large and - # costly to move between hosts or regenerate, then it may be worth putting it - # on a host volume so it can be backed up as well. Possibly once I get NFS - # shares running from the Proxmox host available to the VMs for faster shared - # storage. - backup { - paths = ["/local/photoprism"] + paths = [ + "/local/photoprism", + # NOTE: Right now the cache and sidecar files are stored in the task local + # storage and not in a volume that can be backed up. This was done to allow + # Photoprism to be moved between hosts. If this directory becomes large and + # costly to move between hosts or regenerate, then it may be worth putting it + # on a host volume so it can be backed up as well. Possibly once I get NFS + # shares running from the Proxmox host available to the VMs for faster shared + # storage. + "/data/moxy/photoprism-storage", + ] # Because path is absolute restore_opts { Target = "/" diff --git a/services/main.tf b/services/main.tf index fb26b1c..3f9facb 100644 --- a/services/main.tf +++ b/services/main.tf @@ -102,13 +102,15 @@ module "minitor" { module "photoprism_module" { source = "./service" - name = "photoprism" - image = "photoprism/photoprism:221105-jammy" - ingress = true - service_port = 2342 - sticky_disk = true - healthcheck_path = "/library/login" + name = "photoprism" + image = "photoprism/photoprism:221118-jammy" + image_pull_timeout = "10m" + ingress = true + service_port = 2342 + sticky_disk = true + healthcheck_path = "/library/login" env = { + PHOTOPRISM_DEBUG = true # UI PHOTOPRISM_SITE_CAPTION = "AI-Powered Photos App" PHOTOPRISM_SITE_DESCRIPTION = "Fijolek home photos" @@ -120,7 +122,7 @@ module "photoprism_module" { # Paths PHOTOPRISM_ORIGINALS_PATH = "/photoprism-media/Library" PHOTOPRISM_IMPORT_PATH = "/photoprism-media/Import" - PHOTOPRISM_STORAGE_PATH = "$${NOMAD_TASK_DIR}/storage" # Storage PATH for generated files like cache and index + PHOTOPRISM_STORAGE_PATH = "/photoprism-storage" # Storage PATH for generated files like cache and thumbnails # Unix permissions PHOTOPRISM_UID = 500 PHOTOPRISM_GID = 100 @@ -134,6 +136,11 @@ module "photoprism_module" { use_mysql = true use_vault = true host_volumes = [ + { + name = "photoprism-storage" + dest = "/photoprism-storage" + read_only = false + }, { name = "photoprism-media" dest = "/photoprism-media"