docker_compose

This commit is contained in:
Ian Norden 2020-03-02 16:30:46 -06:00
parent 8c2a71b16f
commit 9d2a30596e
3 changed files with 54 additions and 11 deletions

View File

@ -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

View File

@ -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:

View File

@ -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