I read this article on developerWorks: Deploying into the cloud with the IBM Application Pattern for Java which I found very interesting. It explains how to deploy a Java application in SCAS. The author demonstrates how to setup a Tomcat environment and how to install its application on it.
The Java Pattern is very generic, it allows you to install any kind of java application with only several components:
– The Java application itself: With this component you can upload an installation file and launch it.
– The Additional archive file: This components allows you to upload an extra archive file on the server.
– Generic listener and target which are used to setup the firewall rules.
– Monitored file: Allows you to monitor application log files via the Workload Service Console.
So, I would like to give it a try… and decided to go for the following scenario:
I have a Eclipse RAP application and I would like to run it on the IBM SmartCloud Application Services using the IBM Application Patter for Java. As the Eclipse RAP IDE provides testing tools using Jetty, I decided to install Jetty on SCAS.
As you know, SCAS, IBM PureApplication and IWD use the same technology and thus this scenario is application for these three IBM Solutions.
First, I reused the Eclipse RAP Demo to create a war file containing the application (more information at RAP Examples and Deploying a RAP Application to a Servlet Container?).
Secondly, I created my pattern based on the Java Application Pattern-type and by executing the following steps:
1) Use the Java Application Component.
2) Drag and Drop and Additional archive file.
3) Include a Generic listener to open the firewall on port 8080.
4) Setup the Monitored file component.
5) Launch the pattern and Test
Java Application Component
The Java application component takes an archive file which will be unzipped on the server and then class or a command line can be launched.Here as I would like to start my Jetty, I launched the command-line “jetty.sh start” from the bin directory.
Additional archive file:
My application is a war file, I can use the ‘Additional archive file’ component to upload this war file to a specified directory. I have to link also the archive file component with the Java application.
We have to open the port 8080 on the “Java Application Server” and to do that I use the “Generic listern” component. I can aslo limit the access to IP addresses by specify a mask.
Of course, I have to link the ‘Generic Listener’ to the Java application too.
When you use this component and specify log file path, the log files become accessible via the SCAWS console. So, here I will specify the log file path for my “Jetty” installation: /jetty-distribution-8.1.8.v20121106/logs/*.log
Again, I have to link the ‘Monitored file’ component to the ‘Java application’ component.
Launch and Test
Now, I can save and launch my pattern. When the deployment is ready, I can access the application.
Let’s check now the log file, for that from the SCAWS console I open the virtual application instance list, select my virtual application instance and click on ‘log’ and select the jetty log file:
Conclusion: As you can see with the IBM Application Pattern Type for Java, we can run any type of Java applications, manage the firewall and monitor the log files.