Are daily builds the way to go for a web app?
Asked Answered
B

6

9

Joel seems to think highly of daily builds. For a traditional compiled application I can certainly see his justification, but how does this parallel over to web development -- or does it not?

A bit about the project I'm asking for -- There are 2 developers working on a Django (Python) web app. We have 1 svn repository. Each developer maintains a checkout and thier own copy of MySQL running locally (if you're unfamiliar with Django, it comes bundled with it's own test server, much the way ASP apps can run inside of Visual Studio). Development and testing are done locally, then committed back to the repository. The actual working copy of the website is an SVN checkout (I know about SVN export and it takes too long). The closest we have to a 'build' is a batch file that runs an SVN update on the working copy, does the django bits ('manage.py syncdb'), updates the search engine cache (solr), then restarts apache.

I guess what I don't see is the parallel to web apps.

Are you doing a source controlled web app with 'nightly builds' -- if so, what does that look like?

Bum answered 17/9, 2009 at 22:50 Comment(0)
H
11

You can easily run all of your Django unit tests through the Django testing framework as your nightly build.

That's what we do.

We also have some ordinary unit tests that don't leverage Django features, and we run those, also.

Even though Python (and Django) don't require the kind of nightly compile/link/unit test that compiled languages do, you still benefit from the daily discipline of "Don't Break The Build". And a daily cycle of unit testing everything you own is a good thing.

We're in the throes of looking at Python 2.6 (which works perfectly for us) and running our unit tests with the -3 option to see which deprecated features we're using. Having a full suite of unit tests assures us that a change for Python 3 compatibility won't break the build. And running them nightly means that we have to be sure we're refactoring correctly.

Headgear answered 17/9, 2009 at 22:56 Comment(1)
+1 Web apps in dynamic languages often don't require a "build" at all, but continuous integration testing is highly recommended.Lizbeth
O
3

Continuous integration is useful if you have the right processes around it. TeamCity from JetBrains is a great starting point if you want to build familiarity:

http://www.jetbrains.com/teamcity/index.html

There's a great article that relates directly to Django here:

http://www.ajaxline.com/continuous-integration-in-django-project

Hope this gets you started.

Outpost answered 17/9, 2009 at 22:54 Comment(0)
Q
3

Web applications built in dynamic languages may not require a "compilation" step, but there can still be a number of "build" steps involved in getting the app to run. Your build scripts might install or upgrade dependencies, perform database migrations, and then run the test suite to insure that the code is "clean" w.r.t. the actual checked-in version in the repository. Or, you might deploy a copy of the code to a test server, then run a set of Selenium integration tests against the new version to insure that core site functionality still works.

It may help to do some reading on the topic of Continuous Integration, which is a very useful practice for webapp dev teams. The more fast-paced and agile your development process, the more you need regular input from automated testing and quality metrics to make sure you fail fast and loud on any broken version of the code.

Quick answered 17/9, 2009 at 22:55 Comment(1)
+1 for being the first answer that I saw that combines the ideas of the non-compilation aspects of the build process with a suggestion for continuous integration. FWIW, I've had good luck with CruiseControl for a webapp.Awesome
C
2

If it's really just you and one other developer working on it, nightly builds are probably not going to give you much.

I would say that the web app equivalent of nightly builds would be staging sites (which can be built nightly).

Where nightly builds to a staging area start paying real dividends is when you have clients, project managers, and QA people that need to be able to see an up to date, but relatively stable version of the app. Your developer sandboxes (if you're like me, at least) probably spend a lot of time in an unusable state as you're breaking things trying to get the next feature implemented. So the typical problem is that a QA person wants to verify that a bug is fixed, or a PM wants to check that some planned feature was implemented correctly, or a client wants to see that you've made progress on the issue that they care about. If they only have access to developer sandboxes, there's a good chance that when they get around to looking at it, either the sandbox version isn't running (since it means ./manage.py runserver is up in a terminal somewhere) or it's in a broken state because of something else. That really slows down the whole team and wastes a lot of time.

It sounds like you don't have a staging setup since you just automatically update the production version. That could be fine if you're way more careful and disciplined than I (and I think most developers) am and never commit anything that isn't totally bulletproof. Personally, I'd rather make sure that my work has made it through at least some cursory QA by someone other than me before it hits production.

So, in conclusion, the setup where I work:

  • each developer runs their own sandbox locally (same as you do it)
  • there's a "common" staging sandbox on a dev server that gets updated nightly from a cronjob. PMs, clients, and QA go there. They are never given direct access to developer sandboxes.
  • There's an automated (though manually initiated) deployment to production. A developer or the PM can "push" to production when we feel things have been sufficiently QA'd and are stable and safe.

I'd say the only downside (besides a bit of extra overhead setting up the nightly staging builds) is that it makes for a day of turnaround on bug verification. ie, QA reports a bug in the software (based on looking at that day's nightly build), developer fixes bug and commits, then QA must wait until the next day's build to check that the bug is actually fixed. It's usually not that much of a problem since everyone has enough stuff going on that it doesn't affect the schedule. When a milestone is approaching though and we're in a feature-frozen, bugfix only mode, we'll do more frequent manual updates of the staging site.

Chapell answered 18/9, 2009 at 15:18 Comment(0)
M
1

I've had great success using Hudson for continuous integration. Details on using Hudson with Python by Redsolo.

A few months ago, several articles espousing continuous deployment caused quite a stir online. IMVU has details on how they deploy up to 5 times a day.

Mayce answered 17/9, 2009 at 23:14 Comment(0)
R
1

The whole idea behind frequent builds (nightly or more frequent like in continuous integration) is to get immediate feedback in order to reduce the elapsed time between the introduction of a problem and its detection. So, building frequently is useful only if you are able to generate some feedback through compilation, (ideally automated) testing, quality checks, etc. Without feedback, there is no real point.

Ravens answered 17/9, 2009 at 23:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.