diff --git a/dockerfiles/super_node/Dockerfile b/dockerfiles/super_node/Dockerfile index 06b55a83..2a4d2cbd 100644 --- a/dockerfiles/super_node/Dockerfile +++ b/dockerfiles/super_node/Dockerfile @@ -7,8 +7,6 @@ RUN apk add busybox-extras # this is probably a noob move, but I want apk from alpine for the above but need to avoid Go 1.13 below as this error still occurs https://github.com/ipfs/go-ipfs/issues/6603 FROM golang:1.12.4 as builder -RUN yum install -y libusb1-devel systemd-devel - # Get and build vulcanizedb ADD . /go/src/github.com/vulcanize/vulcanizedb WORKDIR /go/src/github.com/vulcanize/vulcanizedb @@ -19,7 +17,7 @@ RUN go get -u -d github.com/ipfs/go-ipfs WORKDIR /go/src/github.com/ipfs/go-ipfs RUN git remote add vulcanize https://github.com/vulcanize/go-ipfs.git RUN git fetch vulcanize -RUN git checkout -b pg_ipfs v0.4.22-alpha +RUN git checkout -b pg_ipfs vulcanize/postgres_update RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o ipfs ./cmd/ipfs # Build migration tool @@ -53,6 +51,7 @@ COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/vulcanizedb vulcani COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose goose COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/db/migrations migrations/vulcanizedb COPY --from=builder /go/src/github.com/ipfs/go-ipfs/ipfs ipfs +RUN touch vulcanizedb.log EXPOSE $EXPOSE_PORT_1 EXPOSE $EXPOSE_PORT_2 diff --git a/dockerfiles/super_node/docker-compose.yml b/dockerfiles/super_node/docker-compose.yml new file mode 100644 index 00000000..e842cd97 --- /dev/null +++ b/dockerfiles/super_node/docker-compose.yml @@ -0,0 +1,48 @@ +version: '3.2' + +services: + db: + image: postgres:10.12-alpine + environment: + POSTGRES_USER: "postgres" + POSTGRES_DB: "vulcanize_public" + POSTGRES_PASSWORD: "password" + volumes: + - vulcanizedb_db_data:/var/lib/postgresql/data + expose: + - "5432" + ports: + - "127.0.0.1:8079:5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 30 + + supernode: + depends_on: + - db + build: + context: ./../../ + cache_from: + - alpine:latest + - golang:1.12.4 + dockerfile: ./dockerfiles/super_node/Dockerfile + args: + CONFIG_FILE: ./environments/superNode.toml + environment: + IPFS_INIT: "true" + VDB_PG_NAME: "vulcanize_public" + VDB_PG_HOSTNAME: "db" + VDB_PG_PORT: 5432 + VDB_PG_USER: "postgres" + VDB_PG_PASSWORD: "password" + ports: + - "127.0.0.1:8080:8080" + - "127.0.0.1:8081:8081" + - "127.0.0.1:8082:8082" + - "127.0.0.1:8083:8083" + +volumes: + vulcanizedb_db_data: + diff --git a/dockerfiles/super_node/startup_script.sh b/dockerfiles/super_node/startup_script.sh index ddf6c8a1..7ecde43b 100755 --- a/dockerfiles/super_node/startup_script.sh +++ b/dockerfiles/super_node/startup_script.sh @@ -45,14 +45,10 @@ fi # If IPFS initialization was successful if [[ $? -eq 0 ]]; then - # Wait until block synchronisation has begun - echo "Waiting for block synchronization to begin" - ( tail -f -n0 log.txt & ) | grep -q "Block synchronisation started" # this blocks til we see "Block synchronisation started" - # And then spin up the syncPublishScreenAndServe Vulcanizedb service - echo "Beginning the syncPublishScreenAndServe vulcanizedb process" - ./vulcanizedb superNode --config=config.toml 2>&1 | tee -a log.txt & + echo "Beginning the vulcanizedb super node process" + ./vulcanizedb superNode --config=config.toml 2>&1 | tee -a vulcanizedb.log & else - echo "Could not initialize state-diffing Geth." + echo "Could not initialize IPFS." exit fi @@ -64,4 +60,4 @@ else exit fi -wait +tail -f vulcanizedb.log