1 |
< |
### RPM cms dbs-server DBS_1_1_2e |
1 |
> |
### RPM cms dbs-server DBS_1_1_5 |
2 |
> |
|
3 |
> |
%define cvstag %{realversion} |
4 |
> |
# define version of DBS to use, it's schema version |
5 |
> |
%define dbs_version %{realversion} |
6 |
|
|
3 |
– |
%define cvstag %v |
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 |
9 |
|
|
18 |
|
# fix context.xml file |
19 |
|
cat > etc/context.xml << EOF_CONTEXT |
20 |
|
<Context path="/servlet/DBSServlet" docBase="DBSServlet" debug="5" reloadable="true" crossContext="true"> |
21 |
< |
<SupportedSchemaVersion schemaversion="DBS_1_0_9" /> |
22 |
< |
<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"/> |
21 |
> |
<SchemaOwner schemaowner="%{dbs_version}" /> |
22 |
> |
<SupportedSchemaVersion schemaversion="%{dbs_version}" /> |
23 |
> |
<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 "/> |
24 |
|
<DBSBlockConfig maxBlockSize="2000000000000" maxBlockFiles="100" /> |
25 |
< |
|
25 |
> |
|
26 |
|
<Resource name="jdbc/dbs" |
27 |
|
auth="Container" |
28 |
|
type="javax.sql.DataSource" |
32 |
|
username="dbs" |
33 |
|
password="cmsdbs" |
34 |
|
driverClassName="org.gjt.mm.mysql.Driver" |
35 |
< |
url="jdbc:mysql://localhost:3316/%{cvstag}?autoReconnect=true"/> |
35 |
> |
url="jdbc:mysql://localhost:3316/%{dbs_version}?autoReconnect=true"/> |
36 |
|
</Context> |
37 |
|
EOF_CONTEXT |
38 |
|
|
56 |
|
#!/bin/sh |
57 |
|
export MYAREA=rpm_install_area |
58 |
|
export SCRAM_ARCH=slc4_ia32_gcc345 |
59 |
< |
source \$MYAREA/\$SCRAM_ARCH/external/apt/0.5.15lorg3.2-CMS3/etc/profile.d/init.sh |
59 |
> |
source \$MYAREA/\$SCRAM_ARCH/external/apt/\$APT_VERSION/etc/profile.d/init.sh |
60 |
|
source \$MYAREA/%{pkgrel}/etc/profile.d/init.sh |
61 |
|
# set DBS DBs |
62 |
|
MYSQL_PORT=3316 |
75 |
|
{ |
76 |
|
echo "+++ Start up CMS MySQL daemon on port \${MYSQL_PORT} ..." |
77 |
|
\$MYSQL_ROOT/bin/mysqld_safe --datadir=\$MYSQL_PATH --port=\$MYSQL_PORT \ |
78 |
< |
--socket=\$MYSQL_SOCK --log-error=\$MYSQL_ERR --pid-file=\$MYSQL_PID & |
78 |
> |
--socket=\$MYSQL_SOCK --log-error=\$MYSQL_ERR --pid-file=\$MYSQL_PID --max_allowed_packet=32M & |
79 |
|
echo "+++ Start tomcat server" |
80 |
|
\$APACHE_TOMCAT_ROOT/bin/catalina.sh start |
81 |
|
sleep 2 |
170 |
|
MYSQL_PID=$MYSQL_PATH/mysqld.pid |
171 |
|
MYSQL_ERR=$MYSQL_PATH/error.log |
172 |
|
# grant permissions to CMS MySQL DBS account |
173 |
< |
echo "+++ Grand permission to dbs account, DBS DB ${DBS_SCHEMA_VERSION} ..." |
173 |
> |
echo "+++ Grand permission to dbs account, DBS schema %{dbs_version} ..." |
174 |
|
#echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK" |
175 |
< |
echo "$DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql" |
175 |
> |
echo "$DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql" |
176 |
|
# DBS uses trigger which requires to have SUPER priveleges, so we'll create DB using root |
177 |
|
# and delegate this to dbs account. |
178 |
< |
$MYSQL_ROOT/bin/mysql -uroot -pcms --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql |
179 |
< |
$MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "GRANT ALL ON ${DBS_SCHEMA_VERSION}.* TO dbs@localhost;" |
178 |
> |
$MYSQL_ROOT/bin/mysql -uroot -pcms --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/lib/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql |
179 |
> |
$MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "GRANT ALL ON %{dbs_version}.* TO dbs@localhost;" |
180 |
|
|
181 |
|
# I need to copy/deploy DBS.war file into tomcat area |
182 |
|
cp $DBS_SERVER_ROOT/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps |
183 |
|
|
184 |
+ |
# Copy mysql jdbc driver to tomcat |
185 |
+ |
if [ ! -f $APACHE_TOMCAT_ROOT/common/lib/mysql-connector-java-5.0.5-bin.jar ]; then |
186 |
+ |
cp $DBS_SERVER_ROOT/Servers/JavaServer/lib/mysql-connector-java-5.0.5-bin.jar \ |
187 |
+ |
$APACHE_TOMCAT_ROOT/common/lib |
188 |
+ |
fi |
189 |
+ |
|
190 |
|
# Fix path in dbs_init.sh file since now we know install area |
191 |
|
cat $DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh | sed "s,rpm_install_area,$RPM_INSTALL_PREFIX,g" > \ |
192 |
|
$DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh.new |
199 |
|
|
200 |
|
# kill running mysql|tomcat under my account since build is over |
201 |
|
echo "+++ Clean-up mysqld|tomcat processes" |
202 |
< |
ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |
202 |
> |
#ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |
203 |
|
#ps -w -w -f -u`whoami` | egrep "mysqld|tomcat" | grep -v egrep | awk '{print "kill -9 "$2""}' |/bin/sh |
204 |
|
killall -q mysqld |
205 |
|
killall -q tomcat |
207 |
|
echo |
208 |
|
echo |
209 |
|
echo "##### IMPORTANT!!! #####" |
210 |
< |
echo "For your convinience we created" |
210 |
> |
echo "To work with DBS you need to source init.sh file located at" |
211 |
> |
echo "$DBS_SERVER_ROOT/etc/profile.d/init.sh" |
212 |
> |
echo |
213 |
> |
echo "OR use init script to start|stop|status DBS services:" |
214 |
|
echo "$DBS_SERVER_ROOT/Servers/JavaServer/bin/dbs_init.sh" |
215 |
< |
echo "init script file which can be placed into /etc/init.d/ to allow auto-startup of DBS service" |
216 |
< |
echo "##### END OF README #####" |
215 |
> |
echo "init script file can be placed into /etc/init.d/ to allow auto-startup of DBS service" |
216 |
> |
echo "##########################" |
217 |
|
echo |
218 |
|
|