kopia lustrzana https://github.com/bugout-dev/moonstream
Status page with nodes blocks
rodzic
0cc1bb8f9e
commit
21c51a6427
|
@ -3,7 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"dev": "next dev --hostname 127.0.0.1",
|
||||
"build": "next build && next export -o build",
|
||||
"start": "next start",
|
||||
"lint": "eslint ./ --ext js,jsx,ts,tsx --fix",
|
||||
|
|
|
@ -14,14 +14,43 @@ const Status = () => {
|
|||
};
|
||||
|
||||
const {
|
||||
apiServerStatusCache,
|
||||
ethereumClusterServerStatusCache,
|
||||
gethStatusCache,
|
||||
serverListStatusCache,
|
||||
crawlersStatusCache,
|
||||
dbServerStatusCache,
|
||||
latestBlockDBStatusCache,
|
||||
} = useStatus();
|
||||
|
||||
const moonstreamapiStatus = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "moonstreamapi"
|
||||
)[0];
|
||||
const moonstreamCrawlersStatus = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "moonstream_crawlers"
|
||||
)[0];
|
||||
const nodeEthereumAStatus = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_ethereum_a"
|
||||
)[0];
|
||||
const nodeEthereumAGeth = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_ethereum_a_geth"
|
||||
)[0];
|
||||
const nodeEthereumBStatus = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_ethereum_b"
|
||||
)[0];
|
||||
const nodeEthereumBGeth = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_ethereum_b_geth"
|
||||
)[0];
|
||||
const nodePolygonAStatus = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_polygon_a"
|
||||
)[0];
|
||||
const nodePolygonAGeth = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_polygon_a_geth"
|
||||
)[0];
|
||||
const nodePolygonBStatus = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_polygon_b"
|
||||
)[0];
|
||||
const nodePolygonBGeth = serverListStatusCache?.data?.filter(
|
||||
(i) => i.status.name === "node_polygon_b_geth"
|
||||
)[0];
|
||||
|
||||
const StatusRow = (props) => {
|
||||
console.log(props.cache.data);
|
||||
return (
|
||||
|
@ -46,43 +75,22 @@ const Status = () => {
|
|||
{`Status page`}
|
||||
</Heading>
|
||||
<chakra.span pl={2} px={12} py={2} width="400px">
|
||||
<StatusRow title="Backend server" cache={apiServerStatusCache}>
|
||||
<StatusRow title="Backend server" cache={serverListStatusCache}>
|
||||
<Text
|
||||
color={
|
||||
apiServerStatusCache?.data?.status == "ok"
|
||||
moonstreamapiStatus?.status.body.status == "ok"
|
||||
? healthyStatusColor
|
||||
: downStatusColor
|
||||
}
|
||||
>
|
||||
{apiServerStatusCache?.data?.status == "ok"
|
||||
{moonstreamapiStatus?.status.body.status == "ok"
|
||||
? healthyStatusText
|
||||
: downStatusText}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
|
||||
<br />
|
||||
<StatusRow
|
||||
title="Crawlers server"
|
||||
cache={ethereumClusterServerStatusCache}
|
||||
>
|
||||
<Text
|
||||
color={
|
||||
ethereumClusterServerStatusCache?.data?.status == "ok"
|
||||
? healthyStatusColor
|
||||
: downStatusColor
|
||||
}
|
||||
>
|
||||
{ethereumClusterServerStatusCache?.data
|
||||
? healthyStatusText
|
||||
: downStatusText}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<StatusRow title="Latest block in Geth" cache={gethStatusCache}>
|
||||
<Text>
|
||||
{gethStatusCache?.data?.current_block
|
||||
? gethStatusCache.data.current_block
|
||||
: 0}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
|
||||
<StatusRow title="Txpool latest record ts" cache={crawlersStatusCache}>
|
||||
<Text>
|
||||
{crawlersStatusCache?.data?.ethereum_txpool_timestamp
|
||||
|
@ -106,6 +114,93 @@ const Status = () => {
|
|||
</StatusRow>
|
||||
|
||||
<br />
|
||||
|
||||
<StatusRow title="Node Ethereum A" cache={serverListStatusCache}>
|
||||
<Text
|
||||
color={
|
||||
nodeEthereumAStatus?.status.body.status == "ok"
|
||||
? healthyStatusColor
|
||||
: downStatusColor
|
||||
}
|
||||
>
|
||||
{nodeEthereumAStatus?.status.body.status == "ok"
|
||||
? healthyStatusText
|
||||
: downStatusText}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<StatusRow title="Node Ethereum A block" cache={serverListStatusCache}>
|
||||
<Text>
|
||||
{nodeEthereumAGeth?.status.body.current_block
|
||||
? nodeEthereumAGeth.status.body.current_block
|
||||
: 0}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<br />
|
||||
<StatusRow title="Node Ethereum B" cache={serverListStatusCache}>
|
||||
<Text
|
||||
color={
|
||||
nodeEthereumBStatus?.status.body.status == "ok"
|
||||
? healthyStatusColor
|
||||
: downStatusColor
|
||||
}
|
||||
>
|
||||
{nodeEthereumBStatus?.status.body.status == "ok"
|
||||
? healthyStatusText
|
||||
: downStatusText}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<StatusRow title="Node Ethereum B block" cache={serverListStatusCache}>
|
||||
<Text>
|
||||
{nodeEthereumBGeth?.status.body.current_block
|
||||
? nodeEthereumBGeth.status.body.current_block
|
||||
: 0}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<br />
|
||||
<StatusRow title="Node Polygon A" cache={serverListStatusCache}>
|
||||
<Text
|
||||
color={
|
||||
nodePolygonAStatus?.status.body.status == "ok"
|
||||
? healthyStatusColor
|
||||
: downStatusColor
|
||||
}
|
||||
>
|
||||
{nodePolygonAStatus?.status.body.status == "ok"
|
||||
? healthyStatusText
|
||||
: downStatusText}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<StatusRow title="Node Polygon A block" cache={serverListStatusCache}>
|
||||
<Text>
|
||||
{nodePolygonAGeth?.status.body.current_block
|
||||
? nodePolygonAGeth.status.body.current_block
|
||||
: 0}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<br />
|
||||
<StatusRow title="Node Polygon B" cache={serverListStatusCache}>
|
||||
<Text
|
||||
color={
|
||||
nodePolygonBStatus?.status.body.status == "ok"
|
||||
? healthyStatusColor
|
||||
: downStatusColor
|
||||
}
|
||||
>
|
||||
{nodePolygonBStatus?.status.body.status == "ok"
|
||||
? healthyStatusText
|
||||
: downStatusText}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
<StatusRow title="Node Polygon B block" cache={serverListStatusCache}>
|
||||
<Text>
|
||||
{nodePolygonBGeth?.status.body.current_block
|
||||
? nodePolygonBGeth.status.body.current_block
|
||||
: 0}
|
||||
</Text>
|
||||
</StatusRow>
|
||||
|
||||
<br />
|
||||
|
||||
<StatusRow title="Database server" cache={dbServerStatusCache}>
|
||||
<Text
|
||||
color={
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
export NEXT_PUBLIC_MIXPANEL_TOKEN="<YOUR MIXPANEL TOKEN HERE>"
|
||||
export NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="<stripe publishable key>"
|
||||
export NEXT_PUBLIC_MOONSTREAM_API_URL="<moonstream_api_url>"
|
||||
export NEXT_PUBLIC_MOONSTREAM_ETHEREUM_CLUSTER_URL="<moonstream_crawlers_url>"
|
||||
export NEXT_PUBLIC_MOONSTREAM_DB_URL="<moonstream_db_url>"
|
||||
export NEXT_PUBLIC_BUGOUT_STATUS_URL=https://status.moonstream.to
|
||||
export NEXT_PUBLIC_MOONSTREAM_API_URL=https://api.moonstream.to
|
||||
export NEXT_PUBLIC_MOONSTREAM_DB_URL=https://pg.moonstream.to
|
||||
export NEXT_PUBLIC_SIMIOTICS_AUTH_URL=https://auth.bugout.dev
|
||||
export NEXT_PUBLIC_SIMIOTICS_JOURNALS_URL=https://spire.bugout.dev
|
||||
export NEXT_PUBLIC_FRONTEND_VERSION="<frontend_version_number>"%
|
||||
|
||||
|
||||
export NEXT_PUBLIC_FRONTEND_VERSION="<frontend_version_number>"
|
||||
|
|
|
@ -3,16 +3,8 @@ import { queryCacheProps } from "./hookCommon";
|
|||
import { StatusService } from "../../core/services";
|
||||
|
||||
const useStatus = () => {
|
||||
const getAPIServerStatus = async () => {
|
||||
const response = await StatusService.apiServerStatus();
|
||||
return response.data;
|
||||
};
|
||||
const getEthereumClusterServerStatus = async () => {
|
||||
const response = await StatusService.ethereumClusterServerStatus();
|
||||
return response.data;
|
||||
};
|
||||
const getGethStatus = async () => {
|
||||
const response = await StatusService.gethStatus();
|
||||
const getServerListStatus = async () => {
|
||||
const response = await StatusService.serverListStatus();
|
||||
return response.data;
|
||||
};
|
||||
const getCrawlersStatus = async () => {
|
||||
|
@ -28,22 +20,14 @@ const useStatus = () => {
|
|||
return response.data;
|
||||
};
|
||||
|
||||
const apiServerStatusCache = useQuery("apiServer", getAPIServerStatus, {
|
||||
...queryCacheProps,
|
||||
retry: 0,
|
||||
});
|
||||
const ethereumClusterServerStatusCache = useQuery(
|
||||
"ethereumClusterServer",
|
||||
getEthereumClusterServerStatus,
|
||||
const serverListStatusCache = useQuery(
|
||||
"serverListStatus",
|
||||
getServerListStatus,
|
||||
{
|
||||
...queryCacheProps,
|
||||
retry: 0,
|
||||
}
|
||||
);
|
||||
const gethStatusCache = useQuery("geth", getGethStatus, {
|
||||
...queryCacheProps,
|
||||
retry: 0,
|
||||
});
|
||||
const crawlersStatusCache = useQuery("crawlers", getCrawlersStatus, {
|
||||
...queryCacheProps,
|
||||
retry: 0,
|
||||
|
@ -62,9 +46,7 @@ const useStatus = () => {
|
|||
);
|
||||
|
||||
return {
|
||||
apiServerStatusCache,
|
||||
ethereumClusterServerStatusCache,
|
||||
gethStatusCache,
|
||||
serverListStatusCache,
|
||||
crawlersStatusCache,
|
||||
dbServerStatusCache,
|
||||
latestBlockDBStatusCache,
|
||||
|
|
|
@ -1,28 +1,13 @@
|
|||
import { http } from "../utils";
|
||||
|
||||
const BUGOUT_STATUS_URL = process.env.NEXT_PUBLIC_BUGOUT_STATUS_URL;
|
||||
const API_URL = process.env.NEXT_PUBLIC_MOONSTREAM_API_URL;
|
||||
const DB_URL = process.env.NEXT_PUBLIC_MOONSTREAM_DB_URL;
|
||||
const ETHEREUM_CLUSTER_URL =
|
||||
process.env.NEXT_PUBLIC_MOONSTREAM_ETHEREUM_CLUSTER_URL;
|
||||
|
||||
export const apiServerStatus = () => {
|
||||
export const serverListStatus = () => {
|
||||
return http({
|
||||
method: "GET",
|
||||
url: `${API_URL}/ping`,
|
||||
});
|
||||
};
|
||||
|
||||
export const ethereumClusterServerStatus = () => {
|
||||
return http({
|
||||
method: "GET",
|
||||
url: `${ETHEREUM_CLUSTER_URL}/ping`,
|
||||
});
|
||||
};
|
||||
|
||||
export const gethStatus = () => {
|
||||
return http({
|
||||
method: "GET",
|
||||
url: `${ETHEREUM_CLUSTER_URL}/status`,
|
||||
url: `${BUGOUT_STATUS_URL}`,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue