Merge pull request 'watchdog-be' (#12) from watchdog-be into master
Reviewed-on: #12
This commit is contained in:
commit
a2749072eb
|
@ -0,0 +1,32 @@
|
|||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
- synchronize
|
||||
- closed
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
build-watchdog-be:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./watch-dog-be
|
||||
if: contains(github.event.pull_request.labels.*.name,'watchdog-be')
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v3
|
||||
- run: ./gradlew jibBuildTar
|
||||
if: github.event.pull_request.merged == false
|
||||
- run: ./gradlew jib -Djib.to.image=git.usbharu.dev/usbharu/watchdog-be -Djib.to.auth.username=usbharu -Djib.to.auth.password=${{ secrets.DEPLOY_TOKEN }}
|
||||
if: github.event.pull_request.merged == true
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "dev.usbharu"
|
||||
version = "1.0-SNAPSHOT"
|
||||
version = "1.0.0"
|
||||
|
||||
application {
|
||||
mainClass.set("io.ktor.server.netty.EngineMain")
|
||||
|
@ -82,5 +82,6 @@ jib {
|
|||
ktor {
|
||||
docker {
|
||||
localImageName.set("watchdog-be")
|
||||
this.imageTag = version.toString()
|
||||
}
|
||||
}
|
|
@ -3,8 +3,8 @@ package dev.usbharu.unos.watchdog.be
|
|||
import io.grpc.ServerBuilder
|
||||
import io.ktor.server.application.*
|
||||
|
||||
fun Application.grpc(pushMetricsService: PushMetricsService){
|
||||
val server = ServerBuilder.forPort(50051)
|
||||
fun Application.grpc(port:Int,pushMetricsService: PushMetricsService){
|
||||
val server = ServerBuilder.forPort(port)
|
||||
.addService(pushMetricsService)
|
||||
.build()
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ fun Application.module() {
|
|||
|
||||
val url = environment.config.property("watchdog.db.url").getString()
|
||||
val databaseName = environment.config.property("watchdog.db.database").getString()
|
||||
val grpcPort = environment.config.property("watchdog.grpc.port").getString().toInt()
|
||||
val database =
|
||||
MongoClient
|
||||
.create(
|
||||
|
@ -33,7 +34,7 @@ fun Application.module() {
|
|||
|
||||
val mongoMetricsRepository = MongoMetricsRepository(database)
|
||||
|
||||
grpc(PushMetricsService(mongoMetricsRepository))
|
||||
grpc(grpcPort,PushMetricsService(mongoMetricsRepository))
|
||||
routing {
|
||||
api(ApiController(mongoMetricsRepository))
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ watchdog {
|
|||
url = "mongodb://localhost:27017"
|
||||
database = "watchdog"
|
||||
}
|
||||
|
||||
grpc {
|
||||
port = 50051
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue