-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devnet): add substrate docker images to dockerfile (#2263)
* feat: include substrate docker image * chore: add substrate docker images * chore: formatting and add depends on yaml key * chore: add datadog stuff again * chore: use alice peer id * chore: split substrate docker compose services into another file * chore: enable prometheus external and add datadog * chore: keep substrate ports same as gossamer node ports * chore: expose rpc and ws calls in substrate docker file * chore: use same dns name and p2p id * chore: use same key for both alice gossamer and substrate nodes * chore: fix dd golang cmd chore: keep both cross-client and gssmr chain genesis raw chore: mistakes * Update devnet/README.md Co-authored-by: Quentin McGaw <[email protected]> * Update devnet/README.md Co-authored-by: Quentin McGaw <[email protected]> * chore: update `substrate_alice` readme info * Update devnet/README.md Co-authored-by: Quentin McGaw <[email protected]> * chore: add `/tcp` to expose ports * chore: adjust args and envs * chore: pin prometheus version, add read only volume and add trailing new line * chore: improve README.md * chore: add port 7001 explicitly * chore: remove prometheus `--config.file` flag Co-authored-by: Quentin McGaw <[email protected]> * chore: use env to chain This is needed since ARG cannot be used inside ENTRYPOINT * update substrate_bob.Dockerfile * chore: add datadog-agent start to gssmr alice node * chore: add comment about different but same node keys * chore: update substrate docker images to version 0.9.17 * chore: include license header * chore: make image smaller, start dd agent at entrypoint * chore: use only one genesis * chore: be more descriptive at genesis.json folder * chore: update image to use arg polkadot version Co-authored-by: Quentin McGaw <[email protected]>
- Loading branch information
1 parent
567c1ab
commit b7b2a66
Showing
11 changed files
with
564 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
services: | ||
alice: | ||
platform: linux/amd64 | ||
build: | ||
context: ./.. | ||
dockerfile: devnet/substrate_alice.Dockerfile | ||
args: | ||
DD_API_KEY: ${DD_API_KEY} | ||
ports: | ||
- 7001 | ||
- 8545 | ||
- 8546 | ||
- 9876 | ||
|
||
bob: | ||
platform: linux/amd64 | ||
build: | ||
context: ./.. | ||
dockerfile: devnet/substrate_bob.Dockerfile | ||
args: | ||
key: bob | ||
DD_API_KEY: ${DD_API_KEY} | ||
ports: | ||
- 7001 | ||
- 8545 | ||
- 8546 | ||
- 9876 | ||
depends_on: | ||
- alice | ||
|
||
charlie: | ||
platform: linux/amd64 | ||
build: | ||
context: ./.. | ||
dockerfile: devnet/substrate_bob.Dockerfile | ||
args: | ||
key: charlie | ||
DD_API_KEY: ${DD_API_KEY} | ||
ports: | ||
- 7001 | ||
- 8545 | ||
- 8546 | ||
- 9876 | ||
depends_on: | ||
- alice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright 2022 ChainSafe Systems (ON) | ||
# SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
ARG POLKADOT_VERSION=v0.9.10 | ||
|
||
FROM golang:1.17 as openmetrics | ||
ARG METRICS_NAMESPACE=substrate.local.devnet | ||
|
||
WORKDIR /devnet | ||
|
||
COPY ./devnet/go.mod ./devnet/go.sum ./ | ||
RUN go mod download | ||
|
||
COPY ./devnet . | ||
RUN go run cmd/update-dd-agent-confd/main.go -n=${METRICS_NAMESPACE} -t=key:alice > conf.yaml | ||
|
||
FROM parity/polkadot:${POLKADOT_VERSION} | ||
|
||
ARG POLKADOT_VERSION | ||
# Using a genesis file with 3 authority nodes (alice, bob, charlie) generated using polkadot $POLKADOT_VERSION | ||
ARG CHAIN=3-auth-node-${POLKADOT_VERSION} | ||
ARG DD_API_KEY=somekey | ||
|
||
ENV DD_API_KEY=${DD_API_KEY} | ||
ENV CHAIN=${CHAIN} | ||
|
||
USER root | ||
RUN gpg --recv-keys --keyserver hkps://keys.mailvelope.com 9D4B2B6EB8F97156D19669A9FF0812D491B96798 | ||
RUN gpg --export 9D4B2B6EB8F97156D19669A9FF0812D491B96798 > /usr/share/keyrings/parity.gpg | ||
RUN apt update && apt install -y curl && rm -r /var/cache/* /var/lib/apt/lists/* | ||
|
||
WORKDIR /cross-client | ||
|
||
RUN curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh --output install_script.sh && \ | ||
chmod +x ./install_script.sh | ||
|
||
RUN DD_AGENT_MAJOR_VERSION=7 DD_INSTALL_ONLY=true DD_SITE="datadoghq.com" ./install_script.sh | ||
COPY --from=openmetrics /devnet/conf.yaml /etc/datadog-agent/conf.d/openmetrics.d/ | ||
|
||
USER polkadot | ||
|
||
COPY ./devnet/chain ./chain/ | ||
|
||
# The substrate node-key argument should be a 32 bytes long sr25519 secret key | ||
# while gossamer nodes uses a 64 bytes long sr25519 key (32 bytes long to secret key + 32 bytes long to public key). | ||
# Then to keep both substrate and gossamer alice nodes with the same libp2p node keys we just need to use | ||
# the first 32 bytes from `alice.node.key` which means the 32 bytes long sr25519 secret key used here. | ||
ENTRYPOINT service datadog-agent start && /usr/bin/polkadot \ | ||
--chain ./chain/$CHAIN/genesis-raw.json \ | ||
--alice \ | ||
--port 7001 \ | ||
--rpc-port 8545 \ | ||
--ws-port 8546 \ | ||
--node-key "93ce444331ced4d2f7bfb8296267544e20c2591dbf310c7ea3af672f2879cf8f" \ | ||
--tmp \ | ||
--prometheus-external \ | ||
--prometheus-port 9876 \ | ||
--unsafe-rpc-external \ | ||
--unsafe-ws-external | ||
|
||
EXPOSE 7001/tcp 8545/tcp 8546/tcp 9876/tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright 2022 ChainSafe Systems (ON) | ||
# SPDX-License-Identifier: LGPL-3.0-only | ||
ARG POLKADOT_VERSION=v0.9.10 | ||
FROM golang:1.17 as openmetrics | ||
|
||
ARG METRICS_NAMESPACE=substrate.local.devnet | ||
|
||
WORKDIR /devnet | ||
|
||
COPY ./devnet/go.mod ./devnet/go.sum ./ | ||
RUN go mod download | ||
|
||
COPY ./devnet . | ||
RUN go run cmd/update-dd-agent-confd/main.go -n=${METRICS_NAMESPACE} -t=key:alice > conf.yaml | ||
|
||
FROM parity/polkadot:${POLKADOT_VERSION} | ||
|
||
ARG POLKADOT_VERSION | ||
# Using a genesis file with 3 authority nodes (alice, bob, charlie) generated using polkadot $POLKADOT_VERSION | ||
ARG CHAIN=3-auth-node-${POLKADOT_VERSION} | ||
ARG DD_API_KEY=somekey | ||
ARG key | ||
|
||
ENV DD_API_KEY=${DD_API_KEY} | ||
ENV CHAIN=${CHAIN} | ||
ENV key=${key} | ||
|
||
USER root | ||
RUN gpg --recv-keys --keyserver hkps://keys.mailvelope.com 9D4B2B6EB8F97156D19669A9FF0812D491B96798 | ||
RUN gpg --export 9D4B2B6EB8F97156D19669A9FF0812D491B96798 > /usr/share/keyrings/parity.gpg | ||
|
||
RUN apt update && apt install -y curl && rm -r /var/cache/* /var/lib/apt/lists/* | ||
|
||
WORKDIR /cross-client | ||
|
||
RUN curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh --output install_script.sh && \ | ||
chmod +x ./install_script.sh | ||
|
||
RUN DD_AGENT_MAJOR_VERSION=7 DD_INSTALL_ONLY=true DD_SITE="datadoghq.com" ./install_script.sh | ||
COPY --from=openmetrics /devnet/conf.yaml /etc/datadog-agent/conf.d/openmetrics.d/ | ||
|
||
USER polkadot | ||
|
||
COPY ./devnet/chain ./chain/ | ||
|
||
ENTRYPOINT service datadog-agent start && /usr/bin/polkadot \ | ||
--bootnodes /dns/alice/tcp/7001/p2p/12D3KooWMER5iow67nScpWeVqEiRRx59PJ3xMMAYPTACYPRQbbWU \ | ||
--chain chain/$CHAIN/genesis-raw.json \ | ||
--port 7001 \ | ||
--rpc-port 8545 \ | ||
--ws-port 8546 \ | ||
--${key} \ | ||
--tmp \ | ||
--prometheus-external \ | ||
--prometheus-port 9876 \ | ||
--unsafe-rpc-external \ | ||
--unsafe-ws-external | ||
|
||
EXPOSE 7001/tcp 8545/tcp 8546/tcp 9876/tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters