Connecting V2 apps outside Fly

This is the result of the flyctl info -a <db-app-name>:

App
  Name     = <db-app-name>
  Owner    = <owner>
  Platform = machines
  Hostname = <db-app-name>.fly.dev

Services
PROTOCOL	PORTS	FORCE HTTPS

IP Addresses
TYPE	ADDRESS            	REGION	CREATED AT
v4  	<Ip-v4>       	    global	33s ago
v6  	<Ip-v6>	            global	1m18s ago

P.s. This is new DB created. If i will use the above config to deploy it again. It will crash.

I noticed you have two different services section within your fly.toml? Is that on purpose?

but in the fly dashboard it still shows: v0

Machine does not have the same versioning scheme as Nomad. So you should be able to ignore this.

It will crash.

Is there a specific error message you’re seeing?

I added this one to get the 12500 port for the postgres instance so i can connect it to Preset.io. Rest of the toml file was generated by this command:

fly config save --app <db-app-name>

All i want is to connect this V2 app to the preset.io.

Right, so for now, delete all other services you have defined within your fly.toml.

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

  [[services.ports]]
    handlers = []
    port = 12500

Then do the following:

# Run this to see what version of PG you're running.
fly image show
# Issue a new deploy
fly deploy .   --image flyio/postgres:<major-pg-version>

If this doesn’t work, please let me know you see on your end.

Once you get this working, i’d also look into this:

by running fly image show under version is N/A. What should i do ? Should i deploy it with 14.4?

If this is a new provision, using --image flyio/postgres:14.4 should be fine.

Okay the DB got deployed and it is is deployed stage for now. How should i connect it outside Fly?

What does fly info say?

App
  Name     = <db-app-name>
  Owner    = <owner>
  Platform = machines
  Hostname = <db-app-name>.fly.dev

Services
PROTOCOL	PORTS                 	FORCE HTTPS
TCP     	12500 => 5432 []      	False
TCP     	80 => 8080 [HTTP]     	True
        	443 => 8080 [TLS,HTTP]	False

IP Addresses
TYPE	ADDRESS            	REGION	CREATED AT
v4  	<IPv4>    	        global	11h38m ago
v6  	<IPv6>           	global	11h39m ago

@shaun it feels like adding this worked somehow :sweat_smile:

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

  [[services.ports]]
    handlers = []
    port = 12500

@shaun, I have implemented Multi region and i want to verify either it got implemented properly or is there an issue. How can i do that?

Looks like you never deleted the other services in that file, but happy the deploy worked.

You can find additional information on this process here:

You can test it by running:

psql postgres://<user>:<password>@<db-app-name>.fly.dev:12500

i deleted it from the toml file and deployed again and then deployed by the command you sent me and after that i ran fly info and it showed me that

How can i test my Multi Region implementation?

How can i test my Multi Region implementation?

This is pretty vague. What specifically are you trying to test?

like it is working like it is supposed to? :sweat_smile:
like the both clusters are working like they are meant to

@shaun i tried deploying again and using the pg_tls one you gave me above but it didn’t connect with the preset.io

@shaun connecting to apps link is not opening.

Hi @amirhussain, we’ve been working on our docs and that link has become a page of its own: External Connections · Fly Docs

Feel free to have a browse through all of our Postgres docs, though. It’s not too clear how much basic troubleshooting you’ve done, or if you’re still stuck, but the “Monitoring” and “Connect with flyctl” pages in particular can help you see if your database cluster is healthy and you can connect in the usual ways before adding the external connection bits.

2 Likes

yeah i found it. Thank you for sharing. i am trying to follow this one:

but it is not working for me

1 Like