Skip to content
This repository has been archived by the owner on Jul 24, 2022. It is now read-only.

Latest commit

 

History

History
230 lines (154 loc) · 5.19 KB

deploy.md

File metadata and controls

230 lines (154 loc) · 5.19 KB

Deployment Chia Farm from Zero

In this document collected the most useful scripts and libraries related to Chia cluster deployment.

Set up VM

Use Storage optimized VM instances in Microsoft Azure. For this type of VM instances is available NVMe SSD(s) on demand.

Create Lsv2-series VM using Azure Portal or Azure CLI.

Connect with VM and update: sudo apt update && sudo apt upgrade -y

Add non-root user (optional):

sudo adduser $user_name
sudo usermod -aG sudo $user_name

Mount disks for Plotting and Harvesting

Mount volumes (instruction):

# view available disks
lsblk

# for each NVMe drive
sudo parted /dev/nvme0n1 --script mklabel gpt mkpart xfspart xfs 0% 100%
sudo mkfs.xfs /dev/nvme0n1p1
sudo partprobe /dev/nvme0n1p1

sudo mkdir /plotdrive1
sudo mount /dev/nvme0n1p1 /plotdrive1
sudo chmod -R 777 /plotdrive1


# for each HDD drive
sudo parted /dev/sdc --script mklabel gpt mkpart xfspart xfs 0% 100%
sudo mkfs.xfs /dev/sdc1
sudo partprobe /dev/sdc1

sudo mkdir /harvestdrive1
sudo mount /dev/sdc1 /harvestdrive1
sudo chmod -R 777 /harvestdrive1

# check
df -h

Install Chia Software

Install Chia Software and activate it (instruction):

# install python 3.7 (if necessary)

sudo apt -y install python3.7
sudo apt install python3.7-venv python3.7-distutils python3.7-dev git lsb-release -y


# Checkout the source and install
git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
cd chia-blockchain

sh install.sh

. ./activate

Run Chia Software

Init Chia using Chia CLI:

chia version

chia keys add
chia keys show

chia init

chia start --help # check mode which you wish start Chia
chia start farmer-only

Start plotting:

chia keys show # see your farmer key

chia plots create -k 32 -n 1 -b 5000 -r 2 -t /plotdrive1 -d /harvestdrive1 2>&1 | tee ~/chia-blockchain/logs/my_1st_plot.log

Tools

Install .NET 5 and Powershell.

Git settings:

# 1.
# view ssh-key 
cat ~/.ssh/id_rsa.pub
# or create if it isn't exist
cd ~/.ssh && ssh-keygen

# 2. Register SSH keys in github
cat id_rsa.pub
# and register to https://github.com/settings/keys

# 3.
git config --global user.name $user_name # @codez0mb1e
git config --global user.email $user_email

Monitoring

Monitoring NVMe:

sudo apt -y install nvme-cli
sudo nvme list

sudo nvme smart-log /dev/nvme0n1 | grep percentage_used

Monitoring of Plotting via PSChiaPlotter (WARN: only for Windows):

Install-Module -Repository PSGallery -Name PSChiaPlotter
Get-ChiaPlottingStatistic | sort Time_started -Descending | select -first 20

Monitoring of Plotting via Chia Plot Graph:

sudo apt install -y  build-essential

# clone and build tool
mkdir tools; cd tools
git clone https://github.com/stolk/chiaplotgraph.git
cd chiaplotgraph
make 
# analyze logs
$top_n = 20
Set-Location ./tools/chiaplotgraph/

$logFiles = Get-ChildItem -Path ~/chia-blockchain/logs/ | Sort-Object -Property LastWriteTime -Descending | Select -expa FullName -first $top_n  
./chiaplotgraph $logFiles  

Monitoring of Harvesting via Chia Harvest Graph:

# install
git clone https://github.com/stolk/chiaharvestgraph.git
cd chiaplotgraph
make 

# run
./chiaharvestgraph ~/chia-blockchain/farmer-logs

Attempts to Boost (beta)

New multi-thread Chia Plotter (WARN: under active development).

After VMs Reboot...

Script that I run after VM(s) reboot:

## Get updates
sudo apt update && sudo  apt upgrade -y


## Mount disks
sudo mount /dev/sdc1 /harvestdrive1

sudo parted /dev/nvme0n1 --script mklabel gpt mkpart xfspart xfs 0% 100%
sudo mkfs.xfs /dev/nvme0n1p1
sudo partprobe /dev/nvme0n1p1
sudo mount /dev/nvme0n1p1 /plotdrive1
sudo chmod -R 777 /plotdrive1
lsblk


## Start Chia farmer daemons
cd chia-blockchain
. ./activate
cd ~

chia version
chia start farmer-only

Chia GUI (obsolete)

The GUI requires you have Ubuntu Desktop or a similar windowing system installed. WARN: You can not install and run the GUI as root.

# Install GUI ---- 
sudo apt -y install xfce4 # or ubuntu-desktop
sudo reboot

# Remote access [2] ----

sudo apt-get -y install xrdp
sudo systemctl enable xrdp

echo xfce4-session >~/.xsession

sudo service xrdp restart

az vm open-port --resource-group $resource_group_name --name $vm_name --port 3389

# Install Chia GUI
chmod +x ./install-gui.sh
./install-gui.sh

cd chia-blockchain-gui
npm run electron &