views:

37

answers:

2

Hi,

I need some advice on configuring a project so it works in development, staging and production environments:

I have a web app project, MainProject, that contains two sub-projects, ProjectA and ProjectB, as well as some common code, Common. It's in a Subversion repository. It's nearly all HTML, CSS and JavaScript.

In our current development environment we check MainProject out, then set up Apache virtual hosts to point at each of the sub-project's directories, as paths within each project are relative to their root. We also have a build process that then compiles each of the sub-projects into their own deliverable package, with the common code copied into each.

So - I'm trying to make development of this project a bit easier. At the moment there is a lot of configuration of file paths in Apache http.conf files, as well as the build.xml file and in a couple of other places too.

Ideally I'd like the project to be checked out of SVN onto a fresh computer, with a web server as part of the project, fully configured, that can then be run from the checkout directory with very little extra configuration, either on a PC or Mac. And I'd like anyone to be able to run the build to compile it too.

I'd love to hear from anyone who has done something like this, and any advice you have.

Thanks, Paul

A: 

Hi, I've done this with Jetty, from within Java. Basically you write a simple Java class that starts Jetty (which is a small web server) - you can make then this run via an ant task (I used it with automated tests - Java code made requests to the server and checked the results in various ways).

Not sure it's appropriate here because you don't mention Java at all, so apologies if it's not the kind of thing you're looking for.

andrew cooke
A: 

If you can add python as a dependency, you can get a minimal HTTP server running in less than ten lines of code. If you have basic server side code, there is a CGI server as well.

The following snippet is copied directly from the BaseHTTPServer documentation

import BaseHTTPServer
def run(server_class=BaseHTTPServer.HTTPServer,
        handler_class=BaseHTTPServer.BaseHTTPRequestHandler):
    server_address = ('', 8000)
    httpd = server_class(server_address, handler_class)
    httpd.serve_forever()
Andrew Walker
Hi, yes, this is probably closer to what I need. Basically my project is static HTML and JavaScript, but I'd like to add a tiny bit of server side code to simulate Ajax calls. Then I want to be able to check it out on *any* machine, build it and run it there and then, with no further configuration. This might do the trick, I'll just have to write a Python script to deal with the form submissions and simulate returning some dynamic data.Thanks,Paul