Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:18.04

RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y build-essential libpcre3 libpcre3-dev libssl-dev unzip ffmpeg wget zlib1g zlib1g-dev libssl-dev sudo
RUN apt-get install -y build-essential libpcre3 libpcre3-dev libssl-dev unzip ffmpeg wget zlib1g zlib1g-dev libssl-dev sudo curl

RUN useradd --create-home -s /bin/bash www ;\
adduser www sudo
Expand All @@ -29,6 +29,11 @@ ADD crossdomain.xml /usr/local/nginx/html/crossdomain.xml
ADD nginx.conf /home/www
RUN sudo chown -R www:www /usr/local/nginx

# aws cli
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip -u awscliv2.zip
RUN sudo ./aws/install

EXPOSE 80 443 1935

CMD ["/usr/local/nginx/sbin/nginx", "-c", "/home/www/nginx.conf"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ Then stop the container and start it again with the same command.
```
docker run -p 1935:1935 -p 8080:8080 -p 16666:4443 -v /home/deploy/viz/fullchain.pem:/etc/letsencrypt/live/viz.streampusher.com/fullchain.pem -v /home/deploy/viz/privkey.pem:/etc/letsencrypt/live/viz.streampusher.com/privkey.pem datafruits/viz:latest
```

## Building new image:
```
docker build -t datafruits/viz:latest .
```
90 changes: 63 additions & 27 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ events {
http {
server {
listen 8080;
listen 4443 ssl;
server_name viz.streampusher.com;
ssl_certificate /etc/letsencrypt/live/viz.streampusher.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/viz.streampusher.com/privkey.pem;
# listen 4443 ssl;
# server_name viz.streampusher.com;
# ssl_certificate /etc/letsencrypt/live/viz.streampusher.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/viz.streampusher.com/privkey.pem;

server_name vjstream.streampusher.com localhost;

location /hls {
# Serve HLS fragments

# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';

# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
# Serve HLS fragments

# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';

types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}


types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}

location /vj {
Expand Down Expand Up @@ -69,13 +69,37 @@ http {
}

location /vj2 {
# Serve HLS fragments
# Serve HLS fragments

# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';

# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}

types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}

# CORS setup
root /tmp;
add_header Cache-Control no-cache;
}
location /datafruits_hls {
# Serve HLS fragments from liquidsoap output

# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';

# allow CORS preflight requests
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
Expand All @@ -92,6 +116,7 @@ http {
root /tmp;
add_header Cache-Control no-cache;
}

location /live {
# Serve HLS fragments

Expand Down Expand Up @@ -133,6 +158,17 @@ rtmp {
record all;
record_path /home/www/video_recordings;
record_suffix -%d-%b-%y-%T.flv;

# on_record_done http://example.com/recorded;

# convert recorded file to mp4 format
# exec_record_done ffmpeg -y -i $path -acodec libmp3lame -ar 44100 -ac 1 -vcodec libx264 $dirname/$basename.mp4;
# exec_record_done ./sync_to_s3.sh $path
on_publish http://streampusher-rails-1:3000/dj_login.json;

# send to icecast and rtmp listener in one ffmpeg command
exec_push ffmpeg -i rtmp://localhost/$app/$name -map 0:a -c:a libmp3lame -f mp3 icecast://rtmp_source:pricemaster9876@datafruits_liquidsoap:9001/datafruits_rtmp -map 0:v -map 0:a -c copy -f flv rtmp://datafruits_liquidsoap:1936/live/$name;

}

application vj {
Expand Down
5 changes: 5 additions & 0 deletions sync_to_s3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

PATH=ARGV[1]
aws s3 cp $PATH s3://datafruitsvizdumps
rm $PATH