-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d8da779
Showing
11 changed files
with
469 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Statescan | ||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
build-backend-image: | ||
name: Build Backend Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Statescan | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: opensquare-network/statescan-v2 | ||
ref: release-1.4.0 | ||
fetch-depth: 1 | ||
path: statescan-v2 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
clean: false | ||
fetch-depth: 1 | ||
sparse-checkout: | | ||
statescan | ||
path: kreivo-platform | ||
- name: Merge directories | ||
run: rsync --recursive kreivo-platform/statescan/ statescan-v2/ | ||
- name: Verify checkout | ||
run: ls -la statescan-v2/backend | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and Push Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: statescan-v2/backend | ||
push: true | ||
tags: ghcr.io/virto-network/kreivo-statescan-backend:${{ github.sha }} | ||
build-site-image: | ||
name: Build Site Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Statescan | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: opensquare-network/statescan-v2 | ||
ref: release-1.4.0 | ||
fetch-depth: 1 | ||
path: statescan-v2 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
clean: false | ||
fetch-depth: 1 | ||
sparse-checkout: | | ||
statescan | ||
path: kreivo-platform | ||
- name: Merge directories | ||
run: rsync --recursive kreivo-platform/statescan/ statescan-v2/ | ||
- name: Verify checkout | ||
run: ls -la statescan-v2/site | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and Push Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: statescan-v2/site | ||
push: true | ||
tags: ghcr.io/virto-network/kreivo-statescan-site:${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.github | ||
.husky | ||
.vscode | ||
node_modules | ||
|
||
.env | ||
.env.example | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mongo-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM node:22-alpine3.18 | ||
|
||
RUN mkdir -p /usr/statescan | ||
WORKDIR /usr/statescan | ||
|
||
COPY package.json yarn.lock /usr/statescan/ | ||
COPY packages/ /usr/statescan/packages/ | ||
|
||
RUN yarn install | ||
|
||
WORKDIR /usr/statescan/packages | ||
|
||
CMD ["node", "src/index.js"] |
73 changes: 73 additions & 0 deletions
73
statescan/backend/packages/server/src/utils/consts/chains.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const chains = Object.freeze({ | ||
polkadot: "polkadot", | ||
kusama: "kusama", | ||
statemine: "statemine", | ||
statemint: "statemint", | ||
westmint: "westmint", | ||
litentry: "litentry", | ||
litmus: "litmus", | ||
"westend-collectives": "westend-collectives", | ||
collectives: "collectives", | ||
"hydradx-testnet": "hydradx-testnet", | ||
polimec: "polimec", | ||
shadow: "shadow", | ||
gargantua: "gargantua", | ||
"polkadot-crust-parachain": "polkadot-crust-parachain", | ||
tangle: "tangle", | ||
"tangle-testnet": "tangle-testnet", | ||
heiko: "heiko", | ||
parallel: "parallel", | ||
crust: "crust", | ||
invarch: "invarch", | ||
tinkernet: "tinkernet", | ||
subsocial: "kreivo", | ||
}); | ||
|
||
const ss58Format = Object.freeze({ | ||
[chains.polkadot]: 0, | ||
[chains.kusama]: 2, | ||
[chains.statemine]: 2, | ||
[chains.statemint]: 0, | ||
[chains.westmint]: 42, | ||
[chains.litentry]: 31, | ||
[chains.litmus]: 131, | ||
[chains.collectives]: 0, | ||
[chains["westend-collectives"]]: 0, | ||
[chains["hydradx-testnet"]]: 63, | ||
[chains.polimec]: 41, | ||
[chains.shadow]: 66, | ||
[chains.gargantua]: 42, | ||
[chains["polkadot-crust-parachain"]]: 88, | ||
[chains.tangle]: 5845, | ||
[chains["tangle-testnet"]]: 42, | ||
[chains.heiko]: 110, | ||
[chains.parallel]: 172, | ||
[chains.crust]: 66, | ||
[chains.invarch]: 117, | ||
[chains.tinkernet]: 117, | ||
[chains.kreivo]: 2, | ||
}); | ||
|
||
function getSs58Format(chain) { | ||
return ss58Format[chain]; | ||
} | ||
|
||
const assetsModuleChains = [ | ||
chains.statemint, | ||
chains.statemine, | ||
chains.westmint, | ||
chains.parallel, | ||
]; | ||
|
||
const uniquesModuleChains = [ | ||
chains.statemint, | ||
chains.statemine, | ||
chains.westmint, | ||
]; | ||
|
||
module.exports = { | ||
chains, | ||
assetsModuleChains, | ||
uniquesModuleChains, | ||
getSs58Format, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
version: '3.7' | ||
|
||
x-common-arguments: &common-arguments | ||
REACT_APP_PUBLIC_API_END_POINT: https://api-explorer.subsocial.network/ | ||
REACT_APP_PUBLIC_SIMPLE_MODE: "true" | ||
|
||
x-common-variables: &common-variables | ||
MONGO_DB_META_NAME: meta-subsocial | ||
MONGO_META_URL: mongodb://mongodb:27017 | ||
MONGO_BLOCK_SCAN_URL: mongodb://mongodb:27017 | ||
MONGO_ACCOUNT_SCAN_URL: mongodb://mongodb:27017 | ||
MONGO_RUNTIME_SCAN_URL: mongodb://mongodb:27017 | ||
MONGO_ASSET_SCAN_URL: mongodb://mongodb:27017 | ||
MONGO_UNIQUES_SCAN_URL: mongodb://mongodb:27017 | ||
MONGO_DB_KNOWN_HEIGHTS_URL: mongodb://mongodb:27017 | ||
MONGO_BLOCK_SCAN_NAME: statescan-subsocial-block | ||
MONGO_ACCOUNT_SCAN_NAME: statescan-subsocial-account | ||
MONGO_RUNTIME_SCAN_NAME: statescan-subsocial-runtime | ||
MONGO_ASSET_SCAN_NAME: statescan-subsocial-asset | ||
MONGO_UNIQUES_SCAN_NAME: prod-statescan-subsocial-uniques | ||
CHAIN: subsocial | ||
WS_ENDPOINT: wss://para.f3joule.space | ||
USE_META: 1 | ||
SIMPLE_MODE: 1 | ||
LOG_LEVEL: info | ||
NODE_ENV: production | ||
|
||
services: | ||
mongodb: | ||
image: mongo:4.4.18 #image: mongodb/mongodb-community-server:6.0-ubi8 | ||
container_name: statescan-mongo | ||
restart: always | ||
ports: | ||
- "127.0.0.1:27100:27017" | ||
volumes: | ||
- ./mongo-data:/data/db | ||
|
||
account-scan: | ||
image: dappforce/statescan-subsocial:backend | ||
command: ["node", "account-scan/src/index.js"] | ||
build: | ||
context: backend | ||
dockerfile: Dockerfile | ||
container_name: account-scan | ||
restart: always | ||
environment: | ||
<<: *common-variables | ||
SCAN_STEP: 500 | ||
|
||
asset-scan: | ||
image: dappforce/statescan-subsocial:backend | ||
command: [ "node", "asset-scan/src/index.js" ] | ||
build: | ||
context: backend | ||
dockerfile: Dockerfile | ||
container_name: asset-scan | ||
restart: always | ||
environment: | ||
<<: *common-variables | ||
USE_KNOWN_HEIGHTS: 0 | ||
MONGO_DB_KNOWN_HEIGHTS_NAME: known-heights-statescan-subsocial-asset | ||
FOLLOW_BLOCK_SCAN: "true" | ||
SCAN_STEP: 500 | ||
|
||
block-scan: | ||
image: dappforce/statescan-subsocial:backend | ||
command: ["node", "block-scan/src/index.js"] | ||
container_name: block-scan | ||
restart: always | ||
environment: | ||
<<: *common-variables | ||
SCAN_STEP: 500 | ||
|
||
runtime-scan: | ||
image: dappforce/statescan-subsocial:backend | ||
command: ["node", "runtime-scan/src/index.js"] | ||
container_name: runtime-scan | ||
restart: always | ||
environment: | ||
<<: *common-variables | ||
SCAN_STEP: 500 | ||
|
||
rest-api: | ||
image: dappforce/statescan-subsocial:backend | ||
command: ["node", "server/src/index.js"] | ||
container_name: rest-api | ||
restart: always | ||
ports: | ||
- "127.0.0.1:5010:5010" | ||
environment: | ||
<<: *common-variables | ||
PORT: 5010 | ||
VIRTUAL_HOST: api-explorer.subsocial.network | ||
VIRTUAL_PORT: 5010 | ||
VIRTUAL_PATH: / | ||
LETSENCRYPT_HOST: api-explorer.subsocial.network | ||
LETSENCRYPT_EMAIL: [email protected] | ||
|
||
web-app: | ||
image: dappforce/statescan-subsocial:web-app | ||
build: | ||
context: site | ||
dockerfile: Dockerfile | ||
args: | ||
<<: *common-arguments | ||
environment: | ||
VIRTUAL_HOST: explorer.subsocial.network | ||
VIRTUAL_PORT: 3000 | ||
VIRTUAL_PATH: / | ||
LETSENCRYPT_HOST: explorer.subsocial.network | ||
LETSENCRYPT_EMAIL: [email protected] | ||
container_name: web-app | ||
restart: always | ||
ports: | ||
- "127.0.0.1:3000:3000" | ||
|
||
networks: | ||
default: | ||
name: net-explorer | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM node:20-alpine3.18 as builder | ||
|
||
WORKDIR /usr/app | ||
|
||
COPY package.json yarn.lock .eslintrc.cjs .yarnrc.yml /usr/app/ | ||
COPY .yarn/ /usr/app/.yarn/ | ||
|
||
RUN yarn install | ||
|
||
ARG REACT_APP_PUBLIC_API_END_POINT | ||
ARG REACT_APP_PUBLIC_SIMPLE_MODE | ||
|
||
ENV REACT_APP_PUBLIC_API_END_POINT $REACT_APP_PUBLIC_API_END_POINT | ||
ENV REACT_APP_PUBLIC_SIMPLE_MODE $REACT_APP_PUBLIC_SIMPLE_MODE | ||
ENV REACT_APP_PUBLIC_CHAIN kreivo | ||
ENV REACT_APP_DEFAULT_IPFS_GATEWAY https://cloudflare-ipfs.com/ipfs/ | ||
|
||
COPY public/ /usr/app/public/ | ||
COPY src/ /usr/app/src/ | ||
|
||
RUN yarn build | ||
|
||
FROM node:20-alpine3.18 | ||
|
||
WORKDIR /usr/statescan | ||
RUN npm i -g serve | ||
|
||
COPY --from=builder /usr/app/node_modules/ /usr/statescan/node_modules/ | ||
COPY --from=builder /usr/app/build/ /usr/statescan/app/ | ||
|
||
CMD ["serve", "-s", "app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, user-scalable=no" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta name="description" content="Explorer for Kreivo" /> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>Kreivo Explorer</title> | ||
</head> | ||
|
||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
|
||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.