How to serve a Bolero (F#) web app to the internet?

146 views Asked by At

I'm new to using web servers, and I'm trying to learn the Bolero (F#) web framework. As a learning exercise, I'm trying to put the example app "into production", i.e. serve it to the internet and not just localhost.

I would like to use a basic (linux) web server to serve the website (specifically DigitalOcean)..i.e. not a specialized dotnet/microsoft/azure etc platform.

I don't believe that launching an app is covered in the documentation on the Bolero website (aside from a development setup using localhost).

I created the app with:

dotnet new bolero-app -o HelloWorld

Then after some web-searching I did:

cd HelloWorld
dotnet publish -c Release

Then if I do:

cd ./src/HelloWorld.Server/bin/Release/net6.0/publish
./HelloWorld.Server

I get the message:

Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.

I'm not sure if those steps are the way I should be going about this...I would like to be serving on port 80, but I've not been able to change that or find where this is set in the example project. I grepped the project for "5000" but couldn't find where that setting is. I tried setting an environment variable with: "sudo export ASPNETCORE_URLS=http://localhost:80/". That hasn't changed where the app tries to serve the site. (Presumably I should be trying to write the server's ip address there instead of localhost?)

Any help is appreciated! Thanks!


EDIT: I've been able to serve the app to the internet!

From the main app directory (HelloWorld) I did:

cd /src/HelloWorld.Server 
sudo dotnet run --urls "http://xxx.xxx.xxx.xxx:80/

...where the x's were replaced with my server's IP address. )

0

There are 0 answers