diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..92ec26421 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +/.circleci +/.github +/build/* +/extern/filecoin-ffi +/Dockerfile* +/docker-compose* +/sentinel-visor diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..c40afe1b2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Builder +FROM golang:1.15.2 as builder + +# Install deps for filecoin-project/filecoin-ffi +RUN apt-get update +RUN apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev + +WORKDIR /go/src/github.com/filecoin-project/sentinel-visor +COPY . /go/src/github.com/filecoin-project/sentinel-visor +RUN make deps && make build + +# Runner +FROM buildpack-deps:buster-curl +# Grab the things +COPY --from=builder /go/src/github.com/filecoin-project/sentinel-visor/sentinel-visor /usr/bin/ +COPY --from=builder /usr/lib/x86_64-linux-gnu/libOpenCL.so* /lib/ + +ENTRYPOINT ["/usr/bin/sentinel-visor"] +CMD ["--help"] diff --git a/Makefile b/Makefile index 34fe7ab75..d19eb9278 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ PG_IMAGE?=postgres:10 REDIS_IMAGE?=redis:6 +COMMIT := $(shell git rev-parse --short HEAD) unexport GOFLAGS @@ -70,6 +71,11 @@ sentinel-visor: BINS+=sentinel-visor +.PHONY: docker-image +docker-image: + docker build -t "filecoin/sentinel-visor" . + docker tag "filecoin/sentinel-visor:latest" "filecoin/sentinel-visor:$(COMMIT)" + clean: rm -rf $(CLEAN) $(BINS) -$(MAKE) -C $(FFI_PATH) clean diff --git a/README.md b/README.md index 91f021c37..536aa26d8 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,20 @@ A **Visor** process collects _permanent_ Filecoin chain meterics from a [**Lotus ## Getting Started +Clone the repo and build the dependencies: + +```console +$ git clone git@github.com:filecoin-project/sentinel-visor.git +$ cd sentinel-visor +$ make deps +``` + +Build the `sentinel-visor` binary to the root of the project directory: + +```console +$ make build +``` + ### Usage ``` @@ -16,6 +30,11 @@ A **Visor** process collects _permanent_ Filecoin chain meterics from a [**Lotus Use 'sentinel-visor help ' to learn more about each command. ``` +Use the following env vars to configure the lotus node that visor reads from, and the database that it writes to: + +- `LOTUS_PATH` - path to the lotus data dir. _default: `~/.lotus`_ +- `LOTUS_DB` - database connection . _default: `postgres://postgres:password@localhost:5432/postgres?sslmode=disable`_ + ### Configuring Tracing The global flag `--tracing=` turns tracing on or off. It is on by default.