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