Skip to content

This is a REST microservice for storing measurements from sensors into a Postgresql table. It is built with Scala and Akka-http.

Notifications You must be signed in to change notification settings

poguez/measurement-store-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Reactive Rest Service

Enviroment variables

  • PSQL_URL - database url by scheme jdbc:postgresql://host:port/database-name
  • PSQL_USER - database user
  • PSQL_PASSWORD - database password
  • AKKA_HTTP_PORT - port tu run Akka HTTP interface

Features:

  • Akka + Slick
  • CRUD operations
  • Entity partial updates
  • CORS support
  • Implemented authentication by token directive
  • Test coverage with ScalaTest
  • Migrations with FlyWay
  • Ready for Docker
  • Testing with inmemory postgres instance that launch automaticly
  • HikaryCP as connection pool

Requirements

Configuration

  • Create database in PostgresSQL
  • Set database settings on application config or set enviroment variables

Changing application config

There are two config files. Application config src/main/resources/application.conf and test config src/test/resources/application.conf.

Run application

To run application, call:

sbt run

If you wanna restart your application without reloading of sbt, use:

sbt re-start

Run in Docker

For launching application in Docker, you must configure database docker instance and run docker image, generated by sbt.

Generating application docker image and publishing on localhost:

sbt docker:publishLocal

Example of running, generated docker image:

docker run --name restapi -e DB_USER=dbuser -e DB_PASSWORD=dbpass -e DB_NAME=dbname -d --link DATABASE_INSTANCE_NAME:database -p 9090:9000 APPLICATION_IMAGE
  • DATABASE_INSTANCE_NAME - name of your Postgresql docker instance
  • APPLICATION_IMAGE - id or name of application docker image

Run tests

To run tests, call:

sbt test

About

This is a REST microservice for storing measurements from sensors into a Postgresql table. It is built with Scala and Akka-http.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages