Skip to content

Commit 0d7432c

Browse files
authored
Merge pull request #16 from filecoin-saturn/add-nodes-stats-dashboard
New nodes stats dashboard
2 parents 2060a39 + 951817c commit 0d7432c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+7284
-6256
lines changed

.env.development

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
VITE_ROOT_DOMAIN=saturn-test.network
1+
VITE_ROOT_DOMAIN=strn-test.network
22
VITE_METRICS_ORIGIN=https://ln3tnkd4d5uiufjgimi6jlkmci0bceff.lambda-url.us-west-2.on.aws/
3+
VITE_STATS_ORIGIN=https://orchestrator.strn-test.pl

.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
VITE_ROOT_DOMAIN=strn.network
22
VITE_METRICS_ORIGIN=https://uc2x7t32m6qmbscsljxoauwoae0yeipw.lambda-url.us-west-2.on.aws/
3+
VITE_STATS_ORIGIN=https://orchestrator.strn.pl

.env.webui

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
VITE_ROOT_DOMAIN=strn.network
2+
VITE_METRICS_ORIGIN=https://uc2x7t32m6qmbscsljxoauwoae0yeipw.lambda-url.us-west-2.on.aws/
3+
VITE_STATS_ORIGIN=https://orchestrator.strn.pl
4+
VITE_MODE_WEBUI=true

.github/workflows/ci.yml

Lines changed: 108 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,56 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v3
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: 18
22+
cache: npm
23+
24+
- run: npm ci
1925

20-
- name: Setup node
21-
uses: actions/setup-node@v2
26+
# Separate cache for build dir, we reuse it in release publish workflow
27+
- name: Cache build output
28+
if: startsWith(github.ref, 'refs/tags/v')
29+
uses: actions/cache@v3
30+
id: build-cache
2231
with:
23-
node-version: 16
32+
path: dist
33+
key: ${{ runner.os }}-${{ github.sha }}
34+
35+
- name: Confirm build works
36+
if: steps.build-cache.outputs.cache-hit != 'true'
37+
run: npm run build
2438

25-
- name: Cache bigger downloads
26-
uses: actions/cache@v2
27-
id: cache
39+
# Persist produced build dir:
40+
# - this is not for releases, but for quick testing during the dev
41+
# - action artifacts can be downloaded for 90 days, then are removed by github
42+
- name: Attach produced build to Github Action
43+
uses: actions/upload-artifact@v2
2844
with:
29-
path: ${{ github.workspace }}/.cache
30-
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
31-
restore-keys: |
32-
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
33-
${{ runner.os }}-
45+
name: saturn-${{ github.sha }}
46+
path: dist
47+
if-no-files-found: error
3448

35-
- name: Install dependencies
36-
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
49+
build-webui:
50+
name: build-webui
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: actions/setup-node@v3
55+
with:
56+
node-version: 18
57+
cache: npm
58+
59+
- run: npm ci
3760

3861
# Separate cache for build dir, we reuse it in release publish workflow
3962
- name: Cache build output
4063
if: startsWith(github.ref, 'refs/tags/v')
41-
uses: actions/cache@v2
64+
uses: actions/cache@v3
4265
id: build-cache
4366
with:
4467
path: dist
45-
key: ${{ runner.os }}-${{ github.sha }}
46-
restore-keys: |
47-
${{ runner.os }}-${{ github.sha }}
68+
key: ${{ runner.os }}-${{ github.sha }}-webui
4869

4970
- name: Confirm build works
5071
if: steps.build-cache.outputs.cache-hit != 'true'
@@ -56,97 +77,58 @@ jobs:
5677
- name: Attach produced build to Github Action
5778
uses: actions/upload-artifact@v2
5879
with:
59-
name: saturn-webui_${{ github.sha }}
80+
name: saturn-webui-${{ github.sha }}
6081
path: dist
6182
if-no-files-found: error
6283

6384
test-unit:
6485
name: "test:unit"
65-
needs: build
86+
needs: [build, build-webui]
6687
runs-on: ubuntu-latest
6788
steps:
6889
- uses: actions/checkout@v3
69-
70-
- name: Setup node
71-
uses: actions/setup-node@v2
72-
with:
73-
node-version: 16
74-
75-
- name: Cache bigger downloads
76-
uses: actions/cache@v2
77-
id: cache
90+
- uses: actions/setup-node@v3
7891
with:
79-
path: ${{ github.workspace }}/.cache
80-
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
81-
restore-keys: |
82-
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
83-
${{ runner.os }}-
92+
node-version: 18
93+
cache: npm
8494

85-
- name: Install dependencies
86-
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
95+
- run: npm ci
8796

8897
- name: Run unit tests
8998
run: npm run test:unit
9099

91100
test-e2e:
92101
name: "test:e2e"
93-
needs: build
102+
needs: [build, build-webui]
94103
runs-on: ubuntu-latest
95104
steps:
96105
- uses: actions/checkout@v3
97-
98-
- name: Setup node
99-
uses: actions/setup-node@v2
106+
- uses: actions/setup-node@v3
100107
with:
101-
node-version: 16
108+
node-version: 18
109+
cache: npm
102110

103-
- name: Cache bigger downloads
104-
uses: actions/cache@v2
105-
id: cache
106-
with:
107-
path: ${{ github.workspace }}/.cache
108-
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
109-
restore-keys: |
110-
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
111-
${{ runner.os }}-
112-
113-
- name: Install dependencies
114-
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
115-
116-
- name: Download build artifact
117-
uses: actions/download-artifact@v2
118-
with:
119-
name: saturn-webui_${{ github.sha }}
120-
path: dist
111+
- run: npm ci
121112

122113
- name: Run E2E tests
123114
run: npm run test:e2e
124115

116+
- name: Run WebUI E2E tests
117+
run: npm run test:webui-e2e
118+
125119
# separate check for TS
126120
typecheck:
127121
name: typecheck
128-
needs: build
122+
needs: [build, build-webui]
129123
runs-on: ubuntu-latest
130124
steps:
131125
- uses: actions/checkout@v3
132-
133-
- name: Setup node
134-
uses: actions/setup-node@v2
135-
with:
136-
node-version: 16
137-
138-
- name: Cache bigger downloads
139-
uses: actions/cache@v2
140-
id: cache
126+
- uses: actions/setup-node@v3
141127
with:
142-
path: ${{ github.workspace }}/.cache
143-
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
144-
restore-keys: |
145-
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
146-
${{ runner.os }}-
128+
node-version: 18
129+
cache: npm
147130

148-
- name: Install dependencies
149-
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
131+
- run: npm ci
150132

151133
- name: Fancy Typecheck with GH annotations
152134
uses: gozala/[email protected]
@@ -160,36 +142,60 @@ jobs:
160142
# separate check for eslint
161143
eslint:
162144
name: eslint
163-
needs: build
145+
needs: [build, build-webui]
164146
runs-on: ubuntu-latest
165147
steps:
166148
- uses: actions/checkout@v3
149+
- uses: actions/setup-node@v3
150+
with:
151+
node-version: 18
152+
cache: npm
167153

168-
- name: Setup node
169-
uses: actions/setup-node@v2
154+
- run: npm ci
155+
156+
- name: ESLint
157+
run: npm run eslint
158+
159+
release-webui:
160+
if: startsWith(github.ref, 'refs/tags/v')
161+
name: release-webui
162+
needs: [build, build-webui, test-unit, test-e2e, typecheck, eslint]
163+
runs-on: ubuntu-latest
164+
steps:
165+
- uses: actions/checkout@v3
166+
- uses: actions/setup-node@v3
170167
with:
171-
node-version: 16
168+
node-version: 18
169+
cache: npm
172170

173-
- name: Cache bigger downloads
174-
uses: actions/cache@v2
175-
id: cache
171+
# Reuse tag build
172+
- name: Cache build dir
173+
uses: actions/cache@v3
174+
id: build-cache
176175
with:
177-
path: ${{ github.workspace }}/.cache
178-
key: ${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
179-
restore-keys: |
180-
${{ runner.os }}-${{ hashFiles('package.json', 'package-lock.json') }}
181-
${{ runner.os }}-
176+
path: dist
177+
key: ${{ runner.os }}-${{ github.sha }}-webui
182178

183-
- name: Install dependencies
184-
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
179+
- name: Install and Build 🔧
180+
if: steps.build-cache.outputs.cache-hit != 'true'
181+
run: |
182+
npm ci
183+
npm run build
185184
186-
- name: ESLint
187-
run: npm run eslint
185+
- name: Create archive
186+
run: |
187+
cd dist
188+
tar -czf ../saturn-webui.tar.gz *
189+
190+
- name: Release
191+
uses: softprops/action-gh-release@v1
192+
with:
193+
files: saturn-webui.tar.gz
188194

189-
release:
195+
deploy:
190196
if: startsWith(github.ref, 'refs/tags/v')
191-
name: release
192-
needs: [build, test-unit, test-e2e, typecheck, eslint]
197+
name: deploy
198+
needs: [build, build-webui, test-unit, test-e2e, typecheck, eslint]
193199
runs-on: ubuntu-latest
194200
env:
195201
AWS_ACCESS_KEY_ID: ${{ secrets.PROD_GITHUB_CI_AWS_ACCESS_KEY_ID }}
@@ -201,23 +207,24 @@ jobs:
201207
id-token: write
202208
contents: read
203209
steps:
204-
- name: Checkout
205-
uses: actions/checkout@v3
210+
- uses: actions/checkout@v3
211+
- uses: actions/setup-node@v3
212+
with:
213+
node-version: 18
214+
cache: npm
206215

207216
# Reuse tag build
208217
- name: Cache build dir
209-
uses: actions/cache@v2
218+
uses: actions/cache@v3
210219
id: build-cache
211220
with:
212221
path: dist
213222
key: ${{ runner.os }}-${{ github.sha }}
214-
restore-keys: |
215-
${{ runner.os }}-${{ github.sha }}
216223

217224
- name: Install and Build 🔧
218225
if: steps.build-cache.outputs.cache-hit != 'true'
219226
run: |
220-
npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm
227+
npm ci
221228
npm run build
222229
223230
- name: Configure AWS Credentials
@@ -233,15 +240,5 @@ jobs:
233240
aws s3 cp dist/index.html s3://$BUCKET/index.html \
234241
--cache-control "no-cache" --only-show-errors
235242
236-
aws s3 cp dist/assets s3://$BUCKET/webui/assets/ --recursive \
243+
aws s3 cp dist/assets s3://$BUCKET/assets/ --recursive \
237244
--cache-control "public, max-age=2592000" --only-show-errors
238-
239-
- name: Create archive
240-
run: |
241-
cd dist
242-
tar -czf ../saturn-webui.tar.gz *
243-
244-
- name: Release
245-
uses: softprops/action-gh-release@v1
246-
with:
247-
files: saturn-webui.tar.gz

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,39 @@ Hosted at [https://dashboard.strn.network](https://dashboard.strn.network)
1111
## Install
1212

1313
```
14-
$ npm install
14+
npm install
1515
```
1616

1717
## Development
1818

1919
```
20-
$ npm run dev
20+
npm run dev
2121
```
2222

2323
This will start a development server for the frontend. Follow the Saturn L2 docs to setup the backend.
2424

25+
## WebUI
26+
27+
This dashboard apart from being served as a standalone website, is also embedded in L2 node in what is called webui mode. In this mode navigation bar is hidden and only the address page is accessible.
28+
29+
To develop dashboard in webui mode:
30+
31+
```
32+
npm run dev:webui
33+
```
34+
35+
To build dashboard in webui mode:
36+
37+
```
38+
npm run build:webui
39+
```
40+
41+
To preview webui dashboard build:
42+
43+
```
44+
npm run preview:webui
45+
```
46+
2547
## Tips
2648

2749
- Use the special "all" FIL wallet address to view metrics for all of Saturn.

0 commit comments

Comments
 (0)