hyperledger / indy-node-container

Providing Containers to run Indy Node
Apache License 2.0
20 stars 21 forks source link

Container Upgrade via Controller #108

Open Echsecutor opened 2 years ago

Echsecutor commented 2 years ago

@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 commented 2 years ago

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

tsurai commented 2 years ago

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?

Echsecutor commented 1 year ago

Decision for fix: