automated tomcat management

34
(AUTOMATED) TOMCAT MANAGEMENT @ladislavGazo [email protected]

Upload: seges

Post on 14-Jun-2015

500 views

Category:

Internet


1 download

DESCRIPTION

How do you face Tomcat management issues in the deployment scenarios? Tomcat Control Center combined with Chef automation can help.

TRANSCRIPT

Page 1: Automated Tomcat Management

(AUTOMATED) TOMCAT

MANAGEMENT@ladislavGazo

[email protected]

Page 2: Automated Tomcat Management

TOMCAT

Page 3: Automated Tomcat Management

STRUCTUREbin control scripts lib common librarieswebapp instance contextlogs ...

Page 4: Automated Tomcat Management

PROBLEM?

NOfor development(or simple cases)

Page 5: Automated Tomcat Management

ADMIN'S PERSPECTIVEmultiple serversmultiple instances on a serverclustered environmentTomcat's lack of admin toolsnot willing to pay for tcServer

Page 6: Automated Tomcat Management

TEMPLATE: common loggingcommon librariescommon resource naming (JNDI)

VS.

INSTANCE:custom WAR

because of different versionscustom logsspecific resources (e.g. in JNDI)various apps deployed on one server

Page 7: Automated Tomcat Management

get the PID

ENDLESS KILLING /opt/tomcat/bin/shutdown.sh

thought it is killed :( ps aux | grep catal

once it is fine but... even in DEV it is boring

kill -9 <da_PID>

cd ../logsmv * /mnt/backup/logscd ../bin./startup.sh

Page 8: Automated Tomcat Management

... AND WE FACED SUCH ISSUES

Page 9: Automated Tomcat Management

TOMCAT CONTROL CENTER

Page 10: Automated Tomcat Management

HTTPS://GITHUB.COM/SEGES/TOMCAT-CONTROL-CENTER

Page 11: Automated Tomcat Management

WHAT IS IT?

Page 12: Automated Tomcat Management

CONCEPT

TEMPLATEand

(MULTIPLE) INSTANCE(S)controlled from

SINGLE POINT

Page 13: Automated Tomcat Management

[SMALL] SET OF SCRIPTSstart

(start_secured)

stop_forcerestart_force

backup_logs_restart_force

statusexport_instance_info

control-instances

Page 14: Automated Tomcat Management

CENTRAL RESOURCE CONTROLTomcatResources.py

automatically updates server.conf JNDI for each instanceusing central CSV files

setenvresource-db

resource-mailresource-envresource-rmi

...

Page 15: Automated Tomcat Management

OH GOSH, CSV FILES?

Yeah!

... and yeah! again, I can manage it in Excel :p

Page 16: Automated Tomcat Management

PROSlightweight and simpleseparate template and instancescentral management

CONSso far only on BASH-enabled systemsno Docker support yet :)(not actually a minus) no GUI

Page 17: Automated Tomcat Management
Page 18: Automated Tomcat Management
Page 19: Automated Tomcat Management

HTTPS://GITHUB.COM/SEGES/CHEF-COOKBOOK-TCC

Page 20: Automated Tomcat Management

INSTALLS TCC

PREPARES TEMPLATE(S)

PREPARES INSTANCE(S) ENV

(CAN) MONITOR WITH NEWRELIC

Page 21: Automated Tomcat Management

... WISDOM ...

Page 22: Automated Tomcat Management
Page 23: Automated Tomcat Management

AUTOMATED TCCcd ~/chef

git submodule add https://github.com/seges/chef-cookbook-tcc.git site-cookbooks/tcc

git submodule add https://github.com/escapestudios-cookbooks/newrelic.git site-cookbooks/newrelic

Page 24: Automated Tomcat Management

CREATE COOKBOOK OR RECIPE

knife cookbook create mycookie

Page 25: Automated Tomcat Management

DEFINE DEFAULT ATTRIBUTES

default.tcc.user = "lgazo"default.tcc.home = "/home/lgazo"default.tcc.location = "/home/lgazo/opt/tcc"

Page 26: Automated Tomcat Management

DEFINE TCC TOMCAT TEMPLATE WITHDEPENDENCIES

default['tcc']['templates'] = { "synapso" => { "type" => "tomcat7", "libs" => [ { "repo" => "maven", "artifact_id" => "org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1" }, { "repo" => "maven", "artifact_id" => "com.sun.messaging.mq:imq:4.4" }, { "repo" => "maven", "artifact_id" => "javax.mail:mail:1.4.4" }, { "repo" => "maven", "artifact_id" => "org.postgresql:postgresql:9.3-1100-jdbc41" } ] }}

Page 27: Automated Tomcat Management

FINALLY DEFINE AN INSTANCEdefault['tcc']['instances'] = { "syndev" => { "template" => "synapso", "user" => "lgazo" }}

Page 28: Automated Tomcat Management

AND TELL TCC COOKBOOK TO LOOK FORTEMPLATES IN OUR COOKBOOK

default['tcc']['template_cookbooks'] = "mycookie"

Page 29: Automated Tomcat Management

PREPARE DATABASE IF NEEDEDinclude_recipe "database::postgresql"

postgresql_connection_info = { :host => 'localhost', :port => node['postgresql']['config']['port'], :username => 'postgres', :password => node['postgresql']['password']['postgres']}

postgresql_database_user "synapso" do connection postgresql_connection_info password node.postgresql.password.synapso action :createend

postgresql_database "synapso" do connection postgresql_connection_info owner "synapso" action :createend

postgresql_database "synapso user can create DB" do connection postgresql_connection_info sql "alter role #{node.synapso.user} with createdb" action :queryend

Page 30: Automated Tomcat Management

in a server you can monitor it directly

INCLUDE TCCinclude_recipe "tcc::default"include_recipe "tcc::templates"include_recipe "tcc::instances"<font color="#333333" face="Lato, sans-serif"><span style=</span></font>

include_recipe "tcc::newrelic"

Page 31: Automated Tomcat Management

AND NOW THE CONFIGURATION OFINSTANCES

into templates/default/tcc/templates/synapso/conf

default environment is named “_default”

context.xml (in current version it is not Chef environment specific)jmx.properties (in current version it is not Chef environment specific)resources-

c onnector.csvdb.csvenv.csvmail.csvrmi.csvsetenv.csv

Page 32: Automated Tomcat Management

TCC MONITORING

JMXport and access configured in:

jmx.properties andsetenv.csv

NEWRELICinclude recipe tcc::newrelic

Page 33: Automated Tomcat Management

QUESTIONS?

@[email protected]

Page 34: Automated Tomcat Management

THANK YOU... FOR...

ATTENTION