How to setup development, test and production endpoints

794 views Asked by At

I'm pretty new on Backend development, I've worked many years as mobile dev and now I want to switch to the other side :)

I've been doing some tutorials about how to work with nodejs + express and all of them usually just teach you how to deploy your code to production once you're happy with it ... but that´s it, you work locally, you test locally, and just deploy your master to some cloud service platform.

But in the companies where I worked, they always had different environments available for us (mobile devs) to work with the server, usually dev, qa, and production envs. So it means that they had at least 3 versions of their code deployed on the server, and we were able to access it just modifing the endpoints.

This is a really common practice, but I can't figure where to start looking at to see how this architecture can be done. Again, I'm pretty new on this subject, so maybe I just lack of the terminology to find the info, but I spent a day yesterday trying to figure out his and I cant find anything.

To make it a little more complicated, I will start working with a friend on an app that can be customized, so different clients will have different versions of the app, and they will need to access to the server using some kind of identifier in the endpoint path like

/mycompany/clientAname/dev/... 
/mycompany/clientAname/qa/... 
/mycompany/clientAname/prod/...   << do you even use prod there?
/mycompany/clientBname/dev/...
/mycompany/clientBname/qa/...
/mycompany/clientAname/prod/...

and that means, different code versions for each env & client

Any clue on were to start looking will be really appreciated :)

cheers!

1

There are 1 answers

0
Yotes On BEST ANSWER

Ok, after a lot of learning, I finally was able to set up a server with multiple enviroments to deploy what I want when I want.

What I did was, using docker containers, I added a reverse proxy in my server (hired a linode server) using nginx and added the virtual hosts for each of the apps running different enviroments on different ports (internal ports since is a docker network).

So now I have:

qa.myweb.com
dev.myweb.com
stage.myweb.com
myweb.com` (production)

I took a lot of ideas from this post: multiple enviroments with docker

I still have a lot of work to do, but the main idea of what I wanted is described over there.. I hope it can help somebody else later