job "grafana" { datacenters = ["dc1"] group "grafana" { count = 1 network { mode = "bridge" port "web" { %{~ if use_wesher ~} host_network = "wesher" %{~ endif ~} to = 3000 } } ephemeral_disk { migrate = true sticky = true } service { name = "grafana" provider = "nomad" port = "web" tags = [ "traefik.enable=true", "traefik.http.routers.grafana.entryPoints=websecure", ] } task "stunnel" { driver = "docker" lifecycle { hook = "prestart" sidecar = true } config { image = "iamthefij/stunnel:1.0.0" args = ["$${NOMAD_TASK_DIR}/stunnel.conf"] } resources { cpu = 100 memory = 100 } template { data = < "$LOG_FILE" exec 2>&1 GRAFANA_URL=http://127.0.0.1:3000 echo "Reload dashboards" curl -s -S --user admin:$GF_SECURITY_ADMIN_PASSWORD --request POST $GRAFANA_URL/api/admin/provisioning/dashboards/reload echo "Reload datasources" curl -s -S --user admin:$GF_SECURITY_ADMIN_PASSWORD --request POST $GRAFANA_URL/api/admin/provisioning/datasources/reload echo "Reload plugins" curl -s -S --user admin:$GF_SECURITY_ADMIN_PASSWORD --request POST $GRAFANA_URL/api/admin/provisioning/plugins/reload echo "Reload notifications" curl -s -S --user admin:$GF_SECURITY_ADMIN_PASSWORD --request POST $GRAFANA_URL/api/admin/provisioning/notifications/reload echo "Reload access-control" curl -s -S --user admin:$GF_SECURITY_ADMIN_PASSWORD --request POST $GRAFANA_URL/api/admin/provisioning/access-control/reload echo "Reload alerting" curl -s -S --user admin:$GF_SECURITY_ADMIN_PASSWORD --request POST $GRAFANA_URL/api/admin/provisioning/alerting/reload EOF change_mode = "noop" perms = "777" destination = "$${NOMAD_TASK_DIR}/reload_config.sh" } %{ for config_file in fileset(join("/", [module_path, "grafana"]), "**") ~} template { data = <