fix split of coturn and nextcloud

This commit is contained in:
Lars Hahn 2023-08-26 21:08:53 +02:00
parent dcdc06594d
commit 14b70537a7
5 changed files with 66 additions and 14 deletions

View File

@ -4,12 +4,36 @@ cloud_storage: /opt/storage
cloud_stage: prod cloud_stage: prod
cloud_update: false cloud_update: false
ncloud_coturn_pass: SomeRandomString coturn_domain: my_domain.tld
ncloud_coturn_port: 5349
ncloud_domain: coturn_pass: SomeRandomString
- my_domain.tld coturn_port: 5349
coturn_parallel_connection: 0 #0 is unlimited
coturn_bandwitdh: 0 #0 B/s is unlimited
coturn_session_lifetime: 600
coturn_cert: "/etc/letsencrypt/live/{{ coturn_domain }}/fullchain.pem"
coturn_pkey: "/etc/letsencrypt/live/{{ coturn_domain }}/privkey.pem"
coturn_dhparam: "/etc/letsencrypt/ssl-dhparams.pem"
coturn_configs:
- "tls-listening-port={{ coturn_port }}"
- fingerprint
- use-auth-secret
- "static-auth-secret={{ coturn_pass }}"
- "realm={{ ncloud_domain[0] }}"
- "total-quota={{ coturn_parallel_connection }}"
- "bps-capacity={{ coturn_bandwitdh }}"
- "stale-nonce={{ coturn_session_lifetime }}"
- cipher-list=\“ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384\″
- no-multicast-peers
- no-tlsv1
- no-tlsv1_1
- no-stdout-log
- "cert={{ coturn_cert }}"
- "pkey={{ coturn_pkey }}"
- "dh-file={{ coturn_dhparam }}"
signaling_janus_deb_target: "http://ftp.de.debian.org/debian/pool/main/j/janus/janus_1.0.0-4~bpo11+1_amd64.deb"
signaling_janus_api_key: MyVeryCoolApiKeyInBase64 signaling_janus_api_key: MyVeryCoolApiKeyInBase64
signaling_hash_key: VeryCoolHashKeyForSignaling signaling_hash_key: VeryCoolHashKeyForSignaling
@ -25,6 +49,6 @@ signaling_janus_port: 8188
signaling_janus_configs: signaling_janus_configs:
- 'stun_server = "{{ ncloud_domain[0] }}"' - 'stun_server = "{{ ncloud_domain[0] }}"'
- 'stun_port = {{ ncloud_coturn_port }}' - 'stun_port = {{ coturn_port }}'
- 'full_trickle = true' - 'full_trickle = true'
- 'turn_rest_api_key = "{{ signaling_janus_api_key }}"' - 'turn_rest_api_key = "{{ signaling_janus_api_key }}"'

32
tasks/coturn.yml Executable file
View File

@ -0,0 +1,32 @@
---
- name: install coturn server
apt:
update_cache: yes
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
install_recommends: yes
pkg:
- "coturn"
- name: enable coturn server
lineinfile:
path: "/etc/default/coturn"
regexp: '^#?TURNSERVER_ENABLED='
line: "TURNSERVER_ENABLED=1"
notify: restart coturn
- name: enable coturn server
lineinfile:
path: "/etc/turnserver.conf"
regexp: '^#?{{ configline.split("=")[0] }}{% if configline.split("=") | length > 1 %}={% endif %}'
line: "{{ configline }}"
loop: "{{ coturn_configs }}"
loop_control:
loop_var: configline
label: "{{ configline }}"
notify: restart coturn
- name: set coturn capabilities for port setting
capabilities:
path: /usr/bin/turnserver
capability: cap_net_bind_service=+ep
state: present

View File

@ -1,10 +1,4 @@
--- ---
#- name: install janus from deb file
# apt:
# deb: "{{ signaling_janus_deb_target }}"
# state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
# install_recommends: yes
- name: install janus - name: install janus
apt: apt:
update_cache: yes update_cache: yes

View File

@ -51,6 +51,8 @@
- include_tasks: nats.yml - include_tasks: nats.yml
- include_tasks: coturn.yml
- name: setup signaling systemd service unit - name: setup signaling systemd service unit
template: template:
src: "etc/systemd/system/signaling.service.j2" src: "etc/systemd/system/signaling.service.j2"

View File

@ -187,11 +187,11 @@ apikey = {{ signaling_janus_api_key }}
# The shared secret to use for generating TURN credentials. This must be the # The shared secret to use for generating TURN credentials. This must be the
# same as on the TURN server. # same as on the TURN server.
secret = {{ ncloud_coturn_pass }} secret = {{ coturn_pass }}
# A comma-separated list of TURN servers to use. Leave empty to disable the # A comma-separated list of TURN servers to use. Leave empty to disable the
# TURN REST API. # TURN REST API.
servers = turn:{{ ncloud_domain[0] }}:{{ ncloud_coturn_port }}?transport=udp,turn:{{ ncloud_domain[0] }}:{{ ncloud_coturn_port }}?transport=tcp servers = turn:{{ ncloud_domain[0] }}:{{ coturn_port }}?transport=udp,turn:{{ ncloud_domain[0] }}:{{ coturn_port }}?transport=tcp
[geoip] [geoip]
# License key to use when downloading the MaxMind GeoIP database. You can # License key to use when downloading the MaxMind GeoIP database. You can