etkecc / baibot

🤖 A Matrix bot for using diffent capabilities (text-generation, text-to-speech, speech-to-text, image-generation, etc.) of AI / Large Language Models (OpenAI, Anthropic, etc.)
GNU Affero General Public License v3.0
48 stars 4 forks source link

Docker run leads to error #2

Closed kitzler-walli closed 2 months ago

kitzler-walli commented 2 months ago

I currently try to get the bot running in my Matrix Ansible deployment but when In try to run the docker container I receive this error: /bin/sh: 1: /app/baibot: Exec format error

I user Ubuntu 24.04.1 LTS and Docker version 27.2.0, build 3ab4256

this is the command I try to execute:

docker run \
-it \
--rm \
--name=matrix-bot-baibot \
--user=998:1000 \
--cap-drop=ALL \
--read-only \
--network=matrix-addons \
--env-file=/matrix/baibot/config/env \
--mount type=bind,src=/matrix/baibot/config/config.yml,dst=/app/config.yml,ro \
--mount type=bind,src=/matrix/baibot/data,dst=/data \
--tmpfs=/tmp:rw,noexec,nosuid,size=1024m \
ghcr.io/etkecc/baibot:latest
spantaleev commented 2 months ago

Are you possibly on the arm32 architecture? There's no prebuilt image for it, so you would need to use self-building.

I think there is also a playbook bug, in the sense that self-building is not automatically enabled for you when it should be.

kitzler-walli commented 2 months ago

I'm using amd64 (x86_64). How can i work around the self-building issue?

spantaleev commented 2 months ago

The image should be multi-arch and support both amd64 and arm64. Could you try pulling it again?

kitzler-walli commented 2 months ago

It seems like the image is not built - when i do it by hand it seems to work but when I use the docker run command I've shown in my first comment I still receive /bin/sh: 1: /app/baibot: Exec format error

kitzler-walli commented 2 months ago

I was able to surpass the problems by building the image locally and then use it in my matrix setup. That works, at least it compiles and starts but during the usage of the bot I now receive these errors: Couldn't setup and resume recovery Sdk(Http(Reqwest(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("matrix.kw.at")), port: None, path: "/_matrix/client/v3/user/@baibot:kw.at/account_data/m.secret_storage.default_key", query: None, fragment: None }, source: TimedOut })))

Error: Error creating a new login session: Error recovering encryption keys: Failed to recover with an unknown error: Failed to recover with an unknown error: SecretStorage(Sdk(Http(Reqwest(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("matrix.kw.at")), port: None, path: "/_matrix/client/v3/user/@baibot:kw.at/account_data/m.secret_storage.default_key", query: None, fragment: None }, source: TimedOut }))))

Could it be an issue with the docker networks?

spantaleev commented 2 months ago

You're right - the :latest tag was problematic and only worked on arm64. It's some odd CI issue with that build which I haven't figured out yet.

I have rebuilt it and it seems to be fine now. I'll keep an eye on future CI runs and see if it can be reproduced.


The error that you're quoting seems to indicate a that the bot cannot connect to the Matrix server.

If you're using the Ansible playbook with the default Traefik reverse-proxy server, it should be communicating with Synapse via http://matrix-traefik:8008 over the container network. To allow this, the bot is automatically connected to the traefik network. To clarify, Synapse (in non-worker-mode) is reachable via http://matrix-synapse:8008 on the matrix-homeserver network, but requests are made to go through Traefik (http://matrix-traefik:8008) as an additional level of indirection.

If you're using another reverse-proxy, you may need to adjust the configuration and/or container networks.


About self-building not kicking in correctly on arm32 (as I was suspecting earlier), it turns out that it's not the case.

Self-building is correctly enabled for architectures other than arm64 and amd64 as seen here.