Signed-off-by: Suguru Hirahara <did🔑z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5>
pull/4900/head
| @@ -1,203 +0,0 @@ | |||
| # SPDX-FileCopyrightText: 2022 - 2024 Nikita Chernyi | |||
| # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev | |||
| # SPDX-FileCopyrightText: 2022 László Várady | |||
| # SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||
| # SPDX-FileCopyrightText: 2023 Samuel Meenzen | |||
| # SPDX-FileCopyrightText: 2024 Suguru Hirahara | |||
| # | |||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||
| --- | |||
| # Project source code URL: https://github.com/ajbura/cinny | |||
| cinny_enabled: true | |||
| cinny_container_image_self_build: false | |||
| cinny_container_image_self_build_repo: "https://github.com/ajbura/cinny.git" | |||
| # renovate: datasource=docker depName=ajbura/cinny | |||
| cinny_version: v4.10.2 | |||
| cinny_container_image: "{{ cinny_container_image_registry_prefix }}ajbura/cinny:{{ cinny_version }}" | |||
| cinny_container_image_registry_prefix_upstream_default: docker.io/ | |||
| cinny_container_image_force_pull: "{{ cinny_container_image.endswith(':latest') }}" | |||
| cinny_base_path: "{{ matrix_base_data_path }}/client-cinny" | |||
| cinny_docker_src_files_path: "{{ cinny_base_path }}/docker-src" | |||
| # The base container network | |||
| cinny_container_network: '' | |||
| # 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 a reverse proxy, which runs in a different container network. | |||
| cinny_container_additional_networks: [] | |||
| # Controls whether the container exposes its HTTP port (tcp/8080 in the container). | |||
| # | |||
| # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:8768"), or empty string to not expose. | |||
| cinny_container_http_host_bind_port: '' | |||
| # cinny_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container. | |||
| # See `../templates/labels.j2` for details. | |||
| # | |||
| # To inject your own other container labels, see `cinny_container_labels_additional_labels`. | |||
| cinny_container_labels_traefik_enabled: true | |||
| cinny_container_labels_traefik_docker_network: "{{ cinny_container_network }}" | |||
| cinny_container_labels_traefik_hostname: "{{ cinny_hostname }}" | |||
| # The path prefix must either be `/` or not end with a slash (e.g. `/cinny`). | |||
| cinny_container_labels_traefik_path_prefix: "{{ cinny_path_prefix }}" | |||
| cinny_container_labels_traefik_rule: "Host(`{{ cinny_container_labels_traefik_hostname }}`){% if cinny_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ cinny_container_labels_traefik_path_prefix }}`){% endif %}" | |||
| cinny_container_labels_traefik_priority: 0 | |||
| cinny_container_labels_traefik_entrypoints: web-secure | |||
| cinny_container_labels_traefik_tls: "{{ cinny_container_labels_traefik_entrypoints != 'web' }}" | |||
| cinny_container_labels_traefik_tls_certResolver: default # noqa var-naming | |||
| # Controls whether a compression middleware will be injected into the middlewares list. | |||
| # This compression middleware is supposed to be defined elsewhere (using labels or a File provider, etc.) and is merely referenced by this router. | |||
| cinny_container_labels_traefik_compression_middleware_enabled: false | |||
| cinny_container_labels_traefik_compression_middleware_name: "" | |||
| # Controls which additional headers to attach to all HTTP responses. | |||
| # To add your own headers, use `cinny_container_labels_traefik_additional_response_headers_custom` | |||
| cinny_container_labels_traefik_additional_response_headers: "{{ cinny_container_labels_traefik_additional_response_headers_auto | combine(cinny_container_labels_traefik_additional_response_headers_custom) }}" | |||
| cinny_container_labels_traefik_additional_response_headers_auto: | | |||
| {{ | |||
| {} | |||
| | combine ({'X-XSS-Protection': cinny_http_header_xss_protection} if cinny_http_header_xss_protection else {}) | |||
| | combine ({'X-Frame-Options': cinny_http_header_frame_options} if cinny_http_header_frame_options else {}) | |||
| | combine ({'X-Content-Type-Options': cinny_http_header_content_type_options} if cinny_http_header_content_type_options else {}) | |||
| | combine ({'Content-Security-Policy': cinny_http_header_content_security_policy} if cinny_http_header_content_security_policy else {}) | |||
| | combine ({'Permission-Policy': cinny_http_header_content_permission_policy} if cinny_http_header_content_permission_policy else {}) | |||
| | combine ({'Strict-Transport-Security': cinny_http_header_strict_transport_security} if cinny_http_header_strict_transport_security and cinny_container_labels_traefik_tls else {}) | |||
| }} | |||
| cinny_container_labels_traefik_additional_response_headers_custom: {} | |||
| # cinny_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file. | |||
| # See `../templates/labels.j2` for details. | |||
| # | |||
| # Example: | |||
| # cinny_container_labels_additional_labels: | | |||
| # my.label=1 | |||
| # another.label="here" | |||
| cinny_container_labels_additional_labels: '' | |||
| # A list of extra arguments to pass to the container | |||
| cinny_container_extra_arguments: [] | |||
| # List of systemd services that cinny.service depends on | |||
| cinny_systemd_required_services_list: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" | |||
| # Specifies the value of the `X-XSS-Protection` header | |||
| # Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks. | |||
| # | |||
| # Learn more about it is here: | |||
| # - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection | |||
| # - https://portswigger.net/web-security/cross-site-scripting/reflected | |||
| cinny_http_header_xss_protection: "1; mode=block" | |||
| # Specifies the value of the `X-Frame-Options` header which controls whether framing can happen. | |||
| # See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options | |||
| cinny_http_header_frame_options: SAMEORIGIN | |||
| # Specifies the value of the `X-Content-Type-Options` header. | |||
| # See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options | |||
| cinny_http_header_content_type_options: nosniff | |||
| # Specifies the value of the `Content-Security-Policy` header. | |||
| # See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy | |||
| cinny_http_header_content_security_policy: frame-ancestors 'self' | |||
| # Specifies the value of the `Permission-Policy` header. | |||
| # See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permission-Policy | |||
| cinny_http_header_content_permission_policy: "{{ 'interest-cohort=()' if cinny_floc_optout_enabled else '' }}" | |||
| # Specifies the value of the `Strict-Transport-Security` header. | |||
| # See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security | |||
| cinny_http_header_strict_transport_security: "max-age=31536000; includeSubDomains{{ '; preload' if cinny_hsts_preload_enabled else '' }}" | |||
| # Controls whether to send a "Permissions-Policy interest-cohort=();" header along with all responses | |||
| # | |||
| # Learn more about what it is here: | |||
| # - https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea | |||
| # - https://paramdeo.com/blog/opting-your-website-out-of-googles-floc-network | |||
| # - https://amifloced.org/ | |||
| # | |||
| # Of course, a better solution is to just stop using browsers (like Chrome), which participate in such tracking practices. | |||
| # See: `cinny_content_permission_policy` | |||
| cinny_floc_optout_enabled: true | |||
| # Controls if HSTS preloading is enabled | |||
| # | |||
| # In its strongest and recommended form, the [HSTS policy](https://www.chromium.org/hsts) includes all subdomains, and | |||
| # indicates a willingness to be "preloaded" into browsers: | |||
| # `Strict-Transport-Security: max-age=31536000; includeSubDomains; preload` | |||
| # For more information visit: | |||
| # - https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security | |||
| # - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security | |||
| # - https://hstspreload.org/#opt-in | |||
| # See: `cinny_http_header_strict_transport_security` | |||
| cinny_hsts_preload_enabled: false | |||
| cinny_scheme: https | |||
| # The path at which Cinny is exposed. | |||
| # This value must either be `/` or not end with a slash (e.g. `/cinny`). | |||
| cinny_path_prefix: / | |||
| # Controls whether the self-check feature should validate SSL certificates. | |||
| cinny_self_check_validate_certificates: true | |||
| # Default homeserver URL to use in the `config.json` file. | |||
| # See `cinny_config_homeserverList`. | |||
| cinny_default_hs_url: "" | |||
| # Controls whether the Cinny access log is enabled | |||
| cinny_access_log_enabled: true | |||
| # Controls the `defaultHomeserver` value in the `config.json` file. | |||
| cinny_config_defaultHomeserver: 0 # noqa var-naming | |||
| # Controls the `homeserverList` value in the `config.json` file. | |||
| cinny_config_homeserverList: "{{ [cinny_default_hs_url] }}" # noqa var-naming | |||
| # Controls the `allowCustomHomeservers` value in the `config.json` file. | |||
| cinny_config_allowCustomHomeservers: true # noqa var-naming | |||
| # Controls the `featuredCommunities.spaces` value in the `config.json` file. | |||
| cinny_config_featuredCommunities_spaces: [] # noqa var-naming | |||
| # Controls the `featuredCommunities.rooms` value in the `config.json` file. | |||
| cinny_config_featuredCommunities_rooms: [] # noqa var-naming | |||
| # Controls the `featuredCommunities.servers` value in the `config.json` file. | |||
| cinny_config_featuredCommunities_servers: ["matrix.org"] # noqa var-naming | |||
| # Controls the `featuredCommunities.openAsDefault` value in the `config.json` file. | |||
| cinny_config_featuredCommunities_openAsDefault: false # noqa var-naming | |||
| # Default Cinny configuration template which covers the generic use case. | |||
| # You can customize it by controlling the various variables inside it. | |||
| # | |||
| # For a more advanced customization, you can extend the default (see `cinny_configuration_extension_json`) | |||
| # or completely replace this variable with your own template. | |||
| # | |||
| # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. | |||
| # This is unlike what it does when looking up YAML template files (no automatic parsing there). | |||
| cinny_configuration_default: "{{ lookup('template', 'templates/config.json.j2', convert_data=False) | from_json }}" | |||
| # Your custom JSON configuration for Cinny should go to `cinny_configuration_extension_json`. | |||
| # This configuration extends the default starting configuration (`cinny_configuration_default`). | |||
| # | |||
| # You can override individual variables from the default configuration, or introduce new ones. | |||
| # | |||
| # If you need something more special, you can take full control by | |||
| # completely redefining `cinny_configuration_default`. | |||
| cinny_configuration_extension_json: '{}' | |||
| cinny_configuration_extension: "{{ cinny_configuration_extension_json | from_json if cinny_configuration_extension_json | from_json is mapping else {} }}" | |||
| # Holds the final Cinny configuration (a combination of the default and its extension). | |||
| # You most likely don't need to touch this variable. Instead, see `cinny_configuration_default`. | |||
| cinny_configuration: "{{ cinny_configuration_default | combine(cinny_configuration_extension, recursive=True) }}" | |||
| @@ -1,32 +0,0 @@ | |||
| # SPDX-FileCopyrightText: 2022 - 2023 Slavi Pantaleev | |||
| # SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||
| # | |||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||
| --- | |||
| - tags: | |||
| - setup-all | |||
| - setup-client-cinny | |||
| - install-all | |||
| - install-client-cinny | |||
| block: | |||
| - when: cinny_enabled | bool | |||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" | |||
| - when: cinny_enabled | bool | |||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml" | |||
| - tags: | |||
| - setup-all | |||
| - setup-client-cinny | |||
| block: | |||
| - when: not cinny_enabled | bool | |||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" | |||
| - tags: | |||
| - self-check | |||
| block: | |||
| - when: cinny_enabled | bool | |||
| ansible.builtin.include_tasks: "{{ role_path }}/tasks/self_check.yml" | |||
| @@ -1,30 +0,0 @@ | |||
| # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev | |||
| # SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||
| # | |||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||
| --- | |||
| - ansible.builtin.set_fact: | |||
| cinny_url_endpoint_public: "{{ cinny_scheme }}://{{ cinny_hostname }}{{ cinny_path_prefix }}/config.json" | |||
| - name: Check Cinny | |||
| ansible.builtin.uri: | |||
| url: "{{ cinny_url_endpoint_public }}" | |||
| follow_redirects: none | |||
| validate_certs: "{{ cinny_self_check_validate_certificates }}" | |||
| register: cinny_self_check_result | |||
| check_mode: false | |||
| ignore_errors: true | |||
| delegate_to: 127.0.0.1 | |||
| become: false | |||
| - name: Fail if Cinny not working | |||
| ansible.builtin.fail: | |||
| msg: "Failed checking Cinny is up at `{{ cinny_hostname }}` (checked endpoint: `{{ cinny_url_endpoint_public }}`). Is Cinny running? Is port 443 open in your firewall? Full error: {{ cinny_self_check_result }}" | |||
| when: "cinny_self_check_result.failed or 'json' not in cinny_self_check_result" | |||
| - name: Report working Cinny | |||
| ansible.builtin.debug: | |||
| msg: "Cinny at `{{ cinny_hostname }}` is working (checked endpoint: `{{ cinny_url_endpoint_public }}`)" | |||
| @@ -1,87 +0,0 @@ | |||
| # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev | |||
| # SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||
| # SPDX-FileCopyrightText: 2022 Nikita Chernyi | |||
| # SPDX-FileCopyrightText: 2022 Sebastian Gumprich | |||
| # SPDX-FileCopyrightText: 2024 David Mehren | |||
| # | |||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||
| --- | |||
| - name: Ensure Cinny paths exists | |||
| ansible.builtin.file: | |||
| path: "{{ item.path }}" | |||
| state: directory | |||
| mode: 0750 | |||
| owner: "{{ matrix_user_name }}" | |||
| group: "{{ matrix_group_name }}" | |||
| with_items: | |||
| - {path: "{{ cinny_base_path }}", when: true} | |||
| - {path: "{{ cinny_docker_src_files_path }}", when: "{{ cinny_container_image_self_build }}"} | |||
| when: "item.when | bool" | |||
| - name: Ensure Cinny Docker image is pulled | |||
| community.docker.docker_image: | |||
| name: "{{ cinny_container_image }}" | |||
| source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | |||
| force_source: "{{ cinny_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | |||
| force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else cinny_container_image_force_pull }}" | |||
| when: "not cinny_container_image_self_build | bool" | |||
| register: result | |||
| retries: "{{ devture_playbook_help_container_retries_count }}" | |||
| delay: "{{ devture_playbook_help_container_retries_delay }}" | |||
| until: result is not failed | |||
| - name: Ensure Cinny repository is present on self-build | |||
| ansible.builtin.git: | |||
| repo: "{{ cinny_container_image_self_build_repo }}" | |||
| dest: "{{ cinny_docker_src_files_path }}" | |||
| version: "{{ cinny_container_image.split(':')[1] }}" | |||
| force: "yes" | |||
| become: true | |||
| become_user: "{{ matrix_user_name }}" | |||
| register: cinny_git_pull_results | |||
| when: "cinny_container_image_self_build | bool" | |||
| - name: Ensure Cinny configuration installed | |||
| ansible.builtin.copy: | |||
| content: "{{ cinny_configuration | to_nice_json }}" | |||
| dest: "{{ cinny_base_path }}/config.json" | |||
| mode: 0644 | |||
| owner: "{{ matrix_user_name }}" | |||
| group: "{{ matrix_group_name }}" | |||
| - name: Ensure Cinny additional config files installed | |||
| ansible.builtin.template: | |||
| src: "{{ item.src }}" | |||
| dest: "{{ cinny_base_path }}/{{ item.name }}" | |||
| mode: 0644 | |||
| owner: "{{ matrix_user_name }}" | |||
| group: "{{ matrix_group_name }}" | |||
| with_items: | |||
| - {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"} | |||
| - {src: "{{ role_path }}/templates/labels.j2", name: "labels"} | |||
| - name: Ensure Cinny Docker image is built | |||
| community.docker.docker_image: | |||
| name: "{{ cinny_container_image }}" | |||
| source: build | |||
| force_source: "{{ cinny_git_pull_results.changed }}" | |||
| build: | |||
| dockerfile: Dockerfile | |||
| path: "{{ cinny_docker_src_files_path }}" | |||
| pull: true | |||
| when: "cinny_container_image_self_build | bool" | |||
| - name: Ensure Cinny container network is created | |||
| community.general.docker_network: | |||
| enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" | |||
| name: "{{ cinny_container_network }}" | |||
| driver: bridge | |||
| driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" | |||
| - name: Ensure cinny.service installed | |||
| ansible.builtin.template: | |||
| src: "{{ role_path }}/templates/systemd/cinny.service.j2" | |||
| dest: "{{ devture_systemd_docker_base_systemd_path }}/cinny.service" | |||
| mode: 0644 | |||
| @@ -1,31 +0,0 @@ | |||
| # SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| # SPDX-FileCopyrightText: 2022 Marko Weltzer | |||
| # SPDX-FileCopyrightText: 2022 Sebastian Gumprich | |||
| # SPDX-FileCopyrightText: 2022 Slavi Pantaleev | |||
| # | |||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||
| --- | |||
| - name: Check existence of cinny.service | |||
| ansible.builtin.stat: | |||
| path: "{{ devture_systemd_docker_base_systemd_path }}/cinny.service" | |||
| register: cinny_service_stat | |||
| - when: cinny_service_stat.stat.exists | bool | |||
| block: | |||
| - name: Ensure cinny is stopped | |||
| ansible.builtin.service: | |||
| name: cinny | |||
| state: stopped | |||
| enabled: false | |||
| daemon_reload: true | |||
| - name: Ensure cinny.service doesn't exist | |||
| ansible.builtin.file: | |||
| path: "{{ devture_systemd_docker_base_systemd_path }}/cinny.service" | |||
| state: absent | |||
| - name: Ensure Cinny paths doesn't exist | |||
| ansible.builtin.file: | |||
| path: "{{ cinny_base_path }}" | |||
| state: absent | |||
| @@ -1,51 +0,0 @@ | |||
| # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev | |||
| # SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| # | |||
| # SPDX-License-Identifier: AGPL-3.0-or-later | |||
| --- | |||
| - name: Fail if required Cinny settings not defined | |||
| ansible.builtin.fail: | |||
| msg: > | |||
| You need to define a required configuration setting (`{{ item }}`) to use Cinny. | |||
| when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" | |||
| with_items: | |||
| - {'name': 'cinny_default_hs_url', when: true} | |||
| - {'name': 'cinny_container_network', when: true} | |||
| - {'name': 'cinny_container_labels_traefik_compression_middleware_name', when: "{{ cinny_container_labels_traefik_compression_middleware_enabled }}"} | |||
| - name: (Deprecation) Catch and report renamed Cinny variables | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| The variable `{{ item.old }}` is deprecated. Please use `{{ item.new }}` instead. | |||
| when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" | |||
| with_items: | |||
| - {'old': 'cinny_container_image_name_prefix', 'new': 'cinny_container_image_registry_prefix'} | |||
| - name: Fail if cinny_path_prefix is not / | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| `cinny_path_prefix` is set to `{{ cinny_path_prefix }}` in your configuration, but Cinny no longer supports hosting under a path prefix without an application rebuild. | |||
| Consider removing your `cinny_path_prefix` override and adjusting the Cinny hostname via `matrix_server_fqn_cinny` or `cinny_hostname`. | |||
| See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/3701 | |||
| when: "cinny_path_prefix != '/'" | |||
| - when: cinny_container_labels_traefik_enabled | bool | |||
| block: | |||
| - name: Fail if required cinny Traefik settings not defined | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| You need to define a required configuration setting (`{{ item }}`). | |||
| when: "lookup('vars', item, default='') == ''" | |||
| with_items: | |||
| - cinny_container_labels_traefik_hostname | |||
| - cinny_container_labels_traefik_path_prefix | |||
| # We ensure it doesn't end with a slash, because we handle both (slash and no-slash). | |||
| # Knowing that `cinny_container_labels_traefik_path_prefix` does not end with a slash | |||
| # ensures we know how to set these routes up without having to do "does it end with a slash" checks elsewhere. | |||
| - name: Fail if cinny_container_labels_traefik_path_prefix ends with a slash | |||
| ansible.builtin.fail: | |||
| msg: >- | |||
| cinny_container_labels_traefik_path_prefix (`{{ cinny_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/cinny`). | |||
| when: "cinny_container_labels_traefik_path_prefix != '/' and cinny_container_labels_traefik_path_prefix[-1] == '/'" | |||
| @@ -1,11 +0,0 @@ | |||
| { | |||
| "defaultHomeserver": {{ cinny_config_defaultHomeserver | to_json }}, | |||
| "homeserverList": {{ cinny_config_homeserverList | to_json }}, | |||
| "allowCustomHomeservers": {{ cinny_config_allowCustomHomeservers | to_json }}, | |||
| "featuredCommunities": { | |||
| "spaces": {{ cinny_config_featuredCommunities_spaces | to_json }}, | |||
| "rooms": {{ cinny_config_featuredCommunities_rooms | to_json }}, | |||
| "servers": {{ cinny_config_featuredCommunities_servers | to_json }}, | |||
| "openAsDefault": {{ cinny_config_featuredCommunities_openAsDefault | to_json }} | |||
| } | |||
| } | |||
| @@ -1,4 +0,0 @@ | |||
| SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| SPDX-FileCopyrightText: 2022 Slavi Pantaleev | |||
| SPDX-License-Identifier: AGPL-3.0-or-later | |||
| @@ -1,56 +0,0 @@ | |||
| {# | |||
| SPDX-FileCopyrightText: 2023 - 2024 Slavi Pantaleev | |||
| SPDX-License-Identifier: AGPL-3.0-or-later | |||
| #} | |||
| {% if cinny_container_labels_traefik_enabled %} | |||
| traefik.enable=true | |||
| {% if cinny_container_labels_traefik_docker_network %} | |||
| traefik.docker.network={{ cinny_container_labels_traefik_docker_network }} | |||
| {% endif %} | |||
| traefik.http.services.cinny.loadbalancer.server.port=8080 | |||
| {% set middlewares = [] %} | |||
| {% if cinny_container_labels_traefik_compression_middleware_enabled %} | |||
| {% set middlewares = middlewares + [cinny_container_labels_traefik_compression_middleware_name] %} | |||
| {% endif %} | |||
| {% if cinny_container_labels_traefik_path_prefix != '/' %} | |||
| traefik.http.middlewares.cinny-slashless-redirect.redirectregex.regex=({{ cinny_container_labels_traefik_path_prefix | quote }})$ | |||
| traefik.http.middlewares.cinny-slashless-redirect.redirectregex.replacement=${1}/ | |||
| {% set middlewares = middlewares + ['cinny-slashless-redirect'] %} | |||
| {% endif %} | |||
| {% if cinny_container_labels_traefik_path_prefix != '/' %} | |||
| traefik.http.middlewares.cinny-strip-prefix.stripprefix.prefixes={{ cinny_container_labels_traefik_path_prefix }} | |||
| {% set middlewares = middlewares + ['cinny-strip-prefix'] %} | |||
| {% endif %} | |||
| {% if cinny_container_labels_traefik_additional_response_headers.keys() | length > 0 %} | |||
| {% for name, value in cinny_container_labels_traefik_additional_response_headers.items() %} | |||
| traefik.http.middlewares.cinny-add-headers.headers.customresponseheaders.{{ name }}={{ value }} | |||
| {% endfor %} | |||
| {% set middlewares = middlewares + ['cinny-add-headers'] %} | |||
| {% endif %} | |||
| traefik.http.routers.cinny.rule={{ cinny_container_labels_traefik_rule }} | |||
| {% if cinny_container_labels_traefik_priority | int > 0 %} | |||
| traefik.http.routers.cinny.priority={{ cinny_container_labels_traefik_priority }} | |||
| {% endif %} | |||
| traefik.http.routers.cinny.service=cinny | |||
| {% if middlewares | length > 0 %} | |||
| traefik.http.routers.cinny.middlewares={{ middlewares | join(',') }} | |||
| {% endif %} | |||
| traefik.http.routers.cinny.entrypoints={{ cinny_container_labels_traefik_entrypoints }} | |||
| traefik.http.routers.cinny.tls={{ cinny_container_labels_traefik_tls | to_json }} | |||
| {% if cinny_container_labels_traefik_tls %} | |||
| traefik.http.routers.cinny.tls.certResolver={{ cinny_container_labels_traefik_tls_certResolver }} | |||
| {% endif %} | |||
| {% endif %} | |||
| {{ cinny_container_labels_additional_labels }} | |||
| @@ -1,75 +0,0 @@ | |||
| #jinja2: lstrip_blocks: True | |||
| # This is a custom nginx configuration file that we use in the container (instead of the default one), | |||
| # because it allows us to run nginx with a non-root user. | |||
| # | |||
| # For this to work, the default vhost file (`/etc/nginx/conf.d/default.conf`) also needs to be removed. | |||
| # (mounting `/dev/null` over `/etc/nginx/conf.d/default.conf` works well) | |||
| # | |||
| # The following changes have been done compared to a default nginx configuration file: | |||
| # - default server port is changed (80 -> 8080), so that a non-root user can bind it | |||
| # - various temp paths are changed to `/tmp`, so that a non-root user can write to them | |||
| # - the `user` directive was removed, as we don't want nginx to switch users | |||
| worker_processes 1; | |||
| error_log /var/log/nginx/error.log warn; | |||
| pid /tmp/nginx.pid; | |||
| events { | |||
| worker_connections 1024; | |||
| } | |||
| http { | |||
| proxy_temp_path /tmp/proxy_temp; | |||
| client_body_temp_path /tmp/client_temp; | |||
| fastcgi_temp_path /tmp/fastcgi_temp; | |||
| uwsgi_temp_path /tmp/uwsgi_temp; | |||
| scgi_temp_path /tmp/scgi_temp; | |||
| include /etc/nginx/mime.types; | |||
| default_type application/octet-stream; | |||
| log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |||
| '$status $body_bytes_sent "$http_referer" ' | |||
| '"$http_user_agent" "$http_x_forwarded_for"'; | |||
| {% if cinny_access_log_enabled %} | |||
| access_log /var/log/nginx/access.log main; | |||
| {% else %} | |||
| access_log off; | |||
| {% endif %} | |||
| sendfile on; | |||
| #tcp_nopush on; | |||
| keepalive_timeout 65; | |||
| #gzip on; | |||
| server { | |||
| listen 8080; | |||
| server_name localhost; | |||
| root /usr/share/nginx/html; | |||
| location / { | |||
| # Inspired by: https://raw.githubusercontent.com/cinnyapp/cinny/dev/docker-nginx.conf | |||
| root /usr/share/nginx/html; | |||
| rewrite ^/config.json$ /config.json break; | |||
| rewrite ^/manifest.json$ /manifest.json break; | |||
| rewrite ^.*/olm.wasm$ /olm.wasm break; | |||
| rewrite ^/sw.js$ /sw.js break; | |||
| rewrite ^/pdf.worker.min.js$ /pdf.worker.min.js break; | |||
| rewrite ^/public/(.*)$ /public/$1 break; | |||
| rewrite ^/assets/(.*)$ /assets/$1 break; | |||
| rewrite ^(.+)$ /index.html break; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,5 +0,0 @@ | |||
| SPDX-FileCopyrightText: 2019 - 2024 Slavi Pantaleev | |||
| SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| SPDX-FileCopyrightText: 2024 James Reilly | |||
| SPDX-License-Identifier: AGPL-3.0-or-later | |||
| @@ -1,50 +0,0 @@ | |||
| #jinja2: lstrip_blocks: True | |||
| [Unit] | |||
| Description=Matrix Cinny Client | |||
| {% for service in cinny_systemd_required_services_list %} | |||
| Requires={{ service }} | |||
| After={{ service }} | |||
| {% endfor %} | |||
| DefaultDependencies=no | |||
| [Service] | |||
| Type=simple | |||
| 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 -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} cinny 2>/dev/null || true' | |||
| ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm cinny 2>/dev/null || true' | |||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ | |||
| --rm \ | |||
| --name=cinny \ | |||
| --log-driver=none \ | |||
| --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ | |||
| --cap-drop=ALL \ | |||
| --read-only \ | |||
| --network={{ cinny_container_network }} \ | |||
| {% if cinny_container_http_host_bind_port %} | |||
| -p {{ cinny_container_http_host_bind_port }}:8080 \ | |||
| {% endif %} | |||
| --label-file={{ cinny_base_path }}/labels \ | |||
| --tmpfs=/tmp:rw,noexec,nosuid,size=10m \ | |||
| --mount type=bind,src={{ cinny_base_path }}/nginx.conf,dst=/etc/nginx/nginx.conf,ro \ | |||
| --mount type=bind,src={{ cinny_base_path }}/config.json,dst=/app/config.json,ro \ | |||
| {% for arg in cinny_container_extra_arguments %} | |||
| {{ arg }} \ | |||
| {% endfor %} | |||
| {{ cinny_container_image }} | |||
| {% for network in cinny_container_additional_networks %} | |||
| ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} cinny | |||
| {% endfor %} | |||
| ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach cinny | |||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} cinny 2>/dev/null || true' | |||
| ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm cinny 2>/dev/null || true' | |||
| Restart=always | |||
| RestartSec=30 | |||
| SyslogIdentifier=cinny | |||
| [Install] | |||
| WantedBy=multi-user.target | |||
| @@ -1,4 +0,0 @@ | |||
| SPDX-FileCopyrightText: 2022 - 2025 Slavi Pantaleev | |||
| SPDX-FileCopyrightText: 2022 MDAD project contributors | |||
| SPDX-License-Identifier: AGPL-3.0-or-later | |||