919 - 926 - 9847

Thank you team Intergral!

As mentioned on the last post, I used FusionReactor to help with tracking down memory issues. I'm not new to the FR boat, as we've used it on my day job for several years to help keep the various CF servers operating under large amounts of load. I've not really dealt with support, beyond requesting activation help, before this past week.

However, that all changed this week. I run Railo/Resin and Apache on all of my current hosted projects, the main reason being Railo is pretty darn fast, and at the right price. Yes, I get that Resin is pretty out dated, but I've not had time to rip apart the current setup to convert to something like Tomcat.

For some reason, when you use the hosts folder option for Resin, contexts constantly appear to restart to FusionReactor. After some back and forth with the Intergral team, they ended up providing a JAR file that resolved this. But the thing to take away here is I'm not yet a paying customer, and they've responded to my requests starting at 7AM EST, and as late as 9:30PM EST at night! I'm waiting on the customer to go ahead with the purchase amount, but team Intergral is a win in my book!

Railo scope dumper

I'm presently trying to run down a memory (perceived) leak issue on an application that I've hosted for 3 years. In the past 3 months, this app has moved to the FarCry framework from a... less than stellar homebrew solution

At first, I thought it was Lucene shorting out, but I didn't have anything concrete beyond the amount of traffic hitting it. I installed FusionReactor, and although it's very helpful to watch the graphs, it still didn't give all that much accuracy into what was going on. Until...

A heap dump from yesterday revealed that railo.runtime.type.scope.ApplicationImpl had grown to 450 megs for just one site (the one converted recently). After asking around the Railo list, this object appears to be the application scope. Further suggestion was to loop over the keys, and use the built-in sizeOf and countOf functions to see what's going on (yay Railo!).

With some manual dumping of those keys, it appears that the cached HTML object types had grown far beyond expected. Way, far beyond. Ooops. So I cleared the cached objects, and poof, memory was manageable again.

So, on to a handy little file/CFC that will dump out scopes in Railo (I don't think these functions exist in Adobe CF, but I've not tested yet). Much thanks to Gert Franz, Michael Offner, Jay, and Peter Boughton (especially for those key loops Peter!)

First, you need this template. scopeDump.cfm


<!--- instantiate scope object --->
<cfset oGetScopeDetail=createObject("component", "scopeDump")>
<cfoutput>
<form action="" method="post">
<!--- set what scopes you want to dump --->
<select name="scope" id="scope">
    <option value="application">Application</option>
    <option value="session">Session</option>    
    <option value="cgi">CGI</option>
</select>

<input id="submit" name="submit" type="submit" value="GO!">
<cfif structkeyExists(form,"submit")>

<!--- You MUST get the struct to pass into the function --->
    <cfset stScope=oGetScopeDetail.getDetail(structGet(form.scope))>
    <cfif structkeyExists(stScope,'countOf')>
        <p>Count of #form.scope#: #stScope.countOf#</p>
    </cfif>
    <cfif structkeyExists(stScope,'sizeOf')>
        <p>Size of #form.scope#: #stScope.sizeOf#</p>
    </cfif>
<!--- Looping over the returned objects in the structure --->
    <cfif structkeyExists(stScope,'aItems')>
        <table border="1">
            <tr>
                <td>Item</td>
                <td>Count</td>
                <td>Size</td>
            </tr>
            <cfloop from="1" to="#arraylen(stScope.aItems)#" index="i">
                <tr>
                    <td>#stScope.aItems[i].name#</td>
                    <td>#stScope.aItems[i].countOf#</td>
                    <td>#stScope.aItems[i].sizeOf#</td>
                </tr>
            </cfloop>
        </table>
    </cfif>
</cfif>
</form>
</cfoutput>

You'll also need this little CFC, scopeDump.cfc


<cfcomponent displayname="scopeDump" >

    <cffunction name="getDetail" access="remote" returntype="struct">
        <cfargument name="scopeVar" required="yes" type="struct">
        
        <cfset var rStruct=structnew()>
        <cfset rStruct.countOf=numberformat(StructCount(arguments.scopeVar),',')>
        <cfset rStruct.sizeOf=numberformat(SizeOf(arguments.scopeVar),',')>
        <cfset var aItems=arraynew(1)>
        <cfset var stItems=structnew()>
        <cfset var tmp="">
        <cfloop item="CurItem" collection=#arguments.scopeVar#>
            <cfset stItems.name=CurItem>
            <cfif isStruct(arguments.scopeVar[CurItem])>
                <cfset stItems.countOf=numberformat(StructCount(arguments.scopeVar[CurItem]),',')>
            <cfelse>
                <cfset stItems.countOf=0>
            </cfif>
            <cfset stItems.sizeOf=numberformat(SizeOf(arguments.scopeVar[CurItem]),',')>
            <cfset tmp=arrayappend(aItems,structcopy(stItems))>
            <cfset tmp=structclear(stItems)>
        </cfloop>
        <cfset rStruct.aItems=aItems>

        
        <cfreturn rStruct>
    </cffunction>
</cfcomponent>

Time to housekeep

It's time to put a new face on the blog and the site. And, to try and get it out there that I'm looking to bring in more hosted customers that like Railo hosting with a small business ;). I'll be switching everything over to a 960gs template just as soon as I get a few projects cleared off my plate.

I also offer custom FarCry solutions, with Social Networking components, e-commerce, blogging, etc. PHP and static sites are welcome as well! I currently host in eastern US, and UK. Signing up through the month of September means no setup fees! You just need to use newfreesetup at checkout time.

I suppose it helps to mention that information can be found at my hosting portal

Whoops, error in that last post

I modified a block of code to check that "attributes.return" is true as well as exists.

After the code block (don't forget the if)


<!--- Return to the objectadmin --->
<cfif structKeyExists(attributes, "Return") AND attributes.return EQ 'true'>
<cfset attributes.exit = true />
<cfset stLocal.onExitProcess = structNew() />
<cfset stLocal.onExitProcess.Type = "Return" />
<cfset stLocal.onExitProcess.Content = "" />
</cfif>

Been awhile. New FarCry hack for the objectadmin

Under the new 6.x builds of FarCry, and object edit overlay (which is quite handy at times) always pops up on object edit. However, this can be tedious at points. Want to change that behavior? Well, here's one way to do so.

1. Create an edit.cfm for your content type, in this case mdwArticles. In this code have a process form that looks like this (note the return="true"):


<ft:processform action="Save" exit="true" return="true">
<ft:processformobjects typename="mdwArticles" />
</ft:processform>

2. Modify (or make a copy in your project being the better answer) /farcry/core/tags/formtools/processform.cfm:

Add the webskin tag


<cfimport taglib="/farcry/core/tags/webskin" prefix="skin" />

Add a new attribute


<cfparam name="attributes.Return" default="false"><!--- Return to objectadmin --->

After the code block (don't forget the if)


<!--- Return to the objectadmin --->
<cfif structKeyExists(attributes, "Return") AND attributes.return EQ 'true'>
<cfset attributes.exit = true />
<cfset stLocal.onExitProcess = structNew() />
<cfset stLocal.onExitProcess.Type = "Return" />
<cfset stLocal.onExitProcess.Content = "" />
</cfif>

And finally, you need a case to handle the return ()


<cfcase value="Return">
<cfif structKeyExists(stLocal.stOnExit, "Content")>
<skin:onReady>
<cfoutput>

parent.$fc.objectAdminActionDiv.dialog('close');
</cfoutput>
</skin:onReady>
</cfif>
</cfcase>

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Addendum 1

I had an "Ah HA!" moment when I got home tonight. I copied in my FarCry core folder from my known good Ubuntu Railo/FarCry install over to my CentOS install and still had issues. I tried several iterations of this, and then I had a think. I pulled up the Railo admin on my Ubuntu install, and noticed I had it at .012. And then it hit me... I was actually in a discussion about this with others on the google groups. I thought I had tried it at 3.1.0.016, but I think I did not complete the upgrade step.

So, I copied the .012 install of Railo over to the CentOS box and it worked! Huzzah! So, it appears that .012 remains the most supported version at this point in time. I'm hosting a copy of this file on my site, but please be gentle! I don't want to hear it from my host that ya'll are killing my server. You can grab the file here.

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 3

In this installment we're going to be installing FarCry, and tweaking our Apache settings a bit. To let ya'll know upfront, there's still a few issues with FarCry and functions that are named the same as internal Railo functions. I know these changes were placed into trunk at one point, but it doesn't seem like they migrated over to the 5.1.6 release. That's OK, I've got a fairly stable pull of the core trunk files from a few weeks back that I'll be linking on the site this evening. I'll verify that this fixes the odd "function cannot be named" stuff going on. The current trunk files are not allowing the overview page to come up, but then again this is trunk we're talking about... life on the bleeding edge sometimes leads to a paper cut ;).

[More]

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 2

Right... part 2. We're going to install Railo in this section. It's going to be a much smaller ride than part 1 ;). But first, some knowledge.

I've learned that:

  • I'm not a fan of CentOS. I prefer the debian distros. Why? I've not really ever had a need to play with SELinux, or IPTables. Why does that matter? Both of these things have caused me grief whilst putting this together as both are enabled by default in both the _64 and i386 builds of 5.3.
  • You must turn off IPTables on each boot of the system. I'm sure there's a way to make this automatic, but I really haven't tracked it down yet. Yes, it would not be an issue if I just set it up... surely this will be a blog posting down the line, but I don't require it for now.
  • I had originally done the write up for part 1 with an _64 build. Everything was great until I got to the point where I needed to build mod_caucho. I could not find a way to successfully build that, and it appeared to be an issue with apsx. I didn't really want to spend my entire day chasing down rabit holes, so I switched to the i386 build. It's at this point that I learned that SELinux was preventing Apache from talking to Caucho. Again, not wanting to chase my tail endlessly, I just disabled SELinux for now.
  • Use PUTTY! I can never get copy/paste to play nice between my VM command line screen and windows. So, I'll just minimize the VM and use PUTTY to terminal (over SSH) into virtual box. In this way, you can also keep several screens up at one time.

[More]

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 1

Woah... not such a catchy title, but it's descriptive, non?

This all began as a quest to be able to provide a VPS solution to the lowest bidder situation. Their host provides CentOS machines at a fairly reasonable price, but that price would not include the cost of a ColdFusion license. My framework of choice is FarCry, and lately the Daemonites have taken great strides in keeping the framework compatible with Railo. This is the thorny path towards creating a Linux virtual machine with FarCry, MySQL, Railo, and Apache (oh... and SES URLs).

We'll start by just getting the basics of the system running and in place.

  • Everything I'm doing is as the root user... yes, not cool, but this just development. Typically, you should really use sudo to do all of this.
  • Grab a VMware image of CentOS 5.2. You can find one here: http://www.vmware.com/appliances/directory/1309. VMplayer can be found here: http://www.vmware.com/download/player/
  • Turn off IPTABLES for testing... yes, not the best idea for production, but this is development. I could not figure out why the heck Apache wasn't serving pages outside the local install, and it was the firewall blocking it. In production, you should really turn this feature on. I'm not addressing how to do so for this excercise.

    • /etc/init.d/iptables save
      /etc/init.d/iptables stop
  • Enable RPMforge packages. This will allow us to install phpMyAdmin through yum.
    • http://wiki.centos.org/AdditionalResources/Repositories/RPMForge (source)
    • Download either i386 or _64 RPM dependant on your OS type version
      • http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
      • http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
    • Import GPG key
      rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
    • Install it (replace the RPM with the name)
      rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm
  • We need to install apache (well, not NEED, but we're not using Tomcat here)
    • http://www.railo.ch/blog/index.cfm/2008/11/12/Installing-ResinRailo-on-CentOS (source)
    • yum install httpd httpd-devel openssl-devel
  • We need to install MySQL
    • http://www.ozzu.com/unix-linux-forum/centos-and-apache-php-mysql-t69484.html (source)
    • vi /etc/yum.repos.d/CentOS-Base.repo
    • change enable=1 for centosplus
    • yum install mysql-server mysql
  • I installed PHP/PHPmyadmin - just for DB administration
      yum install php php-mysql phpmyadmin
      cd /usr/share/phpmyadmin/
      vi config.inc.php
    • enter a value in $cfg['blowfish_secret'] = '<something>';
    • vi /etc/httpd/conf.d/phpmyadmin.conf
    • change the allow line to (yes, yes... but this is a test environ) to Allow from all
  • We need to install a JVM... this part just sucks. Unlike other distros, no precompiled version really meets our needs.
    • http://j2eeinaction.blogspot.com/2009/02/install-java-6-on-centos-52.html (source)
    • Go to http://java.sun.com/javase/downloads/index.jsp (grab the JDK!). You can browse to a download link and post that into your VM as something like the following
    • wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64-rpm.bin?BundledLineItemUUID=CXFIBe.pePAAAAEioR0Hk1t8&OrderID=CgtIBe.pcWUAAAEilh0Hk1t8&ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&FileName=/jdk-6u14-linux-x64-rpm.bin
    • rename that long ugly file to jdk.rpm.bin
    • mv <stupid long name> jdk.rpm.bin
    • chmod 700 jdk.rpm.bin
      ./jdk.rpm.bin
      /usr/sbin/alternatives --config java
  • Start Apache and MySQL at reboot
      /sbin/chkconfig httpd --level 2345 on
      /sbin/chkconfig mysqld --level 2345 on

And that's it. You have Apache serving pages at http://yoursite/ and phpMyAdmin at http://yoursite/phpmyadmin. Next up on the chopping block, adding Railo into the mix.