As I am very new to DevOps topcis and it seems like there are a lot of options, I am curious about whats the best way to deploy the different branches (master and dev) of my nextjs app.
When I push new code to the master branch, the most recent state of the app should be accessible via my domain prod.mydomain.com immediately. Same goes for the dev branch (in this case dev.mydomain.com).
- I have an ubuntu server hosted on digitalocean to fulfill my requirements
- In the future, multiple users should use the app
- In the future, a database (mongodb will be needed)
My questions:
To instantly rebuild my application when I commit and push new code to a specific branch, I need Jenkins, right? (with GitHub webhook?)
Do I need docker containers or can I simply run a jenkins-server on my ubuntu server and start two nodejs servers (one for each branch) from this jenkins-instance?
If I need docker containers, how should the different services should be containerized? One contaier for jenkins, one for each branch and put them into the same network?
How can I map the dev variant of my nextJS app to dev.mydomain.com (some goes for the prod variant)
Do I need nginx?
Thank you very much for your help!
I was watching various YouTube tutorials about deployment / CI/CD / Jenkins and Docker. I also googled for hours. But for now I am more confused than ever.