Using 2 droplets for dev/staging and for production.

May 18, 2013 8.6k views
I'm about to get my first Digital Ocean droplet, but I have a few questions. Thanks in advance for your answers, this forums seems really great. I'd like to have one droplet that will have a git server, MySQL database, and possibly staging environment. Later when I'm ready to deploy my Rails app I'll get another droplet just for Rails/NGINX/Passenger, etc. which will be the production environment. Specific questions: 1) I have only one domain name, which will be for the production droplet, so how do I communicate with the dev/staging droplet? Does Digital Ocean give me a unique IP for the dev/staging droplet? 2) If DO does give me a static IP for my dev/staging droplet, how do I get my Rails app (on production droplet) to use the MySql database that is on the dev/staging droplet? 3) Can I use Phusion Passenger to deploy to both the dev/staging droplet and to the production droplet? 4) If I only have one domain name (for the production droplet), how will I access my Rails app deployed on the dev/staging server? Do I use some path that includes the DO provided static IP? Sorry if this is a bit of a NOOB question, but I'm excited to have found Digital Ocean, and want to see if I can do what I'm hoping for. Thanks!
2 Answers
to answer the first question, each droplet has a unique ip adress. and if u want you can have a subdomain go to one droplet and then the www and the no sub domain go to another i believe
1) Each droplet comes with a static dedicated IP address.
2) You can configure your app to connect to mysql on a specific IP (which would be the mysql droplet's IP in your case) instead of localhost
3) Yes, you should be able to use Phusion Passenger without any problems.
4) You can access it directly by its IP. You can also create a dns record for dev.yourdomain.com to point to your dev box.
  • Is there a distinct advantage to this? I need to set up the same thing and was planning to set up dev.mydomain.com on my production box...but with development branch code deployed there and master branch code deployed to production server. That approach seems like it will work for me...but on seeing that people use separate droplets I'm curious whether I need to take that approach too. Input?
  • The main advantage is planning for scale. If you host your database on a separate server it allows you to do things like run two instances of your app server with a load balancer between them. Check out: https://www.digitalocean.com/community/tutorials/5-common-server-setups-for-your-web-application
    by Mitchell Anicas
    When deciding which server architecture to use for your environment, there are many factors to consider, such as performance, scalability, availability, reliability, cost, and ease of management. Here is a list of commonly used server setups, with a short description of each, including pros and cons. Keep in mind that all of the concepts covered here can be used in various combinations with one another, and there is no single, correct configuration.
Have another answer? Share your knowledge.