Skip to content

geirolz/fp-microservice

 
 

Repository files navigation

Purely Functional HTTP microservice

Build Status Scala Steward Mergify Status Codacy Badge

Simple POC for dockerized HTTP microservice using Scala in a functional programming way.

  1. Prerequisites
  2. Stack
  3. Usage
  4. Customize
  5. Roadmap

Prerequisites

  • JDK 17 (jenv can help)
  • SBT
  • Docker
  • Minikube
  • Terraform

Stack

Application stack

SCOPE TECH
✅ Effects cats-effect
✅ Logging log4cats
✅ Jdbc (plain, transactions, etc..) doobie
✅ Db migration fly4s
✅ Http client and server http4s
✅ Http route definitions tapir
✅ Config pureconfig
✅ Json circe
✅ Refinement types refined
⬜ Unit tests munit
⬜ IT tests testcontainers

Infrastructure stack

SCOPE TECH
⬜ Project as template g8
✅ Containerized app Docker via DockerSbt
⬜ Containers orchestrator K8s
⬜ Service mesh Istio

Local Usage

First of all you have to publish the docker image of the app into your local repository with

./deployLocalDockerImage.sh

Then you can choose to either run the app with docker-compose or minikube.

Docker

Run the deploy script to run the app and the database with docker-compose

.infra/local/docker-compose/deploy.sh

⚠️ You should use http and not https beware that Chrome by default use https

Minikube

Run the deploy script to run the app and the database with minikube. Services are not port forwarded by default.

.infra/local/minikube/deploy.sh

Customize

To customize this project please read the guide