mesg-foundation / engine

Build apps or autonomous workflows with reusable, shareable integrations connecting any service, app, blockchain or decentralized network.
https://mesg.com/
Apache License 2.0
130 stars 13 forks source link

Mesg-cli issues in Debian 10 (Buster) #1429

Closed Joanmacat closed 4 years ago

Joanmacat commented 4 years ago

Hello all,

I am trying to run mesg-cli on a Debian 10 (Buster) and I am having some issues. One of them is everytime I try to deploy a service (or compiling it from github) the terminal remains in "Creating service..." with nothing more to say. That happenned to me with webhook, emit event and ethereum rc20 service as well.

When I execute mesg-cli daemon:logs I get the following:

time="2019-10-24T14:46:22Z" level=info msg="Deploying service \"marketplace\"" module=main
time="2019-10-24T14:46:24Z" level=info msg="Service \"marketplace\" deployed with hash \"6xapARQBWDYs3nJvh7iNrXaSwNtNXjW7zCdqew4RFRZV\"" module=main
time="2019-10-24T14:46:25Z" level=info msg="Instance started with hash \"5tAqvTPfXNYe6rFgRk2Xsg9Taf7f5LeDPLrceyXUpTJ7\"" module=main
time="2019-10-24T14:46:25Z" level=info msg="Deploying service \"ethwallet\"" module=main
time="2019-10-24T14:46:25Z" level=info msg="Service \"ethwallet\" deployed with hash \"81EqBbSDrhLCz9DRZiy2TyjqrgHPDaGSbvAuBgE9X1ZD\"" module=main
time="2019-10-24T14:46:26Z" level=info msg="Instance started with hash \"3kEPTrJbGhFdjLzeCTi868CkVMaiEQdpUgexQXRX13Fk\"" module=main
time="2019-10-24T14:46:26Z" level=info msg="starting MESG Engine version v0.15.0" module=main
time="2019-10-24T14:46:26Z" level=info msg="starting process engine" module=main
time="2019-10-24T14:46:26Z" level=info msg="server listens on [::]:50052" module=grpc

I executed the following command, as your team suggested me, docker service ls and I got the follow:

9a1muq1snp88        engine              replicated          1/1                 mesg/engine:v0.15   *:50052->50052/tcp

Anyone knows what can happen? Is a problem of permissions, about docker? I'll try to reinstall everything, docker included, to discart a possible bad installation.

Thank you very much!

NicolasMahe commented 4 years ago

I tried to install engine and mesg-cli on debian 10 on a digital ocean by following the following steps without issues (except a special config to set to npm because the machine has only one user that is root):

# install node and npm
apt install nodejs

# install docker
# see https://docs.docker.com/install/linux/docker-ce/debian/
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io

# install mesg-cli
npm install -g mesg-cli

# if you get `EACCES` error when running `npm install -g mesg-cli`, try the following and reinstall mesg-cli
# see https://github.com/mesg-foundation/cli/issues/76
npm config set user 0
npm config set unsafe-perm true

# init docker swarm
docker swarm init

# start the engine
mesg-cli daemon:start

# log engine
mesg-cli daemon:logs

# wait for the log to display:
`time="2019-10-25T03:13:38Z" level=info msg="server listens on [::]:50052" module=grpc`

# stop log or open new terminal to list services
mesg-cli service:list
# it should display:
HASH                                         SID         INSTANCES                                    
6xapARQBWDYs3nJvh7iNrXaSwNtNXjW7zCdqew4RFRZV marketplace 5tAqvTPfXNYe6rFgRk2Xsg9Taf7f5LeDPLrceyXUpTJ7 
81EqBbSDrhLCz9DRZiy2TyjqrgHPDaGSbvAuBgE9X1ZD ethwallet   3kEPTrJbGhFdjLzeCTi868CkVMaiEQdpUgexQXRX13Fk 

# now that the engine is correctly started with its 2 required services, we can start the service from the tuto:
mesg-cli service:create "$(mesg-cli service:compile https://github.com/mesg-foundation/service-ethereum-erc20)"
# output:
Create service... J44iJRPX6gmKJzjyfQBxBoLXzBehKcS6Be432k4kG1Us

# list services
mesg-cli service:list
# output:
HASH                                         SID            INSTANCES                                    
6xapARQBWDYs3nJvh7iNrXaSwNtNXjW7zCdqew4RFRZV marketplace    5tAqvTPfXNYe6rFgRk2Xsg9Taf7f5LeDPLrceyXUpTJ7 
81EqBbSDrhLCz9DRZiy2TyjqrgHPDaGSbvAuBgE9X1ZD ethwallet      3kEPTrJbGhFdjLzeCTi868CkVMaiEQdpUgexQXRX13Fk 
J44iJRPX6gmKJzjyfQBxBoLXzBehKcS6Be432k4kG1Us ethereum-erc20

Can you reproduce those steps and tell me if it solves your issue. Maybe reinstall node, npm, mesg-cli and docker as you told me..

Joanmacat commented 4 years ago

Hello Nicolas,

I did all your steps, from the very beginning and things get worse... now when I execute mesg-cli daemon:logs I get a continuous log that never stop:

time="2019-10-27T12:40:57Z" level=info msg="Committed state" appHash=28F2E8E9D984E47306AD90DD094731BEA2907BF28AA1191A8CCECF53842A36BC height=3580 module=state txs=0
time="2019-10-27T12:40:57Z" level=info msg="Indexed block" height=3580 module=txindex
time="2019-10-27T12:40:57Z" level=info msg="Timed out" dur=698.656784ms height=3581 module=consensus round=0 step=RoundStepNewHeight
time="2019-10-27T12:40:57Z" level=info msg="enterNewRound(3581/0). Current: 3581/0/RoundStepNewHeight" height=3581 module=consensus round=0
time="2019-10-27T12:40:57Z" level=info msg="enterPropose(3581/0). Current: 3581/0/RoundStepNewRound" height=3581 module=consensus round=0
time="2019-10-27T12:40:57Z" level=info msg="enterPropose: Our turn to propose" height=3581 module=consensus privValidator="PrivValidator{301EE9869900A57FAF4659309430036F119282D1 LH:3580, LR:0, LS:3}" proposer=301EE9869900A57FAF4659309430036F119282D1 round=0
time="2019-10-27T12:40:57Z" level=info msg="Signed proposal" height=3581 module=consensus proposal="Proposal{3581/0 (70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540:1:5562DB3ECAED, -1) 1678AF94FD8C @ 2019-10-27T12:40:57.8672983Z}" round=0
time="2019-10-27T12:40:57Z" level=info msg="Received proposal" module=consensus proposal="Proposal{3581/0 (70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540:1:5562DB3ECAED, -1) 1678AF94FD8C @ 2019-10-27T12:40:57.8672983Z}"
time="2019-10-27T12:40:58Z" level=info msg="Received complete proposal block" hash=70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540 height=3581 module=consensus
time="2019-10-27T12:40:58Z" level=info msg="enterPrevote(3581/0). Current: 3581/0/RoundStepPropose" module=consensus
time="2019-10-27T12:40:58Z" level=info msg="enterPrevote: ProposalBlock is valid" height=3581 module=consensus round=0
time="2019-10-27T12:40:58Z" level=info msg="Signed and pushed vote" err="<nil>" height=3581 module=consensus round=0 vote="Vote{0:301EE9869900 3581/00/1(Prevote) 70682F6B2C91 E3C50305C260 @ 2019-10-27T12:40:58.004794117Z}"
time="2019-10-27T12:40:58Z" level=info msg="Added to prevote" module=consensus prevotes="VoteSet{H:3581 R:0 T:1 +2/3:70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540:1:5562DB3ECAED(1) BA{1:x} map[]}" vote="Vote{0:301EE9869900 3581/00/1(Prevote) 70682F6B2C91 E3C50305C260 @ 2019-10-27T12:40:58.004794117Z}"
time="2019-10-27T12:40:58Z" level=info msg="Updating ValidBlock because of POL." POLRound=0 module=consensus validRound=-1
time="2019-10-27T12:40:58Z" level=info msg="enterPrecommit(3581/0). Current: 3581/0/RoundStepPrevote" height=3581 module=consensus round=0
time="2019-10-27T12:40:58Z" level=info msg="enterPrecommit: +2/3 prevoted proposal block. Locking" hash=70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540 height=3581 module=consensus round=0
time="2019-10-27T12:40:58Z" level=info msg="Signed and pushed vote" err="<nil>" height=3581 module=consensus round=0 vote="Vote{0:301EE9869900 3581/00/2(Precommit) 70682F6B2C91 AC598C7CCBFC @ 2019-10-27T12:40:58.106299505Z}"
time="2019-10-27T12:40:58Z" level=info msg="Added to precommit" module=consensus precommits="VoteSet{H:3581 R:0 T:2 +2/3:70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540:1:5562DB3ECAED(1) BA{1:x} map[]}" vote="Vote{0:301EE9869900 3581/00/2(Precommit) 70682F6B2C91 AC598C7CCBFC @ 2019-10-27T12:40:58.106299505Z}"
time="2019-10-27T12:40:58Z" level=info msg="enterCommit(3581/0). Current: 3581/0/RoundStepPrecommit" commitRound=0 height=3581 module=consensus
time="2019-10-27T12:40:58Z" level=info msg="Commit is for locked block. Set ProposalBlock=LockedBlock" blockHash=70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540 commitRound=0 height=3581 module=consensus
time="2019-10-27T12:40:58Z" level=info msg="Finalizing commit of block with 0 txs" hash=70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540 height=3581 module=consensus root=28F2E8E9D984E47306AD90DD094731BEA2907BF28AA1191A8CCECF53842A36BC
time="2019-10-27T12:40:58Z" level=info msg="Block{\n  Header{\n    Version:        {10 0}\n    ChainID:        mesg-dev-chain\n    Height:         3581\n    Time:           2019-10-27 12:40:56.720179317 +0000 UTC\n    NumTxs:         0\n    TotalTxs:       0\n    LastBlockID:    F83E7F204463258FAB9FCDB1DB6DEE90CA6785B78A0709E2C89C881C229AA94F:1:7305AC367884\n    LastCommit:     F46E8FD0A5C6EE35A0701B5062C348E8646EE263FFA963894A09F259FD5478CF\n    Data:           \n    Validators:     E791689C82B2D7AC9F6A327ADA1CC3C90A34C6E1B333C8C86DD1D52D5B1FE8A0\n    NextValidators: E791689C82B2D7AC9F6A327ADA1CC3C90A34C6E1B333C8C86DD1D52D5B1FE8A0\n    App:            28F2E8E9D984E47306AD90DD094731BEA2907BF28AA1191A8CCECF53842A36BC\n    Consensus:      048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F\n    Results:        \n    Evidence:       \n    Proposer:       301EE9869900A57FAF4659309430036F119282D1\n  }#70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540\n  Data{\n    \n  }#\n  EvidenceData{\n    \n  }#\n  Commit{\n    BlockID:    F83E7F204463258FAB9FCDB1DB6DEE90CA6785B78A0709E2C89C881C229AA94F:1:7305AC367884\n    Precommits:\n      Vote{0:301EE9869900 3580/00/2(Precommit) F83E7F204463 83403229529B @ 2019-10-27T12:40:56.720179317Z}\n  }#F46E8FD0A5C6EE35A0701B5062C348E8646EE263FFA963894A09F259FD5478CF\n}#70682F6B2C91D74FD98BA7F929DB3831716FB9DB408F0C122BCBC8489C5BF540" module=consensus
time="2019-10-27T12:40:58Z" level=info msg="Executed block" height=3581 invalidTxs=0 module=state validTxs=0
time="2019-10-27T12:40:58Z" level=info msg="Committed state" appHash=2D8E3AD355DC7634B8E4940936FC6358AFBABE6C42851D7B9F743E112F9EAF16 height=3581 module=state txs=0
time="2019-10-27T12:40:58Z" level=info msg="Indexed block" height=3581 module=txindex

And so on... The engine works fine, everytime I execute mesg-cli daemon:start says "Engine is already enabled" but the docker service ls changed a bit:

i9qnge8px1ke        engine              replicated          1/1                 mesg/engine:v0.16   *:26656->26656/tcp, *:50052->50052/tcp

Now I see two kind of ports in the docker service. I don't know, if you need some other log I can paste here.

Thanks :)

NicolasMahe commented 4 years ago

We released a new version of the engine that is now using a tendermint to run the blockchain, that's why now the log get updated every second with a new block, and also we removed the 2 services that were started with the engine. So your engine is running fine. The docker service ls looks good (yes there is 2 ports exposed, one for rpc and one for p2p.

Can you run the cli with a service:list:

mesg-cli service:list
# output should be (no service, but no error):
HASH SID OWNER INSTANCES

Now to create a service you'll need to enter an account name and passphrase. The default one when you start the engine without special genesis config is dev and pass:

➜  ~ mesg-cli service:create "$(mesg-cli service:compile https://github.com/mesg-foundation/service-ethereum-erc20)"

? Select the account to use dev
Type the passphrase: ****
Create service... GvbKYCwsfxMPXTJShrpTS4SbPsR39yi2RXzJwK4Q3zTB

We are currently updating the docs to reflect the last version modification!

Joanmacat commented 4 years ago

Sorry but anything outputs, even the tags like HASH, SID, OWNER and INSTANCES:

Captura de 2019-10-28 18-38-49

Ans remains there. When I execute the mesg-cli service:create, I am still the same with nothing to output. There is any kind of log I can check to see if something wrong is happening?

Thanks.

NicolasMahe commented 4 years ago

Try:

DEBUG=\* mesg-cli service:list

source

Joanmacat commented 4 years ago

Hello, I did it and I got the follow:

root@debianmarc:~# DEBUG=\* mesg-cli service:list
  @oclif/config reading core plugin /usr/lib/node_modules/mesg-cli +0ms
  @oclif/config loadJSON /usr/lib/node_modules/mesg-cli/package.json +0ms
  @oclif/config loadJSON /usr/lib/node_modules/mesg-cli/oclif.manifest.json +3ms
  @oclif/config:mesg-cli using manifest from /usr/lib/node_modules/mesg-cli/oclif.manifest.json +0ms
  @oclif/config reading user plugins pjson /root/.local/share/mesg-cli/package.json +0ms
  @oclif/config loadJSON /root/.local/share/mesg-cli/package.json +3ms
  @oclif/config loading plugins [ '@oclif/plugin-help', '@oclif/plugin-not-found' ] +0ms
  @oclif/config reading core plugin /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-help +0ms
  @oclif/config loadJSON /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-help/package.json +3ms
  @oclif/config reading core plugin /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-not-found +0ms
  @oclif/config loadJSON /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-not-found/package.json +0ms
  @oclif/config loadJSON /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-help/oclif.manifest.json +0ms
  @oclif/config loadJSON /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-not-found/oclif.manifest.json +2ms
  @oclif/config:@oclif/plugin-help using manifest from /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-help/oclif.manifest.json +0ms
  @oclif/config:@oclif/plugin-not-found using manifest from /usr/lib/node_modules/mesg-cli/node_modules/@oclif/plugin-not-found/oclif.manifest.json +0ms
  @oclif/config config done +6ms
  @oclif/config start init hook +1ms
  @oclif/config init hook done +0ms
  mesg-cli init version: @oclif/command@1.5.19 argv: [ 'service:list' ] +0ms
  @oclif/config runCommand service:list [] +4ms
  @oclif/config:mesg-cli require /usr/lib/node_modules/mesg-cli/lib/commands/service/list.js +14ms
  @oclif/config start prerun hook +218ms
  @oclif/config prerun hook done +0ms
  mesg-cli:service:list init version: @oclif/command@1.5.19 argv: [] +0ms

And there remains, without returning nothing. I did a DEBUG from mesg-cli daemon:start and I added in a pastebin here: https://0bin.net/paste/R0g1AKOhfB6MEu2Y#ZQVm2mIOpsLCYx4fWO5W04jxLKJlwVA8wegNxrpZSvT

NicolasMahe commented 4 years ago

Which version of node and npm are you using?

Joanmacat commented 4 years ago

I am using: Captura de 2019-10-30 11-47-11

antho1404 commented 4 years ago

It looks like your CLI cannot communicate with the API of the engine.

There is two ways to test that:

First, make sure that the engine is properly started, just in case you can restart it.

Library

If this works then the problem is not from your node environment nor your engine (so maybe the CLI). If it doesn't you may have an issue with your node environment and you can try the next step to exclude the node environment issue.

GRPCurl

If none of this works then it may be some network issues with your docker, so a good way could be to clean-up your docker with existing docker services or container that may use the same port 50052 or networks with the same name engine.

I hope this can help ;)

Joanmacat commented 4 years ago

Aha! Look what it says:

Failed to dial target host "localhost:50052": context deadline exceeded
root@debianmarc:~/engine# ./grpcurl -proto protobuf/api/service.proto -plaintext localhost:50052 mesg.api.Service/List
Failed to dial target host "localhost:50052": context deadline exceeded
root@debianmarc:~/engine# 

I will try to clean the docker as you say. Maybe could help meanwhile.

antho1404 commented 4 years ago

Can you just check just in case you are not using a docker-machine? echo $DOCKER_HOST should be empty and if it's not what might be the reason and in that case you need to use the IP address of DOCKER_HOST to reach the API and on the cli use the --host IP to make it work. This is unlikely because you should have a different error but worse trying.

And otherwise, you can try to clean and maybe reinstall your docker, you may have a problem with your networks. https://docs.docker.com/install/linux/docker-ce/debian/

Joanmacat commented 4 years ago

Hello all, echo $DOCKER_HOST returns me:

Captura de 2019-10-31 12-34-36

In fact I am very new in dockers too, how can I use IP address to reach the CLI? Thank you very much for your endless patience!

antho1404 commented 4 years ago

You might want to reinstall your docker, I think you had an issue while installing docker. You can check https://docs.docker.com/install/linux/docker-ce/debian/ or the instructions from @NicolasMahe https://github.com/mesg-foundation/engine/issues/1429#issuecomment-546184292

Joanmacat commented 4 years ago

Hello! Indeed it was.

I reinstalled the docker and finally worked well. I don't know what was the problem extactly but it worked.

Thanks a lot for your help all of this time :) I'll close the topic now.