+FROM alpine:latest AS extractor
+COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
+RUN tar -xzf /source.tar.gz -C /tmp \
+ && cp -rf /tmp/@project.build.finalName@/opt / \
+ && rm -rf /source.tar.gz \
+ && rm -rf /tmp/@project.build.finalName@
+
FROM omahoco1/alpine-java-python
# add entrypoint
RUN chmod 777 /startService.sh && dos2unix /startService.sh
# add application
-COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
-RUN tar -xzf /source.tar.gz -C /tmp \
- && cp -rf /tmp/@project.build.finalName@/opt / \
- && rm -rf /source.tar.gz \
- && rm -rf /tmp/@project.build.finalName@
+COPY --from=extractor /opt /opt
ENTRYPOINT [ "/startService.sh" ]
-Djava.security.egd=file:/dev/./urandom \
-DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
-Dspring.config.location=${APP_CONFIG_HOME}/ \
+-Dhazelcast.shutdownhook.policy=GRACEFUL \
+-Dhazelcast.graceful.shutdown.max.wait=600 \
org.onap.ccsdk.cds.blueprintsprocessor.BlueprintProcessorApplicationKt
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Component
-import java.time.Duration
import java.util.Properties
-import javax.annotation.PreDestroy
/**
* To Start the cluster, minimum 2 Instances/ Replicas od CDS needed.
log.info("Cluster is disabled, to enable cluster set the environment CLUSTER_* properties.")
}
}
-
- @PreDestroy
- fun shutDown() = runBlocking {
- bluePrintClusterService.shutDown(Duration.ofMillis(1))
- }
}
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
import org.springframework.context.annotation.ComponentScan
* @author Brinda Santh
*/
@SpringBootApplication
-@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
+@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class, HazelcastAutoConfiguration::class])
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
open class BlueprintProcessorApplication
var joinedLite = false
override suspend fun <T> startCluster(configuration: T) {
- /** Get the Hazelcast Cliet or Server instance */
+ /** Get the Hazelcast Client or Server instance */
hazelcast =
when (configuration) {
is Config -> {
} else {
/** Hazelcast Server from config file */
val hazelcastServerConfiguration = FileSystemYamlConfig(normalizedFile(configFile))
+ hazelcastServerConfiguration.clusterName = configuration.id
+ hazelcastServerConfiguration.instanceName = configuration.nodeId
hazelcastServerConfiguration.properties = configuration.properties
hazelcastServerConfiguration.memberAttributeConfig = memberAttributeConfig
joinedLite = hazelcastServerConfiguration.isLiteMember
}
/** Add the Membership Listeners */
- hazelcast.cluster.addMembershipListener(BlueprintsClusterMembershipListener(this))
+ hazelcast.cluster.addMembershipListener(BlueprintsClusterMembershipListener())
log.info(
"Cluster(${hazelcast.config.clusterName}) node(${hazelcast.name}) created successfully...."
)
}
}
-open class BlueprintsClusterMembershipListener(val hazlecastClusterService: HazlecastClusterService) :
+open class BlueprintsClusterMembershipListener() :
MembershipListener {
private val log = logger(BlueprintsClusterMembershipListener::class)