Sunday, 1 June 2014

Doing a Railo silent install

G'day:
Yesterday I questioned Railo needing an admin password ("Admin passwords shouldn't have a min length requirement") on an existing ticket... one I am surprised to see was raised close to six years ago and seemingly has yet to be triaged by Railo. My comment was thus:

I'm getting fed up with being forced to put a password in every time I install a new Railo install. Because for every single occasion I've installed Railo, I have not needed the admin to have a password because machine security is handled separately, making this password a complete waste of time.

We are on the verge of migrating several hundred CF9 instances to Railo, and this is going to be a problem for us.

It's good you provide password control. It's poor that you attempt to decide for me whether I want to use one or not.


Gert immediately hit me up via Twitter DM and pointed me at the direction of the unattended installer. This is pretty good service! That said the unattended installer addresses the wrong part of the issue for me (as far as I can tell from my googling): it allows for the pwd to be scripted so it only has to be entered once... but my question is the need to have a password at all. It's just pointless in a lot of situations. Possibly almost all situations. No unauthenticated user should be able to get anywhere near the Railo (or CF) admin, so having a password at that stage is a waste of keystrokes and just a barrier to entry, IMO.

Anyway, this piqued my interest, and I need to install Railo on this computer anyhow, so I'm gonna give the unattended installer a try. And document the process as I undertake it.

Firstly - from sitting on the Railo download page - I try to find out how to do an unattended install.


I use the documentation link, and got to here:


There's no "installation" link, which surprised me... surely this is the first thing one wishes to do with Railo? But I decided it's probably under "Quick Start Guide", so went there, which included this suggestion:


That link to the Railo Blogs just 404s.

So I give up on the Railo docs. No, I have not tried very hard here, but in my experience they're quite poor, and tend to give up when I start encountering broken links, missing pages, or start going around in circles.

So I google "railo unattended install". The first (and second) matches are from a Railo Google Group thread from 2012: "Railo installer in unattended mode": my mate Dan Skaggs asking much the same question as I'm undertaking here.

The thread is the usual combination of people answering questions Dan didn't actually ask, plus people genuinely trying to help. But it really ends up boiling down to Dan working it out for himself (something I haven't got the patience for), but he provided a bunch of useful information.

And it also seemed like this is a wild goose chase for me anyhow, as I still need to enter a password. Still I'm on the case now and will see it through.

Anyhow, the key entry in that thread is this last one from Dan, in which he details a bunch of options, including how an options file works:

sudo ./railo-3.3.1.000-pl1-linux-x64-installer.run --mode unattended --optionfile /path/to/options.txt


I'll give that a go. He also lists a bunch of the options for the file:

installdir=/opt/railo
tomcatuser=admin
tomcatpass=password
tomcatport=8888
systemuser=apache
startatboot=true
installconn=true
apachever=22
bittype=64
apachecontrolloc=/etc/init.d/httpd
apachemodulesloc=/usr/lib64/httpd/modules
apacheconfigloc=/etc/httpd/conf/httpd.conf
apachelogloc=/var/log/httpd


This was for an old version of Railo, but I have no reason to think it would not still work, so will give it a go.

Dan also tipped me off at the possibility of a --help option being a good addition to this process, so - hoping it's been implemented between then and now - I will try it.

I've opened a command prompt (I'm on Windows, Dan was on Linux, so sudo isn't an option for me as it was for him), drilled down to where my installer is and go:


D:\Users\adam.cameron\Downloads\apps\dev\railo>railo-4.2.1.000-pl0-windows-installer.exe --help

D:\Users\adam.cameron\Downloads\apps\dev\railo>

And nothing happens. DOH!

But after a few seconds I get a pop-up, thus:


Excellent! I am on to something here.

So... gimme a few min, I'm gonna create an options.txt file (yes, I actually am writing this up as I am trying to make it work)

Side note: bloody annoyingly - and for no sensible reason I can divine - that pop-up closes itself after a while. I'm going to raise a bug for that. What the hell was whoever did that thinking at the time? Why would one auto-close documentation?! I also can't help but think that help invoked from a command line should just output to the command line, not in a GUI pop-up. Oh well: not a big issue.

Also some of the "help" there isn't great:

 --tomcatport <tomcatport>      Tomcat Web Server Port:
                                Default: ***infinite recursion in variable tomcatport***

 --tomcatshutdownport <tomcatshutdownport> Tomcat Shutdown Port:
                                Default: ***infinite recursion in variable tomcatshutdownport***

 --tomcatajpport <tomcatajpport> Tomcat AJP Port:
                                Default: ***infinite recursion in variable tomcatajpport***


I dunno what that's supposed to mean (although someone should have proofread this after they autogenerated it... well it seems like that was an error in the autogeneration?)

I have guessed that all I need to specify in my options file is this lot:

prefix=C:\apps\railo\tomcat\
railopass=password
startatboot=no
installiis=no


And I kick this off via this:

D:\Users\adam.cameron\Downloads\apps\dev\railo>railo-4.2.1.000-pl0-windows-installer.exe --mode unattended --optionfile options.txt

(everything else can happily be default, provided those "infinite recursion" options have the usual defaults of 8888 / 8005 / 8009 etc)

I shall now press [enter] and see what happens...

BLAM


(and this, btw, also disappears of its own accord after a few seconds. Grrr)

Initially I misread this and thought "OK I need to add that in" (because it def was not in the file), so I added it in:

tomcatuser=admin


And when running the install again, it then complained about --tomcatuser being an invalid option again. I was a bit bemused by this, given it wasn't actually listed as an option in the first place. Then that pop-up disappeared too.

Without thinking that I had the previous pop-up pasted in here above, I removed the tomcatuser option, and re-ran the installer to see what it had actually said again but this time... the installer decided it didn't need the tomcatuser setting, and as I type the installer is churning away in the background doing stuff (according to Task Manager).

The only thing I can think here that might be a fault on my part is that I started with all Dan's options (one of which was tomcatuser), and removed the ones I didn't need. Perhaps I didn't save after making those changes, and before running the install? Possibly. I really do doubt this though. Anyway...

Whilst typing that para, it's done. Checking, I have a C:\apps\railo\tomcat dir, and it has stuff in it. I also have a Railo Server service installed, and its running.

So I shall now browse to http://localhost:8888 and see what I get...


Woohoo!

And do I have a Server Admin?



Yes I do. Also note: it's fully patched. It's not like a ColdFusion install wherein having installed, I then need to pants about installing updates too. Railo's done it for me.

OK... there has been one slight glitch.

It has installed the Railo application files for me to C:\apps\railo\tomcat, and there's a C:\apps\railo\tomcat\tomcat\webapps\ROOT dir, with Railo stuff and a WEB-INF dir, but this is not the webroot that's been configured. If I browse to http://localhost:8888/ (with directory listing switched on, so I can see where I am), I find it's serving out of C:\inetpub\wwwroot. I have no idea how it got the idea that that directory has anything to do with anything. I specifically said not to install anything to do with IIS, and even then... that's not where I put my IIS websites anyhow! I dunno WTF is going on there. It doesn't matter for the time being, and I imagine I can google how to sort it out. But that's def not right.

So all in all... only took me an hour or so to go form start to finish, including writing it up. Good. But there's some stuff that Railo could look at:


  1. Fix that 404, and if the install docs are somewhere else now, make it more obvious. I shouldn't have to search for installation docs.
  2. Fix the --help feature to a) not be a GUI pop-up; b) if it needs to be one, to not disappear after a while!
  3. Fix the text in the help to be correct / complete.
  4. What's with the tomcatuser thing? Possibly user error, but might need looking at.
  5. Error messages on an unattended install should be to stderr, not to a pop-up.
  6. Possibly add another install option to allow to specify where the web root ends up being, or just default it to the webapps/ROOT dir. But C:\inetpub\wwwroot should not be a part of any default decision.
Right... I have rugby to go watch and beer to drink. Not in that order. It's kind of a "rinse & repeat" sort of thing, starting with the beer.

Righto.

-- 
Adam