Setup Nginx

RHEL

This procedure works on RHEL, CentOS, AlmaLinux, Rocky Linux and Fedora.

Install Nginx HTTP server and uWSGI:

# dnf install nginx uwsgi uwsgi-plugin-python3

Copy examples of uWSGI services provided in Slurm-web packages and reload units:

# cp -v /usr/share/slurm-web/wsgi/agent/slurm-web-{gateway,agent}-uwsgi.service \
  /etc/systemd/system/
# systemctl daemon-reload

Start and enable these services:

# systemctl enable --now slurm-web-agent-uwsgi.service slurm-web-gateway-uwsgi.service

Create file /etc/nginx/conf.d/slurm-web.conf:

server {
    listen 80;
    listen [::]:80;
    server_name $HOST;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/slurm-web-gateway/uwsgi.sock;
    }

    location /agent/ {
        include uwsgi_params;
        rewrite ^/agent/(.*)$ /$1 break;
        uwsgi_pass unix:/run/slurm-web-agent/uwsgi.sock;
    }
}

Where $HOST is the public hostname of your server.

# systemctl reload nginx.service

Slurm-web is now available at http://$HOST/ where $HOST is the public hostname of your server.

In case of failure, please refer to troubleshooting guide for help.

Debian

This procedure works on Debian and Ubuntu.

Install Nginx HTTP server and uWSGI:

# apt install nginx uwsgi-core uwsgi-plugin-python3

Copy examples of uWSGI services provided in Slurm-web packages and reload units:

# cp -v /usr/share/slurm-web/wsgi/agent/slurm-web-{gateway,agent}-uwsgi.service \
  /etc/systemd/system/
# systemctl daemon-reload

Start and enable these services:

# systemctl enable --now slurm-web-agent-uwsgi.service slurm-web-gateway-uwsgi.service

Create file /etc/nginx/sites-available/slurm-web.conf:

server {
    listen 80;
    listen [::]:80;
    server_name $HOST;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/slurm-web-gateway/uwsgi.sock;
    }

    location /agent/ {
        include uwsgi_params;
        rewrite ^/agent/(.*)$ /$1 break;
        uwsgi_pass unix:/run/slurm-web-agent/uwsgi.sock;
    }
}

Where $HOST is the public hostname of your server.

Enable Slurm-web site:

# ln -s /etc/nginx/sites-available/slurm-web.conf /etc/nginx/sites-enabled/slurm-web.conf

Remove default site:

# rm /etc/nginx/sites-enabled/default

Reload Nginx service to apply new configuration:

# systemctl reload nginx.service

Slurm-web is now available at http://$HOST/ where $HOST is the public hostname of your server.

In case of failure, please refer to troubleshooting guide for help.