Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- job "gateway" {
- datacenters = ["dc1"]
- type = "system"
- update {
- max_parallel = 1
- min_healthy_time = "30s"
- healthy_deadline = "2m"
- auto_revert = true
- }
- group "gateway" {
- task "gateway" {
- driver = "docker"
- config {
- image = "artifactory.setmachine.ru:5000/haproxy:1.9.4"
- auth {
- username = "admin"
- password = "tc324012"
- }
- port_map = {
- http = 8090
- http_nonsecure = 9999
- stats = 3333
- }
- volumes = [
- "local/haproxy:/usr/local/etc/haproxy"
- ]
- }
- template {
- data = <<EOF
- {{ key "haproxy-key" }}
- EOF
- destination = "secrets/haproxy-key"
- change_mode = "signal"
- change_signal = "SIGHUP"
- }
- template {
- data = <<EOH
- global
- nbthread 4
- defaults
- timeout connect 5000
- timeout client 30000
- timeout server 30000
- option http-server-close
- frontend https
- mode http
- bind :8090 ssl crt /secrets/haproxy-key
- # Потом эти пути купонинга надо удалить. SLS-232
- acl deprecated_coupon_coupon_test path_beg /test-couponing/processing/coupons/coupon
- acl deprecated_coupon_category_test path_beg /test-couponing/processing/coupons/category
- acl deprecated_coupon_coupon_production path_beg /production-couponing/processing/coupons/coupon
- acl deprecated_coupon_category_production path_beg /production-couponing/processing/coupons/category
- # Переходные пути (удалить, когда на центруме пропишут новые пути /processing/couponing)
- acl middle_coupon_coupon_test path_beg /test-couponing/coupon
- acl middle_coupon_category_test path_beg /test-couponing/category
- acl middle_coupon_coupon_production path_beg /production-couponing/coupon
- acl middle_coupon_category_production path_beg /production-couponing/category
- # Новые пути купонинга SLS-232
- acl coupon_coupon_test path_beg /processing/test-couponing/coupon
- acl coupon_category_test path_beg /processing/test-couponing/category
- acl coupon_coupon_production path_beg /processing/couponing/coupon
- acl coupon_category_production path_beg /processing/couponing/category
- acl counters_restriction_processing path_beg /processing/restrictions
- # Старый путь сегментов надо удалить SLS-232
- acl deprecated_segments_processing path_beg /processing/segments
- # Новый путь сегментов SLS-232
- acl segments_processing path_beg /processing/segmentation
- # Потом эти пути купонинга надо удалить. SLS-232
- use_backend deprecated-coupon-coupon-test if deprecated_coupon_coupon_test
- use_backend deprecated-coupon-category-test if deprecated_coupon_category_test
- use_backend deprecated-coupon-coupon-production if deprecated_coupon_coupon_production
- use_backend deprecated-coupon-category-production if deprecated_coupon_category_production
- # Переходные пути (удалить, когда на центруме пропишут новые пути /processing/couponing)
- use_backend middle-coupon-coupon-production if middle_coupon_coupon_production
- use_backend middle-coupon-category-production if middle_coupon_category_production
- use_backend middle-coupon-coupon-test if middle_coupon_coupon_test
- use_backend middle-coupon-category-test if middle_coupon_category_test
- # Новые пути купонинга SLS-232
- use_backend coupon-coupon-test if coupon_coupon_test
- use_backend coupon-category-test if coupon_category_test
- use_backend coupon-coupon-production if coupon_coupon_production
- use_backend coupon-category-production if coupon_category_production
- use_backend counters-restriction-processing if counters_restriction_processing
- use_backend segments-processing if segments_processing
- use_backend deprecated-segments-processing if deprecated_segments_processing
- frontend http
- mode http
- bind :9999
- # Потом эти пути купонинга надо удалить. SLS-232
- acl deprecated_coupon_coupon_test path_beg /test-couponing/processing/coupons/coupon
- acl deprecated_coupon_category_test path_beg /test-couponing/processing/coupons/category
- acl deprecated_coupon_coupon_production path_beg /production-couponing/processing/coupons/coupon
- acl deprecated_coupon_category_production path_beg /production-couponing/processing/coupons/category
- # Переходные пути (удалить, когда на центруме пропишут новые пути /processing/couponing)
- acl middle_coupon_coupon_test path_beg /test-couponing/coupon
- acl middle_coupon_category_test path_beg /test-couponing/category
- acl middle_coupon_coupon_production path_beg /production-couponing/coupon
- acl middle_coupon_category_production path_beg /production-couponing/category
- # Новые пути купонинга SLS-232
- acl coupon_coupon_test path_beg /processing/test-couponing/coupon
- acl coupon_category_test path_beg /processing/test-couponing/category
- acl coupon_coupon_production path_beg /processing/couponing/coupon
- acl coupon_category_production path_beg /processing/couponing/category
- acl counters_restriction_processing path_beg /processing/restrictions
- # Старый путь сегментов надо удалить SLS-232
- acl deprecated_segments_processing path_beg /processing/segments
- # Новый путь сегментов SLS-232
- acl segments_processing path_beg /processing/segmentation
- # Потом эти пути купонинга надо удалить. SLS-232
- use_backend deprecated-coupon-coupon-test if deprecated_coupon_coupon_test
- use_backend deprecated-coupon-category-test if deprecated_coupon_category_test
- use_backend deprecated-coupon-coupon-production if deprecated_coupon_coupon_production
- use_backend deprecated-coupon-category-production if deprecated_coupon_category_production
- # Переходные пути (удалить, когда на центруме пропишут новые пути /processing/couponing)
- use_backend middle-coupon-coupon-production if middle_coupon_coupon_production
- use_backend middle-coupon-category-production if middle_coupon_category_production
- use_backend middle-coupon-coupon-test if middle_coupon_coupon_test
- use_backend middle-coupon-category-test if middle_coupon_category_test
- # Новые пути купонинга SLS-232
- use_backend coupon-coupon-test if coupon_coupon_test
- use_backend coupon-category-test if coupon_category_test
- use_backend coupon-coupon-production if coupon_coupon_production
- use_backend coupon-category-production if coupon_category_production
- use_backend counters-restriction-processing if counters_restriction_processing
- use_backend segments-processing if segments_processing
- use_backend deprecated-segments-processing if deprecated_segments_processing
- # Потом эти пути купонинга надо удалить. SLS-232
- backend deprecated-coupon-coupon-test
- mode http
- reqrep ^([^\ ]*\ /)test-couponing\/processing\/coupons\/coupon[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-test-coupon-coupon"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend deprecated-coupon-category-test
- mode http
- reqrep ^([^\ ]*\ /)test-couponing\/processing\/coupons\/category[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-test-category-category"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend deprecated-coupon-coupon-production
- mode http
- reqrep ^([^\ ]*\ /)production-couponing\/processing\/coupons\/coupon[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-production-coupon-coupon"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend deprecated-coupon-category-production
- mode http
- reqrep ^([^\ ]*\ /)production-couponing\/processing\/coupons\/category[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-production-category-category"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- # Переходные пути (удалить, когда на центруме пропишут новые пути /processing/couponing)
- backend middle-coupon-coupon-test
- mode http
- reqrep ^([^\ ]*\ /)test-couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-test-coupon-coupon"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend middle-coupon-category-test
- mode http
- reqrep ^([^\ ]*\ /)test-couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-test-category-category"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend middle-coupon-coupon-production
- mode http
- reqrep ^([^\ ]*\ /)production-couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-production-coupon-coupon"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend middle-coupon-category-production
- mode http
- reqrep ^([^\ ]*\ /)production-couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-production-category-category"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- # Новые пути купонинга SLS-232
- backend coupon-coupon-test
- mode http
- reqrep ^([^\ ]*\ /)processing\/test-couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-test-coupon-coupon"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend coupon-category-test
- mode http
- reqrep ^([^\ ]*\ /)processing\/test-couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-test-category-category"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend coupon-coupon-production
- mode http
- reqrep ^([^\ ]*\ /)processing\/couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-production-coupon-coupon"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend coupon-category-production
- mode http
- reqrep ^([^\ ]*\ /)processing\/couponing[/]?(.*) \1\2
- balance roundrobin{{range service "coupons-production-category-category"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- # Процессинг ограничений
- backend counters-restriction-processing
- mode http
- reqrep ^([^\ ]*\ /)processing\/restrictions[/]?(.*) \1\2
- balance roundrobin{{range service "counters-restriction-processing"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- # Процессинг сегментов
- backend deprecated-segments-processing
- mode http
- balance roundrobin{{range service "segments-proxy"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- backend segments-processing
- mode http
- reqrep ^([^\ ]*\ /)processing\/segmentation[/]?(.*) \1\2
- balance roundrobin{{range service "segments-proxy"}}
- server {{.Node}}-{{.Port}} {{.Address}}:{{.Port}}{{end}}
- listen stats
- bind :3333
- mode http
- stats enable
- stats hide-version
- stats realm Haproxy\ Statistics
- stats uri /stats
- stats auth admin:324012
- EOH
- destination = "local/haproxy/haproxy.cfg"
- change_mode = "signal"
- change_signal = "SIGHUP"
- }
- resources {
- cpu = 1000
- memory = 100
- network {
- port "http" {
- static = "8090"
- }
- port "http_nonsecure" {
- static = "9999"
- }
- port "stats" {
- static = "3333"
- }
- }
- }
- }
- task "haproxy-exporter" {
- driver = "docker"
- config {
- image = "artifactory.setmachine.ru:5000/haproxy-exporter:0.10.0"
- auth {
- username = "admin"
- password = "tc324012"
- }
- args = [
- "--haproxy.scrape-uri", "http://admin:324012@${NOMAD_ADDR_gateway_stats}/stats;csv"
- ]
- port_map = {
- metrics = 9101
- }
- }
- service {
- port = "metrics"
- address_mode = "host"
- check {
- type = "http"
- interval = "5s"
- timeout = "2s"
- path = "/up"
- check_restart {
- limit = 1
- grace = "30s"
- }
- }
- }
- resources {
- cpu = 100
- memory = 20
- network {
- port "metrics" {}
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement