Error: Network is unreachable with postgres-flex

Hi, I have a asp.net EF core app that I’m trying to deploy to fly, but due to my setup with npgsql I need to set up a database first and use the connection string before deploying my app.

I followed the External Connections doc, but upon executing psql "sslmode=require host=houzi-db.fly.dev user=postgres" I get these error:

psql: error: connection to server at "houzi-db.fly.dev" (2a09:8280:1::69:7f2f), port 5432 failed: Network is unreachable
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "houzi-db.fly.dev" (2a09:8280:1::37:8117), port 5432 failed: Network is unreachable
        Is the server running on that host and accepting TCP/IP connections?

I think my fly.toml is set up as instructed so not sure what is the problem…

#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "houzi-db"
primary_region = "arn"

[env]
  FLY_SCALE_TO_ZERO = "1h"
  PRIMARY_REGION = "arn"

[[mounts]]
  source = "pg_data"
  destination = "/data"

[[services]]
  protocol = "tcp"
  internal_port = 5432
  auto_start_machines = true

  [[services.ports]]
    port = 5432
    handlers = ["pg_tls"]
  [services.concurrency]
    type = "connections"
    hard_limit = 1000
    soft_limit = 1000

[[services]]
  protocol = "tcp"
  internal_port = 5433
  auto_start_machines = true

  [[services.ports]]
    port = 5433
    handlers = ["pg_tls"]
  [services.concurrency]
    type = "connections"
    hard_limit = 1000
    soft_limit = 1000

[checks]
  [checks.pg]
    port = 5500
    type = "http"
    interval = "15s"
    timeout = "10s"
    path = "/flycheck/pg"
  [checks.role]
    port = 5500
    type = "http"
    interval = "15s"
    timeout = "10s"
    path = "/flycheck/role"
  [checks.vm]
    port = 5500
    type = "http"
    interval = "15s"
    timeout = "10s"
    path = "/flycheck/vm"

[[metrics]]
  port = 9187
  path = "/metrics"

Thanks in advance.

Edited to add that I might as well mention this here, but when fly launch-ing my Web Api, I somehow get the error Skipping project "/WebApiController/WebApiController.csproj" because it was not found. when it works fine locally & in Azure, and also the path is wrong because it’s actually in another project and the correct path is ../WebApiController/WebApiController.csproj. I don’t know why it omitted the .. :frowning:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.