Tuesday, 13 January 2009

Wt Installation

This is a continuation of the "Witty Adventure"

So where am I?

I know where I'm going and what I want to do and now I have a machine ready to use. So far so good ... jinx!

Here comes the nuts and bolts, getting Wt installed.

Apache2

Before I start messing around I want to make sure that apache can start and I can get to it.

I logged in as root and checked the current status:

witty1:~ # rcapache2 status
Checking for httpd2: unused

Unused basically means apache isn't running. So I'll have to start it:

witty1:~ # rcapache2 start
Starting httpd2 (prefork) done

witty1:~ # rcapache2 status
Checking for httpd2: running

Unsurprisingly apache has started. When I tried to access it I found that I couldn't as OpenSuse starts it's firewall automatically on start-up. I used yast to open the firewall for apache2. Again, I'll assume that you already know how to do this. If not a quick google should yield a few million results :)

mod_fastcgi

Now that I have a working version of apache I need to make sure that mod_fastcgi is installed. I simply did this by running:

a2enmod -l

This lists the modules assigned to APACHE_MODULES in /etc/sysconfig/apache2. I could see that cgi was installed, but fastcgi wasn't. So I then ran:

a2enmod fastcgi

Now be careful here as there aren't any module checks at this stage. To make sure everything is ok run:

rcapache2 configtest

This will make sure the modules are available. If not you either typed the module name incorrectly or it's simply not available. If you did type it incorrectly then run a2edismod with the incorrect spelling and this will remove it from the APACHE_MODULES list. If however you don't have fastcgi available then install it. If you're using suse then you should be able to get hold of it from the opensuse.org website.

I'm going to keep the default location for my htdocs as /srv/www/htdocs/. I'll need this later for the deployment of the witty executables.

FastCGI

The basic installation of OpenSuse that I selected didn't have FastCGI, so I used yast to find and install it ... again, very simple. If you can't find it using yast then you can get it from the OpenSuse website (keep reading before going there).

The version of FastCGI I installed was 2.4.

Now something to note here is that the first time I tried to run the cmake to generate the make file for Wt it reported that it couldn't find libfcgi. This drove me crazy for a wee bit until I started to dig around in the cmake configuration files that came with Wt. I found that cmake/WtFindFcgi.txt was looking for fcgio.h and I didn't have that. I had the FastCGI library installed but not the src part of it. I looked in yast but that didn't have it so I ended up downloading it from the OpenSuse website - FastCGI-devel-2.4.0-111.1.i586.rpm.

After a ...

rpm --install FastCGI-devel-2.4.0-111.1.i586.rpm

... and a ...

rpm -q FastCGI-devel --dump | cut -f1 -d " "

/usr/include/fastcgi
/usr/include/fastcgi/fastcgi.h
/usr/include/fastcgi/fcgi_config.h
/usr/include/fastcgi/fcgi_stdio.h
/usr/include/fastcgi/fcgiapp.h
/usr/include/fastcgi/fcgimisc.h
/usr/include/fastcgi/fcgio.h
/usr/include/fastcgi/fcgios.h
/usr/lib/libfcgi++.a
/usr/lib/libfcgi++.la
/usr/lib/libfcgi.a
/usr/lib/libfcgi.la
/usr/share/man/man3/FCGI_Accept.3.gz
/usr/share/man/man3/FCGI_Finish.3.gz
/usr/share/man/man3/FCGI_SetExitStatus.3.gz
/usr/share/man/man3/FCGI_StartFilterData.3.gz

... I knew I was ready to rock and roll again :)

cmake

The basic installation of OpenSuse that I selected didn't have cmake, so I used yast to find and install it ... simple. If you can't find it using yast then you can get it from the cmake orOpenSuse website.

The version of cmake I installed was 2.6.2.

Wt Installation

Ok, we now have apache2, cmake and fastcgi ready for Wt.

I downloaded Wt 2.2.2 and put it on the server where I could find it.

I then extracted it with the following command:

tar -xvf wt-2.2.2.tar.gz

This gave me a wt-2.2.2 directory (if I had any other version I would expect the directory name to correspond to it).

Next, I created a build directory inside the wt-2.2.2 directory so I have the following structure:

/devel
/witty
/wt-2.2.2
/build

Within the build directory I ran:

cmake ../ -DEXAMPLES_CONNECTOR=wtfcgi -DCONNECTOR_FCGI=yes -DCONNECTOR_HTTP=no -DDEPLOYROOT=/srv/www/htdocs/witty/

This went away for a few seconds checking various things (I could see that FastCGI had been enabled and built-in http hadn't), and hey presto I am ready for a build.

Still within the build directory run make. This should now go off and start making Wt. Once this is complete run make install which will put the libs in the right directories. You'll also get a list of where these files are going. I'd keep that for reference.

So far so good ... and if you're using this as a guide to your installation I hope you're good too!!

Now onto the examples ...

Witty Machine

This is a continuation of the "Witty Adventure"

Here I'm going to go over the configuration I've chosen for the Wt installation on OpenSuse 11 so that it runs as an Apache2 FastCGI module.

Machine Overview

I've gone for quite a limited VMWare machine setup.

The machine itself has 2 CPUs, 256mb of RAM and a 4GB hard drive.


Again for simplicity I'm using a bridged network configuration.

GUI?

As this is going to be a web server I don't need a GUI; plus I've only got 4gb available ... "only 4gb" he says, my first computer 'only' had ... oh dear, I'm sounding old! :)





Default Packages

The default installation doesn't contain the packages I need so I'll need to do some tweaking.

I've selected the following additional packages:

# Web and LAMP Server
# Base Development
# C/C++ Development
# Web Development







Summary

That's it, let the installation do the rest.

So far I haven't done anything special for Wt.

I'm sure there will be other packages/rpms that I'll need later, but I'll go through those when/if I need to.




On to the Wt Installation.

Sunday, 11 January 2009

Introduction

My Witty Adventures

I'm just starting out on my Wt adventures and instead of creating yet another "How to" document that will be referenced a couple of times and then forgotten I thought I'd write a blog about it. This way it will hopefully help others starting out on the same adventure.

When I say that I'm just starting I literally mean "just starting" as I haven't even got a machine ready to trial it on.

What is Wt (Witty)?

If you're here then you'll probably have a good idea what it's all about, but if not then take a look at the Wt website; plus I don't think I could do it justice :).

To do

A Machine

Well the first thing I'm going to need is a machine. As I'm more familiar with Linux for robust server side applications I'm going to use OpenSuse 11.

"Why OpenSuse 11?": its my personal favourite Linux OS. Note that you don't need this OS to use Witty.

As I'm going to be using Apache all we need is:
  • Apache 1 or 2, or another web server which supports the FastCGI protocol.
I'll put this on a Virtual Machine using a VMWare server. As the installer for OpenSuse has advanced so much and there are so many tutorials on how to install it, I'm not going to spend a lot of time going into too much detail.

Wt Installation

As I want to use Wt in such a way that I'd know how to set it up in a production environment I'll install it so it's ready to be used with Apache. I'm aware that Wt comes with it's own web server but I don't think this is production strength. I have been informed that the wt-httpd is in production and is very reliable. As suggested I will look into this at a later stage and use it as a test harness. As Apache is the standard http engine used internally within my organisation I will be focused on ensuring that whatever I do works with that :)

Examples

I'll start off by simply getting the existing examples working; here comes another "Hello World" :)

Starting from scratch

It's all good and well having examples that have already been written and have their own compile scripts but I'll detail what I find when creating my own simple Wt Application.

Ok, now onto the installation of Suse.