mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-10-21 22:04:15 +00:00
Containers are created with `--rm`, so Docker removes them asynchronously after they stop. The pre-start `docker rm` returns immediately while that removal is still in progress (its error is suppressed), and the following `docker create --name` can fail with "The container name ... is already in use". This is easy to hit since systemd_service_manager switched its default restart mode to `all-at-once`: many containers stop and start at the same time and Docker falls behind on removals. The playbook then fails at "Restart systemd services needing restart at once", even though the services recover on their own (`Restart=always`) a little later. The external roles (MASH, devture) were hardened against this in 2026-03 (see mother-of-all-self-hosting/ansible-role-valkey@0ba79c0), but the roles in `roles/custom` never were. This ports the same bounded cleanup loop to them: stop, force-remove, and wait until Docker releases the name, failing explicitly after a timeout. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
162 lines
9.1 KiB
YAML
162 lines
9.1 KiB
YAML
# SPDX-FileCopyrightText: 2023 - 2025 Slavi Pantaleev
|
|
# SPDX-FileCopyrightText: 2023 Benjamin Kampmann
|
|
# SPDX-FileCopyrightText: 2023 Samuel Meenzen
|
|
# SPDX-FileCopyrightText: 2024 - 2025 Suguru Hirahara
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
---
|
|
|
|
# rageshake is a bug report collection service
|
|
# 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
|
|
# renovate: datasource=docker depName=ghcr.io/matrix-org/rageshake
|
|
matrix_rageshake_version: 1.18.0
|
|
|
|
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_registry_prefix }}matrix-org/rageshake:{{ matrix_rageshake_container_image_tag }}"
|
|
matrix_rageshake_container_image_registry_prefix: "{{ 'localhost/' if matrix_rageshake_container_image_self_build else matrix_rageshake_container_image_registry_prefix_upstream }}"
|
|
matrix_rageshake_container_image_registry_prefix_upstream: "{{ matrix_rageshake_container_image_registry_prefix_upstream_default }}"
|
|
matrix_rageshake_container_image_registry_prefix_upstream_default: "ghcr.io/"
|
|
matrix_rageshake_container_image_tag: "{{ matrix_rageshake_version }}"
|
|
|
|
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: []
|
|
|
|
# Controls how long the pre-start cleanup should wait for stale container-name release
|
|
# before failing startup explicitly.
|
|
matrix_rageshake_container_cleanup_timeout_seconds: "{{ devture_systemd_docker_base_container_cleanup_timeout_seconds }}"
|
|
|
|
# Controls the delay between pre-start cleanup retries.
|
|
matrix_rageshake_container_cleanup_retry_delay_seconds: "{{ devture_systemd_docker_base_container_cleanup_retry_delay_seconds }}"
|
|
|
|
# Shell command used in the systemd pre-start phase to deterministically remove a stale
|
|
# container and wait until Docker releases its name.
|
|
matrix_rageshake_container_cleanup_command: |
|
|
i=0;
|
|
while [ "$i" -lt {{ matrix_rageshake_container_cleanup_timeout_seconds }} ]; do
|
|
{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-rageshake >/dev/null 2>&1 || true;
|
|
{{ devture_systemd_docker_base_host_command_docker }} rm -f matrix-rageshake >/dev/null 2>&1 || true;
|
|
if {{ devture_systemd_docker_base_host_command_docker }} container inspect matrix-rageshake >/dev/null 2>&1; then
|
|
i=$((i + 1));
|
|
sleep {{ matrix_rageshake_container_cleanup_retry_delay_seconds }};
|
|
continue;
|
|
fi;
|
|
if {{ devture_systemd_docker_base_host_command_docker }} info >/dev/null 2>&1; then
|
|
exit 0;
|
|
fi;
|
|
echo "Failed to query Docker daemon while cleaning up matrix-rageshake" >&2;
|
|
exit 1;
|
|
done;
|
|
echo "Failed to remove stale container matrix-rageshake after {{ matrix_rageshake_container_cleanup_timeout_seconds }} attempts" >&2;
|
|
exit 1
|
|
|
|
# List of systemd services that matrix-rageshake.service depends on
|
|
matrix_rageshake_systemd_required_services_list: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
|
|
|
|
# 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.yaml.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) }}"
|
|
|
|
# matrix_rageshake_restart_necessary controls whether the service
|
|
# will be restarted (when true) or merely started (when false) by the
|
|
# systemd service manager role (when conditional restart is enabled).
|
|
#
|
|
# This value is automatically computed during installation based on whether
|
|
# any configuration files, the systemd service file, or the container image changed.
|
|
# The default of `false` means "no restart needed" — appropriate when the role's
|
|
# installation tasks haven't run (e.g., due to --tags skipping them).
|
|
matrix_rageshake_restart_necessary: false
|