Hi, I have a site which grabs data from the Directus CMS, which would be spun up in a Docker instance.
My main site would be of the form www.example.com and the CMS could reside at cms.example.com for example. Locally, I have these running on different ports.
Is there an equivalent notion here for Render? Or is the best option to spin up the Docker instance in a Web Service, and have cms.example.com be associated with that and the main website be a static site associated with www.example.com?
The reason I ask is because for any queries made on the site’s server, if running on the same machine, this avoids having to query an external source over the network, which would be slower. (Of course, how “slow” slow really is would depend on tests)
With Docker you’re in control of the environment, so you could set it up however like you. The consideration being that Render Web Services can only expose one port to the public internet. Covered here: https://docs.render.com/web-services#host-and-port-configuration.
Maybe some sort of single Docker setup with Nginx reversing proxying to both the CMS and frontend could achieve this, but it feels like it adds complication and would probably increase resource requirements for that service.
If your frontend is truly static, e.g. a React App, that hydrates with data from calls made to the CMS API - then having them on the on the same server would have no real speed advantage. For example, the client/browser would request the static page, once loaded, that static page would then make another request to the server to get data to hydrate the page. That request to the backend would be the same whether the frontend comes from the same server or a separate Static Site service.
Combining frontend & backend would likely only provide benefits if you’re doing server-side rendering of the response in one request.
However, you’ll know you project best, and Render is pretty flexible to allow you to architect your project as you want.
Thanks for that link. Actually something else stood out to me:
All your services can communicate internally on the same private network, and Render provides an internal hostname (for example, myservice ) for each service in addition to the public DNS name.
Wouldn’t this actually be optimal here?
The Docker nginx reverse proxy sounds like a good idea but like you said, has added complexity and would run on a single Web Service instance. Currently my site would be static, so I take it that running a Static Site and having the Directus Docker instance running on a paid Web Service would allow for communication over the private network. And for my projects that aren’t static, having them in another Web Service instance would allow for the same low latency communication.
EDIT: Actually, re-reading this:
Static sites and Free web services are not on a private network.
Leads me to believe that static sites would not benefit from this.