Loading...

Setup letschat with docker containers

Having chat rooms for specific topics or projects have become quite popular. IMHO it is a nice addon for development and deployment lifecycle management. HipChat or Slack are some popular providers. If you want to have an internal chat system, letschat is a quick way to accomplish that. It has some flaws, debugging LDAP was a horror, but basically is good enough in its vanilla state. Take as it is and its free (MIT License). We use it currently for receiving notifications from our continuous integration system.

Persistent data

letschat uses as data storage MongoDB. Start MongoDB as a docker container with a data volume for persistent storage.

docker run --name chat-mongo -v /var/opt/mongodb/data:/data/db -d mongo:latest

MongoDB is not clustered or high available. This is a simple setup.

Docker Customizations

Upload directory

mkdir -p /var/opt/letschat/uploads

Config directory

mkdir -p /opt/letschat/config

Place the content of this settings.yml in the created directory.

env: production

http:
  enable: true
  host: 'localhost'
  port: 5000

files:
  enable: true
  provider: local
  local:
    dir: uploads

xmpp:
  enable: false
  port: 5222
  domain: example.com

database:
  uri: mongodb://localhost/letschat

secrets:
  cookie: secretsauce

auth:
  providers: [local]

Start Letschat

We map the volumes and link with the MongoDB container, so letschat can use it for data persistence.

docker run  \
  --name letschat \
  --link chat-mongo:mongo \
  -p 8091:8080 -p 5222:5222 \
  -v /opt/letschat/config:/usr/src/app/config \
  -v /var/opt/letschat/uploads:/usr/src/app/uploads \
  --restart=always \
  -d sdelements/lets-chat