How to share one domain between multiple servers

39 Views Asked by At

I'm trying to set up the infrastructure that I would need in order to deploy my app live.

The app is written with a React-Native frontend, Nodejs backend and Postgres as the database.

I know I'll need a separate server for Postgres and a separate server to act as a STUN/TURN server for WebRTC (in-app video and audio calls). Obviously, I'd also need a separate server for my backend.

So this means that I'll have something like the following:

img1

Initially I was thinking of using one server for the MVP, which would handle all the backend logic and database queries, hosting of the data of that database AND also act as a STUN/TURN server. As can be seen by the diagram, I've averted away from that thinking, however even now, I'm not 100% sure that this structure is the way I should be going.

However, I digress, my question is that I have one domain which I've already registered. If Postgres lives on some isolated server that I know the IP address of, that's fine for me, because that IP address is all I'll need in order to connect my Nodejs server to my Postgres server.

The question arises with the STUN/TURN server. Most of the tutorials for Ubuntu and Coturn say that I should have a registered domain in my name, because that's what I'll be providing as the value for the coturn config. Many tutorials also show the process of setting up coturn at a subdomain location.

Would this be possible if I want to also host my Nodejs server at the same domain as my TURN server? Or no two servers can share one domain?

0

There are 0 best solutions below