diff --git a/docker.local/Dockerfile b/docker.local/Dockerfile index f9d18464f..ef7b728b0 100644 --- a/docker.local/Dockerfile +++ b/docker.local/Dockerfile @@ -34,14 +34,19 @@ WORKDIR $SRC_DIR/code/go/0chain.net/blobber ARG GIT_COMMIT ENV GIT_COMMIT=$GIT_COMMIT -RUN go build -v -tags "bn256 development" -ldflags "-X 0chain.net/core/build.BuildTag=$GIT_COMMIT" +RUN go build -v -tags "bn256 development" -gcflags "all=-N -l" -ldflags "-X 0chain.net/core/build.BuildTag=$GIT_COMMIT" # Copy the build artifact into a minimal runtime image: FROM golang:1.14.9-alpine3.12 -RUN apk add gmp gmp-dev openssl-dev +RUN apk add gmp gmp-dev openssl-dev git COPY --from=blobber_build /usr/local/lib/libmcl*.so \ /usr/local/lib/libbls*.so \ /usr/local/lib/ + +RUN git clone --branch v1.4.1 https://github.com/go-delve/delve +WORKDIR ./delve +RUN go install ./cmd/dlv + ENV APP_DIR=/blobber WORKDIR $APP_DIR COPY --from=blobber_build $APP_DIR/code/go/0chain.net/blobber/blobber $APP_DIR/bin/blobber diff --git a/docker.local/b0docker-compose-debug.yml b/docker.local/b0docker-compose-debug.yml new file mode 100644 index 000000000..f25c128cc --- /dev/null +++ b/docker.local/b0docker-compose-debug.yml @@ -0,0 +1,83 @@ +version: "3" +services: + postgres: + image: postgres:11 + environment: + POSTGRES_PORT: 5432 + POSTGRES_HOST: postgres + POSTGRES_USER: postgres + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - "5432:5432" + volumes: + - ./blobber${BLOBBER}/data/postgresql:/var/lib/postgresql/data + networks: + default: + postgres-post: + image: postgres:11 + environment: + POSTGRES_PORT: 5432 + POSTGRES_HOST: postgres + POSTGRES_USER: postgres + volumes: + - ../bin:/blobber/bin + - ../sql:/blobber/sql + command: bash /blobber/bin/postgres-entrypoint.sh + links: + - postgres:postgres + validator: + image: validator + environment: + - DOCKER= true + depends_on: + - postgres-post + links: + - postgres-post:postgres-post + volumes: + - ../config:/blobber/config + - ./blobber${BLOBBER}/data:/blobber/data + - ./blobber${BLOBBER}/log:/blobber/log + - ./keys_config:/blobber/keysconfig + ports: + - "506${BLOBBER}:506${BLOBBER}" + command: ./bin/validator --port 506${BLOBBER} --hostname 198.18.0.6${BLOBBER} --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --log_dir /blobber/log + networks: + default: + testnet0: + ipv4_address: 198.18.0.6${BLOBBER} + + blobber: + image: blobber + environment: + - DOCKER= true + depends_on: + - validator + links: + - validator:validator + volumes: + - ../config:/blobber/config + - ./blobber${BLOBBER}/files:/blobber/files + - ./blobber${BLOBBER}/data:/blobber/data + - ./blobber${BLOBBER}/log:/blobber/log + - ./keys_config:/blobber/keysconfig + - ./blobber${BLOBBER}/data/tmp:/tmp + ports: + - "505${BLOBBER}:505${BLOBBER}" + - "703${BLOBBER}:703${BLOBBER}" + - "236${BLOBBER}:236${BLOBBER}" + command: dlv --listen=:236${BLOBBER} --headless=true --api-version=2 --accept-multiclient exec ./bin/blobber -- --port 505${BLOBBER} --grpc_port 703${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt + networks: + default: + testnet0: + ipv4_address: 198.18.0.9${BLOBBER} + +networks: + default: + driver: bridge + testnet0: + external: true + +volumes: + data: + config: + bin: diff --git a/docker.local/bin/blobber.start_bls.sh b/docker.local/bin/blobber.start_bls.sh index f3686577b..4aba602ee 100755 --- a/docker.local/bin/blobber.start_bls.sh +++ b/docker.local/bin/blobber.start_bls.sh @@ -1,11 +1,15 @@ -#!/bin/sh +#!/bin/bash +set -e + PWD=`pwd` BLOBBER_DIR=`basename $PWD` BLOBBER_ID=`echo my directory $BLOBBER_DIR | sed -e 's/.*\(.\)$/\1/'` - -echo Starting blobber$BLOBBER_ID ... - -# echo blobber$i - -BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose.yml up +if [[ "$*" == *"--debug"* ]] +then + echo Starting blobber$BLOBBER_ID in debug mode... + BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose-debug.yml up +else + echo Starting blobber$BLOBBER_ID ... + BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose.yml up +fi \ No newline at end of file