Running Rocket Chat on a Raspberry Pi in 2023
I run a private Rocket.Chat server on a Raspberry Pi 4. I previously installed it using Snapcraft on Ubuntu, using the official repository. I hadn't noticed it update for a while, and decided to investigate why.
Initial Investigation
Let's check the snap for the arm64
processor architecture!
OK, the latest version is 4.1.2
. Let's take a look at how long versions recieve security fixes via the Enterprise Support page:
Oh... support ended over a year ago. OK, so there's no newer version on Snapcraft, maybe there's a Docker image?
Hmm.. dead end. So can I build it myself on a Raspberry Pi?
$ git clone https://github.com/RocketChat/Rocket.Chat.git
$ cd Rocket.Chat
$ yarn install
➤ YN0000: ┌ Link step
➤ YN0007: │ fibers@npm:5.0.3 must be built because it never has been before or the last one failed
➤ YN0007: │ @rocket.chat/forked-matrix-sdk-crypto-nodejs@npm:0.1.0-beta.12 must be built because it never has been before or the last one failed
➤ YN0009: │ @rocket.chat/forked-matrix-sdk-crypto-nodejs@npm:0.1.0-beta.12 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-f89b4618/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 127, logs can be found here: /tmp/xfs-2075a91e/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 127, logs can be found here: /tmp/xfs-e191f757/build.log)
➤ YN0009: │ fibers@npm:5.0.3 couldn't be built successfully (exit code 127, logs can be found here: /tmp/xfs-12f255a7/build.log)
➤ YN0000: └ Completed in 26s 443ms
➤ YN0000: Failed with errors in 47s 360ms
Ah... it looks like arm64
support has been dropped/broken, however there was no announcement about it. 😳
Considering this wasn't caught, it means that there was never "good" arm64
support. If that were the case, I'd expect a build to start failing somewhere before the breaking changes were merged... but probably arm64
was a bit of an afterthought and no-one really cares about it.
So... better to use amd64
. But I have a Raspberry Pi set up and would like to continue using it. Is it possible?
Fixing the arm64
Build
The core problem is that some of the dependencies pull in native C++ code which needs to be compiled, and these are failing. There are certain dependencies which make specific assumptions about running under Linux on amd64
... and fixing them is quite a big job.
I made some progress towards it, but quickly found the cost/benefit balance isn't quite right going this route, I don't have hours to dump on it. So, what else can we do?
Docker amd64
Emulation
It turns out, there's a one-liner to add amd64
support to Docker. The below command enables amd64
support via the following library: https://github.com/tonistiigi/binfmt:
sudo docker run --privileged --rm tonistiigi/binfmt --install amd64
Emulation proved unstable in the end, and I gave up and attempted to go down the route with less friction with an x86_64 CPU: Running Rocket Chat on an Intel Celron CPU in 2023.
Now, we can run Rocket.Chat as part of a normal docker-compose.yml
:
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:5.4.4
restart: always
container_name: rocketchat
environment:
MONGO_URL: "mongodb://mongodb:27017/rocketchat?replicaSet=rs0&directConnection=true"
MONGO_OPLOG_URL: "mongodb://mongodb:27017/local?replicaSet=rs0&directConnection=true"
ROOT_URL: http://localhost:3000
PORT: 3000
DEPLOY_METHOD: docker
depends_on:
- mongodb
ports:
- 3000:3000
volumes:
- ./uploads:/app/uploads
mongodb:
image: bitnami/mongodb:4.4.15
restart: always
container_name: mongo
environment:
MONGODB_REPLICA_SET_MODE: primary
MONGODB_REPLICA_SET_NAME: rs0
MONGODB_PORT_NUMBER: 27017
MONGODB_INITIAL_PRIMARY_HOST: mongodb
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27017
MONGODB_ADVERTISED_HOSTNAME: mongodb
MONGODB_ENABLE_JOURNAL: true
ALLOW_EMPTY_PASSWORD: yes
volumes:
- ./mongo:/bitnami/mongodb
Running docker compose up -d
as normal creates the emulated versions of Rocket Chat server and MongoDB.
Performance
Emulation proved unstable in the end, and I gave up and attempted to go down the route with less friction with an x86_64 CPU: Running Rocket Chat on an Intel Celron CPU in 2023.
The performance of the emulation approach (as you might have guessed) is really bad. The server itself takes about 10 minutes to start on my Raspberry Pi 4 (it is overclocked with active cooling) - so I can imagine this solution won't be workable for some cases.
However, it's a chat app... it still works fine for that purpose, albeit there's a bit more of a delay to send messages. Everything does still work, and now I'm using a supported version with a low-friction upgrade path.
🏷️ chat rocket raspberry pi about emulation cpu fix docker route snapcraft let versions failing dependencies
Please click here to load comments.