Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
feat(docker): setup docker stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
GOATS2K committed Dec 2, 2021
1 parent 47c3944 commit 005df16
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.10.0

RUN apt update
RUN apt install git nginx libnginx-mod-rtmp ffmpeg -y

COPY ./docker/nginx.conf /etc/nginx/nginx.conf

WORKDIR /app
RUN git clone https://github.com/GOATS2K/overpass.git .
COPY .env /app/
RUN pip3 install .
RUN flask init-db

EXPOSE 8000
EXPOSE 1935

CMD ["gunicorn", "app:app", "--workers=2", "--threads=4", "--worker-class=gthread", "--timeout=600", "--bind=0.0.0.0"]
20 changes: 20 additions & 0 deletions docker-compose.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
overpass:
build: .
container_name: overpass
environment:
- HLS_PATH=/hls
- REC_PATH=/archive
- OVERPASS_SECRET_KEY=example_key_1337
- RTMP_SERVER="127.0.0.1:1935/live"
- DISCORD_CLIENT_ID=yourclientid
- DISCORD_CLIENT_SECRET=yourclientsecret
- DISCORD_REDIRECT_URI=yourredirecturi
- DISCORD_GUILD_ID=yoursecretguildid
volumes:
- /Users/jpg/Container Data/overpass/log:/logs:rw
- /Users/jpg/Container Data/overpass/archive:/archive:rw
- /Users/jpg/Container Data/overpass/hls:/hls:rw
ports:
- 1935:1935
- 8000:8000
1 change: 1 addition & 0 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker
71 changes: 71 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
rtmp_auto_push on;

events {
worker_connections 4096;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# Logging Settings
##

log_format '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';

access_log /logs/nginx/access.log;
error_log /logs/nginx/error.log;

##
# Gzip Settings
##

gzip on;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

rtmp {
server {
listen 0.0.0.0:1935;
on_publish http://127.0.0.1:8000/api/rtmp/connect;
on_publish_done http://127.0.0.1:8000/api/rtmp/done;

application live {
live on;
record all;
record_path /archive;
record_append on;

hls on;
hls_path /hls;
hls_fragment 2s;
hls_playlist_length 10s;
exec_record_done bash -c "/usr/bin/ffmpeg -i $path -acodec copy -vcodec copy -movflags +faststart /archive/$basename.mp4 && rm $path";
}
}
}

0 comments on commit 005df16

Please sign in to comment.