ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/dbs-server.spec
(Generate patch)

Comparing COMP/CMSDIST/dbs-server.spec (file contents):
Revision 1.43 by valya, Tue May 6 16:40:47 2008 UTC vs.
Revision 1.85 by valya, Fri Apr 10 18:04:27 2009 UTC

# Line 1 | Line 1
1 < ### RPM cms dbs-server DBS_1_0_8
1 > ### RPM cms dbs-server DBS_2_0_6
2  
3  
4 < %define cvstag %realversion
4 > %define cvstag %{realversion}
5   # define version of DBS to use, it's schema version
6 < %define dbs_version DBS_1_0_8
6 > %define dbs_version %{realversion}
7  
8   Source: cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e&module=DBS/Servers/JavaServer&export=DBS&tag=-r%{cvstag}&output=/dbs-server.tar.gz
9 < Requires: apache-ant mysql mysql-deployment oracle apache-tomcat java-jdk dbs-schema
9 > Requires: apache-ant mysql mysql-deployment oracle apache-tomcat java-jdk dbs-schema dbs-libs
10  
11   %prep
12   %setup -n DBS
# Line 14 | Line 14 | Requires: apache-ant mysql mysql-deploym
14   ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh
15  
16   %build
17 + # DBS wants to have LibValut attached to DBS top-level dir, required by build.xml file
18 + ln -s $DBS_LIBS_ROOT/lib LibValut
19   echo "PWD=$PWD"
20   cd Servers/JavaServer
21 +
22 + # retrieve which DBS schema to use
23 + #export DBS_SCHEMA=`grep "^use " $DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql | awk '{print $2}' | sed "s/;//g"`
24 + #export DBS_SCHEMA_VERSION=`cat  $DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql | grep "INSERT INTO SchemaVersion" | awk '{split($0,a,"\x27"); print a[2]}'`
25 +
26   # fix context.xml file
27 < cat > etc/context.xml << EOF_CONTEXT
21 < <Context path="/servlet/DBSServlet" docBase="DBSServlet" debug="5" reloadable="true" crossContext="true">
22 <     <SchemaOwner schemaowner="%{dbs_version}" />
23 <     <SupportedSchemaVersion schemaversion="%{dbs_version}" />
24 <     <SupportedClientVersions clientversions="DBS_1_0_1, DBS_1_0_5, DBS_1_0_7, DBS_1_0_8"/>
25 <     <DBSBlockConfig maxBlockSize="2000000000000" maxBlockFiles="100" />
26 <                        
27 <     <Resource name="jdbc/dbs"
28 <              auth="Container"
29 <              type="javax.sql.DataSource"
30 <              maxActive="30"
31 <              maxIdle="10"
32 <              maxWait="10000"
33 <              username="dbs"
34 <              password="cmsdbs"
35 <              driverClassName="org.gjt.mm.mysql.Driver"
36 <              url="jdbc:mysql://localhost:3316/%{dbs_version}?autoReconnect=true"/>
37 < </Context>
38 < EOF_CONTEXT
27 > cat etc/context.xml.tobe  | sed "s/__insert_username__/dbs/g" | sed "s/__insert_password__/cmsdbs/g" | sed "s/3306/3316/g" | sed "s/maxActive=\"0\"/maxActive=\"100\"/g" > etc/context.xml
28  
29 + # compile DBS server code
30   mkdir -p bin/WEB-INF/lib
31   echo "PWD=$PWD"
32   source $JAVA_JDK_ROOT/etc/profile.d/init.sh
# Line 47 | Line 37 | cd ../../
37   %install
38   mkdir -p %{i}/Servers/JavaServer/bin/WEB-INF/lib
39   cp -r Servers/JavaServer/* %{i}/Servers/JavaServer
40 + ln -s $DBS_LIBS_ROOT/lib %{i}/LibValut
41  
42   # copy war file
43   cp %{i}/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
# Line 57 | Line 48 | cat > %{i}/Servers/JavaServer/bin/dbs_in
48   #!/bin/sh
49   export MYAREA=rpm_install_area
50   export SCRAM_ARCH=slc4_ia32_gcc345
51 + export APT_VERSION=0.5.15lorg3.2-cmp
52   source \$MYAREA/\$SCRAM_ARCH/external/apt/\$APT_VERSION/etc/profile.d/init.sh
53   source \$MYAREA/%{pkgrel}/etc/profile.d/init.sh
54   # set DBS DBs
# Line 70 | Line 62 | function dbs_stop()
62   {
63      me=\`whoami\`
64      echo $"Stop mysqld|tomcat running under \$me account..."
65 <    ps -w -w -f -u\$me | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "\$2""}'|/bin/sh
65 >    ps -w -w -f -u\$me | grep mysqld | grep \$MYSQL_PORT | grep -v grep | awk '{print "kill -9 "\$2""}'|/bin/sh
66 >    ps -w -w -f -u\$me | grep tomcat | grep -v grep | awk '{print "kill -9 "\$2""}'|/bin/sh
67   }
68   function dbs_start()
69   {
# Line 86 | Line 79 | function dbs_start()
79   function dbs_status()
80   {
81      me=\`whoami\`
82 <    dbs_mysqld=\`ps -w -w -f -u\$me | egrep "mysqld" | grep -v egrep | wc -l\`
82 >    dbs_mysqld=\`ps -w -w -f -u\$me | egrep "mysqld" | grep \$MYSQL_PORT| grep -v egrep | wc -l\`
83      dbs_tomcat=\`ps -w -w -f -u\$me | egrep "tomcat" | grep -v egrep | wc -l\`
84      if [ \${dbs_tomcat} -ne 1 ]; then
85         echo "Tomcat server is not running"
# Line 136 | Line 129 | mkdir -p %{i}/etc/profile.d
129   echo "source $APACHE_TOMCAT_ROOT/etc/profile.d/init.sh"; \
130   echo "source $APACHE_ANT_ROOT/etc/profile.d/init.sh"; \
131   echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.sh"; \
132 + echo "source $DBS_LIBS_ROOT/etc/profile.d/init.sh"; \
133   echo "source $JAVA_JDK_ROOT/etc/profile.d/init.sh"; \
134   echo "export JAVA_HOME=$JAVA_JDK_ROOT"
135   echo "export CATALINA_HOME=$APACHE_TOMCAT_ROOT"
# Line 148 | Line 142 | mkdir -p %{i}/etc/profile.d
142   echo "source $APACHE_TOMCAT_ROOT/etc/profile.d/init.csh"; \
143   echo "source $APACHE_ANT_ROOT/etc/profile.d/init.csh"; \
144   echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.csh"; \
145 + echo "source $DBS_LIBS_ROOT/etc/profile.d/init.csh"; \
146   echo "source $JAVA_JDK_ROOT/etc/profile.d/init.csh"; \
147   echo "setenv JAVA_HOME $JAVA_JDK_ROOT"
148   echo "setenv CATALINA_HOME $APACHE_TOMCAT_ROOT"
# Line 173 | Line 168 | MYSQL_ERR=$MYSQL_PATH/error.log
168   # grant permissions to CMS MySQL DBS account
169   echo "+++ Grand permission to dbs account, DBS schema %{dbs_version} ..."
170   #echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK"
171 < echo "$DBS_SCHEMA_ROOT/lib/DBS-NeXtGen-MySQL_DEPLOYABLE.sql"
171 > echo "$DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql"
172   # DBS uses trigger which requires to have SUPER priveleges, so we'll create DB using root
173   # and delegate this to dbs account.
174 < $MYSQL_ROOT/bin/mysql -uroot -pcms --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql
175 < $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "GRANT ALL ON %{dbs_version}.* TO dbs@localhost;"
174 > export DBS_SCHEMA=`grep "^use " $DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql | awk '{print $2}' | sed "s/;//g"`
175 > $MYSQL_ROOT/bin/mysql -uroot -pcms --port=$MYSQL_PORT --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql
176 > $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK --port=$MYSQL_PORT -uroot -pcms mysql -e "GRANT ALL ON ${DBS_SCHEMA}.* TO dbs@localhost;"
177  
178   # I need to copy/deploy DBS.war file into tomcat area
179   cp $DBS_SERVER_ROOT/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
180  
181   # Copy mysql jdbc driver to tomcat
182 < if [ ! -f $APACHE_TOMCAT_ROOT/common/lib/mysql-connector-java-5.0.5-bin.jar ]; then
187 < cp $DBS_SERVER_ROOT/Servers/JavaServer/lib/mysql-connector-java-5.0.5-bin.jar \
188 <   $APACHE_TOMCAT_ROOT/common/lib
189 < fi
182 > cp -f $DBS_LIBS_ROOT/lib/*.jar $APACHE_TOMCAT_ROOT/common/lib
183  
184   # Fix path in dbs_init.sh file since now we know install area
185   cat $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh | sed "s,rpm_install_area,$RPM_INSTALL_PREFIX,g" > \
# Line 202 | Line 195 | chmod a+x $DBS_SERVER_ROOT/Servers/JavaS
195   echo "+++ Clean-up mysqld|tomcat processes"
196   #ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}'
197   #ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh
198 < killall -q mysqld
198 > #killall -q mysqld
199 > #cat $MYSQL_ROOT/mysqldb/mysqld.pid
200 > $MYSQL_ROOT/bin/mysqladmin -uroot -pcms --socket=$MYSQL_SOCK --port=$MYSQL_PORT shutdown
201   killall -q tomcat
202  
203 + # made correct link to LibValut
204 + rm -f $DBS_SERVER_ROOT/LibValut
205 + ln -s $DBS_LIBS_ROOT/lib $DBS_SERVER_ROOT/LibValut
206 +
207   echo
208   echo
209   echo "#####  IMPORTANT!!!  #####"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines