Skip to content

Commit

Permalink
feat: configuration of dev tools to easier developments (#5)
Browse files Browse the repository at this point in the history
Signed-off-by: ablandel <[email protected]>
  • Loading branch information
ablandel committed Jun 7, 2024
1 parent 0b34233 commit f44f4d0
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 17 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Add the changes here.

## [1.1.0] - 2024-06-07

### Added

- Configuration of dev tools to easier developments

### Updated

- Update of the dependencies

## [1.0.0] - 2024-05-02

### Added
Expand All @@ -18,6 +28,8 @@ Add the changes here.
- First version of the tag CRUD endpoints
- First version of the tag GraphQL endpoints

[unreleased]: https://github.com/ablandel/another-kaomoji/compare/1.0.0..main
[unreleased]: https://github.com/ablandel/another-kaomoji/compare/1.1.0..main

[1.1.0]: https://github.com/ablandel/another-kaomoji/compare/1.0.0..1.1.0

[1.0.0]: https://github.com/ablandel/another-kaomoji/tree/1.0.0
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# Another Kaomoji \(٥⁀▽⁀ )/

Simple project to test Kotlin + Spring project against a database.
Simple project to test Kotlin + Spring against a database.

### Start the project

A `docker-compose.yaml` file is provided to easier the developments. Another `PostgreSQL` instance can be used; in this
case the `application.yaml` may have to be updated.

#### Start the database

```shell
docker compose up
```

This project is also configured with the `spring-boot-docker-compose` Spring dependency. The `docker-compose.yaml` can
be automatically launched using `spring.docker.compose.enabled` property or the gradle `bootRunDev` task.

#### Start the server

*Note: A database is required to run the server. The `docker-compose.yaml` file can be used for dev purpose.
The `application.yaml` and the `docker-compose.yaml` files has been configured to be directly runnable after a fresh
clone.*
If a database is already running and the application configured.

```shell
./gradlew bootRun
```

Else, using the dev mode with the `spring-boot-docker-compose` Spring feature.

```shell
./gradlew bootRunDev
```

### Run the tests

*Note: `Docker` is required to run the DAOs tests.*
Expand All @@ -31,4 +36,20 @@ clone.*

```shell
./gradlew clean test
```
```

### Docker image build

A `local.docker-compose.yaml` file is provided to easier the test using Docker images. For the moment, the Docker image
are not pushed and need to be locally built.

#### Build the image

```shell
docker build -t another-kaomoji:local .
```

#### Start the docker compose
```shell
docker compose -f local.docker-compose.yaml up
```
55 changes: 46 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
plugins {
id("org.springframework.boot") version "3.2.4"
kotlin("jvm") version "1.9.23"
kotlin("plugin.spring") version "1.9.23"
kotlin("plugin.jpa") version "1.9.23"
// https://plugins.gradle.org/plugin/org.springframework.boot
id("org.springframework.boot") version "3.3.0"
// https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
id("org.jetbrains.kotlin.jvm") version "2.0.0"
// https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.spring
id("org.jetbrains.kotlin.plugin.spring") version "2.0.0"
// https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.jpa
id("org.jetbrains.kotlin.plugin.jpa") version "2.0.0"
}

group = "github.ablandel.anotherkaomoji"
Expand All @@ -12,29 +16,62 @@ repositories {
mavenCentral()
}

val springVersion = "3.2.5"
val testcontainersVersion = "1.19.7"
val springVersion = "3.3.0"
val testcontainersVersion = "1.19.8"

dependencies {
implementation(kotlin("reflect:1.9.23"))
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
implementation("org.springframework.boot:spring-boot-starter-web:$springVersion")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator
implementation("org.springframework.boot:spring-boot-starter-actuator:$springVersion")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
implementation("org.springframework.boot:spring-boot-starter-data-jpa:$springVersion")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation
implementation("org.springframework.boot:spring-boot-starter-validation:$springVersion")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-graphql
implementation("org.springframework.boot:spring-boot-starter-graphql:$springVersion")
implementation("jakarta.validation:jakarta.validation-api:3.0.2")
implementation("org.liquibase:liquibase-core:4.27.0")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-docker-compose
implementation("org.springframework.boot:spring-boot-docker-compose:$springVersion")
// https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api
implementation("jakarta.validation:jakarta.validation-api:3.1.0")
// https://mvnrepository.com/artifact/org.liquibase/liquibase-core
implementation("org.liquibase:liquibase-core:4.28.0")
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect
runtimeOnly("org.jetbrains.kotlin:kotlin-reflect:2.0.0")
// https://mvnrepository.com/artifact/org.postgresql/postgresql
runtimeOnly("org.postgresql:postgresql:42.7.3")
// https://mvnrepository.com/artifact/org.junit.platform/junit-platform-launcher
runtimeOnly("org.junit.platform:junit-platform-launcher:1.10.2")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test
testImplementation("org.springframework.boot:spring-boot-starter-test:$springVersion")
// https://mvnrepository.com/artifact/org.testcontainers/junit-jupiter
testImplementation("org.testcontainers:junit-jupiter:$testcontainersVersion")
// https://mvnrepository.com/artifact/org.testcontainers/postgresql
testImplementation("org.testcontainers:postgresql:$testcontainersVersion")
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools
developmentOnly("org.springframework.boot:spring-boot-devtools:3.3.0")
}

tasks.register("bootRunDev") {
group = "application"
description = "Runs this project as a Spring Boot application with the dev profile"
doFirst {
tasks.bootRun.configure {
systemProperty("spring.profiles.active", "dev")
systemProperty("spring.docker.compose.enabled", true)
systemProperty("logging.level.web", "info")
systemProperty("spring.mvc.log-request-details", true)
systemProperty("spring.codec.log-request-details", true)
}
}
finalizedBy("bootRun")
}

tasks.test {
useJUnitPlatform()
jvmArgs("-XX:+EnableDynamicAgentLoading") // see: https://eclipse.dev/openj9/docs/xxenabledynamicagentloading/
}

kotlin {
jvmToolchain(21)
}
4 changes: 4 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ spring:
liquibase:
change-log: classpath:db/changelog/db.changelog-root.yaml
drop-first: false
docker:
compose:
enabled: false
file: docker-compose.yaml

0 comments on commit f44f4d0

Please sign in to comment.