Categories
Programming

Dev to Staging to Production

How do you keep your development work from interfering with testing new features and providing a stable application to your users? Create a dev to staging to production chain.

You’ve worked for months on a Web application, you launch and all is fine. Now you need to add a new feature that will take you at least a few hours to get right. Do you subject your users to the errors that will intermittently appear if you code directly on the site? No, of course not. You make a completely separate installation that only you’re looking at. When the feature seems solid, push the changes to the production version. You are using a source code repository, aren’t you? So, just perform a svn update on the live site and you’re all good.

Diagram showing flow of code changes from dev to staging to production
This diagram shows the relationship between development, staging and production servers.

Following is the method I’ve found works best for smallish teams working on LAMP Web apps where you can’t afford to introduce bugs to the production version. This method has worked for me on teams of 5-10 coders, each working on different features at once. There’s a balance to be struck between not getting in the way of development work and getting updates out promptly. It’s a drag when you can’t release one feature because its code is all mixed in with another, half-finished feature.

The main idea to have one checkout for your production version, one for a staging and testing version, and multiple servers for various developers and/or projects. Changes that are ready to be tested are checked into the repository. When you want to release, you freeze checkins and test the staging server. When you’re convinced it’s all good, you run an update on the live server and allow checkins again. You’ll want at least three different databases, one each for live, staging and development.

For relatively short-term work, developers should usually check in frequently. For long-term projects, checkins should be held back. Yes, this is what branches are for, and that’s the right choice for more senior coders. In practice, branches don’t seem to be something that the junior members can grok. I might have junior developers working on big changes to copy over many weeks. I simply rely on backups to make sure they don’t lose work in case of disaster.

Here’s a set of steps I might take to set up a new development system.

  1. Create a subversion repository.
  2. Create three virtual hosts: www, stage, and dev.
  3. Create three databases.
  4. Checkout the app once each for www and stage. You’d view these sites as www.example.com and stage.example.com.
  5. Make an open directory for the dev subdomain and make a checkout for each developer. You’d view these sites as dev.example.com/coder1/htdocs. Allow all the dev versions to share a database.
  6. Protect the dev server from the public with basic authentication. You don’t want Web robots indexing everything, and you don’t want to expose scripts that would be outside of the apache webroot in production.

This system will allow you to quickly make a new checkout without hassling with making new subdomains and tweaking the apache config.

Categories
Programming

FreeTime 3

Thanks to the extra time provided by the holiday, I’ve finally put together a release of FreeTime 3, a pet project of mine for more than 10 years. This newest release is based on work I did on the software at Clear Ink from 2006 through 2009. Thanks to David Burk and Steven Nelson for sponsoring writing the code in the first place as their employee and more recently agreeing to donate the code back to the open source project. Their support is most generous!

FreeTime is a Web application written in PHP for MySQL that allows you to keep track of projects. It tracks comments, files and timesheet entries for projects divided up by clients and their divisions. Recently added features, not appearing in previous versions, include tasks, estimates and more reports. There’s also code that allows clients to log in to review work as if it’s a mini-site, but it hasn’t been tested in production. The most well-developed aspects of the application are related to timesheets, both gathering them from staff and then reporting on them.

I’m curious whether anyone will find the code useful, whether for educational or practical purposes. Its purpose was as a highly customized solution for Clear Ink, and it may have no utility outside the same type of consultancy. On the other hand, it could prove useful after some hacking. I would use it for myself if I do more consulting again.

You can download the source code from the FreeTime project page on SourceForge.

Categories
Marketing Programming

Annoying Anti-Piracy for Book from Manning

I bought Zend Framework in Action yesterday because the short tutorial isn’t quite enough to know how to architect an big application. I’m building an enterprise app at work for a client and picked ZF and YUI as core platforms. I’m pleased with the content of the book. Rob Allen is a fine writer and the organization of the text is logical.

Now that I’m about 80 pages into the book, I thought I’d grab a copy of the PDF version for easy reference whichever desk I’m sitting at.  The print edition comes with a “free” ebook. There are two ways to get this free ebook.

The way they want you to do it is as follows.

  1. Cut open a folded paper in the front of the book.
  2. Go to the URL printed on the paper.
  3. Type in a code they ask you for out of 9×20 grid.
  4. Type in another code from the grid.
  5. Type in your name and email address.
  6. Wait for the email to arrive.
  7. Find the email in your spam folder.
  8. Click on a link to start the download.
  9. Rename the file from “gi” (wtf?) to something rational, such as “Zend_Framework_In_Action.pdf”.

However, you could do the following.

  1. Enter “zend framework in action pdf” into Google Search.
  2. Click to some blog.
  3. Click the link into RapidShare.
  4. Wait for your 30 seconds to expire since you are a “free” user.
  5. Download the .rar file.
  6. Expand whatever’s in the rar file. (I didn’t actually go this far).

Typing in codes from a grid is pretty annoying. I threw down $45 to get the book. Maybe they should just trust me and print a direct download link inside the text of the book. After all, we’re all only a couple of links away from downloading it from RapidShare. What would have been really cool was if I could have downloaded the PDF for free first and then bought the print version when I decided that the book was of great value. I had that exact experience with another author recently.

If you are going to buy Zend Framework in Action (and you aren’t in a rush like I was), you might use the Amazon.com link above. It’s a lot cheaper than buying it off the shelf at B&N.

Categories
News Programming

New MySpace Apps: Random Band Names and Random Advice

I now have two apps live on MySpace, Random Advice and Random Band Names. The core functionality is exactly the same as what’s on Leon’s Random Generators. Both of them place content on your MySpace profile. You can see them in action on my profile page, myspace.com/leonatkinson.

It’s somewhat obtuse to get the apps on your own profile. Visit the app’s profile page (linked above). Click the button to add the app. Then, modify your profile and add the “module”. (I’m hand-waving a bit here). I think you must be upgraded to the 2.0 version of profiles.

Despite my bickering about how I was fighting with the approval process last month, I did get the advice generator active. The band names app was approved within hours. So maybe they like to hassle unproven developers. In any event, the advice generator has been live for less than a month and has 116 “active users”. I’m not clear if that means installs, or if people have activated the module in their profile. I can’t find any examples of profiles with it installed.

Categories
Programming

Track Your Migraines on Facebook

Many people suffer from migraines, a kind of storm in the brain that causes more than just headaches. I am one of those people. After I’d heard Mark Zuckerberg speak at last year’s Facebook developers conference, it occurred to me that sharing the experience might fit with his vision to give people the power to share and make the world more open and connected.

migraines screenshot

I had an app done in August but got distracted for several months. Over the Christmas break, I found the time to polish it up and release it. The main feature of the app is a personal database of migraine events with the aim to helping you discover patterns or triggers. In the context of Facebook allows you to automatically let your friends know you’ve had a migraine. That could lead to better understanding or just a feeling of comfort.

You can get started using the app by visiting the Migraines About Page on Facebook.

One advantage in waiting was the the new template bundles for the news feed is working flawlessly. In August it was brand new and buggy. I also had more fun with the Google Chart API. Once you get a few migraines recorded, I can generate a pie chart of how severe they are and a line graph of how many you have each month.