I am trying to deploy a Rasa server and Rasa action server and it fails with the error
2023-08-21 13:38:47 INFO rasa_sdk.endpoint - Starting action endpoint server...
2023-08-21 13:38:47 ERROR rasa_sdk.executor - Failed to register package 'actions'.
.
.
.
File "/app/actions/botdb.py", line 4, in <module>
from rasa.core.tracker_store import TrackerStore
ModuleNotFoundError: No module named 'rasa'
Content of my Docker Compose file
version: '3.7'
services:
# app:
# build:
# context: ./frontends
# networks:
# - admission-bot
rasa:
image: rasa/rasa:main-spacy-en
container_name: rasa
ports:
- 5005:5005
volumes:
- .:/app
command:
- run
- --debug
- --enable-api
- --cors
- "*"
networks:
- admission-bot
rasa-action_server:
build:
context: .
dockerfile: ./actions/Dockerfile
image: rasa-action_server
container_name: rasa-action-server
working_dir: /app
command:
- start
- --debug
- --actions
- actions
- --cors
- "*"
networks:
- admission-bot
ports:
- 5055:5055
volumes:
- ./actions:/app/actions
depends_on:
- rasa
networks:
admission-bot:
name: admission-bot
driver: bridge
The action server Dockerfile:
# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:3.3.0
# Change back to root user to install dependencies
USER root
# To install packages from PyPI
RUN pip install --no-cache-dir requests
# Switch back to non-root to run code
USER $user
After running docker compose up -d --force-recreate
two containers are correctly created:
The Rasa server is up
But the action_server
container does not come and the logs show the error above.
Kindly confirm what I might be doing wrong.
Just to add, if I run the action_server command locally rasa run actions --cors "*" --debug
, it executes fine.
This is my folder structure:
.
├── Dockerfile
├── README.md
├── actions
│ ├── __init__.py
│ ├── __pycache__
│ ├── actions.py
│ └── botdb.py
├── config.yml
├── credentials.yml
├── data
│ ├── nlu.yml
│ ├── rules.yml
│ └── stories.yml
├── docker-compose.yml
├── domain.yml
├── endpoints.yml
├── frontends
│ ├── Dockerfile
│ ├── index.html
│ └── static
├── graph.html
├── models
├── runrasa.sh
├── tests
└── test_stories.yml
I was able to resolve the issue by installing rasa in the rasa-action_server
Dockerfile. The final Dockerfile looks like this:
# Extend the official Rasa SDK image
FROM rasa/rasa-sdk:3.3.0
# Change back to root user to install dependencies
USER root
# To install packages from PyPI
RUN pip install --no-cache-dir requests rasa
# Switch back to non-root to run code
USER $user