v1 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v2

I’ve checked the previous related issues and nothing seems to work. Thanks to another related issue I have discovered that the connection to port 8080 in the vm is being refused and with the related issues the cause was a typo but in my case there is no typo as I did not write the fly.tomi contents manually

This was the output of the command vm status

Instance
  ID            = 4e32638c
  Process       =
  Version       = 4
  Region        = hkg
  Desired       = stop
  Status        = complete
  Health Checks = 1 total, 1 critical
  Restarts      = 0
  Created       = 8m37s ago

Recent Events
TIMESTAMP            TYPE            MESSAGE
2022-03-24T10:10:10Z Received        Task received by client
2022-03-24T10:10:10Z Task Setup      Building Task Directory
2022-03-24T10:10:28Z Started         Task started by client
2022-03-24T10:15:10Z Alloc Unhealthy Task not running for min_healthy_time of 10s by deadline
2022-03-24T10:15:11Z Killing         Sent interrupt. Waiting 5s before force killing
2022-03-24T10:15:30Z Terminated      Exit Code: 130
2022-03-24T10:15:30Z Killed          Task successfully killed
2022-03-24T10:15:30Z Killing         Sent interrupt. Waiting 5s before force killing

Checks
ID                               SERVICE  STATE    OUTPUT
3df2415693844068640885b45074b954 tcp-8080 critical dial tcp 172.19.4.74:8080: connect: connection refused

This below is my Dockerfile

As you can see below I tried exposing the port 8080 but didn’t seem to work.

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 8080

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Du Sud Cannabis Website/Du Sud Cannabis Website.csproj", "Du Sud Cannabis Website/"]
RUN dotnet restore "Du Sud Cannabis Website/Du Sud Cannabis Website.csproj"
COPY . .
WORKDIR "/src/Du Sud Cannabis Website"
RUN dotnet build "Du Sud Cannabis Website.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Du Sud Cannabis Website.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Du_Sud_Cannabis_Website.dll"]

How do I solve the connection refused issue???

Do you know which port your service is listening on? Once you find that out, you can change the port in fly.toml to match it.

Can please tell me how to find out which port is being used or listening to?
This is my first time deploying using Fly.io

This is a dot net thing. It probably has a default port it listens on. Do you see any messages in logs when it boots that say "listening on localhost:5000" or similar?

When I run the application inside the docker the port used is localhost:49153

Recent Logs
2022-03-24T10:10:27.000 [info] Configuring firecracker
2022-03-24T10:10:27.000 [info] Starting virtual machine
2022-03-24T10:10:28.000 [info] Starting init (commit: 6f9865f)...
2022-03-24T10:10:28.000 [info] Preparing to run: `dotnet Du_Sud_Cannabis_Website.dll` as root
2022-03-24T10:10:28.000 [info] 2022/03/24 10:10:28 listening on [fdaa:0:55c2:a7b:acc:4e32:638c:2]:22 (DNS: [fdaa::3]:53)
2022-03-24T10:10:28.000 [info] warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
2022-03-24T10:10:28.000 [info]       Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
2022-03-24T10:10:29.000 [info] warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
2022-03-24T10:10:29.000 [info]       No XML encryptor configured. Key {18de6547-8de8-48e6-a985-dc962c9dee47} may be persisted to storage in unencrypted form.
2022-03-24T10:10:29.000 [info] info: Microsoft.Hosting.Lifetime[0]
2022-03-24T10:10:29.000 [info]       Now listening on: http://[::]:80
2022-03-24T10:10:29.000 [info] info: Microsoft.Hosting.Lifetime[0]
2022-03-24T10:10:29.000 [info]       Application started. Press Ctrl+C to shut down.
2022-03-24T10:10:29.000 [info] info: Microsoft.Hosting.Lifetime[0]
2022-03-24T10:10:29.000 [info]       Hosting environment: Production
2022-03-24T10:10:29.000 [info] info: Microsoft.Hosting.Lifetime[0]
2022-03-24T10:10:29.000 [info]       Content root path: /app
***v4 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v5

Could this be the port the thing is waiting for or one open for us to use instead of the 8080 set inside the fly.toml Under:
[[services]]

Thank you very much Kurt.

I’ve been reading that same thing for 2 days now and for some weird reason I’ve been overlooking it. My eyes only paid attention to the long gibrish V6 address and its port and ignored that one.
I switched the port under [[services]] inside the fly.toml from 8080 to 80 which the dot net thing is listening on and it deployed successfully now.

It’s great to discuss problems with other people. Being a loner sometimes is not fresh :joy::rofl:. Yeah… now I’m going sleep good 2night​:joy::rofl::joy::rofl::joy::rofl::joy::rofl::joy::rofl:

2 Likes

Oh yes! the [::]:80 makes that really non obvious. I’m glad you figured it out!

Do you know why that [::] is there or would it help if we explained it?

The fix for me was to add a PORT as environment variable in Fly.

In the terminal that was:

flyctl secrets set PORT=8080 --app insert-your-app-name-here