Setup Rocket.Chat via Plesk Obsidian and Docker Containers

Best Practise Walktrough for Plesk 18.0.x

In this tutorial, we will use a Linux Debian 12 server with Plesk Obsidian 18.0.63 Update 4 (October 2024). Other Linux operating systems supported by Plesk should work similarly. Our example domain for this configuration is chat.data-horizon.de. Please replace this with your own domain when applying the configuration. This walkthrough demonstrates using different ports than the default ones, showing that multiple Rocket.Chat instances can run on a single server.

Set Up a MongoDB Container

  • Rocket.Chat 6.x only supports MongoDB 6.x.
  • As a first step, we will create a directory on the server to store the database data of our MongoDB Docker container. This ensures that updates to the latest MongoDB Docker image versions via regeneration are possible without data loss.
				
					root@server ~ # mkdir -p /var/www/docker/chat.data-horizon.de/mongodb/data
root@server ~ # chmod 777 /var/www/docker/chat.data-horizon.de/mongodb/data 
				
			
  • „777“ permissions are required; otherwise, the MongoDB startup script cannot create its own data structure as the mongodb user, which is created during the image build process.
  • Now we are ready to create the MongoDB Docker container using the Plesk Docker extension’s GUI. We will use „bitnami/mongodb:6.0.13“ as this image provides all the necessary environment variables for proper setup with the Plesk Docker GUI.
  • Important: If you are using Plesk’s or another firewall, ensure port 27018 is open for network traffic on the external interface.
  • Container name: mongodb-6.0.x-data-horizon-chat
  • Memory limit: 12288 (or another value based on your needs)
  • Automatic start after system reboot: active
  • Automatic port mapping: inactive
  • Manual mapping: 27017 to external 27018
  • Make the port inaccessible from the Internet: inactive
  • Volume mapping: „/bitnami/mongodb“ to „/var/www/docker/chat.data-horizon.de/mongodb/data“
  • Environment variables:
				
					MONGODB_ROOT_PASSWORD: [YOUR-CHOSEN-MONGODB-ROOT-PASSWORD]
MONGODB_REPLICA_SET_MODE: primary
MONGODB_REPLICA_SET_KEY: [YOUR-CHOSEN-MONGODB-KEY]
MONGODB_ADVERTISED_HOSTNAME: [IP-OF-YOUR-SERVER]
MONGODB_ADVERTISED_PORT_NUMBER: 27018
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27018
MONGODB_PORT_NUMBER: 27017
				
			
  • Once everything is set up, press „OK“ to initiate the first MongoDB container’s startup that will configure the database based on our environment variables.
  • If successful, the following log should appear:
  • The error message „MongoNetworkError: connect ECONNREFUSED [IP-OF-YOUR-SERVER]:27017“ can be safely ignored.
  • Now we are ready for the next step.

Set Up a Rocket.Chat Container

  • We will use „rocketchat/rocket.chat:6.9.7“ as version 6.9.x is still supported, and we prioritize stability over the latest features for our Rocket.Chat instances.
  • If the Plesk Docker GUI no longer shows „rocketchat/rocket.chat:6.9.7“ in the dropdown menu (due to a restricted number of entries), you can install it via the command line:
				
					root@server ~ # docker pull rocketchat/rocket.chat:6.9.7
				
			
  • The settings for the Rocket.Chat container should be as follows:
  • Container name: rocket.chat-6.x-data-horizon-chat
  • Memory limit: 4096
  • Automatic start after system reboot: active
  • Automatic port mapping: inactive
  • Manual mapping: 3000 to external 3001
  • Make the port inaccessible from the Internet: active
  • Volume mapping: As we are not using the „/app/uploads“ directory, volume mapping is not needed for this container.
  • Environment variables:
				
					MONGO_URL: mongodb://root:[YOUR-CHOSEN-MONGODB-ROOT-PASSWORD]@[IP-OF-YOUR-SERVER]:27018/rocketchat?authSource=admin
MONGO_OPLOG_URL: mongodb://root:[YOUR-CHOSEN-MONGODB-ROOT-PASSWORD]@[IP-OF-YOUR-SERVER]:27018/local?replSet=replicaset
ROOT_URL: https://chat.data-horizon.de

				
			
  • Once everything is set up, press „OK“ to start the Rocket.Chat container. If successful, the following log should appear:
  • Now we are ready for the final step.

Docker Proxy Rules

  • The settings for the „Docker Proxy Rules“ for the domain should be as follows:
  • Container and Port: Select the Rocket.Chat instance.
  • Support WebSocket traffic: This option must be enabled.
  • After pressing „OK,“ the Rocket.Chat setup should be accessible when opening the domain in your browser.

Firewall Issues?

However, if you have trouble opening port 2018 on the external interface, you could try using the standard port and localhost if only one Rocket.Chat instance is planned for the server. In that case, the external port does not need to be opened (manual mapping 2017 => 2017).

				
					MONGODB_ADVERTISED_HOSTNAME: 127.0.0.1
MONGODB_ADVERTISED_PORT_NUMBER: 27017
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27017
MONGODB_PORT_NUMBER: 27017
				
			

Of course, also change the connection strings of Rocket.Chat to use this new port and localhost.

Does this sound too technical?

If you need help with your Rocket.Chat setup, we would love to assist you. Just contact us, and we will provide the support you need.

Or are you interested in a managed Rocket.Chat solution? Starting at 29 EUR net per month, we can set up this GDPR-compliant chat solution for you, including all maintenance tasks and a backup solution for your sensitive data.

Kategorien
Picture of Michael
Michael
Diesen Beitrag teilen

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Sie sehen gerade einen Platzhalterinhalt von Google reCAPTCHA Kommentar. Um auf den eigentlichen Inhalt zuzugreifen, klicken Sie auf den Button unten. Bitte beachten Sie, dass dabei Daten an Drittanbieter weitergegeben werden.

Weitere Informationen '
'