Lucee on vanilla Elastic Beanstalk AMI

We currently deploy a Railo website on the default Tomcat 8 AMI for Elastic
Beanstalk, which is much more convenient than configuring Tomcat and making
a custom AMI.

Has anyone done this with Lucee?

Hi Rupert. Brad’s correct–the first thing we’ll be delivering to the
community is “gold” (optimized) official Lucee AMIs. On the heels of that,
we’ll be sharing more info on how people can make those a building block
for use with all the ALM/deployment/management tools out there, like
Elastic Beanstalk, Docker, etc. etc. More soon!On Tuesday, June 28, 2016 at 9:48:36 AM UTC-6, Rupert Rawnsley wrote:

We currently deploy a Railo website on the default Tomcat 8 AMI for
Elastic Beanstalk, which is much more convenient than configuring Tomcat
and making a custom AMI.

Has anyone done this with Lucee?

Just to throw this out there, Webapper is working on some official Gold
AMIs for Lucee. It might make this easier for you.

Thanks!

~BradOn Tuesday, June 28, 2016 at 10:48:36 AM UTC-5, Rupert Rawnsley wrote:

We currently deploy a Railo website on the default Tomcat 8 AMI for
Elastic Beanstalk, which is much more convenient than configuring Tomcat
and making a custom AMI.

Has anyone done this with Lucee?

Thanks - I will take a look at those custom AMIs when they become available.

In the meantime I’ve got it working with the default Tomcat container and I
thought it was worth sharing the process. I’m not a Tomcat or Lucee expert,
so apologies if any of this is wrong - feel free to make suggestions.

Background

Amazon Elastic Beanstalk (ELB) lets you select a machine image to use on
all the machines in your server farm. You then provide your web server code
in an archive to be deployed in the appropriate place for the container,
which in the case of the Tomcat image is /usr/share/tomcat8/webapps/ROOT.
Presumably this location is set in the metadata of the machine image as it
will be different for each hosting type.

The key point is that you can only add files under this ROOT folder (you
might be able to do more with scripts and other such wizardry, but it’s
extra configuration). Therefore the standard Lucee installation
instructions don’t work because they require modification of the Tomcat
installation.

One other relevant point is that the easiest way to deploy to ELB is
directly from your git repository using the CLI. This means every file that
is in source control will be deployed under the ROOT folder with the folder
structure preserved.

Step 1: Local Tomcat Installation

To mirror the ELB environment as closely as possible, the easiest thing to
do is to install a pure Tomcat server on your development machine.
Personally I found these instructions
http://codingexplained.com/operating-systems/mac/installing-tomcat-8-os-x-yosemite
very clear.

You might be able to put your source code directly under the Tomcat ROOT
folder at this point, but I prefer to retain my normal source code
locations and tell Tomcat where to find them. This is done with the
addition of a new Host entry in the server.xml file (found in
/Library/Tomcat/conf on OSX) like this:



This tells Tomcat that when it gets a request for a host called
website.local, it should serve up whatever it finds in
/Users/username/Source/Server. You would also need to add website.local
to your hosts file (in /etc/hosts on OSX) like this:

127.0.0.1 website.local

Step 2: Lucee Installation

At this point Tomcat knows where to look, but has no idea what sort of
application to run or what to do about CFM pages. To answer that question
it looks for a web.xml file in the WEB-INF subfolder. So in this
example it would look for /Users/username/Source/Server/WEB-INF/web.xml.
It will have already read the default Tomcat web.xml file that defines
things like MIME types, so the one in here only needs to tell it about
Lucee. In a default Lucee installation, the Tomcat web.xml is replaced with something
like this
https://github.com/lucee/lucee-dockerfiles/blob/master/5.0/web.xml. That
file would probably work in the local WEB-INF folder, but I cut mine down
to include only the bits that are relevant to Lucee:

<?xml version="1.0" encoding="ISO-8859-1"?> Lucee
<servlet> 
    <servlet-name>LuceeServlet</servlet-name> 
    <servlet-class>lucee.loader.servlet.LuceeServlet</servlet-class> 
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet> 
    <servlet-name>CFMLServlet</servlet-name> 
    <servlet-class>lucee.loader.servlet.CFMLServlet</servlet-class> 
    <load-on-startup>2</load-on-startup>
</servlet> 

<servlet>
  <servlet-name>RESTServlet</servlet-name>     
  <servlet-class>lucee.loader.servlet.RestServlet</servlet-class> 
  <load-on-startup>3</load-on-startup> 
</servlet>   

<servlet-mapping> 
  <servlet-name>LuceeServlet</servlet-name> 
  <url-pattern>*.lucee</url-pattern> 
  <url-pattern>/index.lucee/*</url-pattern> 
CFMLServlet *.cfc *.cfm *.cfml /index.cfc/* /index.cfm/* /index.cfml/* RESTServlet /rest/* index.cfm index.lucee index.html index.htm 404 /404.cfm css text/css

The second and last file you need to add is the Lucee JAR file. I put this
one http://cdn.lucee.org/rest/update/provider/loader/5.0.0.252 (from here
http://lucee.org/downloads.html) in the WEB-INF/lib folder. The first
time it runs it will create all the other files and folders it needs.

At this point you should be able to see your website at
http://website.local:8080, assuming you have an index.cfm page or
something similar in the top-level folder. If this fails, consult the
Tomcat catalina.out log file.

Step 3: Git Integration

In theory you could add all the files under WEB-INF to git and deploy them,
but I’ve not tried it and you would need to filter out log files and so on.
Instead I exclude that folder (using .gitignore) and explicitly add the
files WEB-INF/web.xml, WEB-INF/lib/lucee-5.0.0.252.jar, and
WEB-INF/lucee/lucee-web.xml.cfm (where Lucee stores website configuration
changes).

You are now ready to deploy to a vanilla Tomcat ELB environment.On Wednesday, 29 June 2016 23:55:43 UTC+1, Patrick Quinn wrote:

Hi Rupert. Brad’s correct–the first thing we’ll be delivering to the
community is “gold” (optimized) official Lucee AMIs. On the heels of that,
we’ll be sharing more info on how people can make those a building block
for use with all the ALM/deployment/management tools out there, like
Elastic Beanstalk, Docker, etc. etc. More soon!

On Tuesday, June 28, 2016 at 9:48:36 AM UTC-6, Rupert Rawnsley wrote:

We currently deploy a Railo website on the default Tomcat 8 AMI for
Elastic Beanstalk, which is much more convenient than configuring Tomcat
and making a custom AMI.

Has anyone done this with Lucee?