variable "postgres_image" { type = string default = "postgres:14" } variable "immich_tag" { type = string default = "release" } job "immich" { datacenters = ["dc1"] type = "service" group "immich" { count = 1 network { mode = "bridge" port "server" { host_network = "loopback" to = 3001 } port "microservices" { host_network = "loopback" to = 3001 } port "web" { host_network = "loopback" to = 3000 } port "proxy" { host_network = "loopback" to = 80 } } volume "immich-upload" { type = "host" read_only = false source = "immich-upload" } service { name = "immich" port = "proxy" connect { sidecar_service { proxy { local_service_port = 80 upstreams { destination_name = "redis" local_bind_port = 6379 } upstreams { destination_name = "postgres" local_bind_port = 5432 } } } sidecar_task { resources { cpu = 50 memory = 50 } } } tags = [ "traefik.enable=true", ] } task "immich-bootstrap" { driver = "docker" config { image = "${var.postgres_image}" args = [ "/bin/bash", "-c", "/usr/bin/psql --no-password -f ${NOMAD_SECRETS_DIR}/bootstrap.sql", ] } resources { cpu = 50 memory = 20 memory_max = 100 } vault { policies = [ "access-tables", "nomad-task", ] } env { PGHOST = "${NOMAD_UPSTREAM_IP_postgres}" PGPORT = "${NOMAD_UPSTREAM_PORT_postgres}" PGUSER = "root" } template { data = <