Skip to content

Added debug build #173

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

Merged
merged 2 commits into from
May 30, 2021
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
9 changes: 7 additions & 2 deletions docker.local/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
83 changes: 83 additions & 0 deletions docker.local/b0docker-compose-debug.yml
Original file line number Diff line number Diff line change
@@ -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:
18 changes: 11 additions & 7 deletions docker.local/bin/blobber.start_bls.sh
Original file line number Diff line number Diff line change
@@ -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