Updated names and paths for template
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
package de.twomartens.templateservice;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class TemplateServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.info(">>> {}:{} <<<", getTitle(), getVersion());
|
||||
SpringApplication.run(TemplateServiceApplication.class, args);
|
||||
}
|
||||
|
||||
private static String getTitle() {
|
||||
return Optional.ofNullable(TemplateServiceApplication.class.getPackage().getImplementationTitle())
|
||||
.orElse("start");
|
||||
}
|
||||
|
||||
private static String getVersion() {
|
||||
return Optional.ofNullable(TemplateServiceApplication.class.getPackage().getImplementationVersion())
|
||||
.orElse("snapshot");
|
||||
}
|
||||
}
|
||||
15
template-server/src/main/resources/log4j2.xml
Normal file
15
template-server/src/main/resources/log4j2.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Configuration status="warn" monitorInterval="30">
|
||||
<Appenders>
|
||||
<Console name="console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%5p %d{HH:mm:ss.SSS} (%F:%L) [%X{REQTYPE}] %m%n%xEx{full}"
|
||||
alwaysWriteExceptions="true"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="console"/>
|
||||
</Root>
|
||||
<Logger name="de.twomartens" level="TRACE" additivity="true"/>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
85
template-server/template-server.gradle
Normal file
85
template-server/template-server.gradle
Normal file
@ -0,0 +1,85 @@
|
||||
plugins {
|
||||
id 'com.google.cloud.tools.jib' version '1.8.0' // jib build our docker images
|
||||
id 'org.springframework.boot' version '2.2.4.RELEASE'
|
||||
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
||||
}
|
||||
|
||||
configurations {
|
||||
all {
|
||||
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
|
||||
}
|
||||
integrationTestImplementation.extendsFrom testImplementation
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
integrationTest {
|
||||
java {
|
||||
compileClasspath += main.output + test.output
|
||||
runtimeClasspath += main.output + test.output
|
||||
srcDir file('src/integration-test/java')
|
||||
}
|
||||
resources.srcDir file('src/integration-test/resources')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-websocket'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
|
||||
implementation 'io.micrometer:micrometer-registry-prometheus'
|
||||
implementation 'org.springdoc:springdoc-openapi-ui:1.3.9'
|
||||
|
||||
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||
testImplementation('org.springframework.boot:spring-boot-starter-test') {
|
||||
// no support for junit 4 Tests
|
||||
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
|
||||
// exclude hamcrest, we use asAbbringerFahrtLoeschenTypesertj in unit tests
|
||||
exclude group: 'org.hamcrest', module: 'hamcrestv'
|
||||
}
|
||||
testImplementation 'org.testcontainers:testcontainers:1.12.5'
|
||||
// add hamcrest only for mockMvcTest
|
||||
// see https://github.com/spring-projects/spring-framework/issues/21178
|
||||
testImplementation 'org.hamcrest:hamcrest:2.2'
|
||||
}
|
||||
|
||||
bootJar {
|
||||
manifest {
|
||||
attributes 'Implementation-Title': archiveBaseName.get(),
|
||||
'Implementation-Version': archiveVersion.get(),
|
||||
'Implementation-Vendor': "Jim Martens"
|
||||
}
|
||||
}
|
||||
|
||||
task integrationTest(type: Test) {
|
||||
useJUnitPlatform()
|
||||
maxHeapSize = "4g"
|
||||
group = 'verification'
|
||||
workingDir = rootProject.projectDir
|
||||
testClassesDirs = sourceSets.integrationTest.output.classesDirs
|
||||
classpath = sourceSets.integrationTest.runtimeClasspath
|
||||
}
|
||||
|
||||
tasks.jib.dependsOn(build)
|
||||
tasks.jibDockerBuild.dependsOn(build)
|
||||
|
||||
jib {
|
||||
from {
|
||||
image = 'amazoncorretto:11'
|
||||
}
|
||||
to {
|
||||
image = '2martens/oparl'
|
||||
tags = ['latest', getProperty('version').toString().replace('+', '-')]
|
||||
}
|
||||
container {
|
||||
jvmFlags = ['-Xms1g', '-Xmx1g', '-Dlog4j.configurationFile=log4j2-docker.xml']
|
||||
mainClass = "org.springframework.boot.loader.JarLauncher"
|
||||
// 8080 spring boot web, 8081 actuators (prometheus, healthchecks, ...), 9090 grpc
|
||||
ports = ['8080', '8081', '9090']
|
||||
}
|
||||
containerizingMode = 'packaged'
|
||||
}
|
||||
|
||||
tasks.build.dependsOn(integrationTest)
|
||||
tasks.integrationTest.mustRunAfter(test)
|
||||
|
||||
Reference in New Issue
Block a user