Nginx not connecting to port 80 on docker

I have three issues in getting my Rasa X docker-compose set up running with a Rasa agent.

The first issue is that I receive this nginx error when starting the Rasa X logs:

SSL encryption is not used since no certificates were provided.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to app port 80: Connection refused
7
>> exec docker CMD
nginx
2020/03/15 20:50:01 [notice] 1#0: using the "epoll" event method
2020/03/15 20:50:01 [notice] 1#0: nginx/1.14.2
2020/03/15 20:50:01 [notice] 1#0: built by gcc 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) 
2020/03/15 20:50:01 [notice] 1#0: OS: Linux 4.9.0-12-amd64
2020/03/15 20:50:01 [notice] 1#0: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2020/03/15 20:50:01 [notice] 1#0: start worker processes
2020/03/15 20:50:01 [notice] 1#0: start worker process 12

I compose the latest versions of Rasa X with the following docker-compose.yml file:

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}
    --port 5005
    --jwt-method HS256
    --jwt-secret ${JWT_SECRET}
    --auth-token '${RASA_TOKEN}'
    --cors "*"
  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 have tried to restart docker with the following:

sudo systemctl stop docker
sudo systemctl start docker

Here is docker-compose ps:

         Name                       Command               State                           Ports                         
------------------------------------------------------------------------------------------------------------------------
rasa_app_1               ./entrypoint.sh start --ac ...   Up      5055/tcp                                              
rasa_db_1                /entrypoint.sh /run.sh           Up      5432/tcp                                              
rasa_duckling_1          duckling-example-exe --no- ...   Up      8000/tcp                                              
rasa_nginx_1             /opt/bitnami/entrypoint.sh ...   Up      0.0.0.0:80->8080/tcp, 0.0.0.0:443->8443/tcp           
rasa_rabbit_1            /entrypoint.sh /run.sh           Up      15672/tcp, 25672/tcp, 4369/tcp, 0.0.0.0:5672->5672/tcp
rasa_rasa-production_1   rasa x --no-prompt --produ ...   Up      5005/tcp                                              
rasa_rasa-worker_1       rasa x --no-prompt --produ ...   Up      5005/tcp                                              
rasa_rasa-x_1            sh -c user_id=$(id -u) &&  ...   Up      5002/tcp                                              
rasa_redis_1             /entrypoint.sh /run.sh           Up      6379/tcp  

I am not sure if this connection issue with nginx on docker is responsible for other errors I see in my logs, such as these pika errors:

rasa-x_1           | ERROR:pika.adapters.utils.io_services_utils:Socket failed to connect: <socket.socket fd=18, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.18.0.6', 53030)>; error=111 (Connection refused)
rasa-x_1           | ERROR:pika.adapters.utils.connection_workflow:TCP Connection attempt failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('172.18.0.5', 5672))
rasa-x_1           | ERROR:pika.adapters.utils.connection_workflow:AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
rasa-worker_1      | 2020-03-15 21:39:25 ERROR    pika.adapters.utils.io_services_utils  - Socket failed to connect: <socket.socket fd=21, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.18.0.8', 41008)>; error=111 (Connection refused)
rasa-worker_1      | 2020-03-15 21:39:25 ERROR    pika.adapters.utils.connection_workflow  - TCP Connection attempt failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('172.18.0.5', 5672))
rasa-worker_1      | 2020-03-15 21:39:25 ERROR    pika.adapters.utils.connection_workflow  - AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
rasa-production_1  | 2020-03-15 21:39:25 ERROR    pika.adapters.utils.io_services_utils  - Socket failed to connect: <socket.socket fd=21, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.18.0.7', 42166)>; error=111 (Connection refused)
rasa-production_1  | 2020-03-15 21:39:25 ERROR    pika.adapters.utils.connection_workflow  - TCP Connection attempt failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('172.18.0.5', 5672))
rasa-production_1  | 2020-03-15 21:39:25 ERROR    pika.adapters.utils.connection_workflow  - AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')

Does anyone have any ideas about how to debug this?

I am running this docker-compose set up on a Google Cloud VM with standard http-server and https-server firewall tags allowed.

The problems above notwithstanding, I am successfully able to connect to Rasa X via my local browser, but I am not able to converse with my standard Rasa Open Source bot, whose data I have uploaded to rasa X (domain, nlu, stories) and whose action server I have successfully enabled in docker-compose.override.yml.

It seems to not be able to extract slots, and I don’t know why:

app_1              | 2020-03-15 21:43:33 ERROR    rasa_sdk.endpoint  - Failed to extract slot seenBefore with action count_episode
rasa-production_1  | /opt/venv/lib/python3.6/site-packages/rasa/core/policies/keras_policy.py:265: FutureWarning: 'KerasPolicy' is deprecated and will be removed in version 2.0. Use 'TEDPolicy' instead.
rasa-production_1  |   current_epoch=meta["epochs"],
rasa-production_1  | 2020-03-15 21:43:33 ERROR    rasa.core.actions.action  - Failed to extract slot seenBefore with action count_episode

The three errors I want to resolve in my logs are:

  1. the pika errors shown above
  1. the nginx message saying it won’t connect to with 80
  2. Rasa can’t extract slots on rasa x

Hi there @argideritzalpea.

The Nginx message is normal, no need to worry about it. The pika errors are also normal if they do not go on forever; while Rasa X is still setting up, until the server is running, the connection will not go through. So long as they go away when your Rasa X instance is up, that’s okay.

Sounds like you got Rasa X deployed alright.

Regarding your action server not being able to extract slots, can you replicate the story locally with different behavior? Have you checked the versions on your local version vs deployed version? It seems like you are still using deprecated behavior, perhaps due to an upgrade.

I am stuck in this phase? Any idea how to solve this?

Stuck at step 16 of Docker-Compose Manual Install

@dearc do you have permission to assign things to port 80? You may have to run commands on exc or otherwise have administrator priveleges in order to do so .