Skip to content

Commit

Permalink
fix: use host user for mail container (#93663)
Browse files Browse the repository at this point in the history
* the mail container is now started using the host user by default
* removed obsolete FIXME-comments
  • Loading branch information
skiesewetter-intershop committed Feb 14, 2024
1 parent 5ff18e6 commit 237343f
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 228 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,89 +68,6 @@ class ASTaskPreparer(
)
}

/* FIXME SKR project.tasks.register("start${this.getExtensionName()}", StartServerContainer::class.java) { task ->
configureContainerTask(task)
task.description = "Starts Production Application Server in a container"
task.targetImageId(project.provider { pullTask.get().image.get() })
task.image.set(pullTask.get().image)
task.hostConfig.binds.set(project.provider {
getServerVolumes(task, true).apply {
project.logger.info(
"Using the following volume binds for container startup in task {}: {}",
task.name, this
)
}
})
task.withPortMappings(*getPortMappings().toTypedArray())
task.hostConfig.network.set(networkId)
task.withEnvironment(
ICMContainerEnvironmentBuilder()
.withContainerName(getContainerName())
.build()
)
val devConfig = project.extensions.getByType<IntershopDockerExtension>().developmentConfig
task.withHttpProbe(
URI.create(
StartServerContainer.PATTERN_READINESS_PROBE_URL.format(
devConfig.asPortConfiguration.managementConnector.get().hostPort
)
),
devConfig.getDurationProperty(
Configuration.AS_READINESS_PROBE_INTERVAL,
Configuration.AS_READINESS_PROBE_INTERVAL_VALUE
),
devConfig.getDurationProperty(
Configuration.AS_READINESS_PROBE_TIMEOUT,
Configuration.AS_READINESS_PROBE_TIMEOUT_VALUE
)
)
val solrCloudHostList = devConfig.getConfigProperty(Configuration.SOLR_CLOUD_HOSTLIST)
val solrCloudIndexPrefix = devConfig.getConfigProperty(Configuration.SOLR_CLOUD_INDEXPREFIX)
val mailPort = devConfig.getConfigProperty(Configuration.MAIL_SMTP_PORT)
val mailHost = devConfig.getConfigProperty(Configuration.MAIL_SMTP_HOST)
if(zkTaskProvider != null && solrCloudHostList.isEmpty()) {
task.solrCloudZookeeperHostList = project.provider {
val containerPort = zkTaskProvider!!.get().getPortMappings().stream()
.filter { it.name == ZKPreparer.CONTAINER_PORTMAPPING }
.findFirst().get().containerPort
"${zkTaskProvider!!.get().containerName.get()}:${containerPort}"
}
} else if (solrCloudHostList.isNotEmpty()){
task.solrCloudZookeeperHostList = project.provider {
solrCloudHostList
}
if(solrCloudIndexPrefix.isNotEmpty()) {
task.withEnvironment(ICMContainerEnvironmentBuilder().
withAdditionalEnvironment("SOLR_CLUSTERINDEXPREFIX", solrCloudIndexPrefix).build())
}
}
if(mailServerTaskProvider != null && mailPort.isEmpty() && mailHost.isEmpty()) {
task.mailServer = project.provider {
HostAndPort(
mailServerTaskProvider!!.get().containerName.get(),
mailServerTaskProvider!!.get().getPrimaryPortMapping().get().containerPort
)
}
} else if (mailPort.isNotEmpty() && mailHost.isNotEmpty()){
task.mailServer = project.provider {
HostAndPort(mailHost, mailPort.toInt())
}
}
}*/
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -80,68 +80,5 @@ class ASTestContainerTaskPreparer(

}


/* FIXME SKR project.tasks.register("start${this.getExtensionName()}", StartServerContainer::class.java) { task ->
configureContainerTask(task)
task.description = "Starts Production Application Server in a container - only for use in icm-as"
task.targetImageId(project.provider { pullTask.get().image.get() })
task.image.set(pullTask.get().image)
task.hostConfig.binds.set(project.provider {
getServerVolumes(task, false).apply {
project.logger.info(
"Using the following volume binds for container startup in task {}: {}",
task.name, this
)
}
})
task.withPortMappings(*getPortMappings().toTypedArray())
task.hostConfig.network.set(networkId)
task.withEnvironment(
ICMContainerEnvironmentBuilder()
.withContainerName(getContainerName())
.build()
)
val devConfig = project.extensions.getByType<IntershopDockerExtension>().developmentConfig
task.withHttpProbe(
URI.create(
StartServerContainer.PATTERN_READINESS_PROBE_URL.format(
devConfig.asPortConfiguration.managementConnector.get().hostPort
)
),
devConfig.getDurationProperty(
Configuration.AS_READINESS_PROBE_INTERVAL,
Configuration.AS_READINESS_PROBE_INTERVAL_VALUE
),
devConfig.getDurationProperty(
Configuration.AS_READINESS_PROBE_TIMEOUT,
Configuration.AS_READINESS_PROBE_TIMEOUT_VALUE
)
)
val mailPort = devConfig.getConfigProperty(Configuration.MAIL_SMTP_PORT)
val mailHost = devConfig.getConfigProperty(Configuration.MAIL_SMTP_HOST)
if(mailServerTaskProvider != null && mailPort.isEmpty() && mailHost.isEmpty()) {
task.mailServer = project.provider {
HostAndPort(
mailServerTaskProvider!!.get().containerName.get(),
mailServerTaskProvider!!.get().getPrimaryPortMapping().get().containerPort
)
}
} else if (mailPort.isNotEmpty() && mailHost.isNotEmpty()){
task.mailServer = project.provider {
HostAndPort(mailHost, mailPort.toInt())
}
}
} */
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,5 @@ class CustomizationPreparer(project: Project,
registerStartContainerTask(createTask).configure { task ->
task.description = "Starts customization '${customizationName}'"
}


/* FIXME SKR project.tasks.register("start${getExtensionName()}", StartExtraContainer::class.java) { task ->
configureContainerTask(task)
task.description = "Starts customization '${customizationName}'"
task.targetImageId(project.provider { pullTask.get().image.get() })
task.image.set(pullTask.get().image)
task.hostConfig.binds.set(
mutableMapOf(
"${dockerExtension.containerPrefix}-customizations" to "/customizations"
)
)
task.dependsOn(pullTask, networkTask)
}*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,68 +61,6 @@ class WaitingAsTaskPreparer(
} is executed in preparation of this task and supports parameters that you may expect to get supported by this task.
""".trimIndent()
}


/* FIXME SKR project.tasks.register("start${this.getExtensionName()}", StartServerContainer::class.java) { task ->
configureContainerTask(task)
task.description = "Start container without any special command (sleep)"
task.targetImageId(project.provider { pullTask.get().image.get() })
task.image.set(pullTask.get().image)
task.entrypoint.set(listOf("/intershop/bin/startAndWait.sh"))
task.hostConfig.binds.set(project.provider {
getServerVolumes(task, true).apply {
project.logger.info("Using the following volume binds for container startup in task {}: {}",
task.name, this)
}
})
task.withPortMappings(*getPortMappings().toTypedArray())
task.hostConfig.network.set(networkId)
val devConfig = project.extensions.getByType<IntershopDockerExtension>().developmentConfig
val solrCloudHostList = devConfig.getConfigProperty(Configuration.SOLR_CLOUD_HOSTLIST)
val solrCloudIndexPrefix = devConfig.getConfigProperty(Configuration.SOLR_CLOUD_INDEXPREFIX)
val mailPort = devConfig.getConfigProperty(Configuration.MAIL_SMTP_PORT)
val mailHost = devConfig.getConfigProperty(Configuration.MAIL_SMTP_HOST)
if(zkTaskProvider != null && solrCloudHostList.isEmpty()) {
task.solrCloudZookeeperHostList = project.provider {
val containerPort = zkTaskProvider!!.get().getPortMappings().stream()
.filter { it.name == ZKPreparer.CONTAINER_PORTMAPPING }
.findFirst().get().containerPort
"${zkTaskProvider!!.get().containerName.get()}:${containerPort}"
}
} else if (solrCloudHostList.isNotEmpty()){
task.solrCloudZookeeperHostList = project.provider {
solrCloudHostList
}
if(solrCloudIndexPrefix.isNotEmpty()) {
task.withEnvironment(
ICMContainerEnvironmentBuilder().
withAdditionalEnvironment("SOLR_CLUSTERINDEXPREFIX", solrCloudIndexPrefix).build())
}
}
if(mailServerTaskProvider != null && mailPort.isEmpty() && mailHost.isEmpty()) {
task.mailServer = project.provider {
HostAndPort(
mailServerTaskProvider!!.get().containerName.get(),
mailServerTaskProvider!!.get().getPrimaryPortMapping().get().containerPort
)
}
} else if (mailPort.isNotEmpty() && mailHost.isNotEmpty()){
task.mailServer = project.provider {
HostAndPort(mailHost, mailPort.toInt())
}
}
}*/
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TaskPreparer(project: Project,
override fun getExtensionName(): String = EXT_NAME
override fun getImage(): Provider<String> = dockerExtension.images.mailsrv
override fun getUseHostUserConfigProperty(): String = Configuration.MAIL_USE_HOST_USER
override fun useHostUserDefaultValue(): Boolean = true

init {
initBaseTasks()
Expand Down

0 comments on commit 237343f

Please sign in to comment.