By Ilja
Hello,
I’m using DigitalOceans One click MEAN install image and was wondering if I could set up my droplet in a way where I can deploy commits from my development branch to a staging folder/area on a server that is hooked up to staging.domain.com and at the same time have public/root area hooked up to domain.com that I deploy my master branch to. Is this achievable via one droplet?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
I’m afraid I don’t fully understand the methods you use but I believe I understand the end goal; 2 setups on one droplet.
This should be doable, and this is how I would do it.
I would have the git repo cloned in 2 locations, my production path and dev path. Each would have their own branch, production branch and dev branch respectively. You can do it however you want.
Since I’m not quite sure how you are routing the traffic from your URL to the MEAN application, I’m making a bit of assumption going forward that you are using nginx to proxy it. You will also have to configure your dev and production sites to run on different ports. So we will assume the following:
proxy_pass directive to pass nginx requests to your MEAN applications.127.0.0.1:8000 and your dev is running on 127.0.0.1:8001If that’s the case, then it’s as simple as configuring your server blocks within nginx so that staging.domain.com points to 127.0.0.1:8000
This would not be a complete Server block, but has the parts you will likely be changing.
For the Dev Setup
server {
...
server_name staging.domain.com
proxy_pass http://127.0.0.1:8001
...
}
For the Production Setup
server {
...
server_name domain.com
proxy_pass http://127.0.0.1:8000
...
}
So long as your MEAN apps are running on the respective ports, this will proxy all information to the associated application. Then, when you make changes you can just pull the changes with git for the respective branch and it should update.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.