mjolnir/README.md

83 lines
3.1 KiB
Markdown

<!-- # build:0 -->
# Mjolnir Bot Container
This container provides a deployment for the Mjolnir moderation bot, configured to interact with Matrix homeservers. It is built on a `matrixdotorg/mjolnir:latest` base and includes a custom startup script to ensure flexible configuration at runtime.
## Container Image
The image is available at `git.nixc.us/colin/mjolnir:production`.
## Features
- Automatic configuration file setup if not present.
- Customizable through environment variables.
- Integrated Sentry support for error tracking.
- Configured to listen on IP `0.0.0.0` for web interfaces.
## Configuration
The container can be customized using the following environment variables:
- `HOME_SERVER_URL` (default: `https://matrix.org`): The homeserver URL Mjolnir will interact with.
- `RAW_HOME_SERVER_URL` (default: `https://matrix.org`): The URL Mjolnir uses to fetch events.
- `ACCESS_TOKEN` (default: `YOUR_TOKEN_HERE`): The Matrix access token for authentication.
- `PANTALAIMON_USE` (default: `false`): Whether to use Pantalaimon.
- `PANTALAIMON_USERNAME` (default: `mjolnir`): The username for Pantalaimon login.
- `PANTALAIMON_PASSWORD` (default: `your_password`): The password for Pantalaimon.
- `SENTRY_DSN`: The Sentry DSN for error tracking (if not set, Sentry integration is disabled).
- `SENTRY_TRACES_SAMPLE_RATE` (default: `0.5`): The sample rate for Sentry traces.
- `WEB_LISTEN_ADDRESS` (default: `0.0.0.0`): The IP address the web server listens on.
## Running the Container
To run the container with the default settings:
```shell
docker run -d --name mjolnir \
-e ACCESS_TOKEN='your_access_token_here' \
git.nixc.us/colin/mjolnir:production
```
To customize the configuration, adjust the environment variables accordingly:
```
docker run -d --name mjolnir \
-e HOME_SERVER_URL='https://your.homeserver.url' \
-e RAW_HOME_SERVER_URL='https://your.raw.homeserver.url' \
-e ACCESS_TOKEN='your_access_token_here' \
-e PANTALAIMON_USE='true' \
-e PANTALAIMON_USERNAME='your_username' \
-e PANTALAIMON_PASSWORD='your_password' \
-e SENTRY_DSN='your_sentry_dsn' \
-e SENTRY_TRACES_SAMPLE_RATE='0.5' \
-e WEB_LISTEN_ADDRESS='0.0.0.0' \
git.nixc.us/colin/mjolnir:production
```
### docker-compose.yml
```yaml
version: '3.8'
services:
mjolnir:
image: git.nixc.us/colin/mjolnir:production
volumes:
- ./data:/data
- ./config/config.yml:/etc/mjolnir/config.yml
environment:
- HOME_SERVER_URL=https://matrix.org
- RAW_HOME_SERVER_URL=http://chat_chat # this is intended for internal routing to your homeserver inside of docker networking.
- ACCESS_TOKEN=YOUR_TOKEN_HERE
- PANTALAIMON_USE=false
- PANTALAIMON_USERNAME=mjolnir
- PANTALAIMON_PASSWORD=your_password
- SENTRY_DSN=
- SENTRY_TRACES_SAMPLE_RATE=0.5
- WEB_LISTEN_ADDRESS=0.0.0.0
ports:
- "8080:8080" # this is for the webserver portion.
```
## Documentation
For more detailed documentation on configuring and running Mjolnir, visit the official Mjolnir GitHub repository.
https://github.com/matrix-org/mjolnir/blob/main/config/default.yaml
https://github.com/matrix-org/mjolnir/blob/main/docs/setup_docker.md