Skip to content
This repository was archived by the owner on Aug 9, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions coturn.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG coturn_version=4.5.0.6-r3
FROM ananace:coturn:${coturn_version}
4 changes: 2 additions & 2 deletions homeserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,11 @@ media_store_path: "/data/media_store"

# The public URIs of the TURN server to give to clients
#
#turn_uris: []
turn_uris: [ 'turn:turn.ocf.berkeley.edu:3487?transport=udp' ]

# The shared secret used to compute passwords for the TURN server
#
#turn_shared_secret: "YOUR_SHARED_SECRET"
turn_shared_secret: "U2pKbFNwRjU4d016TW9FM0piVzFxZUFXVTk1Nzhta0JlbzgxSGxwMk9jNFpsbnRZVVI0MXR4VkJpcVJ2a1I1RQo="

# The Username and password if the TURN server needs them and
# does not use a token
Expand Down
104 changes: 104 additions & 0 deletions kubernetes/coturn.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
apiVersion: v1
data:
# see https://github.com/matrix-org/synapse/blob/master/docs/turn-howto.md#configuration
turnserver.conf: |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo we should build this into the container, like I mentioned in #11

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... it's not fully static because it needs the INTERNAL_IP variable. I'll need to look into why it needs that in the first place.

no-tcp-relay

denied-peer-ip=10.0.0.0-10.255.255.255
denied-peer-ip=192.168.0.0-192.168.255.255
denied-peer-ip=172.16.0.0-172.31.255.255
Comment thread
nikhiljha marked this conversation as resolved.

allowed-peer-ip=$INTERNAL_IP

user-quota=12
total-quota=1200
kind: ConfigMap
metadata:
labels:
app: coturn
name: coturn-config
namespace: matrix
Comment thread
nikhiljha marked this conversation as resolved.
Outdated
---
apiVersion: v1
data:
Comment thread
nikhiljha marked this conversation as resolved.
Outdated
# `pwgen -s 64 1 | base64 -w0` to generate
# identical to secret in homeserver.yaml
auth-secret: U2pKbFNwRjU4d016TW9FM0piVzFxZUFXVTk1Nzhta0JlbzgxSGxwMk9jNFpsbnRZVVI0MXR4VkJpcVJ2a1I1RQo=

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obviously we need to move these out of here before merging. homeserver.yaml will probably be moved to use ocf/utils#146, here we can just use a standard templated secret (like https://github.com/ocf/grafana/blob/c5e6a1c9c429dc1c0e962cb90842b01b94b5a887/kubernetes/grafana.yml.erb#L107)

kind: Secret
metadata:
labels:
app: coturn
name: coturn-secret
namespace: matrix
type: Opaque
---
apiVersion: v1
kind: Service
metadata:
labels:
app: coturn
name: coturn
namespace: matrix
spec:
externalTrafficPolicy: Cluster

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this does anything outside of AWS

ports:
# UDP only, do we need TCP?
- name: udp-port
port: 3487
protocol: UDP
targetPort: 3487
selector:
app: coturn
type: LoadBalancer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think LoadBalancer will do anything in our cluster.

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: coturn
name: coturn
namespace: matrix
spec:
replicas: 1
selector:
matchLabels:
app: coturn
template:
metadata:
labels:
app: coturn
spec:
containers:
- env:
- name: INTERNAL_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we would want the kubernetes pod IP, not the host IP (aka the IP of the worker). that would be status.podIP. that said, I don't really know what this is used for so that might be wrong

- name: EXTERNAL_IP
value: 1.2.3.4 # TODO: How to get?
Comment thread
nikhiljha marked this conversation as resolved.
Outdated
- name: AUTH_SECRET
valueFrom:
secretKeyRef:
key: auth-secret
name: coturn-secret
- name: PORT
value: "3487"
- name: REALM
value: turn.ocf.berkeley.edu
image: "docker.ocf.berkeley.edu/coturn:<%= coturn_version %>"
name: coturn
readinessProbe:
tcpSocket:
port: 9090
volumeMounts:
- mountPath: /etc/coturn/turnserver.conf
name: coturn-config
subPath: turnserver.conf
restartPolicy: Always
volumes:
- configMap:
defaultMode: 420
Comment thread
nikhiljha marked this conversation as resolved.
name: coturn-config
name: coturn-config