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.1 by eulisse, Fri Dec 15 14:49:23 2006 UTC vs.
Revision 1.23 by valya, Tue Feb 5 16:39:04 2008 UTC

# Line 1 | Line 1
1 < ### RPM cms dbs-web v01_02_00
2 < ## INITENV +PATH PYTHONPATH %i/lib
1 > ### RPM cms dbs-server DBS_1_0_8
2  
3   %define cvstag %v
4 < Source: cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e&module=DBS/Web/DataDiscovery&export=DBS/Web/DataDiscovery&tag=-r%{cvstag}&output=/dbs-web.tar.gz
5 < Requires: python dbs-client py2-sqlalchemy cherrypy
4 > 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
5 > Requires: apache-ant mysql mysql-deployment oracle apache-tomcat java-jdk dbs-schema
6  
7   %prep
8   %setup -n DBS
9 + # kill running mysql|tomcat under my account since build is over
10 + ps -u`whoami` | grep mysqld | awk '{print "kill -9 "$1""}' |/bin/sh
11 + ps -u`whoami` | grep tomcat | awk '{print "kill -9 "$1""}' |/bin/sh
12 +
13   %build
14 < (make DBSHOME=%_builddir/DBS/Web/DataDiscovery )
14 > echo "PWD=$PWD"
15 > cd Servers/JavaServer
16 > # fix context.xml file
17 > cat > etc/context.xml << EOF_CONTEXT
18 > <Context path="/servlet/DBSServlet" docBase="DBSServlet" debug="5" reloadable="true" crossContext="true">
19 >     <SupportedSchemaVersion schemaversion="DBS_1_0_8" />
20 >     <SupportedClientVersions clientversions="DBS_1_0_1, DBS_1_0_5, DBS_1_0_7, DBS_1_0_8, DBS_1_0_9"/>
21 >     <DBSBlockConfig maxBlockSize="2000000000000" maxBlockFiles="100" />
22 >                        
23 >     <Resource name="jdbc/dbs"
24 >              auth="Container"
25 >              type="javax.sql.DataSource"
26 >              maxActive="30"
27 >              maxIdle="10"
28 >              maxWait="10000"
29 >              username="dbs"
30 >              password="cmsdbs"
31 >              driverClassName="org.gjt.mm.mysql.Driver"
32 >              url="jdbc:mysql://localhost:3316/%{cvstag}?autoReconnect=true"/>
33 > </Context>
34 > EOF_CONTEXT
35 >
36 > mkdir -p bin/WEB-INF/lib
37 > echo "PWD=$PWD"
38 > source $JAVA_JDK_ROOT/etc/profile.d/init.sh
39 > export JAVA_HOME=$JAVA_JDK_ROOT
40 > ant --noconfig dist
41 > cd ../../
42  
43   %install
44 < mkdir -p %i/bin
45 < mkdir -p %i/lib/python
46 < ls -l Web/DataDiscovery
47 < cp -r Web/DataDiscovery/* %i/lib/python
44 > mkdir -p %{i}/Servers/JavaServer/bin/WEB-INF/lib
45 > cp -r Servers/JavaServer/* %{i}/Servers/JavaServer
46 >
47 > # copy war file
48 > cp %{i}/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
49 >
50 > mkdir -p %{i}/etc/profile.d
51 > (echo "#!/bin/sh"; \
52 > echo "source $ORACLE_ROOT/etc/profile.d/init.sh"; \
53 > echo "source $MYSQL_ROOT/etc/profile.d/init.sh"; \
54 > echo "source $MYSQL_DEPLOYMENT_ROOT/etc/profile.d/init.sh"; \
55 > echo "source $APACHE_TOMCAT_ROOT/etc/profile.d/init.sh"; \
56 > echo "source $APACHE_ANT_ROOT/etc/profile.d/init.sh"; \
57 > echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.sh"; \
58 > echo "source $JAVA_JDK_ROOT/etc/profile.d/init.sh"; \
59 > echo "export JAVA_HOME=$JAVA_JDK_ROOT"
60 > echo "export CATALINA_HOME=$APACHE_TOMCAT_ROOT"
61 > ) > %{i}/etc/profile.d/dependencies-setup.sh
62 >
63 > (echo "#!/bin/tcsh"; \
64 > echo "source $ORACLE_ROOT/etc/profile.d/init.csh"; \
65 > echo "source $MYSQL_ROOT/etc/profile.d/init.csh"; \
66 > echo "source $MYSQL_DEPLOYMENT_ROOT/etc/profile.d/init.csh"; \
67 > echo "source $APACHE_TOMCAT_ROOT/etc/profile.d/init.csh"; \
68 > echo "source $APACHE_ANT_ROOT/etc/profile.d/init.csh"; \
69 > echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.csh"; \
70 > echo "source $JAVA_JDK_ROOT/etc/profile.d/init.csh"; \
71 > echo "setenv JAVA_HOME $JAVA_JDK_ROOT"
72 > echo "setenv CATALINA_HOME $APACHE_TOMCAT_ROOT"
73 > ) > %{i}/etc/profile.d/dependencies-setup.csh
74 >
75 >
76 > %post
77 > %{relocateConfig}etc/profile.d/dependencies-setup.sh
78 > %{relocateConfig}etc/profile.d/dependencies-setup.csh
79 >
80 > # setup MySQL server
81 > . $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh
82 > VO_CMS_SW_DIR=`echo $DBS_SERVER_ROOT | awk '{split($1,a,SCRAM_ARCH); print a[1]}' SCRAM_ARCH=$SCRAM_ARCH`
83 > export VO_CMS_SW_DIR
84 > $MYSQL_DEPLOYMENT_ROOT/bin/mysql-deployment.sh
85 >
86 > # set DBS DBs
87 > MYSQL_PORT=3316
88 > MYSQL_PATH=$MYSQL_ROOT/mysqldb
89 > MYSQL_SOCK=$MYSQL_PATH/mysql.sock
90 > MYSQL_PID=$MYSQL_PATH/mysqld.pid
91 > MYSQL_ERR=$MYSQL_PATH/error.log
92 > # grant permissions to CMS MySQL DBS account
93 > echo "+++ Grand permission to dbs account, DBS DB ${DBS_SCHEMA_VERSION} ..."
94 > echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK"
95 > echo "$DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql"
96 > # DBS uses trigger which requires to have SUPER priveleges, so we'll create DB using root
97 > # and delegate this to dbs account.
98 > $MYSQL_ROOT/bin/mysql -uroot -pcms --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql
99 > $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "GRANT ALL ON ${DBS_SCHEMA_VERSION}.* TO dbs@localhost;"
100 >
101 > # I need to copy/deploy DBS.war file into tomcat area
102 > cp $DBS_SERVER_ROOT/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps
103 >
104 > echo
105 > echo
106 > echo "In order to run DBS server you need to setup the following environment"
107 > echo
108 > echo "#############################################################"
109 > echo "export MYAREA=$RPM_INSTALL_PREFIX"
110 > echo "export SCRAM_ARCH=slc4_ia32_gcc345"
111 > echo "source $MYAREA/slc4_ia32_gcc345/external/apt/0.5.15lorg3.2-CMS3/etc/profile.d/init.sh"
112 > echo "source $DBS_SERVER_ROOT/etc/profile.d/init.sh"
113 > echo "#############################################################"
114 > echo
115 > echo "For your convinience we created setup_dbs.sh file with this settings"
116 > echo "It should be executed each time when you need to start DBS"
117 > echo
118 >
119 > # create setup file for users convenience
120 > if [ -e $RPM_INSTALL_PREFIX/setup_dbs.sh ]; then
121 >    echo "+++ Found $RPM_INSTALL_PREFIX/setup_dbs.sh, will keep it as $RPM_INSTALL_PREFIX/setup_dbs.sh.bak"
122 >    /bin/mv -f $RPM_INSTALL_PREFIX/setup_dbs.sh $RPM_INSTALL_PREFIX/setup_dbs.sh.bak
123 > else
124 >    echo "+++ File $RPM_INSTALL_PREFIX/setup_dbs.sh not found, will create"
125 > cat > $RPM_INSTALL_PREFIX/setup_dbs.sh << EOF2
126 > #!/bin/sh
127 > export MYAREA=$RPM_INSTALL_PREFIX
128 > export SCRAM_ARCH=slc4_ia32_gcc345
129 > source $MYAREA/slc4_ia32_gcc345/external/apt/0.5.15lorg3.2-CMS3/etc/profile.d/init.sh
130 > source $DBS_SERVER_ROOT/etc/profile.d/init.sh
131 > ps -u`whoami` | egrep "mysqld|tomcat" | awk '{print "kill -9 "$1""}' |/bin/sh
132 > echo "+++ Start up CMS MySQL daemon on port ${MYSQL_PORT} ..."
133 > $MYSQL_ROOT/bin/mysqld_safe --datadir=$MYSQL_PATH --port=$MYSQL_PORT \
134 > --socket=$MYSQL_SOCK --log-error=$MYSQL_ERR --pid-file=$MYSQL_PID &
135 > echo "+++ Start tomcat server"
136 > $APACHE_TOMCAT_ROOT/bin/catalina.sh start
137 > EOF2
138 >    chmod a+x $RPM_INSTALL_PREFIX/setup_dbs.sh
139 > fi
140 >
141 > # time to start up tomcat for user
142 > $APACHE_TOMCAT_ROOT/bin/catalina.sh start
143  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines