resource "nomad_job" "immich" { jobspec = file("immich.nomad.hcl") } resource "postgresql_role" "immich" { name = "immich" password = data.sops_file.secrets.data["immich.database_pw"] login = true } resource "postgresql_database" "immich" { name = "immich" owner = postgresql_role.immich.name } resource "postgresql_extension" "immich_vchord" { name = "vchord" database = postgresql_database.immich.name create_cascade = true } resource "postgresql_extension" "immich_earthdistance" { name = "earthdistance" database = postgresql_database.immich.name create_cascade = true } resource "nomad_variable" "immich" { path = "nomad/jobs/immich" items = { database_pw = data.sops_file.secrets.data["immich.database_pw"] tailscale_oauthsecret = data.sops_file.secrets.data["tailscale.oauthsecret"] } } resource "nomad_csi_volume_registration" "unraid_appdata_immich" { #Note: Before chaning the definition of this volume you need to stop the jobs that are using it depends_on = [data.nomad_plugin.smb] plugin_id = "smb" volume_id = "unraid_appdata_immich" name = "unraid_appdata_immich" external_id = "unraid_appdata_immich" capability { access_mode = "single-node-writer" attachment_mode = "file-system" } context = { source = "//192.168.1.192/appdata" subDir = "immich" # Note: Needs to be manually created on the share } secrets = { "username" = "nomad" "password" = data.sops_file.secrets.data["unraid.nomad"] } } resource "nomad_csi_volume_registration" "unraid_media_photosvideos" { #Note: Before chaning the definition of this volume you need to stop the jobs that are using it depends_on = [data.nomad_plugin.smb] plugin_id = "smb" volume_id = "unraid_media_photosvideos" name = "unraid_media_photosvideos" external_id = "unraid_media_photosvideos" capability { access_mode = "single-node-writer" attachment_mode = "file-system" } context = { source = "//192.168.1.192/media" subDir = "Photos and Videos" # Note: Needs to be manually created on the share } secrets = { "username" = "nomad" "password" = data.sops_file.secrets.data["unraid.nomad"] } } resource "nomad_csi_volume_registration" "unraid_media_immich_encodedvideo" { #Note: Before chaning the definition of this volume you need to stop the jobs that are using it depends_on = [data.nomad_plugin.smb] plugin_id = "smb" volume_id = "unraid_media_immich_encodedvideo" name = "unraid_media_immich_encodedvideo" external_id = "unraid_media_immich_encodedvideo" capability { access_mode = "single-node-writer" attachment_mode = "file-system" } context = { source = "//192.168.1.192/media" subDir = "immich/encoded-video" # Note: Needs to be manually created on the share } secrets = { "username" = "nomad" "password" = data.sops_file.secrets.data["unraid.nomad"] } } resource "nomad_csi_volume_registration" "unraid_mediadump_photosvideos" { #Note: Before chaning the definition of this volume you need to stop the jobs that are using it depends_on = [data.nomad_plugin.smb] plugin_id = "smb" volume_id = "unraid_mediadump_photosvideos" name = "unraid_mediadump_photosvideos" external_id = "unraid_mediadump_photosvideos" capability { access_mode = "single-node-writer" attachment_mode = "file-system" } context = { source = "//192.168.1.192/media-dump" subDir = "Photos and Videos" # Note: Needs to be manually created on the share } secrets = { "username" = "nomad" "password" = data.sops_file.secrets.data["unraid.nomad"] } }