Skip to content
Damián Silvani edited this page Dec 18, 2022 · 2 revisions

Deploy

Configure Muxy server

Copy service files for gunicorn:

sudo cp tools/systemd/muxy-gunicorn.s* /etc/systemd/system/

Edit /etc/systemd/system/muxy-gunicorn.service to replace path to muxy on ExecStart, and correctly set User and Group.

Start and enable service for gunicorn:

sudo systemctl start muxy-gunicorn
sudo systemctl enable muxy-gunicorn

Check if service is running correctly with:

sudo systemctl status muxy-gunicorn

Copy nginx site config:

sudo cp tools/nginx/muxy.example.com /etc/nginx/sites-available/

Rename file to correct server name and edit file to fix server name.

Then, enable site config on Nginx:

sudo ln -s /etc/nginx/sites-available/muxy.example.com /etc/nginx/sites-enabled/

Check for syntax errors on config before restarting nginx:

sudo nginx -t

If everything went OK, restart Nginx:

sudo systemctl restart nginx

Configure cron job for notifications

Run crontab -e and add an entry like this one:

*/1 * * * * /path/to/muxy/.venv/bin/python /path/to/muxy/manage.py runcrons

Replace /path/to/muxy to the path where you have the Muxy repository installed.

Configure nginx-rtmp to set validation

The following is an nginx-rtmp sample configuration, that configures an RTMP application to use Muxy allow/deny mechanism. Remember to replace muxy.example.com with your Muxy hostname.

rtmp {
    application live {
        ...

        notify_update_timeout 10s;

        # HTTP callback when a stream starts publishing.
        # Returns 2xx only if publisher is allowed to publish now.
        on_publish http://muxy.example.com/rtmp/on-publish/;

        # Called when a stream stops publishing.  Response is ignored.
        on_publish_done http://muxy.example.com/rtmp/on-publish-done/;

        # Called with a period of notify_update_timeout,
        # to force disconnect publisher when her allotted time ends.
        on_update http://muxy.example.com/rtmp/on-update/;
    }
}
Clone this wiki locally