From da678f1fcbe4fa33c7c1e39a765840bebbbf2b76 Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Tue, 8 Oct 2024 18:56:39 +0100 Subject: [PATCH] Maubot --- servers/containers/maubot.container | 52 +++++++++++ servers/maubot/config.yaml | 128 ++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 servers/containers/maubot.container create mode 100644 servers/maubot/config.yaml diff --git a/servers/containers/maubot.container b/servers/containers/maubot.container new file mode 100644 index 00000000..f7b20186 --- /dev/null +++ b/servers/containers/maubot.container @@ -0,0 +1,52 @@ + + +[Unit] +Description=Maubot +Wants=network-online.target +After=network-online.target +Documentation=https://docs.mau.fi/maubot/index.html + +[Container] +ContainerName=maubot +NoNewPrivileges=true +Image=dock.mau.dev/maubot/maubot:latest +ReadOnly=true +Volume=/var/opt/maubot:/data:z,U +AutoUpdate=registry +# Network=web.network= + +Label="traefik.enable=true" +Label="traefik.http.routers.maubot.rule=Host(`maubot.ellis.link`)" +Label="traefik.http.services.maubot.loadbalancer.server.port=29316" + +Label="traefik.http.routers.maubot.entrypoints=https" + +Label="traefik.http.routers.maubot.tls.certresolver=letsencrypt" +# Label="traefik.http.routers.maubot.tls.options=intermediate@file" + +Label="traefik.http.routers.maubot.middlewares=default@file" + +Label="homepage.group=Services" +Label="homepage.name=Maubot" +# Label="homepage.href=https://jade.pissing.dev/" +# https://github.com/girlbossceo/conduwuit/blob/032b199129f8648a77bde285f755a78e9ec349a7/src/api/client/unversioned.rs#L142 +# Label="homepage.siteMonitor=" +Label="homepage.description=Matrix bot" + + + +StopTimeout=100 + +[Service] + +Restart=on-failure +RestartSec=5 + +TimeoutStopSec=2m +TimeoutStartSec=2m + +# StartLimitInterval=1m +StartLimitBurst=5 + +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/servers/maubot/config.yaml b/servers/maubot/config.yaml new file mode 100644 index 00000000..7af4e6ee --- /dev/null +++ b/servers/maubot/config.yaml @@ -0,0 +1,128 @@ +# The full URI to the database. SQLite and Postgres are fully supported. +# Format examples: +# SQLite: sqlite:filename.db +# Postgres: postgresql://username:password@hostname/dbname +database: sqlite:/data/maubot.db +# Separate database URL for the crypto database. "default" means use the same database as above. +crypto_database: default +# Additional arguments for asyncpg.create_pool() or sqlite3.connect() +# https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool +# https://docs.python.org/3/library/sqlite3.html#sqlite3.connect +# For sqlite, min_size is used as the connection thread pool size and max_size is ignored. +database_opts: + min_size: 1 + max_size: 10 +# Configuration for storing plugin .mbp files +plugin_directories: + # The directory where uploaded new plugins should be stored. + upload: /data/plugins + # The directories from which plugins should be loaded. + # Duplicate plugin IDs will be moved to the trash. + load: + - /data/plugins + # The directory where old plugin versions and conflicting plugins should be moved. + # Set to "delete" to delete files immediately. + trash: /data/trash +# Configuration for storing plugin databases +plugin_databases: + # The directory where SQLite plugin databases should be stored. + sqlite: /data/dbs + # The connection URL for plugin databases. If null, all plugins will get SQLite databases. + # If set, plugins using the new asyncpg interface will get a Postgres connection instead. + # Plugins using the legacy SQLAlchemy interface will always get a SQLite connection. + # + # To use the same connection pool as the default database, set to "default" + # (the default database above must be postgres to do this). + # + # When enabled, maubot will create separate Postgres schemas in the database for each plugin. + # To view schemas in psql, use `\dn`. To view enter and interact with a specific schema, + # use `SET search_path = name` (where `name` is the name found with `\dn`) and then use normal + # SQL queries/psql commands. + postgres: null + # Maximum number of connections per plugin instance. + postgres_max_conns_per_plugin: 3 + # Overrides for the default database_opts when using a non-"default" postgres connection string. + postgres_opts: {} +server: + # The IP and port to listen to. + hostname: 0.0.0.0 + port: 29316 + # Public base URL where the server is visible. + public_url: https://maubot.ellis.link + # The base path for the UI. + ui_base_path: / + # The base path for plugin endpoints. The instance ID will be appended directly. + plugin_base_path: /_matrix/maubot/plugin/ + # Override path from where to load UI resources. + # Set to false to using pkg_resources to find the path. + override_resource_path: /opt/maubot/frontend + # The shared secret to sign API access tokens. + # Set to "generate" to generate and save a new token at startup. + unshared_secret: msQcj2MgQDGzFTFst7YOmC7bnjNhj8L4qO0XMNmAGVoHXRRCiz0uWRrSdJ9q1fHmaIfUUkzeMBDAKfe +# Known homeservers. This is required for the `mbc auth` command and also allows +# more convenient access from the management UI. This is not required to create +# clients in the management UI, since you can also just type the homeserver URL +# into the box there. +homeservers: + # matrix.org: + # Client-server API URL + # url: https://matrix-client.matrix.org + # registration_shared_secret from synapse config + # You can leave this empty if you don't have access to the homeserver. + # When this is empty, `mbc auth --register` won't work, but `mbc auth` (login) will. + # secret: null + ellis.link: + url: https://matrix.ellis.link + secret: null + pissing.dev: + url: https://matrix.pissing.dev + secret: null +# List of administrator users. Plaintext passwords will be bcrypted on startup. Set empty password +# to prevent normal login. Root is a special user that can't have a password and will always exist. +admins: + root: "" + jade: "TnHyiNrcDvha33p2WTKI0v1jnWFiXJVVaynNZqYDEAUTjHD1j1SLQaviTt4r10e6rFJwg5ycCdZ0RmQ" +# API feature switches. +api_features: + login: true + plugin: true + plugin_upload: true + instance: true + instance_database: true + client: true + client_proxy: true + client_auth: true + dev_open: true + log: true +# Python logging configuration. +# +# See section 16.7.2 of the Python documentation for more info: +# https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema +logging: + version: 1 + formatters: + colored: + (): maubot.lib.color_log.ColorFormatter + format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s" + normal: + format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s" + handlers: + # file: + # class: logging.handlers.RotatingFileHandler + # formatter: normal + # filename: /var/log/maubot.log + # maxBytes: 10485760 + # backupCount: 10 + console: + class: logging.StreamHandler + formatter: colored + loggers: + maubot: + level: DEBUG + mau: + level: DEBUG + aiohttp: + level: INFO + root: + level: DEBUG + handlers: [console]