The recommended deployment methods are Docker, AWS, and Kubernetes.
This document guides you through the process of deploying a Rocket.Chat workspace on CentOS.
Prerequisites
Depending on the version of Rocket.Chat you want to install, check the releases to see the supported engine versions for MongoDB and NodeJs, and install as recommended.
Install Node.js: Download Node.js for Linux systems using the package manager.
Install Deno: Only Deno versions >=1.37.1 and <2.0.0 are supported. Follow the Deno installation guide to install the correct version.
For example, to install the
1.38.5
version with Shell, use the following command:Make sure you export the Deno path according to your installation, for instance:
Install MongoDB: Refer to the MongoDB documentation on installing MongoDB on CentOS.
When deploying MongoDB, it is crucial to secure MongoDB instances and close all MongoDB ports from public access. Unsecured instances can lead to significant security vulnerabilities. Your vigilance in these practices is essential for maintaining the integrity and safety of your systems.
Step 1: Set up MongoDB
Once MongoDB is installed, you must enable replication and specify the name of the replica set. To do this, enter the command below:
In this case, we named the replica set as
rs01
. The MongoDB replica set is mandatory for Rocket.Chat > 1.0.0.Open the MongoDB configuration file (
/etc/mongod.conf
) by running:The MongoDB configuration file should look something like this:
Refer to the MongoDB configuration documentation for additional details.
Enable and start MongoDB with the following command:
Next, initialize the replica set:
To ensure that MongoDB is running successfully, enter the following command:
Step 2: Install Rocket.Chat on CentOS
Start by installing the required dependency packages:
Check the Rocket.Chat releases to deploy the version you need. For stability and compatibility, we recommend downloading a specific version. For example, to download version 6.13.0, run this command:
Alternatively, if you prefer to download the latest version, you can use the following command (note that using
latest
is not recommended for production purposes):Extract the Rocket.Chat server files using the following command:
This command extracts the contents of the downloaded
rocket.chat.tgz
compressed tar archive located in the/tmp
directory and places the extracted files into the same/tmp
directory.Next, run the following command to change the current directory and install the necessary production dependencies.
When executing
npm install
, it is recommended to operate using a non-root account. Alternatively, you can utilize thenpm install --unsafe-perm
command. This approach eliminates the necessity for building libc or upgrading the host system.Move the extracted files to the
/opt
directory:This guide uses the
/opt
directory. However, you can choose your preferred directory.
Step 3: Configure the Rocket.Chat service
Add the Rocket.Chat user and set the proper permissions on the Rocket.Chat folder:
We need the NodeJS binary path to create the Rocket.Chat service file. Depending on how you install NodeJS, the binary path may be different. Save the path to a variable as follows:
Now create a barebone service file, which the system will use to start your Rocket.Chat daemon/process. Create the Rocket.Chat service file as follows:
You may need to replace
User=rocketchat
with your current user (e.g.,User=ubuntu
) if Rocket.Chat or any pre-requisite software is running under a different user on your system.Alternatively, if you don’t want to use the
NODE_PATH
variable in the service file, save the path to the variable, and then print it to find the path as follows:Now replace the
ExecStart
variable in the service file with the path you see in your terminal, for example :If you use
nvm
to manage Node.js versions, update theExecStart
variable as follows:Be sure to replace
<user>
and<node_version>
with your actual system user and installed Node.js version.
Step 4: Pass environment variables
Running the Rocket.Chat daemon requires passing some environment variables. See Rocket.Chat environment variables for more details.
Update the Rocket.Chat file by running:
Update the file with the following information according to your configuration and save it:
Additional steps for installing 6.10 release
If you’re installing version 6.10, run these additional commands:
Now start the Rocket.Chat service using the following command:
Check the status of the Rocket.Chat process with this command:
If you edit your Rocket.Chat configuration file, make sure to reload the daemon and restart the Rocket.Chat process by running the following commands:
Step 5: Configure your Rocket.Chat workspace
To access your Rocket.Chat workspace, open a web browser, and navigate to the specified root URL (http://your-host-name.com:3000
). Follow the configuration prompts to configure your workspace. During the configuration steps, your workspace and email are registered to the Rocket.Chat Cloud portal. You can manage your workspace and subscriptions from the cloud portal.
Next steps
Great! You’ve successfully created your Rocket.Chat workspace and logged in. Next, check out the following documents to get started:
User Guides: Learn the basics of your Rocket.Chat account, the types of rooms, and how to communicate with your workspace users.
Workspace Administration: Administrators and owners can set and manage various configurations.
Marketplace: Explore the available apps to enhance your workspace.
You can also apply the following additional configuration to your Rocket.Chat setup for enhanced security and performance:
Enable HTTPS for your Rocket.Chat workspace
For your workspace’s security, your domain should be accessible only via HTTPS. While there are various ways to set up a reverse proxy, this section provides a walkthrough on using Nginx or Traefik.
Prerequisite
You must set up a DNS record for your domain before configuring Nginx with Let's Encrypt. This domain must have A or AAAA records pointing to the IP address where Nginx is running
Using Nginx
Install Nginx
Create a new Nginx configuration file:
Add the following configuration, replacing
your_domain.com
with your actual domain:Enable the necessary SELinux boolean to allow Nginx to connect to your backend:
Test and restart Nginx:
This proxies requests from port 80 to Rocket.Chat running on
localhost:3000
.Enable SSL with Let's Encrypt and Certbot by installing the Certbot and the Nginx plugin:
Run Certbot to obtain and configure the SSL certificate:
Ensure
your_domain.com
is set correctly in your Nginx config.Follow the prompts to provide an email, agree to terms, and enable HTTPS redirection. Certbot will automatically configure SSL and set up renewal.
After completion, verify HTTPS by visiting
https://your_domain.com
.
Prerequisite
You must set up a DNS record for your domain before configuring Traefik with Let's Encrypt. This domain must have A or AAAA records pointing to the IP address where Traefik is running.
Using Traefik
Install Traefik:
Create a Traefik configuration file:
Add the following:
Replace
your_email@your_domain.com
with your email address.Create a dynamic configuration file for Rocket.Chat:
Add the below:
Make sure
your_domain.com
andhttp://your_ip:3000
point to the appropriate domain and IP address respectively.Create a
systemd
service file for Traefik:Add:
Enable the necessary SELinux boolean for Traefik:
Start and enable Traefik:
Open your Rocket.Chat
systemd
service file to set the correct ROOT_URL:Update the Environment variable::
Restart Rocket.Chat:
Make sure ports 80 and 443 are open:
Now, you can access your Rocket.Chat workspace securely via HTTPS using https://your_domain.com
.
If you're not using a reverse proxy and have a firewall enabled, you may need to allow traffic on port 3000. For more details, refer to the firewall rule documentation.
Here are other additional configuration options to consider when optimizing your Rocket.Chat server:
Monitor and log your deployment
This section provides a guide to monitoring your deployments' health and quickly diagnosing any issues.
Rocket.Chat logs
Check the latest Rocket.Chat logs:
View logs in real-time:
Check Rocket.Chat status:
MongoDB logs
Check MongoDB logs:
View logs in real-time:
Check MongoDB status:
Connect to MongoDB and verify the replica set:
Check system-wide logs
If a service is failing and you need system-wide logs:
For logs of a specific time range (e.g., last 30 minutes):
Nginx logs
Check error logs:
Check access logs:
Monitor logs in real-time:
Check if Nginx is running:
Test the Nginx configuration:
If there are configuration issues, restart Nginx after fixing them:
Traefik logs
Check Traefik logs with:
View logs in real-time:
Check Traefik’s status:
Update your workspace version
It’s important to keep your workspaces updated to enjoy the benefits of new features and fixes.
Follow these steps to update your workspace version:
Stop the Rocket.Chat service with this command:
Remove the installation folder, usually in
/opt
:Ensure you have the supported node and MongoDB versions by checking the releases.
Download the version of Rocket.Chat that you need:
Using
latest
instead of the version number is not recommended.Extract the Rocket.Chat server files using the following command:
Next, run the following command to change the current directory and install the necessary production dependencies:
Move the extracted files to the
/opt
directory:
Start the Rocket.Chat service:
Check the status of the Rocket.Chat process with this command:
If you have any questions or issues when updating Rocket.Chat, refer to the Updating Rocket.Chat FAQ. For information on supported MongoDB versions, see the MongoDB version support document.