mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-10-20 21:34: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>
237 lines
12 KiB
YAML
237 lines
12 KiB
YAML
# SPDX-FileCopyrightText: 2022 - 2024 Nikita Chernyi
|
|
# SPDX-FileCopyrightText: 2022 - 2025 Slavi Pantaleev
|
|
# SPDX-FileCopyrightText: 2023 Samuel Meenzen
|
|
# SPDX-FileCopyrightText: 2024 Suguru Hirahara
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
---
|
|
|
|
# Buscarron is a Web forms (HTTP POST) to Matrix service.
|
|
# Project source code URL: https://github.com/etkecc/buscarron
|
|
|
|
matrix_bot_buscarron_enabled: true
|
|
|
|
# renovate: datasource=docker depName=ghcr.io/etkecc/buscarron
|
|
matrix_bot_buscarron_version: v1.5.0
|
|
|
|
# The hostname at which Buscarron is served.
|
|
matrix_bot_buscarron_hostname: ''
|
|
|
|
# The path at which Buscarron is exposed.
|
|
# This value must either be `/` or not end with a slash (e.g. `/buscarron`).
|
|
matrix_bot_buscarron_path_prefix: /
|
|
|
|
# The path at which Buscarron will expose metrics
|
|
# This value must either be `/` or not end with a slash (e.g. `/metrics`).
|
|
matrix_bot_buscarron_metrics_path: /metrics
|
|
|
|
matrix_bot_buscarron_base_path: "{{ matrix_base_data_path }}/buscarron"
|
|
matrix_bot_buscarron_config_path: "{{ matrix_bot_buscarron_base_path }}/config"
|
|
matrix_bot_buscarron_data_path: "{{ matrix_bot_buscarron_base_path }}/data"
|
|
matrix_bot_buscarron_data_store_path: "{{ matrix_bot_buscarron_data_path }}/store"
|
|
|
|
matrix_bot_buscarron_container_image_self_build: false
|
|
matrix_bot_buscarron_container_repo: "https://github.com/etkecc/buscarron.git"
|
|
matrix_bot_buscarron_container_repo_version: "{{ matrix_bot_buscarron_version }}"
|
|
matrix_bot_buscarron_container_src_files_path: "{{ matrix_base_data_path }}/buscarron/docker-src"
|
|
|
|
matrix_bot_buscarron_container_image: "{{ matrix_bot_buscarron_container_image_registry_prefix }}etkecc/buscarron:{{ matrix_bot_buscarron_version }}"
|
|
matrix_bot_buscarron_container_image_registry_prefix: "{{ 'localhost/' if matrix_bot_buscarron_container_image_self_build else matrix_bot_buscarron_container_image_registry_prefix_upstream }}"
|
|
matrix_bot_buscarron_container_image_registry_prefix_upstream: "{{ matrix_bot_buscarron_container_image_registry_prefix_upstream_default }}"
|
|
matrix_bot_buscarron_container_image_registry_prefix_upstream_default: "ghcr.io/"
|
|
|
|
# The base container network. It will be auto-created by this role if it doesn't exist already.
|
|
matrix_bot_buscarron_container_network: matrix-bot-buscarron
|
|
|
|
# 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_bot_buscarron_container_additional_networks: "{{ matrix_bot_buscarron_container_additional_networks_auto + matrix_bot_buscarron_container_additional_networks_custom }}"
|
|
matrix_bot_buscarron_container_additional_networks_auto: []
|
|
matrix_bot_buscarron_container_additional_networks_custom: []
|
|
|
|
# /metrics login
|
|
matrix_bot_buscarron_metrics_login: ''
|
|
# /metrics password
|
|
matrix_bot_buscarron_metrics_password: ''
|
|
# /metrics allowed ips
|
|
matrix_bot_buscarron_metrics_ips: []
|
|
|
|
# healthchecks.io integration
|
|
matrix_bot_buscarron_hc_url: '' # default is https://hc-ping.com (healthchecks.io)
|
|
matrix_bot_buscarron_hc_uuid: '' # check UUID
|
|
|
|
# redmine integration
|
|
matrix_bot_buscarron_redmine_host: '' # e.g. https://redmine.example.com
|
|
matrix_bot_buscarron_redmine_apikey: ''
|
|
matrix_bot_buscarron_redmine_project: '' # project identifier (e.g., my-project)
|
|
matrix_bot_buscarron_redmine_trackerid: '' # task tracker ID (e.g., 1)
|
|
matrix_bot_buscarron_redmine_statusid: '' # task status ID (e.g., 1)
|
|
|
|
|
|
# matrix_bot_buscarron_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_bot_buscarron_container_labels_additional_labels`.
|
|
matrix_bot_buscarron_container_labels_traefik_enabled: true
|
|
matrix_bot_buscarron_container_labels_traefik_docker_network: "{{ matrix_bot_buscarron_container_network }}"
|
|
matrix_bot_buscarron_container_labels_traefik_hostname: "{{ matrix_bot_buscarron_hostname }}"
|
|
# The path prefix must either be `/` or not end with a slash (e.g. `/buscarron`).
|
|
matrix_bot_buscarron_container_labels_traefik_path_prefix: "{{ matrix_bot_buscarron_path_prefix }}"
|
|
matrix_bot_buscarron_container_labels_traefik_rule: "Host(`{{ matrix_bot_buscarron_container_labels_traefik_hostname }}`){% if matrix_bot_buscarron_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_bot_buscarron_container_labels_traefik_path_prefix }}`){% endif %}"
|
|
matrix_bot_buscarron_container_labels_traefik_metrics_path: "{{ matrix_bot_buscarron_metrics_path }}"
|
|
matrix_bot_buscarron_container_labels_traefik_metrics_rule: "Host(`{{ matrix_bot_buscarron_container_labels_traefik_hostname }}`) && Path(`{{ matrix_bot_buscarron_container_labels_traefik_metrics_path }}`)"
|
|
matrix_bot_buscarron_container_labels_traefik_priority: 0
|
|
matrix_bot_buscarron_container_labels_traefik_entrypoints: web-secure
|
|
matrix_bot_buscarron_container_labels_traefik_tls: "{{ matrix_bot_buscarron_container_labels_traefik_entrypoints != 'web' }}"
|
|
matrix_bot_buscarron_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_bot_buscarron_container_labels_traefik_additional_response_headers_custom`
|
|
matrix_bot_buscarron_container_labels_traefik_additional_response_headers: "{{ matrix_bot_buscarron_container_labels_traefik_additional_response_headers_auto | combine(matrix_bot_buscarron_container_labels_traefik_additional_response_headers_custom) }}"
|
|
matrix_bot_buscarron_container_labels_traefik_additional_response_headers_auto: {}
|
|
matrix_bot_buscarron_container_labels_traefik_additional_response_headers_custom: {}
|
|
|
|
# matrix_bot_buscarron_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_bot_buscarron_container_labels_additional_labels: |
|
|
# my.label=1
|
|
# another.label="here"
|
|
matrix_bot_buscarron_container_labels_additional_labels: ''
|
|
|
|
# A list of extra arguments to pass to the container
|
|
matrix_bot_buscarron_container_extra_arguments: []
|
|
|
|
# Controls how long the pre-start cleanup should wait for stale container-name release
|
|
# before failing startup explicitly.
|
|
matrix_bot_buscarron_container_cleanup_timeout_seconds: "{{ devture_systemd_docker_base_container_cleanup_timeout_seconds }}"
|
|
|
|
# Controls the delay between pre-start cleanup retries.
|
|
matrix_bot_buscarron_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_bot_buscarron_container_cleanup_command: |
|
|
i=0;
|
|
while [ "$i" -lt {{ matrix_bot_buscarron_container_cleanup_timeout_seconds }} ]; do
|
|
{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-bot-buscarron >/dev/null 2>&1 || true;
|
|
{{ devture_systemd_docker_base_host_command_docker }} rm -f matrix-bot-buscarron >/dev/null 2>&1 || true;
|
|
if {{ devture_systemd_docker_base_host_command_docker }} container inspect matrix-bot-buscarron >/dev/null 2>&1; then
|
|
i=$((i + 1));
|
|
sleep {{ matrix_bot_buscarron_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-bot-buscarron" >&2;
|
|
exit 1;
|
|
done;
|
|
echo "Failed to remove stale container matrix-bot-buscarron after {{ matrix_bot_buscarron_container_cleanup_timeout_seconds }} attempts" >&2;
|
|
exit 1
|
|
|
|
# List of systemd services that matrix-bot-buscarron.service depends on
|
|
matrix_bot_buscarron_systemd_required_services_list: "{{ matrix_bot_buscarron_systemd_required_services_list_default + matrix_bot_buscarron_systemd_required_services_list_auto + matrix_bot_buscarron_systemd_required_services_list_custom }}"
|
|
matrix_bot_buscarron_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
|
|
matrix_bot_buscarron_systemd_required_services_list_auto: []
|
|
matrix_bot_buscarron_systemd_required_services_list_custom: []
|
|
|
|
# List of systemd services that matrix-bot-buscarron.service wants
|
|
matrix_bot_buscarron_systemd_wanted_services_list: []
|
|
|
|
|
|
# Database-related configuration fields.
|
|
#
|
|
# To use SQLite, stick to these defaults.
|
|
#
|
|
# To use Postgres:
|
|
# - change the engine (`matrix_bot_buscarron_database_engine: 'postgres'`)
|
|
# - adjust your database credentials via the `matrix_bot_buscarron_database_*` variables
|
|
matrix_bot_buscarron_database_engine: 'sqlite'
|
|
|
|
matrix_bot_buscarron_sqlite_database_path_local: "{{ matrix_bot_buscarron_data_path }}/bot.db"
|
|
matrix_bot_buscarron_sqlite_database_path_in_container: "/data/bot.db"
|
|
|
|
matrix_bot_buscarron_database_username: 'buscarron'
|
|
matrix_bot_buscarron_database_password: 'some-password'
|
|
matrix_bot_buscarron_database_hostname: ''
|
|
matrix_bot_buscarron_database_port: 5432
|
|
matrix_bot_buscarron_database_name: 'buscarron'
|
|
matrix_bot_buscarron_database_sslmode: disable
|
|
|
|
matrix_bot_buscarron_database_connection_string: 'postgres://{{ matrix_bot_buscarron_database_username }}:{{ matrix_bot_buscarron_database_password }}@{{ matrix_bot_buscarron_database_hostname }}:{{ matrix_bot_buscarron_database_port }}/{{ matrix_bot_buscarron_database_name }}?sslmode={{ matrix_bot_buscarron_database_sslmode }}'
|
|
|
|
matrix_bot_buscarron_storage_database: "{{ {
|
|
'sqlite': matrix_bot_buscarron_sqlite_database_path_in_container,
|
|
'postgres': matrix_bot_buscarron_database_connection_string,
|
|
}[matrix_bot_buscarron_database_engine] }}"
|
|
|
|
matrix_bot_buscarron_database_dialect: "{{ {
|
|
'sqlite': 'sqlite3',
|
|
'postgres': 'postgres',
|
|
}[matrix_bot_buscarron_database_engine] }}"
|
|
|
|
|
|
# The bot's username. This user needs to be created manually beforehand.
|
|
# Also see `matrix_bot_buscarron_password`.
|
|
matrix_bot_buscarron_login: "bot.buscarron"
|
|
|
|
# The password that the bot uses to authenticate.
|
|
matrix_bot_buscarron_password: ''
|
|
|
|
# the homeserver URL, uses internal synapse container address by default
|
|
matrix_bot_buscarron_homeserver: ""
|
|
|
|
# forms configuration
|
|
matrix_bot_buscarron_forms: []
|
|
|
|
# Sentry DSN
|
|
matrix_bot_buscarron_sentry: ''
|
|
|
|
# Log level
|
|
matrix_bot_buscarron_loglevel: INFO
|
|
|
|
# list of spammers with wildcards support, eg: *@spam.com spam@*, spam@spam.com
|
|
matrix_bot_buscarron_spamlist: []
|
|
|
|
# Banlist size
|
|
matrix_bot_buscarron_ban_size: 10000
|
|
|
|
# Permanent banlist
|
|
matrix_bot_buscarron_ban_list: []
|
|
|
|
# Postmark token (confirmation emails)
|
|
matrix_bot_buscarron_pm_token: ''
|
|
|
|
# Postmark sender signature
|
|
matrix_bot_buscarron_pm_from: ''
|
|
|
|
# Postmark confirmation email's reply-to
|
|
matrix_bot_buscarron_pm_replyto: ''
|
|
|
|
# email address (from) for SMTP validation. Must be valid email on valid SMTP server, otherwise it will be rejected by other servers
|
|
matrix_bot_buscarron_smtp_from: ''
|
|
|
|
# enforce SMTP validation
|
|
matrix_bot_buscarron_smtp_validation: false
|
|
|
|
# Additional environment variables to pass to the Buscarron container
|
|
#
|
|
# Example:
|
|
# matrix_bot_buscarron_environment_variables_extension: |
|
|
# BUSCARRON_LOGLEVEL=DEBUG
|
|
matrix_bot_buscarron_environment_variables_extension: ''
|
|
|
|
# matrix_bot_buscarron_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_bot_buscarron_restart_necessary: false
|