- Overview
- Pre-requisites
- Up & Running
- Live Reload
- Troubleshooting
- Additional Topics
This starter is a set of utilities built on top of Ktor to quickly bootstrap a microservice. This starter sets up the following features:
Service
- Application architecture that favors grouping by feature.
- The following Kotlin quality plugins are setup: ktlint, detekt and kover
- The follow service feautures using ktor plugins are setup :
- Ignore trailing slashes in routes. (e.g.
foo/
andfoo
are treated the same) - Default headers
- Response compression
- Kubernetes style startup, readiness and liveness health checks using Cohort.
- Swagger UI for API documentation using Tegral's Ktor OpenAPI
- Ignore trailing slashes in routes. (e.g.
Infrastructure
- CI/CD setup using Skaffold to Minikube locally
Let's first clone the repo and fire up our system,
git clone git@github.com:aedenj/ktor-starter.git ~/projects/ktor-starter
cd ~/projects/ktor-starter;docker compose up
This will start the app on port 8080. Navigate to http://localhost:8080 to see the app running.
When running the service via docker compose Ktor's auto-reload
functionality is enabled. This means that if you open a separate terminal and run the command ./gradlew -t build -x test -i
when you make changes to the code, the service will automatically reload.
- The jib task may fail initially from an authentication error like following,
Got output:
credentials not found in native keychain
The credential helper (docker-credential-desktop) has nothing for server URL: registry-1.docker.io
Make sure the task is actually failing. Jib tries serveral hosts and you may have credentials setup for one of them. If the task is failing, you can fix this by running the following commands,
-
Run
docker login registry-1.docker.io
and enter your Docker Hub credentials. -
Re-run the JIB task.