Blog

Blog Archives - 12 Record(s)

Year: '2014' - Month: '5'

27
May 2014

Gavin Pickin

ColdFusion Install Repo - News and Updates and new Contributors

CFML Language, CFML Server, ColdFusion Install Repo, Server Admin

UPDATE: New home for the CF Install Repo Available: http://www.gpickin.com/index.cfm/blog/coldfusion-install-download-repo-new-home-for-all-your-files

The idea started with a couple of tweets, and has been growing steadily since that day in Feb 2014, when I decided to make an online repo of any and all ColdFusion Installs I had, and open it up to the community too. Now, a few months later, with Adobe's ColdFusion 10's legal issues, the ColdFusion Install Repo might become a pretty popular item… and even Charlie Arehart is contributing to the repo, so you know its worth looking into right, well, here is some news and updates.

Previous posts about ColdFusion Install Repo can be found here.

The big news, we got some more contributions from the community. Travis Peters contributed some ColdFusion 7 Windows Installers and Updaters, which we are very light on the older versions, so if you have them, get in touch. Charlie Arehart contacted me last week to see how he could contribute, with the idea of adding a series of hot fixes. I thought all along hot fixes would be important, but unlike Charlie, I did not have a stock pile of updates, and the associated documents which makes the hot fixes useful and useable. We added the hot fixes, so now we have hot fixes from 8.0.0 through to CF10, so thank you Travis and Charlie for that.

Another thing Charlie suggested, which are a good idea, was a short url. I was going to register something, but Charlie has locked down http://tinyurl.com/cfdownloads, which is apparently easier to remember, and share than https://www.copy.com/s/i0LSL1n8A6QC/ColdFusion%20Installs - I'll let you decide lol. I have also tried to update the read me file, and will continue to do so, that way news and updates will be easily available, and credit can be given, without having to blog about it. 

The interesting news that relates to the repo lately, which might spur some traffic, was the fact that ColdFusion 11 seemed to launch out of the blue almost are a very short Public Beta, and the ColdFusion 10 installs disappeared very suddenly from the Adobe website. During some Twitter discussions, which of course are gospel, since this is how all top level business is done these days, Adobe confirmed that there were some legal issues that arose with ColdFusion 10, and that is part of the reason why ColdFusion 10 has been removed from the downloads section. When I read this in the release notes for ColdFusion 11, I quickly ensured the repo has all the versions of CF10, and sure enough, they were gone from Adobe in a flash. Whether or not CF11 released ahead of schedule because of this legal action or not, fear not, the ColdFusion Install Repo has all the CF10 installs for you.

Do you have a older install laying around, want to add it to the repo, let me know @gpickin on twitter, and I can get you access.
Unfortunately, even Copy.com is still developing the features, or I am a bigger moron than I thought, but I found it impossible to share the copy.com folder's admin rights, so if you are wanting to contribute, contact me @gpickin on twitter, and I'll add you to a dropbox folder, where I'll migrate the updates into copy.com. If anyone knows how to share a free accounts folders admin rights, let me know that too.

http://tinyurl.com/cfdownloads

21
May 2014

Gavin Pickin

Techie Gotchas - Debugging Code - How important is it to a Programmer?

CFML Language, Chit Chat, Conferences, Dependency Injection, Techie Gotchas, WireBox

It seems as programmers, we're always writing code, but as Dan Wilson said in one of his great sessions at cf.Objective() last week, we spend only a small fraction of our time writing new code, we spend most of it debugging, fixing and reading code. Thats not something you normally think about, but it aligns with my thinking recently, about what makes a good programmer. Being involved with teams for some time now, albeit small teams, adding new members is something which is constantly on the horizon, and the more I think about it, one of the biggest signs of a good programmer is the ability to spot bugs and problems with code. If you're fixing, debugging, or just trying to read code, it makes sense that reading and understanding the code is the most important thing. Now, whether you agree or not, why am I writing this today? 

I have been re-writing and integrating a lot of cool new things into our codebase at work, and its fun, although slower than normal, because creating conventions as you go requires a lot of conversation, and almost 2 steps back 1 step forward progress. Changing so much so quickly has got me debugging a lot more code than normal, as I go out of my comfort zones, and it reminded me of some of the quirks when debugging, and I thought I'd share them, and invite others to comment on their own debugging stories, lessons etc.

I know I have before talked about misleading error messages, but that is what throws a spanner at me more than anything else, so of course it comes up again. Of course, debugging is full of stupid mistakes, and I'm happy to share my stupid mistakes, because guess what, I make a lot of them, but I pride myself on spotting them and fixing them quickly, and keeping the work going. Yesterday, after coming off the Into the Box and cf.Objective() high, my brain escaped me for a while, and I was having some issues with my simple dao.

Example 1

I was passing in an Integer, doing a simple get query, with a integer query param, and returning the query.

<cffunction name="get" returntype="query" output="false" description="Gets an Address">
    <cfargument name="addressID" required="true" type="integer">
    <cfset var="" q="">
    <cfquery name="q">
        SELECT
        addressID,
        address
        FROM address
        WHERE addressID = <cfqueryparam value="#arguments.addressID#" cfsqltype="CF_SQL_INTEGER">
    </cfqueryparam></cfquery>
    <cfreturn q="">
</cffunction> 

Now of course, this is a simple issue, and I blame my brain not being fully engaged, but what threw me was the error message.
I'm on CF9 for this application, hence the tags for queries, but the error message stated (paraphrasing but close enough)

The variable addressID being passed into get is not of type integer.

I checked my code that was calling it, verified, and then clicked.

The variable is of type integer, but thats not a valid type to check for in cfargument. It should be numeric. Of course, since I was in the DAO, I was thinking integer integer integer, but the error message threw me off. Sometimes, you have to trust your gut and use your code smell to sniff out the real problems, because sometimes the error messages are as sloppy as your code.

Example 2

The next issue I was having, was while using Wirebox. Wirebox is a pretty slick product, and I am loving using it, it is pretty non intrusive, and as little as we are using it so far, its making life easier daily. I wish we had everything using it, but baby steps, and legacy is brittle, so lets not rush it. Now, when WireBox's config runs, it preps them, ready for use. I was getting an interesting message (which since it is open source, I might have to dive in and update this), but when it was doing the prep, it would give me an error message stating my AddressDAO was not of type AddressDAO. I looked at it, the file is named AddressDAO, I have my component name at the top matching, I am returning the type AddressDAO from the Init function, which I thought was weird. What else could effect this? In the spirit of debugging, if it errors because its looking for a given type, change it to any, and see what happens.

Do you know what happened?

BIG FAT ERROR. 

Yup, it was me, sloppy me again, I had an error, but when it tried to do the prep, it didn't tell me there was an error, it just didn't Init right, and pass back the right object, it caught the error, but then it threw a type error.

So, I'll hunt down that piece of code, and maybe append something to the message which states that the CFC itself might have compilation errors or something.

The lesson learned was, just because you get an error message, it might be more under the covers.
Of course there are lots of useless error messages in languages, its funny how you learn them over time… but sometimes, they can throw a spanner at you.

What are some of the weirdest misinformational errors you have seen with ColdFusion?

My worse, apart from the cfarguments, was problem the cffile, if the Destination is invalid, it complains that the Source File is invalid… obvious copy and paste and didn't change the error there.

 

Share the despair :)

Gavin

15
May 2014

Gavin Pickin

Multi CFML Engine Install - Extracting the ColdFusion 9 Connector for Apache

CFML Server, Server Admin

We are going to setup apache with virtual hosts to deliver multiple CFML engines.
To do so, we need to setup the cfml engine adapters / connectors, 1 by 1, and remove their connector code from the main httpd.conf and then include that connector string in the Vhosts themselves, while leaving any LOAD MODULE code in the main httpd.conf, because we only want to load the module once, and because you cannot load modules in a Virtual Host. This way, we can designate which sites use what connector. Lets do ColdFusion 9.

Apache Test File

To test we're going to use a page called index2.cfm
Go to our apache root, /home/www/default (in our case)
nano index2.cfm

<h1>Apache Root</h1>
<cfdump var="#server#">

CTRL X
Y
[ Enter ]

No, lets try the page

http://[machinename]/index2.cfm
Apache displayed the source of the page, because its not prepared to server the CFML in it, it just shows it.

Ok, so now, we're going to setup one of our CFML Engines.

Pre Connector for ColdFusion

First we have to make sure we have https-devel installs
yum install httpd-devel

Fixing the Adobe Connection Shell

On centos you need to edit the coldfusion9/bin/connectors/apache_connectors.sh

Originally is….
../../runtime/bin/wsconfig \
        -server coldfusion \
    -ws apache \
        -dir /usr/local/apache2/conf \
        -bin /usr/local/apache2/bin/httpd \
        -script /usr/local/apache2/bin/apachectl \
        -coldfusion

exit $#

This refers to /usr/local/apache2 as the location of apache.
Update it to /etc/httpd instead for the -dir line,
 -bin line should be /usr/sbin/httpd
The -script line needs to point to the bin, so update it to /etc/rc.d/init.d/httpd

../../runtime/bin/wsconfig \
        -server coldfusion \
    -ws apache \
           -dir /etc/httpd/conf \
    -bin /usr/sbin/httpd \
    -script /etc/rc.d/init.d/httpd \
        -coldfusion
    -w64
    -v

exit $#

Compiling the Connector

Run it by ./apache_connectors.sh
If you get a GCC not found error, you might have to install some development tools,  to allow you to build the connector.
yum groupinstall 'Development Tools'

Run it again, and it will compile.
If you care what it MIGHT say, this is what it told me :)


CentOS release 6.4 (Final)
Server's Module Magic Number: 20051115:25.  Supported major magic numbers on this platform are 20020628 and 20020903.
Attempting to build connector from sources
Server version: Apache/2.2.15 (Unix)
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.lo /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.slo
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_maptable_impl.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_maptable_impl.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_maptable_impl.slo
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_mutex.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_mutex.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_mutex.slo
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_property.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_property.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_property.slo
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_proxy.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_proxy.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_proxy.slo
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_session.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_session.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_session.slo
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_utils.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_utils.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_utils.slo
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -w  -c -o /opt/coldfusion9/runtime/lib/wsconfig/1/platform.lo /opt/coldfusion9/runtime/lib/wsconfig/1/platform.c && touch /opt/coldfusion9/runtime/lib/wsconfig/1/platform.slo
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    /opt/coldfusion9/runtime/lib/wsconfig/1/platform.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_utils.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_session.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_proxy.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_property.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_mutex.lo /opt/coldfusion9/runtime/lib/wsconfig/1/jrun_maptable_impl.lo /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.lo
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.la /opt/coldfusion9/runtime/lib/wsconfig/1/
/usr/lib64/apr-1/build/libtool --mode=install cp /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.la /opt/coldfusion9/runtime/lib/wsconfig/1//
libtool: install: cp /opt/coldfusion9/runtime/lib/wsconfig/1/.libs/mod_jrun22.so /opt/coldfusion9/runtime/lib/wsconfig/1//mod_jrun22.so
libtool: install: cp /opt/coldfusion9/runtime/lib/wsconfig/1/.libs/mod_jrun22.lai /opt/coldfusion9/runtime/lib/wsconfig/1//mod_jrun22.la
libtool: install: cp /opt/coldfusion9/runtime/lib/wsconfig/1/.libs/mod_jrun22.a /opt/coldfusion9/runtime/lib/wslibtool: install: warning: remember to run `libtool --finish /usr/lib64/httpd/modules'
config/1//mod_jrun22.a
libtool: install: chmod 644 /opt/coldfusion9/runtime/lib/wsconfig/1//mod_jrun22.a
libtool: install: ranlib /opt/coldfusion9/runtime/lib/wsconfig/1//mod_jrun22.a
chmod 755 /opt/coldfusion9/runtime/lib/wsconfig/1//mod_jrun22.so
Stopping httpd: [  OK  ]
Starting httpd: [  OK  Restarted Apache server
The Apache connector was installed to /etc/httpd/conf
]
./apache_connector.sh: line 17: -w64: command not found
./apache_connector.sh: line 18: -v: command not found

What does it do. Lets have a look at the new https.conf

DirectoryIndex - it adds index.cfm to the end of the line. Re-order this if you want or need to.


It will also add the connector module, which it compiles, and creates on your machine... as you can see by looking closely at the LoadModule line.

# JRun Settings
LoadModule jrun_module /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so

<IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ignoresuffixmap false
    JRunConfig Serverstore /opt/coldfusion9/runtime/lib/wsconfig/1/jrunserver.s$
    JRunConfig Bootstrap 127.0.0.1:51011
    #JRunConfig Errorurl url <optionally redirect to this URL on errors>
    #JRunConfig ProxyRetryInterval 600 <number of seconds to wait before trying$
    #JRunConfig ConnectTimeout 15 <number of seconds to wait on a socket connec$
    #JRunConfig RecvTimeout 300 <number of seconds to wait on a socket receive $
    #JRunConfig SendTimeout 15 <number of seconds to wait on a socket send to a$
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>

Lets Test the Connector

Test the connector, to make sure it works, for your default website
http://[machinename]/index2.cfm
Apache and server dump shows up… wait, what?

Yes, CF runs the files served from the same vhost as apache.

It we go to http://[machinename]:8500/index2.cfm
We get a cold fusion missing file error… because index2.cfm is not in /opt/coldfusion/wwwroot
If you go to 8500, you're forcing the built in CF Webserver to serve files.

So, Adobe Coldfusion does make setting up hosts easier, once its setup in Apache, and the Adobe Coldfusion connector is attached to the host, it will work.
Railo, you need to setup the host in tomcat as well.
More flexibility, but more complexity, but the AJP is much easier to connect than all the compilation from Source.

But we're done, now we have all of the connectors.

Extract the Connector

So, go and CUT the 2nd part of the code out of the https.conf , and save it for later.

Cut the following into inc_cf9_module.inc
# JRun Settings
LoadModule jrun_module /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so

Cut this piece into a separate file called inc_cf9_conn.inc - Remember, your OS and pathing affects this, so you cannot just copy this.

<IfModule mod_jrun22.c>
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ignoresuffixmap false
    JRunConfig Serverstore /opt/coldfusion9/runtime/lib/wsconfig/1/jrunserver.store
    JRunConfig Bootstrap 127.0.0.1:51011
    #JRunConfig Errorurl url <optionally redirect to this URL on errors>
    #JRunConfig ProxyRetryInterval 600 <number of seconds to wait before trying $
    #JRunConfig ConnectTimeout 15 <number of seconds to wait on a socket connect$
    #JRunConfig RecvTimeout 300 <number of seconds to wait on a socket receive t$
    #JRunConfig SendTimeout 15 <number of seconds to wait on a socket send to a $
    AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>

Then restart apache
service httpd restart
Then test again, and you should just see the file source code again.

Ok, now we have our CFML Engine Connector Code separated, and tested… we're ready to setup vhosts.. and include the various files depending on the engine of choice... check back for that post soon.

 

 

15
May 2014

Gavin Pickin

Multi CFML Engine Install - Extracting the Railo Connector for Apache

CFML Server, Server Admin

We are going to setup apache with virtual hosts to deliver multiple CFML engines.
To do so, we need to setup the cfml engine adapters / connectors, 1 by 1, and remove their connector code from the main httpd.conf and then include that connector string in the Vhosts themselves, while leaving any LOAD MODULE code in the main httpd.conf, because we only want to load the module once, and because you cannot load modules in a Virtual Host. This way, we can designate which sites use what connector. Lets do Railo.

Apache Test File

To test we're going to use a page called index2.cfm
Go to our apache root, /home/www/default (in our case)
nano index2.cfm

<h1>Apache Root</h1>
<cfdump var="#server#">

CTRL X
Y
[ Enter ]

No, lets try the page

http://[machinename]/index2.cfm
Apache displayed the source of the page, because its not prepared to server the CFML in it, it just shows it.

Ok, so now, we're going to setup one of our CFML Engines.


First, we will connect Railo A

Mark Drew mentioned a couple of different ways to connect to railo in the google groups
Link: https://groups.google.com/forum/#!topic/railo/K7wrHYqdeyA

Simple way, just proxy to the AJP port (remember when we installed we set 3 different ports)
<Proxy *>
Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8021/$1$2

When you install Railo and ask it to add the connector, it adds the following code to the https.conf file
This depends on if you select to install the connector.

<IfModule mod_proxy.c>
<Proxy *>
Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ http://127.0.0.1:8888/$1$2
ProxyPassMatch ^/(.+\.cfchart)(/.*)?$ http://127.0.0.1:8888/$1$2
ProxyPassMatch ^/(.+\.cfres)(/.*)?$ http://127.0.0.1:8888/$1$2
ProxyPassMatch ^/(.+\.cfml)(/.*)?$ http://127.0.0.1:8888/$1$2
# optional mappings
#ProxyPassMatch ^/flex2gateway/(.*)$ http://127.0.0.1:8888/flex2gateway/$1
#ProxyPassMatch ^/messagebroker/(.*)$ http://127.0.0.1:8888/messagebroker/$1
#ProxyPassMatch ^/flashservices/gateway(.*)$ http://127.0.0.1:8888/flashservices/gateway$1
#ProxyPassMatch ^/openamf/gateway/(.*)$ http://127.0.0.1:8888/openamf/gateway/$1
#ProxyPassMatch ^/rest/(.*)$ http://127.0.0.1:8888/rest/$1
ProxyPassReverse / http://127.0.0.1:8888/
</IfModule>


PerlRequire /opt/railoa/tomcat_connectors/mod_cfml/mod_cfml.pm
PerlHeaderParserHandler mod_cfml
PerlSetVar LogHeaders false
PerlSetVar LogHandlers false
PerlSetVar CFMLHandlers ".cfm .cfc .cfml"

What connector should we use?

Lets go with the first one, since it will help us when we go to CLUSTER our Railo Instances.
Add the following code (assuming railoa is running and on 8021)

Use CTRL V repeated until you're at the bottom of the page.
Right above the Includes we added, insert this code.
<Proxy *>
Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8021/$1$2

Save the https.conf

CTRL X
Y
[ Enter ]


To use the AJP adapter, you need to make sure the module is loaded.
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

 

Restart apache,
service httpd restart
and run our test page http://[machinename]/index2.cfm
You will get a missing include railo error. Why?
When apache passes the request to Tomcat, tomcat translates that request into its own set of websites. Remember tomcat is a full fledged web server itself, some use it in production, but most people still recommend apache… although a lot are moving to nginx (pronounced EngineX).
Because we want to use ACF9 and Railo and a Railo Cluster, it makes perfect sense to use apache to serve non cfml files, and load balance the cfml requests too.
Lets try something else.
Lets try http://[machinename]/test.cfm
Apache doesn't have a test.cfm… in its root… but Railo does, so what do you think happens?

Apache 404?
Nope, since Apache knows it is CFML, Apache doesn't check to see if the file exists, it just passes the request to Tomcat… and it shows the page we first created in the previous Article installing Railo.

If you go to http://[machinename]:8501/filename.html Tomcat is handling all the requests… images, css, pdf, anything in your webpage.

When you go to http://[machinename] you are using port 80… so Apache handles everything, except CFML, when the https.conf or vhosts are setup right.
Detour over.

So now, lets make index2.cfm in the railo default root.
/opt/railoa/tomcat/webapps/ROOT/index2.cfm
<h1>Railo A</h1> <cfdump var="#server#"> will suffice for now.

You should see Railo's Dump Stylings, and cold fusion.rootdir = /opt/railoa/tomcat/webapps/root
Copy out that part of the conf and save it as inc_railo1_conn.inc

Multi Instances of Railo

Lets edit the ajp port, and test Railob with port 8022
Make the same equivalent index2.cfm in the railob's path, and refresh the browser to test it.
copy out railob

<Proxy *>
Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8022/$1$2

railoc
<Proxy *>
Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8023/$1$2

Railo Cluster
We'll look at this another time, but basically, you just set all the ajp hosts for all the tomcat instances you want to use in the cluster… and it proxies the request.
There are more settings to tweak, but this will work for now.

<Proxy balancer://mycluster>
BalancerMember ajp://localhost:8021/ route=node1 loadfactor=1
BalancerMember ajp://localhost:8022/ route=node1 loadfactor=1
ProxySet lbmethod=byrequests
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.*\.cf[cm]/?.*)$ balancer://mycluster/$1 nofailover=On

Restart Apache
service httpd restart
Now view http://[machinename]/index2.cfm
Now, refresh several times, you should see a 50/50 split approximate of Railo A's page, and Railo B's page. No Railo C, because we didn't include that BalanceMember.
Ok, copy out the code… and put that aside.

Ok, the easy part is done… ready for the tough stuff?
Now, lets GET the COLDFUSION config.

Lets do that in another post :)

 

15
May 2014

Gavin Pickin

Multi CFML Engine Install - Editing Server.XML for Tomcat VHosts

CFML Server, Server Admin

To make editing your Server.xml easier, I'm going to show you a trick, so you can include another file, into your server.xml, so you can add Virtual Hosts (or other settings if you like) so you dont have to edit your Server.XML file so often. This can be useful for automation, or just locking down certain pieces of the server.xml, or just convenience.

If you have followed along, in other Linux Installs, I have put my Web files in /home/www but you can put them wherever you like. I like to keep them all together, so _settings in my websites folder holds various settings on and config files... this is no different.

Added a folder for settings /home/www/_settings
Inside there, create a file, and then we will setup the server.xml file to include this file

nano railoa-tc-vhosts.xml

Put this in the file

<Host name="127.0.0.1" appBase="webapps">
        <Context path="" docBase="/opt/railoa/tomcat/webapps/ROOT" />
</Host>
<Host name="localhost" appBase="webapps">
        <Context path="" docBase="/opt/railoa/tomcat/webapps/ROOT" />
</Host>


CTRL X
Y
[ Enter ]

Adding the Magic to include the file into your Server.xml

Go back to server.xml in /opt/railoa/tomcat/conf/server.xml

Edit the top of the file so it looks like this

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE server-xml [
  <!ENTITY vhosts-config SYSTEM "file:///home/www/_settings/railoa-tc-vhosts.xml">
]>

What we have done, is created a variable, called vhosts-config, and we have loaded the contents of the System file, into that variable. Now, we just need to output that variable, into the server.xml where we want it.

Update our Server.xml's default host

At the start of the Engine definition, the default host is defined.
    <Engine name="Catalina" defaultHost="127.0.0.1">

So the 127.0.0.1 host record will be the default.
Lets update the host record in this file, so it doesn't match, and the vhost record we just created will be the default host.

Go down to the middle of the file, where you see the First Host record, for 127.0.0.1
This looks like this

      <Host name="127.0.0.1"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

To deactivate this Host record, so you can control everything through our vhosts file, update the ip, to something else, like 127.0.0.100

      <Host name="127.0.0.100"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">


Below that host entry is a another host, for localhost.
I comment that out, so we can control everything from vhosts.

<!--
      <Host name="localhost" appBase="webapps">
        <Context path="" docBase="/opt/railoa/tomcat/webapps/ROOT/" />
      </Host>
-->

Adding the vhosts-config variable into the server.xml Page

Go down to the bottom of the file… and right above the SAMPLE VHOSTS

insert &vhosts-config; so it looks like this

        &vhosts-config;


     <!--   HOST ENTRY TEMPLATE:
        <Host name="[ENTER DOMAIN NAME]" appBase="webapps">
             <Context path="" docBase="[ENTER SYSTEM PATH]" />
             <Alias>[ENTER DOMAIN ALIAS]</Alias>
        </Host>
      -->


    </Engine>
  </Service>
</Server>

Now, we can programmatically alter the vhosts.xml file, giving permissions to those files, without compromising our main server.xml file.

Multiple Railo Instances

If you have a multiple Railo Instance setup, you can copy the railoa-tc-vhosts.xml to b and c, and update the internals accordingly.
Go back and edit the server.xml as described above, and all railo server.xml files will be setup to allow us to easily add and remove hosts as needed.

If you are running a cluster of multiple Railo Instances on the same box, they can all include the same vhosts.xml so you don't have to update it for each instance, another advantage of this approach.

Remember, Tomcat needs to restart whenever you change your configuration.

Hope this helps.

Gavin

 

 

 

15
May 2014

Gavin Pickin

Multi CFML Engine Install - Installing CF9 on Linux - Centos

CFML Server, Server Admin

Installing CF9 on Linux, as part of the Multi CFML Engine Series, will show you how to install CF 9 on linux, keeping a couple of key pieces in mind, so we can have apache connect to each engine, based on the Virtual Host.

Configuration Conventions

I am using /home/www for all of my Websites, Config, Settings etc, so you'll see that path a lot.
/home/www/_settings will hold downloads settings etc.
You dont have to follow these, but for this documentation, thats how I will do it.

References and Other Guides

I found this guide by Aaron really nice, but i have a few differences, here and there, I'd recommend reading this too. I think Aaron explains it better than I do. Consider my guide, the quick guide… look up his guide for more details.
http://www.aaronwest.net/blog/index.cfm/2011/2/7/Super-Guide-Installing-ColdFusion-9-on-CentOS-Linux

We are doing a single instance install, so it differs somewhat… I'll try and highlight the "differences" as I go, so they're obvious.

Setup ColdFusion User

Create a linux user for Coldfusion Service to run as. We have to do this before we start the installation, so lets add a user now. Name it to match the version, as we'll install CF 10 and CF 11 in future posts.

useradd cfusion9

For security purposes, we want to make sure these accounts are locked down, so we need to disable SSH and FTP login for the Coldfusion User Account.

nano /etc/passwd

Look for the line with cfusion9… should be at the bottom of the file.
Update the line to go from
cfusion9:x:502:503::/home/cfusion9:/bin/bash
to
cfusion9:x:502:503::/home/cfusion9:/sbin/nologin

CTRL-X        -to exit the file
Y                  - to save the file
[ Enter ]        - to save the file with the same name

Downloading the File

Assuming your have 64 bit Centos installed, we'll go ahead and get the 64 bit bin file (linux .bin), and prepare to install now.

Looking at Adobe's website https://www.adobe.com/support/coldfusion/downloads_updates.html#cf9

This is the link we'll use to get the file
http://download.macromedia.com/pub/coldfusion/cf9_installer/ColdFusion_9_WWEJ_linux64.bin

I have a ColdFusion Install Repo, read more on my blog about that, where I keep as many old install files as possible around, so you do not have to worry when Adobe drops them from their site.

i like to keep my files together, so i'm going to make a folder for downloads like this
mkdir /home/www/_setup/downloads
cd /home/www/_setup/downloads
wget http://download.macromedia.com/pub/coldfusion/cf9_installer/ColdFusion_9_WWEJ_linux64.bin

Get a drink while the file downloads.
Aaron shows you how to use scp from his macbook to his server, but this is more universal, since most machines will get wget (if not, yum it )

Dependencies before Installing

Install the required libstdc++/so/5 C++ library.
This is required by cf8 and cf9 for certain features.

Use Yum to install it with this comment
yum install libstdc++.so.5
Press y to confirm.

Installation

Now that we have everything setup, lets install.
Make the bin file executable
chmod +x ColdFusion_9_WWEJ_linux64.bin

Now lets execute it
./ColdFusion_9_WWEJ_linux64.bin


Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

Preparing CONSOLE Mode Installation...

===============================================================================
Adobe ColdFusion 9                               (created with InstallAnywhere)
-------------------------------------------------------------------------------



===============================================================================
Introduction
------------

Welcome to the Installation Wizard for Adobe ColdFusion 9

This wizard installs Adobe ColdFusion 9  on your computer or produces an EAR or
WAR file for deployment on your J2EE application server.  Adobe recommends that
you exit from all running applications before proceeding.

Respond to each prompt to proceed to the next step in the installation.  If you
want to change something on a previous step, type 'back'.

You may cancel this installation at any time by typing 'quit'.


WARNING: This program is protected by copyright laws and international
treaties.


PRESS <ENTER> TO CONTINUE:

Press [ Enter ] several times to get through the license agreement.
After you've broken your finger from smashing the keyboard [ Enter ] key, you'll get to the end of it.

Press Y then [ Enter ] to accept the agreement (Rocket Science I know)



===============================================================================
Install Type
------------

If you do not have a serial number, select either 30-day trial or Developer
Edition.

  ->1- Install new version of Adobe ColdFusion 9 with a serial number
    2- 30-day trial
    3- Developer Edition

Installation Choice:

Press 2  [ Enter ] - 30 day trial. You can key in your license number in the CF Admin later.



===============================================================================
Installer Configuration
-----------------------

What kind of installation do you want?

  ->1- Server configuration
    2- Enterprise Multiserver configuration
    3- J2EE configuration (EAR file)
    4- J2EE configuration (WAR file)

Choose one of the following options::

Press 1  [ Enter ] - This setup is a single server setup. You can follow Aarons guide more closely if you want an Enterprise Multiserver Config, but we're doing a single instance here... makes it easier to follow my guides if you do the same.



===============================================================================
Is Adobe ColdFusion 9 (Server Configuration) Installed?
-------------------------------------------------------

You cannot install the server configuration of Adobe ColdFusion 9 if it is already installed on this computer.

Is there already a server configuration of Adobe ColdFusion 9 installed?

    1- Yes
  ->2- No

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT::

Press 2  [ Enter ] - We have no other copies, we assume you don't either.



===============================================================================
Subcomponent Installation
-------------------------

The following options are available for installation.

An option marked with "[X]" in front will be installed and an option with "[ ]"
will not.  Choosing an option will toggle it on or off

[X] 1) ColdFusion 9 Documentation
[X] 2) ColdFusion 9 Solr Services
[X] 3) Start ColdFusion on system init

    4) Continue with installation


Select the subcomponents to install:

We are going to turn off Documentation, at this time… but we will leave Solr and Start CF on system init.
So we press 1 [ Enter ] and it reloads and we press 3 [ Enter ] and it reloads again until we're happy with the options.


 

===============================================================================
Subcomponent Installation

[ ] 1) ColdFusion 9 Documentation
[X] 2) ColdFusion 9 Solr Services
[X] 3) Start ColdFusion on system init

    4) Continue with installation


Select the subcomponents to install:

We press 4  [ Enter ] to proceed with install



===============================================================================
Choose Install Folder
---------------------

Select the directory where you want to install Adobe ColdFusion 9.

Directory:

  Default Install Folder: /opt/coldfusion9

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
      :

You can choose your install folder here, we're going with the default.
[ Enter ] to proceed.


===============================================================================
Earlier Versions of Adobe ColdFusion installed?
-----------------------------------------------

If you installed an earlier version of ColdFusion on this computer, you can migrate your settings to Adobe ColdFusion 9.

Is there an earlier version of ColdFusion installed on this computer (for example, ColdFusion 6 or ColdFusion MX 7)?

    1- Yes
  ->2- No

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT::

We assume this is a clean install, so we press 2 [ Enter ]


===============================================================================
Configure Web Servers
---------------------

Please configure your web server(s).  If you do not configure a web server the
built-in web server will be used on port 8500 or the next available port.

    1- Add Web Server Configuration
  ->2- Continue with installation

Choice:

We are going to configure later, as we have to modify the configuration script… so press
2 [ Enter ]


===============================================================================
Runtime User
------------

Enter the name of the runtime user.   This user must already exist on the system.

User Name: (DEFAULT: nobody):

This is where you enter the cold fusion user you setup earlier.
In our case, the user was cfusion9
So type in
cfusion9        [ Enter ]


===============================================================================
Configure ColdFusion with OpenOffice
------------------------------------

Configuring OpenOffice installation with ColdFusion will enable Office documents to be processing using OpenOffice. If OpenOffice is not configured ColdFusion will not be able to convert some Microsoft Office Documents to PDF. Check the documentation for more details.

    1- Configure ColdFusion with local Openoffice installation
  ->2- Skip

ENTER THE NUMBER FOR YOUR CHOICE, OR PRESS <ENTER> TO ACCEPT THE DEFAULT::

We do not want OpenOffice, but its up to you if you want it, so I will press 2  [ Enter ]


===============================================================================
Administrator Password
----------------------

Enter the password that you will use to restrict access to the ColdFusion
Administrator.

This field is required.

Password:    

Enter your choice for your Admin Password
IAmNotThatEasy      [ Enter ]
Confirm the password and proceed


===============================================================================
Enable RDS
----------

The ColdFusion Remote Development Service (RDS) lets developers using Adobe
tools remotely connect to this server for development purposes. RDS is required
for Line Debugging, Report Builder, and Dreamweaver Extensions.

If this is a production server, Adobe recommends that you disable RDS.
Note, however, that disabling RDS also disables debugging, the directory
browsing applets in the ColdFusion Administrator and some of the functionality
in the Report Builder.

Enable RDS  (Y/N):

This is your choice… but usually it is recommended to turn off RDS… for security reasons.
If you say yes, it will ask you for a password.

N        [ Enter ]


===============================================================================
Pre-installation Summary
------------------------


Installation Type:
  Server configuration

Licensing:
  30-day trial

Installation Directories:
  Product: /opt/coldfusion9
  Web root: /opt/coldfusion9/wwwroot

Server Information:
  Web Server: Built-in web server
  Port: 8500
  ColdFusion Solr Search Services: installed
  Documentation: not installed
  RDS: disabled

Disk Space Information (for Installation Target):
  Required: 590,261,953 bytes
  Available: 48,155,537,408 bytes

PRESS <ENTER> TO CONTINUE:
Press [ Enter ] to continue, or if its wrong, I believe you can type quit [ Enter ] or press CTRL C to cancel it. You will have to start again with the installation, there is no way to change a setting.
Now, it will install.
You can see pretty console progress bars, and everything is good in the world :)


===============================================================================
Installation Complete
---------------------

You have successfully completed the first step in installing Adobe ColdFusion
9.

To continue with your installation, go to /opt/coldfusion9/bin and type
"./coldfusion start" to start your server.

Once the server, is started log in to the Configuration Wizard at
http://[machinename]:8500/CFIDE/administrator/index.cfm

Press Enter to exit the installer:
Press [ Enter ] to exit.


Start the server.
cd /opt/coldfusion9/bin
./coldfusion start

if your server has a firewall, unblock port 8500, and then view the cf admin at http://[machinename]:8500/CFIDE/administrator/index.cfm

Sometimes, it takes a while for the first request.
You might get a 500 There is no web application configured to service your request.

Try again shortly.
Login with the CF Admin password you made.
After a couple of minutes, you'll see the Admin Interface come up, and we're installed.

Next, we want to update CF.
We are using 9.0.2, the latest major update (Aarons article only refers to 9.0.0 and 9.0.1 )
It helps you maintain security updates, and is  Unofficial Updater 2… http://www.uu-2.info/
Scott Stroz (from cfhour ) swears by it… although he swears by and about a lot of things :) Check out cfhour.com - quality show - if you can get past the self indulgent dribble (running joke).

ColdFusion on Startup

You can write your own startup script, the CF one isn't bad, but if you want to write your own, you can follow this.

Next we'll set it up so cold fusion starts on boot
Since we're doing a single install, not multi like Aarons article, this is different.
These are the 3 commands that you can use with your cold fusion setup now, lets make them into a service.
/opt/coldfusion9/bin/coldfusion start
/opt/coldfusion9/bin/coldfusion stop
/opt/coldfusion9/bin/coldfusion restart
# Navigate to the /etc/rc.d/init.d directory
cd /etc/rc.d/init.d

# Create a new file that functions as the service.
# Use cfusion9 where that will be the name of your service.
nano cfusion9
# ---------------- start of file below this line
#!/bin/bash
#
# Startup script for ColdFusion
# chkconfig: 345 90 14
# description: Start/stop ColdFusion as service
#
#INSTANCE_NAME="your_instance_name"
# Source function library.
. /etc/rc.d/init.d/functions
#
case "$1" in
start)
echo -n "Starting CFUSION9: "
/opt/coldfusion9/bin/coldfusion start &
echo
;;
stop)
echo -n "Shutting down CFUSION9: "
/opt/coldfusion9/bin/coldfusion stop
echo
;;
restart)
echo -n "Restarting CFUSION9"
/opt/coldfusion9/bin/coldfusion restart &
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
# ---------------- end of file above this line

Update the paths where necessary if you chose to install cold fusion in another location.
Close and save the file
CTRL X
y [ Enter ]

Make it executable
chmod +x cfusion9

add the script as a service
chkconfig --add cfusion9

reboot the machine, and test to see if it is working.
Reboot

when it boots back up, you can type
service cfusion9 status
since we did not create a status command, it just shows you how to use it… and lets you know you can use start, stop, or restart.
You can edit the echoes to make them more readable

What's Next?

We still need to configure apache, so we can use coldfusion9 for the vhosts we want it to run.
We'll do that in a future article, along with the other engines, and show you how to setup apache to use different engines for different websites.

15
May 2014

Gavin Pickin

Multi CFML Engine Install - Installing Railo on Linux - Centos

CFML Server, Server Admin

Some configuration to be aware of

I am going to install all of my Websites, Configuration, all in a Home directory of one user, to make it easier for permissions, backup, configuration.

So /home/www is going to be my User directory.
Settings will go under /home/www/_settings

You can obviously create your own conventions, but this is the basis for what I am doing.

First, lets download the file.

I'm assuming you are running 64 bit Centos, so we get the link from the website GetRailo.org

I like to keep my files organized, so i'm going to
cd /home/www/_settings/downloads
wget http://www.getrailo.org/down.cfm?item=/railo/remote/download/4.0.4.001/tomcat/linux/railo-4.0.4.001-pl2-linux-x64-installer.run&thankyou=true

It has a little extra fluff on their link, as it shows you a form through a browser, but wget is pretty slick, and its downloading away once it finds the right place for the file.

Setup Users before Installing

Like ColdFusion installs, when installing, you have to have a pre-existing User, so we'll go ahead and add them now, before starting the installation.
Add our users that railo will run under.... assuming we might want more than one instance, lets make users for each now.

useradd railoa
useradd railob
useradd railoc

Now, to make managing permissions easier, we'll create a group called webservices or cfmlservices or something that can belong to, and we'll give that group permissions to the /home/www folder. The following command makes that group the main group for each user.

usermod -a -G webservices railoa
usermod -a -G webservices railob
usermod -a -G webservices railoc

When adding a user, we also want to make sure we lock them down, so they can't SSH in, so lets edit the passwd file, and update their settings.

Nano /etc/passwd

Change the new user's /bin/bash to /sbin/nologin

Save and exit the file when you're done.
CTRL X
Y
[ Enter ]

Running the Installation

We have downloaded the file, but before we can run it, we need to make the bin executable, so chmod to change permissions on the file, using +x to add x or execute permissions on the file... then we can run it.

chmod +x railo-4.0.4.001-pl2-linux-x64-installer.run

./railo-4.0.4.001-pl2-linux-x64-installer.run

Installation Screens

The following section is a step by step walk through of the screen. I'm going to enter my instructions in BOLD below each page, with a HR to make it easier to see.


Language Selection

Please select the installation language
[1] Simplified Chinese - ????
[2] Traditional Chinese - ????
[3] Dutch - Nederlands
[4] English - English
[5] French - Français
[6] German - Deutsch
[7] Italian - Italiano
[8] Polish - Polski
[9] Brazilian Portuguese - Português Brasileiro
[10] Romanian - Român?
[11] Spanish - Español
Please choose an option [4] :

I am assuming english.
Press 4 then [ Enter ]



Welcome to the Railo Installer.

 

----------------------------------------------------------------------------
Please read the following License Agreement. You must accept the terms of this
agreement before continuing with the installation.

Press [Enter] to continue :

Press [ Enter ] [ Enter ] and Y to agree to the terms.



----------------------------------------------------------------------------
Please specify the directory where Railo will be installed.

Installation Directory [/opt/railo]:

We are setting up multiple instances, so we're going to match location with instance name.
Opt seems to be the new place to install "external" applications, not installed with YUM etc, so we'll keep that convention. You might want to change the path slightly, so its not the same as everyone else, but this will work for this documentation
/opt/railoa


----------------------------------------------------------------------------
Tomcat Administrator Login

Tomcat includes a web interface that can be used to manage some aspects of your
Tomcat server. Please enter the username and password that you would like to use
to access that web based administrator.

Tomcat User: [admin]:

We're going to setup specific users for our instances, so instance name, railoa and then tomcatadmin, or something similar, again, change for security
railoatomcatadmin


Tomcat Password: :
Tomcat Password (confirm):  :
-------------------------------

Enter and confirm your password, this will allow you to login to the Railo SERVER and WEB admin, so remember this.



----------------------------------------------------------------------------
Tomcat Ports

Tomcat needs to reserve "ports" on your computer in order to serve various types
of requests. You can customize those ports using the fields below. If you are
unsure, the default values provided below are perfectly safe to use.

Tomcat Web Server Port: [8888]:

We're going to setup our instances with certain ports? so lets use 8501 for a, 8502 for b etc? but you can use the default, just remember some system for numbering them all, including your CF, so you can get them all to talk to each other and not clash.

8501 [ Enter ]

Tomcat Shutdown Port: [8005]:

You can use the default, again, we're going to assign a port for each instance, so 8000 + the version
8001 for a, 8002 for b, etc 8009 for CF9, 8010 for CF10, 8011 for CF11.


Tomcat AJP Port: [8009]:

You can use the default, again, we're going to assign a port for each instance, so 8020 + the version
8021 for a, 8022 for b, etc 8029 for CF9, 8030 for CF10, 8031 for CF11.


Tomcat System User

Enter in the System User Account that Tomcat will run under. Running as "root"
or "Administrator" on Windows will avoid system permission problems, while
running as a non-root user will add an additional layer of security. If you
choose to run as a non-root user, we recommend using a easily identifiable
username like "railo" or "cfml".

 [root]:
We're using the user railoa railob etc for our instances. Added prior to installation.


----------------------------------------------------------------------------
Start At Boot?

Do you want Railo to start up automatically whenever the system boots up?

Yes, Start Railo at Boot Time [Y/n]:
We will say yes, because I quite like the railo script. After the install, we'll rename the file, so they don't overwrite each other as we install Railo B and Railo C



----------------------------------------------------------------------------
Install Apache Connector?

The Apache connector is needed for most installs. The only time it is not needed
is if you are not using Apache as your primary web server. If you're not sure
what to do here, please install the connector.

Install Apache Connector? [Y/n]:
We want to do the connector manually, so lets say N, and handle that ourselves later.


----------------------------------------------------------------------------
Choose Bit Type

Please verify the bit-type you're wanting to install. Are you running a 32-bit or a 64-bit OS?

Bit Type

[1] 32-bit: 32-bit
[2] 64-bit: 64-bit
Please choose an option [2] :

We assume you are running 64 bit, so lets press 2 and [ Enter ]



----------------------------------------------------------------------------
Setup is now ready to begin installing Railo on your computer.

Do you want to continue? [Y/n]:

Speak now, or forever hold your peace.
Y  [ Enter ]



----------------------------------------------------------------------------
Please wait while Setup installs Railo on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 ########################################
What the ascii art and wait patiently.



----------------------------------------------------------------------------
Setup has finished installing Railo on your computer.


Installing Java7

java -version
If you are running 1.6 or Java6, we'll install Java7

yum install java7
Y     
[ Enter ]

Next, lets look at the startup script.
cd /etc/rc.d/init.d
ls

You should see a file created called railo_ctl.
Since we will have several instances, lets rename this file, so we can have one for a, b, and c.

Lets remove railo_ctl from chkconfig with
chkconfig --del railo_ctl

Rename the file to railoa_ctl
mv railo_ctl railoa_ctl

Lets add this script to chkconfig
chkconfig --add railoa_ctl

We'll set the script to be on at boot
chkconfig railoa_ctl on

Now, we can install the other instances.
Just remember to rename the scripts after the install? or you can copy paste (and modify the references inside the script) and select no on the installs.
Up to you.

 

Make sure your have the ports open? check your firewall, iptables etc.

Lets test the install
Railo A - http://[machinename]:8501/index.cfm
Railo B - http://[machinename]:8502/index.cfm
Railo C - http://[machinename]:8503/index.cfm

You should see the Railo Welcome page. It has some dumped info, and some great links.
Note: You will see images missing. The install seems to always have the images folder missing.

Now, lets make a more informative test file.

cd /opt/railoa/tomcat/webapps/ROOT
nano test.cfm

Add this to the file

<h1>Railo A</h1>
<cfdump var="#server#">
<cfdump var="#cgi#">

browse to http://[machinename]:8501/test.cfm it

Do the same for Railo B and C
This will be useful when we go to test our cluster? to see which instance of Railo is actually being shown.

Now, we have everything setup with Railo, now we can install ColdFusion engines, and then start configuring Apache, to be the Entry Point / Load Balance, managing the CFML Engine to handle the files, and load balance the cluster.

 

 

15
May 2014

Gavin Pickin

Multi CFML Engine Install - speaking at cf.Objective() today

CFML Server, cfObjective, Conferences, Server Admin

Today is the day, I do my large presentation at cf.Objective(), why do I say large? Well, I bit off a lot when I submitted this topic... so trying to fit all of it in, in 50 mins, with time for questions, is almost impossible, so I am going to release a lot of the information on my blog, and I have made a mini website tacked onto my blog, so everyone attending my session have a great reference for after the session. Installing CF 9, CF 10, CF 11, Railo, and then getting them all to work through Apache, if you have that installed, if not, installing Apache, on Mac Linux or Window, is a large chunk of information, so I'm going to try and provide as much assistance with those topics, but my session will focus on how to bring them all together, while just highlighting items to be aware of while installing.

For those of you not at cf.Objective(), or too busy at other great sessions, and I am up against some big sessions today, I hope to make time and re-present my topic with Charlie Arehart on the Online ColdFusion meetup in the near future.

The address for my mini site is www.gpickin.com/cfo2014 [EDITED] - I will keep updating that as I post more information to my blog, and will include links to my slides, and a github repo of a small tool that might make looking after your apache and tomcat conf files a little easier.

Hope to see you all at my session, but if not, have a great one, and hope you enjoy the barrage of content I've been saving up for a while.

13
May 2014

Gavin Pickin

CFML Conference - Into the Box - Keynote Goodies

CFML Language, cfObjective, ColdBox, Conferences

If you did not know, today, the day before cf.Objective(), Ortus Solutions' very own 1 day ColdFusion Conference is going on at the Homewood Suites by Hilton, across the road from the Radison Blu. The event has a large number of community sponsors, speakers from Team Coldbox, and other community members, plenty of goodies, its not hard to believe the conference sold out. I've talked about the event several times on my blog, because I'm speaking today, but also because I have been eagerly awaiting some ColdBox announcements at the keynote, and it did not disappoint.

It has been rumored for a while, that ColdBox was going to work on:

  • De-Modularize the ColdBox Core
  • Package Manager
  • CommandBox - CLI, REPL

Luis confirmed that ColdBox Lite, the ColdBox MVC will now be the new ColdBox. In the past, ColdBox has included all the libraries by default, but with everything these days, the move is to smaller more modular pieces, and only including what you're using. This is a big move for ColdBox, and due to the complexity of dependencies, breaking ColdBox into smaller modules, required the use of a Package Manager, which leads to their next announcement.

ForgeBox 2.0 will be a ColdFusion Package Manager, expanding from basic ColdBox related technologies, to include, any and every CFML library or project. ColdBox will use JSON.BOX files similar to NPM to register Packages to have a central repository for packages, but expanding ForgeBox to allow you to have Private Repos on top of the Public Repo as well. This has been one of the wishes on my wish list for ForgeBox, to allow our apps to use a local private Repo, and the Public repo, to allow our apps to follow the same structure and make it easier to integrate in the future.

With a Package Manager, only accessible through Web APIs, and the Browser, its not really up to par these days, so ColdBox is pushing the envelope again, and is releasing CommandBox, a CFML based CLI and REPL that allows you to run commands for scaffolding, package management tasks, CFC creation, and run code inline like REPLs available in other languages.

CommandBox is only at Alpha 1, available in the next week or two, but the presentation was really impressive. Running on Windows, Mac and Linux, with familiar commands like help, ls and dir… the CommandBox CLI should be easy to pick up for anyone at any level of Command Line experience.

Nested Help and Tab Completion makes it intuitive, and again, written with CFML, we will be able to write our own extensions and automation.

The future for the CFML Community is looking good, with tools like this, and being open and available, no matter your framework, I cannot wait to get the PackageManager connected to other great resources like CFLib, and what others will do to build upon this solid base.

The keynote also showed off some changes to ContentBox and its 2.0 version coming soon, and what it has in store for us.
It was a great start to a great day… Into the Box is looking to be a great success, and cf.Objective() will make this a great week.

If you aren't here, start planning for next year... you are missing out.

Back to the sessions
Gavin

08
May 2014

Gavin Pickin

When A Boolean is a Boolean and when it isn't - CFML Language Headaches

CFML Language, Techie Gotchas

As usual, ColdFusion has the ability to make me look like a talent developer one minute, but can make me look like crazy fool the next. Am I surprised... no, not in the fact it can do it, but this time, in the way it did it. As the title suggests, I was working with some Booleans, and like most languages, ColdFusion treats a 0 as False, and everything else True. This is not what got me... what got me is, that ColdFusion does not always hold that true.

Interesting right? Frustrating, absolutely. So here is the situation.

For these examples, I'm using -1 as the value in question.

<cfif -1 >
TRUE
<cfelse>
FALSE
</cfif>

Knowing that 0 is false, everything else is true, then -1 is TRUE.
Thanks to CFLive.net we can see that Railo and ColdFusion agree, it is true.

Great... no problem yet.
So lets try the full expression, not shorthand.

<cfif -1 is true>
TRUE
<cfelse>
FALSE
</cfif>

Ok, so that is true too right? WRONG.

Apparently, if you use shorthand, the rule holds true, but if you compare it, it is not true.
is, eq, == in both script, and in tags, in Railo and ColdFusion both work this way.

So evaulating as a boolean and comparing to a boolean is different.
Simple, maybe obvious when you think about it, but when I see ( -1 == true ) or I see ( -1 ) I assumed its doing the same logic... and I was a crazy fool for thinking so.

I tried this with other numbers too... I changed the order of the items, incase it evaluated differently, but its consistent.

The CF9 docs talk about it, and mention in Boolean Comparisons, that non zeros are true, but not sure how to do a boolean comparison unless its shorthand, to get it to work.

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec09af4-7fd0.html

Food for thought.
Word of wisdom for today... test test test and never assume anything.

Have a good one.
Gavin

Blog Search