Cleaning Tomcat for Redeployment

Cleaning Tomcat for Redeployment

Introduction

While it is often better to start with a fresh installation of Tomcat, sometimes it is useful to just clean out all traces of Sakai from Tomcat and redeploy.

Procedure for Sakai 11+

Tomcat 8

Shut Tomcat down. From the Tomcat directory:

  • components

    • Delete everything

  • endorsed (Sakai 12+ only)

    • Delete everything

  • lib

    • Delete everything except:

      • The original jars that came with Tomcat

        • Either keep a list of these and exclude them from the deletion (see Linux Tip below) or re-copy from a freshly-extracted Tomcat 8

      •  your database drivers (see Linux Tip below)

        • Note that if you are using the MariaDB driver shipped with Sakai 11, you can safely delete it and it will be restored when you deploy Sakai

      • For Linux (substituting ecj-<version>.jar, and <your database driver>); tested in tomcat 8.0.32, and tomcat 8.0.33:

        cd /opt/tomcat/lib shopt -s extglob rm -rf !(annotations-api.jar|catalina-ant.jar|catalina-ha.jar|catalina-storeconfig.jar|catalina-tribes.jar|catalina.jar|ecj-<version>.jar|el-api.jar|jasper-el.jar|jasper.jar|jsp-api.jar|servlet-api.jar|tomcat-api.jar|tomcat-coyote.jar|tomcat-dbcp.jar|tomcat-i18n-es.jar|tomcat-i18n-fr.jar|tomcat-i18n-ja.jar|tomcat-jdbc.jar|tomcat-jni.jar|tomcat-util-scan.jar|tomcat-util.jar|tomcat-websocket.jar|websocket-api.jar|<your database driver>)
  • temp

    • Delete everything

  • webapps

    • Keep ROOT (if you have it)

    • Delete everything else (see Linux Tip below)

  • work

    • Delete everything

Procedure for Sakai 10 and under

Tomcat 7/8

Shut Tomcat down. From the Tomcat directory:

  • common/lib:

    • Delete everything (Database drivers should be in lib, the other jars will be redeployed by Maven)

  • components

    • Delete everything

  • shared/lib

    • Delete everything

  • temp

    • Delete everything

  • webapps

    • Keep ROOT (if you have it)

    • Delete everything else (see Linux Tip below)

  • work

    • Delete everything

Tomcat 5.5

Shut Tomcat down. From the Tomcat directory: common/lib: Delete sakai*.jar components Delete everything conf/Catalina/localhost Keep host-manager.xml, manager.xml Delete everything else server/lib Delete sakai*.jar shared/lib Delete everything temp Delete everything webapps Keep ROOT (maybe balancer and webdav as well) Delete everything else (see Linux Tip below) work Delete everything

 

This process could be automated with a script or Maven goal.

Linux Tip

Run the following commands to delete everything in webapps except the specified directories ROOT, balancer, and webdav. A similar command can be used to avoid deletion of database driver jars.

cd /opt/tomcat/webapps shopt -s extglob rm -rf !(ROOT|balancer|webdav)

References

Comments