General infrastructure artchitecture/best practice: Developing locally against and azure hosted postgres
I've created an infrastructure on azure using terraform that is the following:
- public virtual network (vn)
- two subnets associated with the vn, one for my Postgres flexible server, and for a vm/app server that will host a web-based data service to r/w from the database
- the Postgres server is setup using azurerm_private_dns_zone
While i can ssh into the vm to do my work, its purpose is really as a 'prod/uat' environment to deploy code to.
Instead, i would like to be able to continue developing on my local system and connect to that azure Postgres. The problem is its private.
From what i read if you make the Postgres server public, you have to enable access by ip (which is great), but it is put on a separate virtual network. So, my questions are..
- is there any way to have the public Postgres server on the same virtual network as my app server to reduce latency? or is my concern about latency not warranted?
- is there an option here to keep it private, but be able to connect from my local dev workstation without having to remote into saw the app server to get to it?
- the third question is somewhat different - my local setup current is i run everything in docker containers locally, including Postgres. im wondering if i should not simply do the same for the integrated environment - running everything in two containers on the same App server? What is the general best practice around this kind of setup and how are most folks doing this today? managed db or containers all the way?
Any thoughts on this appreciated...