homelab-nomad/core/lldap.nomad

101 lines
2.1 KiB
Plaintext
Raw Normal View History

2022-07-27 22:57:28 +00:00
job "lldap" {
datacenters = ["dc1"]
type = "service"
group "lldap" {
network {
mode = "bridge"
port "web" {
host_network = "wesher"
to = 17170
2022-07-27 22:57:28 +00:00
}
port "ldap" {
host_network = "wesher"
to = 3890
2022-07-27 22:57:28 +00:00
}
}
volume "lldap-data" {
type = "host"
read_only = false
source = "lldap-data"
}
service {
name = "lldap"
provider = "nomad"
2022-07-27 22:57:28 +00:00
port = "ldap"
}
service {
name = "ldap-admin"
provider = "nomad"
2022-07-27 22:57:28 +00:00
port = "web"
tags = [
"traefik.enable=true",
"traefik.http.routers.ldap-admin.entryPoints=websecure",
]
}
task "lldap" {
driver = "docker"
volume_mount {
volume = "lldap-data"
destination = "/data"
read_only = false
}
config {
2022-11-15 23:54:00 +00:00
image = "nitnelave/lldap:v0.4"
2022-07-27 22:57:28 +00:00
ports = ["ldap", "web"]
args = ["run", "--config-file", "${NOMAD_SECRETS_DIR}/lldap_config.toml"]
2022-07-27 22:57:28 +00:00
}
2022-11-16 00:54:37 +00:00
env = {
"LLDAP_LDAP_PORT" = "${NOMAD_PORT_ldap}"
"LLDAP_HTTP_PORT" = "${NOMAD_PORT_web}"
}
2022-07-27 22:57:28 +00:00
template {
data = <<EOH
database_url = "sqlite:///data/users.db?mode=rwc"
key_file = "/data/private_key"
ldap_base_dn = "{{ with nomadVar "nomad/jobs" }}{{ .base_dn }}{{ end }}"
{{ with nomadVar "nomad/jobs/lldap" -}}
jwt_secret = "{{ .jwt_secret }}"
ldap_user_dn = "{{ .admin_user }}"
ldap_user_email = "{{ .admin_email }}"
ldap_user_pass = "{{ .admin_password }}"
{{- end }}
{{ with nomadVar "nomad/jobs" -}}
2022-07-27 22:57:28 +00:00
[smtp_options]
enable_password_reset = true
server = "{{ .smtp_server }}"
port = {{ .smtp_port }}
tls_required = {{ .smtp_tls.Value | toLower }}
user = "{{ .smtp_user }}"
password = "{{ .smtp_password }}"
2022-07-27 22:57:28 +00:00
{{ end -}}
{{ with nomadVar "nomad/jobs/lldap" -}}
from = "{{ .smtp_from }}"
reply_to = "{{ .smtp_reply_to }}"
2022-07-27 22:57:28 +00:00
{{ end -}}
EOH
destination = "${NOMAD_SECRETS_DIR}/lldap_config.toml"
2022-07-27 22:57:28 +00:00
change_mode = "restart"
}
resources {
cpu = 10
memory = 200
memory_max = 200
2022-07-27 22:57:28 +00:00
}
}
}
}