How to host a Virtual Node

Hi JG20, if your current vNode is running normally. There is no need to run this new command. The inc_logshipper is removed to save up some spaces.

3 Likes

I think this tutorial has more details on running multiple nodes on the same machine. Advanced setup shows how to change port but after I examine run.sh, I’ve seen some other ports which are probably used by eth_mainnet docker. Without changing those ports, will my nodes in different folders work?

Hi abduraman

You need at least one eth_mainnet docker container running on one virtual machine. An eth_mainnet docker container can be used to serve multiple incognito_mainnet containers on the same virtual machine.
I suggest that you should NOT change the eth_mainnet port.

For Example:

root@khanhlh:~# docker ps
CONTAINER ID        IMAGE                                         COMMAND                  CREATED             STATUS              PORTS                                                                                                                               NAMES
cc190c872a42        incognitochain/incognito-mainnet:20200205_1   "/bin/sh run_incogni…"   About an hour ago   Up About an hour    0.0.0.0:9334->9334/tcp, 0.0.0.0:9433->9433/tcp                                                                                      inc_mainnet_1
4ab8ef0133c6        incognitochain/incognito-mainnet:20200205_1   "/bin/sh run_incogni…"   About an hour ago   Up About an hour    0.0.0.0:9335->9334/tcp, 0.0.0.0:9434->9433/tcp                                                                                      inc_mainnet_2
9b0f9bc25b47        parity/parity:stable                          "/bin/parity --light…"   About an hour ago   Up About an hour    5001/tcp, 8080/tcp, 8082-8083/tcp, 8180/tcp, 0.0.0.0:8545->8545/tcp, 8546/tcp, 0.0.0.0:30303->30303/tcp, 0.0.0.0:30303->30303/udp   eth_mainnet

You can see that i use one eth_mainnet to serve both inc_mainnet_1 and inc_mainnet_2

7 Likes

In that case, just changing the ports of inc_mainnet in run.sh is not enough for the case of “multiple nodes in the same machine”, is it? I should remove “docker run” lines for log_shipper and eth_mainnet. Or no need for this? The best, could you send your run.sh? :slight_smile: @khanhj

2 Likes

Hi Abduraman, I think @khanhj is the one who can give you a correct answer. Would you please share your words, @khanhj?

3 Likes

I tagged his username. Is it OK?

2 Likes

Hi @abduraman,

In that case, just changing the ports of inc_mainnet in run.sh is not enough for the case of “multiple nodes in the same machine”, is it? I should remove “docker run” lines for log_shipper and eth_mainnet. Or no need for this? The best, could you send your run.sh?

Let’s keep your 1st run.sh file as default, we are going to edit the 2nd one.

  1. Rename the 2nd run.sh to run_2.sh
  2. Edit the run_2.sh
validator_key=YourValidatorKey
data_dir="data_2"
#eth_data_dir="eth-mainnet-data"
#eth_data_dir_geth="eth-mainnet-data-geth"
#logshipper_data_dir="logshipper-mainnet-data"

node_port="9434"
rpc_port="9335"

#if [ ! -d "$PWD/${eth_data_dir}" ]
#then
#  mkdir $PWD/${eth_data_dir}
#  chmod -R 777 $PWD/${eth_data_dir}
#fi

docker rm -f inc_mainnet_2
#docker rm -f eth_mainnet
#docker run -ti --restart=always --net inc_net -d -p 8545:8545  -p 30303:30303 -p 30303:30303/udp -v $PWD/${eth_data_dir}:/home/parity/.local/share/io.parity.ethereum/ --name eth_mainnet  parity/parity:stable --light --jsonrpc-interface all --jsonrpc-hosts all  --jsonrpc-apis all --mode last --base-path=/home/parity/.local/share/io.parity.ethereum/

docker run --restart=always --net inc_net -p $node_port:$node_port -p $rpc_port:$rpc_port -e NODE_PORT=$node_port -e RPC_PORT=$rpc_port -e BOOTNODE_IP=$bootnode -e GETH_NAME=eth_mainnet -e MININGKEY=${validator_key} -e TESTNET=false -v $PWD/${data_dir}:/data -d --name inc_mainnet_2 incognitochain/incognito-mainnet:${latest_tag}

ps aux | grep '[r]un_2.sh' | awk '{ print $2}' | grep -v "^$$\$" | xargs kill -9
  1. run the run_2.sh as normal: sudo bash run_2.sh

You can get my sample run_2.sh here:

Important: In order to run 2 nodes on a server, your server specs should meet the following requirement:

  • 8 CPUs
  • 4 GBs of RAM
  • 500 GBs of SSD
13 Likes

I got 3 errors:

1- Error: No such container: inc_mainnet2
2- Error response from daemon: network with name inc_net already exists
3- docker: Error response from daemon: Conflict. The container name “/inc_logshipper” is already in use by container “fee43127e869d6f0b5acd2a660d46836463710b281f7b88e0cd28959b813857d”. You have to remove (or rename) that container to be able to reuse that name.

I ignore all of them :slight_smile: Is it OK? 1 and 2 are the ones you specified before. To prevent 3, we should have commented out the following lines:

if [ $is_shipping_logs -eq 1 ]
  then
    if [ ! -d "$PWD/${logshipper_data_dir}" ]
    then
      mkdir $PWD/${logshipper_data_dir}
      chmod -R 777 $PWD/${logshipper_data_dir}
    fi
    docker image rm -f incognitochain/logshipper:1.0.0
    docker run --restart=always -d --name inc_logshipper -e RAW_LOG_PATHS=/tmp/*.txt -e JSON_LOG_PATHS=/tmp/*.json -e LOGSTASH_ADDRESSES=34.94.14.147:5000 --mount type=bind,source=$PWD/${data_dir},target=/tmp --mount type=bind,source=$PWD/${logshipper_data_dir},target=/usr/share/filebeat/data incognitochain/logshipper:1.0.0
  fi

OR

set

is_shipping_logs=0

I checked your sample run.sh. It is correct. No problem there.

2 Likes

Hey @abduraman,

Seem like it worked on your machine, in detail:

  1. on the first time you run sudo bash run_2.sh, it will try to remove the container inc_mainnet_2, since it not existed before, the error shown. => can you show me the output of sudo docker ps ?

  2. inc_net already created when you run sudo bash run.sh (the 1st run.sh) => ignore this error

  3. the inc_logshipper is used for analytic, but the team no longer need it => ignore this error

2 Likes

Hey @khanhj ,

CONTAINER ID        IMAGE                                         COMMAND                  CREATED             STATUS              PORTS                                                                                                                               NAMES
3cbb737605ec        incognitochain/incognito-mainnet:20200205_1   "/bin/sh run_incogni…"   20 minutes ago      Up 20 minutes       0.0.0.0:9335->9335/tcp, 0.0.0.0:9434->9434/tcp                                                                                      inc_mainnet2
fee43127e869        incognitochain/logshipper:1.0.0               "/usr/local/bin/dock…"   6 weeks ago         Up 10 days                                                                                                                                              inc_logshipper
f788fcd2742b        incognitochain/incognito-mainnet:20191227_1   "/bin/sh run_incogni…"   6 weeks ago         Up 10 days          0.0.0.0:9334->9334/tcp, 0.0.0.0:9433->9433/tcp                                                                                      inc_mainnet
994da074e85c        parity/parity:stable                          "/bin/parity --light…"   6 weeks ago         Up 10 days          5001/tcp, 8080/tcp, 8082-8083/tcp, 8180/tcp, 0.0.0.0:8545->8545/tcp, 8546/tcp, 0.0.0.0:30303->30303/tcp, 0.0.0.0:30303->30303/udp   eth_mainnet

I think no problem since I tap “Stake” button and it seems working.

2 Likes

Perfect, please do note about your PC specs:

  • 8 CPUs
  • 4 GBs of RAM
  • 500 GBs of SSD

As the sync data process consume a lot CPU and storage :slight_smile:
Anyway, the development team is working on the reduction of data size :wink:

5 Likes

Hey @khanhj,

CONTAINER ID        IMAGE                                         COMMAND                  CREATED             STATUS              PORTS                                                                                                                               NAMES
0ba327f146a3        incognitochain/incognito-mainnet:20200213_1   "/bin/sh run_incogni…"   33 hours ago        Up 33 hours         0.0.0.0:9335->9335/tcp, 0.0.0.0:9434->9434/tcp                                                                                      inc_mainnet2
fee43127e869        incognitochain/logshipper:1.0.0               "/usr/local/bin/dock…"   6 weeks ago         Up 13 days                                                                                                                                              inc_logshipper
f788fcd2742b        incognitochain/incognito-mainnet:20191227_1   "/bin/sh run_incogni…"   6 weeks ago         Up 13 days          0.0.0.0:9334->9334/tcp, 0.0.0.0:9433->9433/tcp                                                                                      inc_mainnet
994da074e85c        parity/parity:stable                          "/bin/parity --light…"   6 weeks ago         Up 13 days          5001/tcp, 8080/tcp, 8082-8083/tcp, 8180/tcp, 0.0.0.0:8545->8545/tcp, 8546/tcp, 0.0.0.0:30303->30303/tcp, 0.0.0.0:30303->30303/udp   eth_mainnet

This is the current output of docker ps. I have some questions. The difference between this output and the above output is that 3cbb737605ec was dead and 0ba327f146a3 is live. Besides, their images are different. Obviously, inc_mainnet2 docker restarted. Is this problem in terms of earning PRV? If problem exists, instead of restarting the docker container silently, could you put some logs stating why the container restarted? If not exist, why is one (20200205_1) of two images updated but the other not (20191227_1)?

2 Likes

Hey @abduraman,

You’re right about inc_mainnet2 restarted, this is expected behavior. The inc_mainnet2 is running latest incognito version 20200213_1
So, the real problem is inc_mainnet still running older version 20191227_1

Please execute these commands:
sudo ps -ef | grep run.sh
sudo kill -9 <process_id_of_run.sh>
sudo docker stop inc_mainnet
sudo bash run.sh

=> this will restart the run.sh file to pull the latest incognito build and then run on your inc_mainnet

We’ll troubleshoot the issue why your inc_mainnet not automatically update to newer version.

PS: this problem has nothing related to earning PRV

5 Likes

Thanks @khanhj . Now, they use the same image.

3 Likes

Is there a tutorial or a guide for setting up a pNode like we have for vNodes How to host a Virtual Node? If not can someone create one? Im currently running Ubuntu Server latest on Mac Mini.

2 Likes

:волна:






9 Likes

So I can get stats this is what I get.
22%20PM

5 Likes

Could anyone help me trouble shoot this…?

image

1 Like

Hi, can you try to split the command into two rows?
curl https://node.incognito.org/run.sh > run.sh && sed -i “s/xxx/validator_key/” run.sh
sudo bash run.sh
Let me know how it works.

2 Likes

Same thing it seems…

root@vmi347454:~# curl https://node.incognito.org/run.sh > run.sh && sed -i “s/xxx/mykeyhere/” run.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3043 100 3043 0 0 3747 0 --:–:-- --:–:-- --:–:-- 3752
sed: -e expression #1, char 1: unknown command: `▒’
root@vmi347454:~#

2 Likes

I am checking, please wait a moment.

2 Likes