# ------------------------------------------------------------------------------
#
#    DO NOT MODIFY THIS FILE !!!
#
#    Configuration properties should be specified in .env file
#
#    Application based on OpenVidu should be specified in
#    docker-compose.override.yml file
#
#    This docker-compose file coordinates all services of OpenVidu CE Platform.
#
#    This file will be overridden when update OpenVidu Platform
#
# ------------------------------------------------------------------------------

version: '3.1'

services:

    openvidu-server:
        image: openvidu/openvidu-server:2.13.0-beta6
        restart: on-failure
        network_mode: host
        entrypoint: ['/bin/bash', '-c', 'export COTURN_IP=`curl --silent ifconfig.co`; /usr/local/bin/entrypoint.sh']
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - ${OPENVIDU_RECORDING_PATH}:${OPENVIDU_RECORDING_PATH}
            - ${OPENVIDU_RECORDING_CUSTOM_LAYOUT}:${OPENVIDU_RECORDING_CUSTOM_LAYOUT}
            - ${OPENVIDU_CDR_PATH}:${OPENVIDU_CDR_PATH}
        env_file:
            - .env
        environment:
            - SERVER_SSL_ENABLED=false
            - SERVER_PORT=5443
            - OPENVIDU_RECORDING=true
            - OPENVIDU_RECORDING_COMPOSED_URL=https://${OPENVIDU_DOMAIN_OR_PUBLIC_IP}/dashboard
            - KMS_URIS=["ws://localhost:8888/kurento"]
            - COTURN_REDIS_IP=127.0.0.1

    kms:
        image: ${KMS_IMAGE:-kurento/kurento-media-server:6.13.1}
        restart: always
        network_mode: host
        ulimits:
          core: -1
        volumes:
            - /opt/openvidu/kms-crashes:/opt/openvidu/kms-crashes
        environment:
            - KMS_MIN_PORT=40000
            - KMS_MAX_PORT=57000
            - GST_DEBUG=${KMS_DEBUG_LEVEL:-}

    redis:
        image: redis:5.0.7
        restart: always
        network_mode: host

    coturn:
        image: openvidu/openvidu-coturn:1.0.0-beta1
        restart: on-failure
        network_mode: host
        environment:
            - REDIS_IP=127.0.0.1
            - TURN_LISTEN_PORT=3478
            - DB_NAME=0
            - DB_PASSWORD=turn
            - MIN_PORT=57001
            - MAX_PORT=65535

    nginx:
        image: openvidu/openvidu-proxy:1.0.0-beta5
        restart: on-failure
        network_mode: host
        volumes:
            - ./certificates:/etc/letsencrypt
            - ./owncert:/owncert
            - /opt/openvidu/custom-layout:/opt/openvidu/custom-layout
        environment:
            - DOMAIN_OR_PUBLIC_IP=${OPENVIDU_DOMAIN_OR_PUBLIC_IP}
            - CERTIFICATE_TYPE=${CERTIFICATE_TYPE}
            - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
            - PROXY_MODE=CE
            - WITH_DEMOS=true
