Opened 7 years ago

Closed 7 years ago

#793 closed (fixed)

Linux install script improvement

Reported by: Fredrik Levander Owned by: olle
Milestone: Proteios SE 2.18.0 Keywords:
Cc:

Description (last modified by Fredrik Levander)

To facilitate updates of Linux systems, the Linux installation script should use the config file of an existing installation if it exists, and the --force flag was given. The proposed procedure would be to look for the file $CATALINA_HOME/webapps/proteios/WEB_INF/config. If it exists, it should be used instead of the one under www/WEB-INF. Furthermore, if $CATALINA_HOME was not set, /var/lib/tomcat6 should also be tested as alternative location (Ubuntu default for CATALINA_HOME).

Change History (17)

comment:1 Changed 7 years ago by Fredrik Levander

Description: modified (diff)

comment:2 Changed 7 years ago by olle

Status: newassigned

Ticket accepted.

comment:3 Changed 7 years ago by olle

Traceability note:

  • Unix/Linux install script misc/install/install.sh was latest updated in Ticket #788 (Update of template files and scripts to allow new versions of external software).

comment:4 Changed 7 years ago by olle

(In [4385]) Refs #793. Unix/Linux install script misc/install/install.sh updated to use directory /var/lib/tomcat6 as default directory for Tomcat instead of /srv/tomcat6, when environment variable CATALINA_HOME is not set.

comment:5 Changed 7 years ago by Fredrik Levander

Summary: Linux install script improvmentLinux install script improvement

comment:6 Changed 7 years ago by olle

Design discussion: CATALINA_HOME vs CATALINA_BASE

Originally the Tomcat executables were located in directories $CATALINA_HOME/bin/ and $CATALINA_HOME/lib/, while each servlet was located in its own directory under $CATALINA_HOME/webapps/. However, in order to allow more than one instance of Tomcat to run simultaneously, e.g. with different port numbers, environment variable CATALINA_BASE was introduced to specify the location of the webapps/ directory, where the servlets for a specific Tomcat instance were installed, while $CATALINA_HOME specified the location of the Tomcat application itself.

To start several Tomcat instances with different configurations, $CATALINA_BASE is first set to the location for the servlets, the Tomcat instance in question should use, after which Tomcat is started (often from a start-up script) with desired configurations for the instance, including port number. $CATALINA_BASE is then set to the location for the servlets, the next Tomcat instance should use, and a new Tomcat instance is started with new configuration, and so on. The current value of $CATALINA_BASE can therefore only be used to find the location of servlets, for the last Tomcat instance started (provided its value has not been changed after that).

Unlike $CATALINA_HOME, CATALINA_BASE is not intended to be set to a fixed value for a system and remain unchanged for a considerable time, but is intended to tell Tomcat and related scripts what subset of servlets a specific operation concerns. However, on systems where only one instance of Tomcat is used, $CATALINA_BASE will specify the location of the webapps/ directory, where servlets are installed. This gives the administrator freedom to have the Tomcat application installed in one place, and servlet code in another. Some Linux distributions like Ubuntu have different default locations for these, $CATALINA_HOME is /usr/share/tomcat6/, while $CATALINA_BASE is /var/lib/tomcat6/ for Tomcat version 6. For a Tomcat installation with both application and webapps directory under the same root directory, $CATALINA_BASE will simply have the same value as $CATALINA_HOME.

Impact on Proteios SE:

  • In order to allow for the servlet code to be installed at another location than the Tomcat application, Proteios SE scripts should use $CATALINA_BASE instead of $CATALINA_HOME. This includes Ant build.xml files, that use the variable to determine where the executable code should be installed.
  • Since environment variable $CATALINA_BASE is not set to a value on many Unix/Linux systems, Proteios SE install scripts should check if the value is set, and if not, set it to the value of $CATALINA_HOME. If $CATALINA_HOME is not set to a value neither, different default directories should be tested for $CATALINA_BASE, and if none exist, the user will be notified to set a value for the variable.
  • Proteios SE scripts should no longer attempt to set a value for environment variable $CATALINA_HOME.
Last edited 7 years ago by olle (previous) (diff)

comment:7 Changed 7 years ago by olle

Design discussion.

The following Unix shell scripts currently refer to environment variable $CATALINA_HOME:

  1. client/servlet/www/WEB-INF/config
  2. client/servlet/www/WEB-INF/init.sh
  3. misc/install/install.sh

The following Unix shell script template files currently refer to environment variable $CATALINA_HOME:

  1. client/ftpd/proteios_ftp_server.sh.in

The following Ant build.xml files currently refer to environment variable $CATALINA_HOME:

  1. build.xml
  2. api/core/build.xml
  3. api/core/test/build.xml
  4. api/waf/build.xml
  5. client/ftpd/build.xml
  6. client/servlet/build.xml
  7. client/servlet/test/build.xml
  8. contrib/immun/build.xml
  9. contrib/SpectrumFileInspector/build.xml
  10. contrib/SpectrumLibraryExport/build.xml
  11. misc/myExtension/build.xml
  12. plugin/build.xml
  13. plugin/test/build.xml

Design update:

  • The Unix shell scripts and Ant build.xml files above should be updated to refer to $CATALINA_BASE instead of $CATALINA_HOME.
  • In addition, Unix shell script misc/install/install.sh and Unix shell script template file client/ftpd/proteios_ftp_server.sh.in should be updated to implement the functionality in the ticket description.
Last edited 7 years ago by olle (previous) (diff)

comment:8 Changed 7 years ago by olle

(In [4386]) Refs #793. Configuration Unix shell script www/WEB-INF/config in client/servlet/ updated:

  1. Environment variable $CATALINA_BASE is now referenced instead of $CATALINA_HOME.
  2. Default directory for $CATALINA_BASE is changed to /var/lib/tomcat6.
  3. Tomcat user and group are set to "tomcat6".

comment:9 Changed 7 years ago by olle

(In [4387]) Refs #793. Unix shell script www/WEB-INF/init.sh in client/servlet/ updated to reference environment variable $CATALINA_BASE instead of $CATALINA_HOME.

comment:10 Changed 7 years ago by olle

(In [4388]) Refs #793. Installation Unix shell script install.sh in misc/install/ updated:

  1. Environment variable $CATALINA_BASE is now referenced instead of $CATALINA_HOME for installation location.
  2. If $CATALINA_BASE is not set, it is initially set to the value of $CATALINA_HOME.
  3. If the "--force" flag is used and a previous Proteios SE installation is found, configuration script $CATALINA_BASE/webapps/proteios/WEB-INF/config is executed, else www/WEB-INF/config.
  4. If $CATALINA_BASE is not set to a valid directory, a number of different default directories are tested, and if none exist, the user is notified to set a value for the variable.

comment:11 Changed 7 years ago by olle

(In [4389]) Refs #793. Unix shell script template file proteios_ftp_server.sh.in in client/ftpd/ updated:

  1. Environment variable $CATALINA_BASE is now referenced instead of $CATALINA_HOME for installation location.
  2. If $CATALINA_BASE is not set, it is initially set to the value of $CATALINA_HOME.
  3. If $CATALINA_BASE is not set to a valid directory, a number of different default directories are tested, and if none exist, the user is notified to set a value for the variable.

comment:12 Changed 7 years ago by olle

Design update:

  • A problem with the current design of misc/install/install.sh for an existing installation, is that although configuration script $CATALINA_BASE/webapps/proteios/WEB-INF/config is executed instead of www/WEB-INF/config, the script will later copy the latter file to $CATALINA_BASE/webapps/proteios/WEB-INF/config. The next time install.sh is executed, it is therefore not the original config file that will be used. This is not a desired result, and the simplest solution is that "./install.sh --force" for an existing installation first copies $CATALINA_BASE/webapps/proteios/WEB-INF/config to www/WEB-INF/config, and then executes the latter file.

comment:13 Changed 7 years ago by olle

(In [4390]) Refs #793. Installation Unix shell script install.sh in misc/install/ updated:

  1. If the "--force" flag is used and a previous Proteios SE installation is found, configuration script $CATALINA_BASE/webapps/proteios/WEB-INF/config is first copied to www/WEB-INF/config before the latter script is executed.

comment:14 Changed 7 years ago by olle

(In [4391]) Refs #793. Ant build.xml files updated to refer to environment variable $CATALINA_BASE instead of $CATALINA_HOME:

  1. build.xml
  2. api/core/build.xml
  3. api/core/test/build.xml
  4. api/waf/build.xml
  5. client/ftpd/build.xml
  6. client/servlet/build.xml
  7. client/servlet/test/build.xml
  8. contrib/immun/build.xml
  9. contrib/SpectrumFileInspector/build.xml
  10. contrib/SpectrumLibraryExport/build.xml
  11. misc/myExtension/build.xml
  12. plugin/build.xml
  13. plugin/test/build.xml

comment:15 Changed 7 years ago by olle

(in [69]) Refs #793. Proteios SE wiki page Proteios 2 Installation updated with new note on "CATALINA_HOME vs CATALINA_BASE" under Requirements.

comment:16 Changed 7 years ago by olle

(In [4430]) Refs #793. Unix/Linux shell script www/WEB-INF/init.sh in client/servlet/ and shell script template file proteios_ftp_server.sh.in in client/fptd/ updated to run Proteios SE FTP server as the Tomcat user configured in shell script www/WEB-INF/config in `client/servlet/.

comment:17 Changed 7 years ago by olle

Resolution: fixed
Status: assignedclosed

Ticket closed as the Linux install scripts have been extended with a number of features, intended to facilitate installation.

Note: See TracTickets for help on using tickets.