Package: tomcatmanager
If you use Apache Tomcat for any sort of development work you’ve probably deployed
lots of applications to it. There are a several ways to get your war files deployed:use theTomcat Managerapplication in your browseruse theTomcat Ant Tasksincluded with
TomcatuseCargoand its plugins for ant and mavenHere’s another way: a command line tool and python library for managing a Tomcat server.How Do I Use It?This package installs a command line utility calledtomcat-manager. It’s
easily scriptable using your favorite shell:$ tomcat-manager --user=ace --password=newenglandclamchowder \
http://localhost:8080/manager deploy local sample.war /sampleapp
$ echo $?
0There is also an interactive mode:$ tomcat-manager
tomcat-manager>connect http://localhost:8080/manager ace
Password:
--connected to http://localhost:8080/manager as ace
tomcat-manager>list
Path                     Status  Sessions Directory
------------------------ ------- -------- ------------------------------------
/                        running        0 ROOT
/sampleapp               stopped        0 sampleapp##9
/sampleapp               running        0 sampleapp##8
/host-manager            running        0 /usr/share/tomcat8-admin/host-manage
/manager                 running        0 /usr/share/tomcat8-admin/managerAnd for the ultimate in flexibility, you can use the python package directly:>>>importtomcatmanagerastm>>>tomcat=tm.TomcatManager()>>>r=tomcat.connect(url="http://localhost:8080/manager",...user="ace",password="newenglandclamchowder")>>>tomcat.is_connectedTrue>>>r=tomcat.stop("/someapp")>>>r.okFalse>>>r.status_message'No context exists named /someapp'What Can It Do?Tomcatmanager has the following capabilities, all available from the command line,
interactive mode, and as a python library:deploy- deploy a war file containing a tomcat application in the tomcat serverredeploy- remove the application currently installed at a given path and
install a new war file thereundeploy- remove an application from the tomcat serverstart- start a tomcat application that has been deployed but isn’t runningstop- stop a tomcat application and leave it deployed on the serverreload- stop and start a tomcat applicationsessions- show active sessions for a particular tomcat applicationexpire- expire idle sessionslist- show all installed applicationsserverinfo- show information about the server, including tomcat version, OS
version and architecture, and jvm versionstatus- show server status information in xml formatvminfo- show diagnostic information about the jvmthreaddump- show a jvm thread dumpresources- show the global jdni resources configured in tomcatfindleakers- show tomcat applications that leak memorysslconnectorciphers- show tls ciphers configured for each connectorsslconnectorcerts- show tls certificate chain for each virtual hostsslconnectortrustedcerts- show trusted certificates for each virtual hostsslreload- reload tls certificate and key filesDocumentationComplete documentation for the last released version is available athttp://tomcatmanager.readthedocs.io/en/stable/. It includes material
showing how to usetomcat-managerfrom the command line or using
interactive mode. There is also a walkthrough of how to use the API and an
API reference.Documentation is also built from thedevelopbranch, and
published athttps://tomcatmanager.readthedocs.io/en/latest/. The develop
branch may not yet be released to PyPi, but you can see the documentation for what’s
coming up in the next release.InstallationYou’ll need Python >= 3.8. Install using pip:$ pip install tomcatmanagerWorks on Windows, macOS, and Linux.Works with Tomcat >= 8.5 and <= 10.1.Tomcat ConfigurationThis library and associated tools do their work via the Tomcat Manager
web application included in the Tomcat distribution. You will need to
configure authentication intomcat-users.xmlwith access to themanager-scriptrole:<tomcat-users>...<rolerolename="manager-script"/><userusername="ace"password="newenglandclamchowder"roles="manager-script"/>...</tomcat-users>