source: gs3-extensions/fedora/trunk/src/build.xml@ 26434

Last change on this file since 26434 was 26434, checked in by ak19, 11 years ago

While getting GS3-with-Fedora collections to work on Puka discovered more issues. 1. Several additional files needed to become template files with placeholder values for the GS3 tomcat server and port, fedora password and index write lock timeout value. Other files needed further modifications (particularly fedora.fcfg.in and gsearch's fgsconfig-basic.properties) to make sure server and port values weren't fixed to localhost and 8383 defaults. 2. The build.xml had to be updated to make changes to these new and modified files during the installation process. 3. There's now a new target in build.xml: uninstall-fedora. 4. README file update with all this information, as well as corrections and clarifications.

File size: 11.0 KB
Line 
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
18 <!-- need to have FEDORA_HOME env correctly defined -->
19
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}"/>
65 <filter token="indexwritelocktimeout" value="${index.writelock.timeout}"/>
66
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"/>
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"/>
69 <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLucene.xslt.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLucene.xslt" filtering="true" overwrite="true"/>
70 <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLuceneGenerated.xslt.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLuceneGenerated.xslt" filtering="true" overwrite="true"/>
71
72
73 <copy file="${basedir}/install/server.xml.in" tofile="${basedir}/install/server.xml" filtering="true" overwrite="true"/>
74 <copy file="${basedir}/install/install.properties.in" tofile="${basedir}/install/install.properties" filtering="true" overwrite="true"/>
75 <copy file="${basedir}/server/config/fedora.fcfg.in" tofile="${basedir}/server/config/fedora.fcfg" filtering="true" overwrite="true"/>
76 <copy file="${basedir}/server/config/fedora-users.xml.in" tofile="${basedir}/server/config/fedora-users.xml" filtering="true" overwrite="true"/>
77 <copy file="${basedir}/server/config/spring/akubra-llstore.xml.in" tofile="${basedir}/server/config/spring/akubra-llstore.xml" filtering="true" overwrite="true"/>
78 <copy file="${basedir}/server/config/spring/web/web.properties.in" tofile="${basedir}/server/config/spring/web/web.properties" filtering="true" overwrite="true"/>
79
80 <!-- not really important, just host and port values in demo ingest files -->
81 <copy file="${basedir}/client/bin/fedora-ingest-demos.sh.in" tofile="${basedir}/client/bin/fedora-ingest-demos.sh" filtering="true" overwrite="true"/>
82 <copy file="${basedir}/client/bin/fedora-ingest-demos.bat.in" tofile="${basedir}/client/bin/fedora-ingest-demos.bat" filtering="true" overwrite="true"/>
83
84 <!-- zip up fedoragsearch, rename as .war file and put it in the install folder-->
85 <zip destfile="${basedir}/install/fedoragsearch.war"
86 basedir="${basedir}/adjust_war_files/fedoragsearch"
87 />
88
89 <!-- move fedora.xml and war files into tomcat -->
90 <copy file="${basedir}/adjust_war_files/fedora.xml.in" tofile="${gsdl3src.home}/packages/tomcat/conf/Catalina/localhost/fedora.xml" filtering="true" overwrite="true"/>
91
92 <copy todir="${gsdl3src.home}/packages/tomcat/webapps">
93 <fileset dir="${basedir}/install">
94 <include name="**/*.war"/>
95 </fileset>
96 </copy>
97
98 <!-- copy jar files needed by tomcat to run fedora from greenstone/web/WEB-INF/lib -->
99 <copy todir="${gsdl3src.home}/packages/tomcat/lib">
100 <filelist dir="${gsdl3src.home}/web/WEB-INF/lib">
101 <file name="xalan.jar"/>
102 <file name="serializer.jar"/>
103 <file name="xsltc.jar"/>
104 </filelist>
105 </copy>
106
107 <echo>
108 *********************************************************
109 1. Adjust ${gsdl3src.home}/build.properties to set up Fedora.
110 2. Then restart the Greenstone 3 tomcat. This will take some time the first time around.
111 3. Once tomcat's started up, return to this extension directory and run: ant continue-fedora-install
112 *********************************************************
113 </echo>
114 </target>
115
116
117
118 <!-- Only if fedoragsearch exists inside tomcat/webapps -->
119 <target name="continue-fedora-install"
120 description="When tomcat is running and has deployed the fedora war files, this stage configures Fedora GSearch"
121 if="fedoragsearch.deployed">
122
123 <!-- call the fgsconfig-basic.xml buildfile in GS3/packages/tomcat/webapps/fedoragsearch/FgsConfig's
124 ant -f fgsconfig-basic.xml -->
125 <echo>
126 Configuring Fedora GSearch
127 </echo>
128 <ant dir="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/FgsConfig" antfile="fgsconfig-basic.xml"/>
129
130 <!-- give read execute permissions to all (755) for the fedoragsearch files -->
131 <echo>
132 Giving executable permissions to Fedora setup script and Fedora GSearch scripts
133 </echo>
134 <chmod file="${basedir}/gs3-setup.sh" perm="755"/>
135 <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh" perm="755"/>
136 <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runSOAPClient.sh" perm="755"/>
137
138 <chmod file="${basedir}/client/bin/fedora-ingest-demos.sh" perm="755"/>
139
140 <!-- call Update EmptyIndex on GSearch to create the initial index (segments) file:
141 .../webapps/fedoragsearch/client/runRESTClient.sh <host:port> updateIndex createEmpty <indexName>
142
143 Where the indexName is FgsIndex. If it is made customisable, then template files need
144 to change to contain placeholders wherever the indexName is mentioned.
145 To run the upateIndex command, need GSearch username and pwd set in the environment. -->
146 <echo>
147 Calling UpdateIndex CreateEmpty on Fedora GSearch to create a new index
148 </echo>
149 <exec osfamily="unix" spawn="false"
150 executable="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh">
151 <env key="fgsUserName" value="fedoraAdmin"/>
152 <env key="fgsPassword" value="${fedora.password}"/>
153 <arg value="${tomcat.server}:${tomcat.port}"/>
154 <arg value="updateIndex"/>
155 <arg value="createEmpty"/>
156 <arg value="FgsIndex"/>
157 </exec>
158
159 <exec osfamily="windows" spawn="false"
160 executable="cmd">
161 <env key="fgsUserName" value="fedoraAdmin" />
162 <env key="fgsPassword" value="${fedora.password}" />
163 <arg value="/c"/>
164 <arg value="${gsdl3src.home}\\packages\\tomcat\\webapps\\fedoragsearch\\client\\runRESTClient.bat"/>
165 <arg value="${tomcat.server}:${tomcat.port}" />
166 <arg value="updateIndex" />
167 <arg value="createEmpty" />
168 <arg value="FgsIndex" />
169 </exec>
170
171 <echo>
172 *********************************************************
173 0. Don't worry about the IndexNotFoundException message. It always does this.
174 1. Stop your Greenstone 3 tomcat. (Check it's stopped: ps aux | grep tomcat)
175 2. Then, to complete fedora installation, return to this extension directory and run: ant finish-fedora-install.
176 This will clear the war files, since they have already been deployed by now.
177 *********************************************************
178 </echo>
179
180 </target>
181
182
183
184 <target name="finish-fedora-install"
185 description="Removes Fedora and GSearch war files from ${basedir}/tomcat/packages/webapps after deployment. Tomcat must not be running.">
186 <!-- clean up the war files -->
187 <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedora.war"/>
188 <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedora-demo.war"/>
189 <delete file="${gsdl3src.home}/packages/tomcat/webapps/fop.war"/>
190 <delete file="${gsdl3src.home}/packages/tomcat/webapps/imagemanip.war"/>
191 <delete file="${gsdl3src.home}/packages/tomcat/webapps/saxon.war"/>
192 <delete file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch.war"/>
193
194 <echo>
195 *********************************************************
196 Fedora installation complete. Try running FLI.
197 *********************************************************
198 </echo>
199
200 </target>
201
202 <target name="uninstall-fedora"
203 description="Uninstalls the Greenstone 3 Fedora extension (including GSearch). Tomcat must not be running when this target is run.">
204 <!-- clean up the war files -->
205 <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fedora"/>
206 <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch"/>
207 <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fedora-demo"/>
208 <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fop"/>
209 <delete dir="${gsdl3src.home}/packages/tomcat/webapps/imagemanip"/>
210 <delete dir="${gsdl3src.home}/packages/tomcat/webapps/saxon"/>
211
212 <!-- attempt to remove GS3/ext/fedora3 -->
213 <delete dir="${basedir}"/>
214 <echo>
215 *********************************************************
216 Fedora uninstall complete.
217 *********************************************************
218 </echo>
219
220 </target>
221
222</project>
Note: See TracBrowser for help on using the repository browser.