Skip to content

Commit

Permalink
chore: fix dd golang cmd
Browse files Browse the repository at this point in the history
chore: keep both cross-client and gssmr chain genesis raw

chore: mistakes
  • Loading branch information
EclesioMeloJunior committed Feb 4, 2022
1 parent f1fea2d commit 9b485f6
Show file tree
Hide file tree
Showing 9 changed files with 503 additions and 169 deletions.
8 changes: 6 additions & 2 deletions devnet/alice.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

FROM golang:1.17

ARG CHAIN=gssmr
ARG DD_API_KEY=somekey

ENV CHAIN=${CHAIN}
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
Expand All @@ -17,7 +21,7 @@ COPY . .
RUN go install -trimpath github.com/ChainSafe/gossamer/cmd/gossamer

# use modified genesis-spec.json with only 3 authority nodes
RUN cp -f devnet/chain/gssmr/genesis-raw.json chain/gssmr/genesis-spec.json
RUN cp -f devnet/chain/${CHAIN}/genesis-raw.json chain/gssmr/genesis-spec.json

RUN gossamer --key=alice init

Expand All @@ -34,4 +38,4 @@ WORKDIR /gossamer

ENTRYPOINT service datadog-agent start && gossamer --key=alice --babe-lead --publish-metrics --rpc --rpc-external=true --pubdns=alice

EXPOSE 7001/tcp 8545/tcp 8546/tcp 8540/tcp 9876/tcp 6060/tcp
EXPOSE 7001 8545 8546 8540 9876 6060
8 changes: 6 additions & 2 deletions devnet/bob.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

FROM golang:1.17

ARG CHAIN=gssmr
ARG DD_API_KEY=somekey

ENV CHAIN=${CHAIN}
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
Expand All @@ -17,7 +21,7 @@ COPY . .
RUN go install -trimpath github.com/ChainSafe/gossamer/cmd/gossamer

# use modified genesis-spec.json with only 3 authority nodes
RUN cp -f devnet/chain/gssmr/genesis-raw.json chain/gssmr/genesis-spec.json
RUN cp -f devnet/chain/${CHAIN}/genesis-raw.json chain/gssmr/genesis-spec.json

ARG key
RUN test -n "$key"
Expand All @@ -39,4 +43,4 @@ ENTRYPOINT service datadog-agent start && gossamer --key=${key} \
--rpc \
--pubdns=${key}

EXPOSE 7001/tcp 8545/tcp 8546/tcp 8540/tcp 9876/tcp 6060/tcp
EXPOSE 7001 8545 8546 8540 9876 6060/tcp
157 changes: 157 additions & 0 deletions devnet/chain/cross-client/genesis-raw.json

Large diffs are not rendered by default.

File renamed without changes.
449 changes: 295 additions & 154 deletions devnet/chain/gssmr/genesis-raw.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion devnet/docker-compose-substrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ services:
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- 9090:9090
- 9090
restart: always

alice:
platform: linux/amd64
build:
context: ./..
dockerfile: devnet/substrate_alice.Dockerfile
args:
DD_API_KEY: ${DD_API_KEY}
ports:
- 7001
- 8545
Expand All @@ -30,6 +32,7 @@ services:
dockerfile: devnet/substrate_bob.Dockerfile
args:
key: bob
DD_API_KEY: ${DD_API_KEY}
ports:
- 7001
- 8545
Expand All @@ -45,6 +48,7 @@ services:
dockerfile: devnet/substrate_bob.Dockerfile
args:
key: charlie
DD_API_KEY: ${DD_API_KEY}
ports:
- 7001
- 8545
Expand Down
20 changes: 16 additions & 4 deletions devnet/substrate_alice.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
FROM parity/polkadot:v0.9.10 as polkadot
FROM golang:1.17

ARG CHAIN=cross-client
ARG VERSION=v0.9.10
ARG DD_API_KEY=somekey
ARG METRICS_NAMESPACE=substrate.local.devnet
ARG NODE_KEY="93ce444331ced4d2f7bfb8296267544e20c2591dbf310c7ea3af672f2879cf8f"

ENV DD_API_KEY=${DD_API_KEY}
ENV CHAIN=${CHAIN}
ENV NODE_KEY=${NODE_KEY}
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)"

COPY --from=polkadot /usr/bin/polkadot /usr/bin/polkadot
COPY devnet/chain/gssmr/genesis-raw.json genesis-spec.json

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

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

COPY . .

ARG METRICS_NAMESPACE=substrate.local.devnet

WORKDIR /gossamer/devnet

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

ENTRYPOINT service datadog-agent start && /usr/bin/polkadot \
--chain genesis-spec.json \
--chain chain/${CHAIN}/genesis-raw.json \
--alice \
--port 7001 \
--rpc-port 8545 \
Expand Down
16 changes: 14 additions & 2 deletions devnet/substrate_bob.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,35 @@ FROM parity/polkadot:v0.9.10 as polkadot
FROM golang:1.17

ARG key
ARG CHAIN=cross-client
ARG DD_API_KEY=somekey
ARG METRICS_NAMESPACE=substrate.local.devnet

ENV key=${key}
ENV CHAIN=${CHAIN}
ENV DD_API_KEY=${DD_API_KEY}

RUN test -n "$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)"

COPY --from=polkadot /usr/bin/polkadot /usr/bin/polkadot
COPY devnet/chain/gssmr/genesis-raw.json genesis-spec.json

WORKDIR /gossamer

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

COPY . .

ARG METRICS_NAMESPACE=substrate.local.devnet

WORKDIR /gossamer/devnet

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

ENTRYPOINT service datadog-agent start && /usr/bin/polkadot \
--bootnodes /dns/alice/tcp/7001/p2p/12D3KooWMER5iow67nScpWeVqEiRRx59PJ3xMMAYPTACYPRQbbWU \
--chain genesis-spec.json \
--chain chain/${CHAIN}/genesis-raw.json \
--port 7001 \
--rpc-port 8545 \
--ws-port 8546 \
Expand Down
8 changes: 4 additions & 4 deletions prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: gossamer
- job_name: gossamer_alice
metrics_path: /metrics
static_configs:
- targets: ['host.docker.internal:9876']
- job_name: substrate
- targets: ['alice:9876']
- job_name: substrate_bob
static_configs:
- targets: ['alice:9615']
- targets: ['bob:9876']

0 comments on commit 9b485f6

Please sign in to comment.