# fly.toml file generated for
app = "<db-app-name>"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[[services]]
internal_port = 5432 # Postgres instance
protocol = "tcp"
# Example of opening port 12500 for insecure connections.
[[services.ports]]
handlers = []
port = 12500
[env]
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
This is the fly.db.toml file and i added the following in it
[[services]]
internal_port = 5432 # Postgres instance
protocol = "tcp"
# Example of opening port 12500 for insecure connections.
[[services.ports]]
handlers = []
port = 12500
shaun
November 19, 2022, 10:01pm
8
@amirhussain can you update to the latest version of flyctl and send us the output of ‘flyctl info’?
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.
shaun
November 21, 2022, 1:31pm
10
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 .
shaun
November 21, 2022, 6:04pm
12
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:
There’s a new handler available for exposing your PostgreSQL instance over the proxy in a secure manner: pg_tls.
How to use?
First, get your current config if you don’t already have it
fly config save -a <your-pg-fly-app-name>
Then, modify your fly.toml, adding this service:
[[services]]
internal_port = 5432
protocol = "tcp"
[[services.ports]]
handlers = ["pg_tls"]
port = 5432
Figure out which image and tag (postgres version) you’re on:
$ fly image show -a <your-pg-fly-app-name>
Image De…
by running fly image show
under version is N/A. What should i do ? Should i deploy it with 14.4?
shaun
November 21, 2022, 6:34pm
14
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?
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
[[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?
shaun
November 21, 2022, 6:52pm
20
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?
shaun
November 21, 2022, 6:56pm
23
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?
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.