spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.76k stars 1.03k forks source link

IPv6 setup fails because URL is not found #3247

Closed array-in-a-matrix closed 5 months ago

array-in-a-matrix commented 5 months ago

Describe the bug IPv6 fails to setup as one of the endpoints needed does not exist. Output of just setup-all -K -vvv:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.44/networks/create
Click to see full output ```txt The full traceback is: Traceback (most recent call last): File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/module_utils/_api/api/client.py", line 263, in _raise_for_status response.raise_for_status() File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.44/networks/create The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/modules/docker_network.py", line 668, in main File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/modules/docker_network.py", line 383, in __init__ File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/modules/docker_network.py", line 610, in present File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/modules/docker_network.py", line 539, in create_network File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/module_utils/_api/api/client.py", line 573, in post_json_to_json return self._result(self._post_json(self._url(pathfmt, *args, versioned_api=True), data, **kwargs), json=True) File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/module_utils/_api/api/client.py", line 270, in _result self._raise_for_status(response) File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/module_utils/_api/api/client.py", line 265, in _raise_for_status raise_from(create_api_error_from_http_exception(e), e) File "/tmp/ansible_community.general.docker_network_payload_00_8nr0s/ansible_community.general.docker_network_payload.zip/ansible_collections/community/docker/plugins/module_utils/_api/errors.py", line 45, in create_api_error_from_http_exception raise_from(cls(e, response=response, explanation=explanation), e) File "", line 3, in raise_from ansible_collections.community.docker.plugins.module_utils._api.errors.NotFound: 404 Client Error for http+docker://localhost/v1.44/networks/create: Not Found ("could not find an available, non-overlapping IPv6 address pool among the defaults to assign to the network") fatal: [matrix.chatinamatrix.xyz]: FAILED! => changed=false invocation: module_args: api_version: auto appends: false attachable: null ca_cert: null client_cert: null client_key: null connected: [] debug: false docker_host: unix://var/run/docker.sock driver: bridge driver_options: {} enable_ipv6: true force: false internal: null ipam_config: null ipam_driver: null ipam_driver_options: null labels: {} name: matrix-addons scope: null ssl_version: null state: present timeout: 60 tls: false tls_hostname: null use_ssh_client: false validate_certs: false msg: 'An unexpected Docker error occurred: 404 Client Error for http+docker://localhost/v1.44/networks/create: Not Found ("could not find an available, non-overlapping IPv6 address pool among the defaults to assign to the network")' ```

To Reproduce My vars.yml file looks like this:

matrix_domain: chatinamatrix.xyz
matrix_homeserver_implementation: dendrite
matrix_homeserver_generic_secret_key: ''
devture_traefik_config_certificatesResolvers_acme_email: 'ssl[at]arrayinamatrix.xyz'
devture_postgres_connection_password: ''
matrix_playbook_reverse_proxy_type: playbook-managed-traefik
matrix_static_files_container_labels_base_domain_enabled: true
matrix_static_files_file_index_html_enabled: false
matrix_static_files_container_labels_base_domain_root_path_redirection_enabled: false
matrix_dendrite_client_api_registration_disabled: true
matrix_dendrite_allow_guest_access: true
matrix_dendrite_client_api_enable_registration_captcha: true
matrix_dendrite_client_api_recaptcha_public_key: ''
matrix_dendrite_client_api_recaptcha_private_key: ''
matrix_dendrite_client_api_recaptcha_siteverify_api: 'https://www.google.com/recaptcha/api/siteverify'
matrix_dendrite_user_api_auto_join_rooms:
- "#void:chatinamatrix.xyz"
- "#general:chatinamatrix.xyz"
- "#homeserver:chatinamatrix.xyz"
matrix_static_files_file_matrix_support_enabled: true
matrix_static_files_file_matrix_support_property_m_contacts:
- matrix_id: "@array.in.a.matrix:{{ matrix_domain }}"
email_address: matrix[at]arrayinamatrix.xyz
role: admin
matrix_dendrite_media_api_dynamic_thumbnails: true
matrix_dendrite_media_api_max_thumbnail_generators: 10
matrix_dendrite_sync_api_search_enabled: true
matrix_dendrite_client_api_rate_limiting_enabled: true
matrix_dendrite_client_api_rate_limiting_threshold: 20
matrix_dendrite_client_api_rate_limiting_cooloff_ms: 500
matrix_dendrite_report_stats: true
matrix_dendrite_configuration_extension_yaml: |
mscs:
mscs:
- msc2836 # enable threading
- msc2946 #enable space summery
rate_limiting:
exempt_user_ids:
- "@array.in.a.matrix:chatinamatrix.xyz"
- "@draupnirbot:chatinamatrix.xyz"
matrix_synapse_admin_enabled: true
matrix_dendrite_container_labels_public_client_synapse_admin_api_enabled: true
devture_traefik_dashboard_enabled: true
devture_traefik_dashboard_hostname: "{{ matrix_server_fqn_matrix }}"
devture_traefik_dashboard_basicauth_enabled: true
devture_traefik_dashboard_basicauth_user: ""
devture_traefik_dashboard_basicauth_password: ""
devture_systemd_docker_base_ipv6_enabled: true
matrix_sliding_sync_enabled: true
matrix_coturn_enabled: true
matrix_coturn_turn_external_ip_address: "89.147.110.160"
matrix_bot_draupnir_enabled: true
matrix_bot_draupnir_access_token: ""
matrix_bot_draupnir_management_room: ""
matrix_bot_maubot_enabled: true
matrix_bot_maubot_admins:
- admin: ""
matrix_client_element_enabled: true
matrix_client_element_themes_enabled: true
matrix_client_element_default_theme: 'dark'
matrix_client_hydrogen_enabled: true
matrix_client_cinny_enabled: true
matrix_client_schildichat_enabled: true
matrix_client_schildichat_themes_enabled: true
matrix_client_schildichat_default_theme: 'dark'
jitsi_enabled: true
jitsi_jicofo_auth_password: ""
jitsi_jvb_auth_password: ""
jitsi_jibri_recorder_password: ""
jitsi_jibri_xmpp_password: ""
jitsi_web_custom_config_extension: |
config.enableLayerSuspension = true;
config.disableAudioLevels = true;
etherpad_enabled: true
etherpad_admin_username: ""
etherpad_admin_password: ""
matrix_admin: "@array.in.a.matrix:{{ matrix_domain }}"
matrix_mautrix_discord_enabled: false

Enabling the new IPv6 option reproduces the issue:

devture_systemd_docker_base_ipv6_enabled: true

Expected behavior Setup completes successfully.

Matrix Server:

Additional context I am running Dendrite 0.13.6+87f028d.

der-domi commented 5 months ago

I've got the same issue when setting

devture_systemd_docker_base_ipv6_enabled: true

The relevant message is

could not find an available, non-overlapping IPv6 address pool among the defaults to assign to the network

Seems that you just have to enable dynamic ipv6 subnet allocation via default-address-pools.

dotlineX commented 5 months ago

I added an IPv6 pool in default-address-pools and a fixed-cidr-v6 prefix. But I noticed these kept getting overridden. To fix this, I added the following to my vars.yml:

matrix_playbook_docker_installation_enabled: false

Otherwise, the /etc/docker/daemon.json file kept getting overridden.

Now v6 works fine for the synapse container 😄

spantaleev commented 5 months ago

Thanks to d9598f0 (slightly fixed up in 4d91e8b), you can now easily pass additional Docker options via the playbook.

Example:

matrix_playbook_docker_installation_daemon_options_custom:
  default-address-pools: ...
  fixed-cidr-v6: ...

These _custom options will be merged with the default ones (matrix_playbook_docker_installation_daemon_options_auto) defined here: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/4d91e8b57928ab49169678e6078727250f0b741f/group_vars/matrix_servers#L24-L26