Showing posts with label open flame. Show all posts
Showing posts with label open flame. Show all posts

Monday, August 06, 2012

Configuring Openflame on Mac OS X

In an earlier blog I went through the installation of Memcache, MySQL, Maven and Tomcat. These are the open source building blocks on which the Openflame platform is built. Openflame is an enterprise-strength, scalable development platform from Columbia, MD innovator FireJack Technologies

I have delayed following up on the installation of Openflame because I have moved my MacBook to Mountain Lion. Now that the OS is largely running smoothly (Other than a few niggles with Safari and Address Book) I am turning back to getting the upcoming 1.4 release of Openflame running.

First step - Launch Memcached:

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

MySQL is easy since I installed the System Preferences Add-in. Just launch System Preferences, choose the MySQL preference pane and click the button to startup MySQL.

I had downloaded and installed Openflame 1.4 in to /Developer/openflame1.4 and setup a symbolic link so that /Developer/openflame points to the 1.4 release directory.

I then copied the openflame.war file from the webapps sub-directory to the webapps sub-directory in the Tomcat installation. I had installed Tomcat in /Developer/apache-tomcat-7.0.29 and had a symbolic link to the installation from /Developer/Tomcat

The next step is to configure the two configuration files. There are two files:

  • environment.xml
  • environment.properties

FireJack provides two sample files for this:
  • environment.example.xml
  • environment.properties.example

More on the settings for these in a moment.

I went through a number of iterations to get the openflame.war file to successfully deploy. After receiving some great support from one of the Developers at FireJack.net  I was able to successfully get OpenFlame running. This is what I had to do to get the 1.4 beta version of Openflame running:

One point to note is that the 1.4 version of Openflame makes a change to the properties files to encrypt the content.  I believe that one of my initial implementation attempts failed because there was no Openflame database to upgrade. First we will start by reviewing the environment files:

The first step is to gather all the settings and accounts you have used to configure Memcached, Maven, Tomcat and MySQL. You will need them to configure the environment files.

environment.xml

<?xml version="1.0" encoding="UTF-8"?>
<environments>
    <environment>
        <system name="opf-local" path="net.firejack">
            <packages>
                <package>net.firejack.openflame</package>
            </packages>
            <port>8080</port>
            <protocol>HTTP</protocol>
            <serverName>localhost</serverName>
        </system>

Specify the port, protocol and serverName to match your machine. If you are running locally this would be localhost on port 8080. The default for Tomcat.

        <databases>
            <database name="db" path="net.firejack.opf-local">
                <password>{account_password}</password>
                <port>3306</port>
                <rdbms>MySQL</rdbms>
                <protocol>JDBC</protocol>
                <serverName>localhost</serverName>
                <urlPath>opf_main</urlPath>
                <username>{admin_Account}</username>
            </database>
        </databases>

This is where you create the connection to MySQL. The default port is 3306. I used the root account for this test but you could specify an alternative name. Just make sure you give it the necessary admin level permissions in order to create and manage the Openflame schema.

Replace {account_password} with the password used by the admin account.
The serverName should match the setting you applied in the previous section - unless you are connecting to a MySQL instance on another machine.
Replace {admin_Account} with the administrator account you are using on MySQL. The default will be root.

        <servers>
            <server name="server" path="net.firejack.opf-local">
                <port>8080</port>
                <protocol>HTTP</protocol>
                <serverName>localhost</serverName>
            </server>
        </servers>

Port, protocol and serverName should match the settings used in the earlier system section. I am using Localhost and the default 8080 port for Tomcat.

        <filestores>
            <filestore name="base" path="net.firejack.opf-local">
                <port>8080</port>
                <serverDirectory>{Absolute_File_Reference}/openflame/base/filestore</serverDirectory>
                <serverName>localhost</serverName>
            </filestore>
            <filestore name="config" path="net.firejack.opf-local">
                <port>8080</port>
                <serverDirectory>
{Absolute_File_Reference}/openflame/base/filestore</serverDirectory>
                <serverName>localhost</serverName>
            </filestore>
            <filestore name="content" path="net.firejack.opf-local">
                <port>8080</port>
                <serverDirectory>
{Absolute_File_Reference}/openflame/base/filestore</serverDirectory>
                <serverName>localhost</serverName>
            </filestore>
        </filestores>

The filestores need to be referenced by an absolute file/folder reference. I pointed the filestore to a Developer area under my user account
{Absolute_File_Reference} = /Users/{OSX_Account_Name}/Developer
The Base, Config and Content database filestores all point to the same location.

        <directories>
            <directory name="accounts" path="net.firejack.opf-local">
                <directoryType>DATABASE</directoryType>
                <serverName>localhost</serverName>
                <status>ACTIVE</status>
                <urlPath>/openflame</urlPath>
            </directory>
        </directories>
    </environment>
</environments>

environment.properties.

# Admin user login and password
app.admin.email={My_Email_Address}
app.admin.name=admin
app.admin.password=111111

#Memcached
memcached.url=localhost
memcached.port=11211
memcached.cache.size=10

#Master Openflame URL
#opf.master.url=[OPF_MASTER_URL]

The app.admin.name and app.admin.password were set to the openflame defaults. They can be changed in the platform once Tomcat has deployed and launched the openflame.war file.

The memcached information is taken from the install. In this case I am running it on localhost on the default port of 11211.

The critical Environment variable before launching Tomcat is OPF_ENV_PATH. I made sure this was set to the /Developer/openflame where the environment files were located.

You should then be able to copy the openflame.war file in to the /Developer/Tomcat/webapps folder and launch Tomcat. 

The deployment process may take up to 15 minutes since there is a lot of code to deploy, databases to build etc. But once it has deployed you should just be able to go to Openflame via localhost:8080/openflame.

If you have problems with a new deployment try these steps:
The following notes are for a new installation and NOT for an upgrade!
If the new deployment fails check these things:
  • Drop the openflame schema. I used MySQLWorkbench to do this. 
  • Check that the MySQL Admin account you use has full rights to create and manipulate schemas and tables.
  • Check that the openflame folder does NOT have an openflame.properties file. I had an unencrypted version that was a result of another installation experiment. Openflame 1.4 requires an encrypted file
  • Have you defined the OPF_ENV_PATH setting and pointed it to the location of the openflame environment files. For me this was /Developer/openflame.

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.