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-release to build a release version of the container image

  • or just build-container-image-debug to 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:

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 debug mode via: just build-debug, yielding a binary in target/debug/baibot
  • (recommended) in release mode via: just build-release, yielding a binary in target/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.