Friday, July 20, 2012

Fanning the Flames… Working with OpenFlame from FireJack Technologies

I am very interested in a new platform called OpenFlame from a local, Columbia MD company - Firejack Technologies. It is a platform that helps you quickly convert your ideas in to software. More importantly, the resulting software is fully documented (automatically) and is configured using industrial-strength, enterprise-ready, open source technologies such as Java, Tomcat, MemCache and MySql.

The platform is designed to run on a Linux or Centos Operating System but the components all have Windows and Mac implementations. Therefore, in order to get my hands on the OpenFlame platform I want to try configuring the platform to run on a Mac running Mac OS X 10.7 aka Lion. I figured that this would also help me to understand how it has been built. So in this blog post I am going to document the process I am going through to get the OpenFlame 1.4 platform running under Mac OS X.

I am indebted to a number of people who have posted configuration guides for these different technologies. There is a wonderful community of developers and coders who contribute their knowledge. What I am doing here is leveraging their valiant efforts to combine a series of these technologies in to a working setup under Mac OS X. To all of you - Thank You.

Since I am running OS X 10.7 Lion it does not come pre-installed with Java and Tomcat 7 requires Java 1.6. So the first step is to get the download for Java and install it. With that done we can move on to installing Tomcat 7.

Tomcat installation:

Thanks go to Wolf Paulus for his guide on installing Tomcat 7 on OS X Lion. I also found the instructions for Snow Leopard installation by John Malis useful

First a little about my environment. Yes, I am running Mac OS X Lion. I have also installed XCode in to the /Developer folder on my hard drive. Since I don't intend to run Tomcat frequently I decided to install Tomcat in /Developer along with Openflame.

First I downloaded the latest version of TomCat and expanded the tar ball.
I then simply moved the Tomcat folder to /Developer.  This gave me a new folder:

/Developer/apache-tomcat-7.0.29

Rather than sprinkle version references for Tomcat in path statements and elsewhere I created a symbolic link.

ln -s /Developer/apache-tomcat-7.0.29 /Developer/Tomcat

I then changed ownership:

sudo chown -R <your_username> /Developer/Tomcat

I removed the .bat files from the /Developer/Tomcat/bin folder since we are not running on Windows and then I made the .sh shell files executable:
sudo chmod +x /Library/Tomcat/bin/*.sh

Make sure that CATALINA_HOME is as an environment variable. 

You can do this with:
export CATALINA_HOME=/Developer/Tomcat

If you want these to be run everytime you launch a shell then add them to ~/.source using a text editor.

Startup Tomcat on port 8080 using:
/Developer/Tomcat/bin/startup.sh

Then launch a browser and try connecting to localhost:8080 and you should see a screen something like this:
Apache_tomcat_7

Memcached Installation:

With Tomcat installed the next step is Memcached. For this process I found Tug's blog post really useful. Once again XCode is a pre-requisite since we are going to be compiling and installing code.

create a temporary working directory and switch to it.

The first pre-requisite is libevent. So let's install it:

curl -O http://www.monkey.org/~provos/libevent-1.4.14-stable.tar.gz
tar xzvf libevent-1.4.14-stable.tar.gz
cd libevent-1.4.14-stable
./configure
make
make verify
sudo make install 

With that done we can install memcached:

Switch back to the temporary working directory and install memcached:

tar xzvf memcached-1.4.10.tar.gz
cd memcached-1.4.10
./configure
make
make test
sudo make install

This should result in an installation of memcached in the /usr/local/bin.

running memcached can be accomplished with the following command:

/usr/local/bin/memcached -d -p 11211

This runs memcached as a daemon on port 11211. 

Tug's blog post gives details on using telnet to connect to the memcached installation to test it.

We are making progress. We have Tomcat and Memcached running. The next step is MySQL.

MySQL Installation:

For the MySQL installation I turned to Michael McLaughlin's blog. MySQL has a simple implementation for Mac OS X. You can download an OS X Disk Image of the 64-bit installation from the MySQL site. This package also include a System Preferences Pane to make starting and stopping MySQL simple to do.

With the System Preferences Pane you can choose whether you want to have MySQL launch when your system starts up.

With mysql configured with a symbolic link we can configure the environment settings:

export set MYSQL_HOME=/usr/local/mysql
export set PATH=$PATH:$MYSQL_HOME/bin

To configure MySQL you can download and install the MySQLWorkbench application. If you are a LAMP developer you may already have MyPHPAdmin installed.

We not have all of the base components up and running for OpenFlame. In the next post on this subject I will look at what is needed to get Openflame configured and working using these base components.