commit
c5dbeeae91
@ -0,0 +1,65 @@
|
|||||||
|
# Setting up Rageshake (optional)
|
||||||
|
|
||||||
|
The playbook can install and configure the [rageshake](https://github.com/matrix-org/rageshake) bug report server for you.
|
||||||
|
|
||||||
|
This is useful if you're developing your own applications and would like to collect bug reports for them.
|
||||||
|
|
||||||
|
|
||||||
|
## Decide on a domain and path
|
||||||
|
|
||||||
|
By default, Rageshake is configured to use its own dedicated domain (`rageshake.DOMAIN`) and requires you to [adjust your DNS records](#adjusting-dns-records).
|
||||||
|
|
||||||
|
You can override the domain and path like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Switch to the domain used for Matrix services (`matrix.DOMAIN`),
|
||||||
|
# so we won't need to an additional DNS records for Rageshake.
|
||||||
|
matrix_rageshake_hostname: "{{ matrix_server_fqn_matrix }}"
|
||||||
|
|
||||||
|
# Expose under the /rageshake subpath
|
||||||
|
matrix_rageshake_path_prefix: /rageshake
|
||||||
|
```
|
||||||
|
|
||||||
|
**NOTE**: When using `matrix-nginx-proxy` instead of Traefik, you won't be able to override the path prefix. You can only override the domain, but that needs to happen using another variable: `matrix_server_fqn_rageshake` (e.g. `matrix_server_fqn_rageshake: "some-domain.{{ matrix_domain }}"`).
|
||||||
|
|
||||||
|
|
||||||
|
## Adjusting DNS records
|
||||||
|
|
||||||
|
Once you've decided on the domain and path, **you may need to adjust your DNS** records to point the Rageshake domain to the Matrix server.
|
||||||
|
|
||||||
|
If you've decided to reuse the `matrix.` domain, you won't need to do any extra DNS configuration.
|
||||||
|
|
||||||
|
|
||||||
|
## Enabling the Rageshake service
|
||||||
|
|
||||||
|
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file (adapt to your needs):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
matrix_rageshake_enabled: true
|
||||||
|
```
|
||||||
|
|
||||||
|
Rageshake has various options which don't have dedicated Ansible variables. You can see the full list of options in the [`rageshake.sample.yaml` file](https://github.com/matrix-org/rageshake/blob/master/rageshake.sample.yaml).
|
||||||
|
|
||||||
|
To set these, you can make use of the `matrix_rageshake_configuration_extension_yaml` variable like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
matrix_rageshake_configuration_extension_yaml: |
|
||||||
|
github_token: secrettoken
|
||||||
|
|
||||||
|
github_project_mappings:
|
||||||
|
my-app: octocat/HelloWorld
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
After configuring the playbook, run the [installation](installing.md) command again:
|
||||||
|
|
||||||
|
```
|
||||||
|
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Refer to the [rageshake documentation](https://github.com/matrix-org/rageshake) for available APIs, etc.
|
@ -0,0 +1,100 @@
|
|||||||
|
#jinja2: lstrip_blocks: "True"
|
||||||
|
|
||||||
|
{% macro render_vhost_directives() %}
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain application/json application/javascript text/css image/x-icon font/ttf image/gif;
|
||||||
|
{% if matrix_nginx_proxy_hsts_preload_enabled %}
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
||||||
|
{% else %}
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||||
|
{% endif %}
|
||||||
|
add_header X-XSS-Protection "{{ matrix_nginx_proxy_xss_protection }}";
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
{% if matrix_nginx_proxy_floc_optout_enabled %}
|
||||||
|
add_header Permissions-Policy interest-cohort=() always;
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for configuration_block in matrix_nginx_proxy_proxy_rageshake_additional_server_configuration_blocks %}
|
||||||
|
{{- configuration_block }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
{% if matrix_nginx_proxy_enabled %}
|
||||||
|
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||||
|
resolver {{ matrix_nginx_proxy_http_level_resolver }} valid=5s;
|
||||||
|
set $backend "matrix-rageshake:9110";
|
||||||
|
proxy_pass http://$backend;
|
||||||
|
{% else %}
|
||||||
|
{# Generic configuration for use outside of our container setup #}
|
||||||
|
proxy_pass http://127.0.0.1:9110;
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For {{ matrix_nginx_proxy_x_forwarded_for }};
|
||||||
|
}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
|
||||||
|
listen [::]:{{ 8080 if matrix_nginx_proxy_enabled else 80 }};
|
||||||
|
|
||||||
|
server_name {{ matrix_nginx_proxy_proxy_rageshake_hostname }};
|
||||||
|
|
||||||
|
server_tokens off;
|
||||||
|
root /dev/null;
|
||||||
|
|
||||||
|
{% if matrix_nginx_proxy_https_enabled %}
|
||||||
|
location /.well-known/acme-challenge {
|
||||||
|
{% if matrix_nginx_proxy_enabled %}
|
||||||
|
{# Use the embedded DNS resolver in Docker containers to discover the service #}
|
||||||
|
resolver {{ matrix_nginx_proxy_http_level_resolver }} valid=5s;
|
||||||
|
set $backend "matrix-certbot:8080";
|
||||||
|
proxy_pass http://$backend;
|
||||||
|
{% else %}
|
||||||
|
{# Generic configuration for use outside of our container setup #}
|
||||||
|
proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$http_host$request_uri;
|
||||||
|
}
|
||||||
|
{% else %}
|
||||||
|
{{ render_vhost_directives() }}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
|
||||||
|
{% if matrix_nginx_proxy_https_enabled %}
|
||||||
|
server {
|
||||||
|
listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
|
||||||
|
listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
|
||||||
|
|
||||||
|
server_name {{ matrix_nginx_proxy_proxy_rageshake_hostname }};
|
||||||
|
|
||||||
|
server_tokens off;
|
||||||
|
root /dev/null;
|
||||||
|
|
||||||
|
ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_rageshake_hostname }}/fullchain.pem;
|
||||||
|
ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_rageshake_hostname }}/privkey.pem;
|
||||||
|
|
||||||
|
ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
|
||||||
|
{% if matrix_nginx_proxy_ssl_ciphers != '' %}
|
||||||
|
ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
|
||||||
|
{% endif %}
|
||||||
|
ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
|
||||||
|
|
||||||
|
{% if matrix_nginx_proxy_ocsp_stapling_enabled %}
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
|
ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_rageshake_hostname }}/chain.pem;
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if matrix_nginx_proxy_ssl_session_tickets_off %}
|
||||||
|
ssl_session_tickets off;
|
||||||
|
{% endif %}
|
||||||
|
ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
|
||||||
|
ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
|
||||||
|
|
||||||
|
{{ render_vhost_directives() }}
|
||||||
|
}
|
||||||
|
{% endif %}
|
@ -0,0 +1,114 @@
|
|||||||
|
---
|
||||||
|
# rageshake is a issue submission service from matrix.org
|
||||||
|
# Project source code URL: https://github.com/matrix-org/rageshake/
|
||||||
|
|
||||||
|
matrix_rageshake_enabled: true
|
||||||
|
|
||||||
|
matrix_rageshake_scheme: https
|
||||||
|
|
||||||
|
# The hostname at which rageshake is served.
|
||||||
|
matrix_rageshake_hostname: ''
|
||||||
|
|
||||||
|
# The path at which rageshake is exposed.
|
||||||
|
# This value must either be `/` or not end with a slash (e.g. `/rageshake`).
|
||||||
|
matrix_rageshake_path_prefix: /
|
||||||
|
|
||||||
|
# There are no stable container image tags yet.
|
||||||
|
# See: https://github.com/matrix-org/rageshake/issues/69
|
||||||
|
matrix_rageshake_version: "master"
|
||||||
|
|
||||||
|
matrix_rageshake_base_path: "{{ matrix_base_data_path }}/rageshake"
|
||||||
|
matrix_rageshake_config_path: "{{ matrix_rageshake_base_path }}/config"
|
||||||
|
matrix_rageshake_data_path: "{{ matrix_rageshake_base_path }}/data"
|
||||||
|
matrix_rageshake_container_src_files_path: "{{ matrix_rageshake_base_path }}/container-src"
|
||||||
|
|
||||||
|
matrix_rageshake_container_image: "{{ matrix_rageshake_container_image_name_prefix }}matrix-org/rageshake:{{ matrix_rageshake_container_image_tag }}"
|
||||||
|
matrix_rageshake_container_image_name_prefix: "{{ 'localhost/' if matrix_rageshake_container_image_self_build else matrix_rageshake_container_registry_prefix }}"
|
||||||
|
matrix_rageshake_container_image_force_pull: "{{ matrix_rageshake_container_image.endswith(':master') }}"
|
||||||
|
matrix_rageshake_container_image_tag: "{{ matrix_rageshake_version }}"
|
||||||
|
matrix_rageshake_container_registry_prefix: ghcr.io/
|
||||||
|
|
||||||
|
matrix_rageshake_container_image_self_build: false
|
||||||
|
matrix_rageshake_container_image_self_build_repo: "https://github.com/matrix-org/rageshake/"
|
||||||
|
matrix_rageshake_container_image_self_build_repo_version: "{{ matrix_rageshake_version }}"
|
||||||
|
|
||||||
|
# Controls whether the container exposes its HTTP port (tcp/9110 in the container).
|
||||||
|
#
|
||||||
|
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9110"), or empty string to not expose.
|
||||||
|
matrix_rageshake_container_http_host_bind_port: ''
|
||||||
|
|
||||||
|
# The base container network. It will be auto-created by this role if it doesn't exist already.
|
||||||
|
matrix_rageshake_container_network: matrix-rageshake
|
||||||
|
|
||||||
|
# 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_rageshake_container_additional_networks: []
|
||||||
|
|
||||||
|
# matrix_rageshake_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 `matrix_rageshake_container_labels_additional_labels`.
|
||||||
|
matrix_rageshake_container_labels_traefik_enabled: true
|
||||||
|
matrix_rageshake_container_labels_traefik_docker_network: "{{ matrix_rageshake_container_network }}"
|
||||||
|
matrix_rageshake_container_labels_traefik_hostname: "{{ matrix_rageshake_hostname }}"
|
||||||
|
# The path prefix must either be `/` or not end with a slash (e.g. `/rageshake`).
|
||||||
|
matrix_rageshake_container_labels_traefik_path_prefix: "{{ matrix_rageshake_path_prefix }}"
|
||||||
|
matrix_rageshake_container_labels_traefik_rule: "Host(`{{ matrix_rageshake_container_labels_traefik_hostname }}`){% if matrix_rageshake_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_rageshake_container_labels_traefik_path_prefix }}`){% endif %}"
|
||||||
|
matrix_rageshake_container_labels_traefik_priority: 0
|
||||||
|
matrix_rageshake_container_labels_traefik_entrypoints: web-secure
|
||||||
|
matrix_rageshake_container_labels_traefik_tls: "{{ matrix_rageshake_container_labels_traefik_entrypoints != 'web' }}"
|
||||||
|
matrix_rageshake_container_labels_traefik_tls_certResolver: default # noqa var-naming
|
||||||
|
|
||||||
|
# Controls which additional headers to attach to all HTTP responses.
|
||||||
|
# To add your own headers, use `matrix_rageshake_container_labels_traefik_additional_response_headers_custom`
|
||||||
|
matrix_rageshake_container_labels_traefik_additional_response_headers: "{{ matrix_rageshake_container_labels_traefik_additional_response_headers_auto | combine(matrix_rageshake_container_labels_traefik_additional_response_headers_custom) }}"
|
||||||
|
matrix_rageshake_container_labels_traefik_additional_response_headers_auto: {}
|
||||||
|
matrix_rageshake_container_labels_traefik_additional_response_headers_custom: {}
|
||||||
|
|
||||||
|
# matrix_rageshake_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:
|
||||||
|
# matrix_rageshake_container_labels_additional_labels: |
|
||||||
|
# my.label=1
|
||||||
|
# another.label="here"
|
||||||
|
matrix_rageshake_container_labels_additional_labels: ''
|
||||||
|
|
||||||
|
# A list of extra arguments to pass to the container
|
||||||
|
matrix_rageshake_container_extra_arguments: []
|
||||||
|
|
||||||
|
# List of systemd services that matrix-rageshake.service depends on
|
||||||
|
matrix_rageshake_systemd_required_services_list: ["docker.service"]
|
||||||
|
|
||||||
|
# List of systemd services that matrix-rageshake.service wants
|
||||||
|
matrix_rageshake_systemd_wanted_services_list: []
|
||||||
|
|
||||||
|
matrix_rageshake_config_api_prefix: "{{ matrix_rageshake_scheme }}://{{ matrix_rageshake_hostname }}{{ matrix_rageshake_path_prefix }}{{ '' if matrix_rageshake_path_prefix == '/' else '/' }}api/"
|
||||||
|
|
||||||
|
# Default Rageshake 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 `matrix_rageshake_configuration_extension_yaml`)
|
||||||
|
# or completely replace this variable with your own template.
|
||||||
|
matrix_rageshake_configuration_yaml: "{{ lookup('template', 'templates/config.yml.j2') }}"
|
||||||
|
|
||||||
|
matrix_rageshake_configuration_extension_yaml: |
|
||||||
|
# Your custom YAML configuration for Synapse goes here.
|
||||||
|
# This configuration extends the default starting configuration (`matrix_rageshake_configuration_yaml`).
|
||||||
|
#
|
||||||
|
# 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 `matrix_rageshake_configuration_yaml`.
|
||||||
|
#
|
||||||
|
# Example configuration extension follows:
|
||||||
|
#
|
||||||
|
# github_project_mappings:
|
||||||
|
# my-app: octocat/HelloWorld
|
||||||
|
|
||||||
|
matrix_rageshake_configuration_extension: "{{ matrix_rageshake_configuration_extension_yaml | from_yaml if matrix_rageshake_configuration_extension_yaml | from_yaml is mapping else {} }}"
|
||||||
|
|
||||||
|
# Holds the final Synapse configuration (a combination of the default and its extension).
|
||||||
|
# You most likely don't need to touch this variable. Instead, see `matrix_rageshake_configuration_yaml`.
|
||||||
|
matrix_rageshake_configuration: "{{ matrix_rageshake_configuration_yaml | from_yaml | combine(matrix_rageshake_configuration_extension, recursive=True) }}"
|
@ -0,0 +1,76 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure rageshake paths exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0750
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_groupname }}"
|
||||||
|
with_items:
|
||||||
|
- path: "{{ matrix_rageshake_config_path }}"
|
||||||
|
when: true
|
||||||
|
- path: "{{ matrix_rageshake_data_path }}"
|
||||||
|
when: true
|
||||||
|
- path: "{{ matrix_rageshake_container_src_files_path }}"
|
||||||
|
when: matrix_rageshake_container_image_self_build | bool
|
||||||
|
when: "item.when | bool"
|
||||||
|
|
||||||
|
- name: Ensure rageshake config file created
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ matrix_rageshake_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||||
|
dest: "{{ matrix_rageshake_config_path }}/config.yml"
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_groupname }}"
|
||||||
|
mode: 0640
|
||||||
|
|
||||||
|
- name: Ensure rageshake labels installed
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ role_path }}/templates/labels.j2"
|
||||||
|
dest: "{{ matrix_rageshake_base_path }}/labels"
|
||||||
|
mode: 0640
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_groupname }}"
|
||||||
|
|
||||||
|
- name: Ensure rageshake image is pulled
|
||||||
|
community.docker.docker_image:
|
||||||
|
name: "{{ matrix_rageshake_container_image }}"
|
||||||
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||||
|
force_source: "{{ matrix_rageshake_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 matrix_rageshake_container_image_force_pull }}"
|
||||||
|
when: "not matrix_rageshake_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 rageshake repository is present on self-build
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: "{{ matrix_rageshake_container_image_self_build_repo }}"
|
||||||
|
version: "{{ matrix_rageshake_container_image_self_build_version }}"
|
||||||
|
dest: "{{ matrix_rageshake_container_src_files_path }}"
|
||||||
|
force: "yes"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ matrix_user_username }}"
|
||||||
|
register: matrix_rageshake_git_pull_results
|
||||||
|
when: "matrix_rageshake_container_image_self_build | bool"
|
||||||
|
|
||||||
|
- name: Ensure rageshake container image is built
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: |-
|
||||||
|
{{ devture_systemd_docker_base_host_command_docker }} buildx build
|
||||||
|
--tag={{ matrix_rageshake_container_image }}
|
||||||
|
--file={{ matrix_rageshake_container_src_files_path }}/Dockerfile
|
||||||
|
{{ matrix_rageshake_container_src_files_path }}
|
||||||
|
when: matrix_rageshake_container_image_self_build | bool
|
||||||
|
|
||||||
|
- name: Ensure rageshake container network is created
|
||||||
|
community.general.docker_network:
|
||||||
|
name: "{{ matrix_rageshake_container_network }}"
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
- name: Ensure matrix-rageshake.service installed
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ role_path }}/templates/systemd/matrix-rageshake.service.j2"
|
||||||
|
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rageshake.service"
|
||||||
|
mode: 0644
|
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
- block:
|
||||||
|
- when: matrix_rageshake_enabled | bool
|
||||||
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||||
|
|
||||||
|
- when: matrix_rageshake_enabled | bool
|
||||||
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-rageshake
|
||||||
|
- install-all
|
||||||
|
- install-rageshake
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- when: not matrix_rageshake_enabled | bool
|
||||||
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-rageshake
|
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Check existence of matrix-rageshake service
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rageshake.service"
|
||||||
|
register: matrix_rageshake_service_stat
|
||||||
|
|
||||||
|
- when: matrix_rageshake_service_stat.stat.exists | bool
|
||||||
|
block:
|
||||||
|
- name: Ensure matrix-rageshake is stopped
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: matrix-rageshake
|
||||||
|
state: stopped
|
||||||
|
enabled: false
|
||||||
|
daemon_reload: true
|
||||||
|
|
||||||
|
- name: Ensure matrix-rageshake.service doesn't exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rageshake.service"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Ensure rageshake paths don't exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ matrix_rageshake_base_path }}"
|
||||||
|
state: absent
|
@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Fail if required rageshake settings not defined
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >
|
||||||
|
You need to define a required configuration setting (`{{ item }}`).
|
||||||
|
when: "vars[item] == ''"
|
||||||
|
with_items:
|
||||||
|
- matrix_rageshake_hostname
|
||||||
|
- matrix_rageshake_path_prefix
|
||||||
|
- matrix_rageshake_container_network
|
||||||
|
|
||||||
|
- when: matrix_rageshake_container_labels_traefik_enabled | bool
|
||||||
|
block:
|
||||||
|
- name: Fail if required rageshake Traefik settings not defined
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >-
|
||||||
|
You need to define a required configuration setting (`{{ item }}`).
|
||||||
|
when: "vars[item] == ''"
|
||||||
|
with_items:
|
||||||
|
- matrix_rageshake_container_labels_traefik_hostname
|
||||||
|
- matrix_rageshake_container_labels_traefik_path_prefix
|
||||||
|
|
||||||
|
# We ensure it doesn't end with a slash, because we handle both (slash and no-slash).
|
||||||
|
# Knowing that `matrix_rageshake_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 matrix_rageshake_container_labels_traefik_path_prefix ends with a slash
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >-
|
||||||
|
matrix_rageshake_container_labels_traefik_path_prefix (`{{ matrix_rageshake_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/rageshake`).
|
||||||
|
when: "matrix_rageshake_container_labels_traefik_path_prefix != '/' and matrix_rageshake_container_labels_traefik_path_prefix[-1] == '/'"
|
@ -0,0 +1,4 @@
|
|||||||
|
# Default configuration for Rageshake.
|
||||||
|
# To extend it, use `matrix_rageshake_configuration_extension_yaml`.
|
||||||
|
|
||||||
|
api_prefix: {{ matrix_rageshake_config_api_prefix | to_json }}
|
@ -0,0 +1,45 @@
|
|||||||
|
{% if matrix_rageshake_container_labels_traefik_enabled %}
|
||||||
|
traefik.enable=true
|
||||||
|
|
||||||
|
{% if matrix_rageshake_container_labels_traefik_docker_network %}
|
||||||
|
traefik.docker.network={{ matrix_rageshake_container_labels_traefik_docker_network }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set middlewares = [] %}
|
||||||
|
|
||||||
|
{% if matrix_rageshake_container_labels_traefik_path_prefix != '/' %}
|
||||||
|
traefik.http.middlewares.matrix-rageshake-slashless-redirect.redirectregex.regex=({{ matrix_rageshake_container_labels_traefik_path_prefix | quote }})$
|
||||||
|
traefik.http.middlewares.matrix-rageshake-slashless-redirect.redirectregex.replacement=${1}/
|
||||||
|
{% set middlewares = middlewares + ['matrix-rageshake-slashless-redirect'] %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if matrix_rageshake_container_labels_traefik_path_prefix != '/' %}
|
||||||
|
traefik.http.middlewares.matrix-rageshake-strip-prefix.stripprefix.prefixes={{ matrix_rageshake_container_labels_traefik_path_prefix }}
|
||||||
|
{% set middlewares = middlewares + ['matrix-rageshake-strip-prefix'] %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if matrix_rageshake_container_labels_traefik_additional_response_headers.keys() | length > 0 %}
|
||||||
|
{% for name, value in matrix_rageshake_container_labels_traefik_additional_response_headers.items() %}
|
||||||
|
traefik.http.middlewares.matrix-rageshake-add-headers.headers.customresponseheaders.{{ name }}={{ value }}
|
||||||
|
{% endfor %}
|
||||||
|
{% set middlewares = middlewares + ['matrix-rageshake-add-headers'] %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
traefik.http.routers.matrix-rageshake.rule={{ matrix_rageshake_container_labels_traefik_rule }}
|
||||||
|
{% if matrix_rageshake_container_labels_traefik_priority | int > 0 %}
|
||||||
|
traefik.http.routers.matrix-rageshake.priority={{ matrix_rageshake_container_labels_traefik_priority }}
|
||||||
|
{% endif %}
|
||||||
|
traefik.http.routers.matrix-rageshake.service=matrix-rageshake
|
||||||
|
{% if middlewares | length > 0 %}
|
||||||
|
traefik.http.routers.matrix-rageshake.middlewares={{ middlewares | join(',') }}
|
||||||
|
{% endif %}
|
||||||
|
traefik.http.routers.matrix-rageshake.entrypoints={{ matrix_rageshake_container_labels_traefik_entrypoints }}
|
||||||
|
traefik.http.routers.matrix-rageshake.tls={{ matrix_rageshake_container_labels_traefik_tls | to_json }}
|
||||||
|
{% if matrix_rageshake_container_labels_traefik_tls %}
|
||||||
|
traefik.http.routers.matrix-rageshake.tls.certResolver={{ matrix_rageshake_container_labels_traefik_tls_certResolver }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
traefik.http.services.matrix-rageshake.loadbalancer.server.port=9110
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ matrix_rageshake_container_labels_additional_labels }}
|
@ -0,0 +1,51 @@
|
|||||||
|
#jinja2: lstrip_blocks: "True"
|
||||||
|
[Unit]
|
||||||
|
Description=Matrix Rageshake Service
|
||||||
|
{% for service in matrix_rageshake_systemd_required_services_list %}
|
||||||
|
Requires={{ service }}
|
||||||
|
After={{ service }}
|
||||||
|
{% endfor %}
|
||||||
|
{% for service in matrix_rageshake_systemd_wanted_services_list %}
|
||||||
|
Wants={{ 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 }} kill matrix-rageshake 2>/dev/null || true'
|
||||||
|
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-rageshake 2>/dev/null || true'
|
||||||
|
|
||||||
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||||||
|
--rm \
|
||||||
|
--name=matrix-rageshake \
|
||||||
|
--log-driver=none \
|
||||||
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||||
|
--cap-drop=ALL \
|
||||||
|
--read-only \
|
||||||
|
--tmpfs /tmp \
|
||||||
|
--network={{ matrix_rageshake_container_network }} \
|
||||||
|
--mount type=bind,src={{ matrix_rageshake_config_path }},dst=/config \
|
||||||
|
--mount type=bind,src={{ matrix_rageshake_data_path }},dst=/bugs \
|
||||||
|
--label-file={{ matrix_rageshake_base_path }}/labels \
|
||||||
|
{% for arg in matrix_rageshake_container_extra_arguments %}
|
||||||
|
{{ arg }} \
|
||||||
|
{% endfor %}
|
||||||
|
{{ matrix_rageshake_container_image }} \
|
||||||
|
--config /config/config.yml
|
||||||
|
|
||||||
|
{% for network in matrix_rageshake_container_additional_networks %}
|
||||||
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-rageshake
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-rageshake
|
||||||
|
|
||||||
|
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-rageshake 2>/dev/null || true'
|
||||||
|
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-rageshake 2>/dev/null || true'
|
||||||
|
|
||||||
|
Restart=always
|
||||||
|
RestartSec=30
|
||||||
|
SyslogIdentifier=matrix-rageshake
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in new issue