Make matrix-dynamic-dns use its own container network

This commit is contained in:
Slavi Pantaleev 2024-01-13 17:17:03 +02:00
parent 75f8a879de
commit c96a0156c0
5 changed files with 18 additions and 1 deletions

View File

@ -2928,6 +2928,8 @@ etherpad_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_k
matrix_dynamic_dns_enabled: false
matrix_dynamic_dns_container_network: matrix-dynamic-dns
######################################################################
#
# /matrix-dynamic-dns

View File

@ -18,6 +18,8 @@ matrix_dynamic_dns_docker_image_name_prefix: "{{ 'localhost/' if matrix_dynamic_
# The image to force pull
matrix_dynamic_dns_docker_image_force_pull: "{{ matrix_dynamic_dns_docker_image.endswith(':latest') }}"
matrix_dynamic_dns_container_network: ''
# List of extra arguments to pass to the ontainer mode
matrix_dynamic_dns_container_extra_arguments: []

View File

@ -56,6 +56,11 @@
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
- name: Ensure matrix-dynamic-dns container network is created
community.general.docker_network:
name: "{{ matrix_dynamic_dns_container_network }}"
driver: bridge
- name: Ensure matrix-dynamic-dns.service installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-dynamic-dns.service.j2"

View File

@ -14,3 +14,11 @@
with_items: "{{ matrix_dynamic_dns_domain_configurations }}"
loop_control:
loop_var: configuration
- name: Fail if required mautrix-dynamic-dns settings not defined
ansible.builtin.fail:
msg: >-
You need to define a required configuration setting (`{{ item.name }}`).
when: "item.when | bool and vars[item.name] == ''"
with_items:
- {'name': 'matrix_dynamic_dns_container_network', when: true}

View File

@ -17,7 +17,7 @@ ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_s
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-dynamic-dns 2>/dev/null || true'
ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-dynamic-dns \
--log-driver=none \
--network={{ matrix_docker_network }} \
--network={{ matrix_dynamic_dns_container_network }} \
-e PUID={{ matrix_user_uid }} \
-e PGID={{ matrix_user_gid }} \
--mount type=bind,src={{ matrix_dynamic_dns_config_path }},dst=/config \