Connection refused (:5005)

  • Windows 10 (ip: 10.19.163.1)
  • Ubuntu 18.04 (ip: 10.19.163.0)

I followed Docker-Compose Quick Install deployed my bot on Ubuntu 18.04, everything is fine. When I type this in Windows 10 terminal it show me “connection refused”:

curl -X POST -H "Content-Type:application/json" -d "{\"sender\": \"Rasa\",\"message\": \"Hi\"}" http://10.19.163.0:5005/webhooks/rest/webhook
curl: (7) Failed to connect to 10.19.163.0 port 5005: Connection refused

10.19.163.0 is Ubuntu’s IP address.

/etc/rasa/docker-compose.yml :

version: "3.4"
x-database-credentials: &database-credentials
  DB_HOST: "db"
  DB_PORT: "5432"
  DB_USER: "${DB_USER:-admin}"
  DB_PASSWORD: "${DB_PASSWORD}"
  DB_LOGIN_DB: "${DB_LOGIN_DB:-rasa}"

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

x-redis-credentials: &redis-credentials
  REDIS_HOST: "redis"
  REDIS_PORT: "6379"
  REDIS_PASSWORD: ${REDIS_PASSWORD}
  REDIS_DB: "1"

x-duckling-credentials: &duckling-credentials
  RASA_DUCKLING_HTTP_URL: "http://duckling:8000"

x-rasax-credentials: &rasax-credentials
  LOCAL_MODE: "false"
  RASA_X_HOST: "http://rasa-x:5002"
  RASA_X_USERNAME: ${RASA_X_USERNAME:-admin}
  RASA_X_PASSWORD: ${RASA_X_PASSWORD:-}
  RASA_X_TOKEN: ${RASA_X_TOKEN}
  JWT_SECRET: ${JWT_SECRET}
  RASA_USER_APP: "http://app:5055"
  RASA_PRODUCTION_HOST: "http://rasa-production:5005"
  RASA_WORKER_HOST: "http://rasa-worker:5005"
  RASA_TOKEN: ${RASA_TOKEN}

x-rasa-credentials: &rasa-credentials
  <<: *rabbitmq-credentials
  <<: *rasax-credentials
  <<: *database-credentials
  <<: *redis-credentials
  <<: *duckling-credentials
  RASA_TOKEN: ${RASA_TOKEN}
  RASA_MODEL_PULL_INTERVAL: 10
  RABBITMQ_QUEUE: "rasa_production_events"

x-rasa-services: &default-rasa-service
  restart: always
  image: "rasa/rasa:${RASA_VERSION}-full"
  expose:
    - "5005"
  command: >
    x 
    --no-prompt
    --production
    --config-endpoint http://rasa-x:5002/api/config?token=${RASA_X_TOKEN}
    --jwt-method HS256
    --jwt-secret ${JWT_SECRET}
    --auth-token '${RASA_TOKEN}'
    --cors "*"
    --port 5005
    --enable-api
  depends_on:
    - rasa-x
    - rabbit
    - redis

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

  rasa-production:
    <<: *default-rasa-service
    environment:
      <<: *rasa-credentials
      RASA_ENVIRONMENT: "production"
      DB_DATABASE: "tracker"
      RASA_MODEL_SERVER: "http://rasa-x:5002/api/projects/default/models/tags/production"

  rasa-worker:
    <<: *default-rasa-service
    environment:
      <<: *rasa-credentials
      RASA_ENVIRONMENT: "worker"
      DB_DATABASE: "worker_tracker"
      RASA_MODEL_SERVER: "http://rasa-x:5002/api/projects/default/models/tags/production"

  app:
    restart: always
    image: "rasa/rasa-x-demo:${RASA_X_DEMO_VERSION}"
    expose:
      - "5055"
    depends_on:
      - rasa-production

  db:
    restart: always
    image: "bitnami/postgresql:11.3.0"
    expose:
      - "5432"
    environment:
      POSTGRESQL_USERNAME: "${DB_USER:-admin}"
      POSTGRESQL_PASSWORD: "${DB_PASSWORD}"
      POSTGRESQL_DATABASE: "${DB_DATABASE:-rasa}"
    volumes:
      - ./db:/bitnami/postgresql

  rabbit:
    restart: always
    image: "bitnami/rabbitmq:3.7.17"
    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:
      - "80:8080"
      - "443:8443"
    volumes:
      - ./certs:/opt/bitnami/certs
      - ./terms:/opt/bitnami/nginx/conf/bitnami/terms
    depends_on:
      - rasa-x
      - rasa-production
      - app

  redis:
    restart: always
    image: "bitnami/redis:5.0.5"
    environment:
      REDIS_PASSWORD: ${REDIS_PASSWORD}
    expose:
      - "6379"

I tried this:

x-rasa-services: &default-rasa-service
  restart: always
  image: "rasa/rasa:${RASA_VERSION}-full"
  ports:
    - "5005:5005"
  command: >
    x 
    --no-prompt
    --production
    --config-endpoint http://rasa-x:5002/api/config?token=${RASA_X_TOKEN}
    --jwt-method HS256
    --jwt-secret ${JWT_SECRET}
    --auth-token '${RASA_TOKEN}'
    --cors "*"
    --port 5005
    --enable-api
  depends_on:
    - rasa-x
    - rabbit
    - redis

Show this error:

$ docker-compose up
Creating network "rasa_default" with the default driver
Creating rasa_duckling_1 ... done
Creating rasa_redis_1    ... done
Creating rasa_rabbit_1   ... done
Creating rasa_db_1       ... done
Creating rasa_rasa-x_1   ... done
Creating rasa_rasa-worker_1 ...
Creating rasa_rasa-worker_1     ... error
WARNING: Host is already in use by another container

ERROR: for rasa_rasa-worker_1  Cannot start service rasa-worker: driver failed programming external connectivity on endpoint rasa_rasa-worker_1 (c40a151dc0f99c1128a42f19719048f7d5c788a90d04e79548e903ed5fe90b23): Bi
Creating rasa_rasa-production_1 ... done
Creating rasa_app_1             ... done
Creating rasa_nginx_1           ... done

ERROR: for rasa-worker  Cannot start service rasa-worker: driver failed programming external connectivity on endpoint rasa_rasa-worker_1 (c40a151dc0f99c1128a42f19719048f7d5c788a90d04e79548e903ed5fe90b23): Bind for
0.0.0.0:5005 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.

$ docker ps -a

    CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                    PORTS                                      NAMES
    ecb9738ec242        rasa/rasa:1.9.5-full        "rasa x --no-prompt …"   3 minutes ago       Up 3 minutes              0.0.0.0:5005->5005/tcp                     rasa_rasa-worker_1
    9908fbf09e7f        rasa/rasa:1.9.5-full        "rasa x --no-prompt …"   3 minutes ago       Created                                                              rasa_rasa-production_1
    056a30b8f782        rasa/rasa-x:0.27.4          "sh -c 'user_id=$(id…"   3 minutes ago       Up 3 minutes              5002/tcp                                   rasa_rasa-x_1
    96857c097981        rasa/duckling:latest        "duckling-example-ex…"   3 minutes ago       Up 3 minutes              8000/tcp                                   rasa_duckling_1
    119964eda6a1        bitnami/postgresql:11.3.0   "/entrypoint.sh /run…"   3 minutes ago       Up 3 minutes              5432/tcp                                   rasa_db_1
    55ae30a63306        bitnami/redis:5.0.5         "/entrypoint.sh /run…"   3 minutes ago       Up 3 minutes              6379/tcp                                   rasa_redis_1
    02d072ab2bc1        bitnami/rabbitmq:3.7.17     "/entrypoint.sh /run…"   3 minutes ago       Up 3 minutes              4369/tcp, 5672/tcp, 15672/tcp, 25672/tcp   rasa_rabbit_1
    6bc922bbafd3        rasa/rasa:1.9.5-full        "rasa shell"             17 hours ago        Exited (1) 17 hours ago                                              objective_euler
    b1b023b0045a        rasa/rasa:1.9.5-full        "rasa train"             17 hours ago        Exited (1) 17 hours ago                                              sleepy_haslett
    3684000a946b        rasa/rasa:1.9.5-full        "rasa run --enable-a…"   17 hours ago        Exited (0) 16 hours ago                                              zen_archimedes
    cd30d706c7c2        rasa/rasa:1.9.5-full        "rasa run --enable-a…"   17 hours ago        Exited (0) 17 hours ago                                              elastic_diffie
    2cb89cc62690        65f042344ea2                "rasa --help"            18 hours ago        Exited (0) 18 hours ago                                              recursing_spence
    5fd7ee323aaf        rasa/rasa:1.9.5-full        "rasa run"               18 hours ago        Exited (0) 18 hours ago                                              determined_germain
    7806e7f0955e        rasa/rasa:1.9.5-full        "rasa run"               18 hours ago        Exited (1) 18 hours ago                                              serene_montalcini
    8e53283ff311        rasa/rasa:1.9.5-full        "rasa run"               18 hours ago        Exited (1) 18 hours ago                                              pensive_elion
    4af9a0a12a91        rasa/rasa:1.9.5-full        "rasa x"                 18 hours ago        Exited (1) 18 hours ago                                              stupefied_chatelet
    90d43ff23046        rasa/rasa:1.9.5-full        "rasa -m models shell"   19 hours ago        Exited (2) 19 hours ago                                              naughty_raman
    6a0fbbe8c460        rasa/rasa:1.9.5-full        "rasa shell"             19 hours ago        Exited (1) 19 hours ago                                              confident_swartz
    72fcb1f061da        rasa/rasa:1.9.5-full        "rasa shell"             19 hours ago        Exited (1) 19 hours ago                                              relaxed_banzai
    ff49bb37e959        rasa/rasa:1.9.5-full        "rasa shell"             19 hours ago        Exited (1) 19 hours ago                                              naughty_buck
    fc5fa2aebbb4        rasa/rasa:1.9.5-full        "rasa run -m models …"   19 hours ago        Exited (0) 19 hours ago                                              unruffled_heyrovsky
    b31475598a30        rasa/rasa:1.9.5-full        "rasa run --enable-a…"   19 hours ago        Exited (0) 19 hours ago                                              nostalgic_kapitsa
    2196d63ac480        rasa/rasa:1.9.5-full        "rasa /bin/bash"         19 hours ago        Exited (2) 19 hours ago                                              funny_shannon
    2c6a75016f60        65f042344ea2                "rasa run"               20 hours ago        Exited (0) 20 hours ago                                              priceless_cohen
    29ca5ef54a5d        65f042344ea2                "rasa /bin/bash"         20 hours ago        Exited (2) 20 hours ago                                              thirsty_lehmann

How can I connect 5005? Thanks!

I found this Docker-compose up failing because “port is already allocated”

Change :

ports:
  - 5005:5005

To:

ports:
  - 5005

That works, But the port is dynamic.

@hello-code you shouldn’t need to change anything with the ports. And the URL you should query is http://10.19.163.0/core/webhooks/rest/webhook (without the port). Or if you’re using a version of Rasa X >= 0.27.0, http://10.19.163.0/webhooks/rest/webhook should also work

1 Like

Thank you very much!

Hi, I deployed Rasa X on my Ubuntu machine using docker-compose as well, but I get an Requested URL not found when I try to Post to http://141.83.67.168/webhooks/rest/webhook endpoint. Do I need anything to configure to access the Webhook API?

@leondroidgeeks is rest: in your credentials.yml?

What url can I call to parse intent of a sentence. I tried http://10.19.163.0/model/parse but it not work.