In this Howto I will show you how to deploy Rocket.Chat within plesk with docker
If you want to know more about Rocket.Chat
, follow this link.
Prepare vHost:
First of all, we have to create a vHost in plesk, I will use chat.mastodontech.de
in this example, you have to use your own domain or subdomain.
and secure it with LetsEncrypt
:
Within the subdomain we use the file manager
:
and remove all files and directories:
Now we config the Apache & nginx Settings
for the domain.
Disable the Proxy Mode
and Apply the settings.
After you applied the settings add the following block in Additional nginx directives
(adjust your domain):
location / { proxy_pass http://127.0.0.1:3000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Nginx-Proxy true; proxy_redirect off; }
And save with OK
Prepare Rocket.Chat:
For this step, we have to connect to our server with ssh.
If you do not have installed docker-compose
yet, install it now:
curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose
and make it executable:
chmod +x /usr/local/bin/docker-compose
Next you have to edit your hosts-file
:
nano /etc/hosts
and add your domain below the line with localhost:
127.0.0.1 localhost.localdomain localhost
127.0.0.1 chat.mastodontech.de chat
and save.
Then change the directory to your vHost (adjust your domain/subdomain):
cd /var/www/vhosts/mastodontech.de/chat.mastodontech.de
and create the following directories:
mkdir -p /var/www/vhosts/mastodontech.de/chat.mastodontech.de/data/runtime/db mkdir -p /var/www/vhosts/mastodontech.de/chat.mastodontech.de/data/dump
now create a docker-compose.yml
file:
nano docker-compose.yml
and add the following content:
version: '2' services: rocketchat: image: rocketchat/rocket.chat:latest command: > bash -c "for i in `seq 1 30`; do node main.js && s=$$? && break || s=$$?; echo \"Tried $$i times. Waiting 5 secs...\"; sleep 5; done; (exit $$s)" restart: always volumes: - ./uploads:/app/uploads environment: - PORT=3000 - ROOT_URL=http://chat.mastodontech.de # adjust your domain here - MONGO_URL=mongodb://mongo:27017/rocketchat - MONGO_OPLOG_URL=mongodb://mongo:27017/local - Accounts_UseDNSDomainCheck=false depends_on: - mongo ports: - 127.0.0.1:3000:3000 mongo: image: mongo:4.0 restart: always volumes: - ./data/db:/data/db - ./data/dump:/dump command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1 labels: - "traefik.enable=false" ports: - 127.0.0.1:27017:27017 # this container's job is just run the command to initialize the replica set. # it will run the command and remove himself (it will not stay running) mongo-init-replica: image: mongo:4.0 command: > bash -c "for i in `seq 1 30`; do mongo mongo/rocketchat --eval \" rs.initiate({ _id: 'rs0', members: [ { _id: 0, host: '127.0.0.1:27017' } ]})\" && s=$$? && break || s=$$?; echo \"Tried $$i times. Waiting 5 secs...\"; sleep 5; done; (exit $$s)" depends_on: - mongo
save file and use docker-compose
to bring up the container.
docker-compose up -d
We should correct the permissions of files and directories, the fastest way is to use plesk repair command:
plesk repair fs -v
then check if containers are running with:
docker ps
Round about a minute your containers up and running and the Setup-Wizard should appear in your webbrowser (you have to open it by yourself):
Add your admin-user here and finish the wizard.
The Documentation for Rocket.Chat is here.
To integrate your Nextcloud, look here
Have Fun and Happy Nextclouding with Rocket.Chat. 🙂
41 Gedanken zu „How to deploy Rocket.Chat in Plesk with docker“
Hallo Markus, vielen Dank für diesen Beitrag. Dank diesem bin ich ein gutes Stück weitergekommen bei der Einrichtung/Aktivierung von RocketChat auf einer sub-domain. Ich stecke nur leider fest, beim aufrufen dieser bekomme ich eine ‚502‘ Error Page. Im Protokoll finde ich ein ngix Fehler:
56119#0: *317 recv() failed (104: Connection reset by peer) while reading response header from upstream
Hi Erik,
der Artikel ist schon etwas älter, versuch mal den neueren nginx-Block:
Ansonsten mal auf die Seite schauen, kann sich einiges geändert haben: https://docs.rocket.chat/installing-and-updating
Gruß
Markus
Den genau gleichen Fehler habe ich hier auch 🙁
Kennt jemand einen Admin, der das gegen €€€ heile macht? @Markus?
Hi,
kann ich mir natürlich anschauen. Meine Mail-Adresse findest Du im Impressum
Gruß
Markus
Klasse, Mail ist raus. Freue mich 🙂
Hi,
danke für die Anleitungen, die ganze Mühe das hier bereitzustellen, etc!
Kombinationen aus den Aritkeln hier um meine AWS Jitsi Server abschalten zu können und im Plesk laufen zu lasssen!
Gruß!!!
Super Anleitung. Danke.
Nur läuft mein Plesk Backup seit der Installation nicht mehr durch, da im Dataverzeichnis die Berechtigungen auf den User sw-cp-server laufen. Muss man da noch irgend etwas beachten? Der Befehl plesk repair fs -v scheint nämlich auch keine Lösung gebracht zu haben.
I am confused now: Installed it, worked, messed it up, deleted the Docker-Containers via Plesk-GUI and reinstalled again. Now I see the old, messed up configs are still there… I thought, all of this was stored in the Mongo-Container? How come, this survived?
It is saved in the docker volume of the mongo container.
The only thing I had to do to get it to work with my version of Plesk was to keep the Proxy Mode enabled and install Docker then everything worked great.
Without Proxy Mode enabled I would get a 403 error
Web Admin Se Edition with Plesk Obsidian 18.0.28
Thanks
jau, same here, 403 without ProxyMode
@Markus: THANKS MAN!!! You were making my NextCloud very happy, now you saved my Day on the Rocket.chat. GREAT!!!
OLAF 🙂
Olaf! I thank you for supporting my blog! 🙂
Plesk has mattermost extension available which is same as rocketchat – just click to install – it’s free.
Moin Markus
Erstmal, Eine sehr gute Anleitung, da wünscht man sich mehr von.
Leider hat es bei mir nicht so ganz funktioniert.
Es scheint das der Docker-Container läuft, zumindest bekomme ich hier Up-Zeiten angezeigt.
Leider bekomme ich aber beim Aufruf der Seite „403 Forbidden / NGINX“.
In den Logs:
*28296598 upstream sent no valid HTTP/1.0 header while reading response header from upstream
*28296598 readv() failed (104: Connection reset by peer) while reading upstream
*28296599 upstream sent no valid HTTP/1.0 header while reading response header from upstream
*28296599 readv() failed (104: Connection reset by peer) while reading upstream
*28296602 upstream sent no valid HTTP/1.0 header while reading response header from upstream
*28296602 readv() failed (104: Connection reset by peer) while reading upstream.
Was habe ich falsch gemacht?
Hi. Up-Zeiten heißt noch nicht, dass der Container richtig läuft. Er braucht schon eine Weile bis er oben ist. Schau mal in die Logs vom Container. Wenn Du das nicht auf der CLI kannst, schaust Du in der Plesk-GUI
Gruß Markus
Hello again. I have a problem installing any app! The workspace is registered to rocket chat cloud and syncs without errors but when i try to install any app i get a blank red notification without any specific error in it. Searching the error logs in home folder i see this:
2020/04/17 12:12:34 [error] 16637#0: *82647 „/var/www/vhosts/mydomain/httpdocs/api/apps/index.html“ is not found (2: No such file or directory), client: xx.xx.xx.xx, server: mydomain, request: „POST /api/apps/ HTTP/2.0“, host: „mydomain“, referrer: „https://mydomain/admin/marketplace“
I tried reinstalling but nothing… Any ideas plz?
Hi, did you use the new nginx directives?
Markus
Yes I double checked everything from the guide again
I had played around and set up a fresh instance following my Guide and everithing fine.
Please check if php-handler is disabled?
Php-handler was set right but…. I did not set on the docker proxy rules to target the container (websites and domains->domain->docker proxy rules on Plesk panel). Without this everything was working fine and didn’t think it was needed. I did it a few minutes ago and now applications are installing fine. I repeated this on my first instance too and the problem was solved there too.
Hallo,
Ich habe die Anleitung so jetzt gemacht, nur kann ich nicht auf die Anmeldeseite von Rocketchat zugreifen.
Nach dem Befehl „docker ps“ sollte ich doch mit nem Browser auf die Seite von meinem Rocketchat kommen oder ?
Wer kann mir helfen ?
Hallo, die URL musst Du natürlich manuell in Deinen Browser eintragen.
Gruß
Markus
Hallo,
Ich bin jetzt soweit, das ich von RocketChat ne 403 Forbidden Seite bekomme.
in der zweiten Zeile steht noch nginx.
Welche Einstellung stimmt jetzt noch nicht?
Hallo, ohne Logs vom vHost oder Container, kann ich dazu leider nichts sagen.
Omg you are a a life saver. I have been struggling for days trying to install it from Plesk Docker extension! Thank you! Up and running ?
🙂 nice to hear
It seems i have the websocket is disabled error too, in mobile apps. Working great on desktop.
Hi,
try to use this block in nginx:
and give Feedback please 🙂
Same error 🙁
Would you please send me or publish the error-Logs of the related vHost? Have you enabled mod-security?
Ok. It works after reinstalling in a new subtomain. I was using the main domain and it mod security was enabled on it. Disabling mod security did not helped but i aslo have tried a lot of possible solutions, even from terminal without any success and i thought maybe i should reinstall in a subdomain. It works great with a subdomain… I am not sure what went wrong in the main domain. Thank you again
Hey my friend,
Just wanted to say thank you very much for this thorough guide and support. You rock!
Thank you. You are welcome 🙂
Hi, how to update. Thanks.
docker pull rocketchat/rocket.chat:latest
docker-compose stop rocketchat docker-compose rm rocketchat docker-compose up -d rocketchat
Yyyyyessss! Thanks again!!!
I followed this guide and almost averything works except android app. After installing the app i tried to connect to my server with https://chat.mydomain.com and I get the error message that websocket is disabled. The chat works only when I provide http://mydomain.com:3000. I added nginx directives but no luck. Any advice?
Have this error
ERROR: yaml.scanner.ScannerError: while scanning a quoted scalar
in „./docker-compose.yml“, line 33, column 14
found unexpected end of stream
in „./docker-compose.yml“, line 36, column 1
Sorry for that, I renewed the yml content.
hello Markus
is there a way to deploy it with docker, without installing or modifying anything on linux?
just on Plesk?
Thanks in advanced
Hi, you can use docker as Server Admin only. Are you? Or is your problem using the shell?