mirror of
https://github.com/grassrootseconomics/eth-tracker.git
synced 2025-02-23 08:02:16 +01:00
ci: add docker images, update docs
This commit is contained in:
parent
a599bb200e
commit
b35016dac1
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
!/cmd
|
||||||
|
!/internal
|
||||||
|
!/LICENSE
|
||||||
|
!/config.toml
|
||||||
|
!/go.*
|
6
.env.example
Normal file
6
.env.example
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
TRACKER_CORE__POOL_SIZE=
|
||||||
|
TRACKER_CHAIN__ARCHIVE_NODE=
|
||||||
|
TRACKER_CHAIN__WS_ENDPOINT=
|
||||||
|
TRACKER_CHAIN__RPC_ENDPOINT=
|
||||||
|
TRACKER_CHAIN__CHAINID=
|
||||||
|
TRACKER_CHAIN__START_BLOCK=
|
6
.github/dependabot.yaml
vendored
Normal file
6
.github/dependabot.yaml
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "gomod"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
56
.github/workflows/docker.yaml
vendored
Normal file
56
.github/workflows/docker.yaml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Check out repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Login to GHCR Docker registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set outputs
|
||||||
|
run: |
|
||||||
|
echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV \
|
||||||
|
&& echo "RELEASE_SHORT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build and push image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
build-args: |
|
||||||
|
BUILD=${{ env.RELEASE_SHORT_COMMIT }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
tags: |
|
||||||
|
ghcr.io/grassrootseconomics/celo-tracker:latest
|
||||||
|
ghcr.io/grassrootseconomics/celo-tracker:${{ env.RELEASE_TAG }}
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
FROM golang:1.22.3-bookworm as build
|
||||||
|
|
||||||
|
ENV CGO_ENABLED=1
|
||||||
|
|
||||||
|
ARG BUILDPLATFORM
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
ARG BUILD=dev
|
||||||
|
|
||||||
|
RUN echo "Building on $BUILDPLATFORM, building for $TARGETPLATFORM"
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN go mod download
|
||||||
|
RUN go build -o celo-tracker -ldflags="-X main.build=${BUILD} -s -w" cmd/*
|
||||||
|
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
WORKDIR /service
|
||||||
|
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
|
COPY --from=build /build/* .
|
||||||
|
|
||||||
|
EXPOSE 5001
|
||||||
|
|
||||||
|
CMD ["./celo-tracker"]
|
47
README.md
47
README.md
@ -8,6 +8,53 @@ It applies deduplication at the NATS level, making it safe to run in a distribut
|
|||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
* Git
|
||||||
|
* Docker
|
||||||
|
* NATS server
|
||||||
|
* Access to a Celo RPC node
|
||||||
|
|
||||||
|
### 1. Build the Docker image
|
||||||
|
|
||||||
|
We provide pre-built images for `linux/amd64`. See the packages tab on Github.
|
||||||
|
|
||||||
|
If you are on any other platform:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/grassrootseconomics/celo-tracker.git
|
||||||
|
cd celo-tracker
|
||||||
|
docker buildx build --build-arg BUILD=$(git rev-parse --short HEAD) --tag celo-tracker:$(git rev-parse --short HEAD) --tag celo-tracker:latest .
|
||||||
|
docker images
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Run NATS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd dev
|
||||||
|
docker compose up -d
|
||||||
|
docker ps
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Update config values
|
||||||
|
|
||||||
|
See `.env.example` on how to override default values defined in `config.toml` using env varaibles. Alternatively, mount your own config.toml either during build time or Docker runtime.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Override only specific config values
|
||||||
|
nano .env.example
|
||||||
|
mv .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to [`config.toml`](config.toml) to understand different config value settings.
|
||||||
|
|
||||||
|
|
||||||
|
### 4. Run the tracker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --env-file .env -p 127.0.0.1:5001:5001 celo-tracker:latest
|
||||||
|
```
|
||||||
|
|
||||||
## Caveats
|
## Caveats
|
||||||
|
|
||||||
* Reverted transactions older than 10 minutes will be skipped due to the trie potentially missing. To override this behavior, use an archive node and set `chain.archive_node` to `true`.
|
* Reverted transactions older than 10 minutes will be skipped due to the trie potentially missing. To override this behavior, use an archive node and set `chain.archive_node` to `true`.
|
||||||
|
12
config.toml
12
config.toml
@ -1,19 +1,31 @@
|
|||||||
[api]
|
[api]
|
||||||
|
# Exposes /debug and /stats
|
||||||
address = ":5001"
|
address = ":5001"
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
|
# Use a specific cache implementation
|
||||||
cache_type = "map"
|
cache_type = "map"
|
||||||
|
# Use a specific db implementation
|
||||||
db_type = "bolt"
|
db_type = "bolt"
|
||||||
|
# Tune max go routines that can process blocks
|
||||||
|
# Defaults to (nproc * 3)
|
||||||
pool_size = 0
|
pool_size = 0
|
||||||
|
# If you are using an archive node, set this to true
|
||||||
archive_node = false
|
archive_node = false
|
||||||
|
|
||||||
[chain]
|
[chain]
|
||||||
ws_endpoint = "wss://forno.celo.org/ws"
|
ws_endpoint = "wss://forno.celo.org/ws"
|
||||||
rpc_endpoint = "https://forno.celo.org"
|
rpc_endpoint = "https://forno.celo.org"
|
||||||
|
# Defaults to Celo mainnet
|
||||||
|
# At the moment only support Celo based blockchains
|
||||||
chainid = 42220
|
chainid = 42220
|
||||||
|
# This will start a backfill if set to any other value
|
||||||
|
# Ideally this should remain 0
|
||||||
start_block = 0
|
start_block = 0
|
||||||
|
|
||||||
[bootstrap]
|
[bootstrap]
|
||||||
|
# This will bootstrap the cache on which addresses to track
|
||||||
|
# Grassroots Economics specific registries that autoload all other smart contracts
|
||||||
ge_registries = [
|
ge_registries = [
|
||||||
"0xd1FB944748aca327a1ba036B082993D9dd9Bfa0C",
|
"0xd1FB944748aca327a1ba036B082993D9dd9Bfa0C",
|
||||||
"0x0cc9f4fff962def35bb34a53691180b13e653030",
|
"0x0cc9f4fff962def35bb34a53691180b13e653030",
|
||||||
|
Loading…
Reference in New Issue
Block a user