-
Notifications
You must be signed in to change notification settings - Fork 8
Basic service scaffolding using Scala Play framework #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
205ebe9
f6712aa
9266246
e0573b4
8bd1a21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,8 @@ import sbt.Tests.{Group, SubProcess} | |
| // java incompatibility is probably not an issue, hopefully we can cross build flink 1.17 & 1.18 without code changes | ||
|
|
||
| lazy val scala_2_12 = "2.12.18" | ||
| lazy val scala_2_13 = "2.13.14" | ||
|
|
||
| // spark deps: https://mvnrepository.com/artifact/org.apache.spark/spark-core_2.12/3.5.0 | ||
| // avro 1.11.2, jackson: 2.15.2 | ||
| lazy val spark_3_5 = "3.5.1" | ||
|
|
@@ -48,7 +50,7 @@ inThisBuild( | |
| lazy val supportedVersions = List(scala_2_12) // List(scala211, scala212, scala213) | ||
|
|
||
| lazy val root = (project in file(".")) | ||
| .aggregate(api, aggregator, online, spark, flink, cloud_gcp) | ||
| .aggregate(api, aggregator, online, spark, flink, cloud_gcp, webservice) | ||
|
||
| .settings(name := "chronon") | ||
|
|
||
| val spark_sql = Seq( | ||
|
|
@@ -177,6 +179,18 @@ lazy val cloud_gcp = project | |
| libraryDependencies ++= spark_all | ||
| ) | ||
|
|
||
| lazy val webservice = (project in file("webservice")) | ||
| .enablePlugins(PlayScala) | ||
| .settings( | ||
| name := "webservice", | ||
| // play dropped support for Scala 2.12 in release 2.9 | ||
| scalaVersion := scala_2_13, | ||
| libraryDependencies ++= Seq( | ||
| guice, | ||
| "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test | ||
| ) | ||
| ) | ||
|
|
||
| ThisBuild / assemblyMergeStrategy := { | ||
| case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard | ||
| case PathList("META-INF", _*) => MergeStrategy.filterDistinctLines | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package controllers | ||
|
|
||
| import play.api.mvc._ | ||
|
|
||
| import javax.inject._ | ||
|
|
||
| @Singleton | ||
| class FrontendController @Inject() (val controllerComponents: ControllerComponents) extends BaseController { | ||
| def home(): Action[AnyContent] = | ||
| Action { implicit request: Request[AnyContent] => | ||
| Ok(views.html.index("Welcome to the Zipline homepage!")) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @(message: String) | ||
|
|
||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Chronon Home</title> | ||
| <link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")"> | ||
| </head> | ||
| <body> | ||
| <h1>@message</h1> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # This is the main configuration file for the application. | ||
| # https://www.playframework.com/documentation/latest/ConfigFile | ||
|
|
||
| play.http.secret.key = ${?PLAY_HTTP_SECRET_KEY} | ||
| play.i18n.langs = ["en"] | ||
|
|
||
| # Database configuration | ||
| # ~~~~~ | ||
| # You can declare as many datasources as you want. | ||
| # By convention, the default datasource is named `default` | ||
| # | ||
| # db.default.driver=org.h2.Driver | ||
| # db.default.url="jdbc:h2:mem:play" | ||
|
|
||
| # Evolutions | ||
| # ~~~~~ | ||
| # You can disable evolutions if needed | ||
| # play.evolutions.enabled=false | ||
|
|
||
| # You can disable evolutions for a specific datasource if necessary | ||
| # play.evolutions.db.default.enabled=false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| GET / controllers.FrontendController.home() | ||
|
|
||
| # Map static resources from the /public folder to the /assets URL path | ||
| GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the simplicity of one scala version. But if it is not possible to be 2.12 with play, this is workable for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah 2.12 is not possible with play unless we go with a much older release. 2.9.x that is on the akka fork of the project. I think it might be better to use play 3.x and hence scala 2.13 here.