immich/immich.nomad.hcl

147 lines
3.2 KiB
HCL

[[ $c := merge .immich . -]]
job [[ .immich.instance | toJSON ]] {
[[ template "common/job_start.tpl" . ]]
[[ $c := merge .immich.server . -]]
group "immich" {
network {
mode = "bridge"
}
volume "data" {
type = [[ .immich.volumes.data.type | toJSON ]]
source = [[ .immich.volumes.data.source | toJSON ]]
[[- if ne .immich.volumes.data.type "host" ]]
access_mode = "single-node-writer"
attachment_mode = "file-system"
[[- end ]]
}
# volume "ml" {
# type = [[ .immich.volumes.ml.type | toJSON ]]
# source = [[ .immich.volumes.ml.source | toJSON ]]
#[[- if ne .immich.volumes.ml.type "host" ]]
# access_mode = "single-node-writer"
# attachment_mode = "file-system"
#[[- end ]]
# }
# volume "typesense" {
# type = [[ .immich.volumes.typesense.type | toJSON ]]
# source = [[ .immich.volumes.typesense.source | toJSON ]]
#[[- if ne .immich.volumes.typesense.type "host" ]]
# access_mode = "single-node-writer"
# attachment_mode = "file-system"
#[[- end ]]
# }
service {
name = "[[ .immich.instance ]][[ .consul.suffix ]]"
port = 8080
[[ template "common/connect.tpl" $c ]]
tags = [
"[[ $c.traefik.instance ]].enable=[[ $c.traefik.enabled ]]"
]
}
[[ $c := merge .immich.server . -]]
task "server" {
driver = [[ $c.nomad.driver | toJSON ]]
leader = true
config {
image = [[ $c.image | toJSON ]]
#readonly_rootfs = true
command = "start.sh"
args = ["immich"]
}
vault {
policies = ["[[ .immich.instance ]][[ .consul.suffix ]]"]
env = false
disable_file = true
}
env {
REDIS_HOSTNAME = "localhost"
TYPESENSE_HOST = "localhost"
IMMICH_MEDIA_LOCATION = "/data"
TYPESENSE_ENABLED = "false"
}
[[ template "common/file_env.tpl" $c.env ]]
volume_mount {
volume = "data"
destination = "/data"
}
[[ template "common/resources.tpl" $c.resources ]]
}
[[ $c := merge .immich.microservices . ]]
task "microservices" {
driver = [[ $c.nomad.driver | toJSON ]]
config {
image = [[ $c.image | toJSON ]]
#readonly_rootfs = true
command = "start.sh"
args = ["microservices"]
}
vault {
policies = ["[[ .immich.instance ]][[ .consul.suffix ]]"]
env = false
disable_file = true
}
env {
REDIS_HOSTNAME = "localhost"
TYPESENSE_HOST = "localhost"
IMMICH_MEDIA_LOCATION = "/data"
TYPESENSE_ENABLED = "false"
}
[[ template "common/file_env.tpl" $c.env ]]
volume_mount {
volume = "data"
destination = "/data"
}
[[ template "common/resources.tpl" $c.resources ]]
}
#[[ $c := merge .immich.machine_learning . ]]
# task "machine-learning" {
# driver = [[ $c.nomad.driver | toJSON ]]
#
# config {
# image = [[ $c.image | toJSON ]]
# readonly_rootfs = true
# }
#
# env {
# MACHINE_LEARNING_HOST = "127.0.0.1"
# }
#
#
# volume_mount {
# volume = "ml"
# destination = "/cache"
# }
#
# }
[[ template "common/task.redis.tpl" ]]
}
}