Skip to content
Snippets Groups Projects
user avatar
autoupdater authored
6bfb9008
History

Third-party RocketChat Package for Debian

RocketChat is a web-based chat platform. See https://rocket.chat/ for details.

This is a package for deploying RocketChat on Debian Buster or Bullseye.

Disclaimer: This package is provided by a third party. It is not an official package from the RocketChat project or the Debian project. It is automatically built from upstream releases without any review or testing. The package does not fully adhere to Debian packaging standards (especially regarding the vendoring of dependencies).

Prerequisite: Node.js 12

This only applies to Debian Buster. The Node.js version in Debian Bullseye is new enough.

RocketChat requires at least version 12 of Node.js. The package in the official Debian repositories for Debian Buster is too old.

Enable nodesource.com Debian repo:

wget -q https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O /etc/apt/trusted.gpg.d/nodesource.asc
echo "deb https://deb.nodesource.com/node_12.x buster main" > /etc/apt/sources.list.d/nodesource.list
apt update

Installing the RocketChat package later automatically installs Node.js as a dependency.

Prerequisite: MongoDB

MongoDB is not available in the official Debian repositories. However, the MongoDB project provides a third-party repo for Debian.

MongoDB can be installed on the same system as RocketChat or on a separate system. The default config in the RocketChat package expects a local installation of MongoDB.

Enable the mongodb.org Debian repo and install the mongodb-org package:

wget https://www.mongodb.org/static/pgp/server-4.2.asc -O /etc/apt/trusted.gpg.d/mongodb.asc
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" > /etc/apt/sources.list.d/mongodb.list
apt update
apt install mongodb-org

Note: At the time of writing there is no repo for Debian Bullseye on repo.mongodb.org. The Debian Buster repo seems to work fine on Bullseye.

RocketChat requires setting up a replica set. Configure the replica set, start MongoDB and initialize the replica set:

printf 'replication:\n  replSetName: "rs01"\n' >> /etc/mongod.conf
systemctl enable mongod
systemctl start mongod
sleep 10
mongo --eval 'rs.initiate()'

If you install MongoDB on the same host as RocketChat, the corresponding MongoDB URL is mongodb://localhost:27017/rocketchat?replicaSet=rs01 and the oplog URL is mongodb://localhost:27017/local?replicaSet=rs01. These are the default values, so you don't need to change the RocketChat config in /etc/rocketchat.conf.

Install and Setup RocketChat

Enable the infrapackages-rocketchat repo on https://packages.cccv.de/, then install the package rocketchat:

wget https://packages.cccv.de/docs/cccv-archive-key.gpg -O /etc/apt/trusted.gpg.d/cccv-archive.asc
echo "deb https://packages.cccv.de/infrapackages-rocketchat bullseye main" > /etc/apt/sources.list.d/cccv-rocketchat.list
apt update
apt install rocketchat

Customize the configuration in /etc/rocketchat.conf and restart RocketChat with systemctl restart rocketchat.

Per default RocketChat listens on http://localhost:3000/. Open http://localhost:3000/ in a webbrowser and follow the setup instructions.

Setup Follower Instances

Node.js applications are single-threaded. If you have more than a single CPU core, you will want to run additional RocketChat instances ("followers") on the same host to improve performance.

The package includes the systemd service template rocketchat-follower@. The instance name is used as the IP the RocketChat follower instance binds to.

Note that the official guide uses different ports for follower instances instead of different IPs. We found that with enabled Prometheus metrics, follower instances fail to start as they attempt to bind the same metrics port as the main instance.

Follower instances use the same config options as the main instance (/etc/rocketchat.conf). Options can be overwritten for followers in /etc/rocketchat-follower.conf

To enable one follower (e.g. on a system with two CPUs) run:

systemctl enable rocketchat-follower@127.0.0.2
systemctl restart rocketchat

Afterwards the two instances will listen on http://127.0.0.1:3000/ and http://127.0.0.1:3001/. Setup a load-balancer to use both instances as upstreams.