Running Dashboards with non-IIS webservers

As good a topic as any for my first forum post :stuck_out_tongue: I’m running all Windows at work, but my homelab Enterprise license is running on Ubuntu 18.04. Has anyone tried running this with say nginx, or even as a service daemon under centOS or Debian?

Curious to see if i can make this more reliable rather than relying on tmux to start and detach my dashboard over ssh.

Thanks!

According to the MS Docs, it looks like we would need to implement some middleware in the Universal Dashboard service configuration: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.1

This could all be done in the Configure method of the ServerStartup class: https://github.com/ironmansoftware/universal-dashboard/blob/master/src/UniversalDashboard/Server/ServerStartup.cs#L80

Might have to pass in some additional parameters but my Linux skills are very lacking so check out that doc and let me know what you think.

1 Like
* Places an existing ASP.NET Core app behind a reverse proxy server.
* Sets up the reverse proxy server to forward requests to the Kestrel web server.
* Ensures the web app runs on startup as a daemon.
* Configures a process management tool to help restart the web app

Thanks, that’s exactly the scenario I had in mind. The nginx server block configuration looks very straight forward.

Essentially, you’d add a location block to your config like so

location / {
        proxy_pass         http://<dashboard_ip>:<port>;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }

It would appear to me at least, that by default, nginx only trusts localhost as a trusted proxy, meaning you’d want to install nginx on the dashboard server itself. I’ll need to look into that, as my proxy is seperate, being used to proxy several services. I’ll update with results.

Some initial testing indicates nginx reverse-proxying for SSL support works out of the box. This won’t actually RUN the dashboard, but it’s a quick and easy way to get SSL setup with something like Let’s Encrypt.

in your nginx server block, just specify the following:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    
    ssl_certificate /path/to/cert/fullchain.pem; # set permission 0600
    ssl_certificate_key /path/to/cert/privkey.pem; # set permission 0600

    location / {                                                                  
        proxy_pass http://127.0.0.1:<dashboard_running_port>;                   
    }    
}

Per this article it looks like you can check if your app is running directly with dotnet:

From the article:

To directly run the app on the server:

  1. Navigate to the app’s directory.
  2. Run the app: dotnet <app_assembly.dll> , where app_assembly.dll is the assembly file name of the app.

If i can get this working, I might hopefully be able to create a systemd service that will manage the kestrel process for nginx.

Problem is, I am not a dotnet guru, and i don’t know if this is possible, or which .dll i can call to run UD using this method.

@adamdriscoll Does that make sense, and can i run UD from invoking a dll?

Yep. You can use UniversalDashboard.Server.dll to do this. It’s just a dotnet DLL that launches a dashboard.ps1 file.

It’s expecting a dashboard.ps1 to be found in the parent directory of that DLL (root dir).

1 Like

alrighty, initial test throws this. I’ll keep looking around.

$ pwd
/var/www/html/net472

$ dotnet-sdk.dotnet /var/www/html/netstandard2.0/UniversalDashboard.Server.dll

A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/var/www/html/netstandard2.0/'.
Failed to run as a self-contained app. If this should be a framework-dependent app, add the /var/www/html/netstandard2.0/UniversalDashboard.Server.runtimeconfig.json file specifying the appropriate framework.

I’ve made some headway here. Going to write it up in a nice blog post and share!

1 Like