Add support for baibot
Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/3369
This commit is contained in:
429
roles/custom/matrix-bot-baibot/defaults/main.yml
Normal file
429
roles/custom/matrix-bot-baibot/defaults/main.yml
Normal file
@ -0,0 +1,429 @@
|
||||
---
|
||||
|
||||
# baibot is a bot exposing the power of Large Language Models to you.
|
||||
# Project source code URL: https://github.com/etkecc/baibot
|
||||
|
||||
matrix_bot_baibot_enabled: true
|
||||
|
||||
matrix_bot_baibot_container_image_self_build: false
|
||||
matrix_bot_baibot_container_repo: "https://github.com/etkecc/baibot.git"
|
||||
matrix_bot_baibot_container_repo_version: "{{ 'main' if matrix_bot_baibot_version == 'latest' else matrix_bot_baibot_version }}"
|
||||
matrix_bot_baibot_container_src_files_path: "{{ matrix_base_data_path }}/baibot/container-src"
|
||||
|
||||
# renovate: datasource=docker depName=ghcr.io/etkecc/baibot
|
||||
matrix_bot_baibot_version: latest
|
||||
matrix_bot_baibot_container_image: "{{ matrix_bot_baibot_container_image_name_prefix }}etkecc/baibot:{{ matrix_bot_baibot_version }}"
|
||||
matrix_bot_baibot_container_image_name_prefix: "{{ 'localhost/' if matrix_bot_baibot_container_image_self_build else 'ghcr.io/' }}"
|
||||
matrix_bot_baibot_container_image_force_pull: "{{ matrix_bot_baibot_container_image.endswith(':latest') }}"
|
||||
|
||||
matrix_bot_baibot_base_path: "{{ matrix_base_data_path }}/baibot"
|
||||
matrix_bot_baibot_config_path: "{{ matrix_bot_baibot_base_path }}/config"
|
||||
matrix_bot_baibot_data_path: "{{ matrix_bot_baibot_base_path }}/data"
|
||||
|
||||
matrix_bot_baibot_container_network: ""
|
||||
|
||||
matrix_bot_baibot_container_additional_networks: "{{ matrix_bot_baibot_container_additional_networks_auto + matrix_bot_baibot_container_additional_networks_custom }}"
|
||||
matrix_bot_baibot_container_additional_networks_auto: []
|
||||
matrix_bot_baibot_container_additional_networks_custom: []
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_bot_baibot_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-bot-baibot.service depends on
|
||||
matrix_bot_baibot_systemd_required_services_list: "{{ matrix_bot_baibot_systemd_required_services_list_default + matrix_bot_baibot_systemd_required_services_list_auto + matrix_bot_baibot_systemd_required_services_list_custom }}"
|
||||
matrix_bot_baibot_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
|
||||
matrix_bot_baibot_systemd_required_services_list_auto: []
|
||||
matrix_bot_baibot_systemd_required_services_list_custom: []
|
||||
|
||||
# List of systemd services that matrix-bot-baibot.service wants
|
||||
matrix_bot_baibot_systemd_wanted_services_list: []
|
||||
|
||||
# Controls the `homeserver.server_name` configuration setting.
|
||||
matrix_bot_baibot_config_homeserver_server_name: "{{ matrix_domain }}"
|
||||
|
||||
# Controls the `homeserver.url` configuration setting.
|
||||
matrix_bot_baibot_config_homeserver_url: ""
|
||||
|
||||
# Controls the `user.mxid_localpart` configuration setting.
|
||||
#
|
||||
# This affects the bot's username.
|
||||
# Changing this subsequently will require you to drop the bot's session/database (see `matrix_bot_baibot_data_path`),
|
||||
# so it can start fresh.
|
||||
matrix_bot_baibot_config_user_mxid_localpart: baibot
|
||||
|
||||
# Controls the `user.password` configuration setting.
|
||||
matrix_bot_baibot_config_user_password: ''
|
||||
|
||||
# Controls the `user.name` configuration setting.
|
||||
#
|
||||
# The name the bot uses as a display name and when it refers to itself.
|
||||
# If you leave this empty, the bot will use the default (baibot).
|
||||
#
|
||||
# Also see: `matrix_bot_baibot_config_user_mxid_localpart`
|
||||
matrix_bot_baibot_config_user_name: baibot
|
||||
|
||||
# Controls the `user.encryption.recovery_passphrase` configuration setting.
|
||||
#
|
||||
# An optional passphrase to use for backing up and recovering the bot's encryption keys.
|
||||
# You can use any string here.
|
||||
#
|
||||
# If left empty, the recovery module will not be used and losing your session/database (see persistence)
|
||||
# will mean you lose access to old messages in encrypted room.
|
||||
#
|
||||
# Changing this subsequently will also cause you to lose access to old messages in encrypted rooms.
|
||||
# If you really need to change this:
|
||||
# - Set `matrix_bot_baibot_config_user_encryption_recovery_reset_allowed` to `true` and adjust the passphrase
|
||||
# - Remove your session file and database (see persistence)
|
||||
# - Restart the bot
|
||||
# - Then restore `matrix_bot_baibot_config_user_encryption_recovery_reset_allowed` to `false` to prevent accidental resets in the future
|
||||
matrix_bot_baibot_config_user_encryption_recovery_passphrase: null
|
||||
|
||||
# Controls the `user.encryption.recovery_passphrase` configuration setting.
|
||||
#
|
||||
# An optional flag to reset the encryption recovery passphrase (see `matrix_bot_baibot_config_user_encryption_recovery_passphrase`).
|
||||
matrix_bot_baibot_config_user_encryption_recovery_reset_allowed: false
|
||||
|
||||
# Controls the `command_prefix` configuration setting.
|
||||
# If you leave this empty, the bot will use the default (!bai).
|
||||
matrix_bot_baibot_config_command_prefix: "!bai"
|
||||
|
||||
# Controls the `access.admin_patterns` configuration setting.
|
||||
# A space-separated list of MXID patterns which specify who is an admin.
|
||||
#
|
||||
# Example:
|
||||
# matrix_bot_baibot_config_access_admin_patterns:
|
||||
# - "@*:example.com"
|
||||
# - "@admin:another.com"
|
||||
matrix_bot_baibot_config_access_admin_patterns: "{{ [matrix_admin] if matrix_admin else [] }}"
|
||||
|
||||
# Controls the `persistence.data_dir_path` configuration setting.
|
||||
#
|
||||
# The bot runs in a container, so this is the in-container path referring to the data directory on the host
|
||||
# (see `matrix_bot_baibot_data_path`).
|
||||
#
|
||||
# You generally don't need to change this.
|
||||
matrix_bot_baibot_config_persistence_data_dir_path: /data
|
||||
|
||||
# Controls the `persistence.session_encryption_key` configuration setting.
|
||||
#
|
||||
# An optional secret for encrypting the bot's session data (see `matrix_bot_baibot_data_path`).
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently requires that you also throw away all data (see `matrix_bot_baibot_data_path`)
|
||||
matrix_bot_baibot_config_persistence_session_encryption_key: null
|
||||
|
||||
# Controls the `persistence.config_encryption_key` configuration setting.
|
||||
#
|
||||
# An optional secret for encrypting bot configuration stored in Matrix's account data.
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently will make you lose your configuration.
|
||||
matrix_bot_baibot_config_persistence_config_encryption_key: null
|
||||
|
||||
# Controls the `agents.static_definitions` configuration setting.
|
||||
#
|
||||
# There are some presets (e.g. `matrix_bot_baibot_config_agents_static_definitions_openai_*`) you can easily use to get started with a given provider.
|
||||
# You can also define your own agents via `matrix_bot_baibot_config_agents_static_definitions_custom`.
|
||||
matrix_bot_baibot_config_agents_static_definitions: "{{ matrix_bot_baibot_config_agents_static_definitions_auto + matrix_bot_baibot_config_agents_static_definitions_custom }}"
|
||||
matrix_bot_baibot_config_agents_static_definitions_auto: |-
|
||||
{{
|
||||
([{
|
||||
'id': matrix_bot_baibot_config_agents_static_definitions_anthropic_id,
|
||||
'provider': matrix_bot_baibot_config_agents_static_definitions_anthropic_provider,
|
||||
'config': matrix_bot_baibot_config_agents_static_definitions_anthropic_config,
|
||||
}] if matrix_bot_baibot_config_agents_static_definitions_anthropic_enabled else [])
|
||||
+
|
||||
([{
|
||||
'id': matrix_bot_baibot_config_agents_static_definitions_groq_id,
|
||||
'provider': matrix_bot_baibot_config_agents_static_definitions_groq_provider,
|
||||
'config': matrix_bot_baibot_config_agents_static_definitions_groq_config,
|
||||
}] if matrix_bot_baibot_config_agents_static_definitions_groq_enabled else [])
|
||||
+
|
||||
([{
|
||||
'id': matrix_bot_baibot_config_agents_static_definitions_openai_id,
|
||||
'provider': matrix_bot_baibot_config_agents_static_definitions_openai_provider,
|
||||
'config': matrix_bot_baibot_config_agents_static_definitions_openai_config,
|
||||
}] if matrix_bot_baibot_config_agents_static_definitions_openai_enabled else [])
|
||||
}}
|
||||
matrix_bot_baibot_config_agents_static_definitions_custom: []
|
||||
|
||||
|
||||
########################################################################################
|
||||
# #
|
||||
# Anthropic agent configuration #
|
||||
# #
|
||||
########################################################################################
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_enabled: false
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_id: anthropic
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_provider: anthropic
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config: "{{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_yaml | from_yaml | combine(matrix_bot_baibot_config_agents_static_definitions_anthropic_config_extension, recursive=True)}}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_yaml: "{{ lookup('template', 'templates/provider/anthropic-config.yml.j2') }}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_extension: "{{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_extension_yaml | from_yaml if matrix_bot_baibot_config_agents_static_definitions_anthropic_config_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_extension_yaml: |
|
||||
# Your custom YAML configuration for this provider's configuration goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_bot_baibot_config_agents_static_definitions_anthropic_config`).
|
||||
#
|
||||
# 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_bot_baibot_config_agents_static_definitions_anthropic_config_yaml`.
|
||||
#
|
||||
# Example configuration extension follows:
|
||||
#
|
||||
# text_generation:
|
||||
# temperature: 3.5
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_base_url: https://api.anthropic.com/v1
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_api_key: ""
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_enabled: true
|
||||
# For valid model choices, see: https://platform.anthropic.com/docs/models
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_model_id: claude-3-5-sonnet-20240620
|
||||
# The prompt text to use (can be null or empty to not use a prompt).
|
||||
# See: https://huggingface.co/docs/transformers/en/tasks/prompting
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_prompt: null
|
||||
# The temperature parameter controls the randomness of the generated text.
|
||||
# See: https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_temperature: 1.0
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_max_response_tokens: 8192
|
||||
matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_max_context_tokens: 204800
|
||||
|
||||
########################################################################################
|
||||
# #
|
||||
# /Anthropic agent configuration #
|
||||
# #
|
||||
########################################################################################
|
||||
|
||||
|
||||
########################################################################################
|
||||
# #
|
||||
# Groq agent configuration #
|
||||
# #
|
||||
########################################################################################
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_enabled: false
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_id: groq
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_provider: groq
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config: "{{ matrix_bot_baibot_config_agents_static_definitions_groq_config_yaml | from_yaml | combine(matrix_bot_baibot_config_agents_static_definitions_groq_config_extension, recursive=True)}}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_yaml: "{{ lookup('template', 'templates/provider/groq-config.yml.j2') }}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_extension: "{{ matrix_bot_baibot_config_agents_static_definitions_groq_config_extension_yaml | from_yaml if matrix_bot_baibot_config_agents_static_definitions_groq_config_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_extension_yaml: |
|
||||
# Your custom YAML configuration for this provider's configuration goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_bot_baibot_config_agents_static_definitions_groq_config`).
|
||||
#
|
||||
# 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_bot_baibot_config_agents_static_definitions_groq_config_yaml`.
|
||||
#
|
||||
# Example configuration extension follows:
|
||||
#
|
||||
# text_generation:
|
||||
# temperature: 3.5
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_base_url: https://api.groq.com/openai/v1
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_api_key: ""
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_enabled: true
|
||||
# For valid model choices, see: https://platform.groq.com/docs/models
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_model_id: ""
|
||||
# The prompt text to use (can be null or empty to not use a prompt).
|
||||
# See: https://huggingface.co/docs/transformers/en/tasks/prompting
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_prompt: null
|
||||
# The temperature parameter controls the randomness of the generated text.
|
||||
# See: https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_temperature: 1.0
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_max_response_tokens: 4096
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_max_context_tokens: 131072
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_speech_to_text_enabled: true
|
||||
matrix_bot_baibot_config_agents_static_definitions_groq_config_speech_to_text_model_id: whisper-large-v3
|
||||
|
||||
########################################################################################
|
||||
# #
|
||||
# /Groq agent configuration #
|
||||
# #
|
||||
########################################################################################
|
||||
|
||||
|
||||
########################################################################################
|
||||
# #
|
||||
# OpenAI agent configuration #
|
||||
# #
|
||||
########################################################################################
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_enabled: false
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_id: openai
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_provider: openai
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config: "{{ matrix_bot_baibot_config_agents_static_definitions_openai_config_yaml | from_yaml | combine(matrix_bot_baibot_config_agents_static_definitions_openai_config_extension, recursive=True)}}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_yaml: "{{ lookup('template', 'templates/provider/openai-config.yml.j2') }}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_extension: "{{ matrix_bot_baibot_config_agents_static_definitions_openai_config_extension_yaml | from_yaml if matrix_bot_baibot_config_agents_static_definitions_openai_config_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_extension_yaml: |
|
||||
# Your custom YAML configuration for this provider's configuration goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_bot_baibot_config_agents_static_definitions_openai_config`).
|
||||
#
|
||||
# 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_bot_baibot_config_agents_static_definitions_openai_config_yaml`.
|
||||
#
|
||||
# Example configuration extension follows:
|
||||
#
|
||||
# text_generation:
|
||||
# temperature: 3.5
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_base_url: https://api.openai.com/v1
|
||||
|
||||
# The API key is intentionally not required. Some OpenAI-compatible APIs do not require a key.
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_api_key: ""
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_enabled: true
|
||||
# For valid model choices, see: https://platform.openai.com/docs/models
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_model_id: gpt-4o
|
||||
# The prompt text to use (can be null or empty to not use a prompt).
|
||||
# See: https://huggingface.co/docs/transformers/en/tasks/prompting
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_prompt: null
|
||||
# The temperature parameter controls the randomness of the generated text.
|
||||
# See: https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_temperature: 1.0
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_max_response_tokens: 16384
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_max_context_tokens: 128000
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_speech_to_text_enabled: true
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_speech_to_text_model_id: whisper-1
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_enabled: true
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_model_id: tts-1-hd
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_voice: onyx
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_speed: 1.0
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_response_format: opus
|
||||
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_enabled: true
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_model_id: dall-e-3
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_style: vivid
|
||||
matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_size: 1024x1024
|
||||
|
||||
########################################################################################
|
||||
# #
|
||||
# /OpenAI agent configuration #
|
||||
# #
|
||||
########################################################################################
|
||||
|
||||
|
||||
# Controls the `initial_global_config.handler.catch_all` configuration setting.
|
||||
#
|
||||
# This is an initial global configuration setting.
|
||||
# It only affects the first run of the bot. Configuration is later managed at runtime.
|
||||
matrix_bot_baibot_config_initial_global_config_handler_catch_all: null
|
||||
|
||||
# Controls the `initial_global_config.handler.text_generation` configuration setting.
|
||||
#
|
||||
# This is an initial global configuration setting.
|
||||
# It only affects the first run of the bot. Configuration is later managed at runtime.
|
||||
matrix_bot_baibot_config_initial_global_config_handler_text_generation: null
|
||||
|
||||
# Controls the `initial_global_config.handler.text_to_speech` configuration setting.
|
||||
#
|
||||
# This is an initial global configuration setting.
|
||||
# It only affects the first run of the bot. Configuration is later managed at runtime.
|
||||
matrix_bot_baibot_config_initial_global_config_handler_text_to_speech: null
|
||||
|
||||
# Controls the `initial_global_config.handler.speech_to_text` configuration setting.
|
||||
#
|
||||
# This is an initial global configuration setting.
|
||||
# It only affects the first run of the bot. Configuration is later managed at runtime.
|
||||
matrix_bot_baibot_config_initial_global_config_handler_speech_to_text: null
|
||||
|
||||
# Controls the `initial_global_config.handler.image_generation` configuration setting.
|
||||
#
|
||||
# This is an initial global configuration setting.
|
||||
# It only affects the first run of the bot. Configuration is later managed at runtime.
|
||||
matrix_bot_baibot_config_initial_global_config_handler_image_generation: null
|
||||
|
||||
# Controls the `initial_global_config.user_patterns` configuration setting.
|
||||
#
|
||||
# A space-separated list of MXID patterns which specify who can use the bot.
|
||||
# By default, we let anyone on the homeserver use the bot.
|
||||
#
|
||||
# This is an initial global configuration setting.
|
||||
# It only affects the first run of the bot. Configuration is later managed at runtime.
|
||||
matrix_bot_baibot_config_initial_global_config_user_patterns:
|
||||
- "@*:{{ matrix_bot_baibot_config_homeserver_server_name }}"
|
||||
|
||||
# Controls the `logging` configuration setting.
|
||||
#
|
||||
# This could take a single value (e.g. `warn`) to affect all tracing targets,
|
||||
# or individual libraries (e.g. `mxlink`, `baibot`) can be configured independently of the main level.
|
||||
#
|
||||
# Below, we configure the logging level for:
|
||||
# - the bot (baibot), via `matrix_bot_baibot_config_logging_level_baibot`
|
||||
# - the bot framework that the bot is based on (mxlink), via `matrix_bot_baibot_config_logging_level_mxlink`
|
||||
# - everything else (external libraries), via `matrix_bot_baibot_config_logging_level_other_libs`
|
||||
#
|
||||
# Valid values for each level are: `trace`, `debug`, `info`, `warn`, `error`.
|
||||
# Learn more here: https://stackoverflow.com/a/73735203
|
||||
matrix_bot_baibot_config_logging: "{{ matrix_bot_baibot_config_logging_level_other_libs }},mxlink={{ matrix_bot_baibot_config_logging_level_mxlink }},baibot={{ matrix_bot_baibot_config_logging_level_baibot }}"
|
||||
|
||||
# Adjust the logging level for other libraries used by the bot.
|
||||
matrix_bot_baibot_config_logging_level_other_libs: warn
|
||||
|
||||
# Affects the logging level of the bot framework (mxlink) that the bot is based on.
|
||||
# Related to `matrix_bot_baibot_config_logging`
|
||||
matrix_bot_baibot_config_logging_level_mxlink: info
|
||||
|
||||
# Affects the logging level of the bot itself.
|
||||
# Related to `matrix_bot_baibot_config_logging`
|
||||
matrix_bot_baibot_config_logging_level_baibot: info
|
||||
|
||||
# Holds the final baibot configuration (a combination of the default and its extension).
|
||||
# You most likely don't need to touch this variable. Instead, see `matrix_bot_baibot_configuration_yaml` or `matrix_bot_baibot_configuration_extension_yaml`.
|
||||
matrix_bot_baibot_configuration: "{{ matrix_bot_baibot_configuration_yaml | from_yaml | combine(matrix_bot_baibot_configuration_extension, recursive=True) }}"
|
||||
|
||||
# Default baibot 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_bot_baibot_configuration_extension_yaml`)
|
||||
# or completely replace this variable with your own template.
|
||||
matrix_bot_baibot_configuration_yaml: "{{ lookup('template', 'templates/config.yml.j2') }}"
|
||||
|
||||
matrix_bot_baibot_configuration_extension_yaml: |
|
||||
# Your custom YAML configuration for baibot goes here.
|
||||
# This configuration extends the default starting configuration (`matrix_bot_baibot_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_bot_baibot_configuration_yaml`.
|
||||
#
|
||||
# Example configuration extension follows:
|
||||
#
|
||||
# user:
|
||||
# password: something
|
||||
|
||||
matrix_bot_baibot_configuration_extension: "{{ matrix_bot_baibot_configuration_extension_yaml | from_yaml if matrix_bot_baibot_configuration_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
# Additional environment variables to pass to the baibot container.
|
||||
#
|
||||
# Environment variables take priority over settings in the configuration file.
|
||||
#
|
||||
# Example:
|
||||
# matrix_bot_baibot_environment_variables_extension: |
|
||||
# BAIBOT_USER_PASSWORD=password
|
||||
matrix_bot_baibot_environment_variables_extension: ''
|
77
roles/custom/matrix-bot-baibot/tasks/install.yml
Normal file
77
roles/custom/matrix-bot-baibot/tasks/install.yml
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
|
||||
- name: Ensure baibot paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {path: "{{ matrix_bot_baibot_config_path }}", when: true}
|
||||
- {path: "{{ matrix_bot_baibot_data_path }}", when: true}
|
||||
- {path: "{{ matrix_bot_baibot_container_src_files_path }}", when: matrix_bot_baibot_container_image_self_build}
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure baibot configuration installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_bot_baibot_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_bot_baibot_config_path }}/config.yml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure baibot environment variables file created
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/env.j2"
|
||||
dest: "{{ matrix_bot_baibot_config_path }}/env"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
mode: 0640
|
||||
|
||||
- name: Ensure baibot image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_bot_baibot_container_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_baibot_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_bot_baibot_container_image_force_pull }}"
|
||||
when: "not matrix_bot_baibot_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 baibot repository is present on self-build
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_bot_baibot_container_repo }}"
|
||||
version: "{{ matrix_bot_baibot_container_repo_version }}"
|
||||
dest: "{{ matrix_bot_baibot_container_src_files_path }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_bot_baibot_git_pull_results
|
||||
when: "matrix_bot_baibot_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure baibot image is built
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_bot_baibot_container_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_bot_baibot_git_pull_results.changed 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_bot_baibot_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_bot_baibot_container_src_files_path }}"
|
||||
pull: true
|
||||
when: "matrix_bot_baibot_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure baibot container network is created
|
||||
community.general.docker_network:
|
||||
enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
|
||||
name: "{{ matrix_bot_baibot_container_network }}"
|
||||
driver: bridge
|
||||
|
||||
- name: Ensure matrix-bot-baibot.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-bot-baibot.service.j2"
|
||||
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-bot-baibot.service"
|
||||
mode: 0644
|
20
roles/custom/matrix-bot-baibot/tasks/main.yml
Normal file
20
roles/custom/matrix-bot-baibot/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-bot-baibot
|
||||
- install-all
|
||||
- install-bot-baibot
|
||||
block:
|
||||
- when: matrix_bot_baibot_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
|
||||
- when: matrix_bot_baibot_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-bot-baibot
|
||||
block:
|
||||
- when: not matrix_bot_baibot_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml"
|
25
roles/custom/matrix-bot-baibot/tasks/uninstall.yml
Normal file
25
roles/custom/matrix-bot-baibot/tasks/uninstall.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-baibot service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-bot-baibot.service"
|
||||
register: matrix_bot_baibot_service_stat
|
||||
|
||||
- when: matrix_bot_baibot_service_stat.stat.exists | bool
|
||||
block:
|
||||
- name: Ensure matrix-baibot is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-bot-baibot
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
|
||||
- name: Ensure matrix-bot-baibot.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-bot-baibot.service"
|
||||
state: absent
|
||||
|
||||
- name: Ensure Matrix baibot paths don't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_bot_baibot_base_path }}"
|
||||
state: absent
|
25
roles/custom/matrix-bot-baibot/tasks/validate_config.yml
Normal file
25
roles/custom/matrix-bot-baibot/tasks/validate_config.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
|
||||
- name: Fail if required baibot settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item.name }}`).
|
||||
when: "item.when | bool and vars[item.name] == ''"
|
||||
with_items:
|
||||
- {'name': 'matrix_bot_baibot_config_user_mxid_localpart', when: true}
|
||||
- {'name': 'matrix_bot_baibot_config_user_password', when: true}
|
||||
- {'name': 'matrix_bot_baibot_container_network', when: true}
|
||||
- {'name': 'matrix_bot_baibot_config_homeserver_url', when: true}
|
||||
|
||||
- {'name': 'matrix_bot_baibot_config_agents_static_definitions_anthropic_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_anthropic_enabled }}"}
|
||||
|
||||
- {'name': 'matrix_bot_baibot_config_agents_static_definitions_groq_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_groq_enabled }}"}
|
||||
- {'name': 'matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_model_id', when: "{{ matrix_bot_baibot_config_agents_static_definitions_groq_enabled and matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_enabled }}"}
|
||||
|
||||
- {'name': 'matrix_bot_baibot_config_agents_static_definitions_openai_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_openai_enabled }}"}
|
||||
|
||||
- name: Fail if admin patterns list is empty
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`matrix_bot_baibot_config_access_admin_patterns`) to specify which users are bot administrators.
|
||||
when: "matrix_bot_baibot_config_access_admin_patterns | length == 0"
|
85
roles/custom/matrix-bot-baibot/templates/config.yml.j2
Normal file
85
roles/custom/matrix-bot-baibot/templates/config.yml.j2
Normal file
@ -0,0 +1,85 @@
|
||||
# Default configuration for baibot.
|
||||
# To extend it, use `matrix_bot_baibot_configuration_extension_yaml`.
|
||||
|
||||
homeserver:
|
||||
# The canonical homeserver domain name
|
||||
server_name: {{ matrix_bot_baibot_config_homeserver_server_name | to_json }}
|
||||
url: {{ matrix_bot_baibot_config_homeserver_url | to_json }}
|
||||
|
||||
user:
|
||||
mxid_localpart: {{ matrix_bot_baibot_config_user_mxid_localpart | to_json }}
|
||||
password: {{ matrix_bot_baibot_config_user_password | to_json }}
|
||||
|
||||
# The name the bot uses as a display name and when it refers to itself.
|
||||
# Leave empty to use the default (baibot).
|
||||
name: {{ matrix_bot_baibot_config_user_name | to_json }}
|
||||
|
||||
encryption:
|
||||
# An optional passphrase to use for backing up and recovering the bot's encryption keys.
|
||||
# You can use any string here.
|
||||
#
|
||||
# If left empty, the recovery module will not be used and losing your session/database (see persistence)
|
||||
# will mean you lose access to old messages in encrypted room.
|
||||
#
|
||||
# Changing this subsequently will also cause you to lose access to old messages in encrypted rooms.
|
||||
# If you really need to change this:
|
||||
# - Set `encryption_recovery_reset_allowed` to `true` and adjust the passphrase
|
||||
# - Remove your session file and database (see persistence)
|
||||
# - Restart the bot
|
||||
# - Then restore `encryption_recovery_reset_allowed` to `false` to prevent accidental resets in the future
|
||||
recovery_passphrase: {{ matrix_bot_baibot_config_user_encryption_recovery_passphrase | to_json }}
|
||||
|
||||
# An optional flag to reset the encryption recovery passphrase.
|
||||
recovery_reset_allowed: {{ matrix_bot_baibot_config_user_encryption_recovery_reset_allowed | to_json }}
|
||||
|
||||
# Command prefix. Leave empty to use the default (!bai).
|
||||
command_prefix: {{ matrix_bot_baibot_config_command_prefix | to_json }}
|
||||
|
||||
access:
|
||||
# Space-separated list of MXID patterns which specify who is an admin.
|
||||
admin_patterns: {{ matrix_bot_baibot_config_access_admin_patterns | to_json }}
|
||||
|
||||
persistence:
|
||||
data_dir_path: {{ matrix_bot_baibot_config_persistence_data_dir_path | to_json }}
|
||||
|
||||
# An optional secret for encrypting the bot's session data (stored in data_dir_path).
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently requires that you also throw away all data stored in data_dir_path.
|
||||
session_encryption_key: {{ matrix_bot_baibot_config_persistence_session_encryption_key | to_json }}
|
||||
|
||||
# An optional secret for encrypting bot configuration stored in Matrix's account data.
|
||||
# This must be 32-bytes (64 characters when HEX-encoded).
|
||||
# Generate it with: `openssl rand -hex 32`
|
||||
# Leave null or empty to avoid using encryption.
|
||||
# Changing this subsequently will make you lose your configuration.
|
||||
config_encryption_key: {{ matrix_bot_baibot_config_persistence_config_encryption_key | to_json }}
|
||||
|
||||
agents:
|
||||
# A list of statically-defined agents.
|
||||
static_definitions: {{ matrix_bot_baibot_config_agents_static_definitions | to_json }}
|
||||
|
||||
# Initial global configuration. This only affects the first run of the bot.
|
||||
# Configuration is later managed at runtime.
|
||||
initial_global_config:
|
||||
handler:
|
||||
catch_all: {{ matrix_bot_baibot_config_initial_global_config_handler_catch_all | to_json }}
|
||||
text_generation: {{ matrix_bot_baibot_config_initial_global_config_handler_text_generation | to_json }}
|
||||
text_to_speech: {{ matrix_bot_baibot_config_initial_global_config_handler_text_to_speech | to_json }}
|
||||
speech_to_text: {{ matrix_bot_baibot_config_initial_global_config_handler_speech_to_text | to_json }}
|
||||
image_generation: {{ matrix_bot_baibot_config_initial_global_config_handler_image_generation | to_json }}
|
||||
|
||||
# Space-separated list of MXID patterns which specify who can use the bot.
|
||||
# By default, we let anyone on the homeserver use the bot.
|
||||
user_patterns: {{ matrix_bot_baibot_config_initial_global_config_user_patterns | to_json}}
|
||||
|
||||
# Controls logging.
|
||||
#
|
||||
# Sets all tracing targets (external crates) to warn, and our own logs to debug.
|
||||
# For even more verbose logging, one may also use trace.
|
||||
#
|
||||
# matrix_sdk_crypto may be chatty and could be added with an error level.
|
||||
#
|
||||
# Learn more here: https://stackoverflow.com/a/73735203
|
||||
logging: {{ matrix_bot_baibot_config_logging | to_json }}
|
1
roles/custom/matrix-bot-baibot/templates/env.j2
Normal file
1
roles/custom/matrix-bot-baibot/templates/env.j2
Normal file
@ -0,0 +1 @@
|
||||
{{ matrix_bot_baibot_environment_variables_extension }}
|
@ -0,0 +1,13 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
base_url: {{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_base_url | to_json }}
|
||||
|
||||
api_key: {{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_api_key | to_json }}
|
||||
|
||||
{% if matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_enabled %}
|
||||
text_generation:
|
||||
model_id: {{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_model_id | to_json }}
|
||||
prompt: {{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_prompt | to_json }}
|
||||
temperature: {{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_temperature | to_json }}
|
||||
max_response_tokens: {{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_max_response_tokens | int | to_json }}
|
||||
max_context_tokens: {{ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_max_context_tokens | int | to_json }}
|
||||
{% endif %}
|
@ -0,0 +1,18 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
base_url: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_base_url | to_json }}
|
||||
|
||||
api_key: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_api_key | to_json }}
|
||||
|
||||
{% if matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_enabled %}
|
||||
text_generation:
|
||||
model_id: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_model_id | to_json }}
|
||||
prompt: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_prompt | to_json }}
|
||||
temperature: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_temperature | to_json }}
|
||||
max_response_tokens: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_max_response_tokens | int | to_json }}
|
||||
max_context_tokens: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_max_context_tokens | int | to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_bot_baibot_config_agents_static_definitions_groq_config_speech_to_text_enabled %}
|
||||
speech_to_text:
|
||||
model_id: {{ matrix_bot_baibot_config_agents_static_definitions_groq_config_speech_to_text_model_id | to_json }}
|
||||
{% endif %}
|
@ -0,0 +1,33 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
base_url: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_base_url | to_json }}
|
||||
|
||||
api_key: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_api_key | to_json }}
|
||||
|
||||
{% if matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_enabled %}
|
||||
text_generation:
|
||||
model_id: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_model_id | to_json }}
|
||||
prompt: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_prompt | to_json }}
|
||||
temperature: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_temperature | to_json }}
|
||||
max_response_tokens: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_max_response_tokens | int | to_json }}
|
||||
max_context_tokens: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_max_context_tokens | int | to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_bot_baibot_config_agents_static_definitions_openai_config_speech_to_text_enabled %}
|
||||
speech_to_text:
|
||||
model_id: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_speech_to_text_model_id | to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_enabled %}
|
||||
text_to_speech:
|
||||
model_id: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_model_id | to_json }}
|
||||
voice: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_voice | to_json }}
|
||||
speed: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_speed | float }}
|
||||
response_format: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_to_speech_response_format | to_json }}
|
||||
{% endif %}
|
||||
|
||||
{% if matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_enabled %}
|
||||
image_generation:
|
||||
model_id: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_model_id | to_json }}
|
||||
style: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_style | to_json }}
|
||||
size: {{ matrix_bot_baibot_config_agents_static_definitions_openai_config_image_generation_size | to_json }}
|
||||
{% endif %}
|
@ -0,0 +1,53 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix baibot bot
|
||||
{% for service in matrix_bot_baibot_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_bot_baibot_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 }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-bot-baibot 2>/dev/null || true'
|
||||
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-baibot 2>/dev/null || true'
|
||||
|
||||
{#
|
||||
We mount a tmpfs at /tmp, because the bot may write temporary files there
|
||||
(see its `src/agent/provider/openai_compat/controller.rs`).
|
||||
#}
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||||
--rm \
|
||||
--name=matrix-bot-baibot \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--network={{ matrix_bot_baibot_container_network }} \
|
||||
--env-file={{ matrix_bot_baibot_config_path }}/env \
|
||||
--mount type=bind,src={{ matrix_bot_baibot_config_path }}/config.yml,dst=/app/config.yml,ro \
|
||||
--mount type=bind,src={{ matrix_bot_baibot_data_path }},dst=/data \
|
||||
--tmpfs=/tmp:rw,noexec,nosuid,size=1024m \
|
||||
{% for arg in matrix_bot_baibot_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_bot_baibot_container_image }}
|
||||
|
||||
{% for network in matrix_bot_baibot_container_additional_networks %}
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-bot-baibot
|
||||
{% endfor %}
|
||||
|
||||
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-bot-baibot
|
||||
|
||||
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-bot-baibot 2>/dev/null || true'
|
||||
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-baibot 2>/dev/null || true'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-bot-baibot
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user