there is a weird bug with adguard in docker, needs investigation

This commit is contained in:
Bertrand Lanson 2023-06-04 01:02:00 +02:00
parent 529bcc3a20
commit 674fabd392
6 changed files with 63 additions and 1 deletions

View File

@ -18,3 +18,10 @@
listen: "systemctl-restart-adguard" listen: "systemctl-restart-adguard"
throttle: 1 throttle: 1
when: deploy_adguard_start_service when: deploy_adguard_start_service
- name: "Enable adguard-connect-proxy service"
ansible.builtin.service:
name: adguard-connect-proxy
enabled: true
state: restarted
listen: "systemctl-enable-restart-adguard-connect-proxy"

41
tasks/consul_service.yml Normal file
View File

@ -0,0 +1,41 @@
---
# task/consul_service file for deploy_adguard
- name: "Copy adguard.consul.json file"
ansible.builtin.template:
src: "adguard.consul.json.j2"
dest: "{{ deploy_adguard_directory }}/adguard.consul.json"
owner: root
group: root
mode: '0644'
register: _copy_service_template
- name: "Register/Update consul service"
ansible.builtin.command: "consul services register {{ deploy_adguard_directory }}/adguard.consul.json"
environment:
CONSUL_HTTP_ADDR: "{{ deploy_adguard_consul['consul_addr'] }}"
CONSUL_HTTP_TOKEN: "{{ deploy_adguard_consul['consul_token'] }}"
when: _copy_service_template.changed
- name: "Configure service mesh proxy"
when: deploy_adguard_consul['configuration']['service']['connect'] is defined
block:
- name: "Copy adguard-connect-proxy.env file"
ansible.builtin.template:
src: "adguard-connect-proxy.env.j2"
dest: "{{ deploy_adguard_directory }}/adguard-connect-proxy.env"
owner: root
group: root
mode: '0644'
notify:
- "systemctl-enable-restart-adguard-connect-proxy"
- name: "Copy adguard-connect-proxy.service file"
ansible.builtin.template:
src: "adguard-connect-proxy.service.j2"
dest: "/etc/systemd/system/adguard-connect-proxy.service"
owner: root
group: root
mode: '0644'
notify:
- "systemctl-daemon-reload"
- "systemctl-enable-restart-adguard-connect-proxy"

View File

@ -5,3 +5,7 @@
- name: "Import configure.yml" - name: "Import configure.yml"
ansible.builtin.include_tasks: configure.yml ansible.builtin.include_tasks: configure.yml
- name: "Import consul_service.yml"
ansible.builtin.include_tasks: consul_service.yml
when: deploy_adguard_consul['enable']

View File

@ -0,0 +1,3 @@
# {{ ansible_managed }}
CONSUL_HTTP_ADDR="{{ deploy_adguard_consul['consul_addr'] }}"
CONSUL_HTTP_TOKEN="{{ deploy_adguard_consul['consul_token'] }}"

View File

@ -3,7 +3,8 @@ Description=Consul Envoy Proxy for Adguard.
After=adguard.service,consul.service After=adguard.service,consul.service
[Service] [Service]
ExecStart=/usr/local/bin/consul connect envoy -sidecar-for {{ deploy_adguard_consul['configuration']['service']['name'] }} EnvironmentFile=-{{ deploy_adguard_directory }}/adguard-connect-proxy.env
ExecStart=/usr/bin/consul connect envoy -sidecar-for {{ deploy_adguard_consul['configuration']['service']['name'] }}
Restart=always Restart=always
RestartSec=3 RestartSec=3

View File

@ -16,6 +16,10 @@ services:
{% endif %} {% endif %}
adguard: adguard:
image: adguard/adguardhome:latest image: adguard/adguardhome:latest
{% if deploy_adguard_virtual_ip['enable']%}
depends_on:
- keepalived
{% endif %}
ports: ports:
- "{% 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/tcp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}53:53/udp" - "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}53:53/udp"
@ -53,6 +57,8 @@ services:
node_exporter: node_exporter:
image: ebrianne/adguard-exporter:latest image: ebrianne/adguard-exporter:latest
depends_on:
- adguard
secrets: secrets:
- adguard_passw - adguard_passw
environment: environment: