Why the name highgarden? Why not.
Highgarden is an example all-in-one webservice. It mounts up a REST-like service for maintaining a list of cars.
case class Car(id: Long, licenseNumber: String, color: String, name: Option[String])| Http | Body | Description | Returns |
|---|---|---|---|
| GET localhost:8080/cars | None | Lists all cars in database | List of cars |
| GET localhost:8080/cars/$id | None | Get car with id $id | The requested car or 404 |
| POST localhost:8080/cars | Car | Insert car with id | The inserted car |
| PATCH localhost:8080/cars/$id | Car | Update car $id | The updated car or 404 |
| PUT localhost:8080/cars/$id | Car | Update car $id or insert if not existent | The updated/inserted car |
| PUT localhost:8080/cars | List[Car] | Replace all cars with list | The new list of cars |
| DELETE localhost:8080/cars/$id | None | Delete car | None |
| DELETE localhost:8080/cars | None | Delete all cars | None |
Highgarden is built upon:
| Library | Description |
|---|---|
| Scala | Scala programming language |
| Sbt | Buildtool for scala |
| Sbt-assembly | Create fatjars from sbt, used in docker images |
| Sbt-docker | Create docker images from sbt |
| Scalafmt | Codeformatter for Scala |
| Cats | Functional library and effect monad |
| Doobie | Functional JDBC for database access |
| Circe | JSON parsing and encoding |
| Http4s | HTTP services, server and client |
| embedded-postgres | Embedded database for testing |
| Flyway | Database migrations |
Docker image available at Dockerhub
sbt run
Access the server with curl localhost:8080/cars
Make sure to have docker installed
- create docker image with
sbt docker docker run -d -i -p 8080:8080 <imageId>- run
sbt dockerPushto push image to dockerhub
Run docker ps to see the running image
Access the server with curl localhost:8080/cars
- Install kubernetes comandline client, kubectl
- Set up client and connect to your cluster
kubectl create -f deployment.yaml
Since deployment is based on latest-tag you can get the newest version by deleting the old pods.