updated haproxy state
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2024-03-22 10:10:29 +01:00
parent 54132a9baa
commit 668a7df8ae
3 changed files with 25 additions and 21 deletions

View File

@ -31,7 +31,7 @@ haproxy:
countries:
FR: OK
dbs:
- name: /var/lib/haproxy/geoip/GeoLite2-City.mmdb
GeoLite2-City.mmdb:
url: https://git.paulbsd.com/paulbsd/GeoLite.mmdb/releases/download/2023.03.26/GeoLite2-City.mmdb
lua_max_mem: 1024
peers:
@ -44,25 +44,29 @@ haproxy:
- scripts
- mods
- errors
geoip_dbs:
scripts:
- name: mods/haproxy.c
haproxy:
path: mods/haproxy.c
lib: true
- name: scripts/compile.lua
compile:
path: scripts/compile.lua
lib: true
- name: scripts/geoip.lua
geoip:
path: scripts/geoip.lua
lib: false
args:
- /var/lib/haproxy/geoip/GeoLite2-City.mmdb
- name: scripts/json.lua
json:
path: scripts/json.lua
lib: true
- name: scripts/collector.lua
scripts/collector.lua:
lib: false
#- name: scripts/weight.lua
# lib: false
# args:
# - 5
- name: scripts/state.lua
state:
path: scripts/state.lua
lib: false
args:
- 30

View File

@ -25,11 +25,11 @@ haproxy-config-{{ dir }}-dir:
- mode: "0700"
{% endfor %}
{% for file in haproxy.config.scripts %}
haproxy-script-{{ file.name }}:
{% for script, params in haproxy.config.scripts.items() %}
haproxy-script-{{ script }}:
file.managed:
- name: {{ haproxy.config.dir }}/{{ file.name }}
- source: salt://haproxy/{{ file.name }}
- name: {{ haproxy.config.dir }}/{{ params.path }}
- source: salt://haproxy/{{ params.path }}
- user: {{ haproxy.config.user }}
- group: {{ haproxy.config.group }}
- mode: "0600"
@ -37,11 +37,11 @@ haproxy-script-{{ file.name }}:
- service: haproxy-service
{% endfor %}
{% for file in haproxy.config.geoip.dbs %}
haproxy-geoip-{{ file.name }}:
{% for dbname, params in haproxy.config.geoip.dbs.items() %}
haproxy-geoip-{{ dbname }}:
file.managed:
- name: {{ file.name }}
- source: {{ file.url }}
- name: /var/lib/haproxy/geoip/{{ dbname }}
- source: {{ params.url }}
- skip_verify: True
- makedirs: True
- user: {{ haproxy.config.user }}

View File

@ -95,9 +95,9 @@ global
maxconn 1000
lua-prepend-path {{ haproxy.config.dir }}/mods/?.so cpath
lua-prepend-path {{ haproxy.config.dir }}/scripts/?.lua
{%- for script in haproxy.config.scripts %}
{%- if not script.lib and script.enabled|default(true) %}
lua-load {{ haproxy.config.dir }}/{{ script.name }} {% if "args" in script.keys() %}{{ script.args|join(" ") }}{% endif %}
{%- for script,params in haproxy.config.scripts.items() %}
{%- if not params.lib and params.enabled|default(true) %}
lua-load {{ haproxy.config.dir }}/{{ params.path }} {% if "args" in params.keys() %}{{ params.args|join(" ") }}{% endif %}
{%- endif %}
{%- endfor %}
{%- if haproxy.config.api.enable %}
@ -173,7 +173,7 @@ frontend fe_http from {{ haproxy.config.namespace }}
http-request return status 200 content-type text/html lf-string "host: %H\ndate: %[var(txn.httpdate)]\nsrchash: %[var(txn.srchash)]\n" if self_host path_info
{%- if haproxy.config.geoip.enabled %}
# GeoIP
## GeoIP
{{ geoip() }}
{%- endif %}
@ -230,7 +230,7 @@ frontend fe_https from {{ haproxy.config.namespace }}
http-request deny deny_status 429 if max_req_rate !internal
{%- if haproxy.config.geoip.enabled %}
# GeoIP
## GeoIP
{{ geoip() }}
{%- endif %}