Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- job "coupons-processing" {
- datacenters = ["dc1"]
- type = "system"
- update {
- max_parallel = 1
- min_healthy_time = "30s"
- healthy_deadline = "5m"
- auto_revert = true
- }
- group "processing" {
- task "processing" {
- driver = "docker"
- config {
- image = "artifactory.setmachine.ru:5000/coupon-processing/psql:localtest"
- auth {
- username = "admin"
- password = "tc324012"
- }
- port_map = {
- http = 8008,
- tcp = 5432
- }
- force_pull = true
- dns_servers = ["${NOMAD_IP_http}"]
- }
- env {
- "PATRONI_CONSUL_HOST"="${NOMAD_IP_http}:8500"
- "PATRONI_NAME"="dbnode_${NOMAD_IP_http}"
- "PATRONI_RESTAPI_CONNECT_ADDRESS"="${NOMAD_IP_http}:8008"
- "PATRONI_POSTGRESQL_CONNECT_ADDRESS"="${NOMAD_IP_http}:5432"
- }
- service {
- name = "dbnode"
- tags = ["dbnode"]
- port = "http"
- check {
- name = "alive"
- type = "tcp"
- interval = "10s"
- timeout = "2s"
- }
- }
- resources {
- cpu = 1000
- memory = 1500
- network {
- port "http" {
- static = "8008"
- },
- port "tcp" {
- static = "5432"
- }
- }
- }
- }
- task "haproxy" {
- driver = "docker"
- config {
- image = "haproxy:alpine"
- port_map = {
- http_5000 = 5000,
- http_5001 = 5001,
- http = 80
- }
- volumes = [
- "haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg"
- ]
- dns_servers = ["${NOMAD_IP_http}"]
- }
- template {
- data = <<EOH
- global
- maxconn 500
- defaults
- log global
- mode tcp
- retries 2
- timeout client 30m
- timeout connect 4s
- timeout server 30m
- timeout check 5s
- frontend f_master_postgresql
- bind *:5000
- default_backend b_master_postgresql
- frontend f_slave_postgresql
- bind *:5001
- default_backend b_replica_postgresql
- backend b_master_postgresql
- option httpchk OPTIONS /master
- http-check expect status 200
- default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
- {{range $i, $services := service "dbnode"}}
- server dbnode{{ $i | add 1 }} {{.Address}}:5432 maxconn 200 check port 8008{{ end }}
- backend b_replica_postgresql
- option httpchk OPTIONS /replica
- http-check expect status 200
- default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
- {{range $i, $services := service "dbnode"}}
- server dbnode{{ $i | add 1 }} {{.Address}}:5432 maxconn 200 check port 8008{{ end }}
- EOH
- destination = "haproxy.cfg"
- }
- service {
- name = "haproxy"
- tags = [ "global", "lb", "urlprefix-/haproxy" ]
- port = "http"
- check {
- name = "alive"
- type = "tcp"
- interval = "10s"
- timeout = "2s"
- }
- }
- resources {
- cpu = 1000
- memory = 1500
- network {
- port "http_5000" {
- static = "5000"
- },
- port "http_5001" {
- static = "5001"
- },
- port "http" {
- static = 80
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement