Skip to content

Instantly share code, notes, and snippets.

@debdutdeb
Last active April 17, 2024 20:49
Show Gist options
  • Save debdutdeb/f1a02a3ef2dd42f3e0eb523395625abe to your computer and use it in GitHub Desktop.
Save debdutdeb/f1a02a3ef2dd42f3e0eb523395625abe to your computer and use it in GitHub Desktop.
`docker compose up -d` then head over to http://ip:3000
volumes:
mongodb_data: { driver: local }
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest}
restart: always
environment:
MONGO_URL: "${MONGO_URL:-\
mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
MONGO_OPLOG_URL: "${MONGO_OPLOG_URL:\
-mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
local?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
ROOT_URL: ${ROOT_URL:-http://localhost:${HOST_PORT:-3000}}
PORT: ${PORT:-3000}
DEPLOY_METHOD: docker
DEPLOY_PLATFORM: ${DEPLOY_PLATFORM}
command:
- sh
- -c
- |
export INSTANCE_IP=$$(hostname -I)
node main.js
depends_on:
mongodb:
condition: service_started
rocketchat2:
image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest}
restart: always
environment:
MONGO_URL: "${MONGO_URL:-\
mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
MONGO_OPLOG_URL: "${MONGO_OPLOG_URL:\
-mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
local?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
ROOT_URL: ${ROOT_URL:-http://localhost:${HOST_PORT:-3000}}
PORT: ${PORT:-3000}
DEPLOY_METHOD: docker
DEPLOY_PLATFORM: ${DEPLOY_PLATFORM}
command:
- sh
- -c
- |
export INSTANCE_IP=$$(hostname -I)
node main.js
depends_on:
mongodb:
condition: service_started
mongodb:
image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-5.0}
restart: always
volumes:
- mongodb_data:/bitnami/mongodb
environment:
MONGODB_REPLICA_SET_MODE: primary
MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
MONGODB_INITIAL_PRIMARY_HOST: ${MONGODB_INITIAL_PRIMARY_HOST:-mongodb}
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: ${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}
proxy:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/conf.d/nginx.conf:ro
depends_on:
rocketchat:
condition: service_started
rocketchat2:
condition: service_started
ports:
- 3000:80
upstream rocket_goes_boooo {
server rocketchat:3000;
server rocketchat2:3000;
}
server {
listen 80 default_server;
server_name _;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_pass http://rocket_goes_boooo;
}
}
@d-gubert
Copy link

d-gubert commented Apr 17, 2024

Had to modify the nginx config for it to work. Maybe outdated compared to the version when you first wrote it? Anyway, here goes:

events {}

http {
    upstream rocketchat {
        server rocketchat:3000;
        server rocketchat2:3000;
    }

    server {
        listen 80 default_server;
        server_name _;
        location / {
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header Host $host;
            proxy_pass http://rocketchat;
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment