Unable to connect to MongoDB instance

I have a Fly app that runs MongoDB from mongo image attached with volume, it is running smoothly, and I can log in and create a database using fly ssh console.

But I cannot connect it from my other Fly app (let’s call it HelloApp),

  • from HelloApp, I can ping mongo app using .internal domain
  • my DATABASE_URL=mongodb://user:pass@mongo-production.internal:27017/db-production
  • I can’t connect using nc -vz mongo-production.internal 27017
  • I can’t connect using mongoshell as well
  • from Mongo app, tcp 27017 is open
    CleanShot 2022-04-22 at 21.48.06

here’s my mongo fly.toml config

app = "mongo-production"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
  image = "mongo:latest"

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 27017
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

  [[mounts]]
    destination = "/data/db"
    source = "mongo_production"

not sure what step I missed

anything I could check and do?
Thank you

I’ve never used MongoDB but since nobody else has replied here, I’ll give it a go :slight_smile:

Is it listening on IPv6? Fly’s internal network uses IPv6 and so if not, that would explain why another app can’t connect. The reason I wonder is mongod appears to be listening on 0.0.0.0 and not an IPv6-style address. Like how hallpass has in that screenshot.

This may be of help … no idea though:

Perhaps you’ve since fixed this.