Skip to content

Commit

Permalink
Initial Spring and nais setup
Browse files Browse the repository at this point in the history
  • Loading branch information
AudunSorheim committed Dec 7, 2023
1 parent fddc122 commit ec55d67
Show file tree
Hide file tree
Showing 15 changed files with 526 additions and 207 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-and-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build & Deploy
on: push

jobs:
boot-jar-app:
uses: navikt/teamesyfo-github-actions-workflows/.github/workflows/boot-jar-app.yaml@main
permissions:
actions: read
contents: write
security-events: write
packages: write
id-token: write
secrets: inherit
with:
app: oppfolgingsplan-backend
43 changes: 33 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
# Idea project files
*.iml
.idea/
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

# Gradle files
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
build/
.gradle/
!**/src/main/**/out/
!**/src/test/**/out/

# Generated sources
src/generated
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

# OS specific
.DS_Store
### VS Code ###
.vscode/
132 changes: 52 additions & 80 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,101 +1,73 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "no.nav.syfo"
version = "1.0"

val ktorVersion = "2.3.1"
val prometheusVersion = "0.15.0"
val micrometerVersion = "1.8.4"
val slf4jVersion = "1.7.36"
val logbackVersion = "1.2.11"
val javaxVersion = "2.1.1"
val logstashEncoderVersion = "7.0.1"
val postgresVersion = "42.6.0"
val hikariVersion = "5.0.1"
val flywayVersion = "7.5.2"
plugins {
id("org.springframework.boot") version "3.2.0"
id("io.spring.dependency-management") version "1.1.4"
id("io.gitlab.arturbosch.detekt") version "1.23.4"
kotlin("jvm") version "1.9.21"
kotlin("plugin.spring") version "1.9.21"
}

val githubUser: String by project
val githubPassword: String by project
group = "no.nav.syfo"
version = "0.0.1-SNAPSHOT"

plugins {
kotlin("jvm") version "1.8.21"
id("org.jetbrains.kotlin.plugin.allopen") version "1.8.21"
id("com.diffplug.gradle.spotless") version "3.18.0"
id("com.github.johnrengelman.shadow") version "7.1.0"
java {
sourceCompatibility = JavaVersion.VERSION_17
}

allOpen {
annotation("no.nav.syfo.annotation.Mockable")
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}

repositories {
mavenCentral()
maven(url = "https://packages.confluent.io/maven/")
maven {
url = uri("https://maven.pkg.github.com/navikt/syfo-xml-codegen")
credentials {
username = githubUser
password = githubPassword
}
}
maven {
url = uri("https://maven.pkg.github.com/navikt/syfotjenester")
credentials {
username = githubUser
password = githubPassword
}
}
maven {
url = uri("https://maven.pkg.github.com/navikt/tjenestespesifikasjoner")
credentials {
username = githubUser
password = githubPassword
}
url = uri("https://github-package-registry-mirror.gc.nav.no/cached/maven-release")
}
}

configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.scala-lang" && requested.name == "scala-library" && (requested.version == "2.13.3")) {
useVersion("2.13.9")
because("fixes critical bug CVE-2022-36944 in 2.13.6")
}
}
}
val tokenSupportVersion = "3.1.5"
val mockkVersion = "1.13.8"
val kotestVersion = "5.6.2"
val hikariVersion = "5.1.0"
val logstashLogbackEncoderVersion = "7.4"

dependencies {

// Ktor server
implementation("io.ktor:ktor-server-auth:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-jackson:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")
implementation("io.ktor:ktor-serialization-jackson:$ktorVersion")

// API
implementation("javax.ws.rs:javax.ws.rs-api:$javaxVersion")

// Logging
implementation("org.slf4j:slf4j-api:$slf4jVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("net.logstash.logback:logstash-logback-encoder:$logstashEncoderVersion")

// Database
implementation("org.postgresql:postgresql:$postgresVersion")
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.micrometer:micrometer-registry-prometheus")
implementation("org.flywaydb:flyway-core")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("no.nav.security:token-client-spring:$tokenSupportVersion")
implementation("no.nav.security:token-validation-spring:$tokenSupportVersion")
implementation("com.zaxxer:HikariCP:$hikariVersion")
implementation("org.flywaydb:flyway-core:$flywayVersion")
implementation("org.springframework.boot:spring-boot-starter-logging")
implementation("net.logstash.logback:logstash-logback-encoder:$logstashLogbackEncoderVersion")
developmentOnly("org.springframework.boot:spring-boot-devtools")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("com.h2database:h2")
}

// Metrics and Prometheus
implementation("io.micrometer:micrometer-registry-prometheus:$micrometerVersion")
implementation("io.prometheus:simpleclient_common:$prometheusVersion")
implementation("io.prometheus:simpleclient_hotspot:$prometheusVersion")
implementation("io.prometheus:simpleclient_pushgateway:$prometheusVersion")
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "17"
}
}

configurations.implementation {
exclude(group = "com.fasterxml.jackson.module", module = "jackson-module-scala_2.13")
tasks.withType<Test> {
useJUnitPlatform()
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit ec55d67

Please sign in to comment.