Commit ec66285f authored by Trever Schirmer's avatar Trever Schirmer
Browse files

Enable Debugging of nodeB

parent 3e343e68
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run 3NodeTest" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<configuration default="false" name="3NodeTest: Run Tests" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<makefile filename="$PROJECT_DIR$/tests/3NodeTest/Makefile" target="test clean" workingDirectory="" arguments="">
<envs />
</makefile>
......
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="3NodeTest: Run Tests &amp; Debug nodeB (start &quot;Debug nodeB&quot; immediately after!)" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" singleton="false">
<makefile filename="$PROJECT_DIR$/tests/3NodeTest/Makefile" target="debug-nodeB" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2" />
</configuration>
</component>
\ No newline at end of file
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="3NodeTest: Start without Tester" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<makefile filename="$PROJECT_DIR$/tests/3NodeTest/Makefile" target="fred" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2" />
</configuration>
</component>
\ No newline at end of file
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Debug nodeB" type="GoRemoteDebugConfigurationType" factoryName="Go Remote" port="40000">
<method v="2" />
</configuration>
</component>
\ No newline at end of file
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run 3NodesTest (all Clients in Container)" type="GoApplicationRunConfiguration" factoryName="Go Application" singleton="false">
<module name="fred" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/tests/3NodeTest/cmd/main.go" />
<package value="gitlab.tu-berlin.de/mcc-fred/fred/tests/3NodeTest/cmd/main" />
<directory value="$PROJECT_DIR$/" />
<method v="2" />
</configuration>
</component>
\ No newline at end of file
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run 3NodesTest (nodeA on Machine =&gt; Debugging)" type="GoApplicationRunConfiguration" factoryName="Go Application" singleton="false">
<module name="fred" />
<working_directory value="$PROJECT_DIR$" />
<parameters value="--nodeAhttp 9001 --nodeAzmqhost localhost --nodeAhost localhost" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/tests/3NodeTest/cmd/main.go" />
<package value="gitlab.tu-berlin.de/mcc-fred/fred/tests/3NodeTest/cmd/main" />
<directory value="$PROJECT_DIR$/" />
<method v="2" />
</configuration>
</component>
\ No newline at end of file
......@@ -28,6 +28,14 @@ How do I push changes to the `master` branch?
Some last words, keep pull requests small (not 100 files changed etc :D), so they are easier to review and rather create a lot of pull requests than one big
## Debugging
It is possible to debug nodeB of the 3NodeTest:
- Create some breakpoints
- Run the configuration "3NodeTest: Run Tests & Debug nodeB (start "Debug nodeB" immediately after!)" (equals to `make debug-nodeB` in 3NodeTest)
- Run the configuration "Debug nodeB"
## Using the DynamoDB Backend
To use the DynamoDB storage backend, a table must already exist in DynamoDB.
......
# This is a compy from the dockerfile that adds support for debugging. It is used in the 3NodeTest to debug nodeB
# building the binary
FROM golang:1.15-buster as golang
MAINTAINER Tobias Pfandzelter <tp@mcc.tu-berlin.de>
WORKDIR /go/src/gitlab.tu-berlin.de/mcc-fred/fred/
RUN apt update && apt install -y ca-certificates git && rm -rf /var/cache/apk/*
COPY nase/tls/ca.crt /usr/local/share/ca-certificates/ca.crt
RUN update-ca-certificates
RUN go get github.com/go-delve/delve/cmd/dlv
# Make an extra layer for the installed packages so that they dont have to be downloaded everytime
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY pkg pkg
COPY cmd cmd
COPY proto proto
RUN CGO_ENABLED=0 go install -gcflags="all=-N -l" ./cmd/frednode/
# actual Docker image
FROM debian:buster
WORKDIR /
COPY --from=golang /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=golang /go/bin/frednode frednode
COPY --from=golang /go/bin/dlv dlv
EXPOSE 443
EXPOSE 5555
EXPOSE 40000
#ENTRYPOINT ["/dlv"]
ENTRYPOINT ["./dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "./frednode", "--"]
\ No newline at end of file
......@@ -9,6 +9,11 @@ test: ## start all containers with docker compose and run the test dockerized
@docker-compose -f etcd.yml -f nodeA.yml -f nodeB.yml -f nodeC.yml -f tester.yml -f trigger.yml build
@docker-compose -f etcd.yml -f nodeA.yml -f nodeB.yml -f nodeC.yml -f tester.yml -f trigger.yml up --force-recreate --abort-on-container-exit --renew-anon-volumes --remove-orphans
debug-nodeB: ## same as "test" but with nodeB in debugger mode
@docker network create fredwork --gateway 172.26.0.1 --subnet 172.26.0.0/16 || true
@docker-compose -f etcd.yml -f nodeA.yml -f nodeB-debug.yml -f nodeC.yml -f tester.yml -f trigger.yml build
@docker-compose -f etcd.yml -f nodeA.yml -f nodeB-debug.yml -f nodeC.yml -f tester.yml -f trigger.yml up --force-recreate --abort-on-container-exit --renew-anon-volumes --remove-orphans
fred: ## Start all containers except the tester so that other clients can access them
@docker network create fredwork --gateway 172.26.0.1 --subnet 172.26.0.0/16 || true
@docker-compose -f etcd.yml -f nodeA.yml -f nodeB.yml -f nodeC.yml -f trigger.yml build
......
version: "3.7"
services:
nodeB:
build:
context: ../../../fred
dockerfile: debug.Dockerfile
depends_on:
- storeB
image: fred/fred:local-debug
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
container_name: nodeB
command: --remote-storage-host "172.26.2.2:1337" --peer-host "172.26.2.1:5555" --nodeID "nodeB" --host ":9001" --cert "/cert/nodeB.crt" --key "/cert/nodeB.key" --ca-file "/cert/ca.crt" --adaptor "remote" --nase-host "https://172.26.6.1:2379" --nase-cert "/cert/nodeB.crt" --nase-key "/cert/nodeB.key" --nase-ca "/cert/ca.crt" --log-level "debug" --handler "dev" --badgerdb-path "./db" --remote-storage-cert "/cert/nodeB.crt" --remote-storage-key "/cert/nodeB.key" --trigger-cert "/cert/nodeB.crt" --trigger-key "/cert/nodeB.key"
volumes:
- ../../nase/tls/nodeB.crt:/cert/nodeB.crt
- ../../nase/tls/nodeB.key:/cert/nodeB.key
- ../../nase/tls/ca.crt:/cert/ca.crt
ports:
- 9003:9001
- 40000:40000
networks:
fredwork:
ipv4_address: 172.26.2.1
storeB:
build:
context: ../../../fred
dockerfile: storage.Dockerfile
image: fred/store:local
container_name: storeB
command: --cert "/cert/cert.crt" --key "/cert/key.key" --ca-file "/cert/ca.crt"
volumes:
- ../../nase/tls/storeB.crt:/cert/cert.crt
- ../../nase/tls/storeB.key:/cert/key.key
- ../../nase/tls/ca.crt:/cert/ca.crt
networks:
fredwork:
ipv4_address: 172.26.2.2
networks:
fredwork:
external: true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment