-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Replace io.d11:zhttp lib with dev.zio:zio-http (#504)
- Loading branch information
1 parent
9d587ff
commit be7fe96
Showing
7 changed files
with
124 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
version: "3.8" | ||
|
||
services: | ||
########################## | ||
# Database | ||
########################## | ||
db: | ||
image: postgres:13 | ||
environment: | ||
POSTGRES_MULTIPLE_DATABASES: "castor,pollux,connect,iris,agent,node_db" | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
volumes: | ||
- pg_data_db:/var/lib/postgresql/data | ||
- ./postgres/init-script.sh:/docker-entrypoint-initdb.d/init-script.sh | ||
- ./postgres/max_conns.sql:/docker-entrypoint-initdb.d/max_conns.sql | ||
ports: | ||
- "5433:5432" | ||
|
||
healthcheck: | ||
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "iris"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
volumes: | ||
pg_data_db: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/SystemInfoApp.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.iohk.atala.agent.server | ||
|
||
import zio.* | ||
import zio.http.* | ||
import zio.http.model.* | ||
import zio.metrics.jvm.DefaultJvmMetrics | ||
import io.iohk.atala.agent.server.buildinfo.BuildInfo | ||
import io.iohk.atala.agent.server.health.HealthInfo | ||
import zio.metrics.connectors.MetricsConfig | ||
import zio.metrics.connectors.prometheus | ||
|
||
import io.circe.generic.auto.* | ||
import io.circe.syntax.* | ||
|
||
object SystemInfoApp { | ||
val metricsConfig = ZLayer.succeed(MetricsConfig(5.seconds)) | ||
|
||
lazy val prometheusLayer = (metricsConfig ++ prometheus.publisherLayer) >>> prometheus.prometheusLayer | ||
|
||
def app = Http | ||
.collectZIO[Request] { | ||
case Method.GET -> !! / "metrics" => | ||
ZIO.serviceWithZIO[prometheus.PrometheusPublisher](_.get.map(Response.text)) | ||
case Method.GET -> !! / "health" => | ||
ZIO.succeed(Response.json(HealthInfo(version = BuildInfo.version).asJson.toString)) | ||
} | ||
.provideLayer(SystemInfoApp.metricsConfig ++ prometheus.publisherLayer ++ prometheusLayer) | ||
} |