Docker Swarm : Stack Rocket.Chat

Docker Swarm : Stack Rocket.Chat

Table of Contents

Informations importantes

Fichier stack.yml

version: '3.3'

services:

  rocketchat:
    image: registry.rocket.chat/rocketchat/rocket.chat:latest
    environment:
      MONGO_URL: "mongodb://mongodb:27017/rocketchat?replicaSet=rs0"
      MONGO_OPLOG_URL: "mongodb://mongodb:27017/local?replicaSet=rs0"
      # Modifier l'URL d'accès à l'application RocketChat
      ROOT_URL: https://rocketchat.example.com
      PORT: 3000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/localtime:/etc/localtime:ro
      - uploads:/app/uploads
    networks:
      - net
      # Réseau utilisé par le conteneur traefik
      - traefik-public
    deploy:
      #resources:
        #limits:
          #cpus: '0.50'
          #memory: 1024M
        #reservations:
          #cpus: '0.25'
          #memory: 512M
      placement:
        constraints:
          # Label à appliquer au noeud (A retirer si utilisation de glusterfs / ceph)
          - node.labels.rocketchat_uploads == true
      labels:
        # Activation de traefik
        - traefik.enable=true
        - traefik.docker.network=traefik-public
        - traefik.constraint-label=traefik-public
        # Modifier le domaine de l'application RocketChat
        - traefik.http.routers.rocketchat-http.rule=Host(`rocketchat.example.com`)
        - traefik.http.routers.rocketchat-http.entrypoints=http
        - traefik.http.routers.rocketchat-http.middlewares=https-redirect
        # Modifier le domaine de l'application RocketChat
        - traefik.http.routers.rocketchat-https.rule=Host(`rocketchat.example.com`)
        - traefik.http.routers.rocketchat-https.entrypoints=https
        - traefik.http.routers.rocketchat-https.tls=true
        - traefik.http.routers.rocketchat-https.tls.certresolver=le
        - traefik.http.services.rocketchat.loadbalancer.server.port=3000

  mongodb:
    image: docker.io/bitnami/mongodb:4.4
    environment:
      MONGODB_REPLICA_SET_MODE: primary
      MONGODB_REPLICA_SET_NAME: rs0
      MONGODB_PORT_NUMBER: 27017
      MONGODB_INITIAL_PRIMARY_HOST: mongodb
      MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27017
      MONGODB_ADVERTISED_HOSTNAME: mongodb
      MONGODB_ENABLE_JOURNAL: "true"
      ALLOW_EMPTY_PASSWORD: "yes"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/localtime:/etc/localtime:ro
      - mongodb_data:/bitnami/mongodb
    networks:
      - net
    deploy:
      #resources:
        #limits:
          #cpus: '0.50'
          #memory: 1024M
        #reservations:
          #cpus: '0.25'
          #memory: 512M
      placement:
        constraints:
          # Label à appliquer au noeud (A retirer si utilisation de glusterfs / ceph)
          - node.labels.rocketchat_mongodb_data == true

networks:
  net:
    driver: overlay
    attachable: true
  # Réseau utilisé par le conteneur traefik
  traefik-public:
    external: true

volumes:
  mongodb_data:
    driver: local
  uploads:
    driver: local

Deploiement

docker stack deploy -c stack.yml rocketchat
Les commentaires sont fermés.