From e2d86599dbc83510448bc1281ae5190cd000eac4 Mon Sep 17 00:00:00 2001 From: Denis Novac Date: Sat, 28 Sep 2024 11:06:34 +0400 Subject: [PATCH] IHP-32 Update dependencies (#33) --- .../kafka/KafkaJsonDeserializer.scala | 2 +- docker-compose.yml | 25 +++++------- project/Dependencies.scala | 38 ++++++------------- .../recognizer/ObjectDetection.scala | 15 +------- 4 files changed, 24 insertions(+), 56 deletions(-) diff --git a/common/src/main/scala/com/github/baklanovsoft/imagehosting/kafka/KafkaJsonDeserializer.scala b/common/src/main/scala/com/github/baklanovsoft/imagehosting/kafka/KafkaJsonDeserializer.scala index edd4fd1..a931fdb 100644 --- a/common/src/main/scala/com/github/baklanovsoft/imagehosting/kafka/KafkaJsonDeserializer.scala +++ b/common/src/main/scala/com/github/baklanovsoft/imagehosting/kafka/KafkaJsonDeserializer.scala @@ -19,7 +19,7 @@ trait KafkaJsonDeserializer { decodeByteArray[T](bytes) match { case Left(value) => KafkaJsonDecodingError( - s"Can't decode json kafka message: ${value.getMessage}. Original message: $bytes" + s"Can't decode json kafka message: ${value.getMessage}. Original message: ${new String(bytes)}" ) .raiseError[F, T] case Right(value) => value.pure[F] diff --git a/docker-compose.yml b/docker-compose.yml index 21df733..5aa8312 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,7 +82,7 @@ services: kafka: container_name: kafka - image: bitnami/kafka:3.6.1 + image: bitnami/kafka:3.8 ports: - "9094:9094" environment: @@ -99,7 +99,7 @@ services: minio: container_name: minio - image: quay.io/minio/minio:RELEASE.2024-01-31T20-20-33Z + image: quay.io/minio/minio:RELEASE.2024-09-13T20-26-02Z command: server --console-address ":9001" /data ports: - "9000:9000" @@ -112,7 +112,7 @@ services: postgres: container_name: postgres - image: postgres:16-alpine3.18 + image: postgres:16.4-alpine3.20 volumes: - db-data:/var/lib/postgresql/data environment: @@ -128,23 +128,18 @@ services: retries: 3 command: [ "postgres", "-c", "log_statement=all" ] - image-hosting-storage: - container_name: image-hosting-storage - image: ghcr.io/baklanov-soft/image-hosting-storage + image-hosting-webapi: + container_name: image-hosting-webapi + image: image-hosting-storage-webapi environment: - Logging__LogLevel__Default: Information - Logging__LogLevel__Microsoft.AspNetCore: Warning - Logging__LogLevel__Microsoft.EntityFrameworkCore: Warning Minio__Endpoint: minio:9000 Minio__AccessKey: minioadmin Minio__SecretKey: minioadmin Minio__Secure: false ConnectionStrings__ImageHosting: "Host=postgres;Port=5432;Database=image_hosting;Username=image_hosting;Password=P@ssw0rd;Include Error Detail=true" ASPNETCORE_ENVIRONMENT: Development - Kafka__Producer__BootstrapServers: kafka:9092 - Kafka__Producer__ClientId: image-hosting-storage - Kafka__Producer__CompressionType: gzip - Kafka__NewImageTopic: new-images.v1 + Kafka__BootstrapServers__0: kafka:9092 + Kafka__NewImagesProducer__TopicName: new-images.v1 ports: - "8080:8080" depends_on: @@ -155,7 +150,7 @@ services: kafka-init-new-images: container_name: kafka-init-new-images - image: bitnami/kafka:3.6.1 + image: bitnami/kafka:3.8 depends_on: - kafka entrypoint: "kafka-topics.sh" @@ -169,7 +164,7 @@ services: kafka-init-categories: container_name: kafka-init-categories - image: bitnami/kafka:3.6.1 + image: bitnami/kafka:3.8 depends_on: - kafka entrypoint: "kafka-topics.sh" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 5a32f64..42e85d0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -3,35 +3,31 @@ import sbt.* object Dependencies { private object Versions { - val apispec = "0.7.4" + val cats = "2.12.0" + val catsEffect = "3.5.4" + val circe = "0.14.10" - val cats = "2.10.0" - val catsEffect = "3.5.3" - val circe = "0.14.6" + val djl = "0.30.0" - val djl = "0.26.0" + val enumeratum = "1.7.4" - val enumeratum = "1.7.3" + val fs2 = "3.11.0" + val fs2Kafka = "3.5.1" - val fs2 = "3.9.4" - val fs2Kafka = "3.3.1" + val logback = "1.5.8" + val log4cats = "2.7.0" - val logback = "1.4.14" - val log4cats = "2.6.0" - - val minioClient = "8.5.7" + val minioClient = "8.5.12" val newtype = "0.4.4" - val pureconfig = "0.17.5" + val pureconfig = "0.17.7" val imgscalr = "4.2" /* testing */ - val scalatest = "3.2.17" - val weaver = "0.8.4" - + val scalatest = "3.2.19" } val plugins = Seq( @@ -39,8 +35,6 @@ object Dependencies { "com.olegpy" %% "better-monadic-for" % "0.3.1" ).map(compilerPlugin) - val apispec = "com.softwaremill.sttp.apispec" %% "openapi-circe-yaml" % Versions.apispec - val cats = "org.typelevel" %% "cats-core" % Versions.cats val catsEffect = "org.typelevel" %% "cats-effect" % Versions.catsEffect @@ -53,9 +47,6 @@ object Dependencies { val djl = Seq( "ai.djl" % "api" % Versions.djl, - // mxnet is used in object detection for embedded vgg16 - "ai.djl.mxnet" % "mxnet-model-zoo" % Versions.djl, - "ai.djl.mxnet" % "mxnet-engine" % Versions.djl, // pytorch for nsfw detection "ai.djl.pytorch" % "pytorch-engine" % Versions.djl, "ai.djl.pytorch" % "pytorch-model-zoo" % Versions.djl @@ -91,11 +82,6 @@ object Dependencies { object Testing { val scalatest = "org.scalatest" %% "scalatest" % Versions.scalatest % Test - - val weaver = Seq( - "com.disneystreaming" %% "weaver-core" % Versions.weaver % Test, - "com.disneystreaming" %% "weaver-cats" % Versions.weaver % Test - ) } } diff --git a/recognizer/src/main/scala/com/github/baklanovsoft/imagehosting/recognizer/ObjectDetection.scala b/recognizer/src/main/scala/com/github/baklanovsoft/imagehosting/recognizer/ObjectDetection.scala index d35d8ce..f7817d0 100644 --- a/recognizer/src/main/scala/com/github/baklanovsoft/imagehosting/recognizer/ObjectDetection.scala +++ b/recognizer/src/main/scala/com/github/baklanovsoft/imagehosting/recognizer/ObjectDetection.scala @@ -24,21 +24,8 @@ trait ObjectDetection[F[_]] { object ObjectDetection { private object Engines { - - // mx net has a lot of included models so it's better to use in detection - object MxNet { - val name = "MXNet" - - object Models { - val darknet53 = "darknet53" - val mobileNet = "mobilenet1.0" - val resnet50 = "resnet50" - val vgg16 = "vgg16" - } - } - object PyTorch { - val name = "MXNet" + val name = "PyTorch" object Models { val resnet50 = "resnet50"