1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-26 04:21:00 +01:00

Fix arguments expansion in docker-entrypoint.sh (#1110, #902)

Co-authored-by: Kai Ren <tyranron@gmail.com>
This commit is contained in:
Shu Muto 2023-02-01 02:09:43 +09:00 committed by GitHub
parent 46a38d1c8c
commit 629faceeef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 29 deletions

View File

@ -4,6 +4,18 @@ Coturn TURN server Docker image changelog
## [4.6.1-r1] · 2023-01-??
[4.6.1-r1]: /../../tree/docker/4.6.1-r1
### Fixed
- Incorrect argument expansion in `docker-entrypoint.sh`. ([#1110])
[#1110]: /../../pull/1110
## [4.6.1-r0] · 2022-12-04
[4.6.1-r0]: /../../tree/docker/4.6.1-r0
@ -192,7 +204,7 @@ Coturn TURN server Docker image changelog
### Improved
- Use DNS requests to discover external IP address in `detect-external-ip` script ([#753]).
- Use DNS requests to discover external IP address in `detect-external-ip` script. ([#753])
### Fixed

View File

@ -52,9 +52,7 @@ As per [RFC 5766 Section 6.2], these are the ports that the TURN server will use
You can change them with `min-port` and `max-port` Coturn configuration options:
```bash
docker run -d -p 3478:3478 -p 3478:3478/udp -p 5349:5349 -p 5349:5349/udp -p 49160-49200:49160-49200/udp \
coturn/coturn -n --log-file=stdout \
--external-ip='$(detect-external-ip)' \
--min-port=49160 --max-port=49200
coturn/coturn --min-port=49160 --max-port=49200
```
Or just use the host network directly (__recommended__, as Docker [performs badly with large port ranges][7]):
@ -97,12 +95,15 @@ By default, default Coturn configuration and CLI options provided in the `CMD` [
#### Automatic detection of external IP
`detect-external-ip` binary may be used to automatically detect external IP of TURN server in runtime. It's okay to use it multiple times (the value will be evaluated only once).
`detect-external-ip` binary may be used to automatically detect external IP of TURN server in runtime.
To add ` --external-ip=<detected external IP>` using `detect-external-ip` as argument for `turnserver`, set envronment variable `DETECT_EXTERNAL_IP`. Also, environment variables `DETECT_RELAY_IP`, `DETECT_EXTERNAL_IPV6` and `DETECT_RELAY_IPV6` can be used for adding arugments ` --external-ip=<detected external IP>` or ` --relay-ip=<detected external IP>`.
It's okay to use it multiple times (the value will be evaluated only once).
```bash
docker run -d --network=host coturn/coturn \
-n --log-file=stdout \
--external-ip='$(detect-external-ip)' \
--relay-ip='$(detect-external-ip)'
docker run -d --network=host \
-e DETECT_EXTERNAL_IP=yes \
-e DETECT_RELAY_IP=yes \
coturn/coturn \
-n --log-file=stdout
```
By default, [IPv4] address is discovered. In case you need an [IPv6] one, specify the `--ipv6` flag:

View File

@ -105,7 +105,7 @@ COPY --from=dist-libprom /out/ /
COPY CMakeLists.txt \
configure \
INSTALL \
LICENSE LICENSE.OpenSSL \
LICENSE \
make-man.sh Makefile.in \
postinstall.txt \
README.turn* \
@ -154,7 +154,6 @@ RUN mkdir -p /out/ \
# Install helper tools of Docker image.
COPY docker/coturn/rootfs/ /out/
COPY docker/coturn/alpine/rootfs/ /out/
RUN chmod +x /out/usr/local/bin/docker-entrypoint.sh \
/out/usr/local/bin/detect-external-ip.sh
RUN ln -s /usr/local/bin/detect-external-ip.sh \
@ -187,6 +186,9 @@ RUN apk update \
hiredis \
mongo-c-driver \
libmicrohttpd \
# Install `bash` for `docker-entrypoint.sh`.
&& apk add --no-cache \
bash \
# Install `dig` tool for `detect-external-ip.sh`.
&& apk add --no-cache \
bind-tools \

View File

@ -1,8 +0,0 @@
#!/bin/sh
# If command starts with an option, prepend it with a `turnserver` binary.
if [ "${1:0:1}" == '-' ]; then
set -- turnserver "$@"
fi
exec $(eval "echo $@")

View File

@ -104,7 +104,7 @@ COPY --from=dist-libprom /out/ /
COPY CMakeLists.txt \
configure \
INSTALL \
LICENSE LICENSE.OpenSSL \
LICENSE \
make-man.sh Makefile.in \
postinstall.txt \
README.turn* \
@ -153,7 +153,6 @@ RUN mkdir -p /out/ \
# Install helper tools of Docker image.
COPY docker/coturn/rootfs/ /out/
COPY docker/coturn/debian/rootfs/ /out/
RUN chmod +x /out/usr/local/bin/docker-entrypoint.sh \
/out/usr/local/bin/detect-external-ip.sh
RUN ln -s /usr/local/bin/detect-external-ip.sh \

View File

@ -1,8 +0,0 @@
#!/bin/bash
# If command starts with an option, prepend it with a `turnserver` binary.
if [ "${1:0:1}" == '-' ]; then
set -- turnserver "$@"
fi
exec $(eval "echo $@")

View File

@ -0,0 +1,14 @@
#!/bin/bash
# If command starts with an option, prepend it with a `turnserver` binary.
if [ "${1:0:1}" == '-' ]; then
set -- turnserver "$@"
fi
# Evaluate each argument separately to avoid mixing them up in a single `eval`.
expanded=()
for i in "$@"; do
expanded+=("$(eval "echo $i")")
done
exec "${expanded[@]}"