Score:-2

General infrastructure artchitecture/best practice: Developing locally against and azure hosted postgres

ch flag

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:

  1. public virtual network (vn)
  2. 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
  3. 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..

  1. 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?
  2. 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?
  3. 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...

HBruijn avatar
in flag
Generally a suitable approach is to set up a VPN that will include your laptop / development system into the private network containing your remote datacenter resources. - but of course you shouldn’t be developing against your live production database server. You should want your unit tests to get predictable results and don’t want unpredictable live users throw a spanner into those test results. Also a bug in your draft code should not impact your production environment and real users
mike01010 avatar
ch flag
yeah there are dev/qa/prod databases. im not finding a good way to allow a vpn into an azure managed postgres. these alot are saying that is the solution, but when you actually try, seems not possible
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.