{% include 'roles/sys-svc-compose/templates/base.yml.j2' %} {% set service_name = 'nginx' %} {{ service_name }}: {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_image', application_id, 'gateway') }} {{ lookup('compose_only', 'container_name', entity_name ~ '_nginx') }} {{ lookup('container_ports', ['coturn', 'http', DOCKER_BIND_HOST]) | indent(4) }} command: > sh -c "printf 'server { listen 80; location / { default_type text/plain; return 200 \"OK\n\"; } }' > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" {{ lookup('container_networks') | indent(4) }} {% set service_name = 'coturn' %} {{ service_name }}: {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_image', application_id, 'coturn') }} {{ lookup('compose_only', 'container_name', COTURN_CONTAINER) }} network_mode: {{ COTURN_NETWORK_MODE }} {% if COTURN_NETWORK_MODE == 'bridge' %} {% if COTURN_TLS_ENABLED | bool %} {{ lookup('container_ports', {'service': 'coturn', 'protocol': 'stun_turn', 'transport': ['udp', 'tcp'], 'container': 'same'}, {'service': 'coturn', 'protocol': 'stun_turn_tls', 'transport': 'tcp', 'container': 'same'}, {'service': 'coturn', 'protocol': 'relay', 'transport': 'udp', 'container': 'same', 'publish': 'ephemeral'}) | indent(4) }} {% else %} {{ lookup('container_ports', {'service': 'coturn', 'protocol': 'stun_turn', 'transport': ['udp', 'tcp'], 'container': 'same'}, {'service': 'coturn', 'protocol': 'relay', 'transport': 'udp', 'container': 'same', 'publish': 'ephemeral'}) | indent(4) }} {% endif %} {{ lookup('container_networks') | indent(4) }} {% endif %} {{ lookup('container_volumes', service_name) | indent(4) }} command: > {% if COTURN_USER_AUTH_ENABLED | bool %} --lt-cred-mech --user="${COTURN_USER_NAME}:${COTURN_USER_PASSWORD}" {% else %} --use-auth-secret --static-auth-secret="${COTURN_STATIC_AUTH_SECRET}" {% endif %} --log-file=stdout --external-ip={{ networks.internet.ip4 }} {% if networks.internet.ip6 | default('') %} --external-ip={{ networks.internet.ip6 }} {% endif %} --realm="${COTURN_REALM}" --fingerprint --total-quota=100 --stale-nonce --no-multicast-peers --no-cli --listening-port={{ COTURN_STUN_TURN_PORT }} --min-port={{ COTURN_RELAY_PORT_START }} --max-port={{ COTURN_RELAY_PORT_END }} {% if COTURN_TLS_ENABLED| bool %} --tls-listening-port={{ COTURN_STUN_TURN_PORT_TLS }} --cert={{ COTURN_TLS_CERT_PATH }} --pkey={{ COTURN_TLS_KEY_PATH }} {% endif %} --cipher-list=DEFAULT healthcheck: test: ["CMD", "sh", "-c", "command -v turnutils_stunclient >/dev/null && turnutils_stunclient -p {{ COTURN_STUN_TURN_PORT }} 127.0.0.1 || nc -z 127.0.0.1 {{ COTURN_STUN_TURN_PORT }}"] interval: 2m timeout: 5s retries: 3 start_period: 10m start_interval: 5s {{ lookup('compose_networks') }} {{ lookup('compose_volumes') }}