Browse Source

Add Docker support

Signed-off-by: Gary Kim <gary@garykim.dev>
pull/7/head
Gary Kim 10 months ago
parent
commit
e65b570419
No known key found for this signature in database GPG Key ID: 9349B59FB54594AC
6 changed files with 108 additions and 0 deletions
  1. +4
    -0
      .dockerignore
  2. +18
    -0
      Dockerfile
  3. +15
    -0
      README.md
  4. +32
    -0
      docker-compose.yml
  5. +5
    -0
      docker/coturn/Dockerfile
  6. +34
    -0
      docker/janus/Dockerfile

+ 4
- 0
.dockerignore View File

@ -0,0 +1,4 @@
/docker/janus
/docker/coturn
/Dockerfile
/docker-compose.yml

+ 18
- 0
Dockerfile View File

@ -0,0 +1,18 @@
FROM golang:1.13 AS builder
RUN apt-get update && apt-get install -y python3
WORKDIR /workdir
COPY . .
RUN make build
FROM alpine:3.11
ENV CONFIG=/config/server.conf
RUN adduser -D spreedbackend && \
apk add --no-cache --no-cache ca-certificates libc6-compat libstdc++
USER spreedbackend
COPY --from=builder /workdir/bin/signaling /usr/local/signaling
COPY ./server.conf.in /config/server.conf
CMD ["/bin/sh", "-c", "/usr/local/signaling --config=$CONFIG"]

+ 15
- 0
README.md View File

@ -72,6 +72,21 @@ systemctl enable signaling.service
systemctl start signaling.service
```
### Running with Docker
#### Docker Compose
You will likely have to adjust the Janus command line options depending on the exact network configuration on your server. Refer to [Setup of Janus](#setup-of-janus) and the Janus documentation for how to configure your Janus server.
Copy `server.conf.in` to `server.conf` and adjust it to your liking.
If you're using the [docker-compose.yml](docker-compose.yml) configuration as is, the MCU Url must be set to `ws://localhost:8188`, the NATS Url must be set to `nats://localhost:4222`, and TURN Servers must be set to `turn:localhost:3478?transport=udp,turn:localhost:3478?transport=tcp`.
```bash
docker-compose build
docker-compose up -d
```
## Setup of NATS server
There is a detailed description on how to install and run the NATS server


+ 32
- 0
docker-compose.yml View File

@ -0,0 +1,32 @@
version: '3'
services:
spreedbackend:
build: .
volumes:
- ./server.conf:/config/server.conf
network_mode: host
restart: unless-stopped
depends_on:
- nats
- janus
- coturn
nats:
image: nats:2.1
volumes:
- ./gnatsd.conf:/config/gnatsd.conf
command: ["-c", "/config/gnatsd.conf"]
network_mode: host
restart: unless-stopped
janus:
build: docker/janus
command: ["janus"]
network_mode: host
restart: unless-stopped
coturn:
build: docker/coturn
network_mode: host
environment:
REALM: nextcloud.domain.invalid
STATIC_SECRET: static_secret_same_in_server_conf
restart: unless-stopped

+ 5
- 0
docker/coturn/Dockerfile View File

@ -0,0 +1,5 @@
FROM alpine:3.11
RUN apk add --no-cache coturn
CMD ["/bin/sh", "-c", "turnserver --prod --fingerprint --use-auth-secret --static-auth-secret=$STATIC_SECRET --realm=$REALM --no-multicast-peers --no-tls --no-dtls"]

+ 34
- 0
docker/janus/Dockerfile View File

@ -0,0 +1,34 @@
# Modified from https://gitlab.com/powerpaul17/nc_talk_backend/-/blob/dcbb918d8716dad1eb72a889d1e6aa1e3a543641/docker/janus/Dockerfile
FROM alpine:3.11
RUN apk add --no-cache curl autoconf automake libtool pkgconf build-base \
glib-dev libconfig-dev libnice-dev jansson-dev openssl-dev zlib libsrtp-dev \
gengetopt libwebsockets-dev git
# usrsctp
ARG USRSCTP_VERSION=4069ba5b9587bd7c99d964756b527d6259f0d3da
RUN cd /tmp && \
git clone https://github.com/sctplab/usrsctp && \
cd usrsctp && \
git checkout $USRSCTP_VERSION && \
./bootstrap && \
./configure --prefix=/usr && \
make && make install
# JANUS
ARG JANUS_VERSION=0.9.2
RUN mkdir -p /usr/src/janus && \
cd /usr/src/janus && \
curl -L https://github.com/meetecho/janus-gateway/archive/v$JANUS_VERSION.tar.gz | tar -xz && \
cd /usr/src/janus/janus-gateway-$JANUS_VERSION && \
./autogen.sh && \
./configure --disable-rabbitmq --disable-mqtt --disable-boringssl && \
make && \
make install && \
make configs
WORKDIR /usr/src/janus/janus-gateway-$JANUS_VERSION
CMD [ "janus" ]

Loading…
Cancel
Save