initial conduwuit support
This commit is contained in:
committed by
Slavi Pantaleev
parent
96b3cb8392
commit
be586f0f30
67
roles/custom/matrix-conduwuit/templates/conduwuit.toml.j2
Normal file
67
roles/custom/matrix-conduwuit/templates/conduwuit.toml.j2
Normal file
@ -0,0 +1,67 @@
|
||||
# =============================================================================
|
||||
# This is the official example config for Conduwuit.
|
||||
# If you use it for your server, you will need to adjust it to your own needs.
|
||||
# At the very least, change the server_name field!
|
||||
# =============================================================================
|
||||
|
||||
|
||||
[global]
|
||||
# The server_name is the pretty name of this server. It is used as a suffix for user
|
||||
# and room IDs. Examples: matrix.org, puppyirl.gay
|
||||
|
||||
# The Conduwuit server needs all /_matrix/ requests to be reachable at
|
||||
# https://example.com/ on port 443 (client-server) and 8448 (federation).
|
||||
|
||||
# If that's not possible for you, you can create /.well-known files to redirect
|
||||
# requests. See
|
||||
# https://matrix.org/docs/spec/client_server/latest#get-well-known-matrix-client
|
||||
# and
|
||||
# https://matrix.org/docs/spec/server_server/r0.1.4#get-well-known-matrix-server
|
||||
# for more information
|
||||
|
||||
server_name = "{{ matrix_domain }}"
|
||||
|
||||
# This is the only directory where Conduwuit will save its data
|
||||
database_path = "/var/lib/matrix-conduwuit/"
|
||||
database_backend = "rocksdb"
|
||||
|
||||
# The port Conduwuit will be running on. You need to set up a reverse proxy in
|
||||
# your web server (e.g. apache or nginx), so all requests to /_matrix on port
|
||||
# 443 and 8448 will be forwarded to the Conduwuit instance running on this port
|
||||
# Docker users: Don't change this, you'll need to map an external port to this.
|
||||
port = {{ matrix_conduwuit_port_number }}
|
||||
|
||||
# Max size for uploads
|
||||
max_request_size = {{ matrix_conduwuit_max_request_size }}
|
||||
|
||||
# Max number of open files for the RocksDB database
|
||||
rocksdb_max_open_files = {{ matrix_conduwuit_rocksdb_max_open_files }}
|
||||
|
||||
# Enables registration. If set to false, no users can register on this server.
|
||||
allow_registration = {{ matrix_conduwuit_allow_registration | to_json }}
|
||||
|
||||
allow_federation = {{ matrix_conduwuit_allow_federation | to_json }}
|
||||
|
||||
# Enable the display name lightning bolt on registration.
|
||||
enable_lightning_bolt = {{ matrix_conduwuit_enable_lightning_bolt | to_json }}
|
||||
|
||||
trusted_servers = {{ matrix_conduwuit_trusted_servers | to_json }}
|
||||
|
||||
max_concurrent_requests = {{ matrix_conduwuit_max_concurrent_requests }}
|
||||
|
||||
log = "info,state_res=warn,rocket=off,_=off,sled=off"
|
||||
|
||||
address = "0.0.0.0"
|
||||
|
||||
turn_uris = {{ matrix_conduwuit_turn_uris | to_json }}
|
||||
|
||||
{% if matrix_conduwuit_turn_secret != '' %}
|
||||
turn_secret = {{ matrix_conduwuit_turn_secret | to_json }}
|
||||
{% endif %}
|
||||
|
||||
# If you have your TURN server configured to use a username and password
|
||||
# you can provide these information too. In this case comment out `turn_secret above`!
|
||||
{% if matrix_conduwuit_turn_username != '' or matrix_conduwuit_turn_password != '' %}
|
||||
turn_username = {{ matrix_conduwuit_turn_username | to_json }}
|
||||
turn_password = {{ matrix_conduwuit_turn_password | to_json }}
|
||||
{% endif %}
|
134
roles/custom/matrix-conduwuit/templates/labels.j2
Normal file
134
roles/custom/matrix-conduwuit/templates/labels.j2
Normal file
@ -0,0 +1,134 @@
|
||||
{% if matrix_conduwuit_container_labels_traefik_enabled %}
|
||||
traefik.enable=true
|
||||
|
||||
{% if matrix_conduwuit_container_labels_traefik_docker_network %}
|
||||
traefik.docker.network={{ matrix_conduwuit_container_labels_traefik_docker_network }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.services.matrix-conduwuit.loadbalancer.server.port={{ matrix_conduwuit_port_number }}
|
||||
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_client_root_enabled %}
|
||||
############################################################
|
||||
# #
|
||||
# Public Root path (/) #
|
||||
# #
|
||||
############################################################
|
||||
|
||||
{% set client_root_middlewares = [] %}
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_client_root_redirection_enabled %}
|
||||
{% set client_root_middlewares = client_root_middlewares + ['matrix-conduwuit-client-root-redirect'] %}
|
||||
traefik.http.middlewares.matrix-conduwuit-client-root-redirect.redirectregex.regex=(.*)
|
||||
traefik.http.middlewares.matrix-conduwuit-client-root-redirect.redirectregex.replacement={{ matrix_conduwuit_container_labels_public_client_root_redirection_url }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-client-root.rule={{ matrix_conduwuit_container_labels_public_client_root_traefik_rule }}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-client-root.middlewares={{ client_root_middlewares | join(',') }}
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_client_root_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-conduwuit-public-client-root.priority={{ matrix_conduwuit_container_labels_public_client_root_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-client-root.service=matrix-conduwuit
|
||||
traefik.http.routers.matrix-conduwuit-public-client-root.entrypoints={{ matrix_conduwuit_container_labels_public_client_root_traefik_entrypoints }}
|
||||
traefik.http.routers.matrix-conduwuit-public-client-root.tls={{ matrix_conduwuit_container_labels_public_client_root_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_client_root_traefik_tls %}
|
||||
traefik.http.routers.matrix-conduwuit-public-client-root.tls.certResolver={{ matrix_conduwuit_container_labels_public_client_root_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
############################################################
|
||||
# #
|
||||
# /Public Root path (/) #
|
||||
# #
|
||||
############################################################
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_client_api_enabled %}
|
||||
############################################################
|
||||
# #
|
||||
# Public Client-API (/_matrix) #
|
||||
# #
|
||||
############################################################
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-client-api.rule={{ matrix_conduwuit_container_labels_public_client_api_traefik_rule }}
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_client_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-conduwuit-public-client-api.priority={{ matrix_conduwuit_container_labels_public_client_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-client-api.service=matrix-conduwuit
|
||||
traefik.http.routers.matrix-conduwuit-public-client-api.entrypoints={{ matrix_conduwuit_container_labels_public_client_api_traefik_entrypoints }}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-client-api.tls={{ matrix_conduwuit_container_labels_public_client_api_traefik_tls | to_json }}
|
||||
{% if matrix_conduwuit_container_labels_public_client_api_traefik_tls %}
|
||||
traefik.http.routers.matrix-conduwuit-public-client-api.tls.certResolver={{ matrix_conduwuit_container_labels_public_client_api_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
############################################################
|
||||
# #
|
||||
# /Public Client-API (/_matrix) #
|
||||
# #
|
||||
############################################################
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if matrix_conduwuit_container_labels_internal_client_api_enabled %}
|
||||
############################################################
|
||||
# #
|
||||
# Internal Client-API (/_matrix) #
|
||||
# #
|
||||
############################################################
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-internal-client-api.rule={{ matrix_conduwuit_container_labels_internal_client_api_traefik_rule }}
|
||||
|
||||
{% if matrix_conduwuit_container_labels_internal_client_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-conduwuit-internal-client-api.priority={{ matrix_conduwuit_container_labels_internal_client_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-internal-client-api.service=matrix-conduwuit
|
||||
traefik.http.routers.matrix-conduwuit-internal-client-api.entrypoints={{ matrix_conduwuit_container_labels_internal_client_api_traefik_entrypoints }}
|
||||
|
||||
############################################################
|
||||
# #
|
||||
# /Internal Client-API (/_matrix) #
|
||||
# #
|
||||
############################################################
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_federation_api_enabled %}
|
||||
############################################################
|
||||
# #
|
||||
# Public Federation-API (/_matrix) #
|
||||
# #
|
||||
############################################################
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-federation-api.rule={{ matrix_conduwuit_container_labels_public_federation_api_traefik_rule }}
|
||||
|
||||
{% if matrix_conduwuit_container_labels_public_federation_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-conduwuit-public-federation-api.priority={{ matrix_conduwuit_container_labels_public_federation_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-federation-api.service=matrix-conduwuit
|
||||
traefik.http.routers.matrix-conduwuit-public-federation-api.entrypoints={{ matrix_conduwuit_container_labels_public_federation_api_traefik_entrypoints }}
|
||||
|
||||
traefik.http.routers.matrix-conduwuit-public-federation-api.tls={{ matrix_conduwuit_container_labels_public_federation_api_traefik_tls | to_json }}
|
||||
{% if matrix_conduwuit_container_labels_public_federation_api_traefik_tls %}
|
||||
traefik.http.routers.matrix-conduwuit-public-federation-api.tls.certResolver={{ matrix_conduwuit_container_labels_public_federation_api_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
############################################################
|
||||
# #
|
||||
# /Public Federation-API (/_matrix) #
|
||||
# #
|
||||
############################################################
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ matrix_conduwuit_container_labels_additional_labels }}
|
@ -0,0 +1,51 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Conduwuit Matrix homeserver
|
||||
{% for service in matrix_conduwuit_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
|
||||
[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-conduwuit 2>/dev/null || true'
|
||||
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-conduwuit 2>/dev/null || true'
|
||||
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||||
--rm \
|
||||
--name=matrix-conduwuit \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_conduwuit_tmp_directory_size_mb }}m \
|
||||
--network={{ matrix_conduwuit_container_network }} \
|
||||
--env conduwuit_CONFIG=/etc/matrix-conduwuit/conduwuit.toml \
|
||||
--label-file={{ matrix_conduwuit_base_path }}/labels \
|
||||
--mount type=bind,src={{ matrix_conduwuit_data_path }},dst=/var/lib/matrix-conduwuit \
|
||||
--mount type=bind,src={{ matrix_conduwuit_config_path }},dst=/etc/matrix-conduwuit,ro \
|
||||
{% for arg in matrix_conduwuit_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_conduwuit_docker_image }}
|
||||
|
||||
{% for network in matrix_conduwuit_container_additional_networks %}
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-conduwuit
|
||||
{% endfor %}
|
||||
|
||||
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-conduwuit
|
||||
|
||||
{% if matrix_conduwuit_systemd_service_post_start_delay_seconds != 0 %}
|
||||
ExecStartPost=-{{ matrix_host_command_sleep }} {{ matrix_conduwuit_systemd_service_post_start_delay_seconds }}
|
||||
{% endif %}
|
||||
|
||||
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-conduwuit 2>/dev/null || true'
|
||||
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-conduwuit 2>/dev/null || true'
|
||||
ExecReload={{ devture_systemd_docker_base_host_command_docker }} exec matrix-conduwuit /bin/sh -c 'kill -HUP 1'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-conduwuit
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user