ansible_playbooks/roles/waf_manual/templates/docker_compose_template.yml.j2
2026-02-24 11:30:35 +03:00

59 lines
3.8 KiB
Django/Jinja
Executable file

services:
ptaf-{{ app_config[app].TENANT_NAME }}-agent{{ '%03d' | format(item) }}:
image: '{{ docker_image }}'
restart: unless-stopped
shm_size: '1gb'
container_name: ptaf_{{ app_config[app].TENANT_NAME }}_{{ '%03d' | format(item) }}
hostname: ptaf_{{ app_config[app].TENANT_NAME }}_{{ '%03d' | format(item) }}
environment:
- CONNECTION_STRING={{ app_config[app].CONNECTION_STRING }}
- WORKER_PROCESSES={{ number_of_worker_processes }}
- WORKER_CONNECTIONS={{ number_of_worker_connections }}
- INCLUDE_CUSTOM_CONFIG=True
- PTAF_CONFIGURATOR_DISABLED=1
{% if app_config[app].FLUENT_BIT_NEED == true %}
- EVENT_SENDER_ENABLED=1
- EVENT_SENDER_HOST=172.17.0.1
- EVENT_SENDER_PORT={{ app_config[app].FLUENT_BIT_INPUT_PORT }}
- EVENT_SENDER_TIMEOUT=3
- EVENT_WEB_UI_URL=https://af.ptcloud.ru/events/attacks/%s/general/
{% endif %}
sysctls:
kernel.sem: "32000 1024000000 500 32000"
ports:
{% for i in range(app_config[app].SID_NUMBERS | length) %}
- 127.0.0.1:{{ finded_port | int + item - 1000 + i * ((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) }}:80/tcp
- 127.0.0.1:{{ finded_port | int + item + i * ((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) }}:443/tcp
{% endfor %}
{% if app_config[app].CUSTOM_CONFIG_ANGIE_NEED == true %}
{% for i in range(app_config[app].SID_NUMBERS_WITH_CUSTOM | length) %}
- 127.0.0.1:{{ finded_port | int + (((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) * (app_config[app].SID_NUMBERS | length) + (app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) + item - 1000 + (i - 1) * ((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) }}:80/tcp
- 127.0.0.1:{{ finded_port | int + (((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) * (app_config[app].SID_NUMBERS | length) + (app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) + item + (i - 1) * ((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) }}:443/tcp
{% endfor %}
{% endif %}
{% if app_config[app].CUSTOM_PORTS_NEED == true %}
{% if app_config[app].CUSTOM_CONFIG_ANGIE_NEED == false %}
{% for i in range(app_config[app].SID_NUMBERS_WITH_CUSTOM_PORTS | length) %}
- 127.0.0.1:{{ finded_port | int + (((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) * (app_config[app].SID_NUMBERS | length) + (app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) + item + (i - 1) * ((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) }}:{{ app_config[app].CUSTOM_PORTS[i] }}/tcp
{% endfor %}
{% else %}
{% for i in range(app_config[app].SID_NUMBERS_WITH_CUSTOM_PORTS | length) %}
- 127.0.0.1:{{ finded_port | int + (finded_port | int + (((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) * (app_config[app].SID_NUMBERS | length) + (app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10) + item + (i - 1) * ((app_config[app].CONTAINER_NUMBERS | int + 9) // 10 * 10)) }}:app_config[app].CUSTOM_PORTS[item]/tcp
{% endfor %}
{% endif %}
{% endif %}
volumes:
- /var/log/ptaf_nginx/{{ app_config[app].TENANT_NAME }}/ptaf-agent{{ '%03d' | format(item) }}:/var/log/nginx
- /home/install/conf/ptaf-nginx/{{ app_config[app].TENANT_NAME }}/ptaf-agent{{ '%03d' | format(item) }}/conf.d:/opt/ptaf/conf/conf.d
- /home/install/conf/ptaf-nginx/{{ app_config[app].TENANT_NAME }}/ptaf-agent{{ '%03d' | format(item) }}/nginx.conf:/opt/ptaf/conf/nginx.conf
- /home/install/conf/ptaf-nginx/{{ app_config[app].TENANT_NAME }}/ptaf-agent{{ '%03d' | format(item) }}/mime.types:/opt/ptaf/conf/mime.types
networks:
- ptaf-{{ app_config[app].TENANT_NAME }}-net
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
networks:
ptaf-{{ app_config[app].TENANT_NAME }}-net:
driver: bridge