Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to .NET 8 #2

Merged
merged 9 commits into from
Jul 19, 2024
Merged

Update to .NET 8 #2

merged 9 commits into from
Jul 19, 2024

Conversation

64J0
Copy link
Member

@64J0 64J0 commented May 5, 2024

Warning

Notice that the branch name is misleading. My bad. I changed the PR direction while working on it.

Description

With this PR, I'm:

  • Updating the project to .NET 8 (F# and Dockerfile).

Related

How to test

  • If you're testing this PR before the related PR is merged, please change the Giraffe markdown URLs back to point to the master branch.
dotnet run --project src/Giraffe.Website/
# open the localhost:5000/ and make sure that it's working well (giraffe.wiki)

The Docker container:

docker build --build-arg version="0.0.1" -t "giraffefsharp/giraffe-website:0.0.1" -f src/Giraffe.Website/Dockerfile .

docker container run giraffefsharp/giraffe-website:0.0.1

# notice that we defined the environment variable ASPNETCORE_HTTP_PORTS due to a breaking
# change on .NET 8
docker container run -d -p 5000:5000 -e ASPNETCORE_HTTP_PORTS=5000 giraffefsharp/giraffe-website:0.0.1

⚠️ More information about the .NET 8 default port breaking change: link. This must impact the deployment of a new server version, so we'll need to talk to @dustinmoris.

This Docker image is available at: https://hub.docker.com/r/giraffefsharp/giraffe-website.

@64J0 64J0 self-assigned this May 5, 2024
@64J0 64J0 requested a review from dbrattli May 5, 2024 20:10
Copy link

@dbrattli dbrattli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@64J0
Copy link
Member Author

64J0 commented May 6, 2024

Updated the PR description due to a .NET 8 breaking change in the default port 80 -> 8080. It must impact the deployment of a new version. More information: link.

@64J0
Copy link
Member Author

64J0 commented May 8, 2024

I'll review how it was working before in respect to the listening port. It may be possible to configure this container version to replicate the old behavior.

@64J0 64J0 changed the title Use Giraffe's main branch and update to .NET 8 Update to .NET 8 Jul 15, 2024
@64J0 64J0 force-pushed the use-main-branch branch from 0136c97 to 277a119 Compare July 15, 2024 22:50
@64J0
Copy link
Member Author

64J0 commented Jul 19, 2024

After looking at the logs from the previous version, I noticed that it's already waiting some requests using the localhost:5000 somehow. The logs with .NET 5 base image are:

2024-07-19 10:52:17.565 [Notice] 

..:: Environment Summary ::..

                    APP :
-------------------------
                    App : Giraffe
                Version : 0.0.1

            DIRECTORIES :
-------------------------
                    App : /app
          Public Assets : /app/Assets/Public

                LOGGING :
-------------------------
            Environment : Unknown
              Log Level : info
             Sentry DSN : 

            REDIRECTION :
-------------------------
            Force HTTPS : False

                   URLS :
-------------------------
                 Domain : giraffe.wiki
               Base URL : http://localhost:5000

                PROXIES :
-------------------------
            Proxy count : 0
          Known proxies : 
   Known proxy networks : 

              DEBUGGING :
-------------------------
Request logging enabled : False
 Error endpoint enabled : False

2024-07-19 10:52:17.760 [Info] Now listening on: http://[::]:80
2024-07-19 10:52:17.760 [Info] Application started. Press Ctrl+C to shut down.
2024-07-19 10:52:17.760 [Info] Hosting environment: Production
2024-07-19 10:52:17.760 [Info] Content root path: /app

But it works fine if I use this port binding:

docker container run -d -p 5000:80 giraffefsharp/giraffe-website:0.0.1

And the new version with .NET 8:

2024-07-19 10:59:37.175 [Notice] 

..:: Environment Summary ::..

                    APP :
-------------------------
                    App : Giraffe
                Version : 0.0.1

            DIRECTORIES :
-------------------------
                    App : /app
          Public Assets : /app/Assets/Public

                LOGGING :
-------------------------
            Environment : Unknown
              Log Level : info
             Sentry DSN : 

            REDIRECTION :
-------------------------
            Force HTTPS : False

                   URLS :
-------------------------
                 Domain : giraffe.wiki
               Base URL : http://localhost:5000

                PROXIES :
-------------------------
            Proxy count : 0
          Known proxies : 
   Known proxy networks : 

              DEBUGGING :
-------------------------
Request logging enabled : False
 Error endpoint enabled : False

2024-07-19 10:59:37.314 [Info] Now listening on: http://[::]:5000
2024-07-19 10:59:37.315 [Info] Application started. Press Ctrl+C to shut down.
2024-07-19 10:59:37.315 [Info] Hosting environment: Production
2024-07-19 10:59:37.315 [Info] Content root path: /app

@64J0 64J0 marked this pull request as ready for review July 19, 2024 23:01
@64J0 64J0 merged commit e61f849 into master Jul 19, 2024
2 checks passed
@64J0 64J0 deleted the use-main-branch branch July 19, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants