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.