Skip to content
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

feat(devnet): Local Gossamer Devnet #2008

Merged
merged 42 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
89b4337
wip
timwu20 Nov 9, 2021
31b3494
revise function, add test
timwu20 Nov 9, 2021
b502b27
cleanup
timwu20 Nov 9, 2021
a515bae
more wip
timwu20 Nov 10, 2021
3afd167
add pubip flag to cli
timwu20 Nov 10, 2021
0469b5c
go mod tidy after upgrading to 1.17
timwu20 Nov 10, 2021
53f0d51
add config tests
timwu20 Nov 11, 2021
a94830d
devnet cmd test
timwu20 Nov 11, 2021
d71bc2b
fix bob
timwu20 Nov 11, 2021
d2fc4f8
fix confd command
timwu20 Nov 11, 2021
1526265
update dockerfiles
timwu20 Nov 11, 2021
276d7c4
use dev go.mod and go.sum
timwu20 Nov 11, 2021
edea601
fix logs
timwu20 Nov 11, 2021
4bb5719
update lint settings
timwu20 Nov 11, 2021
078eab3
fix linting
timwu20 Nov 11, 2021
37bc203
add readme
timwu20 Nov 11, 2021
f2b0c2a
update README
timwu20 Nov 12, 2021
d77c1fc
remove symlinking step
timwu20 Nov 16, 2021
fee9325
Update devnet/README.md
timwu20 Nov 16, 2021
4d3cfc6
Update devnet/README.md
timwu20 Nov 16, 2021
bc651d6
Update devnet/README.md
timwu20 Nov 16, 2021
2cfbb59
Update devnet/alice.Dockerfile
timwu20 Nov 16, 2021
ae168e1
Update devnet/alice.Dockerfile
timwu20 Nov 16, 2021
2048bea
Update devnet/alice.Dockerfile
timwu20 Nov 16, 2021
1e31f5d
Update devnet/alice.Dockerfile
timwu20 Nov 16, 2021
f059130
Update devnet/alice.Dockerfile
timwu20 Nov 16, 2021
d78d5ab
cr feedback, fix metrics on bob
timwu20 Nov 16, 2021
e3f4c08
fix go.mod
timwu20 Nov 16, 2021
c7fdbf7
go mod tidy
timwu20 Nov 16, 2021
50de22e
Update devnet/cmd/update-dd-agent-confd/main.go
timwu20 Nov 17, 2021
b44587c
Update devnet/cmd/update-dd-agent-confd/main.go
timwu20 Nov 17, 2021
7c9e88d
cr feedback
timwu20 Nov 17, 2021
a79cee7
Merge branch 'devnet' of github.com:ChainSafe/gossamer into devnet
timwu20 Nov 17, 2021
b20dbef
update readme
timwu20 Nov 17, 2021
baf937b
Update devnet/README.md
timwu20 Nov 18, 2021
9e8fe21
cr feedback
timwu20 Nov 18, 2021
0c0d2de
more cr feedback
timwu20 Nov 18, 2021
d9d07be
use embed
timwu20 Nov 18, 2021
3aed2bd
Merge branch 'devnet' of github.com:ChainSafe/gossamer into devnet
timwu20 Nov 18, 2021
a226b83
add license
timwu20 Nov 18, 2021
9a9bb10
trimpath
timwu20 Nov 19, 2021
0cbd42f
Update devnet/bob.Dockerfile
timwu20 Nov 23, 2021
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
12 changes: 4 additions & 8 deletions devnet/alice.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM golang:1.17

ARG DD_API_KEY=somekey
timwu20 marked this conversation as resolved.
Show resolved Hide resolved
ENV DD_API_KEY=${DD_API_KEY}

RUN DD_AGENT_MAJOR_VERSION=7 DD_INSTALL_ONLY=true DD_SITE="datadoghq.com" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"
RUN DD_API_KEY=${DD_API_KEY} DD_AGENT_MAJOR_VERSION=7 DD_INSTALL_ONLY=true DD_SITE="datadoghq.com" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"

WORKDIR /gossamer

Expand All @@ -12,10 +10,6 @@ RUN go mod download

COPY . .

RUN go run devnet/cmd/update-dd-agent-confd/main.go -n=gossamer.local.devnet -t=key:alice > /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml
RUN service datadog-agent start

# RUN go get ./...
RUN go install github.com/ChainSafe/gossamer/cmd/gossamer
timwu20 marked this conversation as resolved.
Show resolved Hide resolved

# use modified genesis-spec.json with only 3 authority nodes
Expand All @@ -26,5 +20,7 @@ RUN gossamer --key=alice init
# use a hardcoded key for alice, so we can determine what the peerID is for subsequent nodes
RUN cp devnet/alice.node.key ~/.gossamer/gssmr/node.key

ENTRYPOINT service datadog-agent restart && gossamer --key=alice --babe-lead --publish-metrics --rpc --rpc-external=true --pubip=10.5.0.2
RUN go run devnet/cmd/update-dd-agent-confd/main.go -n=gossamer.local.devnet -t=key:alice > /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml

ENTRYPOINT service datadog-agent start && gossamer --key=alice --babe-lead --publish-metrics --rpc --rpc-external=true --pubip=10.5.0.2
EXPOSE 7001/tcp 8545/tcp 8546/tcp 8540/tcp 9876/tcp
27 changes: 13 additions & 14 deletions devnet/bob.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
FROM golang:1.17

ARG key
RUN test -n "$key"
ARG pubip
RUN test -n "$pubip"
ARG DD_API_KEY=somekey
RUN DD_API_KEY=${DD_API_KEY} DD_AGENT_MAJOR_VERSION=7 DD_INSTALL_ONLY=true DD_SITE="datadoghq.com" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"

ENV key=${key}
ENV pubip=${pubip}
ENV DD_API_KEY=${DD_API_KEY}

RUN DD_AGENT_MAJOR_VERSION=7 DD_INSTALL_ONLY=true DD_SITE="datadoghq.com" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"
WORKDIR /gossamer

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN go run devnet/cmd/update-dd-agent-confd/main.go -n=gossamer.local.devnet -t=key:${key} > /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml
RUN service datadog-agent start

# RUN go get ./...
RUN go install github.com/ChainSafe/gossamer/cmd/gossamer

# use modified genesis-spec.json with only 3 authority nodes
RUN cp -f devnet/chain/gssmr/genesis-spec.json chain/gssmr/genesis-spec.json
kishansagathiya marked this conversation as resolved.
Show resolved Hide resolved

ARG key
RUN test -n "$key"
ARG pubip
Comment on lines +21 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit usually build arguments and env variables are in uppercase out there, although lowercase works too.

RUN test -n "$pubip"

ENV key=${key}
ENV pubip=${pubip}

RUN gossamer --key=${key} init

ENTRYPOINT service datadog-agent restart && gossamer --key=${key} --bootnodes=/ip4/10.5.0.2/tcp/7001/p2p/12D3KooWMER5iow67nScpWeVqEiRRx59PJ3xMMAYPTACYPRQbbWU --publish-metrics --rpc --pubip=${pubip}
RUN go run devnet/cmd/update-dd-agent-confd/main.go -n=gossamer.local.devnet -t=key:${key} > /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml
kishansagathiya marked this conversation as resolved.
Show resolved Hide resolved

ENTRYPOINT service datadog-agent start && gossamer --key=${key} --bootnodes=/ip4/10.5.0.2/tcp/7001/p2p/12D3KooWMER5iow67nScpWeVqEiRRx59PJ3xMMAYPTACYPRQbbWU --publish-metrics --rpc --pubip=${pubip}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to be able to fiddle with the bootnodes at runtime with i.e.:

Suggested change
ENTRYPOINT service datadog-agent start && gossamer --key=${key} --bootnodes=/ip4/10.5.0.2/tcp/7001/p2p/12D3KooWMER5iow67nScpWeVqEiRRx59PJ3xMMAYPTACYPRQbbWU --publish-metrics --rpc --pubip=${pubip}
ENV BOOTNODES=/ip4/10.5.0.2/tcp/7001/p2p/12D3KooWMER5iow67nScpWeVqEiRRx59PJ3xMMAYPTACYPRQbbWU
ENTRYPOINT service datadog-agent start && gossamer --key=${key} --bootnodes=${BOOTNODES} --publish-metrics --rpc --pubip=${pubip}

You could also split that string in multiple ENV if you want (i.e. BOOTNODE_PORT=7001) using sensible defaults.

Copy link
Contributor Author

@timwu20 timwu20 Nov 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a case where we would want to adjust the bootnodes for the gssmr devnet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least the IP address 10.5.0.2 could be changed if we change the docker network right?

Copy link
Contributor Author

@timwu20 timwu20 Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the next PR I do actually have to change the bootnode ports, so port will be configurable on bob.Dockerfile. I'm trying to hardcode the configuration for alice.Dockerfile since that is the lead node. I think being explicit in this case shows that everything is dependant on alice. The dockerfiles that I'm creating here aren't meant to be used standalone, but actually only orchestrated using the docker-compose.yml


EXPOSE 7001/tcp 8545/tcp 8546/tcp 8540/tcp 9876/tcp
timwu20 marked this conversation as resolved.
Show resolved Hide resolved
Loading