- Akka HTTP: https://doc.akka.io/docs/akka-http/current/introduction.html
- Template for generate this project: https://github.com/CodelyTV/scala-basic-skeleton.g8
- Scaladex: https://index.scala-lang.org/search?q=dependencies%3Aakka%2Fakka-http*
- HOCON (for configuration files in 'conf' folder): https://github.com/lightbend/config/blob/master/HOCON.md
- Scopt: https://github.com/scopt/scopt
- Doobie: https://github.com/tpolecat/doobie
- Try RabbitMQ: http://tryrabbitmq.com/
- SLF4J: http://www.slf4j.org/
- Logging with Logback in Scala: https://www.slideshare.net/knoldus/logging-with-logback-in-scala
- Logback configuration: https://logback.qos.ch/manual/configuration.html
- JSON logging for Spring applications: https://sadique.io/blog/2016/06/30/json-logging-for-spring-applications/
- Logback Logstash/JSON encoder: https://github.com/logstash/logstash-logback-encoder
sbt new codelytv/scala-basic-skeleton.g8
(Template URL: https://github.com/CodelyTV/scala-basic-skeleton.g8)- Project name: Scala Http Api
- After open the project in Intellij, open a 'sbt shell' and run 't' command for run the tests
sbt
t
prep
run
reload
exit
curl localhost:8080/status
- Copy the Docker environment variables config file and tune it with your desired values:
cp docker/.env.dist docker/.env
- Start Docker and bring up the project needed containers:
cd docker/; docker-compose up -d
- Create the database tables in your Docker MySQL container:
sbt createDbTables
testOnly *DoobieMySqlUserRepositoryShould
We use SBT Native Packager in order to package the app in single Jar file that you can execute.
- Create the universal package:
sbt universal:packageBin
. - Extract the generated zip:
unzip target/universal/codelytv-scala-http-api-1.0.zip -d ~/var/www/
which will contain:bin/
: All the executable binaries of our main classes in Unix and Windows (bat) formatlib/
: All the project dependencies jar files.
- Run the main app binary:
- Without specifying any parameters (OK for this example app):
~/var/www/codelytv-scala-http-api-1.0/bin/scala-http-api
- Specifying parameters for the JVM:
~/var/www/codelytv-scala-http-api-1.0/bin/scala-http-api -Dconfig.resource=application/$CONFIG_PATH
- Specifying application parameters:
~/var/www/codelytv-scala-http-api-1.0/bin/scala-http-api -Dconfig.resource=application/$CONFIG_PATH -- -appParam
- Without specifying any parameters (OK for this example app):