Skip to content

Bug #10769 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 36 additions & 19 deletions src/main/dist/bin/build.gradle
Original file line number Diff line number Diff line change
@@ -54,17 +54,24 @@ buildscript {
* and to install Silverpeas
*/
silversetup {
// mode for developers only (be caution: don't use this mode in production environment).
developmentMode = (System.getenv('SILVERPEAS_DEV_MODE') != null ? System.getenv('SILVERPEAS_DEV_MODE').toBoolean() : false)
if (developmentMode.get() && System.getenv('SILVERPEAS_DIST_DIR') != null) {
distDir = file(System.getenv('SILVERPEAS_DIST_DIR'))
}
logging {
logDir = file("${project.silversetup.silverpeasHome.path}/log")
defaultLevel = project.logLevel
}
silverpeasBundles = project.configurations.silverpeas
tiersBundles = project.configurations.library
installation {
// mode for developers only (be caution: don't use this mode in production environment).
developmentMode = (System.getenv('SILVERPEAS_DEV_MODE') != null ? System.getenv('SILVERPEAS_DEV_MODE').toBoolean() : false)
if (developmentMode.get() && System.getenv('SILVERPEAS_DIST_DIR') != null) {
distDir = file(System.getenv('SILVERPEAS_DIST_DIR'))
}

bundles {
// used to construct the Silverpeas application from a descriptor of software components that
// made up Silverpeas. See silverpeas.gradle for software configuration.
silverpeas = project.configurations.silverpeas
tiers = project.configurations.library
}
}
}

/**
@@ -80,6 +87,7 @@ project.ext {
clean {
doFirst {
JBossServer jboss = new JBossServer(project.silversetup.jbossHome.path)
.withStartingTimeout(project.silversetup.timeout.get())
.redirectOutputTo(project.ext.jbossOutputLog)
if (jboss.isStartingOrRunning()) {
print 'WARNING: JBoss is running, stop it...'
@@ -88,8 +96,8 @@ clean {
}
}
doLast {
ant.delete(dir: project.silversetup.distDir.get().path, includeemptydirs: true)
ant.delete(dir: project.silversetup.deploymentDir.path, includes: '*')
ant.delete(dir: project.silversetup.installation.distDir.get().path, includeemptydirs: true)
ant.delete(dir: project.silversetup.installation.deploymentDir.get().path, includes: '*')
ant.delete(dir: "${project.silversetup.silverpeasHome.path}/log", includes: 'build*.log jboss_output.log')
ant.delete(dir: "${project.silversetup.silverpeasHome.path}/silvertrace", includeemptydirs: true)
ant.delete(dir: "${project.silversetup.silverpeasHome.path}/migrations", includeemptydirs: true)
@@ -109,20 +117,21 @@ clean {
task redeploy {
description 'Redeploy all the artifacts in the SILVERPEAS_HOME/deployments folder'
group 'Silverpeas'
onlyIf { project.silversetup.deploymentDir.exists() }
onlyIf { project.silversetup.installation.deploymentDir.get().exists() }
JBossServer jboss = new JBossServer(project.silversetup.jbossHome.path)
.withStartingTimeout(project.silversetup.timeout.get())
.redirectOutputTo(project.ext.jbossOutputLog)
doFirst {
jboss.doWhenRunning {
project.silversetup.deploymentDir.listFiles().sort { a, b -> b.name <=> a.name }.each { artifact ->
project.silversetup.installation.deploymentDir.get().listFiles().sort { a, b -> b.name <=> a.name }.each { artifact ->
println "Undeploy ${artifact.name}..."
jboss.undeploy(artifact.name)
}
}
}
doLast {
try {
project.silversetup.deploymentDir.listFiles().sort().each { artifact ->
project.silversetup.installation.deploymentDir.get().listFiles().sort().each { artifact ->
println "Deploy ${artifact.name}..."
jboss.deploy(artifact.path)
}
@@ -139,7 +148,9 @@ task start {
description 'Starts Silverpeas'
group 'Silverpeas'
doLast {
long timeout = (project.silversetup.settings.SERVER_STARTING_TIMEOUT as Long) * 1000
new JBossServer(project.silversetup.jbossHome.path)
.withStartingTimeout(timeout)
.redirectOutputTo(project.ext.jbossOutputLog)
.start()
}
@@ -153,7 +164,9 @@ task debug {
group 'Silverpeas'
doLast {
int port = (project.ext.has('port') ? project.ext.port as int:5005)
long timeout = (project.silversetup.settings.SERVER_STARTING_TIMEOUT as Long) * 1000
new JBossServer(project.silversetup.jbossHome.path)
.withStartingTimeout(timeout)
.redirectOutputTo(project.ext.jbossOutputLog)
.debug(port)
}
@@ -167,6 +180,7 @@ task stop {
group 'Silverpeas'
doLast {
new JBossServer(project.silversetup.jbossHome.path)
.withStartingTimeout(project.silversetup.timeout.get())
.redirectOutputTo(project.ext.jbossOutputLog)
.stop()
}
@@ -180,6 +194,7 @@ task status {
group 'Silverpeas'
doLast {
def jboss = new JBossServer(project.silversetup.jbossHome.path)
.withStartingTimeout(project.silversetup.timeout.get())
String configurationStatus = (jboss.isAlreadyConfigured() ? 'Configured: [OK]' : 'Configured: [NOK]')
String executionStatus = (jboss.isRunning() ? 'Running: [OK]' : 'Running: [NOK]')
String deploymentStatus = (jboss.isRunning() && jboss.isDeployed('silverpeas.war') ? 'Active: [OK]' : 'Active: [NOK]')
@@ -196,35 +211,37 @@ task status {
task reload {
description 'Reassembles the Silverpeas war application and deploys it again while JBoss/Wildfly is running (only in dev mode)'
group 'Silverpeas Development'
onlyIf { silversetup.developmentMode }
onlyIf { silversetup.installation.developmentMode.get() }
FileLogger log = FileLogger.getLogger('reload')
long timeout = (project.silversetup.settings.SERVER_STARTING_TIMEOUT as Long) * 1000
JBossServer jboss = new JBossServer(project.silversetup.jbossHome.path)
.withStartingTimeout(timeout)
.redirectOutputTo(project.ext.jbossOutputLog)
.useLogger(log)
doFirst {
log.info "Undeploy ${SILVERPEAS_WAR}..."
jboss.undeploy(SILVERPEAS_WAR)
// deletes the Silverpeas distribution directory
ant.delete(includeemptydirs: true) {
fileset(dir: project.silversetup.distDir.get().path, includes: '**/*')
fileset(dir: project.silversetup.installation.distDir.get().path, includes: '**/*')
}
}
doLast {
// disassembles each war that made Silverpeas
def artifacts = configurations.silverpeas.files
SilverpeasBuilder builder = new SilverpeasBuilder(project, log)
builder.silverpeasHome = project.silversetup.silverpeasHome
builder.settings = project.silversetup.config.settings
builder.developmentMode = project.silversetup.developmentMode
builder.settings = project.silversetup.settings
builder.developmentMode = project.silversetup.installation.developmentMode.get()

File silverpeasWar = builder.findSilverpeasCoreWarBundle(artifacts)
builder.extractWarBundle(silverpeasWar, project.silversetup.distDir.get())
builder.extractWarBundle(silverpeasWar, project.silversetup.installation.distDir.get())
artifacts.each {
if (it.name.endsWith('.war') && it.name != silverpeasWar.name) {
builder.extractWarBundle(it, project.silversetup.distDir.get())
builder.extractWarBundle(it, project.silversetup.installation.distDir.get())
}
}
builder.generateSilverpeasApplication(project.silversetup.distDir.get())
builder.generateSilverpeasApplication(project.silversetup.installation.distDir.get())

try {
log.info "Deploy ${SILVERPEAS_WAR}..."
13 changes: 13 additions & 0 deletions src/main/dist/configuration/jboss/deployment-timeout.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Change the timeout of the application deployment in Wildfly
#

echo Change the timeout of the application deployment in Wildfly

# If already set, remove it so that the timeout can be updated
if (outcome == success) of /system-property=jboss.as.management.blocking.timeout:read-resource
/system-property=jboss.as.management.blocking.timeout:remove
end-if

/system-property=jboss.as.management.blocking.timeout:add(value=${SERVER_STARTING_TIMEOUT})
/subsystem=deployment-scanner/scanner=default:write-attribute(name=deployment-timeout,value=${SERVER_STARTING_TIMEOUT})
8 changes: 8 additions & 0 deletions src/main/dist/configuration/sample_config.properties
Original file line number Diff line number Diff line change
@@ -81,6 +81,14 @@
# false. By default false.
#SERVER_SECURED=false

# The timeout in seconds for the server to start Silverpeas. By default, the timeout of the
# application deployment of the server (5mn in Wildfly). When Silverpeas is started by the server
# (when it is deployed in the JEE jargon), it can take some times to initialize the resources that
# depends on the amount of the data managed by Silverpeas and on the performance of both the
# hardware and the filesystem. If you encounter a timeout error at Silverpeas starting, then
# change the value here (for example, by setting it to 900 for 15mn)
#SERVER_STARTING_TIMEOUT = 300

####################################################################################################
## Properties of the database to use for Silverpeas.
####################################################################################################