Recent Posts
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 깡돼후
- vfr video
- 달인막창
- 개성국밥
- 코루틴 컨텍스트
- addhooks
- 코루틴 빌더
- PersistenceContext
- pytest
- 자원부족
- Spring Batch
- preemption #
- terminal
- 헥사고날아키텍처 #육각형아키텍처 #유스케이스
- VARCHAR (1)
- Value too long for column
- tolerated
- mp4fpsmod
- JanusWebRTCGateway
- JanusWebRTCServer
- 겨울 부산
- JanusWebRTC
- python
- JanusGateway
- table not found
- PytestPluginManager
- 오블완
- taint
- kotlin
- 티스토리챌린지
Archives
너와 나의 스토리
Janus Gateway를 이용해서 미러링 본문
반응형
1. Docker build
- 베이스 코드: https://github.com/baiyongzhen/webrtc-janus
- 여기서 dockerfile을 아래와 같이 수정
FROM debian:latest
ENV BUILD_FOLDER /tmp/build
ENV WORK_FOLDER /opt
ENV VENV_PATH=/opt/venv
RUN mkdir -p ${BUILD_FOLDER}
RUN mkdir -p ${WORK_FOLDER}
RUN apt-get update && apt-get install -y --fix-missing \
libmicrohttpd-dev \
libjansson-dev \
libnice-dev \
libssl-dev \
libsofia-sip-ua-dev \
libglib2.0-dev \
libopus-dev \
libogg-dev \
libcurl4-openssl-dev \
liblua5.3-dev \
libconfig-dev \
pkg-config \
gengetopt \
libtool \
automake \
gtk-doc-tools \
doxygen \
graphviz \
libnanomsg-dev \
libunwind-dev \
cmake \
golang-go
RUN apt-get install -y wget \
&& apt-get install -y vim \
&& apt-get install -y git \
&& apt-get install -y curl
RUN PATH="/usr/local/bin:$PATH"
RUN yes | apt-get install python3 python3-pip python3-setuptools \
python3-wheel ninja-build python3-venv
RUN python3 -m venv ${VENV_PATH}
ENV PATH="${VENV_PATH}/bin:${PATH}"
RUN . /opt/venv/bin/activate && pip install meson
RUN cd ${BUILD_FOLDER} \
&& git clone https://gitlab.freedesktop.org/libnice/libnice --depth=1 \
&& cd ./libnice \
&& meson setup --prefix=/usr --buildtype=release build \
&& ninja -C build \
&& ninja -C build install
RUN cd ${BUILD_FOLDER} \
&& wget https://github.com/cisco/libsrtp/archive/v2.3.0.tar.gz \
&& tar xfv v2.3.0.tar.gz \
&& cd libsrtp-2.3.0 \
&& ./configure --prefix=/usr --enable-openssl \
&& make shared_library \
&& make install
RUN cd ${BUILD_FOLDER} \
&& git clone https://github.com/sctplab/usrsctp -b 0.9.5.0 --depth=1 \
&& cd ./usrsctp \
&& ./bootstrap \
&& ./configure --prefix=/usr --libdir=/usr/lib \
&& make \
&& make install
RUN cd ${BUILD_FOLDER} \
&& git clone https://libwebsockets.org/repo/libwebsockets -b v3.2-stable --depth=1 \
&& cd ./libwebsockets \
&& mkdir build \
&& cd ./build \
&& cmake -DCMAKE_BUILD_TYPE=Release \
-DLWS_MAX_SMP=1 -DLWS_WITHOUT_EXTENSIONS=0 \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DCMAKE_C_FLAGS="-fpic -Wno-deprecated-declarations" .. \
&& make \
&& make install
RUN cd ${WORK_FOLDER} \
&& git clone https://github.com/meetecho/janus-gateway.git -b v1.1.0 --depth=1 \
&& cd janus-gateway \
&& sh autogen.sh \
&& ./configure --prefix=/opt/janus \
&& make \
&& make install \
&& make configs
EXPOSE 8188
EXPOSE 8088
EXPOSE 8089
EXPOSE 8889
EXPOSE 8000
EXPOSE 7088
EXPOSE 7089
EXPOSE 10000-10300/udp
CMD ["/opt/janus/bin/janus"]
2. docker-compose
- 단일 서버에서 여러개의 컨테이너를 하나의 서비스로 정의해 컨테이너의 묶음으로 관리할 수 있도록 설정
- /webrtc-janus/docker/janus-gateway/v1.1.0로 이동 후
- $ docker-compose up -d
- 컨테이너가 정상적으로 실행 중인지 확인
- $ docker ps
* web container가 계속 restarting되는 문제 발생
- 로그를 보니(docker logs $container_id) 다음과 같이 나옴
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/03/20 01:19:37 [emerg] 1#1: unknown directive "ssl" in /etc/nginx/conf.d/default.conf:12
nginx: [emerg] unknown directive "ssl" in /etc/nginx/conf.d/default.conf:12
- 원인: ssl 지시어를 인식하지 못 하는 문제
- 해결책: nginx.conf를 다음과 같이 수정
- listen 뒤에 ssl 붙이기
- "listen 443" -> "listen 443 ssl"
- "ssl on" 부분 모두 주석 처리 -> # ssl on;
- listen 뒤에 ssl 붙이기
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
# ssl on;
access_log /var/log/nginx/client.access.log;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
# Web server HTTP port
# - "8088:8088" # Web server HTTP port
# - "8089:8089" # Web server secure HTTPS port
server {
listen 8089 ssl;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
# ssl on;
access_log /var/log/nginx/client.access.log;
location / {
proxy_pass http://jg:8088;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# Admin/Monitor
# - "7088:7088" # Admin/monitor web server HTTP port
# - "7889:7889" # Admin/monitor web server HTTPS port
server {
listen 7889;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
# ssl on;
access_log /var/log/nginx/client_7889.access.log;
location /admin {
proxy_pass http://jg:7088;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# websocket
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# - "7188:7188" # Admin API WebSockets server port
# - "7989:7989" # Admin API WebSockets server secure port
upstream appserver_7989 {
server jg:7188; # appserver_ip:ws_port
}
server {
listen 7989; # client_wss_port
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
# ssl on;
location / {
proxy_pass http://appserver_7989;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# - "8188:8188" # WebSockets server port
# - "8989:8989" # WebSockets server secure port
upstream appserver_8188 {
server jg:8188; # appserver_ip:ws_port
}
server {
listen 8989; # client_wss_port
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
# ssl on;
location / {
proxy_pass http://appserver_8188;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
- 이제 다시 확인해보면 status가 up으로 바뀐 것을 확인할 수 있다.
- 컨테이너가 정상적으로 떴는지 확인
- "https://127.0.0.1/" 접속했을 때 아래의 화면이 나오면 정상적으로 실행된 것.
- 여기서 Demos > Echo Test를 했을 때, 카메라 화면이 잘 미러링 돼야 한다.
출처
반응형
'개발' 카테고리의 다른 글
Python, pip 삭제 후 특정 버전 설치 (0) | 2024.06.23 |
---|---|
Unexpected method 'appcast' called on Cask adoptopenjdk** 문제 해결 (0) | 2024.06.23 |
Janus WebRTC Tutorial 실행 방법 정리 - 화상 미팅 테스트 (0) | 2024.03.19 |
Launchd를 이용해 시스템 부팅할 때마다 자동으로 서버 띄우기 예제 (1) | 2024.01.24 |
Appium version 여러 개 사용하는 방법 (0) | 2023.08.28 |
Comments