From 5f4a070a37c02a4d4382be8ed58de3d0d92ae459 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Thu, 27 May 2021 16:13:50 -0600 Subject: [PATCH 1/4] Harvester mode startup. --- app/commands/global_config.py | 3 +++ entrypoint.sh | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/commands/global_config.py b/app/commands/global_config.py index 9ff3aa44..8de3b2a2 100644 --- a/app/commands/global_config.py +++ b/app/commands/global_config.py @@ -50,6 +50,9 @@ def is_setup(): app.logger.debug( "Found plotter mode with farmer_pk and pool_pk provided.") return True # When plotting don't need private in mnemonic.txt + if "mode" in os.environ and os.environ['mode'] == 'harvester': + # Harvester doesn't require a mnemonic private key as farmer's ca already imported. + return True # All other modes, we should have at least one keys path if "keys" not in os.environ: app.logger.info( diff --git a/entrypoint.sh b/entrypoint.sh index 1415ae48..fca7acee 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,11 +11,7 @@ cd /chia-blockchain . ./activate mkdir -p /root/.chia/mainnet/log -if [ -d /root/.chia/farmer_ca ]; then - chia init -c /root/.chia/farmer_ca 2>&1 > /root/.chia/mainnet/log/init.log -else # All regular cases - chia init 2>&1 > /root/.chia/mainnet/log/init.log -fi +chia init 2>&1 > /root/.chia/mainnet/log/init.log # Loop over provided list of key paths for k in ${keys//:/ }; do @@ -38,9 +34,15 @@ elif [[ ${mode} == 'harvester' ]]; then echo "A farmer peer address and port are required." exit else + if [ -d /root/.chia/farmer_ca ]; then + chia init -c /root/.chia/farmer_ca 2>&1 > /root/.chia/mainnet/log/init.log + else + echo "Did not find your farmer's ca folder at /root/.chia/farmer_ca." + echo "See: https://github.com/guydavis/machinaris/wiki/Generic#harvester-only" + fi chia configure --set-farmer-peer ${farmer_address}:${farmer_port} chia configure --enable-upnp false - chia start harvester + chia start harvester -r fi elif [[ ${mode} == 'plotter' ]]; then echo "Starting in Plotter-only mode. Run Plotman from either CLI or WebUI." From 7c8e2179ac2e5dc83ea4045fdec773db71c4e4c1 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Fri, 28 May 2021 09:02:06 -0600 Subject: [PATCH 2/4] Testing chiapos for multi-threading. --- CHANGELOG.md | 10 ++++++---- app/commands/global_config.py | 5 +++-- dockerfile | 6 +++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e2fddef..ccd117a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.3.0] - 2021-05-? +## [0.3.0] - 2021-05-28 - Integrate the excellent Chiadog project for log monitoring and alerting -- Rebase off ubuntu:focal, include nice Dockerfile cleanup by sparklyballs -- Support farmer_pk and pool_pk env vars when mode=plotter, automatically configure Plotman +- Plotman Analyze output to show time spent in each plotting phase - Log Viewer for Farming, Alerts, and Plotting including logs for running plot jobs -- Plotman Analyze output available for plots with Plotman job logs. +- Rebase off ubuntu:focal, include nice Dockerfile cleanup by sparklyballs +- When mode=plotter, autoconfigure Plotman with provided farmer_pk and pool_pk +- When mode=harvester, auto import of your farmer's CA certificates +- Adopt ChiaPOS multi-threading library for faster plotting; see https://github.com/xrobau/chiapos ## [0.2.1] - 2021-05-21 diff --git a/app/commands/global_config.py b/app/commands/global_config.py index 8de3b2a2..4421a187 100644 --- a/app/commands/global_config.py +++ b/app/commands/global_config.py @@ -176,8 +176,9 @@ def load_chiadog_version(): if errs: abort(500, description=errs.decode('utf-8')) last_chiadog_version = outs.decode('utf-8').strip() - if last_chiadog_version.startswith('chiadog'): - last_chiadog_version = last_chiadog_version[len('chiadog'):].strip() + app.logger.info(last_chiadog_version) + if last_chiadog_version.startswith('v'): + last_chiadog_version = last_chiadog_version[len('v'):].strip() last_chiadog_version_load_time = datetime.datetime.now() return last_chiadog_version diff --git a/dockerfile b/dockerfile index 42476a6b..1a1bf53b 100644 --- a/dockerfile +++ b/dockerfile @@ -35,6 +35,7 @@ RUN \ unzip \ vim \ wget \ + cmake \ \ # cleanup apt cache \ @@ -54,12 +55,15 @@ COPY . /machinaris/ # set workdir WORKDIR /chia-blockchain -# install chia +# install chia and patch for faster plotting; see https://github.com/xrobau/chiapos RUN \ git clone --branch ${CHIA_BRANCH} https://github.com/Chia-Network/chia-blockchain.git /chia-blockchain \ && git submodule update --init mozilla-ca \ && chmod +x install.sh \ && /usr/bin/sh ./install.sh \ + && curl -o install_multithreaded_chiapos.sh https://gist.githubusercontent.com/SippieCup/8420c831ffcd74f4c4c3c756d1bda912/raw/45d44573b6aedf8ea47d8c485fb9eeeb342c53b4/install_multithreaded_chiapos.sh \ + && chmod a+x install_multithreaded_chiapos.sh \ + && ./install_multithreaded_chiapos.sh /chia-blockchain \ \ # cleanup apt and pip caches \ From 6b50195c8851e904cda013cceb5bfb8db8183c6e Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Fri, 28 May 2021 16:36:59 -0600 Subject: [PATCH 3/4] Pulling chiapos patch after no observable plotting speed difference for me. --- CHANGELOG.md | 1 - CREDITS.md | 1 + app/commands/global_config.py | 5 +---- dockerfile | 6 +----- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccd117a6..d56809dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ All notable changes to this project will be documented in this file. The format - Rebase off ubuntu:focal, include nice Dockerfile cleanup by sparklyballs - When mode=plotter, autoconfigure Plotman with provided farmer_pk and pool_pk - When mode=harvester, auto import of your farmer's CA certificates -- Adopt ChiaPOS multi-threading library for faster plotting; see https://github.com/xrobau/chiapos ## [0.2.1] - 2021-05-21 diff --git a/CREDITS.md b/CREDITS.md index 95920a7f..b76809ff 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -37,6 +37,7 @@ A big thanks to all that contributed with dev and test including: * Praghaels * judy * Allram +* Fumo696 ## Trademark Notice CHIA NETWORK INC, CHIA™, the CHIA BLOCKCHAIN™, the CHIA PROTOCOL™, CHIALISP™ and the “leaf Logo” (including the leaf logo alone when it refers to or indicates Chia), are trademarks or registered trademarks of Chia Network, Inc., a Delaware corporation. *There is no affliation between this Machinaris project and the main Chia Network project.* \ No newline at end of file diff --git a/app/commands/global_config.py b/app/commands/global_config.py index 4421a187..0be9a046 100644 --- a/app/commands/global_config.py +++ b/app/commands/global_config.py @@ -117,13 +117,10 @@ def load_chia_version(): abort(500, description=errs.decode('utf-8')) last_chia_version = outs.decode('utf-8').strip() # Chia devs use a really weird versioning offset... - if last_chia_version.endswith('dev0'): + if last_chia_version.endswith('dev'): sem_ver = last_chia_version.split('.') last_chia_version = sem_ver[0] + '.' + \ sem_ver[1] + '.' + str(int(sem_ver[2])-1) - elif '.dev' in last_chia_version: - sem_ver = last_chia_version.split('.') - last_chia_version = sem_ver[0] + '.' + sem_ver[1] + '.' + sem_ver[2] last_chia_version_load_time = datetime.datetime.now() return last_chia_version diff --git a/dockerfile b/dockerfile index 1a1bf53b..42476a6b 100644 --- a/dockerfile +++ b/dockerfile @@ -35,7 +35,6 @@ RUN \ unzip \ vim \ wget \ - cmake \ \ # cleanup apt cache \ @@ -55,15 +54,12 @@ COPY . /machinaris/ # set workdir WORKDIR /chia-blockchain -# install chia and patch for faster plotting; see https://github.com/xrobau/chiapos +# install chia RUN \ git clone --branch ${CHIA_BRANCH} https://github.com/Chia-Network/chia-blockchain.git /chia-blockchain \ && git submodule update --init mozilla-ca \ && chmod +x install.sh \ && /usr/bin/sh ./install.sh \ - && curl -o install_multithreaded_chiapos.sh https://gist.githubusercontent.com/SippieCup/8420c831ffcd74f4c4c3c756d1bda912/raw/45d44573b6aedf8ea47d8c485fb9eeeb342c53b4/install_multithreaded_chiapos.sh \ - && chmod a+x install_multithreaded_chiapos.sh \ - && ./install_multithreaded_chiapos.sh /chia-blockchain \ \ # cleanup apt and pip caches \ From e375204f737ee61dbb23be25b40a50fa0295cabf Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Fri, 28 May 2021 16:49:02 -0600 Subject: [PATCH 4/4] Back to old version behavior. --- app/commands/global_config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/commands/global_config.py b/app/commands/global_config.py index 0be9a046..4421a187 100644 --- a/app/commands/global_config.py +++ b/app/commands/global_config.py @@ -117,10 +117,13 @@ def load_chia_version(): abort(500, description=errs.decode('utf-8')) last_chia_version = outs.decode('utf-8').strip() # Chia devs use a really weird versioning offset... - if last_chia_version.endswith('dev'): + if last_chia_version.endswith('dev0'): sem_ver = last_chia_version.split('.') last_chia_version = sem_ver[0] + '.' + \ sem_ver[1] + '.' + str(int(sem_ver[2])-1) + elif '.dev' in last_chia_version: + sem_ver = last_chia_version.split('.') + last_chia_version = sem_ver[0] + '.' + sem_ver[1] + '.' + sem_ver[2] last_chia_version_load_time = datetime.datetime.now() return last_chia_version