From 95b4dccf8cea915dc1e9494d58c4f344eb3cc8fc Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Tue, 26 Jul 2022 11:18:25 +0200 Subject: [PATCH] add install.md --- README.md | 4 ++ assets/ffplayout.conf | 75 +++++++++++++++++++++++++++++++++++++ docs/install.md | 24 ++++++++++++ ffplayout-engine/Cargo.toml | 3 ++ 4 files changed, 106 insertions(+) create mode 100644 assets/ffplayout.conf create mode 100644 docs/install.md diff --git a/README.md b/README.md index ddb325c0..7f36e169 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,10 @@ ffpapi is an [REST API](/ffplayout-api/README.md) for controlling the engine, ma - **ffmpeg** v4.2+ and **ffprobe** (**ffplay** if you want to play on desktop) - if you want to overlay text, ffmpeg needs to have **libzmq** +### Install + +Check [install](docs/install.md) for details about how to install ffplayout. + ----- ### JSON Playlist Example diff --git a/assets/ffplayout.conf b/assets/ffplayout.conf new file mode 100644 index 00000000..90d2c12c --- /dev/null +++ b/assets/ffplayout.conf @@ -0,0 +1,75 @@ +server { + listen 80; + + server_name ffplayout.local; + + gzip on; + gzip_types text/plain application/xml text/css application/javascript; + gzip_min_length 1000; + + charset utf-8; + + client_max_body_size 7000M; # should be desirable value + + add_header X-Frame-Options SAMEORIGIN; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; + + location / { + if ($http_origin ~ '^https?://(localhost|ffplayout\.local)') { + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; + } + + if ($request_method = OPTIONS ) { + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + + root /var/www/ffplayout-frontend/; + } + + location ~ ^/(api|auth) { + if ($http_origin ~ '^https?://(localhost|ffplayout\.local)') { + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; + } + + add_header Last-Modified $date_gmt; + add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; + if_modified_since off; + expires off; + etag off; + + proxy_set_header Host $http_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; + proxy_read_timeout 36000s; + proxy_connect_timeout 36000s; + proxy_send_timeout 36000s; + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + send_timeout 36000s; + proxy_no_cache 1; + proxy_pass http://127.0.0.1:8000; + + } + + location /live/ { + alias /var/www/srs/live/; + } + + location /preview/stream.flv { + # HTTP-FLV preview + proxy_pass http://preview.local:8080/live/stream.flv; + } +} diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 00000000..03383c9d --- /dev/null +++ b/docs/install.md @@ -0,0 +1,24 @@ +### Install ffplayout + +ffplayout provides ***.deb** amd ***.rpm** packages, which makes it more easy to install and use, but there is still some steps to do. + +1. download the latest ffplayout from [release](https://github.com/ffplayout/ffplayout/releases/latest) page. +2. install it with `apt install /tmp/ffplayout__amd64.deb` +3. install ffmpeg/ffprobe, or compile and copy it to **/usr/local/bin/** +4. activate systemd services: + - `systemctl enable ffplayout` + - `systemctl enable --now ffpapi` +5. initialize sqlite database for ffpapi: + - `ffpapi -i` +6. add admin user to ffpapi: + - `ffpapi -a` +7. use a revers proxy for SSL, Port is **8787**. +8. login with your browser, address without proxy would be: **http://[IP ADDRESS]:8787** + +Default location for playlists and media files are: **/var/lib/ffplayout/**. If you need to change them, the media storage folder needs a symlink to **/usr/share/ffplayout/public/**. + +When you don't need the frontend and API, skip enable the systemd service **ffpapi**. + +When playlists are created and the ffplayout output is configured, you can start the process: `systemctl start ffplayout`, or click start in frontend. + +If you want to configure ffplayout over terminal, you can edit **/etc/ffplayout/ffplayout.yml**. diff --git a/ffplayout-engine/Cargo.toml b/ffplayout-engine/Cargo.toml index b2eb4f5c..dfcdceee 100644 --- a/ffplayout-engine/Cargo.toml +++ b/ffplayout-engine/Cargo.toml @@ -54,6 +54,7 @@ assets = [ ["../assets/ffplayout.yml", "/etc/ffplayout/", "644"], ["../assets/logo.png", "/usr/share/ffplayout/", "644"], ["../assets/ffplayout.yml", "/usr/share/ffplayout/ffplayout.yml.orig", "644"], + ["../assets/ffplayout.conf", "/usr/share/ffplayout/ffplayout.conf.example", "644"], ["../README.md", "/usr/share/doc/ffplayout/README", "644"], ["../public/**/*", "/usr/share/ffplayout/public/", "644"], ] @@ -75,6 +76,7 @@ assets = [ ["../assets/ffplayout.yml", "/etc/ffplayout/", "644"], ["../assets/logo.png", "/usr/share/ffplayout/", "644"], ["../assets/ffplayout.yml", "/usr/share/ffplayout/ffplayout.yml.orig", "644"], + ["../assets/ffplayout.conf", "/usr/share/ffplayout/ffplayout.conf.example", "644"], ["../README.md", "/usr/share/doc/ffplayout/README", "644"], ["../public/**/*", "/usr/share/ffplayout/public/", "644"], ] @@ -95,6 +97,7 @@ assets = [ { source = "../LICENSE", dest = "/usr/share/doc/ffplayout/LICENSE", mode = "644" }, { source = "../assets/logo.png", dest = "/usr/share/ffplayout/logo.png", mode = "644" }, { source = "../assets/ffplayout.yml", dest = "/usr/share/ffplayout/ffplayout.yml.orig", mode = "644" }, + { source = "../assets/ffplayout.conf", dest = "/usr/share/ffplayout/ffplayout.conf.example", mode = "644" }, { source = "../public/**/*", dest = "/usr/share/ffplayout/public/", mode = "644" }, { source = "../debian/postinst", dest = "/usr/share/ffplayout/postinst", mode = "755" }, { source = "../debian/postrm", dest = "/usr/share/ffplayout/postrm", mode = "755" },