| @@ -18,13 +18,14 @@ Add the following block to your `vars.yaml` and make sure to exchange the tokens | |||
| ## Cactus Chat ## | |||
| ################# | |||
| # This enables the backend (appservice) | |||
| matrix_cactus_comments_enabled: true | |||
| # To allow guest comments without users needing to log in, you need to have guest registration enabled. | |||
| # To do this you need to uncomment one of the following lines (depending if you are using synapse or dentrite as a homeserver) | |||
| # If you don't know which one you use: The default is synapse ;) | |||
| # To do this you need to uncomment one of the following lines (depending if you are using Synapse or Dendrite as a homeserver) | |||
| # If you don't know which one you use: The default is Synapse ;) | |||
| # matrix_synapse_allow_guest_access: true | |||
| # matrix_dentrite_allow_guest_access: true | |||
| # matrix_dendrite_allow_guest_access: true | |||
| ``` | |||
| ## Installing | |||
| @@ -2568,23 +2568,24 @@ backup_borg_systemd_required_services_list: | | |||
| matrix_cactus_comments_enabled: false | |||
| # Derive secret values from homeserver secret | |||
| matrix_cactus_comments_as_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'cactus.as.token', rounds=655555) | to_uuid }}" | |||
| matrix_cactus_comments_hs_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'cactus.hs.token', rounds=655555) | to_uuid }}" | |||
| matrix_cactus_comments_systemd_required_services_list_auto: | | |||
| {{ | |||
| matrix_addons_homeserver_systemd_services_list | |||
| }} | |||
| matrix_cactus_comments_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm32', 'arm64'] }}" | |||
| matrix_cactus_comments_systemd_required_services_list: | | |||
| matrix_cactus_comments_container_network: "{{ matrix_addons_container_network }}" | |||
| matrix_cactus_comments_container_additional_networks_auto: |- | |||
| {{ | |||
| (['docker.service']) | |||
| + | |||
| (['matrix-nginx-proxy.service'] if matrix_nginx_proxy_enabled else []) | |||
| + | |||
| (['matrix-' + matrix_homeserver_implementation + '.service']) | |||
| ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) | |||
| }} | |||
| matrix_cactus_comments_homeserver_url: "{{ matrix_addons_homeserver_client_api_url }}" | |||
| matrix_cactus_comments_as_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'cactus.as.token', rounds=655555) | to_uuid }}" | |||
| matrix_cactus_comments_hs_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'cactus.hs.token', rounds=655555) | to_uuid }}" | |||
| matrix_cactus_comments_client_nginx_path: "{{ '/cactus-comments/' if matrix_nginx_proxy_enabled else matrix_cactus_comments_client_path + '/' }}" | |||
| matrix_cactus_comments_homeserver_url: "{{ matrix_addons_homeserver_client_api_url }}" | |||
| ###################################################################### | |||
| # | |||
| @@ -1,20 +1,17 @@ | |||
| --- | |||
| # Cactus Comments is a federated comment system built on Matrix | |||
| # Project source code URL: https://gitlab.com/cactus-comments/cactus-appservice | |||
| # Project source code URL: https://gitlab.com/cactus-comments/cactus-client | |||
| matrix_cactus_comments_enabled: true | |||
| matrix_cactus_comments_serve_client_enabled: true | |||
| matrix_cactus_comments_container_image_self_build: false | |||
| matrix_cactus_comments_docker_repo: "https://gitlab.com/cactus-comments/cactus-appservice.git" | |||
| matrix_cactus_comments_docker_repo_version: "{{ matrix_cactus_comments_version if matrix_cactus_comments_version != 'latest' else 'main' }}" | |||
| matrix_cactus_comments_docker_src_files_path: "{{ matrix_cactus_comments_base_path }}/docker-src" | |||
| matrix_cactus_comments_base_path: "{{ matrix_base_data_path }}/cactus-comments" | |||
| matrix_cactus_comments_container_tmp_path: "{{ matrix_cactus_comments_base_path }}/tmp" | |||
| matrix_cactus_comments_client_path: "{{ matrix_cactus_comments_base_path }}/client" | |||
| matrix_cactus_comments_client_file_permissions: "0644" | |||
| matrix_cactus_comments_app_service_config_file: "{{ matrix_cactus_comments_base_path }}/cactus_appservice.yaml" | |||
| matrix_cactus_comments_app_service_env_file: "{{ matrix_cactus_comments_base_path }}/cactus.env" | |||
| @@ -32,24 +29,14 @@ matrix_cactus_comments_version: 0.9.0 | |||
| matrix_cactus_comments_docker_image: "{{ matrix_container_global_registry_prefix }}cactuscomments/cactus-appservice:{{ matrix_cactus_comments_version }}" | |||
| matrix_cactus_comments_docker_image_force_pull: "{{ matrix_cactus_comments_docker_image.endswith(':latest') }}" | |||
| # The released & compiled client is uploaded to a URL that changes per commit. Therefore it is necessary to check the | |||
| # available versions and adjust the url manually. | |||
| # For available versions, see: https://gitlab.com/cactus-comments/cactus-client/-/releases | |||
| # Also see: `matrix_cactus_comments_client_local_dir` | |||
| matrix_cactus_comments_webclient_js_url: "https://gateway.pinata.cloud/ipfs/QmSiWN27KZZ1XE32jKwifBnS3nWTUcFGNArKzur2nmDgoL/v0.13.0/cactus.js" | |||
| matrix_cactus_comments_webclient_css_url: "https://gateway.pinata.cloud/ipfs/QmSiWN27KZZ1XE32jKwifBnS3nWTUcFGNArKzur2nmDgoL/v0.13.0/style.css" | |||
| matrix_cactus_comments_container_network: "" | |||
| # matrix_cactus_comments_client_local_dir specifies a local directory (on the Ansible controller, not on the remote server) with cactus-client files to use. | |||
| # This is an alternative to `matrix_cactus_comments_client_version`, to be used when you'd like to | |||
| # provide the files locally / manually. | |||
| matrix_cactus_comments_client_local_dir: '' | |||
| matrix_cactus_comments_container_additional_networks: "{{ matrix_cactus_comments_container_additional_networks_auto + matrix_cactus_comments_container_additional_networks_custom }}" | |||
| matrix_cactus_comments_container_additional_networks_auto: [] | |||
| matrix_cactus_comments_container_additional_networks_custom: [] | |||
| # matrix_cactus_comments_client_nginx_path specifies the path where nginx can access the client files. | |||
| # The default value assumes a container setup. If you're running nginx without a container, consider adjusting this path | |||
| matrix_cactus_comments_client_nginx_path: "/cactus-comments/" | |||
| # matrix_cactus_comments_client_endpoint specifies where nginx will serve the files in nginx is enabled | |||
| matrix_cactus_comments_client_endpoint: "/cactus-comments/" | |||
| # A list of extra arguments to pass to the container | |||
| matrix_cactus_comments_container_extra_arguments: [] | |||
| # List of systemd services that matrix-cactus-comments.service depends on | |||
| matrix_cactus_comments_systemd_required_services_list: ['docker.service'] | |||
| @@ -57,7 +44,4 @@ matrix_cactus_comments_systemd_required_services_list: ['docker.service'] | |||
| # List of systemd services that matrix-cactus-comments.service wants | |||
| matrix_cactus_comments_systemd_wanted_services_list: [] | |||
| # A list of extra arguments to pass to the container | |||
| matrix_cactus_comments_container_extra_arguments: [] | |||
| matrix_cactus_comments_environment_variables_extension: '' | |||
| @@ -1,44 +0,0 @@ | |||
| --- | |||
| - block: | |||
| - name: Fail if matrix-nginx-proxy role already executed | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| Trying to append Cactus Comment's reverse-proxying configuration to matrix-nginx-proxy, | |||
| but it's pointless since the matrix-nginx-proxy role had already executed. | |||
| To fix this, please change the order of roles in your playbook, | |||
| so that the matrix-nginx-proxy role would run after the matrix-cactus-comments role. | |||
| when: matrix_nginx_proxy_role_executed | default(False) | bool | |||
| - name: Mount volume | |||
| ansible.builtin.set_fact: | |||
| matrix_nginx_proxy_container_additional_volumes: > | |||
| {{ | |||
| matrix_nginx_proxy_container_additional_volumes | default([]) | |||
| + | |||
| [{"src": "{{ matrix_cactus_comments_client_path }}", "dst": "/cactus-comments/cactus-comments", "options": "ro"}] | |||
| }} | |||
| - name: Generate Cactus Comment proxying configuration for matrix-nginx-proxy | |||
| ansible.builtin.set_fact: | |||
| matrix_cactus_comments_nginx_proxy_configuration: | | |||
| location {{ matrix_cactus_comments_client_endpoint }} { | |||
| root {{ matrix_cactus_comments_client_nginx_path }}; | |||
| } | |||
| - name: Register Cactus Comment proxying configuration with matrix-nginx-proxy | |||
| ansible.builtin.set_fact: | |||
| matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | | |||
| {{ | |||
| matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) | |||
| + | |||
| [matrix_cactus_comments_nginx_proxy_configuration] | |||
| }} | |||
| - name: Warn about reverse-proxying if matrix-nginx-proxy not used | |||
| ansible.builtin.debug: | |||
| msg: >- | |||
| NOTE: You've enabled Cactus Comments but are not using the matrix-nginx-proxy | |||
| reverse proxy. | |||
| Please make sure that you're proxying client files in {{ matrix_cactus_comments_client_path }} correctly | |||
| when: "not matrix_nginx_proxy_enabled | default(False) | bool" | |||
| @@ -1,14 +1,5 @@ | |||
| --- | |||
| - tags: | |||
| - setup-all | |||
| - setup-nginx-proxy | |||
| - install-all | |||
| - install-nginx-proxy | |||
| block: | |||
| - when: matrix_cactus_comments_enabled | bool and matrix_cactus_comments_serve_client_enabled | bool | |||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/inject_into_nginx_proxy.yml" | |||
| - tags: | |||
| - setup-all | |||
| - setup-cactus-comments | |||
| @@ -9,7 +9,6 @@ | |||
| group: "{{ matrix_user_groupname }}" | |||
| with_items: | |||
| - {path: "{{ matrix_cactus_comments_base_path }}", when: true} | |||
| - {path: "{{ matrix_cactus_comments_client_path }}", when: true} | |||
| - {path: "{{ matrix_cactus_comments_container_tmp_path }}", when: true} | |||
| - {path: "{{ matrix_cactus_comments_docker_src_files_path }}", when: matrix_cactus_comments_container_image_self_build} | |||
| when: "item.when | bool" | |||
| @@ -65,40 +64,6 @@ | |||
| pull: true | |||
| when: "matrix_cactus_comments_container_image_self_build | bool" | |||
| - when: matrix_cactus_comments_client_local_dir | length == 0 | |||
| block: | |||
| - name: Download web client js | |||
| ansible.builtin.get_url: | |||
| url: "{{ matrix_cactus_comments_webclient_js_url }}" | |||
| dest: "{{ matrix_cactus_comments_client_path }}/cactus.js" | |||
| mode: "{{ matrix_cactus_comments_client_file_permissions }}" | |||
| owner: "{{ matrix_user_username }}" | |||
| group: "{{ matrix_user_groupname }}" | |||
| - name: Download web client css | |||
| ansible.builtin.get_url: | |||
| url: "{{ matrix_cactus_comments_webclient_css_url }}" | |||
| dest: "{{ matrix_cactus_comments_client_path }}/style.css" | |||
| mode: "{{ matrix_cactus_comments_client_file_permissions }}" | |||
| owner: "{{ matrix_user_username }}" | |||
| group: "{{ matrix_user_groupname }}" | |||
| - when: matrix_cactus_comments_client_local_dir | length > 0 | |||
| block: | |||
| - name: Propagate locally distributed client javascreipt | |||
| ansible.builtin.copy: | |||
| src: "{{ matrix_cactus_comments_client_local_dir }}/src/cactus.js" | |||
| dest: "{{ matrix_cactus_comments_client_path }}/cactus.js" | |||
| mode: "{{ matrix_cactus_comments_client_file_permissions }}" | |||
| owner: "{{ matrix_user_username }}" | |||
| group: "{{ matrix_user_groupname }}" | |||
| - name: Propagate locally distributed client style.css | |||
| ansible.builtin.copy: | |||
| src: "{{ matrix_cactus_comments_client_local_dir }}/src/style.css" | |||
| dest: "{{ matrix_cactus_comments_client_path }}/style.css" | |||
| mode: "{{ matrix_cactus_comments_client_file_permissions }}" | |||
| owner: "{{ matrix_user_username }}" | |||
| group: "{{ matrix_user_groupname }}" | |||
| - name: Ensure matrix-cactus-comments.service installed | |||
| ansible.builtin.template: | |||
| src: "{{ role_path }}/templates/systemd/matrix-cactus-comments.service.j2" | |||
| @@ -1,15 +1,5 @@ | |||
| --- | |||
| - name: Fail if required matrix-cactus-comments settings not defined | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| You need to define a required configuration setting (`{{ item }}`). | |||
| when: "vars[item] == ''" | |||
| with_items: | |||
| - "matrix_cactus_comments_as_token" | |||
| - "matrix_cactus_comments_hs_token" | |||
| - "matrix_cactus_comments_homeserver_url" | |||
| - name: (Deprecation) Catch and report renamed matrix-cactus-comments settings | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| @@ -19,3 +9,18 @@ | |||
| with_items: | |||
| - {'old': 'matrix_bot_cactus_comments_systemd_required_services_list', 'new': 'matrix_cactus_comments_systemd_required_services_list'} | |||
| - {'old': 'matrix_bot_cactus_comments_systemd_wanted_services_list', 'new': 'matrix_cactus_comments_systemd_wanted_services_list'} | |||
| - {'old': 'matrix_cactus_comments_client_endpoint', 'new': 'matrix_cactus_comments_client_path_prefix'} | |||
| - {'old': 'matrix_cactus_comments_client_nginx_path', 'new': '<superseded by Traefik labels controlled by matrix_cactus_comments_client_container_labels_traefik_* variables>'} | |||
| - {'old': 'matrix_cactus_comments_client_path', 'new': 'matrix_cactus_comments_client_base_path'} | |||
| - {'old': 'matrix_cactus_comments_serve_client_enabled', 'new': 'matrix_cactus_comments_client_enabled'} | |||
| - name: Fail if required matrix-cactus-comments settings not defined | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| You need to define a required configuration setting (`{{ item }}`). | |||
| when: "vars[item] == ''" | |||
| with_items: | |||
| - "matrix_cactus_comments_as_token" | |||
| - "matrix_cactus_comments_hs_token" | |||
| - "matrix_cactus_comments_homeserver_url" | |||
| - "matrix_cactus_comments_container_network" | |||
| @@ -16,16 +16,24 @@ 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 }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-cactus-comments 2>/dev/null || true' | |||
| ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-cactus-comments 2>/dev/null || true' | |||
| ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-cactus-comments \ | |||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ | |||
| --rm \ | |||
| --name=matrix-cactus-comments \ | |||
| --log-driver=none \ | |||
| --cap-drop=ALL \ | |||
| --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ | |||
| --read-only \ | |||
| --env-file {{ matrix_cactus_comments_app_service_env_file }} \ | |||
| --tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_cactus_comments_tmp_directory_size_mb }}m \ | |||
| --network={{ matrix_docker_network }} \ | |||
| --network={{ matrix_cactus_comments_container_network }} \ | |||
| {{ matrix_cactus_comments_docker_image }} | |||
| {% for network in matrix_cactus_comments_container_additional_networks %} | |||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-cactus-comments | |||
| {% endfor %} | |||
| ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-cactus-comments | |||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-cactus-comments 2>/dev/null || true' | |||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-cactus-comments 2>/dev/null || true' | |||
| Restart=always | |||