Setup Caddy
RHEL
This procedure works on RHEL, CentOS, AlmaLinux, Rocky Linux and Fedora. |
On RHEL, CentOS, AlmaLinux and Rocky Linux, enable EPEL repositories to get access to Caddy packages:
# dnf install -y epel-release
It is not required on Fedora on which Caddy is available in default distribution repositories. |
Install Caddy HTTP server and uWSGI:
# dnf install caddy uwsgi uwsgi-plugin-python3
Copy examples of uWSGI services provided in Slurm-web packages:
# cp -v /usr/share/slurm-web/wsgi/agent/slurm-web-{agent,gateway}-uwsgi.service /etc/systemd/system/
Edit /etc/systemd/system/slurm-web-gateway-uwsgi.service
to force
HTTP protocol:
--- a/etc/systemd/system/slurm-web-gateway-uwsgi.service
+++ b/etc/systemd/system/slurm-web-gateway-uwsgi.service
@@ -6,7 +6,7 @@
User=slurm-web
Group=slurm-web
RuntimeDirectory=slurm-web-gateway
-ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/gateway/slurm-web-gateway.ini
+ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/gateway/slurm-web-gateway.ini --protocol http
[Install]
WantedBy=multi-user.target
And also in /etc/systemd/system/slurm-web-gateway-uwsgi.service
:
--- a/etc/systemd/system/slurm-web-agent-uwsgi.service
+++ b/etc/systemd/system/slurm-web-agent-uwsgi.service
@@ -6,7 +6,7 @@
User=slurm
Group=slurm
RuntimeDirectory=slurm-web-agent
-ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/agent/slurm-web-agent.ini
+ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/agent/slurm-web-agent.ini --protocol http
[Install]
WantedBy=multi-user.target
This modification is required because Caddy does not support native uWSGI protocol. |
Reload unit files to apply changes:
# systemctl daemon-reload
Start and enable these services:
# systemctl enable --now slurm-web-agent-uwsgi.service slurm-web-gateway-uwsgi.service
Create fome /etc/caddy/Caddyfile.d/slurm-web.caddyfile
with this
content:
$HOST {
reverse_proxy unix//run/slurm-web-gateway/uwsgi.sock
handle_path /agent/* {
reverse_proxy unix//run/slurm-web-agent/uwsgi.sock
}
}
Where $HOST is the public hostname of your server.
Enable and start caddy service:
# systemctl enable --now caddy.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 Caddy HTTP server and uWSGI:
# apt install caddy uwsgi-core uwsgi-plugin-python3
Copy examples of uWSGI services provided in Slurm-web packages:
# cp -v /usr/share/slurm-web/wsgi/agent/slurm-web-{agent,gateway}-uwsgi.service /etc/systemd/system/
Edit /etc/systemd/system/slurm-web-gateway-uwsgi.service
to force
HTTP protocol:
--- a/etc/systemd/system/slurm-web-gateway-uwsgi.service
+++ b/etc/systemd/system/slurm-web-gateway-uwsgi.service
@@ -6,7 +6,7 @@
User=slurm-web
Group=slurm-web
RuntimeDirectory=slurm-web-gateway
-ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/gateway/slurm-web-gateway.ini
+ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/gateway/slurm-web-gateway.ini --protocol http
[Install]
WantedBy=multi-user.target
And also in /etc/systemd/system/slurm-web-gateway-uwsgi.service
:
--- a/etc/systemd/system/slurm-web-agent-uwsgi.service
+++ b/etc/systemd/system/slurm-web-agent-uwsgi.service
@@ -6,7 +6,7 @@
User=slurm
Group=slurm
RuntimeDirectory=slurm-web-agent
-ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/agent/slurm-web-agent.ini
+ExecStart=/usr/bin/uwsgi --ini /usr/share/slurm-web/wsgi/agent/slurm-web-agent.ini --protocol http
[Install]
WantedBy=multi-user.target
This modification is required because Caddy does not support native uWSGI protocol. |
Reload unit files to apply changes:
# systemctl daemon-reload
Start and enable these services:
# systemctl enable --now slurm-web-agent-uwsgi.service slurm-web-gateway-uwsgi.service
Edit /etc/caddy/Caddyfile
to add the following directives in default
site block:
reverse_proxy unix//run/slurm-web-gateway/uwsgi.sock
handle_path /agent/* {
reverse_proxy unix//run/slurm-web-agent/uwsgi.sock
}
Reload caddy configuration to apply configuration changes:
# systemctl reload caddy.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. |