diff --git a/build.sbt b/build.sbt index 7dcc26b..27f0fba 100644 --- a/build.sbt +++ b/build.sbt @@ -9,7 +9,7 @@ val testcontainersVersion = "0.41.0" Global / onChangedBuildSource := ReloadOnSourceChanges ThisBuild / licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) -ThisBuild / scalaVersion := "3.3.1" +ThisBuild / scalaVersion := "3.3.3" // ThisBuild / version := "0.0.1" ThisBuild / organization := "org.mbari" ThisBuild / organizationName := "Monterey Bay Aquarium Research Institute" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 73f9a7d..8f66b8a 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -22,14 +22,14 @@ object Dependencies { lazy val jansi = "org.fusesource.jansi" % "jansi" % "2.4.0" lazy val javaJwt = "com.auth0" % "java-jwt" % "4.4.0" - val logbackVersion = "1.5.0" + val logbackVersion = "1.5.3" lazy val logbackClassic = "ch.qos.logback" % "logback-classic" % logbackVersion lazy val logbackCore = "ch.qos.logback" % "logback-core" % logbackVersion lazy val mssqlJdbc = "com.microsoft.sqlserver" % "mssql-jdbc" % "12.6.1.jre11" lazy val munit = "org.scalameta" %% "munit" % "1.0.0-M11" lazy val oracleJdbc = "com.oracle.ojdbc" % "ojdbc8" % "19.3.0.0" - lazy val postgresql = "org.postgresql" % "postgresql" % "42.7.2" + lazy val postgresql = "org.postgresql" % "postgresql" % "42.7.3" lazy val scalatest = "org.scalatest" %% "scalatest" % "3.2.18" val slf4jVersion = "2.0.12" @@ -37,15 +37,15 @@ object Dependencies { lazy val slf4jLog4j = "org.slf4j" % "log4j-over-slf4j" % slf4jVersion lazy val slf4jSystem = "org.slf4j" % "slf4j-jdk-platform-logging" % slf4jVersion - private val tapirVersion = "1.9.10" - lazy val tapirSttpCirce = "com.softwaremill.sttp.client3" %% "circe" % "3.9.3" + private val tapirVersion = "1.10.0" + lazy val tapirSttpCirce = "com.softwaremill.sttp.client3" %% "circe" % "3.9.5" lazy val tapirCirce = "com.softwaremill.sttp.tapir" %% "tapir-json-circe" % tapirVersion lazy val tapirPrometheus = "com.softwaremill.sttp.tapir" %% "tapir-prometheus-metrics" % tapirVersion lazy val tapirServerStub = "com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % tapirVersion lazy val tapirSwagger = "com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-bundle" % tapirVersion lazy val tapirVertex = "com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % tapirVersion - val testcontainersVersion = "1.19.6" + val testcontainersVersion = "1.19.7" lazy val testcontainersCore = "org.testcontainers" % "testcontainers" % testcontainersVersion lazy val testcontainersSqlserver = "org.testcontainers" % "mssqlserver" % testcontainersVersion lazy val testcontainersOracle = "org.testcontainers" % "oracle-xe" % testcontainersVersion diff --git a/vampire-squid/src/main/resources/META-INF/persistence.xml b/vampire-squid/src/main/resources/META-INF/persistence.xml index a081101..b99b679 100644 --- a/vampire-squid/src/main/resources/META-INF/persistence.xml +++ b/vampire-squid/src/main/resources/META-INF/persistence.xml @@ -18,8 +18,8 @@ org.mbari.vampiresquid.repository.jpa.entity.VideoReferenceEntity - - + diff --git a/vampire-squid/src/main/scala/org/mbari/vampiresquid/AppConfig.scala b/vampire-squid/src/main/scala/org/mbari/vampiresquid/AppConfig.scala index 6e82a5d..eed624c 100644 --- a/vampire-squid/src/main/scala/org/mbari/vampiresquid/AppConfig.scala +++ b/vampire-squid/src/main/scala/org/mbari/vampiresquid/AppConfig.scala @@ -29,6 +29,8 @@ object AppConfig: val Description: String = "Video Asset Manager" + val NumberOfVertxWorkers: Int = 20 + private lazy val Config = ConfigFactory.load() lazy val JwtParameters: JwtParams = diff --git a/vampire-squid/src/main/scala/org/mbari/vampiresquid/Main.scala b/vampire-squid/src/main/scala/org/mbari/vampiresquid/Main.scala index debe17f..dc7cc6b 100644 --- a/vampire-squid/src/main/scala/org/mbari/vampiresquid/Main.scala +++ b/vampire-squid/src/main/scala/org/mbari/vampiresquid/Main.scala @@ -29,6 +29,7 @@ import sttp.tapir.server.interceptor.log.ServerLog import org.mbari.vampiresquid.etc.jdk.Logging import org.mbari.vampiresquid.etc.jdk.Logging.{*, given} import sttp.tapir.server.interceptor.log.DefaultServerLog +import io.vertx.core.VertxOptions @main def run(): Unit = @@ -54,7 +55,8 @@ def run(): Unit = val port = sys.env.get("HTTP_PORT").flatMap(_.toIntOption).getOrElse(8080) - val vertx = Vertx.vertx() + val vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(AppConfig.NumberOfVertxWorkers)) + // val vertx = Vertx.vertx() val server = vertx.createHttpServer() val router = Router.router(vertx) @@ -100,7 +102,7 @@ def run(): Unit = router .getRoutes() - .forEach(r => log.atDebug.log(f"Adding route: ${r.methods()}%8s ${r.getPath}%s")) + .forEach(r => log.atInfo.log(f"Adding route: ${r.methods()}%8s ${r.getPath}%s")) // val program = for // binding <- server.requestHandler(router).listen(port).asScala diff --git a/vampire-squid/src/main/scala/org/mbari/vampiresquid/repository/jpa/EntityManagerFactories.scala b/vampire-squid/src/main/scala/org/mbari/vampiresquid/repository/jpa/EntityManagerFactories.scala index 73c41d4..192b3de 100644 --- a/vampire-squid/src/main/scala/org/mbari/vampiresquid/repository/jpa/EntityManagerFactories.scala +++ b/vampire-squid/src/main/scala/org/mbari/vampiresquid/repository/jpa/EntityManagerFactories.scala @@ -22,6 +22,7 @@ import com.typesafe.config.ConfigFactory import java.lang.System.Logger.Level import scala.jdk.CollectionConverters.* import org.mbari.vampiresquid.etc.jdk.Logging.{given, *} +import org.mbari.vampiresquid.AppConfig /** * https://stackoverflow.com/questions/4106078/dynamic-jpa-connection @@ -43,7 +44,7 @@ object EntityManagerFactories: "hibernate.connection.provider_class" -> "org.hibernate.hikaricp.internal.HikariCPConnectionProvider", "hibernate.hbm2ddl.auto" -> "validate", "hibernate.hikari.idleTimeout" -> "30000", - "hibernate.hikari.maximumPoolSize" -> "16", + "hibernate.hikari.maximumPoolSize" -> s"${AppConfig.NumberOfVertxWorkers}", "hibernate.hikari.minimumIdle" -> "2" )