Skip to content

Commit d90570f

Browse files
committed
Feature #12832
Adding parameter JCR_STATS_ENABLED and DB_STATS_ENABLED in order to enable the statistics on Silverpeas's used data sources. When statistics enabled on a data source, its pool state can be analyzed in real time from management console. Adding boolean SERVER_MANAGEMENT_ALL_IP parameter which allows to enable the management services access from server IP and not only localhost. This is useful with Silverpeas's servers not providing WEB browsers.
1 parent 3e04924 commit d90570f

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

src/main/groovy/org/silverpeas/setup/api/JBossServer.groovy

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class JBossServer {
5151

5252
final String jbossHome
5353

54+
private boolean serverManagementAllIP
55+
5456
private File redirection = null
5557

5658
private long timeout = DEFAULT_TIMEOUT
@@ -165,12 +167,27 @@ class JBossServer {
165167
* @return itself.
166168
*/
167169
JBossServer withStartingTimeout(long timeout) {
168-
if (this.timeout > 0) {
170+
if (timeout > 0) {
169171
this.timeout = timeout
170172
}
171173
return this
172174
}
173175

176+
/**
177+
* By default, the management console is only available on the machine of the running wildfly
178+
* at IP 127.0.0.1 and port 9990.
179+
* This method allows the management console to be accessible from any server IP. This is useful
180+
* with a client server which does not provide WEB browser (which is generally the case).
181+
* By default, false (that means default wildfly behavior).
182+
* This parameter only affects start and debug methods.
183+
* @param isAllIp true to make the management accessible from any client.
184+
* @return itself.
185+
*/
186+
JBossServer setServerManagementAllIP(boolean isAllIp) {
187+
this.serverManagementAllIP = isAllIp
188+
return this
189+
}
190+
174191
/**
175192
* Gets the name and the version of the JBoss/Wildfly application server referred by the
176193
* JBOSS_HOME environment variable.
@@ -200,6 +217,7 @@ class JBossServer {
200217
* </ul>
201218
*/
202219
void start(Map params = null) {
220+
int managementPort = 9990
203221
boolean adminOnly = (params != null && params.adminOnly ? params.adminOnly:false)
204222
if (reloadRequired()) {
205223
reload()
@@ -209,6 +227,8 @@ class JBossServer {
209227
ProcessBuilder process
210228
if (adminOnly) {
211229
process = new ProcessBuilder(starter, '-c', 'standalone-full.xml', '--admin-only')
230+
} else if (serverManagementAllIP) {
231+
process = new ProcessBuilder(starter, '-c', 'standalone-full.xml', '-bmanagement', '0.0.0.0', '-b', '0.0.0.0')
212232
} else {
213233
process = new ProcessBuilder(starter, '-c', 'standalone-full.xml', '-b', '0.0.0.0')
214234
}
@@ -222,6 +242,10 @@ class JBossServer {
222242
}
223243
process.start()
224244
waitUntilRunning()
245+
if (serverManagementAllIP) {
246+
println ''
247+
println "Silverpeas management console is accessible at server IP on port ${managementPort}"
248+
}
225249
} else {
226250
logger.info 'A JBoss instance is already started'
227251
}
@@ -239,11 +263,20 @@ class JBossServer {
239263
stop()
240264
}
241265
if (!isStartingOrRunning()) {
266+
int managementPort = 9990
242267
String p = (port <= 1000 ? '5005':String.valueOf(port))
243-
ProcessBuilder process =
244-
new ProcessBuilder(starter, '-c', 'standalone-full.xml', '-b', '0.0.0.0', '--debug', p)
245-
.directory(new File(jbossHome))
246-
.redirectErrorStream(true)
268+
ProcessBuilder process
269+
if (serverManagementAllIP) {
270+
process =
271+
new ProcessBuilder(starter, '-c', 'standalone-full.xml', '-bmanagement', '0.0.0.0', '-b', '0.0.0.0', '--debug', p)
272+
.directory(new File(jbossHome))
273+
.redirectErrorStream(true)
274+
} else {
275+
process =
276+
new ProcessBuilder(starter, '-c', 'standalone-full.xml', '-b', '0.0.0.0', '--debug', p)
277+
.directory(new File(jbossHome))
278+
.redirectErrorStream(true)
279+
}
247280
if (redirection != null) {
248281
process.redirectOutput(redirection)
249282
} else {
@@ -252,6 +285,10 @@ class JBossServer {
252285
}
253286
process.start()
254287
waitUntilRunning()
288+
println ''
289+
if (serverManagementAllIP) {
290+
println "Silverpeas management console is accessible at server IP on port ${managementPort}"
291+
}
255292
println "Silverpeas Debugging Port is ${p}"
256293
} else {
257294
logger.info 'A JBoss instance is already started'

src/main/resources/default_config.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ SERVER_SECURED=false
123123
# change the value here (for example, by setting it to 900 for 15mn)
124124
SERVER_STARTING_TIMEOUT = 300
125125

126+
# By default, the management console is only available on the machine of the running wildfly
127+
# at IP 127.0.0.1 and port 9990.
128+
# This variable allows the management console to be accessible from any server IP. This is useful
129+
# with a client server which does not provide WEB browser (which is generally the case).
130+
# By default, false (that means default wildfly behavior).
131+
SERVER_MANAGEMENT_ALL_IP = false
132+
126133
####################################################################################################
127134
## Properties of the database to use for Silverpeas.
128135
####################################################################################################
@@ -159,6 +166,7 @@ DB_MIN_POOL_SIZE=5
159166
DB_MAX_POOL_SIZE=120
160167
DB_IDLE_TIMEOUT=15
161168
DB_BLOCKING_TIMEOUT=30000
169+
DB_STATS_ENABLED=false
162170

163171
####################################################################################################
164172
## Properties for the JCR used by Silverpeas to store document metadata.
@@ -178,6 +186,7 @@ JCR_MIN_POOL_SIZE=5
178186
JCR_MAX_POOL_SIZE=55
179187
JCR_IDLE_TIMEOUT=15
180188
JCR_BLOCKING_TIMEOUT=30000
189+
JCR_STATS_ENABLED=false
181190

182191
####################################################################################################
183192
## Document Conversion Service properties.

src/test/resources/configuration/config.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ DB_NAME=test
143143
#DB_MAX_POOL_SIZE=55
144144
#DB_IDLE_TIMEOUT=15
145145
#DB_BLOCKING_TIMEOUT=30000
146+
#DB_STATS_ENABLED=false
146147

147148
####################################################################################################
148149
## Properties for the JCR used by Silverpeas to store document metadata.
@@ -162,6 +163,7 @@ DB_NAME=test
162163
#JCR_MAX_POOL_SIZE=55
163164
#JCR_IDLE_TIMEOUT=15
164165
#JCR_BLOCKING_TIMEOUT=30000
166+
#JCR_STATS_ENABLED=false
165167

166168
####################################################################################################
167169
## Document Conversion Service properties.

0 commit comments

Comments
 (0)