0

I am trying to connect the postgres database hosted in azure storage account from within the flyway, flyway is running as docker image in docker container

docker run --rm flyway/flyway -url=jdbc:postgresql://postgres-azure-db:5432/postgres -user=user -password=password info but I am getting the error ERROR: Unable to obtain connection from database

Any idea/doc-link would be helpful

4
  • If that the entirety of the error message? Commented Mar 14, 2022 at 15:49
  • This is stacktrace Caused by: org.postgresql.util.PSQLException: The connection attempt failed. Caused by: java.net.SocketTimeoutException: connect timed out Commented Mar 14, 2022 at 18:35
  • I am able to connect to postgress installed on my localhost from within docker, but if I am tryin to connect to posgres hosted on Azure that time unable to connect Commented Mar 14, 2022 at 18:37
  • Sounds like a firewall. They block you not by actively rejecting the connection, but just by ghosting you, leading to timeouts. Commented Mar 14, 2022 at 18:38

2 Answers 2

1
+50

You have a similar error (different context, same general solution) in this flyway issue

my missing piece for reaching private Cloud SQL instances from private worker pools in Cloud Build was a missing network route.
The fix is ensuring the Service Networking VPC peer has the "Export custom routes" setting enabled, and that the Cloud Router advertises the route.

In your context (Azure), see "Quickstart: Use Azure Data Studio to connect and query PostgreSQL"

You can also try with a local Postgres instance first, and Azure Data Studio, for testing.

Sign up to request clarification or add additional context in comments.

Comments

0

After exploring few option, I implemented the flyway using the Azure container instance. Create an ACI to store the flyway docker image and to execute the commands inside ACI, Also created a file share to keep the config file and sql scripts.

All these resource (Storage, ACI, file share) I created via the terraform scripts which is being triggered from Jenkins.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.