update 26.7.26
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Change these
|
||||
REG_TOKEN=
|
||||
DOMAIN=localhost
|
||||
ROOT_URL=http://localhost:5200
|
||||
RELEASE=8.6.1
|
||||
# Change to true after you set your domain and valid lets encrypt email
|
||||
LETSENCRYPT_ENABLED=false
|
||||
LETSENCRYPT_EMAIL=demo@email.com
|
||||
TRAEFIK_PROTOCOL=http
|
||||
|
||||
# MongoDB
|
||||
MONGODB_BIND_IP=127.0.0.1
|
||||
MONGODB_PORT_NUMBER=27017
|
||||
|
||||
# NATS (bundled compose.nats.yml). For external NATS, set NATS_URL and omit compose.nats.yml; see docs/external-nats.md
|
||||
NATS_PORT_NUMBER=4223
|
||||
NATS_BIND_IP=127.0.0.1
|
||||
# NATS_URL=monolith+nats://your-nats-host:4222
|
||||
@@ -0,0 +1,111 @@
|
||||
services:
|
||||
mongodb-fix-permission-container:
|
||||
image: docker.io/mongodb/mongodb-community-server:${MONGODB_VERSION:-8.2}-ubi8
|
||||
restart: on-failure
|
||||
user: "0"
|
||||
volumes:
|
||||
- ${MONGODB_HOST_PATH:-mongodb_data}:/data/db:rw
|
||||
environment:
|
||||
MONGODB_USER_ID: ${MONGODB_USER_ID:-1001}
|
||||
entrypoint: |
|
||||
sh -xc '
|
||||
owner="$(stat -c %u /data/db)";
|
||||
# for fresh installs
|
||||
if [ "$$owner" != "$$MONGODB_USER_ID" ]; then
|
||||
echo "=====> Fixing directory ownership to uid $$MONGODB_USER_ID"
|
||||
chown -R "$$MONGODB_USER_ID" /data/db;
|
||||
else echo "=====> Nothing to do"; fi;
|
||||
'
|
||||
# TODO: add user creation here
|
||||
mongodb-init-container:
|
||||
image: docker.io/mongodb/mongodb-community-server:${MONGODB_VERSION:-8.2}-ubi8
|
||||
restart: on-failure
|
||||
# depends_on:
|
||||
# mongodb:
|
||||
# condition: service_healthy
|
||||
user: "0"
|
||||
environment:
|
||||
MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
|
||||
MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
|
||||
MONGODB_URI: ${MONGODB_URI:-mongodb://mongodb:27017/?directConnection=true}
|
||||
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
|
||||
volumes:
|
||||
- ${MONGODB_HOST_PATH:-mongodb_data}:/data/db:rw
|
||||
logging:
|
||||
driver: "json-file"
|
||||
labels:
|
||||
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#mongodb-init-container"
|
||||
entrypoint: |
|
||||
sh -xc '
|
||||
echo "=====> Waiting for MongoDB to be healthy before initiating replica set...";
|
||||
until mongosh "$$MONGODB_URI" --eval "db.adminCommand(\"ping\")" >/dev/null 2>&1; do
|
||||
echo "=====> MongoDB not ready yet, retrying in 5 seconds...";
|
||||
sleep 5;
|
||||
done;
|
||||
echo "=====> Initiating ReplSet $$MONGODB_REPLICA_SET_NAME at $$MONGODB_ADVERTISED_HOSTNAME:$$MONGODB_PORT_NUMBER...";
|
||||
mongosh "$$MONGODB_URI" --eval "rs.initiate({_id: \"$$MONGODB_REPLICA_SET_NAME\", members: [{ _id: 0, host: \"$$MONGODB_ADVERTISED_HOSTNAME:$$MONGODB_PORT_NUMBER\" }]})";
|
||||
echo "=====> Initiating ReplSet done...";
|
||||
'
|
||||
|
||||
mongodb:
|
||||
image: docker.io/mongodb/mongodb-community-server:${MONGODB_VERSION:-8.2}-ubi8
|
||||
restart: always
|
||||
# depends_on:
|
||||
# mongodb-fix-permission-container:
|
||||
# condition: service_completed_successfully
|
||||
volumes:
|
||||
- ${MONGODB_HOST_PATH:-mongodb_data}:/data/db:rw
|
||||
user: "${MONGODB_USER_ID:-1001}"
|
||||
entrypoint:
|
||||
- sh
|
||||
- -ec
|
||||
- |
|
||||
echo "=====> Waiting for /data/db to be owned by uid=$$MONGODB_USER_ID (mongodb user) ...";
|
||||
for i in $(seq 1 60); do
|
||||
owner="$(stat -c %u /data/db 2>/dev/null || true)";
|
||||
if [ "$$owner" = "$$MONGODB_USER_ID" ]; then
|
||||
echo "=====> /data/db ownership OK ($$owner) - starting MongoDB";
|
||||
exec mongod --replSet "$$MONGODB_REPLICA_SET_NAME" --bind_ip_all;
|
||||
fi;
|
||||
echo "=====> /data/db owner is '$$owner' (expected $$MONGODB_USER_ID), retrying in 5 seconds...";
|
||||
sleep 5;
|
||||
done;
|
||||
echo "=====> Giving up waiting for /data/db ownership after 5 minutes";
|
||||
exit 1
|
||||
environment:
|
||||
MONGODB_USER_ID: ${MONGODB_USER_ID:-1001}
|
||||
MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
|
||||
MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
|
||||
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
|
||||
ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}
|
||||
logging:
|
||||
driver: "json-file"
|
||||
labels:
|
||||
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#mongodb"
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- mongosh
|
||||
- "mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_PORT_NUMBER:-27017}/?directConnection=true"
|
||||
- --eval
|
||||
- '"db.adminCommand(''ping'')"'
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
ports:
|
||||
- "${MONGODB_BIND_IP:-127.0.0.1}:${MONGODB_PORT_NUMBER:-27017}:${MONGODB_PORT_NUMBER:-27017}"
|
||||
|
||||
mongodb-exporter:
|
||||
image: docker.io/percona/mongodb_exporter:${MONGODB_EXPORTER_VERSION:-0.44.0}
|
||||
depends_on:
|
||||
- mongodb
|
||||
expose:
|
||||
- 9216
|
||||
command:
|
||||
- --mongodb.uri=${MONGODB_URI:-mongodb://mongodb:27017}
|
||||
- --collect-all
|
||||
- --compatible-mode
|
||||
|
||||
volumes:
|
||||
mongodb_data: {driver: local}
|
||||
@@ -0,0 +1,32 @@
|
||||
services:
|
||||
nats:
|
||||
image: docker.io/nats:${NATS_VERSION:-2.11-alpine}
|
||||
restart: always
|
||||
expose:
|
||||
- 4222
|
||||
- 8222
|
||||
- 6222
|
||||
# healthcheck:
|
||||
# test: ["CMD", "nc", "-zv", "-w", "10", "nats", "4222"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 30s
|
||||
command: --http_port 8222
|
||||
ports:
|
||||
- "${NATS_BIND_IP:-127.0.0.1}:${NATS_PORT_NUMBER:-4222}:4222"
|
||||
logging:
|
||||
driver: "json-file"
|
||||
labels:
|
||||
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#nats"
|
||||
|
||||
nats-exporter:
|
||||
image: docker.io/natsio/prometheus-nats-exporter:${NATS_EXPORTER_VERSION:-0.17.3}
|
||||
depends_on:
|
||||
- nats
|
||||
expose:
|
||||
- 7777
|
||||
command:
|
||||
- -healthz
|
||||
- -varz
|
||||
- "http://nats:8222"
|
||||
@@ -0,0 +1,65 @@
|
||||
services:
|
||||
rocketchat:
|
||||
image: ${IMAGE:-registry.rocket.chat/rocketchat/rocket.chat}:${RELEASE:-8.0.1}
|
||||
restart: always
|
||||
labels:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: ${METRICS_PORT:-9458}
|
||||
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#rocketchat"
|
||||
environment:
|
||||
ROOT_URL: ${ROOT_URL:-http://localhost}
|
||||
PORT: ${PORT:-3000}
|
||||
DEPLOY_METHOD: docker
|
||||
DEPLOY_PLATFORM: compose
|
||||
REG_TOKEN: ${REG_TOKEN:-}
|
||||
LICENSE_DEBUG: true
|
||||
OVERWRITE_SETTING_Prometheus_Enabled: true
|
||||
OVERWRITE_SETTING_Prometheus_Port: "${METRICS_PORT:-9458}"
|
||||
MONGO_URL: ${MONGO_URL:-mongodb://mongodb:27017/rocketchat?replicaSet=rs0}
|
||||
TRANSPORTER: "${NATS_URL-monolith+nats://nats:4222}"
|
||||
INSTANCE_IP: "${INSTANCE_IP:-}"
|
||||
# depends_on:
|
||||
# mongodb-init-container:
|
||||
# condition: service_completed_successfully
|
||||
entrypoint: sh
|
||||
command:
|
||||
- -c
|
||||
- |
|
||||
protocol=$(echo $$MONGO_URL | awk -F'://' '{print $$1}')
|
||||
if [ "$$protocol" = "mongodb+srv" ]; then
|
||||
echo "=====> MongoDB is using SRV protocol, skipping healthcheck before attempting to start rocket.chat ...";
|
||||
exec node main.js;
|
||||
fi
|
||||
host_port=$(echo $$MONGO_URL | awk -F/ '{print $$3}')
|
||||
if echo $$host_port | grep -q @; then
|
||||
host_port=$(echo $$host_port | awk -F@ '{print $$2}')
|
||||
fi
|
||||
echo "=====> host_port: $$host_port";
|
||||
host=$${host_port%%:*}
|
||||
port=$${host_port##*:}
|
||||
port=$${port:-27017}
|
||||
echo "=====> Waiting for MongoDB ($$host:$$port) to be ready before starting Rocket.Chat...";
|
||||
for i in $(seq 1 60); do
|
||||
if nc -z $$host $$port >/dev/null 2>&1; then
|
||||
echo "=====> MongoDB is up - starting Rocket.Chat";
|
||||
exec node main.js;
|
||||
fi;
|
||||
echo "=====> MongoDB not ready yet, retrying in 5 seconds...";
|
||||
sleep 5;
|
||||
done;
|
||||
echo "=====> Giving up waiting for MongoDB after 5 minutes";
|
||||
exit 1
|
||||
expose:
|
||||
- ${PORT:-3000}
|
||||
- ${METRICS_PORT:-9458}
|
||||
ports:
|
||||
- "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"
|
||||
- "${BIND_IP:-0.0.0.0}:${METRICS_PORT:-9458}:${METRICS_PORT:-9458}"
|
||||
logging:
|
||||
driver: "json-file"
|
||||
# healthcheck:
|
||||
# test: ["CMD", "nc", "-zv", "-w", "10", "rocketchat", "${PORT:-3000}"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 30s
|
||||
@@ -0,0 +1,4 @@
|
||||
include:
|
||||
- compose.yml
|
||||
- compose.database.yml
|
||||
- compose.nats.yml
|
||||
Reference in New Issue
Block a user