Skip to content
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

fix: use host user for mail container (#93663) #94

Merged
Merged
Show file tree
Hide file tree
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
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
Loading