diff --git a/infra/jobs/station/device-server.levant.nomad b/infra/jobs/station/device-server.levant.nomad index 5d4572eba6166a9f5ed5498c5f3680fc2bb61272..75a700a12cadde7da38c1f22e72a62d4f58edf60 100644 --- a/infra/jobs/station/device-server.levant.nomad +++ b/infra/jobs/station/device-server.levant.nomad @@ -92,6 +92,36 @@ job "device-servers" { } } + task "wait-for-db" { + lifecycle { + hook = "prestart" + sidecar = false + } + driver = "docker" + + config { + image = "[[.registry.astron.url]]/busybox:latest" + command = "sh" + args = ["-c", "while ! nc -z ${MYSQL_HOST} ${MYSQL_PORT}; do sleep 1; done"] + } + + template { + wait { + min = "30s" + max = "300s" + } + error_on_missing_key = true + data = <<EOH + {{- range service "tangodb" }} + MYSQL_HOST = "{{ .Address }}" + MYSQL_PORT = "{{ .Port }}" + {{- end }} + EOH + destination = "local/env.txt" + env = true + } + } + task "device-[[ $name ]]" { driver = "docker" diff --git a/infra/jobs/station/jupyter.levant.nomad b/infra/jobs/station/jupyter.levant.nomad index 5213a5b6e223b345674077e371f5b8bc3d2fd701..9134cb4d47debf387d251c15c70744b70703d5a0 100644 --- a/infra/jobs/station/jupyter.levant.nomad +++ b/infra/jobs/station/jupyter.levant.nomad @@ -3,6 +3,12 @@ job "jupyter" { datacenters = ["stat"] type = "service" + reschedule { + unlimited = true + delay = "60s" + delay_function = "constant" + } + group "jupyter-lab" { count = 1 diff --git a/infra/jobs/station/landing-page.levant.nomad b/infra/jobs/station/landing-page.levant.nomad index c24885db77f121158fcec532f24cc1c9c5351894..81de230e689bf305a6345bbaf70ba5222a7e0a73 100644 --- a/infra/jobs/station/landing-page.levant.nomad +++ b/infra/jobs/station/landing-page.levant.nomad @@ -3,6 +3,12 @@ job "landing-page" { datacenters = ["stat"] type = "service" + reschedule { + unlimited = true + delay = "60s" + delay_function = "constant" + } + group "web-server" { count = 1 diff --git a/infra/jobs/station/logging.levant.nomad b/infra/jobs/station/logging.levant.nomad index bad27a1010d381d0df9363508e7e692457300db5..e5db3aeb8493c85bfc3e30c52303d5146ccc69f0 100644 --- a/infra/jobs/station/logging.levant.nomad +++ b/infra/jobs/station/logging.levant.nomad @@ -7,6 +7,12 @@ job "log-scraping" { type = "service" [[ end ]] + reschedule { + unlimited = true + delay = "30s" + delay_function = "constant" + } + update { min_healthy_time = "10s" healthy_deadline = "5m" diff --git a/infra/jobs/station/monitoring.levant.nomad b/infra/jobs/station/monitoring.levant.nomad index 84290fb20ed9a8c83f626c36cc97d29151d7171b..e39c888cb08ebbedd937e4c2949ce7da6fa67274 100644 --- a/infra/jobs/station/monitoring.levant.nomad +++ b/infra/jobs/station/monitoring.levant.nomad @@ -3,6 +3,12 @@ job "monitoring" { datacenters = ["stat"] type = "service" + reschedule { + unlimited = true + delay = "60s" + delay_function = "constant" + } + group "postgres" { count = 1 diff --git a/infra/jobs/station/object-replication.levant.nomad b/infra/jobs/station/object-replication.levant.nomad index f538020e4ccd446352b708a77611ad04b844123f..d2d793e029aa78077801f0532cd8c3e84d04f7f5 100644 --- a/infra/jobs/station/object-replication.levant.nomad +++ b/infra/jobs/station/object-replication.levant.nomad @@ -6,6 +6,7 @@ job "object-replication" { cron = "*/5 * * * * *" prohibit_overlap = true } + group "batch" { count = 1 diff --git a/infra/jobs/station/object-storage.levant.nomad b/infra/jobs/station/object-storage.levant.nomad index c7c55538a28df346d0026417b3bc559d0f3a4919..aeedb81dfd4a6f58a4751d45902443a2e38c5b98 100644 --- a/infra/jobs/station/object-storage.levant.nomad +++ b/infra/jobs/station/object-storage.levant.nomad @@ -3,6 +3,12 @@ job "object-storage" { datacenters = ["stat"] type = "service" + reschedule { + unlimited = true + delay = "30s" + delay_function = "constant" + } + group "minio" { count = 1