Skip to content

Commit

Permalink
STAC4S and all other dependencies update (#334)
Browse files Browse the repository at this point in the history
* Update and cleanup dependencies
* Depend on the STAC4s Client
  • Loading branch information
pomadchin authored Mar 3, 2021
1 parent 702ac49 commit 8ba07b3
Show file tree
Hide file tree
Showing 21 changed files with 207 additions and 370 deletions.
74 changes: 57 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,65 @@
# Scala #
# Operating System Files

project/boot
project/plugins/project
project/plugins/target
project/target
*.DS_Store
Thumbs.db

# Build Files

bin
target
.ensime*
ensime-langserver.log
pc.stdout.log
\#*#
*~
build/
.gradle
cmake-build-debug

# Eclipse Project Files

.classpath
.project
.settings

# IntelliJ IDEA Files

*.iml
*.ipr
*.iws
*.idea

# Sublime files

*.sublime-workspace

# VSCode files

.vscode
.history

# Metals

.metals
.bloop
metals.sbt

# SBT

.bsp

# Other

.#*
.lib
*.aux.xml
*.jar
*.crc
.idea

_SUCCESS

*.pyc
.cache
.settings
*.swp
*.swo

nohup.out
derby.log
metastore_db/
*.log
.DS_Store
.bloop
.metals
metals.sbt
.history
.bsp
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- WCS services support configuration of `supported-projections` [#314](https://github.com/geotrellis/geotrellis-server/pull/314)
- Add WCS 1.1.0 as the supported version [#330](https://github.com/geotrellis/geotrellis-server/pull/330)

### Changed
- Update GT Server STAC4S dependency [#319](https://github.com/geotrellis/geotrellis-server/issues/319)

## [4.3.0] - 2021-02-12

## Added
Expand Down
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ lazy val example = project
concHashMap,
pureConfig,
pureConfigCatsEffect,
sttp,
sttpCats,
sttpCirce,
scalatest,
jaxbApi,
log4cats
Expand Down Expand Up @@ -330,7 +327,6 @@ lazy val `stac-example` = project
.settings(moduleName := "geotrellis-stac-example")
.settings(commonSettings)
.settings(publishSettings)
.settings(crossScalaVersions := Seq(scalaVer))
.settings(
libraryDependencies ++= Seq(
geotrellisGdal,
Expand All @@ -345,7 +341,11 @@ lazy val `stac-example` = project
scaffeine,
scalatest,
decline,
stac4s,
stac4sCore,
stac4sClient,
sttpHttp4s,
refinedCats,
refinedPureconfig,
ansiColors212
),
excludeDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ class PersistenceService[F[_]: Sync: Logger: ApplicativeError[*[_], Throwable],
(for {
expr <- req.as[Expression]
_ <- logger.info(
s"Attempting to store expression (${req.bodyAsText}) at key ($key)"
s"Attempting to store expression (${req.bodyText}) at key ($key)"
)
res <- MamlStore[F, S].putMaml(store, key, expr)
} yield res).attempt flatMap {
case Right(created) =>
Created()
case Left(InvalidMessageBodyFailure(_, _)) | Left(MalformedMessageBodyFailure(_, _)) =>
req.bodyAsText.compile.toList flatMap { reqBody =>
req.bodyText.compile.toList flatMap { reqBody =>
BadRequest(s"""Unable to parse ${reqBody
.mkString("")} as a MAML expression""")
}
Expand Down
81 changes: 40 additions & 41 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@ object Dependencies {
def catsVersion(module: String) =
Def.setting {
module match {
case "core" => "org.typelevel" %% s"cats-$module" % "2.1.1"
case "effect" => "org.typelevel" %% s"cats-$module" % "2.1.3"
case "core" => "org.typelevel" %% s"cats-$module" % "2.4.2"
case "effect" => "org.typelevel" %% s"cats-$module" % "2.3.3"
}
}

def circeVersion(module: String) = Def.setting { "io.circe" %% s"circe-$module" % "0.13.0" }
def http4sVer(module: String) = Def.setting { "org.http4s" %% s"http4s-$module" % "0.21.7" }
def http4sVer(module: String) = Def.setting { "org.http4s" %% s"http4s-$module" % "0.21.20" }

val crossScalaVer = List("2.12.12")
val crossScalaVer = List("2.12.13")
val scalaVer = crossScalaVer.head

val dispatchVer = "0.11.3"
val gtVer = "3.5.2"
val jaxbApiVer = "2.3.1"
val refinedVer = "0.9.9"
val refinedVer = "0.9.20"
val shapelessVer = "2.3.3"
val sttpVer = "1.7.2"
val tsecVer = "0.0.1-M11"

val cats = catsVersion("core")
val catsEffect = catsVersion("effect")
Expand All @@ -34,43 +32,44 @@ object Dependencies {
val circeParser = circeVersion("parser")
val circeRefined = circeVersion("refined")
val circeJava8 = circeVersion("java8")
val commonsIO = "commons-io" % "commons-io" % "2.7"
val concHashMap = "com.googlecode.concurrentlinkedhashmap" % "concurrentlinkedhashmap-lru" % "1.4.2"
val decline = "com.monovore" %% "decline" % "1.2.0"
val geotrellisRaster = "org.locationtech.geotrellis" %% "geotrellis-raster" % gtVer
val geotrellisLayer = "org.locationtech.geotrellis" %% "geotrellis-layer" % gtVer
val geotrellisVector = "org.locationtech.geotrellis" %% "geotrellis-vector" % gtVer
val geotrellisS3 = "org.locationtech.geotrellis" %% "geotrellis-s3" % gtVer
val geotrellisStore = "org.locationtech.geotrellis" %% "geotrellis-store" % gtVer
val geotrellisHBase = "org.locationtech.geotrellis" %% "geotrellis-hbase" % gtVer
val geotrellisAccumulo = "org.locationtech.geotrellis" %% "geotrellis-accumulo" % gtVer
val geotrellisCassandra = "org.locationtech.geotrellis" %% "geotrellis-cassandra" % gtVer
val geotrellisGdal = "org.locationtech.geotrellis" %% "geotrellis-gdal" % gtVer
val commonsIO = "commons-io" % "commons-io" % "2.8.0"
val concHashMap = "com.googlecode.concurrentlinkedhashmap" % "concurrentlinkedhashmap-lru" % "1.4.2"
val decline = "com.monovore" %% "decline" % "1.4.0"
val geotrellisRaster = "org.locationtech.geotrellis" %% "geotrellis-raster" % gtVer
val geotrellisLayer = "org.locationtech.geotrellis" %% "geotrellis-layer" % gtVer
val geotrellisVector = "org.locationtech.geotrellis" %% "geotrellis-vector" % gtVer
val geotrellisS3 = "org.locationtech.geotrellis" %% "geotrellis-s3" % gtVer
val geotrellisStore = "org.locationtech.geotrellis" %% "geotrellis-store" % gtVer
val geotrellisHBase = "org.locationtech.geotrellis" %% "geotrellis-hbase" % gtVer
val geotrellisAccumulo = "org.locationtech.geotrellis" %% "geotrellis-accumulo" % gtVer
val geotrellisCassandra = "org.locationtech.geotrellis" %% "geotrellis-cassandra" % gtVer
val geotrellisGdal = "org.locationtech.geotrellis" %% "geotrellis-gdal" % gtVer
val http4sBlazeClient = http4sVer("blaze-client")
val http4sBlazeServer = http4sVer("blaze-server")
val http4sCirce = http4sVer("circe")
val http4sDsl = http4sVer("dsl")
val http4sXml = http4sVer("scala-xml")
val jaxbApi = "javax.xml.bind" % "jaxb-api" % jaxbApiVer
val kindProjector = "org.typelevel" %% "kind-projector" % "0.11.0"
val semanticdbScalac = "org.scalameta" % "semanticdb-scalac" % "4.3.20"
val log4cats = "io.chrisdavenport" %% "log4cats-slf4j" % "1.1.1"
val mamlJvm = "com.azavea.geotrellis" %% "maml-jvm" % "0.6.1"
val pureConfig = "com.github.pureconfig" %% "pureconfig" % "0.13.0"
val pureConfigCatsEffect = "com.github.pureconfig" %% "pureconfig-cats-effect" % "0.13.0"
val scaffeine = "com.github.blemale" %% "scaffeine" % "4.0.1"
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.3.0"
val scalatest = "org.scalatest" %% "scalatest" % "3.2.1" % Test
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.0" % Test
val scalacheckCats = "io.chrisdavenport" %% "cats-scalacheck" % "0.1.1" % Test
val sttp = "com.softwaremill.sttp" %% "core" % sttpVer
val sttpCirce = "com.softwaremill.sttp" %% "circe" % sttpVer
val sttpCats = "com.softwaremill.sttp" %% "async-http-client-backend-cats" % sttpVer
val macrosParadise = "org.scalamacros" % "paradise" % "2.1.1"
val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
val shapeless = "com.chuusai" %% "shapeless" % shapelessVer
val logback = "ch.qos.logback" % "logback-classic" % "1.2.3" % Runtime
val droste = "io.higherkindness" %% "droste-core" % "0.8.0"
val stac4s = "com.azavea.stac4s" %% "core" % "0.0.14"
val ansiColors212 = "org.backuity" %% "ansi-interpolator" % "1.1.0" % Provided
val jaxbApi = "javax.xml.bind" % "jaxb-api" % jaxbApiVer
val kindProjector = "org.typelevel" %% "kind-projector" % "0.11.3"
val semanticdbScalac = "org.scalameta" % "semanticdb-scalac" % "4.4.10"
val log4cats = "io.chrisdavenport" %% "log4cats-slf4j" % "1.1.1"
val mamlJvm = "com.azavea.geotrellis" %% "maml-jvm" % "0.6.1"
val pureConfig = "com.github.pureconfig" %% "pureconfig" % "0.14.1"
val pureConfigCatsEffect = "com.github.pureconfig" %% "pureconfig-cats-effect" % "0.14.1"
val scaffeine = "com.github.blemale" %% "scaffeine" % "4.0.2"
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.3.0"
val scalatest = "org.scalatest" %% "scalatest" % "3.2.5" % Test
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.0" % Test
val scalacheckCats = "io.chrisdavenport" %% "cats-scalacheck" % "0.1.1" % Test
val sttpHttp4s = "com.softwaremill.sttp.client3" %% "http4s-backend" % "3.1.6"
val macrosParadise = "org.scalamacros" % "paradise" % "2.1.1"
val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
val shapeless = "com.chuusai" %% "shapeless" % shapelessVer
val logback = "ch.qos.logback" % "logback-classic" % "1.2.3" % Runtime
val droste = "io.higherkindness" %% "droste-core" % "0.8.0"
val stac4sCore = "com.azavea.stac4s" %% "core" % "0.0.21"
val stac4sClient = "com.azavea.stac4s" %% "client" % "0.0.21"
val refinedCats = "eu.timepit" %% "refined-cats" % refinedVer
val refinedPureconfig = "eu.timepit" %% "refined-pureconfig" % refinedVer
val ansiColors212 = "org.backuity" %% "ansi-interpolator" % "1.1.0" % Provided
}
1 change: 0 additions & 1 deletion project/assembly.sbt

This file was deleted.

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.6
sbt.version=1.4.7
5 changes: 3 additions & 2 deletions stac-example/src/main/scala/geotrellis/server/ogc/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.backuity.ansi.AnsiFormatter.FormattedHelper
import com.google.common.util.concurrent.ThreadFactoryBuilder
import io.chrisdavenport.log4cats.Logger
import io.chrisdavenport.log4cats.slf4j.Slf4jLogger
import sttp.client3.http4s.Http4sBackend

import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
Expand Down Expand Up @@ -115,7 +116,7 @@ object Main
def createServer: Resource[IO, Server[IO]] =
for {
conf <- Conf.loadResourceF[IO](configPath)
http4sClient <- BlazeClientBuilder[IO](executionContext).resource
http4sClient <- Http4sBackend.usingDefaultBlazeClientBuilder[IO](Blocker.liftExecutionContext(executionContext), executionContext)
simpleSources = conf.layers.values.collect { case rsc @ RasterSourceConf(_, _, _, _, _, _, _) => rsc.toLayer }.toList
_ <- Resource.liftF(
logOptState(
Expand Down Expand Up @@ -168,7 +169,7 @@ object Main
wmtsModel,
new URL(publicUrl)
)
server <- BlazeServerBuilder[IO]
server <- BlazeServerBuilder[IO](executionContext)
.withIdleTimeout(Duration.Inf)
.withResponseHeaderTimeout(Duration.Inf)
.enableHttp2(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package geotrellis.server.ogc.conf

import pureconfig._
import pureconfig.generic.auto._
import eu.timepit.refined.pureconfig._
import pureconfig.module.catseffect.syntax._
import cats.effect.{Resource, Sync}
import com.typesafe.config.ConfigFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import geotrellis.server.ogc.wms.WmsParentLayerMeta
import geotrellis.server.ogc.wmts.GeotrellisTileMatrixSet
import geotrellis.server.ogc.stac._
import geotrellis.store.query.{Repository, RepositoryM}
import org.http4s.client.Client
import io.chrisdavenport.log4cats.Logger
import sttp.client3.SttpBackend

/**
* Each service has its own unique configuration requirements (see the below instances)
Expand All @@ -46,7 +46,10 @@ sealed trait OgcServiceConf {
ogc.OgcSourceRepository(rasterLayers ++ mapAlgebraLayers)
}

def layerSources[F[_]: Sync: SemigroupK: Logger](rasterOgcSources: List[RasterOgcSource], client: Client[F]): RepositoryM[F, List, OgcSource] = {
def layerSources[F[_]: Sync: SemigroupK: Logger](
rasterOgcSources: List[RasterOgcSource],
client: SttpBackend[F, Any]
): RepositoryM[F, List, OgcSource] = {
val stacLayers: List[StacSourceConf] = layerDefinitions.collect { case ssc @ StacSourceConf(_, _, _, _, _, _, _, _, _, _, _, _, _, _) => ssc }
val mapAlgebraConfLayers: List[MapAlgebraSourceConf] = layerDefinitions.collect { case masc @ MapAlgebraSourceConf(_, _, _, _, _, _, _) => masc }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import geotrellis.raster.io.geotiff.OverviewStrategy
import geotrellis.raster.resample._
import geotrellis.server.ogc._
import geotrellis.store.GeoTrellisPath
import com.azavea.maml.ast._
import geotrellis.proj4.{CRS, WebMercator}
import com.azavea.maml.ast._
import cats.syntax.option._
import eu.timepit.refined.types.numeric.NonNegInt
import pureconfig.ConfigReader

import scala.util.Try
Expand All @@ -42,7 +43,7 @@ case class StacSourceConf(
title: String,
source: String,
asset: String,
assetLimit: Option[Int],
assetLimit: Option[NonNegInt],
defaultStyle: Option[String],
styles: List[StyleConf],
commonCrs: CRS = WebMercator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import cats.effect.Sync
import cats.syntax.functor._
import cats.syntax.semigroup._
import cats.instances.list._
import org.http4s.client.Client
import io.chrisdavenport.log4cats.Logger
import sttp.client3.SttpBackend

case class MapAlgebraStacOgcRepository[F[_]: Sync](
mapAlgebraSourceConf: MapAlgebraSourceConf,
Expand All @@ -49,7 +49,7 @@ case class MapAlgebraStacOgcRepository[F[_]: Sync](
case class MapAlgebraStacOgcRepositories[F[_]: Sync: Logger](
mapAlgebraConfLayers: List[MapAlgebraSourceConf],
stacLayers: List[StacSourceConf],
client: Client[F]
client: SttpBackend[F, Any]
) extends RepositoryM[F, List, OgcSource] {
def store: F[List[OgcSource]] =
find(query.withNames(mapAlgebraConfLayers.map(_.name).toSet))
Expand Down
Loading

0 comments on commit 8ba07b3

Please sign in to comment.