Compare commits

...
19 Commits
Author SHA1 Message Date
2martens c8e4474175 Remove configserver import from general configuration
continuous-integration/drone/push Build is failing
2023-08-16 22:09:50 +02:00
2martens 499c85ae49 Load configserver only in production and move refreshable prod properties to wahlrecht-prod
continuous-integration/drone/push Build is failing
2023-08-16 22:08:50 +02:00
2martens e88d98efc1 Dummy change
continuous-integration/drone/push Build is failing
2023-08-16 21:56:57 +02:00
2martens 8d545aa7fb Moved refreshable configuration to config sub-directory
continuous-integration/drone/push Build is failing
2023-08-16 21:54:42 +02:00
2martens a04094bc60 Move configserver import to bootstrap.yaml
continuous-integration/drone/push Build is failing
2023-08-16 21:09:15 +02:00
2martens 7d68612e57 Adjusted path to configserver
continuous-integration/drone/push Build is failing
2023-08-16 20:17:57 +02:00
2martens 64295db0e7 Added environments for http requests
continuous-integration/drone/push Build is failing
2023-08-16 20:08:54 +02:00
2martens 6dcd302ab7 OPTIONS method does not have to be allowed 2023-08-16 20:08:01 +02:00
2martens e50e769e22 Added production domain as allowed origin
continuous-integration/drone/push Build is failing
2023-08-16 12:52:17 +02:00
2martens b7c85e2368 Reversed code format 2023-08-16 01:00:48 +02:00
2martens a60289fc49 Added production server to OpenAPI
continuous-integration/drone/push Build is failing
2023-08-16 01:00:16 +02:00
2martens 9c4feee043 Use 127.0.0.1 as address
continuous-integration/drone/push Build is failing
2023-08-16 00:25:15 +02:00
2martens 1a50b40eaf Load log4j2.xml from resources
continuous-integration/drone/push Build is failing
2023-08-15 23:50:42 +02:00
2martens 3c7464a0cf Fix mainClassName
continuous-integration/drone/push Build is failing
2023-08-15 22:37:45 +02:00
2martens 2fe84fec45 Exclude env.sh script
continuous-integration/drone/push Build is failing
2023-08-15 09:28:32 +02:00
2martens bc1f85865c Enable bootJar 2023-08-15 09:28:18 +02:00
2martens 17bde7aa42 Fix config import property 2023-08-15 09:21:22 +02:00
2martens 9d21dfe032 Added scripts to help with nebula releases 2023-08-15 08:25:46 +02:00
2martens e463f0b7a8 Removed not required toString 2023-08-15 08:24:02 +02:00
19 changed files with 65 additions and 62 deletions
+1
View File
@@ -12,6 +12,7 @@ build/
**/*.log
**/*.hprof
**/generated/**
env.sh
### STS ###
.apt_generated
@@ -1,6 +1,4 @@
import org.gradle.accessors.dm.LibrariesForLibs
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
plugins {
jacoco
@@ -51,22 +49,6 @@ tasks.jacocoTestReport {
}
}
val formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
tasks.jar {
doFirst {
manifest {
attributes["Implementation-Title"] = rootProject.name
attributes["Implementation-Version"] = archiveVersion.get()
attributes["Implementation-Vendor"] = "Jim Martens"
attributes["Build-Timestamp"] = ZonedDateTime.now().format(formatter)
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
attributes["Build-Jdk"] = "${providers.systemProperty("java.version").get()} (${providers.systemProperty("java.vendor").get()} ${providers.systemProperty("java.vm.version").get()})"
attributes["Build-OS"] = "${providers.systemProperty("os.name").get()} ${providers.systemProperty("os.arch").get()} ${providers.systemProperty("os.version").get()}"
}
}
}
normalization.runtimeClasspath.metaInf {
ignoreAttribute("Build-Timestamp")
}
@@ -13,6 +13,6 @@ tasks.register("writeVersionProperties") {
val directory = buildDir
doLast {
Files.createDirectories(directory.toPath())
File("$buildDir/version.properties").writeText("VERSION=${project.version.toString()}\n")
File("$buildDir/version.properties").writeText("VERSION=${project.version}\n")
}
}
@@ -1,4 +1,7 @@
import org.gradle.accessors.dm.LibrariesForLibs
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeFormatter.ofPattern
plugins {
id("org.springframework.boot")
@@ -57,27 +60,21 @@ tasks.named("buildAll") {
dependsOn("integrationTest")
}
springBoot {
buildInfo()
}
val formatter: DateTimeFormatter = ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
tasks.bootJar {
enabled = false
manifest {
attributes["Implementation-Title"] = rootProject.name
attributes["Implementation-Version"] = archiveVersion.get()
attributes["Implementation-Vendor"] = "Jim Martens"
attributes["Build-Timestamp"] = ZonedDateTime.now().format(formatter)
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
attributes["Build-Jdk"] = "${providers.systemProperty("java.version").get()} (${providers.systemProperty("java.vendor").get()} ${providers.systemProperty("java.vm.version").get()})"
attributes["Build-OS"] = "${providers.systemProperty("os.name").get()} ${providers.systemProperty("os.arch").get()} ${providers.systemProperty("os.version").get()}"
}
}
tasks.jar {
enabled = true
archiveClassifier.set("")
springBoot {
buildInfo()
mainClass.set("de.twomartens.wahlrecht.MainApplicationKt")
}
tasks.bootDistZip {
dependsOn(tasks.jar)
}
tasks.bootDistTar {
dependsOn(tasks.jar)
}
tasks.bootStartScripts {
dependsOn(tasks.jar)
}
+1 -1
View File
@@ -1,4 +1,4 @@
POST http://localhost:12000/wahlrecht/v1/calculate
POST {{backend}}/wahlrecht/v1/calculate
Content-Type: application/json
{
+2
View File
@@ -0,0 +1,2 @@
GET {{backend}}/wahlrecht/v1/elections
Content-Type: application/json
+8
View File
@@ -0,0 +1,8 @@
{
"dev": {
"backend": "http://localhost:12000"
},
"prod" : {
"backend": "https://api.2martens.de"
}
}
+2 -4
View File
@@ -31,10 +31,8 @@ jib {
}
}
container {
extraClasspath = listOf("/configmap")
mainClass = "de.twomartens.wahlrecht.MainApplication"
mainClass = "de.twomartens.wahlrecht.MainApplicationKt"
jvmFlags = listOf("-XX:+UseContainerSupport",
"-XX:MaxRAMPercentage=75.0",
"-Dlog4j.configurationFile=/configmap/log4j2.xml")
"-XX:MaxRAMPercentage=75.0")
}
}
@@ -1,2 +0,0 @@
server:
port: 12000
+1 -1
View File
@@ -10,4 +10,4 @@ dependencies {
annotationProcessor(libs.mapstruct.processor)
kapt(libs.mapstruct.processor)
implementation(libs.spring.cloud.starter.config)
}
}
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.security.OAuthFlows
import io.swagger.v3.oas.annotations.security.SecurityScheme
import io.swagger.v3.oas.models.OpenAPI
import io.swagger.v3.oas.models.info.Info
import io.swagger.v3.oas.models.servers.Server
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@@ -35,5 +36,7 @@ open class OpenApiConfiguration {
.version(apiVersion)
.description(apiDescription)
)
.addServersItem(Server().url("http://localhost:12000"))
.addServersItem(Server().url("https://api.2martens.de"))
}
}
@@ -16,10 +16,13 @@ open class WebConfiguration(private val headerInterceptorRest: HeaderInterceptor
override fun addCorsMappings(registry: CorsRegistry) {
val registration = registry.addMapping("/**")
registration.allowedMethods(
HttpMethod.GET.name(), HttpMethod.POST.name(),
HttpMethod.PUT.name(), HttpMethod.OPTIONS.name()
HttpMethod.GET.name(), HttpMethod.POST.name(),
HttpMethod.PUT.name(), HttpMethod.HEAD.name()
)
registration.allowCredentials(true)
registration.allowedOrigins("http://localhost:4200")
registration.allowedOrigins(
"http://localhost:4200",
"https://wahlrecht.2martens.de"
)
}
}
@@ -0,0 +1,5 @@
spring:
config:
import:
- "classpath:config/wahlrecht.yaml"
- "optional:configserver:http://configserver:8888/config"
@@ -23,9 +23,9 @@ management:
http.server.requests: true
spring:
spring:
config:
import: "optional:configserver:http://localhost:8888/config"
config:
import:
- "classpath:config/wahlrecht.yaml"
main:
banner-mode: off
profiles:
@@ -42,16 +42,6 @@ spring:
name: wahlrecht
# properties for application
de.twomartens.wahlrecht:
defaultTimeZone: Europe/Berlin
greeting: "Hello %s"
statusprobe:
scheduleDuration: 60
maxKafkaFailureDuration: 5
maxBlobFailureCount: 5
maxFailurePercent: 50
springdoc:
swagger-ui:
display-request-duration: true
@@ -0,0 +1,2 @@
de.twomartens.wahlrecht:
greeting: "Moin %s"
@@ -0,0 +1,8 @@
de.twomartens.wahlrecht:
defaultTimeZone: Europe/Berlin
greeting: "Hello %s"
statusprobe:
scheduleDuration: 60
maxKafkaFailureDuration: 5
maxBlobFailureCount: 5
maxFailurePercent: 50
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
./gradlew -Prelease.scope=major $@
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
./gradlew -Prelease.scope=minor $@
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
./gradlew -Prelease.scope=patch $@