This procedure is written for the installation of MyDojo on a host machine running Ubuntu 16 but it should be easy to adapt it for Linux distributions running on a x86-64 architecture.
MyDojo stores its code and data in 2 different locations:
By default, MyDojo and Docker data will be stored under /var/lib/docker
directory but the directory can be modified (e.g.: all data stored on an dedicated disk).
First, we must prepare our host system for MyDojo by installing required operating system dependencies and configuring our linux system with privacy and security in mind.
# Fetch latest updates
sudo apt-get update
# Install needed dependencies
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common unzip
The latest version of Docker and Docker Compose are required to run Dojo.
Please check you are running the latest or follow the official how-to installation documentation before continuing:
Creating a segregated user account for MyDojo is a good idea for security reasons.
sudo useradd -s /bin/bash -d /home/dojo -m -G sudo dojo
sudo passwd dojo
Enter and confirm the password for the dojo
user when promoted before continuing.
# Add the user to the docker group
sudo usermod -aG docker dojo
# Restart Host System
sudo shutdown -r now
Log back into the Host System with the dojo
user and test the Docker installation
docker run hello-world
This command should display a hello message if Docker can be run with the dojo
user.
This step is optional, but should be applied if you don’t want to store MyDojo and Docker data under the /var/lib/docker
directory (e.g.: all data will be stored on an external SSD).
# Stop the Docker service
sudo systemctl stop docker
# Create the directory that will store Docker data
sudo mkdir /path/to/target/directory/
# Temporarily switch to root and create the daemon.json
sudo su - root
echo '{ "data-root": "/path/to/target/directory/" }' > /etc/docker/daemon.json
exit
In this guide we are naming the directory that houses all our MyDojo files
dojo-app
and it will be located in the root directory of thedojo
user.
Now that the Host System is now prepared, we will download the latest MyDojo source code and prepare our Host System further before proceeding with install.
# Create the directory for housing our MyDojo files
mkdir ~/dojo-app
# Download latest MyDojo files
wget https://code.samourai.io/dojo/samourai-dojo/-/archive/master/samourai-dojo-master.zip
# Unzip the Files
unzip samourai-dojo-master.zip -d .
# Copy the files to our dojo-app directory
cp -a samourai-dojo-master/. dojo-app/
# Delete the source archive now that we have copied the files to our directory.
rm -rf samourai-dojo-master
rm samourai-dojo-master.zip
Change the working directory to the MyDojo configuration directory.
cd ~/dojo-app/docker/my-dojo/conf
You will be required to generate various random alphanumeric passwords to secure various aspects of your Dojo installation. You can generate these in any way you wish, but you may wish to use the following command in a terminal session to generate these passwords with sufficient entropy:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1
# Edit the docker-bitcoind.conf.tpl file.
nano docker-bitcoind.conf.tpl
Customize the contents of the file
BITCOIND_RPC_USER=<provide_this value>
BITCOIND_RPC_PASSWORD=<provide_this value>
If your machine has a lot of RAM, it’s recommended that you increase the value of
BITCOIND_DB_CACHE
(e.g 2048) for a faster Initial Block Download.
Save and exit the file with CTRL+X, Y and ENTER.
# Edit the docker-mysql.conf.tpl file.
nano docker-mysql.conf.tpl
Customize the contents of the file
MYSQL_ROOT_PASSWORD=<provide_this value>
MYSQL_USER=<provide_this value>
MYSQL_PASSWORD=<provide_this value>
Save and exit the file with CTRL+X, Y and ENTER.
# Edit the docker-node.conf.tpl file.
nano docker-node.conf.tpl
Customize the contents of the file
NODE_API_KEY=<provide_this value>
NODE_ADMIN_KEY=<provide_this value>
NODE_JWT_SECRET=<provide_this value>
NODE_ACTIVE_INDEXER=local_indexer
Save and exit the file with CTRL+X, Y and ENTER.
# Edit the docker-indexer.conf.tpl file.
nano docker-indexer.conf.tpl
Customize the contents of the file
INDEXER_INSTALL=on
Set an Indexer to use, for example to use Fulcrum set
INDEXER_TYPE=fulcrum
Save and exit the file with CTRL+X, Y and ENTER.
# Edit the docker-explorer.conf.tpl file.
nano docker-explorer.conf.tpl
If you wish to deactivate the Explorer change the contents to
EXPLORER_INSTALL=off
Save and exit the file with CTRL+X, Y and ENTER.
From this point on the install process is automatic. Launch the installation of MyDojo
# Return to the root MyDojo profject folder
cd ~/dojo-app/docker/my-dojo
# Install MyDojo
./dojo.sh install
Confirm the installation with Y and ENTER.
At this point, your job is done. The Dojo Shell script and Docker are going to take over and a lot of things are going to happen automatically.
First, the shell script is going to initialize a set of configuration files. Then Docker is going to initialize the dedicated networks and data volumes that will be used by MyDojo. At last, Docker is going to build the containers composing MyDojo.
This latest operation may last from a dozen to a few tens of minutes, depending on the specs of the hardware.
A lot of logs are displayed and you may be concerned that some of these logs (displayed in red) are the sign of a problem. Don’t worry about this. Some of these logs are just informational or warnings. Just be aware that if a blocking error occurs, Docker will stop building the containers and you won’t reach the next phase.
If all Docker containers have been successfully built, the Shell Script is going to launch MyDojo (equivalent of the dojo.sh start
command) and display its logs.
When all blocks headers have been successfully downloaded and processed, the Bitcoin daemon is going to process its Initial Blocks Download (IBD).
This phase is going to last from 1 to several days, depending on the specs of the hardware. At this point, all you have to do is wait. The Bitcoin daemon is processing the IBD while the Tracker is importing block headers in parallel.
You can exit the logs with CTRL+C. Don’t worry, MyDojo is still running in background.
When the bitcoin daemon has completed its IBD, the Indexer will automatically start the indexation of all Bitcoin addresses. When the indexation is complete, it will compact the database.
These operations should last a few hours, depending on the specs of the hardware.
This section describes how to monitor the progression of the initialization of MyDojo by its different components.
# Return to the root MyDojo project folder
cd ~/dojo-app/docker/my-dojo
# Get Blockchain Info from Bitcoin Core
./dojo.sh bitcoin-cli getblockchaininfo
The Bitcoin daemon has completed its IBD if the blocks
and headers
values match and the initialblockdownload
value is false
.
# Get Tracker Logs
./dojo.sh logs tracker
The import has completed if the logs return Processing active mempool
traces.
If you see Beginning to process new block header
in the output of the logs, the Tracker is still importing headers.
# Retrieve onion address of Block Explorer
./dojo.sh onion
Open the block explorer in a Tor browser and runs a search for the Bitcoin address 14vjqQ3tT1QuHmDtsd57BqTJo7Q8oNzizP
(mainnet) or 2MuctxrPEowcG9vXzTJ9igUhLBSWSe7Afiw
(testnet)
The Indexer is ready if the block explorer displays the transactions associated to the address.