Skip to content

Commit 4572bc0

Browse files
committed
Summary: Sample packaging scripts
This is a manual merge of the maven-to-rpm branch. This commits show how an RPM package can be built without waf. The current version only builds the management server rpm and some related rpms like setup. The main missing items are agent rpm and the awsapi rpm. But it should at least show how to use maven and packaging. Several small tweaks are put into the client/pom.xml to make sure that the war has all items required to run as a standalone war.
1 parent f65b268 commit 4572bc0

8 files changed

Lines changed: 673 additions & 2 deletions

File tree

client/pom.xml

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
</fileset>
165165
</copy>
166166
<copy
167-
todir="${basedir}/target/generated-webapp/WEB-INF/lib/scripts">
167+
todir="${basedir}/target/generated-webapp/WEB-INF/classes/scripts">
168168
<fileset dir="${basedir}/../scripts" />
169169
</copy>
170170
<copy
@@ -191,7 +191,49 @@
191191
</filterreader>
192192
</filterchain>
193193
</copy>
194-
<copy overwrite="true" file="../console-proxy/dist/systemvm.iso" todir="${basedir}/target/generated-webapp/WEB-INF/lib/vms"/>
194+
<copy overwrite="true" todir="${basedir}/target/generated-webapp/WEB-INF/classes">
195+
<fileset dir="${basedir}/tomcatconf">
196+
<include name="*.in" />
197+
</fileset>
198+
<globmapper from="*.in" to="*" />
199+
<filterchain>
200+
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
201+
<param type="propertiesfile" value="${basedir}/../build/replace.properties" />
202+
</filterreader>
203+
</filterchain>
204+
</copy>
205+
<copy overwrite="true" todir="${basedir}/target/utilities/bin">
206+
<fileset dir="${basedir}/../setup/bindir">
207+
<include name="*.in" />
208+
</fileset>
209+
<globmapper from="*.in" to="*" />
210+
<filterchain>
211+
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
212+
<param type="propertiesfile" value="${basedir}/../build/replace.properties" />
213+
</filterreader>
214+
</filterchain>
215+
</copy>
216+
<copy overwrite="true" todir="${basedir}/target/utilities/bin">
217+
<fileset dir="${basedir}/bindir">
218+
<include name="*.in" />
219+
</fileset>
220+
<globmapper from="*.in" to="*" />
221+
<filterchain>
222+
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
223+
<param type="propertiesfile" value="${basedir}/../build/replace.properties" />
224+
</filterreader>
225+
</filterchain>
226+
</copy>
227+
<copy overwrite="true" todir="${basedir}/target/utilities/scripts/db">
228+
<fileset dir="${basedir}/../setup/db">
229+
<include name="**/*" />
230+
</fileset>
231+
<filterchain>
232+
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
233+
<param type="propertiesfile" value="${basedir}/../build/replace.properties" />
234+
</filterreader>
235+
</filterchain>
236+
</copy>
195237
</target>
196238
</configuration>
197239
</execution>
@@ -213,6 +255,39 @@
213255
</execution>
214256
</executions>
215257
</plugin>
258+
<!-- there are the jasypt libs requires by some of the python scripts -->
259+
<plugin>
260+
<groupId>org.apache.maven.plugins</groupId>
261+
<artifactId>maven-dependency-plugin</artifactId>
262+
<version>2.5.1</version>
263+
<executions>
264+
<execution>
265+
<id>copy</id>
266+
<phase>package</phase>
267+
<goals>
268+
<goal>copy</goal>
269+
</goals>
270+
<configuration>
271+
<artifactItems>
272+
<artifactItem>
273+
<groupId>org.jasypt</groupId>
274+
<artifactId>jasypt</artifactId>
275+
<version>1.9.0</version>`
276+
<overWrite>false</overWrite>
277+
<outputDirectory>${project.build.directory}/pythonlibs</outputDirectory>
278+
</artifactItem>
279+
<artifactItem>
280+
<groupId>org.jasypt</groupId>
281+
<artifactId>jasypt</artifactId>
282+
<version>1.8</version>`
283+
<overWrite>false</overWrite>
284+
<outputDirectory>${project.build.directory}/pythonlibs</outputDirectory>
285+
</artifactItem>
286+
</artifactItems>
287+
</configuration>
288+
</execution>
289+
</executions>
290+
</plugin>
216291
</plugins>
217292
<pluginManagement>
218293
<plugins>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
# chkconfig: 35 99 10
20+
# description: Cloud Agent
21+
22+
# WARNING: if this script is changed, then all other initscripts MUST BE changed to match it as well
23+
24+
. /etc/rc.d/init.d/functions
25+
26+
whatami=cloud-external-ipallocator
27+
28+
# set environment variables
29+
30+
SHORTNAME="$whatami"
31+
PIDFILE=/var/run/"$whatami".pid
32+
LOCKFILE=/var/lock/subsys/"$SHORTNAME"
33+
LOGFILE=/var/log/cloud/ipallocator/ipallocator.log
34+
PROGNAME="External IPAllocator"
35+
36+
unset OPTIONS
37+
[ -r /etc/sysconfig/"$SHORTNAME" ] && source /etc/sysconfig/"$SHORTNAME"
38+
DAEMONIZE=/usr/bin/cloud-daemonize
39+
PROG=/usr/bin/cloud-external-ipallocator.py
40+
OPTIONS=8083
41+
42+
start() {
43+
echo -n $"Starting $PROGNAME: "
44+
if hostname --fqdn >/dev/null 2>&1 ; then
45+
daemon --check=$SHORTNAME --pidfile=${PIDFILE} "$DAEMONIZE" \
46+
-n "$SHORTNAME" -p "$PIDFILE" -l "$LOGFILE" "$PROG" $OPTIONS
47+
RETVAL=$?
48+
echo
49+
else
50+
failure
51+
echo
52+
echo The host name does not resolve properly to an IP address. Cannot start "$PROGNAME". > /dev/stderr
53+
RETVAL=9
54+
fi
55+
[ $RETVAL = 0 ] && touch ${LOCKFILE}
56+
return $RETVAL
57+
}
58+
59+
stop() {
60+
echo -n $"Stopping $PROGNAME: "
61+
killproc -p ${PIDFILE} $SHORTNAME # -d 10 $SHORTNAME
62+
RETVAL=$?
63+
echo
64+
[ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
65+
}
66+
67+
68+
# See how we were called.
69+
case "$1" in
70+
start)
71+
start
72+
;;
73+
stop)
74+
stop
75+
;;
76+
status)
77+
status -p ${PIDFILE} $SHORTNAME
78+
RETVAL=$?
79+
;;
80+
restart)
81+
stop
82+
sleep 3
83+
start
84+
;;
85+
condrestart)
86+
if status -p ${PIDFILE} $SHORTNAME >&/dev/null; then
87+
stop
88+
sleep 3
89+
start
90+
fi
91+
;;
92+
*)
93+
echo $"Usage: $whatami {start|stop|restart|condrestart|status|help}"
94+
RETVAL=3
95+
esac
96+
97+
exit $RETVAL
98+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
# cloud-management This shell script takes care of starting and stopping Tomcat
20+
#
21+
# chkconfig: - 80 20
22+
#
23+
### BEGIN INIT INFO
24+
# Provides: tomcat6
25+
# Required-Start: $network $syslog
26+
# Required-Stop: $network $syslog
27+
# Default-Start:
28+
# Default-Stop:
29+
# Description: Release implementation for Servlet 2.5 and JSP 2.1
30+
# Short-Description: start and stop tomcat
31+
### END INIT INFO
32+
#
33+
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
34+
# - heavily rewritten by Deepak Bhole and Jason Corley
35+
#
36+
37+
if [ -r /etc/rc.d/init.d/functions ]; then
38+
. /etc/rc.d/init.d/functions
39+
fi
40+
if [ -r /lib/lsb/init-functions ]; then
41+
. /lib/lsb/init-functions
42+
fi
43+
44+
45+
NAME="$(basename $0)"
46+
stop() {
47+
SHUTDOWN_WAIT="30"
48+
count="0"
49+
if [ -f /var/run/cloud-management.pid ]; then
50+
pid=`cat /var/run/cloud-management.pid`
51+
kill $pid &>/dev/null
52+
until [ "$(ps --pid $pid | grep -c $pid)" -eq "0" ] || \
53+
[ "$count" -gt "$SHUTDOWN_WAIT" ]
54+
do
55+
sleep 1
56+
let count="${count}+1"
57+
done
58+
if [ "$(ps --pid $pid | grep -c $pid)" -eq "0" ]; then
59+
log_success_msg "Stopping cloud-management:"
60+
else
61+
log_failure_msg "Stopping cloud-management:"
62+
fi
63+
else
64+
echo "Cannot find PID file of Cloud-management"
65+
log_failure_msg "Stopping cloud-management:"
66+
fi
67+
}
68+
69+
set_ulimit() {
70+
fd_limit=`ulimit -n`
71+
if [ "$fd_limit" != "4096" ]; then
72+
user=`whoami`
73+
if [ $user == "root" ]; then
74+
ulimit -n 4096
75+
fi
76+
fi
77+
}
78+
79+
handle_pid_file() {
80+
if [ "$1" -ne 0 ] ; then
81+
echo "The pid file locates at /var/run/cloud-management.pid and lock file at /var/lock/subsys/cloud-management.
82+
Starting cloud-management will take care of them or you can manually clean up."
83+
fi
84+
}
85+
86+
# See how we were called.
87+
case "$1" in
88+
status)
89+
status ${NAME}
90+
RETVAL=$?
91+
handle_pid_file $RETVAL
92+
;;
93+
stop)
94+
stop
95+
;;
96+
restart)
97+
stop
98+
set start
99+
set_ulimit
100+
. /etc/rc.d/init.d/tomcat6
101+
;;
102+
*)
103+
set_ulimit
104+
. /etc/rc.d/init.d/tomcat6
105+
esac
106+
107+
exit $RETVAL
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# This file is loaded in /etc/init.d/vmopsmanagement
19+
# ATM we only do two things here:
20+
21+
dummy=1 ; export TOMCAT_CFG=/etc/cloud/management/tomcat6.conf ; . /etc/cloud/management/tomcat6.conf
22+
#--------------------------
23+

0 commit comments

Comments
 (0)