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:
Here's another way: a command line tool and python library for managing a Tomcat server.
This package installs a command line utility called tomcat-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 $? 0
There 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/manager
And for the ultimate in flexibility, you can use the python package directly:
>>> import tomcatmanager as tm >>> tomcat = tm.TomcatManager() >>> r = tomcat.connect(url="http://localhost:8080/manager", ... user="ace", password="newenglandclamchowder") >>> tomcat.is_connected True >>> r = tomcat.stop("/someapp") >>> r.ok False >>> r.status_message 'No context exists named /someapp'
Tomcatmanager has the following capabilities, all available from the command line, interactive mode, and as a python library:
Complete documentation for the last released version is available at http://tomcatmanager.readthedocs.io/en/stable/. It includes material showing how to use tomcat-manager
from 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 the develop branch, and published at https://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.
You'll need Python >= 3.8. Install using pip:
$ pip install tomcatmanager
Works on Windows, macOS, and Linux.
Works with Tomcat >= 8.5 and <= 10.1.
This library and associated tools do their work via the Tomcat Manager web application included in the Tomcat distribution. You will need to configure authentication in tomcat-users.xml
with access to the manager-script
role:
<tomcat-users> ... <role rolename="manager-script"/> <user username="ace" password="newenglandclamchowder" roles="manager-script"/> ... </tomcat-users>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4