From f9883d54b1c631cb2db5e294bd1033c50eed9764 Mon Sep 17 00:00:00 2001 From: Sergey Yakubov <sergey.yakubov@desy.de> Date: Fri, 25 May 2018 17:35:37 +0200 Subject: [PATCH] start nginx --- config/nomad/nginx.conf | 22 +++++++++++++++ config/nomad/nginx.nmd | 57 +++++++++++++++++++++++++++++++++++++++ config/nomad/payload.json | 9 +++++++ 3 files changed, 88 insertions(+) create mode 100644 config/nomad/nginx.conf create mode 100644 config/nomad/nginx.nmd create mode 100644 config/nomad/payload.json diff --git a/config/nomad/nginx.conf b/config/nomad/nginx.conf new file mode 100644 index 000000000..357a7c157 --- /dev/null +++ b/config/nomad/nginx.conf @@ -0,0 +1,22 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { +# include mime.types; +# default_type application/octet-stream; + +# sendfile on; +# tcp_nopush on; + +# keepalive_timeout 0; +# keepalive_timeout 65; + server { + listen 8080; + location /discovery/ { + proxy_pass http://discovery.service.consul:5006/; + } + } +} diff --git a/config/nomad/nginx.nmd b/config/nomad/nginx.nmd new file mode 100644 index 000000000..097b74aa6 --- /dev/null +++ b/config/nomad/nginx.nmd @@ -0,0 +1,57 @@ +job "nginx" { + datacenters = ["dc1"] + + type = "service" + + update { + max_parallel = 1 + min_healthy_time = "10s" + healthy_deadline = "3m" + auto_revert = false + } + + group "nginx" { + count = 1 + + restart { + attempts = 2 + interval = "30m" + delay = "15s" + mode = "fail" + } + + task "nginx" { + driver = "docker" + + config { + image = "nginx:latest" + volumes = ["/home/yakubov/projects/asapo/config/nomad/nginx.conf:/etc/nginx/nginx.conf","local/:/logs" ] + network_mode = "host" + dns_servers = ["127.0.0.1"] + dns_search_domains=["consul"] + } + + resources { + cpu = 500 # 500 MHz + memory = 256 # 256MB + network { + mbits = 10 + port "nginx" { + static = 8080 + } + } + } + + service { + port = "nginx" + name = "nginx" + check { + name = "alive" + type = "tcp" + interval = "10s" + timeout = "2s" + } + } + } + } +} \ No newline at end of file diff --git a/config/nomad/payload.json b/config/nomad/payload.json new file mode 100644 index 000000000..ed49f9bbc --- /dev/null +++ b/config/nomad/payload.json @@ -0,0 +1,9 @@ +{ + "Name": "discovery", + "Address": "127.0.0.1", + "Port": 5006, + "Check": { + "HTTP": "http://localhost:5006/receivers", + "Interval": "15s" + } +} -- GitLab