{"id":6182,"date":"2022-08-23T13:33:29","date_gmt":"2022-08-23T04:33:29","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=6182"},"modified":"2022-08-23T13:44:42","modified_gmt":"2022-08-23T04:44:42","slug":"nomad-haproxy-job","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=6182","title":{"rendered":"Nomad haproxy job"},"content":{"rendered":"<h1>Nomad haproxy job<\/h1>\n<h2>job \ud30c\uc77c \uc0dd\uc131<\/h2>\n<pre><code class=\"language-nomad\">vi haproxy.nomad\n-----------------------------\njob &quot;haproxy&quot; {\n  datacenters = [&quot;dc1&quot;]\n  type = &quot;system&quot;         # \ubaa8\ub4e0 \ub178\ub4dc\uc5d0 \uc790\ub3d9\uc124\uce58\n\n  group &quot;haproxy&quot; {\n    count = 1\n\n    network {\n      port &quot;haproxy_ui&quot; {\n        static = 4936\n      }\n\n      port &quot;haproxy_exporter&quot; {}\n    }\n\n    task &quot;haproxy&quot; {\n      driver = &quot;docker&quot;\n\n      config {\n        image = &quot;haproxy:2.4.4&quot;\n        ports = [&quot;haproxy_ui&quot;]\n\n        auth_soft_fail = true\n\n        # host \ub85c \uc124\uc815\ud588\uc73c\ubbc0\ub85c 127.0.0.1 \ub294 \ud638\uc2a4\ud2b8\ub97c \uac00\ub974\ud0a8\ub2e4.\n        network_mode = &quot;host&quot;\n\n        volumes = [\n          &quot;local\/haproxy.cfg:\/usr\/local\/etc\/haproxy\/haproxy.cfg&quot;,\n          &quot;\/ssl\/:\/ssl\/&quot;,\n        ]\n      }\n\n      template {\n        data = &lt;&lt;EOF\nglobal\n   maxconn 8192\ndefaults\n   mode http\n   timeout client 10s\n   timeout connect 5s\n   timeout server 10s\n   timeout http-request 10s\n   option forwardfor\n\nfrontend stats\n   bind *:{{ env &quot;NOMAD_PORT_haproxy_ui&quot; }}\n   stats uri \/\n   stats show-legends\n   no log\n\nresolvers consul\n   nameserver consul 127.0.0.1:8600\n   accepted_payload_size 8192\n   hold valid 5s\nEOF\n\n        destination   = &quot;local\/haproxy.cfg&quot;\n        change_mode   = &quot;signal&quot;\n        change_signal = &quot;SIGUSR1&quot;\n      }\n\n      resources {\n        cpu    = 500\n        memory = 128\n      }\n\n      service {\n        name = &quot;haproxy-ui&quot;\n        port = &quot;haproxy_ui&quot;\n\n        check {\n          type     = &quot;http&quot;\n          path     = &quot;\/&quot;\n          interval = &quot;10s&quot;\n          timeout  = &quot;2s&quot;\n        }\n      }\n    }\n\n    task &quot;haproxy-exporter&quot; {\n      driver = &quot;docker&quot;\n\n      lifecycle {\n        hook    = &quot;prestart&quot;\n        sidecar = true\n      }\n\n      config {\n        image = &quot;prom\/haproxy-exporter:v0.10.0&quot;\n        ports = [&quot;haproxy_exporter&quot;]\n\n        network_mode = &quot;host&quot;\n        auth_soft_fail = true\n\n        args = [\n          &quot;--web.listen-address&quot;,\n          &quot;:${NOMAD_PORT_haproxy_exporter}&quot;,\n          &quot;--haproxy.scrape-uri&quot;,\n          &quot;http:\/\/${NOMAD_ADDR_haproxy_ui}\/?stats;csv&quot;,\n        ]\n      }\n\n      resources {\n        cpu    = 100\n        memory = 32\n      }\n\n      service {\n        name = &quot;haproxy-exporter&quot;\n        port = &quot;haproxy_exporter&quot;\n\n        check {\n          type     = &quot;http&quot;\n          path     = &quot;\/metrics&quot;\n          interval = &quot;10s&quot;\n          timeout  = &quot;2s&quot;\n        }\n      }\n    }\n  }\n}\n-----------------------------<\/code><\/pre>\n<h2>job \uc2e4\ud589<\/h2>\n<p>Nomad server \uc5d0 \uc811\uc18d\ud574\uc11c \uc2e4\ud589\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">nomad job run haproxy.nomad<\/code><\/pre>\n<p>http:\/\/&lt;\ub178\ub9c8\ub4dc \ud074\ub77c\uc774\uc5b8\ud2b8 \uc544\uc774\ud53c&gt;:4936\/ \uc5d0 \uc811\uc18d\ud558\uba74,<br \/>\n\uc2e4\ud589\uc0c1\ud0dc\ub97c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nomad haproxy job job \ud30c\uc77c \uc0dd\uc131 vi haproxy.nomad &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; job &quot;haproxy&quot; { datacenters = [&quot;dc1&quot;] type = &quot;system&quot; # \ubaa8\ub4e0 \ub178\ub4dc\uc5d0 \uc790\ub3d9\uc124\uce58 group &quot;haproxy&quot; { count = 1 network { port &quot;haproxy_ui&quot; { static = 4936 } port &quot;haproxy_exporter&quot; {} } task &quot;haproxy&quot; { driver = &quot;docker&quot; config { image = &quot;haproxy:2.4.4&quot; ports = [&quot;haproxy_ui&quot;]\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=6182\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-6182","post","type-post","status-publish","format-standard","hentry","category-nomad"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6182"}],"version-history":[{"count":3,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6182\/revisions"}],"predecessor-version":[{"id":6186,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6182\/revisions\/6186"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}