diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 64962065d..9c10a8071 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -79,7 +79,7 @@ matrix_homeserver_container_extra_arguments_auto: | + (['--mount type=bind,src=' + matrix_appservice_webhooks_config_path + '/webhooks-registration.yaml,dst=/matrix-appservice-webhooks-registration.yaml,ro'] if matrix_appservice_webhooks_enabled else []) + - (['--mount type=bind,src=' + matrix_appservice_polychat_config_path + '/polychat-registration.yaml,dst=/matrix-appservice-polychat-registration.yaml,ro'] if matrix_appservice_polychat_enabled else []) + (['--mount type=bind,src=' + matrix_appservice_polychat_config_path + '/registration.yaml,dst=/matrix-appservice-polychat-registration.yaml,ro'] if matrix_appservice_polychat_enabled else []) + (['--mount type=bind,src=' + matrix_beeper_linkedin_config_path + '/registration.yaml,dst=/matrix-beeper-linkedin-registration.yaml,ro'] if matrix_beeper_linkedin_enabled else []) + diff --git a/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml b/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml index fe6941558..f0724f856 100644 --- a/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml +++ b/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml @@ -13,9 +13,16 @@ matrix_appservice_polychat_container_image_self_build_repo: "https://github.com/ matrix_appservice_polychat_container_image_self_build_repo_version: "{{ 'master' if matrix_appservice_polychat_version == 'latest' else matrix_appservice_polychat_version }}" matrix_appservice_polychat_container_image_self_build_repo_dockerfile_path: "Dockerfile" -matrix_appservice_polychat_version: v1.0.3-01 + +matrix_appservice_polychat_docker_login_registry: "{{ matrix_appservice_polychat_registry_prefix }}" +matrix_appservice_polychat_docker_login_username: "{{ vault_matrix_appservice_polychat_docker_login_username }}" +matrix_appservice_polychat_docker_login_password: "{{ vault_matrix_appservice_polychat_docker_login_password }}" + + +matrix_appservice_polychat_version: main +matrix_appservice_polychat_registry_prefix: ghcr.io/ matrix_appservice_polychat_docker_image: "{{ matrix_appservice_polychat_docker_image_name_prefix }}polychatproject/polychat-appservice:{{ matrix_appservice_polychat_version }}" -matrix_appservice_polychat_docker_image_name_prefix: "{{ 'localhost/' if matrix_appservice_polychat_container_image_self_build else matrix_container_global_registry_prefix }}" +matrix_appservice_polychat_docker_image_name_prefix: "{{ 'localhost/' if matrix_appservice_polychat_container_image_self_build else matrix_appservice_polychat_registry_prefix }}" matrix_appservice_polychat_docker_image_force_pull: "{{ matrix_appservice_polychat_docker_image.endswith(':latest') }}" matrix_appservice_polychat_base_path: "{{ matrix_base_data_path }}/appservice-polychat" @@ -31,12 +38,12 @@ matrix_appservice_polychat_bot_name: 'webhookbot' matrix_appservice_polychat_user_prefix: '_webhook_' # Controls the polychat_PORT and MATRIX_PORT of the installation -matrix_appservice_polychat_matrix_port: 6789 +matrix_appservice_polychat_matrix_port: 9999 # Controls whether the appservice-polychat container exposes its HTTP port (tcp/6789 in the container). # # Takes an ":" or "" value (e.g. "127.0.0.1:9999"), or empty string to not expose. -matrix_appservice_polychat_container_http_host_bind_port: '' +matrix_appservice_polychat_container_http_host_bind_port: '127.0.0.1:9998' matrix_appservice_polychat_container_network: "" @@ -73,7 +80,15 @@ matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls_certReso matrix_appservice_polychat_container_labels_additional_labels: '' # A list of extra arguments to pass to the container -matrix_appservice_polychat_container_extra_arguments: [] +matrix_appservice_polychat_container_extra_arguments: + - "-e API_BIND_ADDRESS=0.0.0.0" + - "-e API_PORT=9998" + - "-e APPSERVICE_BIND_ADDRESS=127.0.0.1" + - "-e APPSERVICE_PORT=9999" + - "-e DEBUG_MXID=@testuser:polychat.de" + - "-e HOMESERVER_NAME={{ matrix_domain }}" + - "-e HOMESERVER_URL={{ matrix_homeserver_url }}" + # List of systemd services that matrix-appservice-polychat.service depends on. matrix_appservice_polychat_systemd_required_services_list: "{{ matrix_appservice_polychat_systemd_required_services_list_default + matrix_appservice_polychat_systemd_required_services_list_auto + matrix_appservice_polychat_systemd_required_services_list_custom }}" @@ -112,13 +127,15 @@ matrix_appservice_polychat_registration_yaml: | as_token: "{{ matrix_appservice_polychat_appservice_token }}" namespaces: users: + - exclusive: false + regex: '@polychat_*' + aliases: - exclusive: true - regex: '^@{{ matrix_appservice_polychat_user_prefix | regex_escape }}.*:{{ matrix_domain | regex_escape }}$' - aliases: [] - rooms: [] + regex: '#polychat_*' url: "{{ matrix_appservice_polychat_appservice_url }}:{{ matrix_appservice_polychat_matrix_port }}" - sender_localpart: _webhook + sender_localpart: polychat rate_limited: false protocols: null matrix_appservice_polychat_registration: "{{ matrix_appservice_polychat_registration_yaml | from_yaml }}" + diff --git a/roles/custom/matrix-bridge-appservice-polychat/tasks/setup_install.yml b/roles/custom/matrix-bridge-appservice-polychat/tasks/setup_install.yml index 3805cfdfe..c67a47b83 100644 --- a/roles/custom/matrix-bridge-appservice-polychat/tasks/setup_install.yml +++ b/roles/custom/matrix-bridge-appservice-polychat/tasks/setup_install.yml @@ -14,6 +14,13 @@ - {path: "{{ matrix_appservice_polychat_docker_src_files_path }}", when: "{{ matrix_appservice_polychat_container_image_self_build }}"} when: "item.when | bool" +- name: Log into private registry and force re-authorization + docker_login: + registry: "{{ matrix_appservice_polychat_docker_login_registry }}" + username: "{{ matrix_appservice_polychat_docker_login_username }}" + password: "{{ matrix_appservice_polychat_docker_login_password }}" + reauthorize: yes + - name: Ensure matrix-appservice-polychat container image is pulled community.docker.docker_image: name: "{{ matrix_appservice_polychat_docker_image }}" @@ -76,7 +83,7 @@ - name: Ensure appservice-polychat registration.yaml installed ansible.builtin.copy: content: "{{ matrix_appservice_polychat_registration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_appservice_polychat_config_path }}/polychat-registration.yaml" + dest: "{{ matrix_appservice_polychat_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" diff --git a/roles/custom/matrix-bridge-appservice-polychat/templates/systemd/matrix-appservice-webhooks.service.j2 b/roles/custom/matrix-bridge-appservice-polychat/templates/systemd/matrix-appservice-polychat.service.j2 similarity index 93% rename from roles/custom/matrix-bridge-appservice-polychat/templates/systemd/matrix-appservice-webhooks.service.j2 rename to roles/custom/matrix-bridge-appservice-polychat/templates/systemd/matrix-appservice-polychat.service.j2 index 60dcdbb33..5782ced76 100644 --- a/roles/custom/matrix-bridge-appservice-polychat/templates/systemd/matrix-appservice-webhooks.service.j2 +++ b/roles/custom/matrix-bridge-appservice-polychat/templates/systemd/matrix-appservice-polychat.service.j2 @@ -32,8 +32,8 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ {% for arg in matrix_appservice_polychat_container_extra_arguments %} {{ arg }} \ {% endfor %} - {{ matrix_appservice_polychat_docker_image }} \ - node index.js -p {{ matrix_appservice_polychat_matrix_port }} -c /config/config.yaml -f /config/polychat-registration.yaml + {{ matrix_appservice_polychat_docker_image }} + {% for network in matrix_appservice_polychat_container_additional_networks %} ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-appservice-polychat