Skip to content

Commit

Permalink
Merge branch 'Main' into dependabot/cargo/backend/h2-0.3.21
Browse files Browse the repository at this point in the history
Signed-off-by: Cryptob3auty <[email protected]>
  • Loading branch information
Rose2161 authored Feb 21, 2024
2 parents 03e8586 + 053085b commit 3c650c1
Show file tree
Hide file tree
Showing 138 changed files with 18,169 additions and 13,181 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/backend_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -37,7 +37,7 @@ jobs:
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
workspaces: backend

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backend_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -37,7 +37,7 @@ jobs:
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
workspaces: backend

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backend_fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backend_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -37,7 +37,7 @@ jobs:
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
workspaces: backend

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: install
run: yarn install
- name: Install
run: npm install

- name: check
run: yarn pretty:check
- name: Check
run: npm run pretty:check

- name: Test
run: yarn test
run: npm run test

- name: Build
run: yarn build
run: npm run build
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ build
env-config.js

npm-debug.log*
yarn-debug.log*
yarn-error.log*
npm-error.log*
.vscode
.nyc
154 changes: 93 additions & 61 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,14 @@ variables:
CONTAINER_REPO: ""
DOCKERFILE_DIRECTORY: ""

# Deploy Variables (Mandatory)
HELM_NAMESPACE: "substrate-telemetry"
HELM_RELEASE_NAME: "substrate-telemetry"
HELM_CHART: "parity/substrate-telemetry"

# Deploy Variables (Optional)
HELM_REPO_NAME: "parity"
HELM_REPO_URL: "https://paritytech.github.io/helm-charts/"
HELM_CONFIGMAP_NAME: "helm-custom-values"
HELM_CONFIGMAP_KEYNAME: "values-parity.yaml"

# Manual Variables (Optional)
## Could be used in the webconsole when triggering the pipeline manually
## DO NOT SET THEM IN THIS FILE!! They've been mentioned here only for documentation purposes!
FORCE_DEPLOY: "" # boolean: true or false - triggers the deploy-production stage
FORCE_DOCKER_TAG: "" # choose an existing docker tag to be deployed (e.g. v1.2.3)
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29"
BUILDAH_COMMAND: "buildah --storage-driver overlay2"

default:
before_script:
Expand Down Expand Up @@ -58,29 +50,29 @@ stages:
# Pipeline Job Templates:
.dockerize: &dockerize
stage: build
image: quay.io/buildah/stable:v1.27
image: $BUILDAH_IMAGE
script:
- |-
echo building "$CONTAINER_REPO:$DOCKER_IMAGE_TAG"
if [[ $BUILD_LATEST_IMAGE ]]; then
buildah bud \
$BUILDAH_COMMAND build \
--format=docker \
--tag "$CONTAINER_REPO:$DOCKER_IMAGE_TAG" \
--tag "$CONTAINER_REPO:latest" "$DOCKERFILE_DIRECTORY"
else
buildah bud \
$BUILDAH_COMMAND build \
--format=docker \
--tag "$CONTAINER_REPO:$DOCKER_IMAGE_TAG" "$DOCKERFILE_DIRECTORY"
fi
- echo ${Docker_Hub_Pass_Parity} |
buildah login --username ${Docker_Hub_User_Parity} --password-stdin docker.io
- echo ${DOCKER_PASSWORD} |
buildah login --username ${DOCKER_USERNAME} --password-stdin docker.io
- |-
echo pushing "$CONTAINER_REPO:$DOCKER_IMAGE_TAG"
if [[ $BUILD_LATEST_IMAGE ]]; then
buildah push --format=v2s2 "$CONTAINER_REPO:$DOCKER_IMAGE_TAG"
buildah push --format=v2s2 "$CONTAINER_REPO:latest"
$BUILDAH_COMMAND push --format=v2s2 "$CONTAINER_REPO:$DOCKER_IMAGE_TAG"
$BUILDAH_COMMAND push --format=v2s2 "$CONTAINER_REPO:latest"
else
buildah push --format=v2s2 "$CONTAINER_REPO:$DOCKER_IMAGE_TAG"
$BUILDAH_COMMAND push --format=v2s2 "$CONTAINER_REPO:$DOCKER_IMAGE_TAG"
fi
rules:
- if: '$FORCE_DOCKER_TAG'
Expand All @@ -92,38 +84,41 @@ stages:
tags:
- kubernetes-parity-build

.publish-docker-image-description:
stage: build
image: paritytech/dockerhub-description
before_script:
- echo
variables:
DOCKERHUB_REPOSITORY: parity/substrate-telemetry-$PRODUCT
DOCKER_USERNAME: $Docker_Hub_User_Parity
DOCKER_PASSWORD: $Docker_Hub_Pass_Parity
README_FILEPATH: $CI_PROJECT_DIR/$PRODUCT/Dockerfile.README.md
rules:
- if: $CI_COMMIT_REF_NAME == "master"
changes:
- $PRODUCT/Dockerfile.README.md
script:
- cd / && sh entrypoint.sh
tags:
- kubernetes-parity-build

.deploy: &deploy
image: paritytech/kubetools:3.5.3
image: quay.io/argoproj/argocd:v2.7.9
variables:
ARGOCD_OPTS: --grpc-web --grpc-web-root-path /$ENVIRONMENT
APP: substrate-telemetry
environment:
name: $ENVIRONMENT
script:
- |-
echo generating an empty custom-values.yaml file
touch custom-values.yaml
- |-
echo fetching the custom values file from the configmap if HELM_CONFIGMAP_NAME is specified
if [[ $HELM_CONFIGMAP_NAME ]]; then
# escape dot characters
HELM_CONFIGMAP_KEYNAME=`echo $HELM_CONFIGMAP_KEYNAME | sed 's/\./\\\./g'`
kubectl get cm $HELM_CONFIGMAP_NAME -n $HELM_NAMESPACE -o jsonpath="{.data.$HELM_CONFIGMAP_KEYNAME}" \
> custom-values.yaml
fi
- |-
echo adding the helm repository if HELM_REPO_URL is specified
if [[ $HELM_REPO_URL ]]; then
helm repo add $HELM_REPO_NAME $HELM_REPO_URL
helm repo update
fi
- echo installing the helm chart
- helm upgrade
--install
--atomic
--timeout 300s
--namespace $HELM_NAMESPACE
--values custom-values.yaml
--set image.backend.repository="${CONTAINER_REPO_BACKEND}"
--set image.backend.tag="${DOCKER_IMAGE_TAG}"
--set image.frontend.repository="${CONTAINER_REPO_FRONTEND}"
--set image.frontend.tag="${DOCKER_IMAGE_TAG}"
${HELM_RELEASE_NAME} ${HELM_CHART}
- argocd app list
- argocd app set $APP
--helm-set substrate-telemetry.image.backend.repository="${CONTAINER_REPO_BACKEND}"
--helm-set substrate-telemetry.image.backend.tag="${DOCKER_IMAGE_TAG}"
--helm-set substrate-telemetry.image.frontend.repository="${CONTAINER_REPO_FRONTEND}"
--helm-set substrate-telemetry.image.frontend.tag="${DOCKER_IMAGE_TAG}"
- argocd app sync $APP
- argocd app wait $APP --timeout 180
tags:
- kubernetes-parity-build

Expand All @@ -133,34 +128,72 @@ build-backend:
variables:
CONTAINER_REPO: "docker.io/parity/substrate-telemetry-backend"
DOCKERFILE_DIRECTORY: "./backend/"
DOCKER_USERNAME: $Docker_Hub_User_Parity
DOCKER_PASSWORD: $Docker_Hub_Pass_Parity
<<: *dockerize

build-frontend:
variables:
CONTAINER_REPO: "docker.io/parity/substrate-telemetry-frontend"
DOCKERFILE_DIRECTORY: "./frontend/"
DOCKER_USERNAME: $Docker_Hub_User_Parity
DOCKER_PASSWORD: $Docker_Hub_Pass_Parity
<<: *dockerize

publish-backend-docker-image-description:
extends: .publish-docker-image-description
variables:
PRODUCT: backend
SHORT_DESCRIPTION: "substrate-backend Docker Image."

publish-frontend-docker-image-description:
extends: .publish-docker-image-description
variables:
PRODUCT: frontend
SHORT_DESCRIPTION: "substrate-frontend Docker Image."

# Manually build the docker images and deploy some commit to staging.
build-backend-manual:
variables:
CONTAINER_REPO: "docker.io/paritypr/substrate-telemetry-backend"
DOCKERFILE_DIRECTORY: "./backend/"
DOCKER_USERNAME: $PARITYPR_USER
DOCKER_PASSWORD: $PARITYPR_PASS
<<: *dockerize
rules:
- if: '$CI_COMMIT_BRANCH =~ /^[0-9]+/'
when: manual

build-frontend-manual:
variables:
CONTAINER_REPO: "docker.io/paritypr/substrate-telemetry-frontend"
DOCKERFILE_DIRECTORY: "./frontend/"
DOCKER_USERNAME: $PARITYPR_USER
DOCKER_PASSWORD: $PARITYPR_PASS
<<: *dockerize
rules:
- if: '$CI_COMMIT_BRANCH =~ /^[0-9]+/'
when: manual

deploy-commit-to-staging:
variables:
CONTAINER_REPO_BACKEND: "docker.io/parity/substrate-telemetry-backend"
CONTAINER_REPO_FRONTEND: "docker.io/parity/substrate-telemetry-frontend"
CONTAINER_REPO_BACKEND: "docker.io/paritypr/substrate-telemetry-backend"
CONTAINER_REPO_FRONTEND: "docker.io/paritypr/substrate-telemetry-frontend"
ENVIRONMENT: "parity-stg"
stage: deploy-commit-to-staging
<<: *deploy
environment:
name: parity-stg
when: manual
extends: .deploy
rules:
- if: '$CI_COMMIT_BRANCH =~ /^[0-9]+/'
when: manual

# Autoamtically deploy `master` branch or tag like `v1.0` to staging
# Automatically deploy `master` branch or tag like `v1.0` to staging
deploy-master-to-staging:
variables:
CONTAINER_REPO_BACKEND: "docker.io/parity/substrate-telemetry-backend"
CONTAINER_REPO_FRONTEND: "docker.io/parity/substrate-telemetry-frontend"
ENVIRONMENT: "parity-stg"
stage: deploy-master-to-staging
<<: *deploy
environment:
name: parity-stg
extends: .deploy
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+.*$/' # i.e. v1.0, v2.1rc1
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Expand All @@ -170,10 +203,9 @@ deploy-production:
variables:
CONTAINER_REPO_BACKEND: "docker.io/parity/substrate-telemetry-backend"
CONTAINER_REPO_FRONTEND: "docker.io/parity/substrate-telemetry-frontend"
ENVIRONMENT: "parity-prod"
stage: deploy-production
<<: *deploy
environment:
name: parity-prod
extends: .deploy
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+.*$/' # i.e. v1.0, v2.1rc1
when: manual
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To run the frontend make sure to grab the latest stable version of node and inst

```sh
nvm install stable
(cd frontend && yarn)
(cd frontend && npm install)
```

### Terminal 1 & 2 - Backend
Expand Down Expand Up @@ -72,8 +72,8 @@ By default, `telemetry_core` will listen on 127.0.0.1:8000, and `telemetry_shard

```sh
cd frontend
yarn install
yarn start
npm install
npm run start
```

Once this is running, you'll be able to navigate to [http://localhost:3000](http://localhost:3000) to view the UI.
Expand Down
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
Loading

0 comments on commit 3c650c1

Please sign in to comment.