At Boxfuse we love solutions that just work. And that's why, when it comes to Java EE, we've grown very fond of Apache TomEE. Unlike traditional heavy and complex application servers, TomEE combines the swiftness of Tomcat with the benefits of standard Java EE.
Today we are happy to announce that we have added TomEE to Boxfuse's selection of payloads that can be deployed effortlessly to VirtualBox and AWS. Just like Dropwizard, Spring Boot, Tomcat and (executable) jar files, you can now fuse TomEE applications into immutable images with a single command. These images can then be deployed unchanged to VirtualBox and AWS with zero downtime updates.
At its core Apache TomEE stands for 3 things:
TomEE does away with long and tedious deployments typically associated with Java EE. Instead you now get a Tomcat
that has been tuned to be able to run Java EE applications. It's still Tomcat, but it is now also fully Java EE
certified with support for EJB, CDI, JMS and more. It starts quickly and does away with .ear files. Instead you
can simply use tried and true .war files and define any JNDI resources in
Java EE has never been this simple!
You will also need Git, Java, Maven and VirtualBox installed on your machine.
Start by cloning the Boxfuse Samples repository:
> git clone https://github.com/boxfuse/boxfuse-samples.git
and build the TomEE sample application:
> cd tomee tomee> mvn package
Great. You should now have a file called
target/tomee-1.0.war as part of the following application:
This application uses various Java EE features including EJBs, JSPs, Servlets, JPA and JNDI.
Now that you have built the application, let's deploy it to AWS. Boxfuse will start by analysing it
and determining its type. Doing so it will find the
WEB-INF/resources.xml file. This tells it that it is a Java EE that requires TomEE instead of Tomcat.
Boxfuse will then create a Micro-OS on-the-fly designed to do one thing and one thing only: run this version of your application.
It does that by combining your application with TomEE, a JVM, the C library, the Linux kernel and a bootloader into an tiny image. Everything is fully configured and ready to run out of the box:
To launch your application on AWS as well as provision and configure all necessary infrastructure, all you need to do is:
> boxfuse run target/tomee-1.0.war -env=prod Fusing Image for tomee-1.0.war ... Image fused in 00:08.592s (73858 K) -> axelfontaine/tomee:1.0 Creating axelfontaine/tomee ... Pushing axelfontaine/tomee:1.0 ... Verifying axelfontaine/tomee:1.0 ... Waiting for AWS to create an AMI for axelfontaine/tomee:1.0 in eu-central-1 (this may take up to 50 seconds) ... AMI created in 00:18.531s -> ami-806e6c9d Creating Elastic IP ... Mapping tomee-axelfontaine.boxfuse.io to 188.8.131.52 ... Creating security group boxsg-prod-axelfontaine/tomee:1.0 ... Launching t2.micro instance of axelfontaine/tomee:1.0 (ami-806e6c9d) in prod (eu-central-1) ... Instance launched in 00:38.394s -> i-dec80062 Waiting for AWS to boot Instance i-dec80062 and Payload to start at http://184.108.40.206/ ... Payload started in 01:00.050s -> http://220.127.116.11/ Remapping Elastic IP 18.104.22.168 to i-dec80062 ... Waiting 15s for AWS to complete Elastic IP Zero Downtime transition ... Deployment completed successfully. axelfontaine/tomee:1.0 is up and running at http://tomee-axelfontaine.boxfuse.io
And there you have it, your Java EE application is now fully up and running on AWS:
You can deploy new versions at any time and Boxfuse will automatically perform blue/green zero downtime updates for you.
In this post you saw how Apache TomEE makes Java EE fast and lightweight. We took this to the next level by using Boxfuse to deploy a Java EE application to AWS using a single command. There was no tedious configuration and the entire process took less than two minutes, including automatically provisioning all the necessary infrastructure on EC2.
Running your Java EE applications on AWS has never been this easy.
Have fun! And if you haven't already, sign up for your Boxfuse account now. All you need is a GitHub user and you'll be up and running in no time. The Boxfuse free plan aligns perfectly with the AWS free tier, so you can deploy your TomEE Java EE application to EC2 completely free.