TinyPilot은 LAN을 통해 외부 인터넷에서도 KVM에 접속하여 키보드, 마우스, 모니터를 사용할 수 있도록 하는 KVM 서비스임.
TinyPilot은 크게 3가지로 구성되어 있음:
- TinyPilot의 웹 프로그램: 사용자 인터페이스를 제공하고, 키보드 및 마우스 입력을 캡처함.
- uStreamer: HDMI 캡처 장치로부터 화면을 캡처하여 스트리밍함.
- Janus Gateway: WebRTC를 통해 uStreamer로부터 받아온 캡처 화면을 웹을 통해 스트리밍 가능하게 함.
따라서 다음과 같이 두 개의 Docker 파일로 구분하여 Compose 파일을 구성할 예정임:
- TinyPilot의 메인 프로그램 (Janus 포함)
- uStreamer 서버
구성 절차
- 패키지 설치: Python, Node.js, Git 등의 필요한 패키지 설치
- TinyPilot 소스 코드 클론: TinyPilot 소스 코드 클론
- 종속성 설치: Python 및 Node.js 종속성 설치
- TinyPilot 빌드: TinyPilot 빌드
프로젝트 디렉토리 구조
project-directory/
├── docker-compose.yml
├── images/
│ ├── tinypilot/
│ │ ├── Dockerfile
│ │ └── 프로그램 파일들 (예: app/, dev-scripts/, requirements.txt 등)
│ └── ustreamer/
│ ├── Dockerfile
│ └── 프로그램 파일들
└── nginx/
└── kvn.conf.template
Dockerfile 예제
TinyPilot Dockerfile (images/tinypilot/Dockerfile)
FROM python:3
# 필요한 패키지 설치
RUN apt-get update && apt-get install -y curl sudo git
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
# TinyPilot 소스 코드 복사
COPY . /opt/tinypilot
WORKDIR /opt/tinypilot
# Python 및 Node.js 종속성 설치
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install -r dev_requirements.txt
RUN npm install prettier@2.0.5
# TinyPilot 빌드
RUN ./dev-scripts/build
# 포트 설정
EXPOSE 8000
# 컨테이너 진입점 설정
CMD ["python", "/opt/tinypilot/app/main.py"]
uStreamer Dockerfile (images/ustreamer/Dockerfile)
FROM ubuntu:20.04
# 필요한 패키지 설치
RUN apt update && apt -y install git build-essential libevent-dev libjpeg62-dev uuid-dev libbsd-dev make gcc libjpeg8 libjpeg-turbo8 libuuid1 libbsd0
# uStreamer 소스 코드 복사
COPY . /opt/ustreamer
WORKDIR /opt/ustreamer
# uStreamer 빌드 및 설치
RUN make && make install
# 포트 설정
EXPOSE 8080
# 컨테이너 진입점 설정
CMD ["ustreamer", "--host=0.0.0.0", "-r", "1920x1080", "--persistent", "--drop-same-frames=30", "-l"]
docker-compose.yml 파일 작성
version: '3.6'
services:
nginx:
image: nginx
container_name: nginx
restart: always
depends_on:
- ustreamer
- tinypilot
ports:
- 10080:10080
volumes:
- ./nginx:/etc/nginx/templates
ustreamer:
build:
context: ./images/ustreamer/
container_name: ustreamer
restart: always
devices:
- /dev/video0:/dev/video0
tinypilot:
build:
context: ./images/tinypilot/
container_name: tinypilot
restart: always
devices:
- /dev/hidg0:/dev/hidg0
- /dev/hidg1:/dev/hidg1
설정 방법
프로젝트 디렉토리 구조 생성:
mkdir -p project-directory/images/tinypilot mkdir -p project-directory/images/ustreamer mkdir -p project-directory/nginx
TinyPilot 소스 코드 클론:
cd project-directory/images/tinypilot git clone https://github.com/mtlynch/tinypilot .
uStreamer 소스 코드 클론:
cd project-directory/images/ustreamer git clone --depth=1 https://github.com/pikvm/ustreamer .
Docker 이미지 빌드:
cd project-directory docker-compose build
Docker 컨테이너 실행:
docker-compose up
'Server' 카테고리의 다른 글
우분투 시스템 에 lxc 설정하기 (1) | 2024.08.31 |
---|---|
[RaspberryPI] 라즈베리 파이 dwc 커스텀 usb_hid_gadget 설정 (4) | 2024.08.30 |
ubuntu ssh key-pair 생성 및 적용 (6) | 2024.07.23 |
Server_Chroot_nginx start 실패시 대응법 (1) | 2024.07.08 |
Server_chroot환경_nginx_설치 및 세팅 (0) | 2024.07.08 |