docker_deployment_notes/rocketchat
2020-10-16 16:12:54 -07:00
..
.env update rocketchat .env 2020-08-26 13:43:58 -07:00
docker-compose.yml Added rocketChat 2020-08-26 13:41:04 -07:00
README.md updated readmes to include contents of files referenced 2020-10-16 16:12:54 -07:00

Minimum File Structure

/home/
└── ~/
    └── docker/
        └── rocketchat/
            ├── .env
            ├── docker-compose.yml

Caddyfile

subdomain.example.com {
	reverse_proxy rocketchat:3000
}

Things to Modify

.env

set your environment variables https://github.com/StarWhiz/docker_deployment_notes/blob/master/rocketchat/.env

# General
MY_DOMAIN=example.com
DOCKER_MY_NETWORK=caddy_net

# Rocket Chat Specific
ROOT_URL=https://subdomain.example.com
SMTP_MAIL_URL=smtp.mailgun.org
ROCKETCHAT_BOT_PASSWORD=samplebotpassword

docker-compose.yml

https://github.com/StarWhiz/docker_deployment_notes/blob/master/rocketchat/docker-compose.yml

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=${ROOT_URL}
      - MONGO_URL=mongodb://mongo:27017/rocketchat
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local
      - MAIL_URL=${SMTP_MAIL_URL}
#       - HTTP_PROXY=http://proxy.domain.com
#       - HTTPS_PROXY=http://proxy.domain.com
    depends_on:
      - mongo
    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 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: '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=${ROCKETCHAT_BOT_PASSWORD}
      - 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

networks:
  default:
    external:
      name: ${DOCKER_MY_NETWORK}

docker-compose up -d

After you have the .env and docker-compose files set up in this directory. Do a docker-compose up -d to start the containers.