Unable to run Duckling server using docker-compose

[Topic split from Permission denied when using custom docker-compose by Moderator]


Hi @nik202 , Thanks for your help the permission issue has been gone and docker containers are up and running using docker-compose without issue. Here is a thing, I thought once the rasa server is running on cloud service(I’m using azure VM) then I could use this endpoint http://{publicIPofVM}:5005/webhooks/rest/webhook to send message to rasa server but the request doesn’t go through. I’m testing it by postman. Is it possible scenario? if then what configuration needs to be changed? rasa server is running on localhost:5005 on VM right now.

Well now I can send request using endpoint, needed to open the port on VM. Then here is another issue, rasa doesn’t talk duckling server and action server. attatching docker-compose and error message

rasa:
    restart: always
    image: "myimage:tag"
    user: root
    ports:
      - 5005:5005
    volumes:
      - ./:/app
    depends_on:
      - duckling
      - app

  app:
    restart: always
    image: "myimage:tag"
    expose:
      - "5055"
    ports:
      - 5055:5055

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

Duckling Error

2022-02-01 18:13:48 DEBUG    urllib3.connectionpool  - Starting new HTTP connection (1): localhost:8000
2022-02-01 18:13:48 ERROR    rasa.nlu.extractors.duckling_entity_extractor  - Failed to connect to duckling http server. Make sure the duckling server is running/healthy/not stale and the proper host and port are set in the configuration. More information on how to run the server can be found on github: https://github.com/facebook/duckling#quickstart Error: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /parse (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f22086f3700>: Failed to establish a new connection: [Errno 111] Connection refused'))

Action server error

rasa.shared.exceptions.RasaException: Failed to execute custom action 'action_session_start' because no endpoint is configured to run this custom action. Please take a look at the docs and set an endpoint configuration via the --endpoints flag. https://rasa.com/docs/rasa/custom-actions

@jpark2111 can I request you to please close this topic issue first?

@jpark2111 Now which issue I will answer first what is your current issues as you mentioned 2 :slight_smile: Ducking one right?

@nik202 Yeap I made your post as solution :slight_smile:

Duckling and action server :slight_smile:

@jpark2111 can you share the full docker file starting from Version?

@jpark2111 above mentioned one is your docker-compose.yml file?

@jpark2111 please also mentioned the ducking image code for my reference, please?

Dockerfile for rasa

FROM rasa/rasa:2.8.2

WORKDIR /app
COPY . /app
USER root

RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN python -m spacy download en_core_web_md 
RUN python -m spacy link en_core_web_md en

RUN rasa train

VOLUME /app/models

CMD ["run", "-m", "/app/models", "--enable-api","--cors","*","--debug" ,"--endpoints", "endpoints.yml", "--log-file", "out.log", "--debug"]

EXPOSE 5005

Dockerfile for action server

FROM rasa/rasa-sdk:2.8.2

WORKDIR /app

COPY actions /app/actions

USER root
RUN pip install --no-cache-dir -r /app/actions/requirements-actions.txt

USER 1001
CMD ["start", "--actions", "actions"]

@nik202

@jpark2111 can you please share the docker-compose.yml file and config.yml file which you are using in RASA Open source?

@nik202 this is not RASA X, it’s rasa open source. config.yml file should be copied in rasa image right? I don’t have config.yml file on VM, but I have docker-compose.override.yml

Here is config.yml on my source code

version: "2.0"
language: en
pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 100
  - name: FallbackClassifier
    threshold: 0.7
  - name: DucklingEntityExtractor
    url: http://localhost:8000
    dimensions:
    - amount-of-money
    - time
    - number
  - name: SpacyNLP
    model: "en_core_web_md"
    case_sensitive: false
  - name: "SpacyEntityExtractor"
    # Note: It is not possible to use the SpacyTokenizer + SpacyFeaturizer in
    #       combination with the WhitespaceTokenizer, and as a result the
    #       PERSON extraction by Spacy is not very robust.
    #       Because of this, the nlu training data is annotated as well, and the
    #       DIETClassifier will also extract PERSON entities .
    dimensions: ["PERSON"]
  - name: EntitySynonymMapper
policies:
- name: AugmentedMemoizationPolicy
- name: TEDPolicy
  epochs: 40
- name: RulePolicy
  core_fallback_threshold: 0.4
  core_fallback_action_name: "action_default_fallback"
  enable_fallback_prediction: True

Here is docker-compose.override.yml

version: "3.4"
services:
  rasa:
    image: "myimage:tag"
  app:
    image: "myactionimage:tag"

@jpark2111 apologies, just finished office work :stuck_out_tongue:

Try this and delete older trained model and train again:

version: '3.4'
services:
  rasa:
    image: "myimage:tag"
    ports:
      - "5005:5005"
    depends_on:
      - duckling
      - app
  app:
    "myactionimage:tag"
    ports:
      - 5055
  duckling:
    image: rasa/duckling
    ports:
      - "8000:8000"

In config.yml

Try this:

- name: "DucklingHTTPExtractor"
  url: "http://duckling:8000"

Tip: Delete the image also whilst using docker desktop and build the docker image again using the command docker build .

Concern: Are you sure your pipeline is as per Spacy? please check Rasa Documentation or Google, please.

Why you don’t have config.yml? and why do you have docker-compse.override.yml? If its rasa open source.

You need to copy the config.yml file also while training the model and I guess now you know how you can copy the files in /app ( working directory)

@jpark2111 Confirm to me your bot is working fine on the local machine without using docker?

@nik202 bot has been working fine on my laptop without using docker and I don’t see config.yml either on another machine that RASA X deployed. and what’s the purpose of using docker-compose.override.yml then? whenever image updated docker-compose automatically pull that image right? I can’t use it on rasa open source?

@jpark2111 Now me totally confused :crazy_face:

This is related to rasa open-source or rasa x confirm me?

@nik202 I told you rasa open source… I’ve deployed rasa x on another server as well

@jpark2111 Then why do you need docker-compose.override? are you using this file yes or no ?

@nik202 I rebuilt docker image, changed docker-compose.override.yml and config.yml as you suggested, restarted docker-compose, still getting same error. :frowning:

@nik202 if docker-compose.override doens’t need to be there, will remove it then.

@jpark2111 you only need docker file for rasa server 5005 and rasa action server 5055 and docker-compose.yml for both as you saw in my last thread that’s it and you can mention ducking in the docker-compose.yml and build. Nothing much you need.

But you need to copy every folder to the app for the docker container?

@nik202 I have dockerignore file, I put there models actions test images etc so that these folder are not going to be copied to docker container.