0

I am trying to integrate my own ABCI-application with the localnet. The docker-compose looks as

version: '3'

services:
  node0:
    container_name: node0
    image: "tendermint/localnode"
    ports:
      - "26656-26657:26656-26657"
    environment:
      - ID=0
      - LOG=${LOG:-tendermint.log}
    volumes:
      - ./build:/tendermint:Z
    command: node --proxy_app=tcp://abci0:26658
    networks:
      localnet:
        ipv4_address: 192.167.10.2

 abci0:
    container_name: abci0
    image: "abci-image"
    volumes:
      - $GOPATH/src/samplePOC:/go/src/samplePOC
    ports:
      - "26658:26658"
    build:
      context: .
      dockerfile: $GOPATH/src/samplePOC/Dockerfile
    command:  /go/src/samplePOC/samplePOC
    networks:
      localnet:
        ipv4_address: 192.167.10.6

Both the nodes and the abci- containers are built successfully. The ABCI server is started successfully and the nodes are trying to make connections. However the main problem is that the I see the two are not able to communicate with each other.

I get the following error:

node0 |E[2019-10-29|15:14:28.525] abci.socketClient failed to connect to tcp://abci0:26658. Retrying... module=abci-client connection=query err="dial tcp 192.167.10.6:26658: connect: connection refused"

Can someone please help me here?

SuperStar518
  • 2,814
  • 2
  • 20
  • 35
Srinath
  • 66
  • 4

2 Answers2

1

My first thought is that you may need to add a depends_on: ["abci0"] to node0, as the ABCI application must be listening before Tendermint will try to connect.

Of course, TM should continue to retry so this may not be the issue.

Another thing you can try, is to run tendermint on your host machine, and attempt to connect to the exposed port of ABCI port on abci0 (26658) to isolate the problem to the docker configuration.

If you're not able to run tendermint node --proxy_app=tcp://localhost:26658 the problem likely lies in your ABCI application.

I assume you've initialized a directory in the volume you mount into node0?

  • Firstly, thnx for ur response. When I use only local host, tendermint and abci are connecting to each other. Problem only with docker Upon chaning `tendermint node --proxy_app=tcp://localhost:26658`in the `docker-compose.yml` file, I still get the same output. I don't quite understand your last question on initializing the directory in the volume for `node0`. Could you please elaborate a bit further? – Srinath Nov 08 '19 at 12:36
  • When I try to run tendermint on my local host, and attempt to connect to the exposed port of ABCI port on `abci` (26658) inside docker container, I still get connection refused error. – Srinath Nov 08 '19 at 12:45
  • Re. initializing a directory, I mean have you setup a Tendermint Home directory (with `tendermint init`). I assume when you run everything locally (without docker or docker-compose) you have a folder at `~/.tendermint` that has your configuration. The dockerized Tendermint `node0` will need a configuration as well. I'm not familiar with the TM image you are using, so you may not need to. – Henry Harder Nov 08 '19 at 22:37
  • Can you try using your dockerfile, but remove the `networks:` section from each service? This will force docker-compose to make a default network. – Henry Harder Nov 08 '19 at 22:38
  • I wrote a docker file for my abci-application which is working fine when I run `docker build .` but is not working on `docker-compose`. Also, I haven't seperately dockerized tendermint node. Any idea how you would do that? Right now, am only using the `tendermint/localnode` image generated from the `docker-compose.yml` file. – Srinath Nov 18 '19 at 11:42
0

I got this working with the kvstore example from Tendermint.

version: "3.4"

services:
  kvstore-app:
    image: alpine
    expose:
      - "26658"
    volumes:
      - ./kvstore-example:/home/dev/kvstore-example
    command: "/home/dev/kvstore-example --socket-addr tcp://kvstore-app:26658"
  tendermint-node:
    image: tendermint/tendermint
    depends_on: 
      - kvstore-app
    ports:
      - "26657:26657"
    environment:
      - TMHOME=/tmp/tendermint
    volumes:
      - ./tmp/tendermint:/tmp/tendermint
    command: node --proxy_app=tcp://kvstore-app:26658

I'm not exactly sure why your docker-compose.yml isn't working, but it's likely that you are not binding the socket of your abci application in a way that is accessible to the node. I'm explicitly telling the abci application to do so with the argument --socket-addr tcp://kvstore-app:26658". Additionally, I'm just exposing the port of the abci application on the docker network, but I think mapping the port should do this implicitly.

Also I would get rid of all the network stuff. Personally, I use the network configuration only if I have some very specific network goals in mind.

Valakyr
  • 151
  • 1
  • 5