From 820d20c10241c7a6645787acc6902f4c6993a4bc Mon Sep 17 00:00:00 2001 From: Haiko Schol Date: Tue, 10 Dec 2024 11:09:51 +0700 Subject: [PATCH 1/3] chore(docker): clean up Dockerfile.development - Remove Datadog vestiges - Remove running "gossamer init" during Docker build - Use the same entrypoint as the main Dockerfile to ease deployment --- Dockerfile.development | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile.development b/Dockerfile.development index 01c8c5cc4f..0bcf8d736a 100644 --- a/Dockerfile.development +++ b/Dockerfile.development @@ -2,7 +2,6 @@ FROM golang:1.23 ARG chain="polkadot" ARG basepath="~/.local/share/gossamer" -ARG DD_API_KEY ENV chain=${chain} ENV GSSMRHOME=${basepath} @@ -11,9 +10,12 @@ WORKDIR /gossamer COPY . . -RUN go get ./... -RUN go install -trimpath github.com/ChainSafe/gossamer/cmd/gossamer +ARG GO_BUILD_FLAGS +RUN go build \ + -trimpath \ + -o /gossamer/bin/gossamer \ + ${GO_BUILD_FLAGS} \ + ./cmd/gossamer -RUN ["sh", "-c", "gossamer init --chain=${chain} --base-path=${basepath}/${chain}"] -ENTRYPOINT ["sh", "-c", "gossamer --chain=${chain} --base-path=${basepath}/${chain} --rpc-external=true --unsafe-rpc=true --prometheus-external --prometheus-port=9876 --pprof.enabled --pprof.listening-address=\":6060\""] EXPOSE 7001 8545 8546 8540 9876 6060 +ENTRYPOINT [ "/gossamer/bin/gossamer" ] From ea484c9e09bee5df6b98c79cf3123f7ed251743d Mon Sep 17 00:00:00 2001 From: Haiko Schol Date: Tue, 10 Dec 2024 11:34:17 +0700 Subject: [PATCH 2/3] use the same Dockerfile for dev and staging envs --- .github/workflows/staging.yml | 2 +- Dockerfile.staging | 24 ------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 Dockerfile.staging diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index f2aadc34b1..61af219f4f 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -33,7 +33,7 @@ jobs: CHAIN: ${{ matrix.chain }} DD_API_KEY: ${{ secrets.DD_API_KEY }} run: | - docker build -f=Dockerfile.staging . --progress=plain -t=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg chain=$CHAIN --build-arg DD_API_KEY=$DD_API_KEY + docker build -f=Dockerfile.development . --progress=plain -t=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg chain=$CHAIN --build-arg DD_API_KEY=$DD_API_KEY docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" diff --git a/Dockerfile.staging b/Dockerfile.staging deleted file mode 100644 index eacc5e6a8c..0000000000 --- a/Dockerfile.staging +++ /dev/null @@ -1,24 +0,0 @@ -FROM golang:1.23 - -ARG chain="polkadot" -ARG basepath="~/.local/share/gossamer" -ARG DD_API_KEY - -ENV chain=${chain} -ENV GSSMRHOME=${basepath} -ENV DD_API_KEY=${DD_API_KEY} -ENV DD_HOSTNAME=${chain}-host - -RUN ["sh", "-c", "DD_AGENT_MAJOR_VERSION=7 DD_INSTALL_ONLY=true DD_API_KEY=${DD_API_KEY} DD_SITE=\"datadoghq.com\" bash -c \"$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)\""] - -WORKDIR /gossamer - -COPY . . -RUN ["sh", "-c", "mv .github/workflows/staging/openmetrics.d/${chain}-conf.yaml /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml"] - -RUN go get ./... -RUN go install -trimpath github.com/ChainSafe/gossamer/cmd/gossamer - -RUN ["sh", "-c", "gossamer init --chain=${chain} --base-path=${basepath}/${chain}"] -ENTRYPOINT ["sh", "-c", "service datadog-agent start && gossamer --chain=${chain} --base-path=${basepath}/${chain} --rpc-external=true --unsafe-rpc=true --prometheus-external --prometheus-port=9876 --pprof.enabled --pprof.listening-address=\":6060\""] -EXPOSE 7001 8545 8546 8540 9876 6060 From 862a62adbbf597fcadf5a781f976b73b4adcd70f Mon Sep 17 00:00:00 2001 From: Haiko Schol Date: Thu, 12 Dec 2024 20:47:14 +0700 Subject: [PATCH 3/3] remove unused GHA workflow --- .github/workflows/staging.yml | 54 -- .github/workflows/staging/kusama-taskdef.json | 49 -- .../staging/openmetrics.d/kusama-conf.yaml | 486 ------------------ .../staging/openmetrics.d/polkadot-conf.yaml | 486 ------------------ .../staging/openmetrics.d/westend-conf.yaml | 486 ------------------ .../workflows/staging/polkadot-taskdef.json | 49 -- .../workflows/staging/westend-taskdef.json | 53 -- 7 files changed, 1663 deletions(-) delete mode 100644 .github/workflows/staging.yml delete mode 100644 .github/workflows/staging/kusama-taskdef.json delete mode 100644 .github/workflows/staging/openmetrics.d/kusama-conf.yaml delete mode 100644 .github/workflows/staging/openmetrics.d/polkadot-conf.yaml delete mode 100644 .github/workflows/staging/openmetrics.d/westend-conf.yaml delete mode 100644 .github/workflows/staging/polkadot-taskdef.json delete mode 100644 .github/workflows/staging/westend-taskdef.json diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml deleted file mode 100644 index 61af219f4f..0000000000 --- a/.github/workflows/staging.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: staging -on: - push: - branches: - - staging - -jobs: - update: - strategy: - matrix: - chain: [polkadot, kusama, westend] - runs-on: buildjet-4vcpu-ubuntu-2204 - steps: - - uses: actions/checkout@v4 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-2 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Build, tag, and push image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: gossamer-${{ matrix.chain }} - IMAGE_TAG: ${{ github.sha }} - CHAIN: ${{ matrix.chain }} - DD_API_KEY: ${{ secrets.DD_API_KEY }} - run: | - docker build -f=Dockerfile.development . --progress=plain -t=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg chain=$CHAIN --build-arg DD_API_KEY=$DD_API_KEY - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" - - - name: Render Amazon ECS task definition - id: task-def - uses: aws-actions/amazon-ecs-render-task-definition@v1 - with: - task-definition: .github/workflows/staging/${{ matrix.chain }}-taskdef.json - container-name: gossamer-${{ matrix.chain }} - image: ${{ steps.build-image.outputs.image }} - - - name: Deploy Amazon ECS task definition - uses: aws-actions/amazon-ecs-deploy-task-definition@v2 - with: - task-definition: ${{ steps.task-def.outputs.task-definition }} - service: gossamer-${{ matrix.chain }}-svc - cluster: gossamer-stg - wait-for-service-stability: true diff --git a/.github/workflows/staging/kusama-taskdef.json b/.github/workflows/staging/kusama-taskdef.json deleted file mode 100644 index 3bbc41b41c..0000000000 --- a/.github/workflows/staging/kusama-taskdef.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "containerDefinitions": [ - { - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": "gossamer-staging-CWLogsGroup-wPH0S1xHYmq7", - "awslogs-region": "us-east-2", - "awslogs-stream-prefix": "ecs" - } - }, - "portMappings": [ - { - "containerPort": 7001, - "protocol": "tcp" - }, - { - "containerPort": 8546, - "protocol": "tcp" - }, - { - "containerPort": 8540, - "protocol": "tcp" - }, - { - "containerPort": 6060, - "protocol": "tcp" - } - ], - "environment": [], - "image": "500822580415.dkr.ecr.us-east-2.amazonaws.com/gossamer-kusama", - "essential": true, - "name": "gossamer-kusama" - } - ], - "placementConstraints": [ - { - "type": "memberOf", - "expression": "attribute:ecs.availability-zone==us-east-2a" - } - ], - "memory": "12288", - "family": "gossamer-kusama", - "networkMode": "host", - "requiresCompatibilities": [ - "EC2" - ], - "cpu": "4096" -} \ No newline at end of file diff --git a/.github/workflows/staging/openmetrics.d/kusama-conf.yaml b/.github/workflows/staging/openmetrics.d/kusama-conf.yaml deleted file mode 100644 index 5b2d2f8b85..0000000000 --- a/.github/workflows/staging/openmetrics.d/kusama-conf.yaml +++ /dev/null @@ -1,486 +0,0 @@ -## All options defined here are available to all instances. -# -init_config: - - ## @param proxy - mapping - optional - ## Set HTTP or HTTPS proxies for all instances. Use the `no_proxy` list - ## to specify hosts that must bypass proxies. - ## - ## The SOCKS protocol is also supported like so: - ## - ## socks5://user:pass@host:port - ## - ## Using the scheme `socks5` causes the DNS resolution to happen on the - ## client, rather than on the proxy server. This is in line with `curl`, - ## which uses the scheme to decide whether to do the DNS resolution on - ## the client or proxy. If you want to resolve the domains on the proxy - ## server, use `socks5h` as the scheme. - # - # proxy: - # http: http://: - # https: https://: - # no_proxy: - # - - # - - - ## @param skip_proxy - boolean - optional - default: false - ## If set to `true`, this makes the check bypass any proxy - ## settings enabled and attempt to reach services directly. - # - # skip_proxy: false - - ## @param timeout - number - optional - default: 10 - ## The timeout for connecting to services. - # - # timeout: 10 - - ## @param service - string - optional - ## Attach the tag `service:` to every metric, event, and service check emitted by this integration. - ## - ## Additionally, this sets the default `service` for every log source. - # - # service: - -## Every instance is scheduled independent of the others. -# -instances: - - ## @param prometheus_url - string - required - ## The URL where your application metrics are exposed by Prometheus. - # - - prometheus_url: http://127.0.0.1:9876/metrics - - ## @param namespace - string - required - ## The namespace to be prepended to all metrics. - # - namespace: gossamer.staging.kusama - - ## @param metrics - (list of string or mapping) - required - ## List of metrics to be fetched from the prometheus endpoint, if there's a - ## value it'll be renamed. This list should contain at least one metric. - # - metrics: - - gossamer_* - - go_* - - ## @param prometheus_metrics_prefix - string - optional - ## Removes a given from exposed Prometheus metrics. - # - # prometheus_metrics_prefix: _ - - ## @param health_service_check - boolean - optional - default: true - ## Send a service check reporting about the health of the Prometheus endpoint. - ## The service check is named .prometheus.health - # - # health_service_check: true - - ## @param label_to_hostname - string - optional - ## Override the hostname with the value of one label. - # - # label_to_hostname: