Start Rasa at ubuntu startup

Hi guys, I have my Rasa-1.7.0 bot on an Ubuntu18 server and I want to execute the following commands as a service when I power on the computer:

$ rasa run actions
$ rasa run --ssl-certificate /etc/letsencrypt/live/x/fullchain.pem --ssl-keyfile /etc/letsencrypt/live/x/privkey.pem -vv --port XXXX --cors "*" --enable-api --credentials credentials.yml

Is there a way to achieve this?

EDIT:

I tried creating a chatbot.sh file with this:

#!/bin/bash

/usr/bin/dropbox dropbox start &&
cd /home/ib/Dropbox/Boggio/chatbot-boggio && 
source home/ib/miniconda3/bin/activate rasa1.7.0 &&
cd /home/ib/Dropbox/Boggio/chatbot-boggio && nohup /home/ib/miniconda3/envs/rasa1.7.0/bin/rasa run actions &
cd /home/ib/Dropbox/Boggio/chatbot-boggio && nohup /home/ib/miniconda3/envs/rasa1.7.0/bin/rasa run --ssl-certificate ....

After that I created a service with this:

[Unit]
Description=chatbot
Wants=network.target
After=syslog.target network-online.target
StartLimitIntervalSec=0

[Service]
Type=forking
ExecStart=/home/x/chatbot.sh
Restart=on-failure
RestartSec=1
KillMode=process

[Install]
WantedBy=multi-user.target

But when I try to open the chat, this shows up:

Segmentation fault      (core dumped) nohup /home/ib/miniconda3/envs/rasa1.7.0/bin/rasa run --ssl-certificate ...

Does anyone make this work?

EDIT 2:

I tried what ShreyasNayak posted, and it kinda works. When I start the core service it executes right, but as soon as I try to talk with the bot the core service crashes with this msg:

Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 4 events.
Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.policies.memoization  - Current tracker state [None, None, No
Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.policies.memoization  - There is no memorised next action
Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.policies.form_policy  - There is no active form
Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence
Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_0_Ker
Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.processor  - Predicted next action 'action_comienzo' with con
Feb 14 14:47:32 instance-2 python3[8231]: 2020-02-14 14:47:32 DEBUG    rasa.core.actions.action  - Calling action endpoint to run action 'acti
Feb 14 14:47:33 instance-2 systemd[1]: chatbot_core.service: Main process exited, code=killed, status=11/SEGV
Feb 14 14:47:33 instance-2 systemd[1]: chatbot_core.service: Failed with result 'signal'.

If I run the core from a terminal it works at usual, but if I do it from the service that error happens.

Does anyone have the same issue or know how to solve it?

@facureyes Welcome to the Rasa forums. Are you sure the Action server process is running at the time that Rasa calls the action?

Can you include the full log from Rasa and the action server (the rasa log example was clipped at col 80 or so).

How much memory do you have on this system?

What version of gym is installed? There have been reports of segmentation fault issues with gym version 0.15.6. Reverting back to 0.15.4 appears to resolve them.

pip uninstall gym
pip install gym==0.15.4
1 Like

OMG, changing the gym version back to 0.15.4 solved my problem!! It was driving me mad :sweat_smile::sweat_smile:

Thank you really much for you help, I really appreciate it!!