Skip to content

Commit

Permalink
Collect chia version info
Browse files Browse the repository at this point in the history
felixbrucker committed Sep 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 35c40ac commit d297d34
Showing 7 changed files with 1,838 additions and 1,312 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Use current yarn
run: yarn set version stable
- name: yarn install
run: yarn install
- name: Package release archive
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yarn

# Runtime data
pids
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodeLinker: node-modules
enableGlobalCache: true
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM node:18-alpine

RUN apk update && apk add --no-cache bash
RUN yarn set version stable
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
18 changes: 18 additions & 0 deletions lib/service/stats-collection.js
Original file line number Diff line number Diff line change
@@ -18,13 +18,15 @@ const walletService = 'wallet';
const farmerService = 'farmer';
const harvesterService = 'harvester';
const plotterService = 'plotter';
const daemonService = 'daemon';

const allServices = [
fullNodeService,
walletService,
farmerService,
harvesterService,
plotterService,
daemonService,
];
const plotterStates = {
RUNNING: 'RUNNING',
@@ -320,6 +322,7 @@ class StatsCollection {

async updateStats() {
await Promise.all([
this.updateChiaVersion(),
this.updateWalletStats(),
this.updateHarvesterStats(),
])
@@ -445,6 +448,21 @@ class StatsCollection {
this.walletIsLoggedIn = true;
}

async updateChiaVersion() {
const daemonStats = this.stats.has(daemonService) ? this.stats.get(daemonService) : {};

const version = await this.daemonApiClient.getVersion()
let daemonPartialStats = undefined
if (daemonStats.version === undefined || daemonStats.version !== version) {
daemonPartialStats = { version }
}
daemonStats.version = version

if (daemonPartialStats !== undefined) {
await this.setStatsForService(daemonService, daemonStats, daemonPartialStats)
}
}

async updateWalletStats() {
if (!this.isServiceRunning.get(walletService)) {
return;
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
"dependencies": {
"axios": "^0.27.2",
"bignumber.js": "^9.1.1",
"chia-api": "^3.5.0",
"chia-api": "^3.6.1",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
@@ -18,9 +18,7 @@
"archiver": "^5.3.1",
"pkg": "^5.8.0"
},
"bin": {
"chia-dashboard-satellite": "./main.js"
},
"bin": "./main.js",
"scripts": {
"start": "node main.js",
"package": "node bin/build-package.js"
3,120 changes: 1,812 additions & 1,308 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit d297d34

Please sign in to comment.