2023-09-04 16:52:49 +00:00
|
|
|
|
|
|
|
job "ghostfolio" {
|
|
|
|
datacenters = ["homelab"]
|
|
|
|
priority = 50
|
|
|
|
type = "service"
|
|
|
|
meta {
|
|
|
|
forcedeploy = "0"
|
|
|
|
}
|
|
|
|
constraint {
|
|
|
|
attribute = "${attr.cpu.arch}"
|
|
|
|
value = "amd64"
|
|
|
|
}
|
|
|
|
|
|
|
|
group "main"{
|
|
|
|
network {
|
|
|
|
mode = "host"
|
|
|
|
port "http" {
|
|
|
|
}
|
|
|
|
port "redis" {
|
|
|
|
to = 6379
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vault{
|
|
|
|
policies= ["ghostfolio"]
|
|
|
|
|
|
|
|
}
|
|
|
|
task "redis" {
|
|
|
|
driver = "docker"
|
|
|
|
config {
|
|
|
|
image = "redis"
|
|
|
|
ports = ["redis"]
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
memory = 50
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
task "server" {
|
|
|
|
driver = "docker"
|
|
|
|
service {
|
|
|
|
name = "${NOMAD_JOB_NAME}"
|
|
|
|
port = "http"
|
|
|
|
tags = [
|
|
|
|
"traefik.enable=true",
|
|
|
|
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`${NOMAD_JOB_NAME}.ducamps.win`)",
|
|
|
|
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.win",
|
|
|
|
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
|
2023-10-07 16:40:40 +00:00
|
|
|
"traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure",
|
2023-09-04 16:52:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
}
|
|
|
|
config {
|
|
|
|
image = "ghostfolio/ghostfolio:latest"
|
|
|
|
ports = ["http"]
|
|
|
|
volumes = [
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
env {
|
|
|
|
NODE_ENV = "production"
|
|
|
|
REDIS_HOST= "${NOMAD_IP_redis}"
|
|
|
|
REDIS_PORT = "${NOMAD_HOST_PORT_redis}"
|
|
|
|
PORT = "${NOMAD_PORT_http}"
|
|
|
|
JWT_SECRET_KEY = uuidv4()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data= <<EOH
|
|
|
|
{{ with secret "secrets/data/database/ghostfolio"}}
|
2023-11-01 07:42:04 +00:00
|
|
|
DATABASE_URL = postgresql://ghostfolio:{{.Data.data.password}}@active.db.service.consul/ghostfolio?connect_timeout=300&sslmode=prefer
|
2023-09-04 16:52:49 +00:00
|
|
|
{{end}}
|
|
|
|
{{ with secret "secrets/data/nomad/ghostfolio"}}
|
|
|
|
ACCESS_TOKEN_SALT = {{.Data.data.token}}
|
|
|
|
{{end}}
|
|
|
|
EOH
|
|
|
|
destination = "secrets/ghostfolio.env"
|
|
|
|
env = true
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
memory = 400
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|