Skip to content
Snippets Groups Projects
Commit 8e60d7f5 authored by tpylak's avatar tpylak
Browse files

SE-104 make server installation script configurable by defining constants

SVN: 10980
parent 0b43fe4e
No related branches found
No related tags found
No related merge requests found
...@@ -11,33 +11,45 @@ VER=SNAPSHOT ...@@ -11,33 +11,45 @@ VER=SNAPSHOT
if [ $1 ]; then if [ $1 ]; then
VER=$1 VER=$1
fi fi
cd sprint-* SERVERS_DIR_ALIAS=sprint
PREV_VER=${PWD#*-} SERVERS_VER=$SERVERS_DIR_ALIAS-$VER
cd -
if [ -d $SERVERS_DIR_ALIAS-* ]; then
cd $SERVERS_DIR_ALIAS-*
PREV_VER=${PWD#*-}
SERVERS_PREV_VER=$SERVERS_DIR_ALIAS-$PREV_VER
cd ..
else
echo Warning: no previous servers instalation found.
SERVERS_PREV_VER=unknown
fi
DB_SNAPSHOT=db_snapshots/sprint$PREV_VER-lims_productive.sql
KEYSTORE=~/.keystore KEYSTORE=~/.keystore
# Unalias rm and cp commands # Unalias rm and cp commands
unalias rm unalias rm
unalias cp unalias cp
echo Stopping the components... if [ -e $SERVERS_PREV_VER ]; then
./sprint/openBIS-server/apache-tomcat/bin/shutdown.sh echo Stopping the components...
./sprint/datastore_server/datastore_server.sh stop ./$SERVERS_PREV_VER/openBIS-server/apache-tomcat/bin/shutdown.sh
./$SERVERS_PREV_VER/datastore_server/datastore_server.sh stop
fi
echo Making a database dump... echo Making a database dump...
pg_dump -U postgres -O lims_productive > $DB_SNAPSHOT DB_NAME=lims_productive
tar -cf - $DB_SNAPSHOT | bzip2 >db_snapshots/sprint$PREV_VER-lims_productive.tar.bz2 DB_SNAPSHOT=db_snapshots/$SERVERS_PREV_VER-$DB_NAME.sql
pg_dump -U postgres -O $DB_NAME > $DB_SNAPSHOT
tar -cf - $DB_SNAPSHOT | bzip2 > $DB_SNAPSHOT.tar.bz2
rm -f $DB_SNAPSHOT rm -f $DB_SNAPSHOT
echo Installing openBIS server... echo Installing openBIS server...
rm -rf old/sprint-$PREV_VER rm -rf old/$SERVERS_PREV_VER
mv sprint-$PREV_VER old mv $SERVERS_PREV_VER old
rm -f sprint rm -f $SERVERS_DIR_ALIAS
mkdir sprint-$VER mkdir $SERVERS_VER
ln -s sprint-$VER sprint ln -s $SERVERS_VER $SERVERS_DIR_ALIAS
cd sprint cd $SERVERS_DIR_ALIAS
unzip ../openBIS-server*$VER* unzip ../openBIS-server*$VER*
cd openBIS-server cd openBIS-server
./install.sh --nostartup $PWD ../../service.properties ./install.sh --nostartup $PWD ../../service.properties
...@@ -56,7 +68,7 @@ cd datastore_server ...@@ -56,7 +68,7 @@ cd datastore_server
cp -p ~/datastore_server-service.properties etc/service.properties cp -p ~/datastore_server-service.properties etc/service.properties
if [ -f $KEYSTORE ]; then if [ -f $KEYSTORE ]; then
cp -p $KEYSTORE etc/openBIS.keystore cp -p $KEYSTORE etc/openBIS.keystore
cp -Rf ~/old/sprint-$PREV_VER/datastore_server/data/store/* data/store cp -Rf ~/old/$SERVERS_PREV_VER/datastore_server/data/store/* data/store
sed 's/-Djavax.net.ssl.trustStore=etc\/openBIS.keystore //g' datastore_server.sh > xxx sed 's/-Djavax.net.ssl.trustStore=etc\/openBIS.keystore //g' datastore_server.sh > xxx
mv -f xxx datastore_server.sh mv -f xxx datastore_server.sh
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment