infra/nomad/wallabag.nomad

89 lines
2.4 KiB
HCL

job "wallabag" {
datacenters = ["columbia"]
region = "global"
type = "service"
update {
stagger = "30s"
max_parallel = 1
}
group "wallabag" {
count = 1
task "wallabag" {
vault {
policies = ["default", "ansible"]
change_mode = "restart"
}
driver = "docker"
config {
image = "docker-repo.service.masked.name:5000/wallabag"
ports = ["http"]
}
service {
name = "wallabag"
port = "http"
check {
name = "wallabag"
type = "tcp"
interval = "10s"
timeout = "2s"
address_mode = "driver"
}
}
template {
data = <<EOH
{{- with secret "pki_int/issue/masked-dot-name" "common_name=wallabag.service.masked.name" "alt_names=wallabag.service.columbia.masked.name" -}}
{{- .Data.certificate -}}
{{- end -}}
EOH
destination = "${NOMAD_SECRETS_DIR}/wallabag.crt"
change_mode = "restart"
}
template {
data = <<EOH
{{- with secret "pki_int/issue/masked-dot-name" "common_name=wallabag.service.masked.name" "alt_names=wallabag.service.columbia.masked.name" -}}
{{- .Data.private_key -}}
{{- end -}}
EOH
destination = "${NOMAD_SECRETS_DIR}/wallabag.key"
change_mode = "restart"
}
template {
data = <<EOH
POSTGRES_USER = wallabag
POSTGRES_PASSWORD = "{{ with secret "kv/data/wallabag" }}{{ .Data.data.db_pw }}{{ end }}"
SYMFONY__ENV__DATABASE_DRIVER = pdo_pgsql
SYMFONY__ENV__DATABASE_HOST = ivyking.node.masked.name
SYMFONY__ENV__DATABASE_PORT = 5432
SYMFONY__ENV__DATABASE_NAME = wallabag
SYMFONY__ENV__DATABASE_USER = wallabag
SYMFONY__ENV__DATABASE_PASSWORD = "{{ with secret "kv/data/wallabag" }}{{ .Data.data.db_pw }}{{ end }}"
SYMFONY__ENV__DOMAIN_NAME = "https://wallabag.minhas.io"
POPULATE_DATABASE = False
EOH
destination = "secrets/wallabag.env"
env = true
}
resources {
cpu = 2000
memory = 256
}
}
network {
port "http" {
to = 80
}
}
}
}