Development Server Implementation

January 8, 2013 8k views
Hello everyone! I'm working on a side project with a friend. We currently develop code on a domain/server package purchased on hostmonster. During development I stumbled upon Digital Ocean and decided to give it a try. I created an Ubuntu Server droplet, pulled down a build from git, and the rest was history. I had the test site up and running in minutes! I was sold from that point on -- I want to use Digital Ocean for all my web hosting needs. Creating a test site for our project was easy. I'm not really sure, however, what the best approach would be to creating a droplet to serve as a development server. What is the best way to use a droplet as a development server? Should we develop code on our local machines, push the code to git, and then pull the development code down from git onto the development droplet?
8 Answers
There's no particular right or wrong way to do it, it all comes down to what's comfortable.

One way that you can develop quickly and test without having to constantly deploy to the development server is to grant access to your DB from your local laptops/PCs and develop and test the code initially straight from your laptop, assuming it has the ability to run the stack you are developing in.

Then after you've done a days worth of work or a week you can deploy to the dev server and test from the web to ensure that everything works as expected from a proper linux server environment.

Using this method your development DB always stays in sync because even if you develop locally on your machine you are still connecting to the DB that is maintained on your development server. It also allows your friend to see the same DB state as you do when you guys are working.
I'd definitely agree with Moisey on this one. Develop on your local environment then use the development server or 'staging' server to test to see how the code will run in a 'production' setting.... compile assets, deploy from git and see how everything runs. If you need any more help, just drop me a line!
Thank you very much for the quick replies! Your help is greatly appreciated. We're going to develop locally and then test on a development server. This sounds like the best way to go.
Quick follow up question. How should I configure the iptables on the development server? I don't want the public to be able to access the development server from the Internet. I currently created the following iptables firewall rules:

# iptables -A INPUT -i lo -j ACCEPT
# iptables -A INPUT -p tcp --dport ssh -j ACCEPT
# iptables -A INPUT -j REJECT

Should this suffice for our server? I'm new to iptables so I want to ensure that our server will be hidden from the Internet.
I'm assuming you are running a web application so you'll also want to restrict access to HTTP.

That's easier done via whatever web server you are running like Nginx or Apache than to mess around with iptables, but you'll also need a whitelist of your IPs, your local PCs/laptops that you will want to connect with.

What application stack are you running and which webserver?

Also you don't want to run those iptables rules without adding a whitelist set of IPs and also its a good idea to take a snapshot of your server before doing any config changes that may lock you out, otherwise you will be fixing them via console, or you could just revert to the snapshot prior to the change.
We're running a LAMP stack on Ubuntu Server 64x 12.10 . Do you recommend not editing the iptables but instead editing the Apache config?
Yes, it's much easier and will accomplish the same thing, you can either setup an .htpasswd file and use .htaccess to restrict it on a username/password basis or you can restrict it via an access list mod_auth which is precompiled as one of the base modules:

Order deny,allow
Deny from all
Allow from your.whitelisted.ip
Allow from your.whitelisted.ip2

thank you for your comment on wordpress installation on localhost.

Have another answer? Share your knowledge.