Skip to content

Commit

Permalink
Feature: add celestials (#334)
Browse files Browse the repository at this point in the history
* Feature: add celestials

* Fix: build

* Refactoring: celestials module to separate package

* Some improvements

* Add statuses

* Fix: go.mod

* Add joins to grants and delegations

* Change interface to address handler
  • Loading branch information
aopoltorzhicky authored Feb 1, 2025
1 parent b7098dd commit 07f966a
Show file tree
Hide file tree
Showing 54 changed files with 1,909 additions and 321 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ CELENIUM_ENV=production
BINANCE_API_URL=https://api.binance.com/
BINANCE_API_RPS=5
BINANCE_API_TIMEOUT=10
CELESTIALS_API_URL=<CELESTIALS_API_HERE>
CELESTIALS_API_RPS=3
CELESTIALS_API_TIMEOUT=10
CELESTIALS_CHAIN_ID=celestia-1
21 changes: 20 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,23 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta-tvl.outputs.tags }}
labels: ${{ steps.meta-tvl.outputs.labels }}
labels: ${{ steps.meta-tvl.outputs.labels }}

# Celestials

- name: Celestials image tags & labels
id: meta-celestials
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-celestials

- name: Celestials image build & push
uses: docker/build-push-action@v5
with:
context: .
file: build/celestials/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta-celestials.outputs.tags }}
labels: ${{ steps.meta-celestials.outputs.labels }}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
"../../configs/dipdup.yml",
],
"envFile": "${workspaceFolder}/.env"
}, {
"name": "Launch Celestials",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/cmd/celestials",
"args": [
"-c",
"../../configs/dipdup.yml",
],
"envFile": "${workspaceFolder}/.env"
}
]
}
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ quotes:
tvl:
cd cmd/tvl && go run . -c ../../configs/dipdup.yml

celestials:
cd cmd/celestials && go run . -c ../../configs/dipdup.yml

build:
cd cmd/indexer && go build -a -o ../../bin/indexer .
cd cmd/api && go build -a -o ../../bin/api .
Expand Down Expand Up @@ -43,7 +46,7 @@ adr:
@cp adr/adr-template.md adr/adr-$(NUM)-$(TITLE).md

generate:
go generate -v ./internal/blob ./internal/storage ./internal/storage/types ./pkg/node ./internal/binance ./internal/tvl/l2beat ./internal/tvl/lama
go generate -v ./internal/blob ./internal/storage ./internal/storage/types ./pkg/node ./internal/binance ./internal/celestials ./internal/tvl/l2beat ./internal/tvl/lama

api-docs:
cd cmd/api && swag init --md markdown -parseDependency --parseInternal --parseDepth 1 --outputTypes json
Expand Down Expand Up @@ -81,4 +84,4 @@ cover:
license-header:
update-license -path=./ -license=./HEADER

.PHONY: init indexer api build clean compose lint test adr mock api-docs check-licenses cover license-header tvl
.PHONY: init indexer api celestials quotes build clean compose lint test adr mock api-docs check-licenses cover license-header tvl
37 changes: 37 additions & 0 deletions build/celestials/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ---------------------------------------------------------------------
# The first stage container, for building the application
# ---------------------------------------------------------------------
FROM golang:1.23.2-alpine AS builder

ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOOS=linux

RUN apk --no-cache add ca-certificates

RUN mkdir -p $GOPATH/src/github.com/celenium-io/celestia-indexer/

COPY ./go.* $GOPATH/src/github.com/celenium-io/celestia-indexer/
WORKDIR $GOPATH/src/github.com/celenium-io/celestia-indexer
RUN go mod download

COPY cmd/celestials cmd/celestials
COPY internal internal
COPY pkg pkg

WORKDIR $GOPATH/src/github.com/celenium-io/celestia-indexer/cmd/celestials/
RUN go build -a -installsuffix cgo -o /go/bin/celestials .

# ---------------------------------------------------------------------
# The second stage container, for running the application
# ---------------------------------------------------------------------
FROM scratch

WORKDIR /app/celestials

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/bin/celestials /go/bin/celestials
COPY ./configs/dipdup.yml ./
COPY database database

ENTRYPOINT ["/go/bin/celestials", "-c", "dipdup.yml"]
Loading

0 comments on commit 07f966a

Please sign in to comment.