Manifests/rocket-chat/rocketchat.yml
2025-08-28 15:54:51 +03:00

109 lines
3.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: "3.8"
services:
### MongoDB (single-node replica set + oplog)
mongo:
image: mongo:6
command: ["--replSet","rs0","--oplogSize","128"]
volumes:
- mongo_data:/data/db
networks:
- rocketchat-net
healthcheck:
test: ["CMD","mongosh","--quiet","--eval","db.adminCommand('ping').ok"]
interval: 10s
timeout: 5s
retries: 10
deploy:
placement:
constraints:
- node.labels.platform == prod # İstersen kaldırabilirsin
### ReplSet init (tek seferlik)
mongo-init-replica:
image: mongo:6
networks:
- rocketchat-net
command:
- sh
- -lc
- |
set -e
echo "Waiting for Mongo to be ready..."
until mongosh --host mongo:27017 --quiet --eval 'db.adminCommand({ ping: 1 }).ok' | grep -q 1; do
sleep 2
done
echo "Checking replica set..."
mongosh --host mongo:27017 --quiet --eval '
try {
if (rs.status().ok === 1) {
print("Replica set already initiated.");
} else { throw new Error("status not ok"); }
} catch (e) {
print("Initiating replica set...");
rs.initiate({ _id: "rs0", members: [ { _id: 0, host: "mongo:27017" } ] });
}
'
echo "Waiting for PRIMARY..."
until mongosh --host mongo:27017 --quiet --eval 'db.isMaster().ismaster' | grep -q true; do
sleep 2
done
echo "PRIMARY is ready."
deploy:
restart_policy:
condition: on-failure
delay: 5s
placement:
constraints:
- node.labels.platform == prod
### Rocket.Chat
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:latest
ports:
- "3001:3000"
environment:
- PORT=3000
- ROOT_URL=https://chat.emrekirman.xyz # <- kendi domainini yaz
- MONGO_URL=mongodb://mongo:27017/rocketchat?replicaSet=rs0
- REDIS_URL=redis://:98836@redis:6379
# İsteğe bağlı: Türkçe varsayılan dil
- OVERWRITE_SETTING_Language=tr
volumes:
- uploads:/app/uploads
networks:
- traefik-public
- redis_redis_net
- rocketchat-net
deploy:
replicas: 1 # Traefik sticky cookie ile çoklayabiliyoruz
update_config:
order: start-first
parallelism: 1
delay: 5s
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.platform == prod
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.http.routers.rocketchat.rule=Host(`chat.emrekirman.xyz`)
- traefik.http.routers.rocketchat.entrypoints=websecure
- traefik.http.routers.rocketchat.tls.certresolver=myresolver
- traefik.http.services.rocketchat.loadbalancer.server.port=3000
- traefik.http.routers.rocketchat.service=rocketchat
networks:
traefik-public:
external: true
redis_redis_net:
external: true
rocketchat-net:
volumes:
mongo_data:
uploads: