Create a gist now

Instantly share code, notes, and snippets.

@kvaps /ONLYOFFICE.md
Last active Dec 13, 2016

What would you like to do?
docker-compose config for ONLYOFFICE
version: '2'
services:
onlyoffice-communityserver:
container_name: onlyoffice-communityserver
image: onlyoffice/communityserver:latest
environment:
- SSL_CERTIFICATE_PATH=/etc/letsencrypt/live/crm.dlm.crosslab.ru/cert.pem
- SSL_KEY_PATH=/etc/letsencrypt/live/crm.dlm.crosslab.ru/privkey.pem
- LE_RENEW_HOOK=docker restart @CONTAINER_NAME@
- DOCUMENT_SERVER_PORT_80_TCP_ADDR=document_server
- MAIL_SERVER_DB_HOST=mail_server
depends_on:
- onlyoffice-haproxy
- onlyoffice-mailserver
links:
- onlyoffice-haproxy:document_server
- onlyoffice-mailserver:mail_server
stdin_open: true
restart: always
networks:
- onlyoffice
ports:
- '80:80'
- '443:443'
volumes:
- communityserver_logs:/var/log/onlyoffice
- communityserver_data:/var/www/onlyoffice/Data
- communityserver_db:/var/lib/mysql
- letsencrypt-data:/etc/letsencrypt
- letsencrypt-www:/tmp/letsencrypt
- ./onlyoffice.conf:/etc/nginx/sites-enabled/onlyoffice:ro
onlyoffice-mailserver:
container_name: onlyoffice-mailserver
image: onlyoffice/mailserver:latest
environment:
- LE_RENEW_HOOK=docker restart @CONTAINER_NAME@
stdin_open: true
restart: always
hostname: yourdomain.com
privileged: true
networks:
- onlyoffice
ports:
- "25:25"
- "143:143"
- "587:587"
volumes:
- mailserver_logs:/var/log
- mailserver_db:/var/lib/mysql
- mailserver_data:/var/vmail
- ./certs/:/etc/pki/tls/mailserver/
- letsencrypt-data:/etc/letsencrypt
onlyoffice-documentserver-data:
container_name: onlyoffice-documentserver-data
image: onlyoffice/documentserver:latest
environment:
- ONLYOFFICE_DATA_CONTAINER=true
- POSTGRESQL_SERVER_HOST=onlyoffice-postgresql
- POSTGRESQL_SERVER_PORT=5432
- POSTGRESQL_SERVER_DB_NAME=onlyoffice
- POSTGRESQL_SERVER_USER=onlyoffice
- RABBITMQ_SERVER_HOST=onlyoffice-rabbitmq
- RABBITMQ_SERVER_USER=guest
- RABBITMQ_SERVER_PASS=guest
- REDIS_SERVER_HOST=onlyoffice-redis
- REDIS_SERVER_PORT=6379
stdin_open: true
restart: always
networks:
- onlyoffice
volumes:
- communityserver_data:/var/www/onlyoffice/Data
- communityserver_logs:/var/log/onlyoffice
#- /var/lib/onlyoffice/documentserver/App_Data/cache/files
#- /var/www/onlyoffice/documentserver-example/public/files
#- /usr/share/fonts
onlyoffice-documentserver:
image: onlyoffice/documentserver:latest
depends_on:
- onlyoffice-documentserver-data
- onlyoffice-postgresql
- onlyoffice-redis
- onlyoffice-rabbitmq
environment:
- ONLYOFFICE_DATA_CONTAINER_HOST=onlyoffice-documentserver-data
- BALANCE=uri depth 3
- EXCLUDE_PORTS=443
- HTTP_CHECK=GET /healthcheck
- EXTRA_SETTINGS=http-check expect string true
# Uncomment the string below to redirect HTTP request to HTTPS request.
#- FORCE_SSL=true
stdin_open: true
restart: always
networks:
- onlyoffice
expose:
- '80'
volumes_from:
- onlyoffice-documentserver-data
onlyoffice-haproxy:
container_name: onlyoffice-haproxy
image: dockercloud/haproxy:1.5.1
depends_on:
- onlyoffice-documentserver
environment:
- LE_RENEW_HOOK=docker restart @CONTAINER_NAME@
- MODE=http
# Uncomment the string below to specify the path of ssl certificates
#- CERT_FOLDER=/certs/
stdin_open: true
links:
- onlyoffice-documentserver
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# Uncomment the string below to map a ssl certificate from host
# to the proxy container
#- /app/onlyoffice/DocumentServer/data/certs/onlyoffice.pem:/certs/cert1.pem
restart: always
networks:
- onlyoffice
ports:
- '180:80'
- '1443:443'
- '1936:1936'
onlyoffice-redis:
container_name: onlyoffice-redis
image: redis
restart: always
networks:
- onlyoffice
expose:
- '6379'
onlyoffice-rabbitmq:
container_name: onlyoffice-rabbitmq
image: rabbitmq
restart: always
networks:
- onlyoffice
expose:
- '5672'
onlyoffice-postgresql:
container_name: onlyoffice-postgresql
image: postgres:9.5
environment:
- POSTGRES_DB=onlyoffice
- POSTGRES_USER=onlyoffice
networks:
- onlyoffice
restart: always
expose:
- '5432'
volumes:
- documentserver_db:/var/lib/postgresql
letsencrypt:
restart: always
image: kvaps/letsencrypt-webroot
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- letsencrypt-data:/etc/letsencrypt
- letsencrypt-www:/tmp/letsencrypt
links:
- onlyoffice-communityserver
- onlyoffice-mailserver
environment:
- DOMAINS=yourdomain.com mail.yourdomain.com
- EMAIL=postmaster@yourdomain.com
- WEBROOT_PATH=/tmp/letsencrypt
- EXP_LIMIT=30
- CHECK_FREQ=30
networks:
onlyoffice:
driver: 'bridge'
volumes:
communityserver_db:
communityserver_data:
communityserver_logs:
documentserver_db:
documentserver_data:
documentserver_logs:
mailserver_db:
mailserver_logs:
mailserver_data:
letsencrypt-data:
letsencrypt-www:

ONLYOFFICE configuration for docker-compose (and letsencrypt).

  • Run communityserver container, and get onlyoffice.conf from it:
docker run -name communityserver -i -t -d onlyoffice/communityserver`
# wait 1-2 minutes.
sudo docker exec -i -t communityserver /bin/bash -c 'cat /etc/nginx/sites-enabled/onlyoffice' > onlyoffice.conf`
sudo docker rm -fv communityserver
  • Edit onlyoffice.conf, add new location before /:
        location '/.well-known/acme-challenge' {
            default_type "text/plain";
            root        /tmp/letsencrypt;
        }
  • Download docker-compose.yml:
curl -O https://gist.githubusercontent.com/kvaps/6ac945e6c2e2e41bd536b7486a7dea4a/raw/d9d0c2a5e33605e9b50145461863b3ba3b44cf01/docker-compose.yml
  • Edit docker-compose.yml, change hostname.
  • Make certs symlinks for your mailserver:
mkdir certs
ln -s /etc/letsencrypt/live/yourdomain.com/cert.pem mail.onlyoffice.crt 
ln -s /etc/letsencrypt/live/yourdomain.com/privkey.pem mail.onlyoffice.key
ln -s /etc/letsencrypt/live/yourdomain.com/chain.pem certs/mail.onlyoffice.ca-bundle
  • Run onlyoffice:
docker-compose up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment