Basic Scala Api Application
Starting Locally
Docker Compose
Prerequisites
- Docker for Mac (
brew cask install docker
) - (Docker compose should be installed already)[https://docs.docker.com/compose/install/#prerequisites]
Start
Can start by using docker compose, but the issue here is that the schema might not be applied. This is due to the limitations of docker compose not waiting for the db to be up applying flyway.
docker-compose up
Alternatively use (SBT Docker Compose Plugin)[https://github.com/Tapad/sbt-docker-compose]
sbt dockerComposeUp
Stop
docker-compose down --volumes
sbt dockerComposeStop
Starting Manually
Prerequisites
- Postgres 9.4+
- Follow flyway instructions to install schema
sbt run
Tests
sbt test dockerComposeTest
If the integration tests are broken and you want to debug see here
Generate Swagger Json
- TODO: Create SBT Plugin
brew install swagger-codegen
swagger-codegen generate -i swagger/api.yaml -l swagger -o public/
Some Useful Docker Commands
Clear out old docker images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
docker system prune
docker images prune
Clear out the exited containers
docker rm -v $(docker ps -a -q -f status=exited)
List docker images
docker images -a
List docker containers
docker ps -a
Docker Volume
docker volume ls
docker volume prune
Docker network
docker network ls
docker inspect <NETWORK_HASH>
Test Coverage
Investigate if IT tests are covered as part of it.
https://github.com/scoverage/sbt-scoverage
sbt coverage test dockerComposeTest coverageReport
TODO - Upgrades
- Play 2.6
- Akka 2.5
- SBT 1.X
- Scala 2.12
- codahale 4.X