No address associated with hostname thrown by RabbitMQ/Rasa-X

rabbit_1           | 2019-08-23 09:31:07.827 [info] <0.8.0> Server startup complete; 3 plugins started.
rabbit_1           |  * rabbitmq_management
rabbit_1           |  * rabbitmq_web_dispatch
rabbit_1           |  * rabbitmq_management_agent
rasa-x_1           | WARNING:rasax.community.services.model_service:Could not run model discovery.
rasa-x_1           | Starting Rasa X server... ๐Ÿš€
rasa-x_1           | Caught an exception while consuming events. Will retry in 5s
rasa-x_1           | Traceback (most recent call last):
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasax/community/services/event_service.py", line 989, in continuously_consume
rasa-x_1           |     queue=config.rabbitmq_queue,
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasax/community/services/event_service.py", line 912, in __init__
rasa-x_1           |     connection = pika.BlockingConnection(parameters)
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
rasa-x_1           |     self._impl = self._create_connection(parameters, _impl_class)
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
rasa-x_1           |     raise self._reap_last_connection_workflow_error(error)
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/pika/adapters/utils/selector_ioloop_adapter.py", line 564, in _resolve
rasa-x_1           |     self._flags)
rasa-x_1           |   File "/usr/local/lib/python3.6/socket.py", line 745, in getaddrinfo
rasa-x_1           |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
rasa-x_1           | socket.gaierror: [Errno -5] No address associated with hostname

โ†’ Things to Note:

  1. I am working on a CentOS machine and since there is no automated script for it, I am trying to manually install Rasa-X and deploy it through docker.

  2. I have another project that is my action server and I have modified the docker-compose.yml file as shown below to work with that project and also I need it to use the hostโ€™s PostgreSQL database for which I am adding network_mode as host.

  3. Since I am using host mode, the worker and production images are both trying to run on 5005 which is not possible so I am running worker on 5006.

Challenges:

  1. No address associated with hostname thrown from the rasa-x container, probably some issue interfacing with the rabbitmq container.
  2. Could not run model discovery which is shown as a warning but the it takes 2-3 mins before that warning is shown so I am assuming it is trying to run for that time blocking the start of the Rasa X server.
version: "3.4"

x-database-credentials: &database-credentials
  DB_HOST: "${DB_HOST}"
  DB_PORT: "5432"
  DB_USER: "${DB_USER}"
  DB_PASSWORD: "${DB_PASSWORD}"
  DB_LOGIN_DB: "${DB_LOGIN_DB}"

x-rabbitmq-credentials: &rabbitmq-credentials
  RABBITMQ_HOST: "rabbit"
  RABBITMQ_USERNAME: "user"
  RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}

x-rasax-credentials: &rasax-credentials
  LOCAL_MODE: "false"
  RASA_X_HOST: "http://rasa-x:5002"
  RASA_X_TOKEN: ${RASA_X_TOKEN}
  JWT_SECRET: ${JWT_SECRET}
  RASA_USER_APP: "http://app:5055"
  RASA_WORKER_HOST: "http://rasa-worker:5006"
  RASA_TOKEN: ${RASA_TOKEN}
  RASA_WORKER_TOKEN: ${RASA_TOKEN}

x-rasa-credentials: &rasa-credentials
  <<: *rabbitmq-credentials
  <<: *rasax-credentials
  <<: *database-credentials
  RASA_TOKEN: ${RASA_TOKEN}
  RASA_MODEL_PULL_INTERVAL: 10

x-rasa-services: &default-rasa-service
  restart: always
  image: "rasa/rasa:${RASA_VERSION}-full"
  network_mode: host
  volumes:
    - ./credentials.yml:/app/credentials.yml
    - ./endpoints.yml:/app/endpoints.yml
  depends_on:
    - rasa-x
    - rabbit

services:
  rasa-x:
    restart: always
    image: "rasa/rasa-x:${RASA_X_VERSION}"
    network_mode: host
    expose:
      - "5002"
    volumes:
      - ./models:/app/models
      - ./environments.yml:/app/environments.yml
      - ./logs:/logs
      - ./auth:/app/auth
    environment:
      <<: *database-credentials
      <<: *rasa-credentials
      SELF_PORT: "5002"
      DB_DATABASE: "${DB_DATABASE}"
      RASA_MODEL_DIR: "/app/models"
      RABBITMQ_QUEUE: "${RABBITMQ_QUEUE}"
      PASSWORD_SALT: ${PASSWORD_SALT}
      RASA_X_USER_ANALYTICS: "0"
      SANIC_RESPONSE_TIMEOUT: "3600"

  rasa-production:
    <<: *default-rasa-service
    environment:
      <<: *rasa-credentials
      DB_DATABASE: "${DB_DATABASE}"
      RABBITMQ_QUEUE: "${RABBITMQ_QUEUE}"
      RASA_MODEL_SERVER: "http://rasa-x:5002/api/projects/default/models/tags/production"
    command: >
      x
      --no-prompt
      --production
      --port 5005
      --jwt-method HS256
      --jwt-secret ${JWT_SECRET}
      --auth-token '${RASA_TOKEN}'
      --cors "*"

  rasa-worker:
    <<: *default-rasa-service
    environment:
      <<: *rasa-credentials
      DB_DATABASE: "${DB_DATABASE}"
      RABBITMQ_QUEUE: "rasa_worker_events"
      RASA_MODEL_SERVER: "http://rasa-x:5002/api/projects/default/models/tags/production"
    command: >
      x
      --no-prompt
      --production
      --port 5006
      --jwt-method HS256
      --jwt-secret ${JWT_SECRET}
      --auth-token '${RASA_TOKEN}'
      --cors "*"
  app:
    restart: always
    image: "rasa_app:latest"
    expose:
      - "5055"
    volumes:
      - ${RASA_ACTIONS_SERVER}:/app
    depends_on:
      - rasa-production


  rabbit:
    restart: always
    image: "bitnami/rabbitmq:3.7.17"
    network_mode: host
    environment:
      RABBITMQ_HOST: "rabbit"
      RABBITMQ_USERNAME: "user"
      RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
      RABBITMQ_DISK_FREE_LIMIT: "{mem_relative, 0.1}"
    expose:
      - "5672"

  duckling:
    restart: always
    image: "rasa/duckling:latest"
    expose:
      - "8000"
    command: ["duckling-example-exe", "--no-access-log", "--no-error-log"]

  nginx:
    restart: always
    image: "rasa/nginx:${RASA_X_VERSION}"
    ports:
      - "89:8080"
      # - "443:8443"
    volumes:
      - ./certs:/opt/bitnami/certs
      - ./terms:/opt/bitnami/nginx/conf/bitnami/terms
    depends_on:
      - rasa-x
      - rasa-production
      - app

  logger:
    restart: always
    image: "rasa/logger:${RASA_X_VERSION}"
    command: ["/bin/sh", "-c", "docker-compose logs --no-color -f > /logs/compose_`date '+%Y-%m-%d_%H:%M:%S'`.log"]
    volumes:
      - ./logs:/logs
      - ./.env/:${RASA_X_PATH}/.env
      - ./docker-compose.yml:${RASA_X_PATH}/docker-compose.yml
      - /var/run/docker.sock:/var/run/docker.sock
    working_dir: ${RASA_X_PATH}
    depends_on:
      - rasa-x
      - rasa-production
      - app
      - nginx
      - duckling
      - rabbit

In case you want detailed logs, attaching that as well.

compose_2019-08-23_09:30:57.log (25.1 KB)

Thanks in advance, any sort of insights will be appreciated.

Hi @dhwanils95 the nginx logs seem to say that no host rasa-production was found. I assume network_mode: host means they run on localhost paths instead of docker paths? Any reason this is actually necessary? You would have to set the environment variables RASA_X_HOST, RASA_PRODUCTION_HOST and CUSTOM_ACTION_HOST to the correct host names if you want to go this way

Hey @akelad,

I put network_mode: host so as to make the containers use the postgreSQL database I have setup on my host machine.

I actually got a solution for that. Instead of using network_mode host. Put your database host as the IP of your dockerโ€™s default network settings, usually 172.17.0.1! After that I configure my PG to listen to all requests from the network instead of only localhost which works.

Keeping network mode as host messes up the mapping for the services and hosts.

Thanks for your reply though.

1 Like