version: "3.8" services: app: image: rocketchat/rocket.chat:3.16.3 depends_on: - db volumes: - "rocketchat_uploads:/app/uploads" secrets: - admin_password environment: - PORT=3000 - ROOT_URL=https://${DOMAIN} - MONGO_URL=mongodb://db:27017/rocketchat - MONGO_OPLOG_URL=mongodb://db:27017/local - ADMIN_USERNAME - ADMIN_PASS_FILE=/run/secrets/admin_password - ADMIN_EMAIL #- HTTP_PROXY=http://proxy.domain.com #- HTTPS_PROXY=http://proxy.domain.com configs: - source: entrypoint_conf target: /docker-entrypoint.sh mode: 0555 networks: - internal - proxy entrypoint: /docker-entrypoint.sh 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)" healthcheck: test: 'nodejs -e "http.get(''http://localhost:3000'', (res) => { console.log(''status: '', res.statusCode); if (res.statusCode == 200) { process.exit(0); } else { process.exit(1); } });"' interval: 30s timeout: 10s retries: 3 start_period: 1m deploy: update_config: failure_action: rollback order: start-first labels: - "traefik.enable=true" - "traefik.docker.network=proxy" - "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=3000" - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})" - "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}" - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure" - "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect" - "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true" - "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}" - coop-cloud.${STACK_NAME}.app.version=3.16.1-da4b65ff db: image: mongo:3.7 volumes: - mongo:/data/db #- ./data/dump:/dump command: mongod --smallfiles --oplogSize 128 --replSet rs0 networks: - internal labels: - "traefik.enable=false" deploy: labels: - coop-cloud.${STACK_NAME}.db.version=3.7-736eec20 # 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.4 command: | bash -c "for i in `seq 1 30`; do mongo db/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: - db networks: - internal networks: proxy: external: true internal: internal: true volumes: rocketchat_uploads: mongo: secrets: admin_password: external: true name: ${STACK_NAME}_admin_password_${SECRET_ADMIN_PASSWORD_VERSION} configs: entrypoint_conf: name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION} file: entrypoint.sh.tmpl template_driver: golang