indy-node-container icon indicating copy to clipboard operation
indy-node-container copied to clipboard

Container Upgrade via Controller

Open Echsecutor opened this issue 3 years ago • 3 comments
trafficstars

@c2bo had problems upgrading via the controller container:

indy_node_controller | 2022-08-26 07:55:58,559|INFO|container_node_control_tool.py|Node control tool is starting up on 0.0.0.0 port 30003
indy_node_controller | 2022-08-26 07:55:58,559|DEBUG|container_node_control_tool.py|Waiting for the next event
indy_node_controller | 2022-08-26 08:20:00,897|DEBUG|container_node_control_tool.py|New connection from ('127.0.0.1', 57614) on fd 5
indy_node_controller | 2022-08-26 08:20:00,897|DEBUG|container_node_control_tool.py|Waiting for the next event
indy_node_controller | 2022-08-26 08:20:00,897|DEBUG|container_node_control_tool.py|Received "b'{"version": "1.12.6", "pkg_name": "indy-node", "message_type": "upgrade"}'" from ('127.0.0.1', 57614) on fd 5
indy_node_controller | 2022-08-26 08:20:00,898|DEBUG|container_node_control_tool.py|Decoded 
indy_node_controller | 2022-08-26 08:20:00,898|INFO|container_node_control_tool.py|Upgrading indy
indy_node_controller | Error response from daemon: user specified IP address is supported only when connecting to networks with user configured subnets
indy_node_controller | Error: failed to start containers: indy_node
indy_node_controller | 2022-08-26 08:20:55,326|ERROR|container_node_control_tool.py|Unexpected error in _process_data must be str, not int
indy_node_controller | 2022-08-26 08:20:55,327|DEBUG|container_node_control_tool.py|Waiting for the next event
indy_node_controller | 2022-08-26 08:20:55,327|DEBUG|container_node_control_tool.py|Closing socket with fd 5
indy_node_controller | 2022-08-26 08:20:55,327|DEBUG|container_node_control_tool.py|Waiting for the next event

usgin the docker-compose.yml

version: "3.7"

services:
  indy-node:
    image: ${IMAGE}
    container_name: ${NODE_CONTAINER_NAME}
    ports:
      - "${INDY_NODE_PORT}:${INDY_NODE_PORT}"
      - "${INDY_CLIENT_PORT}:${INDY_CLIENT_PORT}"
    volumes:
      - ./etc_indy:/etc/indy
      - ./lib_indy:/var/lib/indy
      - ./log_indy:/var/log/indy
    environment:
      - INDY_NODE_IP=${INDY_NODE_IP}
      - INDY_NODE_PORT=${INDY_NODE_PORT}
      - INDY_CLIENT_IP=${INDY_CLIENT_IP}
      - INDY_CLIENT_PORT=${INDY_CLIENT_PORT}
      - INDY_NETWORK_NAME=${INDY_NETWORK_NAME}
      - INDY_NODE_NAME=${INDY_NODE_NAME}
    env_file:
      - .node.env
    restart: unless-stopped

  indy-controller:
    image: ${IMAGE_NAME_CONTROLLER}
    init: true
    container_name: ${CONTROLLER_CONTAINER}
    environment:
     - NODE_CONTAINER=${NODE_CONTAINER_NAME}
     - INDY_NETWORK_NAME=${INDY_NETWORK_NAME}
     - CONTROLLER_CONTAINER=${CONTROLLER_CONTAINER}
    volumes:
      - ./etc_indy:/etc/indy
      - ${SOCK}:/var/run/docker.sock
    restart: unless-stopped
    network_mode: "service:indy-node"

@tsurai could you have a look at this?

Echsecutor avatar Sep 01 '22 15:09 Echsecutor

Problem: https://github.com/hyperledger/indy-node-container/blob/main/controller/upgrade_indy.sh#L58 expects fixed IP for container

Echsecutor avatar Sep 16 '22 07:09 Echsecutor

While fixing this issue another problem has become visible. We are currently using an internal service network for the communication between node and controller for ease of configuration. Internally the controller refers to the container with its ID in the network settings. Upgrading the node results in a new ID and thus the controller uses its network connectivity.

We either have to use fixed IPs which afaik is not the best practice or use dns. The later requires the node to know the controllers hostname and write it into indy_config.py for controlServiceHost.

Should I proceed with this solution?

tsurai avatar Oct 06 '22 13:10 tsurai

Decision for fix:

  • change https://github.com/hyperledger/indy-node-container/blob/main/run/docker-compose.yml : do not use network_mode: "service:indy-node" + access via localhost but use dockers default networking + access via hostname=container name

Echsecutor avatar Nov 25 '22 08:11 Echsecutor