Custom channel setup for docker

Hello! I’m using rasa x for some time and used to install it as a pip package and therefore run everything manually using rasa command. Now I decided to switch to docker setup, thankfully there are some good tutorials from Juste, but there are some things that I’m still not able to figure out.

First, how do I add my custom channel. With pip package I used to create .py file in specified pip package folder, in my case it was livechat.py, then I just added livechat: line in my credentials file.

Second question might look dumb, but I failed to find an answer to it. I know that there is an integrated vcs to sync rasa x with rasa bot itself. Following tutorial to make a sync I need to run some commands. I assume I need to run them every time I restart rasa X. Is that true or am I missing something?

Related to question above, is there a different way to connect rasa bot and get bot files back after changing them in rasa X? e.g. where to store them and how to pass them to rasa X and get them back?

There is another question, but it is more related to docker itself and since I’m totally newbie in that I would be pleased to hear your advice.

For action server I have to create an image and then pass it to docker-compose file. For that I need a dockerfile with for example requirements.txt file that will install required packages. But if I change something in requirements then I would have to create a new image once again and then restart rasa x. Is there a way to create an image while restarting rasa x? What I mean is that when you change your custom action in actions.py you just restart rasa x and that’s it, I want something similar to that.

Sorry for so many dumb questions, looking forward to your smart answers!

UPD: I moved this question to rasa X since it’s related to setting up rasa with the docker, which I believe is the case for rasa X.

Your first question is not dumb. I havent been able to get a custom channel working yet with Rasa X either.

First, how do I add my custom channel. With pip package I used to create .py file in specified pip package folder, in my case it was livechat.py, then I just added livechat: line in my credentials file.

You’ll do the same, you’ll just need to add

- ./livechat.py:/app/livechat.py

to the volumes mounted to the rasa-production and rasa-worker containers.

Following tutorial to make a sync I need to run some commands. I assume I need to run them every time I restart rasa X. Is that true or am I missing something?

Nope! That information is stored in the database, you shouldn’t need to connect it every time. You also shouldnt really be restarting your rasa X much, though, as it’s a server meant to be running continuously.

Related to question above, is there a different way to connect rasa bot and get bot files back after changing them in rasa X? e.g. where to store them and how to pass them to rasa X and get them back?

You can upload and download most files in the UI, but I wouldn’t recommend that approach as it’s easy for things to get out of sync.

But if I change something in requirements then I would have to create a new image once again and then restart rasa x.

You would indeed need to create a new image. You wouldn’t have to restart rasa x, just the app service that uses that image.

I see, very demonstrative, thank you very much. I have another question if you could help.

I created rasa X from scratch in multiple ways using docker, but everytime I can’t add story, e.g. when I click create new story nothing happens.

Another thing is with git repository, I get some error in rasa x logs regarding this so it doesn’t really sync however it says that is sync(seems like that’s because of the error).

/usr/local/lib/python3.6/site-packages/rasa/core/domain.py:151: FutureWarning: No tracker session configuration was found in the loaded domain. Domains without a session config will automatically receive a session expiration time of 60 minutes in Rasa version 2.0 if not configured otherwise. session_config = cls._get_session_config(data.get(SESSION_CONFIG_KEY, {})) Job "GitService.run_background_synchronization (trigger: cron[minute='*'], next run at: 2020-03-24 07:24:00 UTC)" raised an exception Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) File "/usr/local/lib/python3.6/site-packages/rasax/community/services/integrated_version_control/git_service.py", line 826, in run_background_synchronization git_service.synchronize_project(force_data_injection) File "uvloop/loop.pyx", line 1450, in uvloop.loop.Loop.run_until_complete File "uvloop/loop.pyx", line 1443, in uvloop.loop.Loop.run_until_complete File "uvloop/loop.pyx", line 1351, in uvloop.loop.Loop.run_forever File "uvloop/loop.pyx", line 519, in uvloop.loop.Loop._run File "uvloop/loop.pyx", line 436, in uvloop.loop.Loop._on_idle File "uvloop/cbhandles.pyx", line 90, in uvloop.loop.Handle._run File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run File "/usr/local/lib/python3.6/site-packages/rasax/community/services/integrated_version_control/git_service.py", line 700, in synchronize_project await self._inject_data() File "/usr/local/lib/python3.6/site-packages/rasax/community/services/integrated_version_control/git_service.py", line 710, in _inject_data str(self.repository_path()), str(data_path), self.session, SYSTEM_USER File "/usr/local/lib/python3.6/site-packages/rasax/community/initialise.py", line 297, in inject_files_from_disk inject_config(os.path.join(project_path, config_path), settings_service) File "/usr/local/lib/python3.6/site-packages/rasax/community/initialise.py", line 50, in inject_config f"Failed to inject Rasa configuration:\n" File "/usr/local/lib/python3.6/site-packages/rasa/cli/utils.py", line 241, in print_error_and_exit sys.exit(exit_code) SystemExit: 1

I got it when updated my github repo.

Seems like I was able to get a solution for that, if rasa sees files with incorrect format or for example empty config.yml(or story.yml if I understood it correctly), it just doesn’t work therefore throwing exceptions and some other stuff. So I recommend anyone who face this issue to configure your git rep with correct files, then sync and upload them to rasa X, otherwise your rasa just won’t work, at least it was in my case. Tbh there are plenty of things(more like bugs) that are not mentioned in video tutorials(probably there are in docs, but I haven’t seen that as well), that stops you from creating default bot that responds with hello and goodbye, it really took me some time to set it up even though I used rasa for quite some time :(.

2 Likes

Regarding custom connector, I was able to add livechat.py file to the /app folder on both worker and production, however I get the same error that livechat was not found. I assume I need to provide __init__.py file as well with changed input channels. Can you describe how to do that precisely? Because when I just put new __init__.py file same error appears.

Hi, sorry, I did not see your responses! Yes, as mentioned in the docs, you should have a rasa project setup before connecting to the git repository, it should not have empty files. That is one of the prerequisites

How do you reference the livechat module in your credentials file? You’ll have to do it as

livechat.Classname:
  parameters

and not just as livechat:

Ah, thank you very much, that was my huge mistake to use livechat: directly. Actually I got it to work having changed __init__.py as I did before, which is pretty dumb way :smiley:

Can I ask you one more minor question as well, please? I have my git synchronized now, since rasa x just didn’t work for me if I didn’t have it, e.g. stories haven’t added, bot hanged and so on. I have some additional files in my git repository as well, so the thing is that when I push files from rasa x, push is successfull, but rasa says that it’s still unsynced, but when I discard changes it says that it is synced(so it is possible to make it sync). I guess that’s because those additional files aren’t in commit but in a diff or smth like that. What do you think?

Hm, which version are you running? I’ve seen strange behavior with regards to yellow state but no diff on the latest version and am trying to pin down why. So it may not be your fault.

I’m using 0.27.1 which was the latest version for me.

@erohmensing I am using Rasa X 27.6 and am getting this synchronization error. My domain.yml is not updating with the repo. Any ideas?

rasa-x_1           | Traceback (most recent call last):
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/apscheduler/executors/base.py", line 125, in run_job
rasa-x_1           |     retval = job.func(*job.args, **job.kwargs)
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasax/community/services/integrated_version_control/git_service.py", line 853, in run_background_synchronization
rasa-x_1           |     git_service.synchronize_project(force_data_injection)
rasa-x_1           |   File "uvloop/loop.pyx", line 1450, in uvloop.loop.Loop.run_until_complete
rasa-x_1           |   File "uvloop/loop.pyx", line 1443, in uvloop.loop.Loop.run_until_complete
rasa-x_1           |   File "uvloop/loop.pyx", line 1351, in uvloop.loop.Loop.run_forever
rasa-x_1           |   File "uvloop/loop.pyx", line 519, in uvloop.loop.Loop._run
rasa-x_1           |   File "uvloop/loop.pyx", line 436, in uvloop.loop.Loop._on_idle
rasa-x_1           |   File "uvloop/cbhandles.pyx", line 90, in uvloop.loop.Handle._run
rasa-x_1           |   File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasax/community/services/integrated_version_control/git_service.py", line 697, in synchronize_project
rasa-x_1           |     await self._inject_data()
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasax/community/services/integrated_version_control/git_service.py", line 727, in _inject_data
rasa-x_1           |     str(self.repository_path()), str(data_path), self.session, SYSTEM_USER
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasax/community/initialise.py", line 293, in inject_files_from_disk
rasa-x_1           |     username,
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasax/community/initialise.py", line 130, in inject_domain
rasa-x_1           |     f"domain.yml could not be found at '{os.path.abspath(domain_path)}'. "
rasa-x_1           |   File "/usr/local/lib/python3.6/site-packages/rasa/cli/utils.py", line 241, in print_error_and_exit
rasa-x_1           |     sys.exit(exit_code)
rasa-x_1           | SystemExit: 1

@argideritzalpea that seems really weird, is your project in the standard format? Are you using anything special like the MultiProjectImporter?