2023-08-07 18:37:19 +00:00
|
|
|
module "diun" {
|
|
|
|
source = "./service"
|
|
|
|
|
|
|
|
name = "diun"
|
2024-04-17 17:46:28 +00:00
|
|
|
image = "crazymax/diun:4.27"
|
2023-08-07 18:37:19 +00:00
|
|
|
args = ["serve", "--log-level=debug"]
|
|
|
|
|
2023-09-28 04:34:14 +00:00
|
|
|
sticky_disk = true
|
|
|
|
|
2023-08-07 18:37:19 +00:00
|
|
|
env = {
|
2023-09-28 04:34:14 +00:00
|
|
|
DIUN_DB_PATH = "$${NOMAD_ALLOC_DIR}/data/diun.db"
|
2023-08-07 18:37:19 +00:00
|
|
|
DIUN_WATCH_SCHEDULE = "0 */6 * * *"
|
|
|
|
DIUN_PROVIDERS_NOMAD_WATCHBYDEFAULT = true
|
2023-09-28 04:33:55 +00:00
|
|
|
DIUN_DEFAULTS_WATCHREPO = true
|
|
|
|
DIUN_DEFAULTS_SORTTAGS = "semver"
|
2023-11-16 20:22:44 +00:00
|
|
|
DIUN_DEFAULTS_INCLUDETAGS = "^\\d+(\\.\\d+){0,2}$"
|
2023-08-07 18:37:19 +00:00
|
|
|
|
|
|
|
# Nomad API
|
2024-05-01 17:18:54 +00:00
|
|
|
NOMAD_ADDR = "unix:///secrets/api.sock"
|
|
|
|
DIUN_PROVIDERS_NOMAD = true
|
|
|
|
DIUN_PROVIDERS_NOMAD_SECRETID = "$${NOMAD_TOKEN}"
|
|
|
|
}
|
|
|
|
|
|
|
|
task_identity = {
|
|
|
|
env = true
|
2023-08-07 18:37:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
templates = [
|
|
|
|
{
|
|
|
|
data = <<EOF
|
|
|
|
{{ with nomadVar "nomad/jobs/diun" -}}
|
|
|
|
DIUN_NOTIF_SLACK_WEBHOOKURL={{ .slack_hook_url }}
|
|
|
|
{{- end }}
|
|
|
|
EOF
|
|
|
|
dest_prefix = "$${NOMAD_SECRETS_DIR}"
|
|
|
|
dest = "env"
|
|
|
|
env = true
|
|
|
|
mount = false
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
2024-05-01 17:18:54 +00:00
|
|
|
|
|
|
|
resource "nomad_acl_policy" "diun_query_jobs" {
|
|
|
|
name = "diun-query-jobs"
|
|
|
|
description = "Allow diun to query jobs"
|
|
|
|
rules_hcl = <<EOH
|
|
|
|
namespace "default" {
|
|
|
|
capabilities = ["list-jobs", "read-job"]
|
|
|
|
}
|
|
|
|
EOH
|
|
|
|
job_acl {
|
|
|
|
job_id = module.diun.job_id
|
|
|
|
}
|
|
|
|
}
|