Tuesday, July 30, 2013

Upgrading from LAMS 2.3.5 to 2.4

Upgrading from 2.3.5 to 2.4

This is a fairly major upgrade as it also involves the deployment of JBOS 5.x to replace JBOSS 4.x

The upgrade instructions below are based on those from the site http://wiki.lamsfoundation.org/display/lamsdocs/Upgrading+LAMS+2.3.5+to+2.4+Linux

I have documented the steps I followed below with our installation

Login as root

Stop the existing LAMS service

service lams2 stop

Download LAMS 2.3.5 to 2.4 upgrade pack

lynx http://wiki.lamsfoundation.org/display/lams/Downloads

To help you the relevant area of the site is shown below

LAMS 2.4 for Unix and Linux

These new 2.4 packages aren't really installers but a bundle of all the resources you need to upgrade or install LAMS 2.4 from scratch.
   File                            md5sum check                             Size  instructions
   LAMS 2.4 installation pack   md5sum: 1f12668869230d89f7e69a999ad5eae1 93MBs Installing instructions
   LAMS 2.3.5 to 2.4 upgrade pack md5sum: 95d720e597251c5fb64f7445e3237ac6 93MBs Upgrade instructions

Unpack the files

tar -xzf lams-unix-upgrade-2.4.0.tar.gz
cd lams-unix-upgrade-2.4.0

Copy JBoss 5.1 and copy over the files from the previous installation (choosing to overwrite any existing files)

cp -pr jboss-5.1 /usr/local

unalias cp

cp -rf /usr/local/jboss-4.0.2/server/default/deploy/lams.ear/lams-www.war/secure /usr/local/jboss-5.1/server/default/deploy/lams.ear/lams-www.war/

cp -rf /usr/local/jboss-4.0.2/server/default/deploy/lams.ear/lams-www.war/news.html /usr/local/jboss-5.1/server/default/deploy/lams.ear/lams-www.war/news.html

cp -rf /usr/local/jboss-4.0.2/server/default/deploy/lams.ear/lams-www.war/images/pixlr /usr/local/jboss-5.1/server/default/deploy/lams.ear/lams-www.war/images/

Create a lams user and give it access to the appropriate directories

useradd -d /usr/local/jboss-5.1/bin -M lams

chown -R lams:lams /usr/local/jboss-5.1

chown -R lams:lams /var/opt/lams

I did not find it was not necessary to edit the MySQL connector in this instance

Run the LAMS upgrade scripts

cd new-tools/bbb-deploy/
./deploy.sh

cd ../imscc-deploy/
/deploy.sh

cd ../wookie-deploy/
./deploy.sh

Upgrade the database

mysql -u lamsuser -plamsdemo lams2

update lams_configuration set config_value = '/usr/local/jboss-5.1/server/default/deploy/lams.ear' where config_key = 'EARDir';

quit

Before LAMS would start it was necessary to get the environment variables in /etc/profile right

nano /etc/profile

a) It was necessary to replace

JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8"

with

JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dfile.encoding=UTF-8"

b) It was also necessary to comment out the JBOSS environment variable lines i.e.

# JBOSS_HOME=/usr/local/jboss-4.0.2
# export JBOSS_HOME

It is not necessary to set this environment variable and allows JBOSS to take care of its own directories

Logout and log back in again as root

LAMS can now be started using the following command

su - lams -c "/usr/local/jboss-5.1/bin/run.sh"

Eventually something like the following message should appear

10:29:08,390 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 14s:598ms

Unfortunately this is now running in the foreground

In order to get LAMS running as a service it was necessary to download and install the Java Service Wrapper

Read and follow the instructions on the following site VERY carefully

http://wiki.lamsfoundation.org/display/lamsdocs/Setup+Java+Service+Wrapper+for+LAMS

Download and unpack the wrapper

Make you download the correct version of the wrapper. You want the Linux x86 Community Edition of the Java Service Wrapper

Note that there may be a later version of this wrapper available

cd
lynx http://wrapper.tanukisoftware.com/doc/english/download.jsp#stable
tar xzvf wrapper-linux-x86-32-3.5.20.tar.gz
cd wrapper-linux-x86-32-3.5.20/bin

cp wrapper /usr/local/jboss-5.1/bin

cd ../src/bin
cp sh.script.in /usr/local/jboss-5.1/bin/lams2

cd ../../lib
cp libwrapper.so /usr/local/jboss-5.1/lib
cp wrapper.jar /usr/local/jboss-5.1/lib

mkdir /usr/local/jboss-5.1/conf
cp /root/wrapper-linux-x86-32-3.5.20/src/conf/wrapper.conf.in  /usr/local/jboss-5.1/conf/wrapper.conf

mkdir /usr/local/jboss-5.1/logs


Edit the lams 2 configuration file as shown below

cd /usr/local/jboss-5.1/bin
nano lams2

Change the following lines

# Application
APP_NAME="@app.name@"
APP_LONG_NAME="@app.long.name@"

To read

# Application
APP_NAME="lams2"
APP_LONG_NAME="LAMS"


Edit the run.sh file as shown below:

nano run.sh

VERY carefully change the following lines

while true; do
   if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "x" ]; then
      # Execute the JVM in the foreground
      "$JAVA" $JAVA_OPTS \
         -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
         -classpath "$JBOSS_CLASSPATH" \
         org.jboss.Main "$@"
      JBOSS_STATUS=$?

To read

while true; do
   if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "x" ]; then
      # Execute the JVM in the foreground
      echo "$JAVA $JAVA_OPTS \
         -Djava.endorsed.dirs=$JBOSS_ENDORSED_DIRS \
         -classpath $JBOSS_CLASSPATH \
         org.jboss.Main $@"
      JBOSS_STATUS=$?


Edit the wrapper.conf configuration file as shown below

nano /usr/local/jboss-5.1/conf/wrapper.conf

VERY carefully change the following lines

#********************************************************************
# Wrapper Java Properties
#********************************************************************
# Java Application
#  Locate the java binary on the system PATH:
wrapper.java.command=java
#  Specify a specific java binary:
#set.JAVA_HOME=/java/path
#wrapper.java.command=%JAVA_HOME%/bin/java

# Tell the Wrapper to log the full generated Java command line.
#wrapper.java.command.loglevel=INFO

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=../lib/wrapper.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib

# Java Bits.  On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=TRUE

# Java Additional Parameters
wrapper.java.additional.1=

# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3

# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=

#********************************************************************

To read

#********************************************************************
# Wrapper Java Properties
#********************************************************************
# Java Application
#  Locate the java binary on the system PATH:
#wrapper.java.command=java
#  Specify a specific java binary:
# set.JAVA_HOME=/java/path
# wrapper.java.command=$JAVA_HOME/bin/java
wrapper.java.command=/usr/java/jdk1.6.0_13/bin/java

# Tell the Wrapper to log the full generated Java command line.
#wrapper.java.command.loglevel=INFO

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../bin/run.jar
wrapper.java.classpath.3=$JAVA_HOME/lib/tools.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib

# Java Bits.  On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
# wrapper.java.additional.auto_bits=TRUE

# Java Additional Parameters
#wrapper.java.additional.1=
wrapper.java.additional.1=-Dprogram.name=run.sh
wrapper.java.additional.2=-XX:MaxPermSize=256m

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=256m

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=512m

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=org.jboss.Main

#********************************************************************

To save log files getting massive also change the following line

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=INFO

To read

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=NONE


Remember to create and symlink and make the lams2 file executable

cd /etc/init.d
ln -siv /usr/local/jboss-5.1/bin/lams2

chmod 755 /usr/local/jboss-5.1/bin/lams2

To start LAMS

service lams2 start