How to Manage Apache Tomcat Update With Python

Abdurrahim Yıldırım
3 min readFeb 1, 2019

--

Enterprise Software architecture refers to high level structures and disciplines. For most organization managing software update may be the hardest part of building enterprise software architecture.

Software updates are unavoidable in any information technology platform. For example, business needs, new features, security vulnerabilities etc. may be some reasons that force company to update existing software. Moreover, many company can no longer afford the high cost of update because of manual tasks.

Apache Tomcat software is an open source web server tool which allows to implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.This product was developed by the Apache Software Foundation with Java Community Process.

For administrator and web developers there are some points that should familiarize before start to design software directory structure.

At this post we will focus on create directory structure and manage updates with python.Basically standard tomcat directory structure can visualize like that;

The main purpose to change default Tomcat directory structure is keeping existing configurations and web deployments while perform upgrade process. Tomcat directory structure should strongly depends on application architecture.

I have added my default configuration. I always prefer to use symbolic link for the configurations and deployment files. These files will be kept in persistent storage area. For my case, AppDirectory will “/appdata/app”.

I added directory structure for the file that I linked. Under binary directory there are two files that I create symbolic links (setenv.sh and setvars.sh).

You should also need to create symbolic links for the configuration files that you specified.

Library directory contains default libraries when you install tomcat. You may need to add additional libraries to application. So, you should create a directory to locate additional libraries (/appdata/app/lib/). Then you need to define additional libraries on setenv.sh file. The configuration will be;

ADDITIONALPATH=”/appdata/app/lib/test.jar:/appdata/app/lib/test2.jar”

CLASSPATH=$CLASSPATH:$ADDITIONALPATH

Last but not least important directories are “logs” and “webapps”. I strongly recommend to create symbolic links for these two directories.

I’m working on a python project that automate tomcat upgrade process with this structure. Basically you can check this GitHup project that I shared.

I aim to manage these tasks;

  • Check existing tomcat configuration
  • Create a backup
  • Allow user to choose tomcat version that will be updated
  • Download binaries
  • Perform update task on remote server
  • Check tomcat status
  • Finish and summarize

If you have any question or need help, feel free to open support ticket on web page. Let’s share together.

--

--