Skip to content

Commit

Permalink
Upgrade collector to 3.1.x and enrich to 4.0.x
Browse files Browse the repository at this point in the history
New collector and enrich versions mean:

* Cats Effect 3
* Http4s as web server, so no more Akka HTTP
* Using IO monad instead of Id

To be consistent with other Snowplow applications, this commit also brings small improvements to configuration loading.
Just like collector configuration, iglu resolver and all enrichments support HOCON configuration format.

As collector 3.1.x is on scala 2.13 and enrich 4.0.x on scala 2.12, it was easier to cross compile collector to 2.12 than upgrade enrich to 2.13. That's why micro uses collector from this branch -> https://github.com/snowplow/stream-collector/tree/3.1.0_cross_scala_2.12 and is based on scala 2.12.
  • Loading branch information
pondzix committed Feb 16, 2024
1 parent 2b4150d commit dfbec5b
Show file tree
Hide file tree
Showing 22 changed files with 1,084 additions and 1,012 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:

- name: Publish collector locally
run: |
git clone --branch 2.8.1 --depth 1 https://github.com/snowplow/stream-collector.git
git clone --branch 3.1.0_cross_scala_2.12 --depth 1 https://github.com/snowplow/stream-collector.git
cd stream-collector
sbt publishLocal
sbt +publishLocal
- name: Run sbt
run: sbt test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:

- name: Publish collector locally
run: |
git clone --branch 2.8.1 --depth 1 https://github.com/snowplow/stream-collector.git
git clone --branch 3.1.0_cross_scala_2.12 --depth 1 https://github.com/snowplow/stream-collector.git
cd stream-collector
sbt publishLocal
sbt +publishLocal
- name: Run sbt
run: sbt test
21 changes: 12 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* Copyright (c) 2019-2022 Snowplow Analytics Ltd. All rights reserved.
*/
import com.typesafe.sbt.packager.MappingsHelper.directory
import com.typesafe.sbt.packager.docker._
import com.typesafe.sbt.packager.docker.*

import scala.collection.Seq

lazy val buildSettings = Seq(
name := "snowplow-micro",
Expand All @@ -20,37 +22,38 @@ lazy val buildSettings = Seq(
baseDirectory.value / "ui" / "out"
),
Compile / unmanagedResources += file("LICENSE.md"),
resolvers ++= Dependencies.resolvers
resolvers ++= Dependencies.resolvers,
Test / parallelExecution := false
)

lazy val dependencies = Seq(
libraryDependencies ++= Seq(
Dependencies.snowplowStreamCollector,
Dependencies.snowplowCommonEnrich,
Dependencies.decline,
Dependencies.http4sCirce,
Dependencies.circeJawn,
Dependencies.circeGeneric,
Dependencies.specs2,
Dependencies.specs2CE,
Dependencies.badRows
)
)

lazy val exclusions = Seq(
excludeDependencies ++= Dependencies.exclusions
)

lazy val buildInfoSettings = Seq(
buildInfoKeys := Seq[BuildInfoKey](organization, name, version, scalaVersion),
buildInfoPackage := "buildinfo"
buildInfoKeys := Seq[BuildInfoKey](name, moduleName, dockerAlias, version, "shortName" -> "micro-ssc"),
buildInfoPackage := "com.snowplowanalytics.snowplow.micro",
buildInfoOptions += BuildInfoOption.Traits("com.snowplowanalytics.snowplow.collector.core.AppInfo")
)


lazy val dynVerSettings = Seq(
ThisBuild / dynverVTagPrefix := false, // Otherwise git tags required to have v-prefix
ThisBuild / dynverSeparator := "-" // to be compatible with docker
)

lazy val commonSettings =
dependencies ++
exclusions ++
buildSettings ++
buildInfoSettings ++
dynVerSettings ++
Expand Down
23 changes: 13 additions & 10 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,36 @@ object Dependencies {

object V {
// Snowplow
val snowplowStreamCollector = "2.8.1"
val snowplowCommonEnrich = "3.8.0"
val snowplowStreamCollector = "3.1.1-rc1"
val snowplowCommonEnrich = "4.0.1"
val http4sCirce = "0.23.23"

val decline = "2.4.1"

// circe
val circe = "0.14.2"

// specs2
val specs2 = "4.12.2"
val specs2CE = "1.5.0"

// force versions of transitive dependencies
val badRows = "2.2.0"
}

val exclusions = Seq(
"org.apache.tomcat.embed" % "tomcat-embed-core"
)

// Snowplow stream collector
val snowplowStreamCollector = "com.snowplowanalytics" %% "snowplow-stream-collector-core" % V.snowplowStreamCollector
val snowplowCommonEnrich = "com.snowplowanalytics" %% "snowplow-common-enrich" % V.snowplowCommonEnrich
val snowplowStreamCollector = "com.snowplowanalytics" %% "snowplow-stream-collector-http4s-core" % V.snowplowStreamCollector
val snowplowCommonEnrich = "com.snowplowanalytics" %% "snowplow-common-enrich" % V.snowplowCommonEnrich

val http4sCirce = "org.http4s" %% "http4s-circe" % V.http4sCirce
val decline = "com.monovore" %% "decline-effect" % V.decline

// circe
val circeJawn = "io.circe" %% "circe-jawn" % V.circe
val circeGeneric = "io.circe" %% "circe-generic" % V.circe

// specs2
val specs2 = "org.specs2" %% "specs2-core" % V.specs2 % Test
val specs2 = "org.specs2" %% "specs2-core" % V.specs2 % Test
val specs2CE = "org.typelevel" %% "cats-effect-testing-specs2" % V.specs2CE % Test

// transitive
val badRows = "com.snowplowanalytics" %% "snowplow-badrows" % V.badRows
Expand Down
249 changes: 0 additions & 249 deletions src/main/resources/application.conf

This file was deleted.

18 changes: 18 additions & 0 deletions src/main/resources/collector-micro.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
collector {
interface = "0.0.0.0"
port = 9090
ssl {
port = 9543
}

streams {
good = "good"
bad = "bad"
buffer {
byteLimit = 3145728
recordLimit = 500
timeLimit = 5000
}
sink {}
}
}
Loading

0 comments on commit dfbec5b

Please sign in to comment.