Backend Scala Playframework Quickstarter (be-scala-play)
Purpose of this quickstarter
This is a Play Framework 2.8.0 quickstarter with basic setup for Docker, Jenkins, SonarQube and OpenShift.
Use it if you want to build an reactive Web Application / REST API based on the Scala Language.
What files / architecture is generated?
An example Play Web Application is generated with a Controller and some tests.
. ├── Jenkinsfile ├── .pre-commit-config.yaml ├── app │ ├── controllers │ │ └── HomeController.scala │ └── views │ ├── index.scala.html │ └── main.scala.html ├── build.sbt ├── conf │ ├── application.conf │ ├── logback.xml │ ├── messages │ └── routes ├── docker │ └── Dockerfile ├── project │ ├── build.properties │ ├── plugins.sbt ├── public │ ├── images │ │ └── favicon.png │ ├── javascripts │ │ └── main.js │ └── stylesheets │ └── main.css ├── sonar-project.properties ├── test │ └── controllers │ └── HomeControllerSpec.scala └── .scalafmt.conf
Frameworks used
This project is generated by SBT using SBTs template generation via the new
command.
The template used is an adapted version of the official Play Scala Seed Template.
It will generate a Play Scala project using version 2.8.2 of Play with Scala version 2.13.10. It uses the logstash-logback-encoder to output logmessages in logstash format. It uses Scalafmt to check/format the source files consistently.
Usage - how do you start after you provisioned this quickstarter
-
Start the SBT shell with
sbt
in the project root directory. -
In the SBT shell run
test
for testing -
Or
run
for running locally in development mode with continous compiling. The application will be accessible under http://localhost:8080
Metadata
The following are typical metadata values that can be used for components based on this quickstarter: Note that the OpenShift resources will be labeled based on this metadata.
name: <the component id (this is the default, if omitted)>
description: "Some microservice implemented in Scala over the Play framework"
supplier: https://example.com
version: 1.0.1
type: ods
role: backend
runtime: play
runtimeVersion: 2.8.2
How this quickstarter is built through jenkins
The Jenkinsfile is provisioned with this quickstarter to ease CI/CD process. In Jenkinsfile, there are various stages
-
stageBuild - checks source files formatting, runs the tests and builds and copies the artifacts for creating the docker image to the
docker
directory.
include::partials$secret-scanning-with-gitleaks.adoc
Builder agent used
This quickstarter uses the Scala Jenkins agent.