The TC-EOS Launch. Step 1 - Synchronization

in #travelchain6 years ago (edited)

  Instruction for unwrapping and synchronising of the TC-EOS software.

Clone the repository:
git clone https://github.com/travelchain/tc-eos

Go to the tc_stable branch and и pull up the submodules:
сd tc-eos && git checkout tc_stable && git submodule update --init --recursive

Run the installation:
./tc_build.sh

After it’s complete, you’ll see the following:

Run the mongo database:
export PATH=${HOME}/opt/mongodb/bin:$PATH
~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf

Go to the build folder And finalize the instalation:
cd build && sudo make install

Make a path to the executable files. Open the bashrc file with any editor:
nano ~/.bashrc

Write the following:
export EOSIO_PATH=/usr/local/eosio/bin
export PATH=$EOSIO_PATH:$PATH

Save, close the file, restart the terminal or pull up changes:
source ~/.bashrc

Now the software will be accessible with the nodeos/cleos/keosd comand. It will come in handy.

Run the node for synchronisation:

nodeos --p2p-peer-address 142.44.161.119:9876 --p2p-peer-address 145.239.86.163:9876 --config-dir tc --http-server-address 127.0.0.1:8888 --p2p-listen-endpoint 0.0.0.0:9876 --verbose-http-errors true --http-validate-host false --agent-name "NODE-NAME" --plugin eosio::chain_plugin --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin

Where:
p2p-peer-address - seed-nodes for connection and suncronization (142.44.161.119:9876 и 145.239.86.163:9876),
tc - will be the config folder in the future, it will appear in the same directory, where you are at the moment - quite useful for quick access;
http-server-address - The open port for transferring the endpoint;
p2p-listen-endpoint - The open p2p port for synchronization;
verbose-http-errors - Messages on the content of errors will be given on http;
http-validate-host - host verification flag by http, disable it temporarily;
agent-name - The name of your node for the identification;
plugin - set of plug-ins for interaction with the node.

You need to wait for the synchronization to complete. After that you need to configure the query forwarding by https to the end point of the node. Go into the nginx configuration and write the following, replacing the SSL certificate paths and the server's web address with your ones.:
server {
listen 80;
server_name YOUR_SERVER_NAME;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
server_name YOUR_SERVER_NAME;
ssl on;
ssl_certificate /PATH_TO_SSL_FOLDER/fullchain.pem;
ssl_certificate_key /PATH_TO_SSL_FOLDER/privkey.pem;

location / {
   access_log off;
    proxy_pass http://127.0.0.1:8888;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    }
}

  Done. After rebooting nginx, go to the web address of the endpoint and check the current node information. For example, for an endpoint https://api.travelchain.io/v1/get_info we’ll see something like this:

{"server_version":"7f77472a","chain_id":"0443d062bb782b32bdc07a65273e1696c9a28749c047124927c7160897cacd28","head_block_num":6190,"last_irreversible_block_num":6189,"last_irreversible_block_id":"0000182df9f50e80d9b006b410dd43fc17f9fdd795919aed3063fc7100e834fb","head_block_id":"0000182e15440db15a3ca369c226778778909e609b08fe8cd1a3e30df7ec3005","head_block_time":"2018-08-16T14:51:36.500","head_block_producer":"eosio","virtual_block_cpu_limit":97528855,"virtual_block_net_limit":512375746,"block_cpu_limit":199900,"block_net_limit":1048576}

  If you see the same thing on your web address, it means everything is in order - the endpoint is available.

  Seed-node can be temporarily left on the same server, after configuring nginx for the transfer, or you can transfer the Seed-node to another server (preferable). We will reorganize the architecture into different topologies after the activation. Right now we need to make sure that everything works as it should.

  Support-chat for the delegates:
      https://t.me/TCwitness