Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add docker build and make targets #19

Merged
merged 7 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.circleci
/.github
/build/*
/extern/filecoin-ffi
/Dockerfile*
/docker-compose*
/sentinel-visor
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PG_IMAGE?=postgres:10
REDIS_IMAGE?=redis:6
COMMIT := $(shell git rev-parse --short HEAD)

unexport GOFLAGS

Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]: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

```
Expand All @@ -16,6 +30,11 @@ A **Visor** process collects _permanent_ Filecoin chain meterics from a [**Lotus
Use 'sentinel-visor help <command>' 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=<bool>` turns tracing on or off. It is on by default.
Expand Down