1 |
< |
### RPM cms dbs-server v00_00_14 |
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/Servers/JavaServer&export=DBS&tag=-r%{cvstag}&output=/dbs-server.tar.gz |
5 |
< |
Requires: apache-ant mysql oracle apache-tomcat |
6 |
< |
#Requires: apache-ant apache-tomcat |
5 |
> |
Requires: apache-ant mysql mysql-deployment oracle apache-tomcat java-jdk dbs-schema |
6 |
|
|
7 |
|
%prep |
8 |
|
%setup -n DBS |
9 |
+ |
|
10 |
|
%build |
11 |
|
echo "PWD=$PWD" |
12 |
|
cd Servers/JavaServer |
13 |
+ |
# fix context.xml file |
14 |
+ |
cat > etc/context.xml << EOF_CONTEXT |
15 |
+ |
<Context path="/servlet/DBSServlet" docBase="DBSServlet" debug="5" reloadable="true" crossContext="true"> |
16 |
+ |
<SupportedSchemaVersion schemaversion="DBS_1_0_8" /> |
17 |
+ |
<SupportedClientVersions clientversions="DBS_1_0_1, DBS_1_0_5, DBS_1_0_7, DBS_1_0_8, DBS_1_0_9"/> |
18 |
+ |
<DBSBlockConfig maxBlockSize="2000000000000" maxBlockFiles="100" /> |
19 |
+ |
|
20 |
+ |
<Resource name="jdbc/dbs" |
21 |
+ |
auth="Container" |
22 |
+ |
type="javax.sql.DataSource" |
23 |
+ |
maxActive="30" |
24 |
+ |
maxIdle="10" |
25 |
+ |
maxWait="10000" |
26 |
+ |
username="dbs" |
27 |
+ |
password="cmsdbs" |
28 |
+ |
driverClassName="org.gjt.mm.mysql.Driver" |
29 |
+ |
url="jdbc:mysql://localhost:3316/%{cvstag}?autoReconnect=true"/> |
30 |
+ |
</Context> |
31 |
+ |
EOF_CONTEXT |
32 |
+ |
|
33 |
+ |
mkdir -p bin/WEB-INF/lib |
34 |
|
echo "PWD=$PWD" |
35 |
+ |
source $JAVA_JDK_ROOT/etc/profile.d/init.sh |
36 |
+ |
export JAVA_HOME=$JAVA_JDK_ROOT |
37 |
|
ant --noconfig dist |
38 |
|
cd ../../ |
39 |
|
|
40 |
|
%install |
41 |
< |
mkdir -p %{i}/Servers/JavaServer/ |
41 |
> |
mkdir -p %{i}/Servers/JavaServer/bin/WEB-INF/lib |
42 |
|
cp -r Servers/JavaServer/* %{i}/Servers/JavaServer |
43 |
|
|
44 |
+ |
# copy war file |
45 |
+ |
cp %{i}/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps |
46 |
+ |
|
47 |
+ |
mkdir -p %{i}/etc/profile.d |
48 |
+ |
(echo "#!/bin/sh"; \ |
49 |
+ |
echo "source $ORACLE_ROOT/etc/profile.d/init.sh"; \ |
50 |
+ |
echo "source $MYSQL_ROOT/etc/profile.d/init.sh"; \ |
51 |
+ |
echo "source $MYSQL_DEPLOYMENT_ROOT/etc/profile.d/init.sh"; \ |
52 |
+ |
echo "source $APACHE_TOMCAT_ROOT/etc/profile.d/init.sh"; \ |
53 |
+ |
echo "source $APACHE_ANT_ROOT/etc/profile.d/init.sh"; \ |
54 |
+ |
echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.sh"; \ |
55 |
+ |
echo "source $JAVA_JDK_ROOT/etc/profile.d/init.sh"; \ |
56 |
+ |
) > %{i}/etc/profile.d/dependencies-setup.sh |
57 |
+ |
|
58 |
+ |
(echo "#!/bin/tcsh"; \ |
59 |
+ |
echo "source $ORACLE_ROOT/etc/profile.d/init.csh"; \ |
60 |
+ |
echo "source $MYSQL_ROOT/etc/profile.d/init.csh"; \ |
61 |
+ |
echo "source $MYSQL_DEPLOYMENT_ROOT/etc/profile.d/init.csh"; \ |
62 |
+ |
echo "source $APACHE_TOMCAT_ROOT/etc/profile.d/init.csh"; \ |
63 |
+ |
echo "source $APACHE_ANT_ROOT/etc/profile.d/init.csh"; \ |
64 |
+ |
echo "source $DBS_SCHEMA_ROOT/etc/profile.d/init.csh"; \ |
65 |
+ |
echo "source $JAVA_JDK_ROOT/etc/profile.d/init.csh"; \ |
66 |
+ |
) > %{i}/etc/profile.d/dependencies-setup.csh |
67 |
+ |
|
68 |
+ |
|
69 |
+ |
%post |
70 |
+ |
%{relocateConfig}etc/profile.d/dependencies-setup.sh |
71 |
+ |
%{relocateConfig}etc/profile.d/dependencies-setup.csh |
72 |
+ |
|
73 |
+ |
# setup MySQL server |
74 |
+ |
. $RPM_INSTALL_PREFIX/%{pkgrel}/etc/profile.d/init.sh |
75 |
+ |
VO_CMS_SW_DIR=`echo $DBS_SERVER_ROOT | awk '{split($1,a,SCRAM_ARCH); print a[1]}' SCRAM_ARCH=$SCRAM_ARCH` |
76 |
+ |
export VO_CMS_SW_DIR |
77 |
+ |
$MYSQL_DEPLOYMENT_ROOT/bin/mysql-deployment.sh |
78 |
+ |
|
79 |
+ |
# set DBS DBs |
80 |
+ |
MYSQL_PORT=3316 |
81 |
+ |
MYSQL_PATH=$MYSQL_ROOT/mysqldb |
82 |
+ |
MYSQL_SOCK=$MYSQL_PATH/mysql.sock |
83 |
+ |
MYSQL_PID=$MYSQL_PATH/mysqld.pid |
84 |
+ |
MYSQL_ERR=$MYSQL_PATH/error.log |
85 |
+ |
# grant permissions to CMS MySQL DBS account |
86 |
+ |
echo "+++ Grand permission to dbs account, DBS DB ${DBS_SCHEMA_VERSION} ..." |
87 |
+ |
echo "$MYSQL_ROOT/bin/mysql -udbs -pcmsdbs --socket=$MYSQL_SOCK" |
88 |
+ |
echo "$DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql" |
89 |
+ |
# DBS uses trigger which requires to have SUPER priveleges, so we'll create DB using root |
90 |
+ |
# and delegate this to dbs account. |
91 |
+ |
$MYSQL_ROOT/bin/mysql -uroot -pcms --socket=$MYSQL_SOCK < $DBS_SCHEMA_ROOT/Schema/NeXtGen/DBS-NeXtGen-MySQL_DEPLOYABLE.sql |
92 |
+ |
$MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "GRANT ALL ON ${DBS_SCHEMA_VERSION}.* TO dbs@localhost;" |
93 |
+ |
|
94 |
+ |
# I need to copy/deploy DBS.war file into tomcat area |
95 |
+ |
cp $DBS_SERVER_ROOT/Servers/JavaServer/DBS.war $APACHE_TOMCAT_ROOT/webapps |
96 |
+ |
|