Skip to content

r3dpoint/kotlin-ktor-starter

 
 

Repository files navigation

Kotlin ktor starter

An application continuum style example using Kotlin and Ktor that includes a single web application with two background workers.

  • Basic web application
  • Data analyzer
  • Data collector

Technology stack

This codebase is written in a language called Kotlin that is able to run on the JVM with full Java compatibility. It uses the Ktor web framework, and runs on the Netty web server. HTML templates are written using Freemarker. The codebase is tested with JUnit and uses Gradle to build a jarfile. The pack cli is used to build a Docker container which is deployed to Google Cloud on Google's Cloud Platform.

Getting Started

Development

  1. Build a Java Archive (jar) file.

    ./gradlew clean build
  2. Configure the port that each server runs on.

    export PORT=8881

Run the servers locally using the below examples.

Web application

java -jar applications/basic-server/build/libs/basic-server-1.0-SNAPSHOT.jar

Data collector

java -jar applications/data-collector-server/build/libs/data-collector-server-1.0-SNAPSHOT.jar

Data analyzer

java -jar applications/data-analyzer-server/build/libs/data-analyzer-server-1.0-SNAPSHOT.jar

Production

Building a Docker container and running with Docker.

Buildpacks

  1. Install the pack CLI.

    brew install buildpacks/tap/pack
  2. Build using pack.

    pack build kotlin-ktor-starter --builder heroku/buildpacks:20
  3. Run with docker.

    docker run  -e "PORT=8882" -e "APP=applications/basic-server/build/libs/basic-server-1.0-SNAPSHOT.jar" kotlin-ktor-starter

That's a wrap for now.

About

kotlin-ktor-starter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Kotlin 51.9%
  • CSS 40.2%
  • FreeMarker 6.4%
  • Dockerfile 1.1%
  • Procfile 0.4%