-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
218 lines (195 loc) · 9.39 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?xml version="1.0"?>
<project name="tomcat-cluster" basedir="." default="bootstrap-tomcat">
<property file="local.build.properties"/>
<property file="build.properties"/>
<target name="init">
<splash imageurl="file://${src.dir}/cluster.jpg" showduration="0"/>
</target>
<target name="bootstrap" description="Meta target that builds everything" depends="init, compile-apache, compile-mod_jk, setup-tomcat-nodes, setup-balancer-tomcat, install-balancer-webapp, pack-apache"/>
<target name="bootstrap-tomcat" description="Meta target that builds Tomcat Cluster and Balancer" depends="init, setup-tomcat-nodes, setup-balancer-tomcat, install-balancer-webapp"/>
<target name="clean" depends="init" description="Clean build directory">
<delete dir="${build.dir}"/>
</target>
<target name="dist-clean" depends="clean" description="Clean distr and build directory">
<delete dir="${dist.dir}"/>
</target>
<target name="pack-apache" depends="compile-apache, compile-mod_jk">
<mkdir dir="${dist.dir}"/>
<tar compression="bzip2"
destfile="${dist.dir}/${apache.version}-jk-${os.name}.tar.bz2">
<tarfileset dir="${build.dir}/apache" prefix="apache">
<include name="**"/>
</tarfileset>
</tar>
</target>
<target name="setup-balancer-tomcat" depends="init" description="Setup the balancer tomcat">
<!-- Unpack standard Tomcat -->
<untar src="${lib.dir}/${tomcat.tarball}"
overwrite="true"
compression="gzip"
dest="${build.dir}"/>
<copy overwrite="true" todir="${build.dir}/${tomcat.version}-balancer">
<fileset dir="${build.dir}/${tomcat.version}"/>
</copy>
<delete dir="${build.dir}/${tomcat.version}"/>
<!-- Make shell scripts executable -->
<chmod dir="${build.dir}/${tomcat.version}-balancer/bin" perm="u+x" includes="**.sh"/>
<!-- Customize configuration file -->
<copy file="${conf.dir}/jakarta-tomcat-5.0.30-balancer/server.xml"
todir="${build.dir}/${tomcat.version}-balancer/conf"
overwrite="true"/>
<replace file="${build.dir}/${tomcat.version}-balancer/conf/${tomcat.conf}" value="${balancer.shutdown.port}">
<replacetoken>@SHUTDOWN@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-balancer/conf/${tomcat.conf}" value="${balancer.http.port}">
<replacetoken>@HTTP@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-balancer/conf/${tomcat.conf}" value="${balancer.ajp.port}">
<replacetoken>@AJP@</replacetoken>
</replace>
</target>
<target name="install-balancer-webapp" depends="setup-balancer-tomcat" description="Deploy the balancer application">
<copy overwrite="true" tofile="balancer/local.build.properties">
<fileset file="${conf.dir}/balancer.build.properties"/>
</copy>
<replace file="balancer/local.build.properties" value="${build.dir}/${tomcat.version}-balancer">
<replacetoken>@TOMCAT_HOME@</replacetoken>
</replace>
<ant inheritAll="false" inheritRefs="false" dir="balancer"/>
<replace file="${build.dir}/${tomcat.version}-balancer/webapps/ROOT/WEB-INF/workers.xml" value="${cnode1.http.port}">
<replacetoken>9018</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-balancer/webapps/ROOT/WEB-INF/workers.xml" value="${cnode2.http.port}">
<replacetoken>9028</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-balancer/webapps/ROOT/WEB-INF/workers.xml" value="${build.dir}/${tomcat.version}-balancer/webapps/ROOT/WEB-INF/logs">
<replacetoken>/REPLACE_THIS_STRING</replacetoken>
</replace>
</target>
<target name="setup-tomcat-nodes" depends="init" description="Setup the two tomcat cluster nodes">
<!-- Unpack standard Tomcat -->
<untar src="${lib.dir}/${tomcat.tarball}"
overwrite="true"
compression="gzip"
dest="${build.dir}"/>
<!-- Cluster Node 1 -->
<copy overwrite="true" todir="${build.dir}/${tomcat.version}-cnode1">
<fileset dir="${build.dir}/${tomcat.version}"/>
</copy>
<chmod dir="${build.dir}/${tomcat.version}-cnode1/bin" perm="u+x" includes="**.sh"/>
<!--
<copy file="src/jakarta-tomcat-5.0.30-1/conf/server.xml"
todir="${build.dir}/${tomcat.version}-cnode1/conf"
overwrite="true"/>
-->
<copy file="${conf.dir}/jakarta-tomcat-5.0.30-cluster-node/server.xml"
todir="${build.dir}/${tomcat.version}-cnode1/conf"
overwrite="true"/>
<replace file="${build.dir}/${tomcat.version}-cnode1/conf/${tomcat.conf}" value="${cnode1.shutdown.port}">
<replacetoken>@SHUTDOWN@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode1/conf/${tomcat.conf}" value="${cnode1.http.port}">
<replacetoken>@HTTP@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode1/conf/${tomcat.conf}" value="${cnode1.ajp.port}">
<replacetoken>@AJP@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode1/conf/${tomcat.conf}" value="${cnode1.listen.port}">
<replacetoken>@TCP_LISTEN_PORT@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode1/conf/${tomcat.conf}" value="cnode1">
<replacetoken>@CNODE@</replacetoken>
</replace>
<!-- Cluster Node 2 -->
<copy overwrite="true" todir="${build.dir}/${tomcat.version}-cnode2">
<fileset dir="${build.dir}/${tomcat.version}"/>
</copy>
<chmod dir="${build.dir}/${tomcat.version}-cnode2/bin" perm="u+x" includes="**.sh"/>
<!--
<copy file="src/jakarta-tomcat-5.0.30-2/conf/server.xml"
todir="${build.dir}/${tomcat.version}-cnode2/conf"
overwrite="true"/>
-->
<copy file="${conf.dir}/jakarta-tomcat-5.0.30-cluster-node/server.xml"
todir="${build.dir}/${tomcat.version}-cnode2/conf"
overwrite="true"/>
<replace file="${build.dir}/${tomcat.version}-cnode2/conf/${tomcat.conf}" value="${cnode2.shutdown.port}">
<replacetoken>@SHUTDOWN@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode2/conf/${tomcat.conf}" value="${cnode2.http.port}">
<replacetoken>@HTTP@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode2/conf/${tomcat.conf}" value="${cnode2.ajp.port}">
<replacetoken>@AJP@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode2/conf/${tomcat.conf}" value="${cnode2.listen.port}">
<replacetoken>@TCP_LISTEN_PORT@</replacetoken>
</replace>
<replace file="${build.dir}/${tomcat.version}-cnode2/conf/${tomcat.conf}" value="cnode2">
<replacetoken>@CNODE@</replacetoken>
</replace>
<delete dir="${build.dir}/${tomcat.version}"/>
</target>
<target name="compile-apache" depends="init" description="Compile Apache-HTTPD from sources">
<echo message="compiling ${apache.version}"/>
<echo message="static modules: ${apache.static_modules}"/>
<untar src="${src.dir}/${apache.tarball}"
overwrite="false"
compression="gzip"
dest="${build.dir}"/>
<chmod dir="${build.dir}/${apache.version}" perm="u+x" includes="**/*.sh"/>
<exec dir="${build.dir}/${apache.version}"
executable="sh"
failonerror="true">
<arg value="configure"/>
<arg value="--prefix=${build.dir}/apache"/>
<arg value="--enable-modules=${apache.static_modules}"/>
</exec>
<exec dir="${build.dir}/${apache.version}"
executable="make"
failonerror="true"/>
<exec dir="${build.dir}/${apache.version}"
executable="make"
failonerror="true">
<arg value="install"/>
</exec>
<copy overwrite="true" file="${conf.dir}/${apache.conf}" todir="${build.dir}/apache/conf"/>
<replace file="${build.dir}/apache/conf/${apache.conf}" value="${apache.port}">
<replacetoken>@PORT@</replacetoken>
</replace>
<replace file="${build.dir}/apache/conf/${apache.conf}" value="${build.dir}/apache">
<replacetoken>@ROOT@</replacetoken>
</replace>
<copy overwrite="true" file="${conf.dir}/${apache.vhost_conf}" todir="${build.dir}/apache/conf/extra"/>
<replace file="${build.dir}/apache/conf/extra/${apache.vhost_conf}" value="${apache.port}">
<replacetoken>@PORT@</replacetoken>
</replace>
</target>
<target name="compile-mod_jk" depends="compile-apache" description="Compile mod_jk from sources">
<replace file="${build.dir}/apache/bin/apxs">
<replacetoken>/replace/with/path/to/perl/interpreter</replacetoken>
<replacevalue>/usr/bin/perl</replacevalue>
</replace>
<chmod dir="${build.dir}/apache" perm="u+x" includes="bin/**"/>
<echo message="compiling ${connectors.version}"/>
<untar src="${src.dir}/${connectors.tarball}"
overwrite="false"
compression="gzip"
dest="${build.dir}"/>
<exec dir="${build.dir}/${connectors.version}/jk/native"
executable="sh"
failonerror="true">
<arg value="configure"/>
<arg value="--with-apxs=${build.dir}/apache/bin/apxs"/>
</exec>
<exec dir="${build.dir}/${connectors.version}/jk/native"
executable="make"
failonerror="true"/>
<exec dir="${build.dir}/${connectors.version}/jk/native"
executable="make"
failonerror="true">
<arg value="install"/>
</exec>
<copy file="${conf.dir}/${connectors.conf}" todir="${build.dir}/apache/conf"/>
</target>
</project>