deploy_adguard/templates/docker-compose.yml.j2

108 lines
3.8 KiB
Plaintext
Raw Normal View History

2023-05-31 20:57:46 +00:00
---
version: '3.9'
services:
2023-05-31 21:40:58 +00:00
{% if deploy_adguard_virtual_ip['enable'] %}
keepalived:
image: ghcr.io/rmartin16/keepalived:latest
network_mode: host
healthcheck:
test: ["CMD-SHELL", "ip addr show dev {{ deploy_adguard_virtual_ip['interface'] }} | grep -q {{ deploy_adguard_virtual_ip['vip_addr'] }}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
2023-05-31 21:40:58 +00:00
environment:
INTERFACE: {{ deploy_adguard_virtual_ip['interface'] }}
VIRTUAL_IPS: {{ deploy_adguard_virtual_ip['vip_addr'] }}
STATE: "BACKUP"
cap_add:
- NET_ADMIN
2023-06-01 17:27:07 +00:00
{% endif %}
2023-05-31 20:57:46 +00:00
adguard:
image: adguard/adguardhome:latest
{% if deploy_adguard_virtual_ip['enable']%}
depends_on:
keepalived:
condition: service_healthy
{% endif %}
2023-05-31 20:57:46 +00:00
ports:
2023-06-04 21:02:16 +00:00
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}53:53/tcp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}53:53/udp"
2023-05-31 20:57:46 +00:00
{% if deploy_adguard_enable_admin_interface %}
- "{% if deploy_adguard_consul['enable'] %}127.0.0.1:{% endif %}80:80/tcp"
- "{% if deploy_adguard_consul['enable'] %}127.0.0.1:{% endif %}443:443/tcp"
2023-05-31 20:57:46 +00:00
- "3000:3000/tcp"
{% endif %}
{% if deploy_adguard_enable_dhcp %}
2023-06-04 21:02:16 +00:00
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}67:67/udp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}68:68/tcp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}68:68/udp"
2023-05-31 20:57:46 +00:00
{% endif %}
{% if deploy_adguard_enable_doh %}
- "{% if deploy_adguard_virtual_ip['enable'] %}{% endif %}443:443/udp"
2023-05-31 20:57:46 +00:00
{% endif %}
{% if deploy_adguard_enable_dot %}
- "{% if deploy_adguard_virtual_ip['enable'] %}{% endif %}853:853/tcp"
2023-05-31 20:57:46 +00:00
{% endif %}
{% if deploy_adguard_enable_doq %}
2023-06-04 21:02:16 +00:00
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}784:784/udp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}8853:8853/udp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}853:853/udp"
2023-05-31 20:57:46 +00:00
{% endif %}
{% if deploy_adguard_enable_dnscrypt %}
2023-06-04 21:02:16 +00:00
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}5443:5443/tcp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}5443:5443/udp"
2023-05-31 20:57:46 +00:00
{% endif %}
volumes:
- conf:/opt/adguardhome/conf
- data:/opt/adguardhome/work
networks:
- internal
{% if deploy_adguard_node_exporter['enable'] %}
2023-06-01 17:27:07 +00:00
node_exporter:
image: ebrianne/adguard-exporter:latest
depends_on:
- adguard
2023-06-02 13:25:56 +00:00
secrets:
- adguard_passw
2023-06-01 17:27:07 +00:00
environment:
2023-06-02 13:25:56 +00:00
adguard_protocol: {{ deploy_adguard_node_exporter['protocol'] }}
adguard_hostname: adguard
adguard_username: {{ deploy_adguard_node_exporter['username'] }}
adguard_password: /run/secrets/adguard_passw
adguard_port: {{ deploy_adguard_node_exporter['port'] }}
server_port: {{ deploy_adguard_node_exporter['exporter_port'] }}
interval: {{ deploy_adguard_node_exporter['interval'] }}
log_limit: {{ deploy_adguard_node_exporter['log_limit'] }}
password_from_file: true
2023-06-01 17:27:07 +00:00
ports:
- "9617:9617"
networks:
- internal
{% endif %}
2023-05-31 20:57:46 +00:00
networks:
internal:
driver: bridge
volumes:
conf:
driver_opts:
o: bind
device: {{ deploy_adguard_directory }}/conf
type: none
data:
driver_opts:
o: bind
device: {{ deploy_adguard_directory }}/data
2023-05-31 21:40:58 +00:00
type: none
2023-06-02 13:25:56 +00:00
{% if deploy_adguard_node_exporter['enable'] %}
2023-06-02 13:25:56 +00:00
secrets:
adguard_passw:
file: {{ deploy_adguard_directory }}/password
{% endif %}