Starling Software K.K Language:

Setting Up and Deploying a Simple Website with QAM

As with any new piece of software, getting started can be tricky without some good help. If you get stuck anywhere along the way, don’t hessitate to contact us. We’ll be happy to help.

Before begin this tutorial, or any other, make sure your system meets these requirements:

OS: 		Linux, *BSD, or MacOS
Software: 	Subversion, Ruby 1.8.5 or higher

Step 1

Get a QAM checkout:

git clone git://git.cynic.net./qam

Step 2

Make sure that the QAM framework’s tests all pass.

cd qam
./Test

Your output should look like this:

$ ./Test 
===== Installing
===== Testing src
-----   Install
-----   db
-----   qam
-----   server
-----   test-httpweb
$ 

What to do if there’s an error?

  1. Ensure you’ve got the appropriate software listed in requirements above.
  2. Try running ./Test -C to do a clean build of extsrc and src.
  3. Look at the messages and see if you can trace the problem. (You are a developer, after all!)
  4. Seek professional help. :-) (Our e-mail addresses are linked above.)

Step 3

Download Lighttpd and place the extracted source files under qam/extsrc/bin/lighttpd.

mkdir -p extsrc/bin; cd extsrc/bin
wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.gz
tar -zxf lighttpd-1.4.18.tar.gz
mv lighttpd-1.4.18 lighttpd
cd ../../

The extsrc directory (external sources) is where third-party software, usually unmodified, lives. It includes subdirectories for applications (bin), modules for applications and libraries (mod), libraries (lib), and scripting-language libraries (ruby, python, etc.) .

So here we Fetch lighttpd-1.4.18, extract it, and name the directory to remove the version name. (Typically this would actually be copied from a vendor branch imported under /vendor in the repository, but this way is easier for this exercise.)

Step 4

Run ./Install from the top level project directory

$ pwd
/u/bryan/dev/qam
$ ./Install
===== Installing
 ---- configuring lighttpd
 cat: /etc/ld.so.conf.d/*.conf: No such file or directory
 appending configuration tag "CXX" to libtool
 cat: /etc/ld.so.conf.d/*.conf: No such file or directory
 appending configuration tag "F77" to libtool
 ........................................................
 ............Lighttpd Configure Build Noise..............
 ........................................................
===== Testing src
-----   Install
-----   db
-----   qam
-----   server
-----   test-httpweb
$ 

QAM knows how to build a number of popular software packages, and adding more is easy. (Have a look at extsrc/Install to see how things are built.) Here, QAM sees that lighttpd is present in extsrc, hasn’t already been installed in the release/ directory, and so builds and installs it.

You’ll note a directory named build/ has also appeared; this is where intermediate build files (unlinked object files and so on) are stored. Occasionally, this will also contain a complete copy of the source, for those packages that don’t build properly outside of their own source directory.

After this, you should see a release/sbin/lighttpd file; this is a standard lighttpd install in all ways, except for that fact that it’s installed under your release directory rather than under /usr, /usr/local, /opt, or similar.

Step 5

Now that we’ve got a web server, we need a configuration and content for it. The src/server.template directory provides a tempate for this. Let’s create a new server called “web” and add some content to its docroot:

$ mv src/server.template src/server.web
$ mkdir src/server.web/docroot
$ vi src/server.web/docroot/index.html

Add this to the file:

<html><head>
  <title>Hello World</title>
</head><body>
  <h3>Hello World</h3>
</body></html> 

Step 6

Run the top-level Install script to install the server configuration templates, the docroot, and other goodies to the release/ directory:

$ ./Install 
===== Installing extsrc
***** Skipping lighttpd (found sbin/lighttpd)
===== Installing src
----- Installing src/qam
----- Installing src/server
----- Installing src/test-httpweb
----- Installing src/server.web

Step 7

Set up and start your server port 8080:

$ ./release/bin/server web start 8080    

Step 8

Point your browser to

http://localhost:8080/index.html

You’ll be asked for a name and password; we do this as a standard practice on development machines to keep them from getting spidered in case they’re directly connected to the Internet. Use “m” for the name and “7539” for the password.

If you get a 404 or other error, check your URL, and also check the error log of this server instance, in the file instance/web.8080/log/error.


Back to the qam information page