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.49 by valya, Fri May 23 15:00:47 2008 UTC vs.
Revision 1.90 by yuyi, Mon May 4 18:49:35 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines