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

Build instruction

Andrew Falaleev edited this page Mar 30, 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

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

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.

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

Get logs from docker container

sudo docker logs --tail 10 -f 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
Clone this wiki locally