Skip to content

Commit f1a71ac

Browse files
authored
Merge pull request #2855 from nextcloud/eturnal
eturnal
2 parents 3052915 + d89d0ce commit f1a71ac

File tree

4 files changed

+55
-53
lines changed

4 files changed

+55
-53
lines changed

Containers/talk/Dockerfile

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM nats:2.9.21-scratch as nats
2+
FROM eturnal/eturnal:1.11.1 AS eturnal
23
FROM strukturag/nextcloud-spreed-signaling:1.1.3 as signaling
34
FROM alpine:3.18.3 as janus
45

@@ -32,8 +33,18 @@ RUN set -ex; \
3233
make configs; \
3334
rename -v ".jcfg.sample" ".jcfg" /usr/local/etc/janus/*.jcfg.sample
3435

35-
FROM coturn/coturn:4.6.2-alpine3.18
36-
USER root
36+
FROM alpine:3.18.2
37+
ENV STUN_SERVICE="stun.nextcloud.com 443"
38+
ENV ETURNAL_ETC_DIR="/conf"
39+
COPY --from=janus /usr/local /usr/local
40+
COPY --from=eturnal /opt/eturnal /opt/eturnal
41+
COPY --from=eturnal /usr/local/bin/stun /usr/local/bin/stun
42+
COPY --from=eturnal /usr/local/bin/eturnalctl /usr/local/bin/eturnalctl
43+
COPY --from=nats /nats-server /usr/local/bin/nats-server
44+
COPY --from=signaling /usr/bin/nextcloud-spreed-signaling /usr/local/bin/nextcloud-spreed-signaling
45+
46+
COPY --chmod=775 start.sh /start.sh
47+
COPY --chmod=664 supervisord.conf /supervisord.conf
3748

3849
RUN set -ex; \
3950
apk add --no-cache \
@@ -57,7 +68,7 @@ RUN set -ex; \
5768
libwebsockets \
5869
\
5970
shadow; \
60-
useradd --system talk; \
71+
useradd --system eturnal; \
6172
apk del --no-cache \
6273
shadow; \
6374
\
@@ -66,6 +77,7 @@ RUN set -ex; \
6677
\
6778
touch \
6879
/etc/nats.conf; \
80+
/etc/eturnal.yml; \
6981
echo "listen: 127.0.0.1:4222" | tee /etc/nats.conf; \
7082
mkdir -p \
7183
/var/tmp \
@@ -74,32 +86,22 @@ RUN set -ex; \
7486
/var/log/supervisord \
7587
/var/run/supervisord \
7688
/usr/local/lib/janus/loggers; \
77-
chown talk:talk -R \
89+
chown eturnal:eturnal -R \
7890
/usr \
91+
/opt/eturnal \
7992
/etc/nats.conf \
80-
/var/lib/turn \
8193
/var/log/supervisord \
8294
/var/run/supervisord; \
8395
chmod 777 -R \
8496
/tmp \
8597
/conf \
98+
/opt/eturnal \
8699
/var/run/supervisord \
87-
/var/lib/turn \
88100
/var/log/supervisord;
89101

90-
COPY --from=janus /usr/local /usr/local
91-
COPY --from=nats /nats-server /usr/local/bin/nats-server
92-
COPY --from=signaling /usr/bin/nextcloud-spreed-signaling /usr/local/bin/nextcloud-spreed-signaling
93-
94-
COPY --chmod=775 start.sh /start.sh
95-
COPY --chmod=664 supervisord.conf /supervisord.conf
96-
97-
# Set default talk port https://github.com/nextcloud/all-in-one/issues/1011
98-
ENV TALK_PORT=3478
99-
100-
USER talk
102+
USER eturnal
101103
ENTRYPOINT ["/start.sh"]
102104
CMD ["supervisord", "-c", "/supervisord.conf"]
103105

104-
HEALTHCHECK CMD (nc -z localhost 8081 && nc -z localhost 8188 && nc -z localhost 4222 && nc -z localhost "$TALK_PORT" && nc -z "$NC_DOMAIN" "$TALK_PORT") || exit 1
106+
HEALTHCHECK CMD (nc -z localhost 8081 && nc -z localhost 8188 && nc -z localhost 4222 && nc -z localhost "$TALK_PORT" && nc -z "$NC_DOMAIN" "$TALK_PORT" && eturnalctl status) || exit 1
105107
LABEL com.centurylinklabs.watchtower.enable="false"

Containers/talk/start.sh

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
if [ -z "$NC_DOMAIN" ]; then
55
echo "You need to provide the NC_DOMAIN."
66
exit 1
7+
elif [ -z "$TALK_PORT" ]; then
8+
echo "You need to provide the TALK_PORT."
9+
exit 1
710
elif [ -z "$TURN_SECRET" ]; then
811
echo "You need to provide the TURN_SECRET."
912
exit 1
@@ -16,43 +19,40 @@ elif [ -z "$INTERNAL_SECRET" ]; then
1619
fi
1720

1821
set -x
19-
IPv4_ADDRESS_TALK="$(dig nextcloud-aio-talk A +short)"
22+
IPv4_ADDRESS_TALK="$(dig nextcloud-aio-talk IN A +short | grep '^[0-9.]\+$' | sort | head -n1)"
23+
IPv6_ADDRESS_TALK="$(dig nextcloud-aio-talk AAAA +short | grep '^[0-9a-f:]\+$' | sort | head -n1)"
24+
25+
IPv4_ADDRESS_NC="$(dig "$NC_DOMAIN" IN A +short +https +tls-ca=/etc/ssl/certs/ca-certificates.crt @1.1.1.1 | grep '^[0-9.]\+$' | sort | head -n1)"
26+
IPv6_ADDRESS_NC="$(dig "$NC_DOMAIN" IN AAAA +short +https +tls-ca=/etc/ssl/certs/ca-certificates.crt @1.1.1.1 | grep '^[0-9a-f:]\+$' | sort | head -n1)"
2027
set +x
2128

2229
# Turn
23-
cat << TURN_CONF > "/conf/turnserver.conf"
24-
listening-port=$TALK_PORT
25-
fingerprint
26-
use-auth-secret
27-
static-auth-secret=$TURN_SECRET
28-
realm=$NC_DOMAIN
29-
total-quota=0
30-
bps-capacity=0
31-
stale-nonce
32-
no-multicast-peers
33-
simple-log
34-
pidfile=/var/tmp/turnserver.pid
35-
no-tls
36-
no-dtls
37-
userdb=/var/lib/turn/turndb
38-
# Based on https://nextcloud-talk.readthedocs.io/en/latest/TURN/#turn-server-and-internal-networks
39-
allowed-peer-ip=$IPv4_ADDRESS_TALK
40-
denied-peer-ip=0.0.0.0-0.255.255.255
41-
denied-peer-ip=10.0.0.0-10.255.255.255
42-
denied-peer-ip=100.64.0.0-100.127.255.255
43-
denied-peer-ip=127.0.0.0-127.255.255.255
44-
denied-peer-ip=169.254.0.0-169.254.255.255
45-
denied-peer-ip=172.16.0.0-172.31.255.255
46-
denied-peer-ip=192.0.0.0-192.0.0.255
47-
denied-peer-ip=192.0.2.0-192.0.2.255
48-
denied-peer-ip=192.88.99.0-192.88.99.255
49-
denied-peer-ip=192.168.0.0-192.168.255.255
50-
denied-peer-ip=198.18.0.0-198.19.255.255
51-
denied-peer-ip=198.51.100.0-198.51.100.255
52-
denied-peer-ip=203.0.113.0-203.0.113.255
53-
denied-peer-ip=240.0.0.0-255.255.255.255
30+
cat << TURN_CONF > "/conf/eturnal.yml"
31+
eturnal:
32+
listen:
33+
- ip: "::"
34+
port: $TALK_PORT
35+
transport: udp
36+
- ip: "::"
37+
port: $TALK_PORT
38+
transport: tcp
39+
log_dir: stdout
40+
log_level: warning
41+
secret: "$TURN_SECRET"
42+
relay_ipv4_addr: "$IPv4_ADDRESS_NC"
43+
relay_ipv6_addr: "$IPv6_ADDRESS_NC"
44+
blacklist:
45+
- recommended
46+
whitelist:
47+
- 127.0.0.1
48+
- ::1
49+
- "$IPv4_ADDRESS_TALK"
50+
- "$IPv6_ADDRESS_TALK"
5451
TURN_CONF
5552

53+
# Remove empty lines so that the config is not invalid
54+
sed -i '/""/d' /conf/eturnal.yml
55+
5656
# Signling
5757
cat << SIGNALING_CONF > "/conf/signaling.conf"
5858
[http]

Containers/talk/supervisord.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ logfile_maxbytes=50MB
77
logfile_backups=10
88
loglevel=error
99

10-
[program:turnserver]
10+
[program:eturnal]
1111
stdout_logfile=/dev/stdout
1212
stdout_logfile_maxbytes=0
1313
stderr_logfile=/dev/stderr
1414
stderr_logfile_maxbytes=0
15-
command=turnserver -c /conf/turnserver.conf
15+
command=eturnalctl foreground
1616

1717
[program:nats-server]
1818
stdout_logfile=/dev/stdout

php/containers.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@
361361
"tmpfs": [
362362
"/var/log/supervisord",
363363
"/var/run/supervisord",
364+
"/opt/eturnal/run",
364365
"/conf",
365-
"/var/lib/turn",
366366
"/tmp"
367367
]
368368
},

0 commit comments

Comments
 (0)