root/gs3-extensions/fedora/trunk/src/build.xml @ 26413

Revision 26413, 8.8 KB (checked in by ak19, 7 years ago)

Restructured GS3 Fedora extension to have a trunk folder with a src subfolder.

RevLine 
[26377]1<?xml version="1.0"?>
2<!-- ======================================================================
3     Oct 2012
4
5     Script to install Fedora and Fedora GSearch as extensions within Greenstone3
6     (using Greenstone's tomcat)
7     ak19                                                               
8     ====================================================================== -->
9
10<project name="fedora_for_gs3" default="usage" basedir=".">
11  <echo>
12    Tested for Linux.
13    Your os.name: ${os.name}
14  </echo>
15
16  <!-- PROPERTIES -->
17
[26404]18  <!-- need to have FEDORA_HOME env correctly defined -->
19
[26377]20  <!--<property name="gsdl3src.home" value="../..${basedir}"/>-->
21  <!--<property name="gsdl3src.home" location="." relative="true" basedir="../.."/>-->
22  <!--<property name="gsdl3src.home" value="/full/path/to/GS3" />-->
23
24  <!-- load the Greenstone properties file to have access to tomcat and fedora properties.
25    This assumes they have Greenstone installed (build.properties must exist). -->
26  <property file="${gsdl3src.home}/build.properties"/>
27
28  <available file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/FgsConfig/build.xml" property="fedoragsearch.deployed"/>   
29
30
31  <!-- TARGETS -->
32  <target name="usage" description="Print a help message">
33    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
34    <echo message="  Execute 'ant -help' for Ant help."/>
35   
36    <echo>
37      *********************************************************
38      1. ant -Dgsdl3src.home=&lt;Full-Path-To-GS3&gt; start-fedora-install
39
40      2. start tomcat by going into ${gsdl3src.home} and running: ant start
41
42      3. ant -Dgsdl3src.home=&lt;Full-Path-To-GS3&gt; continue-fedora-install
43
44      4. stop tomcat by going back into ${gsdl3src.home} and running: ant stop
45     
46      5. ant -Dgsdl3src.home=&lt;Full-Path-To-GS3&gt; finish-fedora-install
47     
48      The README.txt file will have more information about the Greenstone
49      Fedora extension's installation process.
50      *********************************************************
51    </echo>
52  </target>
53
54
55
56  <target name="start-fedora-install" description="Prepares the fedora war files and puts them into tomcat">
57
58    <!-- adjust template files -->
59    <filter token="GSDL3SRCHOME" value="${gsdl3src.home}"/>
60    <filter token="FEDORA_HOME" value="${gsdl3src.home}/ext/fedora3"/>
61    <filter token="tomcatserver" value="${tomcat.server}"/>
62    <filter token="tomcatport" value="${tomcat.port}"/>
63    <filter token="tomcatshutdownport" value="${tomcat.shutdown.port}"/>
64    <filter token="fedorapassw" value="${fedora.password}"/>
[26391]65    <filter token="indexwritelocktimeout" value="${index.writelock.timeout}"/>
66
[26377]67    <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/fgsconfig-basic.properties.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/fgsconfig-basic.properties" filtering="true" overwrite="true"/>
[26391]68    <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/index.properties.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/index.properties" filtering="true" overwrite="true"/>
[26377]69    <copy file="${basedir}/install/install.properties.in" tofile="${basedir}/install/install.properties" filtering="true" overwrite="true"/>
70    <copy file="${basedir}/server/config/fedora.fcfg.in" tofile="${basedir}/server/config/fedora.fcfg" filtering="true" overwrite="true"/>
71    <copy file="${basedir}/server/config/fedora-users.xml.in" tofile="${basedir}/server/config/fedora-users.xml" filtering="true" overwrite="true"/>
72    <copy file="${basedir}/server/config/spring/akubra-llstore.xml.in" tofile="${basedir}/server/config/spring/akubra-llstore.xml" filtering="true" overwrite="true"/>
73
74    <!-- zip up fedoragsearch, rename as .war file and put it in the install folder-->
75    <zip destfile="${basedir}/install/fedoragsearch.war"
76     basedir="${basedir}/adjust_war_files/fedoragsearch"     
77     />
78
79    <!-- move fedora.xml and war files into tomcat -->
80    <copy file="${basedir}/adjust_war_files/fedora.xml.in" tofile="${gsdl3src.home}/packages/tomcat/conf/Catalina/localhost/fedora.xml" filtering="true" overwrite="true"/>
81
82    <copy todir="${gsdl3src.home}/packages/tomcat/webapps">
83      <fileset dir="${basedir}/install">
84    <include name="**/*.war"/>
85      </fileset>
86    </copy>
87
88    <!-- copy jar files needed by tomcat to run fedora from greenstone/web/WEB-INF/lib -->
89    <copy todir="${gsdl3src.home}/packages/tomcat/lib">
90      <filelist dir="${gsdl3src.home}/web/WEB-INF/lib">
91    <file name="xalan.jar"/>
92    <file name="serializer.jar"/>
93    <file name="xsltc.jar"/>
94      </filelist>
95    </copy>
96
97    <echo>
98      *********************************************************
99      1. Adjust ${gsdl3src.home}/build.properties to set up Fedora.
[26404]100      2. Then restart the Greenstone 3 tomcat. This will take some time the first time around.
101      3. Once tomcat's started up, return to this extension directory and run: ant continue-fedora-install
[26377]102      *********************************************************
103    </echo>
104 </target>
105
106
107
108  <!-- Only if fedoragsearch exists inside tomcat/webapps -->
109  <target name="continue-fedora-install"
110      description="When tomcat is running and has deployed the fedora war files, this stage configures Fedora GSearch"
111      if="fedoragsearch.deployed">
112
113    <!-- call the fgsconfig-basic.xml buildfile in GS3/packages/tomcat/webapps/fedoragsearch/FgsConfig's
114     ant -f fgsconfig-basic.xml -->
[26404]115    <echo>
116      Configuring Fedora GSearch
117    </echo>
[26377]118    <ant dir="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/FgsConfig" antfile="fgsconfig-basic.xml"/>
119   
120    <!-- give read execute permissions to all (755) for the fedoragsearch files -->
[26404]121    <echo>
122      Giving executable permissions to Fedora GSearch scripts
123    </echo>
[26377]124    <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh" perm="755"/>
125    <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runSOAPClient.sh" perm="755"/>
126   
[26404]127    <!-- call Update EmptyIndex on GSearch to create the initial index (segments) file:
128     .../webapps/fedoragsearch/client/runRESTClient.sh <host:port> updateIndex createEmpty <indexName>   
129
130     Where the indexName is FgsIndex. If it is made customisable, then template files need
131     to change to contain placeholders wherever the indexName is mentioned.
132     To run the upateIndex command, need GSearch username and pwd set in the environment. -->
[26377]133    <echo>
[26404]134      Calling UpdateIndex CreateEmpty on Fedora GSearch to create a new index
135    </echo>
136    <exec osfamily="unix" spawn="false"
137      executable="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh">   
138      <env key="fgsUserName" value="fedoraAdmin"/>
139      <env key="fgsPassword" value="${fedora.password}"/>
140      <arg value="${tomcat.server}:${tomcat.port}"/>
141      <arg value="updateIndex"/>
142      <arg value="createEmpty"/>
143      <arg value="FgsIndex"/>
144    </exec>
145   
146    <exec osfamily="windows" spawn="false"
147      executable="cmd">
148      <env key="fgsUserName" value="fedoraAdmin" />
149      <env key="fgsPassword" value="${fedora.password}" />
150      <arg value="/c"/>
151      <arg value="${gsdl3src.home}\\packages\\tomcat\\webapps\\fedoragsearch\\client\\runRESTClient.bat"/>
152      <arg value="${tomcat.server}:${tomcat.port}" />
153      <arg value="updateIndex" />
154      <arg value="createEmpty" />
155      <arg value="FgsIndex" />
156    </exec>
157
158    <echo>
[26377]159      *********************************************************
[26404]160      0. Don't worry about the IndexNotFoundException message. It always does this.
161      1. Stop your Greenstone 3 tomcat. (Check it's stopped: ps aux | grep tomcat)
162      2. Then, to complete fedora installation, return to this extension directory and run: ant finish-fedora-install.
163      This will clear the war files, since they have already been deployed by now.
[26377]164      *********************************************************
165    </echo>
166   
167  </target>
168
169
170 
171  <target name="finish-fedora-install"
172      description="Removes Fedora and GSearch war files from ${basedir}/tomcat/packages/webapps after deployment. Tomcat must not be running.">
173    <!-- clean up the war files -->
174    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedora.war"/>
175    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedora-demo.war"/>
176    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fop.war"/>
177    <delete file="${gsdl3src.home}/packages/tomcat/webapps/imagemanip.war"/>
178    <delete file="${gsdl3src.home}/packages/tomcat/webapps/saxon.war"/>
179    <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch.war"/>
180   
181    <echo>
182      *********************************************************
183      Fedora installation complete. Try running FLI.
184      *********************************************************
185   </echo>
186   
187  </target>
188 
189</project>
Note: See TracBrowser for help on using the browser.