aedenj / ktor-starter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ktor Starter (In Progress)

License Build ktlint OpenSSF Scorecard

Overview

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

Infrastructure

  • CI/CD setup using Skaffold to Minikube locally

Pre-Requisites

  1. Docker
  2. Terraform - for infrastructure as code.
  3. Gradle - via your preferred development workflow.

Up & Running

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.

Live Reload

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.

Troubleshooting

  • 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,

  1. Run docker login registry-1.docker.io and enter your Docker Hub credentials.

  2. Re-run the JIB task.

About


Languages

Language:Kotlin 78.2%Language:HCL 21.8%