Skip to content

Commit

Permalink
Versions bumped.
Browse files Browse the repository at this point in the history
Migrated to build.gradle.kts
  • Loading branch information
vadzimkavalkou committed Nov 16, 2023
1 parent cf2fdd6 commit bd4243d
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 67 deletions.
55 changes: 0 additions & 55 deletions spring-boot-web/build.gradle

This file was deleted.

93 changes: 93 additions & 0 deletions spring-boot-web/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
plugins {
java
application
id("org.springframework.boot") version "3.1.5"
id("io.spring.dependency-management") version "1.1.4"
id("com.google.cloud.tools.jib") version "3.4.0"
}

group = "by.vk"
version = "1.0.0-RC1"

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}

springBoot {
buildInfo()
}

repositories {
mavenCentral()
}

dependencies {
//region implementation
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
implementation("org.springframework:spring-context-indexer")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springdoc:springdoc-openapi-ui:1.7.0")
//endregion
//region logback
implementation("ch.qos.logback.contrib:logback-jackson:0.1.5")
implementation("ch.qos.logback.contrib:logback-json-classic:0.1.5")
//endregion
//region lombok
annotationProcessor("org.projectlombok:lombok")
implementation("org.projectlombok:lombok")
//endregion
//region postgres
runtimeOnly("org.postgresql:postgresql")
//endregion
}

object JVMProps {
const val XMX = "512m"
const val XMS = "256m"
const val XSS = "256k"
const val MAX_METASPACE_SIZE = "128m"
const val MAX_DIRECT_MEMORY_SIZE = "128m"
const val HEAPDUMP_PATH = "/opt/tmp/heapdump.bin"
const val MAX_RAM_PERCENTAGE = "80"
const val INITIAL_RAM_PERCENTAGE = "50"
}


jib {
to {
image = "spring-web-a2b-service:latest"
}
from {
image = "gcr.io/distroless/java21-debian12:latest"
}
container {
jvmFlags = listOf(
"-Xss${JVMProps.XSS}",
"-Xmx${JVMProps.XMX}",
"-Xms${JVMProps.XMS}",
"-XX:MaxMetaspaceSize=${JVMProps.MAX_METASPACE_SIZE}",
"-XX:MaxDirectMemorySize=${JVMProps.MAX_DIRECT_MEMORY_SIZE}",
"-XX:MaxRAMPercentage=${JVMProps.MAX_RAM_PERCENTAGE}",
"-XX:InitialRAMPercentage=${JVMProps.INITIAL_RAM_PERCENTAGE}",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:HeapDumpPath=${JVMProps.HEAPDUMP_PATH}",
"-XX:+UseContainerSupport",
"-XX:+OptimizeStringConcat",
"-XX:+UseStringDeduplication",
"-XX:+ExitOnOutOfMemoryError",
"-XX:+AlwaysActAsServerClassMachine")
ports = listOf("8080")
labels.set(mapOf("appname" to application.applicationName, "version" to version.toString(), "maintainer" to "Vadzim Kavalkou <[email protected]>"))
creationTime.set("USE_CURRENT_TIMESTAMP")
}
}
24 changes: 12 additions & 12 deletions spring-boot-web/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
server:
compression:
enabled: true
undertow:
threads:
io: 4 # default: equals to cores count
worker: 8 # default: 8
# undertow:
# threads:
# io: 4 # default: equals to cores count
# worker: 8 # default: 8

spring:
main:
Expand All @@ -16,14 +16,14 @@ spring:
url: "jdbc:postgresql://localhost:5433/a2b?currentSchema=a2b" #for local solution replace 'postgres-a2b' with localhost and port '5432' to '5433'
username: "user"
password: "password"
hikari:
minimumIdle: 4 # default: same as maximumPoolSize
maximumPoolSize: 8 # cores * 2; default is 10
connection-timeout: 35000 #default 30000
pool-name: "hikari-pool"
idle-timeout: 10000 # default: 600000 (10 minutes)
max-lifetime: 35000 # default: 1800000 (30 minutes)
keepaliveTime: 30000 # default: 0 (disabled)
# hikari:
# minimumIdle: 4 # default: same as maximumPoolSize
# maximumPoolSize: 8 # cores * 2; default is 10
# connection-timeout: 35000 #default 30000
# pool-name: "hikari-pool"
# idle-timeout: 10000 # default: 600000 (10 minutes)
# max-lifetime: 35000 # default: 1800000 (30 minutes)
# keepaliveTime: 30000 # default: 0 (disabled)
jpa:
open-in-view: false
database-platform: org.hibernate.dialect.PostgreSQLDialect
Expand Down

0 comments on commit bd4243d

Please sign in to comment.