Deploy RocketChat on Debian with Docker

Firstly, install docker and then install docker compose if you haven't already.

Install git

sudo apt-get install -y git  

Clone the RocketChat repository and navigate to within the source code.

git clone https://github.com/RocketChat/Rocket.Chat.git
cd Rocket.Chat

You should see a docker-compose.yml file with the contents below (may have changed since writing this tutorial).

mongo:
  image: mongo
# volumes:
#    - ./data/runtime/db:/data/db
#    - ./data/dump:/dump
  command: mongod --smallfiles --oplogSize 128

rocketchat:
  image: rocketchat/rocket.chat:develop
# volumes:
#    - ./uploads:/app/uploads
  environment:
    - PORT=3000
    - ROOT_URL=http://yourhost:3000
    - MONGO_URL=mongodb://mongo:27017/rocketchat
# uncomment and set the line below if you need to support mobile apps
#   - DDP_DEFAULT_CONNECTION_URL=http://yourhost:3000
  links:
    - mongo:mongo
  ports:
    - 3000:3000

Change all instances of http://yourhost:3000 to have your server's public IP or hostname. It is also a good idea to remove the # symbols for the volumes configurations. This will allow your containers to save state to the host so that your server doesn't "reset" whenever your containers are replaced. In the end you should end up with something like:

mongo:
  image: mongo
  volumes:
    - ./data/runtime/db:/data/db
    - ./data/dump:/dump
  command: mongod --smallfiles --oplogSize 128

rocketchat:
  image: rocketchat/rocket.chat:develop
  volumes:
    - ./uploads:/app/uploads
  environment:
    - PORT=3000
    - ROOT_URL=http://yourhost:3000
    - MONGO_URL=mongodb://mongo:27017/rocketchat
# uncomment and set the line below if you need to support mobile apps
#   - DDP_DEFAULT_CONNECTION_URL=http://yourhost:3000
  links:
    - mongo:mongo
  ports:
    - 3000:3000

Start rocket chat (both the mongo database container and the application container) by running the command below:

docker-compose up  

Navigate to the server in your web browser.

https://[server ip or hostname]:3000  

Register yourself as the first user. This does not require email authentication and will default you to being an administrator. One of the first things you may need to do is look through the settings and configure SMTP and email confirmation for registration.

Issues

At this point, the only way to enable SSL is to configure a reverse proxy that points to this container. I will provide better instructions for how to do this, at a later date.

References

Author

Programster

Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.