AnsweredAssumed Answered

Post install changes best practices?

Question asked by karlbowden on Jan 23, 2009
Latest reply on Jan 24, 2009 by karlbowden
For the sake of testing I have been working on a script to complete the changes I need in a fresh full linux install to allow me to extract a backup of mysql and alf_data and test alfresco in different environments.

So far I have:

#!/bin/sh
BASE=/opt/Alfresco
#JAVA_VER="java-6-sun"
JAVA_VER="java-1.5.0-sun"

ln -s $BASE/alfresco.sh /etc/init.d/alfresco
ln -s $BASE/virtual_alf.sh /etc/init.d/virtual_alf

cd $BASE
for TARGET in alfresco.sh virtual_alf.sh ; do
        sed -i 's/@@ALFRESCO_DIR@@/\/opt\/Alfresco/' "$BASE/$TARGET"
        sed -i "s/@@JAVA_HOME@@/\/usr\/lib\/jvm\/$JAVA_VER\//" "$BASE/$TARGET"
done

#only required if this is a new mysql install
sudo mysql -p < /opt/Alfresco/extras/databases/mysql/db_setup.sql

DIR=tomcat/shared/classes/alfresco/extension
TARGET=$DIR/custom-repository.properties
sed -i 's/#dir.root=\/srv\/alfresco\/alf_data/dir.root=\/opt\/Alfresco\/alf_data/' "$BASE/$TARGET"
sed -i 's/db.driver=org.apache.derby.jdbc.EmbeddedDriver/#db.driver=org.apache.derby.jdbc.EmbeddedDriver/' "$BASE/$TARGET"
sed -i 's/db.url=jdbc:derby:alf_data\/derby_data\/alfresco;create=true/#db.url=jdbc:derby:alf_data\/derby_data\/alfresco;create=true/' "$BASE/$TARGET"
sed -i 's/#db.driver=org.gjt.mm.mysql.Driver/db.driver=org.gjt.mm.mysql.Driver/' "$BASE/$TARGET"
sed -i 's/#db.url=jdbc:mysql:\/\/localhost\/alfresco/db.url=jdbc:mysql:\/\/localhost\/alfresco/' "$BASE/$TARGET"

TARGET=$DIR/custom-hibernate-dialect.properties
sed -i 's/hibernate.dialect=org.hibernate.dialect.DerbyDialect/#hibernate.dialect=org.hibernate.dialect.DerbyDialect/' "$BASE/$TARGET"
sed -i 's/#hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect/hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect/' "$BASE/$TARGET"

# Fix for openoffice not being started
DIR=tomcat/shared/classes/alfresco/extension/bootstrap
TARGET=$DIR/openoffice-startup-context.xml
sed -i 's/"soffice"/\/usr\/lib\/openoffice\/program\/soffice.bin/' "$BASE/$TARGET"

# Fix for virtual_alf not starting
if [ "$1" = '–postwar' ]; then
        DIR=tomcat/webapps/alfresco/WEB-INF/classes/alfresco
        TARGET=$DIR/repository.properties
        sed -i 's/avm.rmi.service.port=50501/avm.rmi.service.port=50509/' "$BASE/$TARGET"
fi

I have chosen to use sed for file changes as using the sub command in this way has it is safe to run the script multiple times and only have the changes made once.

Process:
Install linux-full
Run script
start alfresco till wars are extracted, stop alfresco.
run script –postwar
alfresco start
virtual_alf start

So my questions:
Is there a better way of making those file changes?

What other changes should I be adding in?

Is there another way of changing tomcat/webapps/alfresco/WEB-INF/classes/alfresco/repository.properties without having to start alfresco first? (it would just be a bit cleaner if I could run the script only once then start alfresco)

Any other suggestions?

Platform notes: ubuntu-8.10-server-i386, java, oo, etc managed by puppet, alfresco-labs-3c, mysql-5.0.67, sun-java5-jre-1.5.0

Outcomes