Simplifying Multi-environment Local Webapp Development

I find myself developing under multiple frameworks and in multiple languages quite often, but one thing stays the same- I can’t be bogged down by getting things to jive on my local machine. Most of my webapp development comes down to PHP and Rails, so I need a fluid solution for both of those. Here are a couple ways I have made life easier.

Git + Github It has become industry standard to use Git as a version control and backup method. Super-big and agile web companies like Facebook and 37 Signals are making a point to use Git, if that is any indication of what is leading the pack. Git itself is open source and Scott Chacon has made his popular book, “Pro Git”, available for free so you can get started right away. Tip: Learn and use the command line for Git, fancy interfaces will not make life easier!

Pro Git

I add Github in here because it is the best place to upload, share, and collaborate with others on all your work (controlled with git!). The Git project itself is hosted on Github, which again, is a good indication of a winning service. Of course you can get started with them for free, and pay for a pro plan if you want to privatize some of your work.

MAMP (basic) If you develop on some sort of LAMP stack (Linux + Apache + MySQL + PHP) you will need something to handle this locally. MAMP basically takes care of all this for you. Download the free version and use the “custom installation” option and uncheck installing their pro version (unless you know you need it and want to pay). Setup is easy, I use the MAMP ports, and have the Apache Document Root set to my “Sites” folder, so when you have MAMP servers running, all of those sites are essentially running on a LAMP environment.

Virtual Host X For a lot of sites you will want a clean development URL (no folders, no port numbers). This makes it easier to find your work, and ensures that if you have custom routing or subdomains, you are not working around folder structures. Virtual Host X takes the pain out of editing and managing a “vhosts” file, and works with MAMP (set this in the preferences). Try it out for free and decide if it is worth $39 for yourself.

Virtual Host X

For Rails people, you will want to add a couple custom directives if you are using a standard local webserver (like WEBrick, or Thin) so you can work with through port number. I have created a “rails.dev” virtual host, so whenever I start up a rails project, I can access it in my browser at “rails.dev” (note: your port number may be 3000, and Local Path is not relevant).

Rails and Virtual Host X

Heroku (Rails) Heroku has made life so easy, and they integrate right with your Git workflow. Check out their Getting Start with Rails 3 page to get  an idea of what it will be like to never mess with a server again. You can deploy multiple projects for free, and only pay when your ready to scale up. If you are like me, you know that servers and deployment is only one part of a product lifecycle, and only one of your responsibilities as a webapp developer, so it should not be a headache.

Beanstalk (FTP) If you are working with other peoples websites, you might not have the luxury of a full Git workflow, with the only option being some type of FTP (or SSH). This is where Beanstalk kills it- you setup a repository with them for your project, then when you push your code to it, they transfer the files via FTP. This means you still collaborate on a project with Git (like you should be), and have access to versioning, but you have the benefit of deploying (and reverting) with FTP. Like everything else, you can try the whole product out for free, and decide if this is curing a headache you have.

Beanstalk Admin

Hit me up on Twitter if you ever need help.