-
Notifications
You must be signed in to change notification settings - Fork 5
Build your docker image
git clone https://github.com/MedBot-team/NaBot --single-branch --depth 1
To run the Rasa chatbot, we need to run actions-server and chatbot-server separately. So we've separated actions, datasets, and chatbots from each other.
Action-Server will contain actions and datasets, and Rasa-Server will contain the chatbot model and its autocorrect component.
production/
├── action-server
│ ├── actions
│ └── docker
├── datasets-server
├── events-server
├── monitoring-server
│ └── monitoring_ui
├── nginx
├── rasa-server
│ ├── docker
│ └── rasa
│ ├── data
│ ├── dictionary
│ ├── domain
│ ├── tests
│ └── train_test_split
└── streamlit-server
└── streamlit
In the rest of the document, we will build separated images for actions and rasa and then run them together.
Create .env file, with this sample
$ cat production/.env
TOKEN=$MY_TOKEN
MYSQL_DATASETS_ROOT_PASSWORD=$MY_DATASETS_DATABASE_PASSWORD
MYSQL_EVENTS_ROOT_PASSWORD=$MY_EVENTS_DATABASE_PASSWORD
RASA_SERVER_URL=http://rasa:5005/webhooks/rest/webhook
SQL_USER=root
DATASETS_DB_HOST=db_datasets
EVENTS_DB_HOST=db_events
MYSQL_DATASETS_DATABASE=datasets
MYSQL_EVENTS_DATABASE=rasa
DRUG_TABLE=drugs
LAB_TABLE=labs
ACTION_HOST=app
TELEGRAM_ACCESS_TOKEN=$MY_TELEGRAM_TOKEN
TELEGRAM_VERIFY=$MY_TELEGRAM_BOT_ID
TELEGRAM_WEBHOOK_URL=$MY_API_SERVER_URL/webhooks/telegram/webhook
- Default Dockerfile is Slim-based. But you can choose other Dockerfiles in the
dockerdirectory. For example for the rasa-based images:
cp production/rasa-server/docker/Dockerfile-Rasa production/rasa-server/Dockerfile
cp production/action-server/docker/Dockerfile-Rasa production/action-server/Dockerfile
- In the case of using an old version of docker-compose or docker-engine, you might need to add the
versionkey, on top of thedocker-compose.ymlfile. For example in the case of the1.25.0version ofdocker-compose, you need to addversion: "3.7"orversion: "3"on top of your docker-compose file like this:
version: "3.7"
services:
rasa:
build:
context: ./rasa-server
dockerfile: Dockerfile
args:
- VERSION=v0.1.0
.
.
.
-
Also the version of the model weights you want to use, can be assigned by the
VERSIONargument in the docker-compose file. This will download theVERSION.tar.gzfile from Dropbox while building Docker images.Please note that, if you want to use the special version of our bot, you should clone that version alongside assigning that version as the
VERSIONargument in the docker-compose file. you can find out available versions here
- Build a rasa chatbot and action server images
docker-compose -f production/docker-compose.yml build
- Run docker-compose to start and run the chatbot and its actions together in an isolated environment
docker-compose -f production/docker-compose.yml up -d
- with the examples in Test your chatbot page
- Check for errors and warnings in logs
docker-compose -f production/docker-compose.yml logs -f -t
- Monitor a live stream of containers resource usage statistics
docker stats
- Stop and remove chatbot containers
docker-compose -f production/docker-compose.yml down