From 4e4d7b3b29b385c1dc4a5fe3568e65ee211a9222 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 9 Feb 2020 19:10:34 +0100 Subject: [PATCH] added Rocket.Chat to dockerzized development system --- doc/docker/development/docker-compose.yml | 59 +++++++++++++++++++++++ doc/docker/development/nginx.conf | 57 +++++++++++++--------- 2 files changed, 92 insertions(+), 24 deletions(-) diff --git a/doc/docker/development/docker-compose.yml b/doc/docker/development/docker-compose.yml index 69671339c7..110bf03969 100644 --- a/doc/docker/development/docker-compose.yml +++ b/doc/docker/development/docker-compose.yml @@ -40,6 +40,20 @@ volumes: sessions: # cache files from compose, npm and yarn (actually /root inside the container) cache: + # store Rocket.Chat MongoDB on an (internal) Volume + mongo: + # directory to store MongoDB dumps + rocketchat-dumps: + driver_opts: + type: none + o: bind + device: $PWD/data/default/rocketchat/dump + rocketchat-uploads: + driver_opts: + type: none + o: bind + device: $PWD/data/default/rocketchat/uploads + services: egroupware: # you can also use tags like: 7.3, 7.3.12 or 7.4 @@ -185,3 +199,48 @@ services: # can access EGroupware without the need to go over your firewall #extra_hosts: #- "my.host.name:ip-address" + + # Rocket.Chat server + rocketchat: + image: rocketchat/rocket.chat:latest + 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)' + restart: unless-stopped + volumes: + - rocketchat-uploads:/app/uploads + # if EGroupware uses a certificate from a private CA, OAuth authentication will fail, you need to: + # - have the CA certificate stored at /etc/egroupware-docker/private-ca.crt + # - uncomment the next 2 lines about the private CA: + # - /etc/egroupware-docker/private-ca.crt:/usr/local/share/ca-certificates/private-ca.crt:ro + environment: + # - NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/private-ca.crt + # IMPORTANT: change ROOT_URL to your actual url eg. https://domain.com/rocketchat + - ROOT_URL=http://localhost/rocketchat + - PORT=3000 + - MONGO_URL=mongodb://mongo:27017/rocketchat + - MONGO_OPLOG_URL=mongodb://mongo:27017/local + # - HTTP_PROXY=http://proxy.domain.com + # - HTTPS_PROXY=http://proxy.domain.com + depends_on: + - mongo + container_name: rocketchat + # set the ip-address of your docker host AND your official DNS name so Rocket.Chat + # can access EGroupware without the need to go over your firewall + #extra_hosts: + #- "my.host.name:ip-address" + + # MongoDB for Rocket.Chat + mongo: + image: mongo:4.0 + restart: unless-stopped + volumes: + - mongo:/data/db + - rocketchat-dumps:/dump + command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1 + container_name: rocketchat-mongo + # 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.0 + command: 'bash -c "for i in `seq 1 30`; do mongo mongo/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: + - mongo diff --git a/doc/docker/development/nginx.conf b/doc/docker/development/nginx.conf index c3b58051c1..5760c29136 100644 --- a/doc/docker/development/nginx.conf +++ b/doc/docker/development/nginx.conf @@ -42,8 +42,8 @@ server { fastcgi_read_timeout 60m; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(.*)$; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; # standard Nginx include fastcgi_params; fastcgi_param SCRIPT_FILENAME /var/www/egroupware$1; @@ -80,9 +80,9 @@ server { fastcgi_read_timeout 60m; fastcgi_index index.php; include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_NAME $fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; } # ActiveSync support @@ -92,8 +92,8 @@ server { fastcgi_read_timeout 60m; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(.*)$; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /var/www/egroupware/activesync/index.php; } @@ -112,23 +112,32 @@ server { } # Collabora sniplet meant to be included in server block of EGroupware vhost - # static files - location ^~ /loleaflet { - proxy_pass http://collabora-key:9980; - proxy_set_header Host $http_host; - } + # static files + location ^~ /loleaflet { + proxy_pass http://collabora-key:9980; + proxy_set_header Host $http_host; + } - # WOPI discovery URL - location ^~ /hosting/discovery { - proxy_pass http://collabora-key:9980; - proxy_set_header Host $http_host; - } + # WOPI discovery URL + location ^~ /hosting/discovery { + proxy_pass http://collabora-key:9980; + proxy_set_header Host $http_host; + } - # websockets, download, presentation and image upload - location ^~ /lool { - proxy_pass http://collabora-key:9980; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $http_host; - } + # websockets, download, presentation and image upload + location ^~ /lool { + proxy_pass http://collabora-key:9980; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $http_host; + } + + # Rocket.Chat sniplet meant to be included in server block of EGroupware vhost + # proxy into rocketchat container + location /rocketchat { + proxy_pass http://rocketchat:3000; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $http_host; + } }