Detailed steps for installing rockerChat in docker and setting up a chat room

Detailed steps for installing rockerChat in docker and setting up a chat room

Comprehensive Documentation

github address

https://github.com/RocketChat/Rocket.Chat

docker-compose documentation

https://docs.rocket.chat/installation/docker-containers/docker-compose

Configuration Files

Get the docker-compose file

Enter the command

curl -L https://raw.githubusercontent.com/RocketChat/Rocket.Chat/develop/docker-compose.yml -o docker-compose.yml

The file content is

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: unless-stopped
   volumes:
     - ./uploads:/app/uploads
   environment:
     -PORT=3000
     - ROOT_URL=http://localhost:3000
     - MONGO_URL=mongodb://mongo:27017/rocketchat
     - MONGO_OPLOG_URL=mongodb://mongo:27017/local
     - MAIL_URL=smtp://smtp.email
# - HTTP_PROXY=http://proxy.domain.com
# - HTTPS_PROXY=http://proxy.domain.com
   depends_on:
     - mongo
   ports:
     - 3000:3000
   labels:
     - "traefik.backend=rocketchat"
     - "traefik.frontend.rule=Host: your.domain.tld"
  mongo:
   image: mongo:4.0
   restart: unless-stopped
   volumes:
     - ./data/db:/data/db
     #- ./data/dump:/dump
   command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
   labels:
     - "traefik.enable=false"
  # This container's job is just running 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: 'localhost:27017' } ]})\" &&
         s=$$? && break || s=$$?;
         echo \"Tried $$i times. Waiting 5 secs...\";
         sleep 5;
       done; (exit $$s)"
   depends_on:
     - mongo
  # hubot, the popular chatbot (add the bot user first and change the password before starting this image)
  hubot:
   image: rocketchat/hubot-rocketchat:latest
   restart: unless-stopped
   environment:
     - ROCKETCHAT_URL=rocketchat:3000
     - ROCKETCHAT_ROOM=GENERAL
     -ROCKETCHAT_USER=bot
     -ROCKETCHAT_PASSWORD=botpassword
     - BOT_NAME=bot
  # you can add more scripts as you'd like here, they need to be installable by npm
     - EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-diagnostics
   depends_on:
     - rocketchat
   labels:
     - "traefik.enable=false"
   volumes:
     - ./scripts:/home/hubot/scripts
  # this is used to expose the hubot port for notifications on the host on port 3001, e.g. for hubot-jenkins-notifier
   ports:
     - 3001:8080
  #traefik:
  # image: traefik:latest
  # restart: unless-stopped
  # command: >
  # traefik
  # --docker
  # --acme=true
  # --acme.domains='your.domain.tld'
  # --acme.email='[email protected]'
  # --acme.entrypoint=https
  # --acme.storagefile=acme.json
  # --defaultentrypoints=http
  # --defaultentrypoints=https
  # --entryPoints='Name:http Address::80 Redirect.EntryPoint:https'
  # --entryPoints='Name:https Address::443 TLS.Certificates:'
  # ports:
  # - 80:80
  # - 443:443
  # volumes:
  # - /var/run/docker.sock:/var/run/docker.sock

Modify the file

nano docker-compose.yml

Change ports to a custom port, the default is 3000, here I change it to 5001

img

Start the service

Enter the command

docker-compose up -d

Access Services

Use http://IP:Port

Enter the installation wizard by default

Set administrator information

img

Set organization information

img

Set server information

img

Register Server

img

Set up for success

img

Enter the default public chat room

img

Click on the upper left corner to create a user

To test the connection between two users

img

Test text, emoji, picture, voice, video, video conference

img

Setting up https

Apply for an SSL certificate and use the IP: port number before the nginx proxy.

At the same time, the domain name is resolved to the corresponding server IP

server {
       listen 443;
       # rocketchat
       server_name rocketchat.domain.com;
       ssl on;
       #root html;
       # index index.html index.htm;
       # The SSL certificate is placed in the domain folder at the same level ssl_certificate cert/domain/rocketchat.domain.com_bundle.crt;
       ssl_certificate_key cert/domain/rocketchat.domain.com.key;
       ssl_session_timeout 5m;
       ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
       ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
       ssl_prefer_server_ciphers on;
       location / {
           #Point to a current service port proxy_pass http://127.0.0.1:5001;
           #Set the request header and pass the header information to the server proxy_redirect off;
           proxy_set_header Host $host;
           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade";
       }
   }

Tips

Some services, such as voice messages, video messages, file transfers, APP applications, etc., require https protocol access.

It is recommended to configure Https in time. If you just want to try it, just use ip:port.

img

The above is the details of how to install rockerChat in docker and set up a chat room. For more information about the docker rockerChat chat room, please pay attention to other related articles on 123WORDPRESS.COM!

<<:  Five delay methods for MySQL time blind injection

>>:  Using text shadow and element shadow effects in CSS

Recommend

Optimize MySQL with 3 simple tweaks

I don't expect to be an expert DBA, but when ...

Detailed explanation of Grid layout and Flex layout of display in CSS3

Gird layout has some similarities with Flex layou...

Call and execute host docker operations in docker container

First of all, this post is dedicated to Docker no...

Specific method to add foreign key constraints in mysql

The operating environment of this tutorial: Windo...

Vue implements login type switching

This article example shares the specific code of ...

MySQL Optimization Summary - Total Number of Query Entries

1. COUNT(*) and COUNT(COL) COUNT(*) usually perfo...

Native JS to implement the aircraft war game

This article example shares the specific code of ...

61 Things Every Web Developer Should Know

Normally, you'll need to read everyone's s...

How to quickly query 10 million records in Mysql

Table of contents Normal paging query How to opti...

Using group by in MySQL always results in error 1055 (recommended)

Because using group by in MySQL always results in...

N ways to center elements with CSS

Table of contents Preface Centering inline elemen...

Common errors and solutions for connecting Navicat to virtual machine MySQL

Question 1 solve Start the service: service mysql...

5 Ways to Send Emails in Linux Command Line (Recommended)

When you need to create an email in a shell scrip...

Docker stop stops/remove deletes all containers

This article mainly introduces Docker stop/remove...