Deploy with Snaps
    • Dark
      Light
    • PDF

    Deploy with Snaps

    • Dark
      Light
    • PDF

    Article summary

    • As of December 15, 2023, Rocket.Chat has ceased support for connections from cloud services and official mobile/desktop apps to workspaces running legacy versions outside our support window. Users on unsupported legacy servers are advised to upgrade to the latest Rocket.Chat version to ensure continued access to cloud, mobile, and desktop applications. Each Rocket.Chat version is supported for six months post-release.

    • The recommended deployment methods are Docker, AWS, and Kubernetes.

    Snaps offer a quick and straightforward way to deploy a Rocket.Chat workspace, primarily suited for development purposes. We do not recommend using Snaps in a production environment.

    Snaps are self-contained packages that bundle all necessary files and dependencies, simplifying the installation and update processes on Linux systems. By using Snaps, you can deploy Rocket.Chat on any Linux distribution in a secure environment, with the added benefit of automatic updates whenever a new version of Rocket.Chat is released.

    Prerequisites

    Before getting started, ensure you have:

    • A Linux-based system (e.g., Ubuntu, Debian, Fedora, etc.)

    • A CPU supporting AVX/AVX2 to run the required MongoDB version for the Rocket.Chat release.

    • Snap installed (It comes pre-installed on most modern Linux distributions. If not, refer to the Snaps installation guide)

    Step 1: Deploy Rocket.Chat using Snaps

    To install Rocket.Chat via Snap on your Linux system, run the following command:

    sudo snap install rocketchat-server --channel=x.x/stable

    This installs a specific version of Rocket.Chat. When using the --channel=x.x/stable flag, the first x represents the major version of the release, while the second x remains unchanged. For example, use 6.x/stable to install the latest release on version 6. Visit Snap Channels for more details.

    The following command installs the latest available version of Rocket.Chat:

    sudo snap install rocketchat-server

    Once the installation is complete, access your workspace by opening a web browser and navigating to the root URL (e.g., http://localhost:3000).

    It is recommended that you specify the version that you want to deploy.

    Once your workspace is deployed, the first user to log in using the setup wizard is set as the administrator. Next, to start using your workspace, check out the following documents:

    • 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.

    Step 2: Enable HTTPs

    Starting from release 0.73, Snaps include Caddy, a web server that integrates with Let's Encrypt for automatic SSL/TLS encryption. Snap hooks simplify the configuration process by ensuring proper DNS setup before enabling Let's Encrypt.

    Set up auto SSL with Snaps (4.x Latest for AMD64 or 3.x Latest for ARM64)

    To enable SSL for your Rocket.Chat workspace using Snap, follow these steps:

    1. Ensure that your domain resolves to the IP address of your server.

    2. Set the siteurl to your domain, prefixed with HTTPS:

      sudo snap set rocketchat-server siteurl=https://<your-domain>
    3. Start Caddy and restart Rocket.Chat services:

      sudo systemctl enable --now snap.rocketchat-server.rocketchat-caddy
      sudo snap restart rocketchat-server
      
    4. Access your Rocket.Chat workspace by navigating to https://<your-domain>.

    Additional steps

    For further configuration, check out the following steps you can take to customize your deployment:

    Configure Rocket.Chat with Snaps

    To view the available configuration options for your Rocket.Chat Snap installation, run:

    sudo snap get rocketchat-server

    This command will display a list of configurable variables, such as:

    Key                Value
    backup-on-refresh  disable
    ignore-errors      false
    mongo-oplog-url    mongodb://localhost:27017/local
    mongo-url          mongodb://localhost:27017/parties
    port               3000
    siteurl            http://localhost:3000

    To set or update any of these variables, use the following command:

    snap set rocketchat-server <variable-name>=<value>

    Change other Rocket.Chat environment variables

    Starting from release 0.73, you can override any Rocket.Chat environment variable using .env files  in the $SNAP_COMMON directory (/var/snap/rocketchat-server/common/). You can create multiple .env files and each file can define multiple environment variables.

    For example, to change SMTP host setting:

    1. Navigate to the $SNAP_COMMON directory:

      cd /var/snap/rocketchat-server/common
    2. Create a file named overwrite-smtp.env and add the snippet below:

      OVERWRITE_SETTING_SMTP_Host=my.smtp.server.com
    3. Restart the Rocket.Chat service to apply the changes:

      sudo systemctl restart snap.rocketchat-server.rocketchat-server.service

    Similarly, to add certificates, create a .env in the /var/snap/rocketchat-server/common or the /var/snap/rocketchat-server/current directory. The file must contain simple key=value pairs. Once this is done, restart the Rocket.Chat service.

    Configure MongoDB

    Starting from track 4.x, you can configure MongoDB for your Rocket.Chat instance. The configuration file is located in /var/snap/rocketchat-server/current/mongod.conf. For all the configuration options, see MongoDB's official documentation.

    Update Rocket.Chat on Snap

    Snap tracks let you control which major version of Rocket.Chat you're running, ensuring that your workspace receives updates specific to that track. This means your server will continue to get the latest patches and minor updates for the current track without automatically upgrading to a new major release. For example, if your workspace is on the 5.x track, it will ignore updates for 6.x until you choose to switch tracks. This approach gives you flexibility, allowing you to adopt new major versions when you're ready while keeping your workspace up-to-date within your current track. By default, the Rocket.Chat Snap installation is set to the latest available track at the time of setup.

    Before updating your workspace, consider the following:

    Update to the latest release on your current track

    To update your workspace to the latest release within your current track, refresh your server by running:

    sudo snap refresh rocketchat-server

    Update to a new major release

    To update to a new major version, switch to the desired track and refresh your Rocket.Chat server:

    sudo snap switch rocketchat-server --channel=x.x/stable
    sudo snap refresh rocketchat-server

    Alternatively, to immediately update to the latest release of a specific major version, run:

    sudo snap refresh rocketchat-server --channel=x.x/stable

    Learn more about track changes in this discussion. If you have any concerns or issues with your deployment, see Snaps FAQ.

    Snap backup and restore

    The Snap backup and restore feature allows you to easily create backups of your Rocket.Chat instance and restore them when needed. This ensures that your data is protected and can be recovered at any time.

    Backup Rocket.Chat Snap data

    To enable automatic backups whenever your Snap installation is refreshed, run:

    sudo snap set rocketchat-server backup-on-refresh=enable

    To manually create a backup of your Rocket.Chat Snap data, follow these steps:

    1. Stop your rocketchat-server by running the command:

      sudo service snap.rocketchat-server.rocketchat-server stop

      While the rocketchat-server service should be stopped, the rocketchat-mongo service should be kept running. To verify this, run the following command:

      sudo service snap.rocketchat-server.rocketchat-mongo status | grep Active

      Ensure MongoDB is still running with the output:

      Active: active (running)
    2. Run the backup command:

      sudo snap run rocketchat-server.backupdb

      A successful backup will return this:

      [+] A backup of your data can be found at /var/snap/rocketchat-server/common/backup/rocketchat_backup_<timestamp>.tar.gz
    3. Start your rocketchat-server

      sudo service snap.rocketchat-server.rocketchat-server start
    4. Copy the backup to a secure location on another system for safekeeping.

    Restore Rocket.Chat Snap data

    To restore your Rocket.Chat Snap data, follow these steps:

    1. Stop your rocketchat-server by running this command:

      sudo service snap.rocketchat-server.rocketchat-server stop

      While the rocketchat-server service should be stopped, the rocketchat-mongo service should be kept running. To verify this, run the following command:

      sudo service snap.rocketchat-server.rocketchat-mongo status | grep Active
         Active: active (running) (...)
    2. Copy your backup file to the snap's common folder:

      sudo cp rocketchat_backup.tgz /var/snap/rocketchat-server/common/
    3. Run the restore command:

      sudo snap run rocketchat-server.restoredb /var/snap/rocketchat-server/common/rocketchat_backup.tgz

      If you are replacing an existing database, you get a warning message:

      ATTENTION
      Your current database WILL BE DROPPED prior to the restore!
      Do you want to restore?
      1) Yes
      2) No

      Choose your restore option. If it is successfully done, you will see an output similar to the following:

      [*] Extracting backup file...
      [*] Restoring data...
      [*] Preparing database...
      [+] Restore completed! Please restart the snap.rocketchat services to verify.
    4. Start your rocketchat-server

      sudo service snap.rocketchat-server.rocketchat-server start

    Customizing Caddy or using an alternative HTTP proxy

    You can either use Caddy with custom configurations or opt for a different HTTP proxy. The Snap package includes both Caddy v2 (preferred) and Caddy v1 (end-of-life), with v2 prioritized.

    1. To configure Caddy manually, place your Caddyfile in the following directory and restart the Rocket.Chat service:

      /var/snap/rocketchat-server/current/
      sudo snap restart rocketchat-server
      
    2. If you prefer using another reverse proxy, disable Caddy by running:

      sudo systemctl disable snap.rocketchat-server.rocketchat-caddy

    Manual Caddy configuration for older Snap versions

    If you're using an older Snap version or want more control over the HTTPS setup, you can manually configure Caddy as follows:

    1. Run this command to disable automatic Caddy configuration:

      sudo snap set rocketchat-server caddy=disable
    2. Edit the Caddyfile found at /var/snap/rocketchat-server/current/Caddyfile and write your configuration.

    3. Replace _caddy-url_ and _port_ with your site information. For example, suppose that you have example-domain.com directed toward your server.

      If your DNS is not working, you could be instantly throttled by Let's Encrypt for up to a week.

    4. Make sure your DNS is resolved before enabling TLS. To test your DNS you can use http:

    http://example-domain.com
    
    reverse_proxy localhost:3000
    1. Restart Caddy:

    sudo systemctl reload snap.rocketchat-server.rocketchat-caddy
    1. Check the status to ensure Caddy started correctly:

    sudo systemctl status snap.rocketchat-server.rocketchat-caddy
    1. Once that is tested and resolved, to get secured communications, you can remove the http://:

    example-domain.com
    
    reverse_proxy localhost:3000

    Using an IP address will not work for automatically enabling TLS with a publicly-trusted certificate. You must use a valid hostname for a trusted certificate. See the official guide for more information.

    If you use an IP address, Caddy will still serve your site over TLS, but using a self-signed certificate.

    1. Restart the Caddy service by running:

    sudo systemctl reload snap.rocketchat-server.rocketchat-caddy
    1. You can check that the Caddy service started correctly by running:

    sudo systemctl status snap.rocketchat-server.rocketchat-caddy

    If the configuration is successful, the website should now be accessible at https://example-domain.com.

    Troubleshooting

    Q: AppArmor errors after Snap update

    If you encounter audit errors from MongoDB related to AppArmor being denied when checking logs, connect the following Snap interfaces:

    sudo snap connect rocketchat-server:mount-observe
    sudo snap connect rocketchat-server:network-observe
    sudo snap connect rocketchat-server:system-observe
    

    Without these connections, AppArmor will block access, resulting in repeated denial messages that could fill system logs and potentially consume significant disk space if log retention is not properly managed.


    Was this article helpful?