Apache Tomcat, often referred to as Tomcat Server, is an open-source Java Servlet Container developed by the Apache Software Foundation (ASF). Tomcat implements several Java EE specifications including Java Servlet, JavaServer Pages (JSP), Java EL, and WebSocket, and provides a "pure Java" HTTP web server environment in which Java code can run.
Apache Tomcat version 9.0 implements the Servlet 4.0 and JavaServer Pages 2.3 specifications from the Java Community Process, and includes many additional features that make it a useful platform for developing and deploying web applications and web services.
Deploy the Tomcat charm:
juju deploy tomcat
Make Tomcat publicly available:
juju expose tomcat
Browse to the public IP with port to start using Tomcat. For example: "http://35.195.173.22:8080".
Checklist for scaling Tomcat:
- Make sure you enable clustering in the configuration by clicking the cluster_enabled option.
- Add to web.xml of every webapp that needs session replication. The session state gets transferred for each web application that has distributable in its web.xml. The file can be found in the WEB-INF folder. For example: /opt/apache-tomcat-9.0.1/webapps/manager/WEB-INF/web.xml.
- A relation with HAProxy is required to make clustering work. If you decide to use a load balancer like HAProxy make sure you unexpose Tomcat and expose the load balancer for security reasons.
- At the moment clustering only works when your cloud provider allows multicasting.