installation.md
June 9, 2025 ยท View on GitHub
๐ Installation
โ๏ธ The easiest way to use the bot is to get a managed Matrix server from etke.cc and order baibot via the order form. Existing customers can request the inclusion of this additional service by contacting support.
๐ป If you're managing your Matrix server with the help of the matrix-docker-ansible-deploy Ansible playbook, you can easily install the bot via the Ansible playbook. See the playbook's Setting up baibot documentation page.
๐ In other cases, we recommend using our prebuilt container images and running in a container. You can also build a container image yourself.
๐จ If containers are not your thing, you can build a binary yourself and run it.
๐ฒ For a quick experiment, you can refer to the ๐งโ๐ป development documentation which contains information on how to build and run the bot (and its various dependency services) locally.
๐ Building a container image
We provide prebuilt container images for the amd64 and arm64 architectures, so you don't necessarily need to build images yourself and can jump to Running in a container.
If you nevertheless wish to build a container image yourself, you can do so by running:
-
(recommended)
just build-container-image-releaseto build a release version of the container image -
or
just build-container-image-debugto build a debug version of the container image
Debug images are faster to build but are larger in size. Release images are ~5x smaller in size, but are slower to build.
Both of these commands will build and tag your container image as localhost/baibot:latest.
๐ Running in a container
We recommend using a tagged-release (e.g. v1.0.0, not latest) of our prebuilt container images, but you can also build a container image yourself.
You should:
- ๐ ๏ธ prepare a configuration file (e.g.
cp etc/app/config.yml.dist /path/to/config.yml& edit it) - prepare a data directory (
mkdir /path/to/data)
The example below uses ๐ Docker to run the container, but other container runtimes like Podman should work as well.
# Adjust the version tag to point to the latest available tagged version.
# If building your own container image name, adjust to something like `localhost/baibot:latest`.
CONTAINER_IMAGE_NAME=ghcr.io/etkecc/baibot:v1.0.0
/usr/bin/env docker run \
-it \
--rm \
--name=baibot \
--user=$(id -u):$(id -g) \
--cap-drop=ALL \
--read-only \
--env BAIBOT_PERSISTENCE_DATA_DIR_PATH=/data \
--mount type=bind,src=/path/to/config.yml,dst=/app/config.yml,ro \
--mount type=bind,src=/path/to/data,dst=/data \
--tmpfs=/tmp:rw,noexec,nosuid,size=1024m \
$CONTAINER_IMAGE_NAME
๐ก If you've defined the persistence.data_dir_path setting in the config.yml file, you can skip the BAIBOT_PERSISTENCE_DATA_DIR_PATH environment variable.
๐จ Building a binary
To build a binary, you need a ๐ฆ Rust toolchain.
Consult the Dockerfile file to learn what some of the build dependencies are (e.g. libssl-dev, libsqlite3-dev, etc., on Debian-based distros).
You can build a binary from the current project's source code:
- in
debugmode via:just build-debug, yielding a binary intarget/debug/baibot - (recommended) in
releasemode via:just build-release, yielding a binary intarget/release/baibot
๐ก Unless you're ๐งโ๐ป developing, you probably wish to build in release mode, as that provides a much smaller and more optimized binary.
๐ฆ You can also install from the baibot crate published to crates.io with the help of the cargo package manager by running: cargo install baibot.
๐ฅ๏ธ Running a binary
Once you've ๐จ built a binary and ๐ ๏ธ prepared a configuration file, you can run it.
Consult the Dockerfile file to learn what some of the runtime dependencies are (e.g. ca-certificates, sqlite3, etc., on Debian-based distros).
You can run the binary like this:
BAIBOT_CONFIG_FILE_PATH=/path/to/config.yml \
BAIBOT_PERSISTENCE_DATA_DIR_PATH=/path/to/data \
./target/release/baibot
๐ก If you've defined the persistence.data_dir_path setting in the config.yml file, you can skip the BAIBOT_PERSISTENCE_DATA_DIR_PATH environment variable.
๐ก If your config.yml file is in your working directory (which may be different than the directory the binary lives in), you can skip the BAIBOT_CONFIG_FILE_PATH environment variable.
๐ ๏ธ Preparing a configuration file
For an introduction to the configuration file, see the ๐ ๏ธ Configuration page.
Generally, you need to copy the configuration file template (etc/app/config.yml.dist) and make modifications as needed.