Skip to content

Commit

Permalink
Merge branch 'paritytech:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
antiyro authored Apr 18, 2024
2 parents 79868bc + 7bf2925 commit 1ccfd96
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backend_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
workspaces: backend

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backend_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
workspaces: backend

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backend_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
workspaces: backend

Expand Down
69 changes: 20 additions & 49 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ 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
Expand Down Expand Up @@ -114,37 +104,21 @@ stages:
- 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 Down Expand Up @@ -205,10 +179,9 @@ deploy-commit-to-staging:
variables:
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
extends: .deploy
rules:
- if: '$CI_COMMIT_BRANCH =~ /^[0-9]+/'
when: manual
Expand All @@ -218,10 +191,9 @@ 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 @@ -231,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
Binary file modified backend/telemetry_core/src/GeoLite2-City.mmdb
Binary file not shown.
14 changes: 8 additions & 6 deletions backend/telemetry_core/src/find_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ struct Locator {
}

impl Locator {
/// GeoLite database release data: 2023-10-13
///
/// GeoLite database release data: 2024-03-29
/// Database and Contents Copyright (c) 2024 MaxMind, Inc.
/// To download the latest version visit: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data.
///
/// This database incorporates GeoNames [https://www.geonames.org] geographical data, which is made available
/// under the Creative Commons Attribution 4.0 License.
/// To view a copy of this license,visit https://creativecommons.org/licenses/by/4.0/.
/// Use of this MaxMind product is governed by MaxMind's GeoLite2 End User License Agreement,
/// which can be viewed at https://www.maxmind.com/en/geolite2/eula.
/// This database incorporates GeoNames [https://www.geonames.org] geographical data,
/// which is made available under the Creative Commons Attribution 4.0 License.
/// To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/.
const CITY_DATA: &'static [u8] = include_bytes!("GeoLite2-City.mmdb");

pub fn new(cache: FxHashMap<IpAddr, Arc<NodeLocation>>) -> Self {
Expand Down Expand Up @@ -144,6 +146,6 @@ mod tests {
fn locate_random_ip() {
let ip = "12.5.56.25".parse().unwrap();
let node_location = Locator::new(Default::default()).locate(ip).unwrap();
assert_eq!(&*node_location.city, "Riverside");
assert_eq!(&*node_location.city, "Gardena");
}
}
2 changes: 1 addition & 1 deletion backend/telemetry_core/tests/e2e_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ async fn e2e_feed_add_and_remove_shard() {
}))
.unwrap();

// Keep what we need to to keep connection alive and let us kill a shard:
// Keep what we need to keep connection alive and let us kill a shard:
shards.push((shard_id, node_tx));
}

Expand Down
2 changes: 1 addition & 1 deletion backend/test_utils/src/server/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub enum ServerMode {
shards: DenseMap<ProcessId, ShardProcess>,
},
ConnectToExistingMode {
/// The hosts that we can connect to to submit things.
/// The hosts that we can connect to submit things.
submit_hosts: Vec<String>,
/// Which host do we use next (we'll cycle around them
/// as shards are "added").
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/List/Column/ImplementationColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import totemIcon from '../../../icons/totem.svg';
import nodleIcon from '../../../icons/nodle.svg';
import zeroIcon from '../../../icons/zero.svg';
import crustIcon from '../../../icons/crust.svg';
import gossamerIcon from '../../../icons/gossamer.svg';

const ICONS = {
'parity-polkadot': parityPolkadotIcon,
Expand All @@ -66,6 +67,7 @@ const ICONS = {
'Nodle Chain Node': nodleIcon,
subzero: zeroIcon,
Crust: crustIcon,
Gossamer: gossamerIcon,
};
const SEMVER_PATTERN = /^\d+\.\d+\.\d+/;

Expand Down
22 changes: 17 additions & 5 deletions frontend/src/components/List/Column/NetworkIdColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import * as React from 'react';
import { Maybe } from '../../../common';
import { ColumnProps } from './';
import { Node } from '../../../state';
import { Truncate } from '../../';
import { Tooltip } from '../../';
import { Tooltip, TooltipCopyCallback } from '../../';
import icon from '../../../icons/fingerprint.svg';

export class NetworkIdColumn extends React.Component<ColumnProps> {
Expand All @@ -30,6 +29,7 @@ export class NetworkIdColumn extends React.Component<ColumnProps> {
public static readonly sortBy = ({ networkId }: Node) => networkId || '';

private data: Maybe<string>;
private copy: Maybe<TooltipCopyCallback>;

public shouldComponentUpdate(nextProps: ColumnProps) {
return this.data !== nextProps.node.networkId;
Expand All @@ -45,10 +45,22 @@ export class NetworkIdColumn extends React.Component<ColumnProps> {
}

return (
<td className="Column">
<Tooltip text={networkId} position="left" />
<Truncate text={networkId} chars={10} />
<td className="Column" onClick={this.onClick}>
<Tooltip text={networkId} position="left" copy={this.onCopy} />
{networkId}
</td>
);
}

private onCopy = (copy: TooltipCopyCallback) => {
this.copy = copy;
};

private onClick = (event: React.MouseEvent) => {
event.stopPropagation();

if (this.copy != null) {
this.copy();
}
};
}
24 changes: 24 additions & 0 deletions frontend/src/icons/gossamer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1ccfd96

Please sign in to comment.