Scripting Lucee / App install in AWS Linux 2

Hi Everyone,
The ultimate goal is to be able to create AWS instances and install Lucee and our applications, via script - so that we can add / remove instances, adhoc.

Currently,
I am trying to copy an existing scheduler.xml that I have into a new install. But am having a “path” issue.

I can successfully install Java/Tomcat/nginx/Lucee/etc via shell scripts.
Everything works via localhost.
Everything (lucee admin) works via domain name / remote.

The issue I am having is that I cannot (seemingly) work out the path to the “web” admin root directory to copy the file into.

Lucee admin shows the following;

Where the first 4 are Tomcat end-points and the last is for Lucee Admin.

But because I am doing this via script, how do I retrieve the 1a456059fdd36b8560052cb5a2490e92 value, so I can use it in a script as the destination directory?

Similarly I wouldn’t mind knowing if I can change it programmatically?
I know the lucee-server.xml has a section labels, so I can make the context more human readable - but even if I am going to sed the XML and create a label(s) - I still need to know how to get the original value - to make it “nice”.

The Lucee admin states that it is normally the MD5 hash of the webroot and so I have tried;

echo /usr/share/tomcat/apache-tomcat-9.0.59/webapps/ROOT | md5sum
echo /usr/share/tomcat/apache-tomcat-9.0.59/webapps/ROOT/ | md5sum

as the admin reports the webroot be - but the value returned is not a match.

I have also tried the actual webroot which is actually in ‘/opt/lucee/config/web’

echo /opt/lucee/config/web | md5sum
echo /opt/lucee/config/web/ | md5sum

but they don’t match either.

I have tried using with a hostname, with localhost, with a http and https protocol - and I can’t produce a MD5 hash that matches.

I assume - that the MD5 hash produced by Lucee and that produced by CentOS7 - create different values for the same strings? - But this is just a guess as I am not 100 certain of what I should be feeding to md5sum

As always - Thanks to everyone for your ongoing help.

Don’t forget to tell us about your stack!

OS: AWS Linux 2
Java Version: 11
Tomcat Version: 9.0.59
Lucee Version: 5.3.8.206

the Lucee admin is written in cfml, so if you see the admin doing something, you can always just look at source code, coz lucee is open source!

2 Likes

Hi Zack,
Thanks - I have had a search through the code
But can’t seem to find where the data that is the configuration items within ADMIN are stored.
I saw in the code a USERDATA directory - but it is empty in my install.

I would have assumed in the XML, but as example - I changed the webroot, label…
And it does not appear in lucee-server.xml

I guess what I need, plainly, is;
In a BASH script;
Can I re-create the HASH that is a CF application’s webroot by providing a path?
Then I could do a match…

Thanks.

I think the code you are looking for is like @Zackster mentioned at Line 279:

<!--- Line 279 --->
<cfadmin
	action="getContexts"
	type="#request.adminType#"
	password="#session["password"&request.adminType]#"
	returnVariable="contexts">

In other words. you can run a cfml template with:

<cfadmin
	action="getContexts"
	type="server"
	password="yourServerAdminPassword"
	returnVariable="contexts">

<cfdump var="#contexts#">

That should give you back a query object with the contexts, paths etc. e.g. of such a dump:

there are also placeholders to get all these values

2 Likes

I’d also recommend programmatically (re-)creating the schedules

Hi Again

Great suggestion - just didn’t think of it - got stuck in the mindset of reconfiguring what was done previously.

I could create a script and CURL it in my shell script.

Thanks very much!

1 Like

I now have this all working - thanks for the help.

As was suggested we are creating the scheduled tasks now via cfschedule, which we CURL after the install scripts have all the prerequisite work completed.

Much easier than having a “source” echedule.xml in a repository that you copy over the top in a working instance. Easier to update / manage etc - and keeps the process “inside” Lucee.

Thanks again!
Gavin.

2 Likes