diff --git a/README.md b/README.md index 4a77b9c..18a7a40 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,10 @@ sudo apt install python3-ldap python3-flask uwsgi-plugin-python3 git clone https://gitlab.crans.org/nounous/ghostream && cd ghostream ``` -Copy [ghostreamer.service](doc/ghostreamer.service) to `/etc/systemd/system/ghostreamer.service` +Copy [ghostreamer.service](doc/ghostream.service) to `/etc/systemd/system/ghostream.service` and customize. ``` sudo systemctl daemon-reload -sudo systemctl enable --now ghostreamer +sudo systemctl enable --now ghostream ``` diff --git a/doc/ghostreamer.service b/doc/ghostream.service similarity index 92% rename from doc/ghostreamer.service rename to doc/ghostream.service index 23a5901..71ee529 100644 --- a/doc/ghostreamer.service +++ b/doc/ghostream.service @@ -9,6 +9,7 @@ Environment=FLASK_CONFIG=production Environment=LDAP_URI=ldap://127.0.0.1:389 Environment=LDAP_USER_DN=cn=Utilisateurs,dc=crans,dc=org Environment=SITE_NAME=Crans Stream +Environment=SITE_HOSTNAME=stream.crans.org Environment=FAVICON=https://www.crans.org/images/favicon.ico ExecStart=uwsgi --http-socket 127.0.0.1:8080 --master --plugin python3 --module ghostream:app --static-map /static=/var/local/ghostream/ghostream/static Restart=always diff --git a/doc/nginx/modules-available/60-ghostream.conf b/doc/nginx/modules-available/60-ghostream.conf index 58894cf..c4530fc 100644 --- a/doc/nginx/modules-available/60-ghostream.conf +++ b/doc/nginx/modules-available/60-ghostream.conf @@ -30,7 +30,7 @@ rtmp { live on; record off; push rtmp://127.0.0.1:1915; - on_publish http://127.0.0.1:5000/; + on_publish http://127.0.0.1:8080/app/auth; } } } diff --git a/doc/nginx/sites-available/ghostream b/doc/nginx/sites-available/ghostream index 189adff..a06d3b3 100644 --- a/doc/nginx/sites-available/ghostream +++ b/doc/nginx/sites-available/ghostream @@ -49,9 +49,11 @@ server { access_log /var/log/nginx/ghostream.log; error_log /var/log/nginx/ghostream_error.log; - # Serve static HTML page with URL rewriting - root /var/www/stream; - try_files $uri $uri/ /index.html; + # Pass HTTP to Flask web server + location / { + proxy_pass http://127.0.0.1:8080; + proxy_redirect off; + } # Pass WebSocket to OvenMediaEngine for WebRTC signalling location /app/ { diff --git a/ghostream/__init__.py b/ghostream/__init__.py index 02defeb..3563666 100644 --- a/ghostream/__init__.py +++ b/ghostream/__init__.py @@ -15,13 +15,9 @@ def viewer(path): """Show stream that match this path""" return render_template('viewer.html', path=path) -@app.route('/auth', methods=['POST']) +@app.route('/app/auth', methods=['POST']) def auth(): """Authentication on stream start""" - # Limit to NGINX auth - if request.remote_addr != '127.0.0.1': - return "Permission denied", 403 - name = request.form.get('name') password = request.form.get('pass') diff --git a/ghostream/default_settings.py b/ghostream/default_settings.py index 22cc735..b509837 100644 --- a/ghostream/default_settings.py +++ b/ghostream/default_settings.py @@ -8,4 +8,5 @@ LDAP_USER_DN = os.environ.get('LDAP_USER_DN') or "cn=users,dc=example,dc=com" # Web page SITE_NAME = os.environ.get('SITE_NAME') or "Ghostream" +SITE_HOSTNAME = os.environ.get('SITE_HOSTNAME') or "localhost" FAVICON = os.environ.get('FAVICON') or "/favicon.ico" diff --git a/ghostream/templates/index.html b/ghostream/templates/index.html index d05776d..152526f 100644 --- a/ghostream/templates/index.html +++ b/ghostream/templates/index.html @@ -23,7 +23,7 @@