WEBAPP PATTERN FOR APACHE TOMCAT - USER GUIDE
Contents 1. Pattern Overview... 3 Features 3 Getting started with the Web Application Pattern... 3 Accepting the Web Application Pattern license agreement... 4 Planning your Virtual Application... 4 2. Deployment Steps... 5 Working with deployed Web Applications... 8 WEBAPP PATTERN FOR APACHE TOMCAT 2
1. Pattern Overview Web Application pattern for Apache Tomcat and MySQL is a virtual application pattern used to build online web application-style virtual applications. The Web Application Pattern manages application deployment and life cycle. The Web Application Pattern provides a set of components that are typical for online web applications, like Java Platform, Enterprise Edition (Java EE) applications and database. After building the virtual application in the Virtual Application Builder, you can deploy the application and the system determines the underlying topology configuration. Web Application Pattern includes an elastically scalable application server and a database. These components are managed together as a single unit, which reduces the management and operational complexity of an end-to-end environment for hosting Java web applications. The components are described as follows: Scalable Application Server Web Application Pattern includes dynamically scalable Apache Tomcat 6.0 application server that expands to meet the resource needs of the applications hosted within it, based on defined criteria. Interaction with Web Application Pattern occurs through artifacts and policies. By providing artifacts such as web archive (WAR) files and data definition language (DDL) file and specifying deployment and management policies, you are ready to use your application. All the management policies and their attributes are explained in the deployment section. Database Web Application Pattern also includes MySQL 5.5 database. Use of the database component is as simple as providing a DDL file that describes the application schema. Features The Web application pattern for Apache Tomcat and MySQL provides following features: Reduce the deployment and configuration time for your web application using automated deployments Ensure consistent nature of deployments by preserving and reusing best practices Includes an elastic scalable component for dynamically scale up and scale down on number of Tomcat servers depending on load on the system. Reduces operational complexity, management and monitoring. Provides integrated monitoring and diagnostics. Tune in your application performance during deploy time and runtime through JVM configurations and logging levels. Leverage MySQL database pattern for automated deployment and configuration for persistent layer. Integrate load balancing component using ELB (Elastic load balancer). Routing policy can be explicitly added for load balancing and routing. Getting started with the Web Application Pattern The Web Application Pattern is an application-centric pattern solution based on common client experiences that can be reused to deploy and manage resources in a cloud environment. The first step in using this pattern is to accept the license agreement. The process of accepting the license agreement is explained in next section. The next step is to create a virtual application template or use an existing virtual application template. The template is then used to build your virtual application pattern. After you select a WEBAPP PATTERN FOR APACHE TOMCAT 3
template and start building, the Virtual Application Builder opens where you can customize your virtual application pattern with cloud component parts and policies. Virtual application patterns can be saved and cloned to build new customized patterns. Accepting the Web Application Pattern license agreement To start using the Web Application Pattern you must accept the license agreement. The web application pattern license agreement encompasses a combination of product licensing. The following lists include major components. For the full detailed list of licensed software, see the license agreement text. You can view the license agreement before and after you accept it. Web Application Pattern Version Apache Tomcat Version MySQL Version 1.0 6.0.35 5.5 To accept the license agreements follow these steps: 1. Click Cloud > Pattern Types. 2. In the list of pattern types, select Web Application Pattern Type which is Webapp Pattern for Apache Tomcat 1.0. The pattern details display on the right. 3. In the License Agreement field, click Accept. 4. After reading the license agreement, click Accept. The license agreement details changes to Accepted. 5. As an administrator, you should review and configure plug-ins before making the pattern type available for creating and deploying virtual applications. 6. Click Cloud > System Plug-ins. 7. Select Web Application Pattern, and then click Show me all Plug-ins in this pattern type in the Plug-ins field. 8. Review the plug-ins and their configuration options. Click Configure to view or update configuration settings. 9. Click Enable to change the pattern type status to Available. Planning your Virtual Application Creating a Virtual Application consists of using the Virtual Application Builder to define and create the virtual application templates and patterns, and then deploying the pattern in the cloud environment. A deployed virtual application pattern is a virtual application instance. Gather the application artifacts and necessary information to configure the cloud components. For the web application component type, a Java Platform, Enterprise Edition (Java EE) artifact, such as a web archive (WAR) file, is required. For the database component type, a SQL script that can be deployed on a MySQL server is required. WEBAPP PATTERN FOR APACHE TOMCAT 4
Gather the necessary information to configure the quality of service (QoS) policies You can add a scaling policy and specify the required cluster size if you want high availability. You can add the Java virtual machine (JVM) policy to debug the Apache Tomcat Server process using an integrated development environment (IDE). You can add log policy to the application component to specify configurations for log records. You can add Routing Policy to specify support for Http and load balancing. After you collect the necessary information and artifacts previously described, you can begin using the Virtual Application Builder to design and configure the cloud components and policies to create your virtual applications. Creating multiple application servers on the same virtual machine is not supported 2. Deployment Steps This section outlines the deployment steps for Web Application Pattern for Apache Tomcat on SCAS. Pre-requisite: To deploy the Web Application Pattern with Routing policy, ELB shared service needs to be deployed first. 1. Go to Cloud->Shares services. 2. Select ELB Proxy service under Proxy Services. 3. Click on Deploy. In the pop-up displayed for configuring it, select ELB instance range. Provide value for Virtual Host. Keep the others parameters unchanged and click on Deploy. Web Application Pattern can be deployed by following below mentioned steps: 1. Go to Patterns -> Virtual Applications and select Webapp Pattern for Apache Tomcat 1.0. 2. Click on the New button displayed in this page. 3. A pop-up window as Create Application will be displayed. Click on the button Start Building. 4. A new page Virtual Application Builder will be displayed with Apache Tomcat displayed under the section Application Components and MySQL displayed under section Database Components. 5. Drag the component Apache Tomcat on the middle pane. 6. Its attributes will be displayed as below: War file Specifies the web application (*.war) to be uploaded. Note: Please ensure that the war file being uploaded is in correct format. If it s not in the desired format of a war file, the pattern deployed will not be operational. Maximum no. of threads Specifies the maximum number of concurrent threads WEBAPP PATTERN FOR APACHE TOMCAT 5
7. Click on the + symbol present inside this component. Following 4 policies can be added a. Adding a JVM policy: Select JVM Policy for this component and specify the below attributes: Enable Debug If this field is checked then JVM starts in debug mode Debug Port Specifies the port that the JVM listens on for remote connections Min and Max JVM heap size (in MB) To set the minimum and maximum JVM heap size (in MB) b. Adding a Log Policy: Select Log Policy for this component and specify below attributes: Log Level Details Specifies the usage of log levels c. Adding a Scaling Policy: Select Scaling Policy for this component and specify below attributes: Scaling type This drop-down field has following 3 values: Static CPU Based Response time based. Default value for this filed is set as Static. Number of Instances Specifies the number of cluster members that are hosting the web application If you select Scaling Type as CPU Based the following additional attributes needs to be specified: Scaling in/out when CPU usage is out of threshold range (%) Specify the threshold in percentage for CPU usage Instance number range of scaling in/out Specify the scaling range for instance members that are hosting the web application. Acceptable values range from 1-50 Minimum time (sec) to trigger add/remove Minimum time when scaling triggers WEBAPP PATTERN FOR APACHE TOMCAT 6
If you select Scaling Type as Response Time Based the following additional attributes needs to be specified: Scaling in/out when Web response time is out of threshold range (ms) Specify the web application response time condition to start scaling activity Instance number range of scaling in and out Specify the scaling range for instance members that are hosting the web application. Acceptable values range from 1-50 Minimum time (in sec) to trigger add/remove Minimum time when scaling triggers d. Adding a Routing Policy: Select Routing Policy for this component and specify below attributes: Virtual hostname Specify the name of the virtual host for the routing policy which will be registered in elastic load balancer. HTTP Specifies support for HTTP schema with a routing policy 8. Drag the component MySQL on the middle pane. Its attributes will be displayed as below: Name Specify name of the component. By default name of the component is MySQL. MySQL Database Name Specify name of the database that will be created when pattern is deployed. Default value is "MySQLDatabase" MySQL Schema File Specify script file with extension as.sql/.ddl that will be executed after database is created 9. Click on the + symbol present inside the component and add the Replication Policy 10. Upload a valid.war file for Apache Tomcat and.sql/.ddl file for MySQL and save the pattern by giving its name and description. 11. Close the Virtual Application Builder page. Now go to Patterns -> Virtual Applications page. 12. Select the pattern saved in above step and click the Deploy button. 13. Go to Instances->Virtual Applications and check deployment status for the pattern. 14. After sometime (approximately 30 minutes), the pattern will be deployed and will be displayed in running mode. The number of tomcat instances will be the same as given in the number of instances field if static policy is applied. In case of CPU based or Response Time Based scaling policy, the number of tomcat instances will depend on the minimum value of instance range given. There will be two instances of MySQL (one for Master and one for Slave) as Replications policy has been applied. 15. Click on the End-point link of Apache Tomcat. It will display endpoint Information i.e. the end-point URL of the application deployed in the pattern. 16. Click on the End-point link of MySQL. The details displayed here are as below: WEBAPP PATTERN FOR APACHE TOMCAT 7
Endpoint Port IP address of the virtual machine on which MySQL database has been installed Database port number Database User Database user name Database Password Database password Working with deployed Web Applications After you have deployed a virtual application pattern, you can monitor and administer the deployed application directly from the Virtual Application Console. Monitoring the Web Application Pattern components Your applications must be deployed and all of your virtual machines started before you can monitor results. Use the user interface to monitor the following statistics for your deployed virtual machines. Memory Network Process Storage Use the user interface to monitor middleware: Roles To monitor middleware follow these steps: 1. Click Instances > Virtual Application Instances. The Virtual Application Instances pane displays. 2. Select a virtual application instance. The virtual application instance details display to the right. 3. Click Manage on the toolbar. 4. Under Monitoring ->Virtual Machine->The graphs for above four entities are displayed to the right. 5. Click Monitoring > Middleware. The Role Monitoring pane displays. The Apache Tomcat Response Time charts are displayed. Managing the Web Application Pattern via Operations Once the Web Application Pattern is deployed, you can perform additional configuration changes through Operations page. For this below steps need to be followed: 1. Go to Instances ->Virtual Applications page and select the instance which has been deployed successfully and click on the Manage button for it. 2. A new page will open up showing Monitoring as the default tab. Go to Operations tab and select the Tomcat option. Following operations can be performed for Apache tomcat: WEBAPP PATTERN FOR APACHE TOMCAT 8
Re-start TOMCAT Instance: Click on Submit button Once tomcat is re-started, a success message will be displayed under the section Operation Execution Results. This message confirms that tomcat has been re-started. In case of any failure, an error message will be displayed. Update Configuration: Following fields are present under this section: 1. Update WAR package: Click on the Edit button and upload a new.war file for the application 2. Log Level Details: Set a new logging level value 3. Maximum no. of threads: You can change the either the default value or a value previously set After making required changes, click on Submit button. Depending on the status of the operations performed a success or failure message. Along with corresponding return value will be displayed under section Operation Execution Results Viewing Virtual Application Instance Logs Your virtual application patterns must be deployed and all of your virtual machines started before you can monitor results. 1. Click Instances > Virtual Application Instances. The Virtual Application Instances pane displays with the virtual application instances listed. 2. Select a virtual application instance. The details display to the right. 3. Click Log, located under the VM Status column to view the virtual machine status logs. The Log Viewer pane displays with organized log sections, such as operating system log, pattern type plug-in log and agent log. 4. The following types of logs can be viewed in the Log Viewer: a. Apache Tomcat Logs: catalina.out Provides Tomcat application logs. It very useful in checking the application deployment and server startup testing. localhost_access_log.txt These logs give information about response time of the application, what components of the application are accessed, source IP and so on tomcat_install.log Shows the logs created during installation of apache tomcat. b. MySQL Logs: mysql_artifacts_log.log Shows the errors, if any, present in the schema file uploaded for the database. mysql_master_log.log Provides master's initial log position and log level details as required by slave for replication purpose. mysql_mysqllog.log Logs created during installation of MySQL mysql_user.log Shows database password with which database can be connected WEBAPP PATTERN FOR APACHE TOMCAT 9
5. You can also view the log files in the Virtual Application Console. After you select the virtual application instance and the details display to the right, you can click Manage on the toolbar. Select the virtual machine for which you want to view logs. Click Logging on the dashboard. 6. Expand each section to view the logs. 7. Optional: Download the log file. After you expand the log type and select a log, you can click the green arrow to download the log. About Persistent Systems Established in 1990, Persistent Systems (BSE & NSE: PERSISTENT) is a global company specializing in software product and technology services. For more than two decades, Persistent has been an innovation partner for the world s largest technology brands, leading enterprises and pioneering start-ups. With a global team of more than 6,000 employees, Persistent has 300 customers spread across North America, Europe, and Asia. Today, Persistent focuses on developing best-in-class solutions in four key next-generation technology areas: Cloud Computing, Mobility, Analytics and Collaboration, for telecommunications, life sciences, consumer packaged goods, banking & financial services and healthcare verticals. For more information, please visit: www.persistentsys.com. India Persistent Systems Limited Bhageerath, 402, Senapati Bapat Road Pune 411016. Tel: +91 (20) 2570 2000 Fax: +91 (20) 2567 8901 USA Persistent Systems, Inc. 2055 Laurelwood Road,Suite 210 Santa Clara, CA 95054 Tel: +1 (408) 216 7010 Fax: +1 (408) 451 9177 Email: info@persistentsys.com WEBAPP PATTERN FOR APACHE TOMCAT 10