Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Add health endpoint #99

Merged
merged 7 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os/signal"
"time"

jRPC "github.com/0xPolygon/cdk-data-availability/rpc"
jRPC "github.com/0xPolygon/cdk-rpc/rpc"
dbConf "github.com/0xPolygonHermez/zkevm-node/db"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down Expand Up @@ -161,6 +161,16 @@ func start(cliCtx *cli.Context) error {
Service: rpc.NewInteropEndpoints(log.WithFields("module", "rpc"), executor, storage, c),
},
},
jRPC.WithHealthHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, err := storage.BeginStateTransaction(context.Background())
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}

_, _ = w.Write([]byte("Healthy"))
w.WriteHeader(http.StatusOK)
})),
)

// Run RPC
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"

"github.com/0xPolygon/agglayer/log"
jRPC "github.com/0xPolygon/cdk-data-availability/rpc"
jRPC "github.com/0xPolygon/cdk-rpc/rpc"
"github.com/0xPolygonHermez/zkevm-node/config/types"
"github.com/0xPolygonHermez/zkevm-node/db"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ services:
agglayer-db:
condition: service_healthy
ports:
- '8444:8444'
- '4444:4444'
- '2223:2223'
volumes:
- ./data/agglayer/agglayer.keystore:/pk/agglayer.keystore
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/0xPolygon/agglayer

go 1.21
go 1.21.3

toolchain go1.21.5

require (
cloud.google.com/go/kms v1.15.7
Expand Down Expand Up @@ -28,6 +30,7 @@ require (
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
github.com/0xPolygon/cdk-rpc v0.0.0-20240305171901-8dbb68fe396a // indirect
github.com/0xPolygonHermez/zkevm-data-streamer v0.1.19 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/0xPolygon/cdk-data-availability v0.0.5 h1://vg1oR/5tw2XfEIorpP+wIxLfNUmoKrdmX8YZvBKX4=
github.com/0xPolygon/cdk-data-availability v0.0.5/go.mod h1:aGwqHiJhL+mJbdepl3s58wsY18EuViDa9vZCpPuIYGw=
github.com/0xPolygon/cdk-rpc v0.0.0-20240305170448-2bb628346403 h1:WMeajdOvyaDNoTGiYV32Zx7VTybWm0S5R7Ec52WRXGw=
github.com/0xPolygon/cdk-rpc v0.0.0-20240305170448-2bb628346403/go.mod h1:2scWqMMufrQXu7TikDgQ3BsyaKoX8qP26D6E262vSOg=
github.com/0xPolygon/cdk-rpc v0.0.0-20240305171559-1accc911d05e h1:kwkws7LD6pI9QQYgKXx5VgCZvSzkOMPzmgSAzNOIxOM=
github.com/0xPolygon/cdk-rpc v0.0.0-20240305171559-1accc911d05e/go.mod h1:2scWqMMufrQXu7TikDgQ3BsyaKoX8qP26D6E262vSOg=
github.com/0xPolygon/cdk-rpc v0.0.0-20240305171901-8dbb68fe396a h1:bu2Dh0q7vNkj8I2FhOdxVTp6HL1TmUKjARizKK5ZS6k=
github.com/0xPolygon/cdk-rpc v0.0.0-20240305171901-8dbb68fe396a/go.mod h1:2scWqMMufrQXu7TikDgQ3BsyaKoX8qP26D6E262vSOg=
github.com/0xPolygonHermez/zkevm-data-streamer v0.1.19 h1:wRFA6uF0sqihWKaxKsk+hEkxcQeOU1eKhVzZy90otZ8=
github.com/0xPolygonHermez/zkevm-data-streamer v0.1.19/go.mod h1:0QkAXcFa92mFJrCbN3UPUJGJYes851yEgYHLONnaosE=
github.com/0xPolygonHermez/zkevm-node v0.0.0-20240222104536-0204affc7436 h1:7VzMlnx+SHXkkoKUIIMuJ2pcby4ngVF8vmEtlSuAZRk=
Expand Down
2 changes: 1 addition & 1 deletion interop/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"go.uber.org/zap"

"github.com/0xPolygon/agglayer/log"
jRPC "github.com/0xPolygon/cdk-data-availability/rpc"
jRPC "github.com/0xPolygon/cdk-rpc/rpc"
"github.com/0xPolygonHermez/zkevm-node/jsonrpc/client"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
Expand Down
2 changes: 1 addition & 1 deletion interop/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/0xPolygon/agglayer/log"
jRPC "github.com/0xPolygon/cdk-data-availability/rpc"
jRPC "github.com/0xPolygon/cdk-rpc/rpc"
"github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
rpctypes "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
"github.com/ethereum/go-ethereum/common"
Expand Down
2 changes: 1 addition & 1 deletion rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/0xPolygon/agglayer/log"
jRPC "github.com/0xPolygon/cdk-data-availability/rpc"
jRPC "github.com/0xPolygon/cdk-rpc/rpc"
"github.com/ethereum/go-ethereum/common"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
Expand Down
Loading