Skip to content

Commit d5ceffc

Browse files
committed
Update Docker build.
1 parent 3671907 commit d5ceffc

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
2+
charts/
23
build.sh
34
Dockerfile

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Note the following environment variables affect the server:
5454

5555
## Bonus: Docker and Kubernetes
5656

57-
For extra credit, you can run the server under Docker. You will need host networking to allow the Docker instance to access all the TCP and UDP ports it needs (see above RTC_ANNOUNCED_IPV4). Docker doesn't allow exposing port ranges.
57+
For extra credit, you can run the server under Docker (the repository is michaelfig/mediasoup-broadcast-example). You will need host networking to allow the Docker instance to access all the TCP and UDP ports it needs (see above RTC_ANNOUNCED_IPV4). Docker doesn't allow exposing port ranges.
5858

5959
If you like Kubernetes, there is a Helm chart in charts/mediasoup-broadcast-example. See the values.yaml in that directory for instructions on using hostNetworkIP. In short, you will need to schedule the mediasoup-broadcast-example pod (single replica only) to run on a node that has an external IP that meets the requirements of RTC_ANNOUNCED_IPV4. To accomplish this, you will use "hostNetworkIP: <MY-IP>" in your Helm yaml settings, and then label the node that receives traffic for that public IP with:
6060

build.sh

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
#! /bin/sh
22
set -e
3+
thisdir=`dirname "$0"`
34
NAME=mediasoup-broadcast-example
5+
VERSION=`sed -ne '/^ *"version":/{ s/^.* "version": *"\([^"]*\)".*/\1/; p; q; }' "$thisdir"/package.json`
6+
47
# If KUBE_CONTEXT=example, use --kube-context=example and -fcharts/example.yaml
58
KUBE_CONTEXT=${KUBE_CONTEXT-example}
6-
thisdir=`dirname "$0"`
79
export KUBE_CONTEXT
810
case "$1" in
9-
build)
11+
push)
1012
cd "$thisdir"
1113
# Find the name of the Docker registry from charts/$KUBE_CONTEXT.yaml's repository: line.
1214
REGISTRY=`sed -ne '/^ *repository:/{ s/^.* \([^/]*\).*$/\1/; p; q; }' charts/"$KUBE_CONTEXT".yaml`
13-
docker build -t $REGISTRY/mediasoup-broadcast-example .
14-
docker push $REGISTRY/mediasoup-broadcast-example
15+
docker build -t $REGISTRY/mediasoup-broadcast-example:$VERSION -t $REGISTRY/mediasoup-broadcast-example:latest .
16+
docker push $REGISTRY/mediasoup-broadcast-example:$VERSION
17+
docker push $REGISTRY/mediasoup-broadcast-example:latest
1518
;;
1619
upgrade|install)
1720
cd "$thisdir"
@@ -23,12 +26,11 @@ upgrade|install)
2326
RECREATE=--recreate-pods
2427
fi
2528
helm --kube-context="$KUBE_CONTEXT" upgrade \
26-
$RECREATE --install $NAME -f charts/"$KUBE_CONTEXT".yaml \
29+
$RECREATE --install $NAME -f charts/"$KUBE_CONTEXT".yaml --set=image.tag=$VERSION \
2730
charts/$NAME ${1+"$@"}
2831
;;
29-
"")
30-
$SHELL $0 build
31-
$SHELL $0 upgrade
32+
"" | help)
33+
echo "Run: \`$0 upgrade' to helm upgrade using KUBE_CONTEXT=$KUBE_CONTEXT"
3234
;;
3335
*)
3436
cmd="$1"

charts/example.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
image:
2-
repository: registry.example.com/mediasoup-broadcast-example
3-
tag: latest
4-
pullPolicy: Always
51
service:
62
# Needs:
73
# kubectl label node <MY-NODE> hostNetworkIP=1.2.3.4
@@ -11,7 +7,7 @@ ingress:
117
ingress.kubernetes.io/rewrite-target: /
128
nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
139
nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
14-
certmanager.k8s.io/cluster-issuer: ca-issuer
10+
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
1511
enabled: true
1612
hosts:
1713
- msbe.example.com

charts/mediasoup-broadcast-example/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
replicaCount: 1
66

77
image:
8-
repository: mediasoup-broadcast-example
8+
repository: michaelfig/mediasoup-broadcast-example
99
tag: stable
1010
pullPolicy: IfNotPresent
1111

0 commit comments

Comments
 (0)