D
David Berger
Guest
Modulus supports the seamless deployment of Java Tomcat applications. The Java runtime supports multiple version of the OpenJDK runtime and multiple versions of Tomcat. Create Project Creating a Java project can be done by choosing Java on the web portal or when creating a project using the CLI. Java is more resource-intensive than other application types, so choose the servo size carefully. We recommend a minimum servo size of 512MB. Deploying The Modulus Java runtime supports the deployment of WAR application bundles. The bundles are placed as-is within Tomcat's webapps folder. In order to deploy a bundle to be served at the root domain, you must name the bundle ROOT.war. The war file is automatically extracted and run by the Tomcat server running within the Modulus servo. You can deploy the WAR file using either the CLI or the web interface. The CLI is the preferred approach. Modulus only needs the WAR file, so it's recommended to copy it to a clean directory prior to deploying. $ cp ROOT.war /my/output $ cd /my/output $ modulus deploy Setting Java and Tomcat Versions Modulus supports OpenJDK versions 7 and 8 and Tomcat versions 7 and 8. If no versions are specified Modulus will choose the latest, which is currently Java 8 and Tomcat 8. In order to set the version, you must deploy an application manifest file , named app.json, in the root of your project. The following example sets the Java and Tomcat versions to 7. { "engines" : { "java" : "7", "tomcat" : "7" } } SETTING JAVA OPTIONS It is sometimes required to specify options based on the performance characteristics of your application. You are able to set a custom JAVA_OPTS environment variable if needed. Setting this environment variable will entirely override any default options provided by Modulus. By default Modulus will define JAVA_OPTS based on the available servo size. -Xms and -Xmx are set to 75% of the available memory. -XX:MaxPermSize is set to 25% of the available memory. For example, if you deploy to a 512MB servo, the default options will be: JAVA_OPTS=-Xms384m -Xmx384m -XX:MaxPermSize=128m If you set the JAVA_OPTS environment variable, you are entirely overriding the default options. It is recommended you define reasonable memory limits as part of your custom options. LOGGING Modulus automatically logs to disk anything written to the console or standard out. Modulus also automatically handles log rotation, so this is not something that needs to be implemented as part of your application. If you choose to use log4j as your logger, the following config options will properly log to the console. log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out What are We Missing? Java is a new runtime for Modulus and we depend on customer feedback to make it better. If we're missing features that are required for your environment, please let us know .
Continue reading...
Continue reading...