Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Build instruction

Alexander edited this page Apr 2, 2018 · 34 revisions

Introduction

We ship a Dockerfile in project to simplify the process of building and running of golosd. If you want to build golosd without docker your OS should be Ubuntu 16.04. There is no a simple way to build golosd under any other version of Linux.

Attention

PLEASE, DON'T FORGET TO SAVE YOUR PRIVATE KEY

On upgrade time you can disable signing of blocks by witness: https://golos.io/ru--golos/@vik/ustanovka-i-nastroika-rezervnykh-nod-vozmozhnost-obkhoditsya-bez-nikh-ne-narushaya-rabotu-golosa

Build under Docker

Building of a docker container can be done on any OS. Before starting of the new version of golosd, you should stop the previous version of docker container and drop it:

docker stop golos-default
docker rm golos-default
docker image rm goloschain/golos

Building of a docker container is quite simple. But before it, you should clone repository and create your own config-file.

git clone https://github.com/GolosChain/golos.git
cd golos

Now, you can modify config.ini, and set values for:

  1. witness
  2. private-key
  3. enable-stale-production set to false
  4. required-participation set to 33
  5. plugins - if you don't need some of them you can remove one.

stable tag for public node 0.17.1RC1

Additional parameters are defaultable in default

read-wait-micro = 500000
max-read-wait-retries = 2
write-wait-micro = 500000
max-write-wait-retries = 3
single-write-thread = true 

If in the docker without external volumes - then 32 for the witness node.

if with external volumes - it is 24 - after updating to 0.17.1 itself it will grow

To do all of this, you should modify file share/golosd/config/config.ini.

As an example, you can get the minimal list of plugings for witness-node from the following file: https://github.com/GolosChain/golos/blob/master/share/golosd/config/config_witness.ini.

And now, you can build docker-container from the root of the project:

sudo docker build -t goloschain/golos -f Dockerfile .

Run docker container

sudo docker run -d \
    -p 2001:2001 -p 8090:8090 -p 8091:8091 \
    --name golos-default \
    goloschain/golos

Run docker container with external volume

If you want to edit config.ini and don't want resync golosd on each docker rebuild, you may mount directories as external volumes.

Good description is here: https://golos.io/golosd/@ropox/zapusk-golos-nody-v-konteijnere-dokera

Steps:

# Create directory for configuration files:
sudo mkdir -p /etc/golosd

# Copy config files to the /etc directory:
sudo cp share/golosd/seednodes /etc/golosd/
sudo cp share/golosd/config/config.ini /etc/golosd/

# Create directory for the blockchain:
sudo mkdir -p /var/lib/golosd/

# Copy the genesis initial file for the blockchain:
sudo cp share/golosd/snapshot5392323.json /var/lib/golosd/

Running of docker container with the external volumes is slightly different:

sudo docker run -d \
    -p 2001:2001 -p 8090:8090 -p 8091:8091 \
    -v /etc/golosd:/etc/golosd \
    -v /var/lib/golosd:/var/lib/golosd/ \
    --name golos-default \
    goloschain/golos

Get logs from docker container

sudo docker logs --tail 10 -f golos-default

Stop docker container

sudo docker stop golos-default

Start docker container

sudo docker start golos-default

Build from sources (upgrade from previous version of daemon).

The following instruction is actual only for Ununtu 16.04.

# Clone source code from github:
git clone https://github.com/GolosChain/golos.git
cd golos
git submodule update --init --recursive -f

# Configure the project:
mkdir build
cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_GOLOS_TESTNET=FALSE \
    -DBUILD_SHARED_LIBRARIES=FALSE \
    -DLOW_MEMORY_NODE=FALSE \
    -DCHAINBASE_CHECK_LOCKING=FALSE \
    -DCLEAR_VOTES=FALSE \
    ..

# Build project and install the daemon to /usr/local/:
make -j $(nproc)
sudo make install

Before starting the new version of golosd, you should get config-file https://github.com/GolosChain/golos/blob/master/share/golosd/config/config.ini and set values for:

  1. witness
  2. private-key
  3. enable-stale-production set to false
  4. required-participation set to 33
  5. plugins - if you don't need some of them you can remove one.

As an example, you can get the minimal list of plugings for witness-node from the following file: https://github.com/GolosChain/golos/blob/master/share/golosd/config/config_witness.ini.

After that you should stop a previous version of daemon and replay blockchain:

# Stopping of your daemon depends on your configuration. 
# For example, if it's a simple running application: pkill -15 golosd

# Now, you can replay blockchain from block_log without resync:
/usr/local/bin/golosd --replay-blockchain

Build from sources (new installation).

The following instruction is actual only for Ununtu 16.04.

# Install required packages:
sudo apt-get install -y \
        autoconf \
        automake \
        autotools-dev \
        bsdmainutils \
        build-essential \
        cmake \
        doxygen \
        git \
        ccache\
        libboost-all-dev \
        libreadline-dev \
        libssl-dev \
        libtool \
        ncurses-dev \
        pbzip2 \
        pkg-config \
        python3 \
        python3-dev \
        python3-pip \
        runit
sudo pip3 install gcovr

# Clone source code from github:
git clone https://github.com/GolosChain/golos.git
cd golos
git submodule update --init --recursive -f

# Configure the project:
mkdir build
cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_GOLOS_TESTNET=FALSE \
    -DBUILD_SHARED_LIBRARIES=FALSE \
    -DLOW_MEMORY_NODE=FALSE \
    -DCHAINBASE_CHECK_LOCKING=FALSE \
    -DCLEAR_VOTES=FALSE \
    ..

# Build project and install the daemon to /usr/local/:
make -j $(nproc)
sudo make install

# Ok. Now, we should configure environment for the golosd.

# Create user for daemon:
sudo useradd -s /bin/bash -m -d /var/lib/golosd golosd

# Copy the genesis initial file for the blockchain:
sudo cp ../share/golosd/snapshot5392323.json /var/lib/golosd/

# Copy config files to the /etc directory:
sudo mkdir -p /etc/golosd
sudo cp ../share/golosd/seednodes /etc/golosd/
sudo cp ../share/golosd/config/config.ini /etc/golosd/
sudo chown golosd:golosd -R /etc/golosd/

# Create a service file for the daemon:
sudo mkdir -p /etc/service/golosd
sudo cp ../share/golosd/golosd.sh /etc/service/golosd/run
sudo chmod +x /etc/service/golosd/run

# The golosd can be started:
sudo runsv /etc/service/golosd

# Do the following steps if you got error like: `fatal: unable to lock supervise/lock: temporary failure`:
sudo systemctl stop runit
sudo systemctl start runit
Clone this wiki locally