Tutorial: Virtual GPU Miner (Google Cloud)

Running the GPU miner in this example is done using Google Cloud.
Step 1: Create VM and Allow Port Access
From the Console, navigate to Compute Engine>>>VM Instances from the main menu on the top left.
Create a new instance.
Requirements:
Zone: asia-southeast1-b
(or any other region that supports GPU miners)
Machine Type: Custom
, 6 CPU
, 10 GB
and 1 Nvidia Tesla P4
OS: Debian GNU/Linux 10
Disk Type: SSD persistant disk
Disk Size: 100 GB
Firewall Settings: Allow HTTP traffic

NOTE: If it's your first time using Google Cloud, you may encounter an error after creation that requires you to increase your GPU Quota limits. You can do so by following this Stack Overflow solution.
Next in order to open the ports on your VM, you will need to create a Firewall Rule. You can navigate there by going to VPC Network>>>Firewall from the main menu. Once there, create a new firewall rule that will match the network tag that was created by the Firewall Setting from earlier:

Be sure to fill out the fields exactly as above.
Enable and create the rule. Once you do so, your ports will be open to view the multiverse being created by your miner (covered at the end of this tutorial).
Step 2: Access VM & Install Nvidia CUDA Drivers
SSH into your VM using your own terminal and enter the following commands:
sudo apt update -y
sudo apt install -y git net-tools vim tmux lshw jq wget curl ca-certificates apt-transport-https gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
sudo apt update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
export DEBIAN_FRONTEND=noninteractive
apt -y install linux-headers-$(uname -r) build-essential
echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf
systemctl reboot
sudo apt install -y linux-headers-4.19.0-10-cloud-amd64
sudo su root
wget http://us.download.nvidia.com/tesla/440.33.01/NVIDIA-Linux-x86_64-440.33.01.run
chmod +x NVIDIA-Linux-x86_64-440.33.01.run
./NVIDIA-Linux-x86_64-440.33.01.run -s
# -s is silent mode which prevents pesky pop ups and questions
# you may see two ERROR messages after running this command. Feel free to ignore and move on
Step 3: Install Docker for Nvidia
While still in root@ from the earlier sudo su root command in Step 2:
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
sudo reboot
# this is a required step and will end your session, so reopen a new session to continue
sudo su root
docker run --gpus all nvidia/cuda:10.0-base nvidia-smi
# this step verifies that docker is installed and recognizes your GPU.
Step 4: Build Miner image
NOTE
The following GitHub repo is maintained by independent, non-Overline affiliated, members of our community. Use at your own discretion.
git clone https://github.com/trick77/bcnode-gpu-docker bcnode-gpu-docker && cd $_
./build-images.sh
vim ./config
# update the "miner key" and "scookie" values in this file,
Step 5: Add latest db snapshot to _data folder
Ephemeral Storage / DB Snapshot
Using this snapshot is recommended only if you would like to speed up your sync process.
We STRONGLY encourage users to mine the full multichain db from scratch, if possible.
apt install unzip
wget https://community.multichains.org/_easysync_db.zip && ./import-db.sh ./_easysync_db.zip
Step 6: Start BC Miner
./start.sh
That's it! below are some commands to use post-running the miner.
To view logs:
sudo docker logs -f bcnode --tail 100
To stop miner*:
sudo ./cleanup.sh
To re-pull the latest db snapshot:
sudo wget https://community.multichains.org/_easysync_db.zip
sudo ./import-db.sh ./_easysync_db.zip
To re-pull the latest docker image:
sudo ./build-images.sh
To restart miner after stopping*:
sudo ./start.sh
To view your multiverse:
Go to [YOUR.EXTERNAL.IP]:3000 in your browser.
*NOTE: You will need to be in the directory tmp/bcnode-gpu-docker/ to run these commands.
Updated over 2 years ago