Merge lp:~jhasaurabh/charms/precise/wildfly/trunk into lp:charms/wildfly

Proposed by saurabh
Status: Merged
Merged at revision: 9
Proposed branch: lp:~jhasaurabh/charms/precise/wildfly/trunk
Merge into: lp:charms/wildfly
Diff against target: 311 lines (+3/-293)
2 files modified
hooks/install (+3/-1)
templates/wildfly-init-debian.sh (+0/-292)
To merge this branch: bzr merge lp:~jhasaurabh/charms/precise/wildfly/trunk
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
Review via email: mp+241934@code.launchpad.net

Description of the change

Bug fix for Bug #1353651
https://bugs.launchpad.net/charms/+source/wildfly/+bug/1353651

Please review the changes and accept this merge proposal.

Thanks,
Saurabh

To post a comment you must log in.
10. By jhasaurabh <email address hidden>

Bug fix for bug #1353651

Revision history for this message
saurabh (jhasaurabh) wrote :

Hi,
Please consider the recent revision r10 for merging in the upstream repo.

Thanks,
Saurabh

Revision history for this message
Matt Bruzek (mbruzek) wrote :

Thank you for taking time to address this problem. The fix was tested on local LXC and Openstack and Power. This charm now works on Power hardware!

+1 LGTM

Thanks again!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/install'
--- hooks/install 2014-02-16 14:30:53 +0000
+++ hooks/install 2014-11-17 10:17:27 +0000
@@ -22,7 +22,9 @@
22 rm -rf /tmp/wildfly-8.0.0.CR1.tar.gz22 rm -rf /tmp/wildfly-8.0.0.CR1.tar.gz
23 mv /opt/wildfly* /opt/wildfly23 mv /opt/wildfly* /opt/wildfly
24 cat ${TMPL}/standalone.xml >/opt/wildfly/standalone/configuration/standalone.xml24 cat ${TMPL}/standalone.xml >/opt/wildfly/standalone/configuration/standalone.xml
25 cp ${TMPL}/wildfly-init-debian.sh /etc/init.d/wildfly25 cp /opt/wildfly/bin/init.d/wildfly.conf /etc/default/wildfly
26 echo "JBOSS_USER=root" >>/etc/default/wildfly
27 cp /opt/wildfly/bin/init.d/wildfly-init-debian.sh /etc/init.d/wildfly
26 chmod +x /etc/init.d/wildfly28 chmod +x /etc/init.d/wildfly
27else29else
28 echo "Download Incomplete, Terminating the charm deployment"30 echo "Download Incomplete, Terminating the charm deployment"
2931
=== removed file 'templates/wildfly-init-debian.sh'
--- templates/wildfly-init-debian.sh 2014-02-16 14:30:53 +0000
+++ templates/wildfly-init-debian.sh 1970-01-01 00:00:00 +0000
@@ -1,292 +0,0 @@
1#!/bin/sh
2#
3# /etc/init.d/wildfly -- startup script for WildFly
4#
5# Written by Jorge Solorzano <jorsol@gmail.com>
6#
7### BEGIN INIT INFO
8# Provides: wildfly
9# Required-Start: $remote_fs $network
10# Required-Stop: $remote_fs $network
11# Should-Start: $named
12# Should-Stop: $named
13# Default-Start: 2 3 4 5
14# Default-Stop: 0 1 6
15# Short-Description: WildFly Application Server
16# Description: Provide WildFly startup/shutdown script
17### END INIT INFO
18
19NAME=wildfly
20DESC="WildFly Application Server"
21DEFAULT=/etc/default/$NAME
22JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
23JBOSS_HOME="/opt/wildfly"
24# Check privileges
25if [ `id -u` -ne 0 ]; then
26 echo "You need root privileges to run this script"
27 exit 1
28fi
29
30# Make sure wildfly is started with system locale
31if [ -r /etc/default/locale ]; then
32 . /etc/default/locale
33 export LANG
34fi
35
36. /lib/lsb/init-functions
37
38if [ -r /etc/default/rcS ]; then
39 . /etc/default/rcS
40fi
41
42# Overwrite settings from default file
43if [ -f "$DEFAULT" ]; then
44 . "$DEFAULT"
45fi
46
47# Location of jdk
48if [ -n "$JAVA_HOME" ]; then
49 JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
50fi
51export JAVA_HOME
52# Setup the JVM
53if [ "x$JAVA" = "x" ]; then
54 if [ "x$JAVA_HOME" != "x" ]; then
55 JAVA="$JAVA_HOME/bin/java"
56 else
57 JAVA="java"
58 fi
59fi
60
61# Location of wildfly
62if [ -z "$JBOSS_HOME" ]; then
63 JBOSS_HOME=/opt/wildfly
64fi
65export JBOSS_HOME
66
67# Check if wildfly is installed
68if [ ! -f "$JBOSS_HOME/jboss-modules.jar" ]; then
69 log_failure_msg "$NAME is not installed in $JBOSS_HOME"
70 exit 1
71fi
72
73# Run as wildfly user
74if [ -z "$JBOSS_USER" ]; then
75 JBOSS_USER=root
76fi
77
78# Check wildfly user
79id $JBOSS_USER > /dev/null 2>&1
80if [ $? -ne 0 -o -z "$JBOSS_USER" ]; then
81 log_failure_msg "User $JBOSS_USER does not exist..."
82 exit 1
83fi
84
85# Startup mode of wildfly
86if [ -z "$JBOSS_MODE" ]; then
87 JBOSS_MODE=standalone
88fi
89
90# Startup mode script
91if [ "$JBOSS_MODE" = "standalone" ]; then
92 JBOSS_SCRIPT=$JBOSS_HOME/bin/standalone.sh
93 if [ -z "$JBOSS_CONFIG" ]; then
94 JBOSS_CONFIG=standalone.xml
95 fi
96else
97 JBOSS_SCRIPT=$JBOSS_HOME/bin/domain.sh
98 if [ -z "$JBOSS_DOMAIN_CONFIG" ]; then
99 JBOSS_DOMAIN_CONFIG=domain.xml
100 fi
101 if [ -z "$JBOSS_HOST_CONFIG" ]; then
102 JBOSS_HOST_CONFIG=host.xml
103 fi
104fi
105
106# Check startup file
107if [ ! -x $JBOSS_SCRIPT ]; then
108 log_failure_msg "$JBOSS_SCRIPT is not an executable!"
109 exit 1
110fi
111
112# Check cli file
113JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh
114if [ ! -x $JBOSS_CLI ]; then
115 log_failure_msg "$JBOSS_CLI is not an executable!"
116 exit 1
117fi
118
119# The amount of time to wait for startup
120if [ -z "$STARTUP_WAIT" ]; then
121 STARTUP_WAIT=30
122fi
123
124# The amount of time to wait for shutdown
125if [ -z "$SHUTDOWN_WAIT" ]; then
126 SHUTDOWN_WAIT=30
127fi
128
129# Location to keep the console log
130if [ -z "$JBOSS_CONSOLE_LOG" ]; then
131 JBOSS_CONSOLE_LOG=/var/log/$NAME/console.log
132fi
133export JBOSS_CONSOLE_LOG
134
135# Location to set the pid file
136JBOSS_PIDFILE=/var/run/$NAME/$NAME.pid
137export JBOSS_PIDFILE
138
139# Launch wildfly in background
140LAUNCH_JBOSS_IN_BACKGROUND=1
141export LAUNCH_JBOSS_IN_BACKGROUND
142
143# Helper function to check status of wildfly service
144check_status() {
145 pidofproc -p $JBOSS_PIDFILE $JAVA >/dev/null 2>&1
146}
147
148case "$1" in
149 start)
150 log_daemon_msg "Starting $DESC" "$NAME"
151 check_status
152 status_start=$?
153 if [ $status_start -eq 3 ]; then
154 mkdir -p $(dirname $JBOSS_PIDFILE)
155 mkdir -p $(dirname $JBOSS_CONSOLE_LOG)
156 chown $JBOSS_USER $(dirname $JBOSS_PIDFILE) || true
157 cat /dev/null > $JBOSS_CONSOLE_LOG
158
159 if [ "$JBOSS_MODE" = "standalone" ]; then
160 start-stop-daemon --start --user "$JBOSS_USER" \
161 --chuid "$JBOSS_USER" --chdir "$JBOSS_HOME" --pidfile "$JBOSS_PIDFILE" \
162 --exec "$JBOSS_SCRIPT" -- -c $JBOSS_CONFIG >> $JBOSS_CONSOLE_LOG 2>&1 &
163 else
164 start-stop-daemon --start --user "$JBOSS_USER" \
165 --chuid "$JBOSS_USER" --chdir "$JBOSS_HOME" --pidfile "$JBOSS_PIDFILE" \
166 --exec "$JBOSS_SCRIPT" -- --domain-config=$JBOSS_DOMAIN_CONFIG \
167 --host-config=$JBOSS_HOST_CONFIG >> $JBOSS_CONSOLE_LOG 2>&1 &
168 fi
169
170 count=0
171 launched=0
172 until [ $count -gt $STARTUP_WAIT ]
173 do
174 grep 'JBAS015874:' $JBOSS_CONSOLE_LOG > /dev/null
175 if [ $? -eq 0 ] ; then
176 launched=1
177 break
178 fi
179 sleep 1
180 count=$((count + 1));
181 done
182
183 if check_status; then
184 log_end_msg 0
185 else
186 log_end_msg 1
187 fi
188
189 if [ $launched -eq 0 ]; then
190 log_warning_msg "$DESC hasn't started within the timeout allowed"
191 log_warning_msg "please review file $JBOSS_CONSOLE_LOG to see the status of the service"
192 fi
193 elif [ $status_start -eq 1 ]; then
194 log_failure_msg "$DESC is not running but the pid file exists"
195 exit 1
196 elif [ $status_start -eq 0 ]; then
197 log_success_msg "$DESC (already running)"
198 fi
199 ;;
200 stop)
201 check_status
202 status_stop=$?
203 if [ $status_stop -eq 0 ]; then
204 read kpid < $JBOSS_PIDFILE
205 log_daemon_msg "Stopping $DESC" "$NAME"
206
207 start-stop-daemon --start --chuid "$JBOSS_USER" \
208 --exec "$JBOSS_CLI" -- --connect --command=:shutdown \
209 >/dev/null 2>&1
210
211 if [ $? -eq 1 ]; then
212 kill -15 $kpid
213 fi
214
215 count=0
216 until [ $count -gt $SHUTDOWN_WAIT ]
217 do
218 check_status
219 if [ $? -eq 3 ]; then
220 break
221 fi
222 sleep 1
223 count=$((count + 1));
224 done
225
226 if [ $count -gt $SHUTDOWN_WAIT ]; then
227 kill -9 $kpid
228 fi
229
230 log_end_msg 0
231 elif [ $status_stop -eq 1 ]; then
232 log_action_msg "$DESC is not running but the pid file exists, cleaning up"
233 rm -f $JBOSS_PIDFILE
234 elif [ $status_stop -eq 3 ]; then
235 log_action_msg "$DESC is not running"
236 fi
237 ;;
238 restart)
239 check_status
240 status_restart=$?
241 if [ $status_restart -eq 0 ]; then
242 $0 stop
243 fi
244 $0 start
245 ;;
246 reload|force-reload)
247 check_status
248 status_reload=$?
249 if [ $status_reload -eq 0 ]; then
250 log_daemon_msg "Reloading $DESC config" "$NAME"
251
252 if [ "$JBOSS_MODE" = "standalone" ]; then
253 RELOAD_CMD=":reload"; else
254 RELOAD_CMD=":reload-servers"; fi
255
256 start-stop-daemon --start --chuid "$JBOSS_USER" \
257 --exec "$JBOSS_CLI" -- --connect --command=$RELOAD_CMD >/dev/null 2>&1
258
259 if [ $? -eq 0 ]; then
260 log_end_msg 0
261 else
262 log_end_msg 1
263 fi
264 else
265 log_failure_msg "$DESC is not running"
266 fi
267 ;;
268 status)
269 check_status
270 status=$?
271 if [ $status -eq 0 ]; then
272 read pid < $JBOSS_PIDFILE
273 log_action_msg "$DESC is running with pid $pid"
274 exit 0
275 elif [ $status -eq 1 ]; then
276 log_action_msg "$DESC is not running and the pid file exists"
277 exit 1
278 elif [ $status -eq 3 ]; then
279 log_action_msg "$DESC is not running"
280 exit 3
281 else
282 log_action_msg "Unable to determine $NAME status"
283 exit 4
284 fi
285 ;;
286 *)
287 log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}"
288 exit 2
289 ;;
290esac
291
292exit 0

Subscribers

People subscribed via source and target branches

to all changes: