version: '2'
networks:
  lb_web:
    external: true
  back:
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 10.0.${SUBNET}.0/24
services:
  onlyoffice:
    image: libresh/onlyoffice:7.3.3.50
    depends_on:
    - db
    - rabbitmq
    expose:
    - "80"
    environment:
    - DB_TYPE=postgres
    - DB_HOST=db
    - DB_PORT=5432
    - DB_NAME=onlyoffice
    - DB_USER=onlyoffice
    - AMQP_URI=amqp://guest:guest@rabbitmq
    - VIRTUAL_HOST
    - LETSENCRYPT_HOST
    - JWT_ENABLED=true
    - JWT_SECRET
    - JWT_HEADER=Authorization
    - JWT_IN_BODY=true
    stdin_open: true
    restart: always
    stop_grace_period: 60s
    networks:
    - back
    - lb_web
    logging:
      driver: "json-file"
      options:
        max-size: "500m"
        max-file: "2"
    volumes:
    - ./data/oo-data:/var/www/onlyoffice/Data
    - ./data/oo-logs:/var/log/onlyoffice
    - ./data/oo-cache:/var/lib/onlyoffice/documentserver/App_Data/cache/files
  rabbitmq:
    image: rabbitmq
    restart: always
    networks:
    - back
  db:
    image: postgres:15
    environment:
    - POSTGRES_DB=onlyoffice
    - POSTGRES_USER=onlyoffice
    - POSTGRES_HOST_AUTH_METHOD=trust
    restart: always
    networks:
    - back
    volumes:
    - ./data/db-data:/var/lib/postgresql