From 99ba05e11be674c1cda7ae4f3951bdadf58384f8 Mon Sep 17 00:00:00 2001 From: Michele Marcucci Date: Thu, 4 Apr 2024 10:00:35 +0200 Subject: [PATCH 1/6] Fix conf files managed from init --- src/init.js | 16 ++++++++++++++-- src/utils.js | 5 +++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/init.js b/src/init.js index b2c35f2..2fe76a8 100644 --- a/src/init.js +++ b/src/init.js @@ -31,9 +31,9 @@ const runMigrations = async () => { try { console.log('Run migrations'); const resp = await knex.migrate.latest(); - await createCkpoolConfigFile(); - await createBitcoinConfigFile(); await runGenerateBitcoinPassword(); + await createBitcoinConfigFile(); + await createCkpoolConfigFile(); } catch (err) { console.log(err); } @@ -130,6 +130,18 @@ uacomment=FutureBit-Apollo-Node`; `Error during the creation of the file bitcoin.conf: ${error.message}` ); } + } finally { + const [settings] = await knex('settings') + .select(['node_rpc_password as nodeRpcPassword']) + .orderBy('created_at', 'desc') + .orderBy('id', 'desc') + .limit(1); + + if (settings && settings.nodeRpcPassword) { + exec( + `sudo sed -i s/rpcpassword.*/rpcpassword=${settings.nodeRpcPassword}/g ${configFilePath}` + ); + } } }; diff --git a/src/utils.js b/src/utils.js index 85ed9cd..a775c72 100644 --- a/src/utils.js +++ b/src/utils.js @@ -46,6 +46,9 @@ module.exports.auth = { '../backend/ckpool/ckpool.conf' ); + await fs.access(configFilePath); + await fs.access(configCkpoolFilePath); + exec( `sudo sed -i s/rpcpassword.*/rpcpassword=${password}/g ${configFilePath}` ); @@ -54,8 +57,6 @@ module.exports.auth = { `sudo sed -i 's#"pass": ""#"pass": "${password}"#g' ${configCkpoolFilePath}` ); - console.log(password, configFilePath); - exec('sudo systemctl restart node'); exec('sudo systemctl restart ckpool'); } catch (err) { From 60e5cfcaaf2a4b711a2b2f74fd79ffcb818fa3cf Mon Sep 17 00:00:00 2001 From: Michele Marcucci Date: Mon, 8 Apr 2024 17:32:56 +0200 Subject: [PATCH 2/6] Reboot after update --- backend/update_system | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/backend/update_system b/backend/update_system index 270a975..e823a8a 100755 --- a/backend/update_system +++ b/backend/update_system @@ -45,19 +45,10 @@ cp $APOLLO_DIR/backend/systemd/ckpool.service /etc/systemd/system/ echo -e "${YELLOW} ---> Reloading systemd${NC}" systemctl daemon-reload -echo -e "${YELLOW} ---> Restarting APP${NC}" -systemctl restart node -systemctl restart ckpool -systemctl restart apollo-api -systemctl restart apollo-miner - -#Restart UI after old version of UI finishes update progress -sleep 1 - -systemctl restart apollo-ui-v2 - -sleep 3 +echo -e "${YELLOW} ---> Rebooting${NC}" echo "100" > $TMPFILE -rm $TMPFILE \ No newline at end of file +rm $TMPFILE + +reboot From 11bfda46eec71f2b021409ce60c8e73e60ef49af Mon Sep 17 00:00:00 2001 From: jstefanop Date: Wed, 10 Apr 2024 16:40:07 -0400 Subject: [PATCH 3/6] Update MinerStats.js Fix graphql 32bit errors --- src/graphql/graphqlModules/Miner/MinerStats.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/graphql/graphqlModules/Miner/MinerStats.js b/src/graphql/graphqlModules/Miner/MinerStats.js index b0d7c08..f7f5a6a 100644 --- a/src/graphql/graphqlModules/Miner/MinerStats.js +++ b/src/graphql/graphqlModules/Miner/MinerStats.js @@ -203,8 +203,8 @@ module.exports.typeDefs = ` hashrate1d: String hashrate7d: String diff: Float - accepted: Int - rejected: Int + accepted: Float + rejected: Float bestshare: Float SPS1m: Float SPS5m: Float @@ -220,7 +220,7 @@ module.exports.typeDefs = ` hashrate7d: String lastshare: Int workers: Int - shares: Int + shares: Float bestshare: Float bestever: Float authorised: Int @@ -235,7 +235,7 @@ module.exports.typeDefs = ` hashrate1d: String, hashrate7d: String, lastshare: Int, - shares: Int, + shares: Float, bestshare: Float, bestever: Float } From 8feaa3dd6bd5b76b3475ced189d3d461721d525b Mon Sep 17 00:00:00 2001 From: Michele Marcucci Date: Thu, 11 Apr 2024 08:07:55 +0200 Subject: [PATCH 4/6] Fix 32-bit issue --- .../graphqlModules/Miner/MinerStats.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/graphql/graphqlModules/Miner/MinerStats.js b/src/graphql/graphqlModules/Miner/MinerStats.js index f7f5a6a..a66e3d5 100644 --- a/src/graphql/graphqlModules/Miner/MinerStats.js +++ b/src/graphql/graphqlModules/Miner/MinerStats.js @@ -86,30 +86,30 @@ module.exports.typeDefs = ` interval: Int jobs: Int cleanFlags: Int - sharesSent: Int - sharesAccepted: Int - sharesRejected: Int - solutionsAccepted: Int + sharesSent: Float + sharesAccepted: Float + sharesRejected: Float + solutionsAccepted: Float minRespTime: Float avgRespTime: Float maxRespTime: Float shareLoss: Float - poolTotal: Int + poolTotal: Float inService: Int subscribeError: Int - diffChanges: Int + diffChanges: Float reconnections: Int reconnectionsOnErrors: Int - defaultJobShares: Int - staleJobShares: Int - duplicateShares: Int - lowDifficultyShares: Int - pwcSharesSent: Int - pwcSharesDropped: Int - bigDiffShares: Int - belowTargetShare: Int + defaultJobShares: Float + staleJobShares: Float + duplicateShares: Float + lowDifficultyShares: Float + pwcSharesSent: Float + pwcSharesDropped: Float + bigDiffShares: Float + belowTargetShare: Float pwcRestart: Int - statOverflow: Int + statOverflow: Float } type MinerStatsFans { @@ -170,7 +170,7 @@ module.exports.typeDefs = ` type MinerStatsSlotAlert { alertLo: Int alertHi: Int - numWrite: Int + numWrite: Float } type MinerStatsSlave { From cc185a2ac506c8bed7cfde0262c8b2f4195365ce Mon Sep 17 00:00:00 2001 From: jstefanop Date: Thu, 11 Apr 2024 10:07:09 -0400 Subject: [PATCH 5/6] Update miner_start.sh fix detection for early batch 1 boards --- backend/apollo-miner/miner_start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/apollo-miner/miner_start.sh b/backend/apollo-miner/miner_start.sh index 1591cd3..8943c36 100755 --- a/backend/apollo-miner/miner_start.sh +++ b/backend/apollo-miner/miner_start.sh @@ -11,7 +11,7 @@ start_hashboards() local boardType=$(./apollo-helper -s $1) - if [[ "$boardType" == *"Apollo-BTC"* ]]; then + if [[ "$boardType" == *"Apollo-BTC"* || "$boardType" == *"RD6"* ]]; then screen -dmS miner ./futurebit-miner -comport $1 -ao_mode 1 $settings -powermode $mode elif [[ "$boardType" == *"Apollo-2"* ]]; then screen -dmS miner ./futurebit-miner-v2 -comport $1 -ao_mode 1 $settings -powermode $mode @@ -37,7 +37,7 @@ sleep 35 boardType=$(./apollo-helper -s /dev/ttyS1) -if [[ "$boardType" == *"Apollo-BTC"* ]]; then +if [[ "$boardType" == *"Apollo-BTC"* || "$boardType" == *"RD6"* ]]; then screen -dmS miner ./futurebit-miner -comport /dev/ttyS1 -ao_mode 1 $settings -powermode $mode elif [[ "$boardType" == *"Apollo-2"* ]]; then screen -dmS miner ./futurebit-miner-v2 -comport /dev/ttyS1 -ao_mode 1 $settings -powermode $mode From 4c5f242071025fbcf6f7e37c91754adecdc93114 Mon Sep 17 00:00:00 2001 From: jstefanop Date: Thu, 11 Apr 2024 10:14:21 -0400 Subject: [PATCH 6/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bdf9ca3..debdb9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "apolloapi-v2", - "version": "2.0.3", + "version": "2.0.4", "main": "index.js", "repository": "https://github.com/jstefanop/apolloapi-v2.git", "author": "FutureBit LLC",