update admin and client config

This commit is contained in:
Sambo Chea 2019-12-19 12:05:19 +07:00
parent e77a06e904
commit 6be2f950f6
9 changed files with 63 additions and 1 deletions

6
Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM cubetiq/cubezdk-alpine
LABEL maintainer="sombochea@cubetiqs.com"
VOLUME /tmp
COPY build/libs/*.jar admin.jar
EXPOSE 8080 8080
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/admin.jar", "--spring.profiles.active=dev"]

View File

@ -24,6 +24,7 @@ dependencies {
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("de.codecentric:spring-boot-admin-starter-client")
implementation("de.codecentric:spring-boot-admin-starter-server")
implementation("de.codecentric:spring-boot-admin-server-ui")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")

1
docker-build.sh Normal file
View File

@ -0,0 +1 @@
bash gradlew build -x test && docker build . -t cubetiq/admin-server:dev && docker stop admin-server && docker rm -v admin-server && docker run -d -p 7658:7658 --name admin-server --restart always cubetiq/admin-server:dev

View File

@ -1,9 +1,11 @@
package com.cubetiqs.ops.admin
import de.codecentric.boot.admin.server.config.EnableAdminServer
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
@SpringBootApplication
@EnableAdminServer
class AdminApplication
fun main(args: Array<String>) {

View File

@ -0,0 +1,16 @@
package com.cubetiqs.ops.admin.indicator
import org.springframework.boot.actuate.health.Health
import org.springframework.boot.actuate.health.ReactiveHealthIndicator
import reactor.core.publisher.Mono
@Indicator
class DownstreamServiceHealthIndicator : ReactiveHealthIndicator {
override fun health(): Mono<Health?>? {
return checkDownstreamServiceHealth()?.onErrorResume { Mono.just(Health.Builder().down(it).build()) }
}
private fun checkDownstreamServiceHealth(): Mono<Health?>? {
return Mono.just(Health.Builder().up().build())
}
}

View File

@ -0,0 +1,12 @@
package com.cubetiqs.ops.admin.indicator
import org.springframework.stereotype.Component
/**
* @author sombochea
* @since 1.0
*/
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS)
@Component
annotation class Indicator(val value: String = "")

View File

@ -0,0 +1,20 @@
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-components: always
show-details: always
spring:
boot:
admin:
client:
enabled: true
url: http://localhost:7658
data:
mongodb:
uri: mongodb://192.168.0.150/admin
application:
name: admin

View File

@ -1 +0,0 @@
server.port=7658

View File

@ -0,0 +1,5 @@
server:
port: 7658
spring:
profiles:
active: dev