Rename repo
This commit is contained in:
parent
f7a7a68c27
commit
7dd22cf730
|
@ -13,8 +13,8 @@ WORKDIR /app
|
|||
RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates
|
||||
|
||||
COPY db/migrations ./db/migrations/
|
||||
COPY --from=build /app/amb-monitor ./
|
||||
COPY --from=build /app/tokenbridge-monitor ./
|
||||
|
||||
EXPOSE 3333
|
||||
|
||||
ENTRYPOINT ./amb-monitor
|
||||
ENTRYPOINT ./tokenbridge-monitor
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Tokenbridge AMB monitor
|
||||
This repo provides a real-time monitoring solution for the AMB bridge contracts.
|
||||
# Tokenbridge monitor
|
||||
This repo provides a real-time monitoring solution for the AMB/XDAI bridge contracts.
|
||||
It performs a real-time chain indexing for the configured bridged instances, and alerts in case of some important events or outages.
|
||||
|
||||
## Tech layout
|
||||
|
@ -57,8 +57,8 @@ docker-compose -f docker-compose.dev.yml up monitor
|
|||
For final deployment, you will need a VM with a static IP and a DNS domain name attached to that IP.
|
||||
SSL certificates will be managed by a Traefik and Let's Encrypt automatically.
|
||||
```bash
|
||||
git clone https://github.com/poanetwork/amb-monitor.git
|
||||
cd amb-monitor
|
||||
git clone https://github.com/poanetwork/tokenbridge-monitor.git
|
||||
cd tokenbridge-monitor
|
||||
|
||||
cp .env.example .env
|
||||
nano .env # put valid INFURA_PROJECT_KEY and valid domain names
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/poanetwork/amb-monitor/blob/master/config.schema.json",
|
||||
"$id": "https://github.com/poanetwork/tokenbridge-monitor/blob/master/config.schema.json",
|
||||
"title": "AMB monitor config",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package contract
|
||||
|
||||
import (
|
||||
"amb-monitor/entity"
|
||||
"amb-monitor/ethclient"
|
||||
"context"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
|
|
2
db/db.go
2
db/db.go
|
@ -1,12 +1,12 @@
|
|||
package db
|
||||
|
||||
import (
|
||||
"amb-monitor/config"
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
"tokenbridge-monitor/config"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4"
|
||||
_ "github.com/golang-migrate/migrate/v4/database/pgx"
|
||||
|
|
|
@ -83,7 +83,7 @@ services:
|
|||
restart: unless-stopped
|
||||
monitor:
|
||||
container_name: monitor
|
||||
image: ghcr.io/poanetwork/amb-monitor:v0.0.20
|
||||
image: ghcr.io/poanetwork/tokenbridge-monitor:v0.0.20
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
|
|
12
main.go
12
main.go
|
@ -1,16 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"amb-monitor/config"
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/logging"
|
||||
"amb-monitor/monitor"
|
||||
"amb-monitor/presenter"
|
||||
"amb-monitor/repository"
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/monitor"
|
||||
"tokenbridge-monitor/presenter"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package alerts
|
||||
|
||||
import (
|
||||
"amb-monitor/config"
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/logging"
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/logging"
|
||||
)
|
||||
|
||||
type AlertManager struct {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package alerts
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
"tokenbridge-monitor/db"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package alerts
|
||||
|
||||
import (
|
||||
"amb-monitor/logging"
|
||||
"context"
|
||||
"time"
|
||||
"tokenbridge-monitor/logging"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package monitor
|
||||
|
||||
import (
|
||||
"amb-monitor/entity"
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package monitor
|
||||
|
||||
import (
|
||||
"amb-monitor/config"
|
||||
"amb-monitor/contract/abi"
|
||||
"amb-monitor/entity"
|
||||
"amb-monitor/ethclient"
|
||||
"amb-monitor/repository"
|
||||
"context"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/contract/abi"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
package monitor
|
||||
|
||||
import (
|
||||
"amb-monitor/config"
|
||||
"amb-monitor/contract"
|
||||
"amb-monitor/contract/abi"
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"amb-monitor/ethclient"
|
||||
"amb-monitor/logging"
|
||||
"amb-monitor/monitor/alerts"
|
||||
"amb-monitor/repository"
|
||||
"amb-monitor/utils"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
|
@ -19,6 +9,16 @@ import (
|
|||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/contract"
|
||||
"tokenbridge-monitor/contract/abi"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/monitor/alerts"
|
||||
"tokenbridge-monitor/repository"
|
||||
"tokenbridge-monitor/utils"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package monitor
|
||||
|
||||
import (
|
||||
"amb-monitor/entity"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package presenter
|
||||
|
||||
import (
|
||||
"amb-monitor/logging"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
"tokenbridge-monitor/logging"
|
||||
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package presenter
|
||||
|
||||
import (
|
||||
"amb-monitor/config"
|
||||
"amb-monitor/entity"
|
||||
"amb-monitor/logging"
|
||||
"amb-monitor/repository"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package presenter
|
||||
|
||||
import (
|
||||
"amb-monitor/entity"
|
||||
"time"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package presenter
|
||||
|
||||
import (
|
||||
"amb-monitor/entity"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
var formats = map[string]string{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"tokenbridge-monitor/db"
|
||||
)
|
||||
|
||||
type basePostgresRepo struct {
|
||||
|
@ -14,4 +14,4 @@ func newBasePostgresRepo(table string, db *db.DB) *basePostgresRepo {
|
|||
table: table,
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
@ -53,4 +53,4 @@ func (r *informationRequestsRepo) FindByMessageID(ctx context.Context, bridgeID
|
|||
return nil, fmt.Errorf("can't get information request: %w", err)
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"amb-monitor/db"
|
||||
"amb-monitor/entity"
|
||||
"amb-monitor/repository/postgres"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/repository/postgres"
|
||||
)
|
||||
|
||||
type Repo struct {
|
||||
|
|
Loading…
Reference in New Issue