It will, additionally, be connected to the devture-postgres network, if devture-postgres is enabled.pull/2561/head
| @@ -3338,6 +3338,11 @@ matrix_synapse_auto_compressor_enabled: false | |||||
| matrix_synapse_auto_compressor_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}" | matrix_synapse_auto_compressor_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}" | ||||
| matrix_synapse_auto_compressor_container_additional_networks: | | |||||
| {{ | |||||
| ([devture_postgres_container_network] if devture_postgres_enabled and devture_postgres_container_network != matrix_synapse_auto_compressor_container_network else []) | |||||
| }} | |||||
| matrix_synapse_auto_compressor_database_username: "{{ matrix_synapse_database_user if matrix_synapse_enabled else '' }}" | matrix_synapse_auto_compressor_database_username: "{{ matrix_synapse_database_user if matrix_synapse_enabled else '' }}" | ||||
| matrix_synapse_auto_compressor_database_password: "{{ matrix_synapse_database_password if matrix_synapse_enabled else '' }}" | matrix_synapse_auto_compressor_database_password: "{{ matrix_synapse_database_password if matrix_synapse_enabled else '' }}" | ||||
| matrix_synapse_auto_compressor_database_hostname: "{{ matrix_synapse_database_host if matrix_synapse_enabled else '' }}" | matrix_synapse_auto_compressor_database_hostname: "{{ matrix_synapse_database_host if matrix_synapse_enabled else '' }}" | ||||
| @@ -17,6 +17,14 @@ matrix_synapse_auto_compressor_container_image_force_pull: "{{ matrix_synapse_au | |||||
| matrix_synapse_auto_compressor_base_path: "{{ matrix_base_data_path }}/synapse-auto-compressor" | matrix_synapse_auto_compressor_base_path: "{{ matrix_base_data_path }}/synapse-auto-compressor" | ||||
| # The base container network. It will be auto-created by this role if it doesn't exist already. | |||||
| matrix_synapse_auto_compressor_container_network: matrix-synapse-auto-compressor | |||||
| # A list of additional container networks that the container would be connected to. | |||||
| # The role does not create these networks, so make sure they already exist. | |||||
| # Use this to expose this container to another reverse proxy, which runs in a different container network. | |||||
| matrix_synapse_auto_compressor_container_additional_networks: [] | |||||
| # A list of extra arguments to pass to the container | # A list of extra arguments to pass to the container | ||||
| matrix_synapse_auto_compressor_container_extra_arguments: [] | matrix_synapse_auto_compressor_container_extra_arguments: [] | ||||
| @@ -43,6 +43,11 @@ | |||||
| pull: true | pull: true | ||||
| when: "matrix_synapse_auto_compressor_container_image_self_build | bool" | when: "matrix_synapse_auto_compressor_container_image_self_build | bool" | ||||
| - name: Ensure matrix-synapse-auto-compressor container network is created | |||||
| community.general.docker_network: | |||||
| name: "{{ matrix_synapse_auto_compressor_container_network }}" | |||||
| driver: bridge | |||||
| - name: Ensure matrix-synapse-auto-compressor systemd service and timer are installed | - name: Ensure matrix-synapse-auto-compressor systemd service and timer are installed | ||||
| ansible.builtin.template: | ansible.builtin.template: | ||||
| src: "{{ role_path }}/templates/matrix-synapse-auto-compressor.{{ item }}.j2" | src: "{{ role_path }}/templates/matrix-synapse-auto-compressor.{{ item }}.j2" | ||||
| @@ -15,18 +15,27 @@ Type=oneshot | |||||
| Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" | Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" | ||||
| ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-synapse-auto-compressor 2>/dev/null || true' | ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-synapse-auto-compressor 2>/dev/null || true' | ||||
| ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-synapse-auto-compressor 2>/dev/null || true' | ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-synapse-auto-compressor 2>/dev/null || true' | ||||
| ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-synapse-auto-compressor \ | |||||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ | |||||
| --rm \ | |||||
| --name=matrix-synapse-auto-compressor \ | |||||
| --log-driver=none \ | --log-driver=none \ | ||||
| --cap-drop=ALL \ | --cap-drop=ALL \ | ||||
| --read-only \ | --read-only \ | ||||
| --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ | --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ | ||||
| --network={{ matrix_docker_network }} \ | |||||
| --network={{ matrix_synapse_auto_compressor_container_network }} \ | |||||
| {% for arg in matrix_synapse_auto_compressor_container_extra_arguments %} | {% for arg in matrix_synapse_auto_compressor_container_extra_arguments %} | ||||
| {{ arg }} \ | {{ arg }} \ | ||||
| {% endfor %} | {% endfor %} | ||||
| {{ matrix_synapse_auto_compressor_container_image }} \ | {{ matrix_synapse_auto_compressor_container_image }} \ | ||||
| {{ matrix_synapse_auto_compressor_command }} | {{ matrix_synapse_auto_compressor_command }} | ||||
| {% for network in matrix_synapse_auto_compressor_container_additional_networks %} | |||||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-synapse-auto-compressor | |||||
| {% endfor %} | |||||
| ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-synapse-auto-compressor | |||||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-synapse-auto-compressor 2>/dev/null || true' | ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-synapse-auto-compressor 2>/dev/null || true' | ||||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-synapse-auto-compressor 2>/dev/null || true' | ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-synapse-auto-compressor 2>/dev/null || true' | ||||
| SyslogIdentifier=matrix-synapse-auto-compressor | SyslogIdentifier=matrix-synapse-auto-compressor | ||||