Admit it, some of the commands in setting up and testing out RasaX are rather long and difficult to remember. Instead of spamming the up-arrow key for half an hour, use these shortcut aliases to get your job done quicker!
Prologue?
All commands are tested and working in Ubuntu 18.04 LTS. You want to copy each command that you want to use into your .bashrc, which is Ubuntu’s default shell. To open the file, fire up a Terminal and type in
gedit ~/.bashrc &
Which should open up bash’s config. Next, you want to copy each command to preferrably the bottom of the bashrc file.
Access a Docker Container in the Terminal as root
Command:
alias docker-access='f(){ docker exec -it -u root "$1" bash; unset -f f; }; f'
Usage:
$ docker-access <your container id here>
This command lets you convert your normal Terminal into a Terminal running inside a docker container as a root user. Its great for tinkering around inside the containers, managing the files and even installing pip packages if the docker-compose acts up.
Set the login password for RasaX (Community Edition ONLY)
Command:
alias rasa-setpassword='f(){ cd /etc/rasa ; sudo python rasa_x_commands.py create admin --update me "$1"; unset -f f; }; f'
Usage:
$ rasa-setpassword yourpasswordhere
This command is a shorter version of the command to set a password for your login.
(Note: if you’re using a custom install location, be sure to replace /etc/rasa/
in the command with the location of your RasaX install files. You’re looking for the folder where you’ll find a file called rasa_x_commands.py
)
Authenticate your RasaX install against your remote repository
Command:
alias rasa-authenticate='f(){ cd /etc/rasa; curl --request POST --url http://localhost:80/api/projects/default/git_repositories?api_token=$1 --header content-tpe:application/json --data-binary @repository.json; unset -f f; }; f'
Usage:
$ rasa-authenticate <your api token here>
This command will authenticate your RasaX server’s Integrated Version Control with your remote repository’s SSH key. You should also be thankful because it took me a good half-hour or so of messing with different strings to make this work.
(Note: Your repository.json
should be in the same folder as your RasaX install folder for this to work. Same as above, if you’re using a custom install folder, replace /etc/rasa
with your install location.)
Force-kill all Docker containers
Command :
alias docker-forcekill='f(){ cd /etc/rasa; sudo systemctl disable apparmor.service --now; sudo service apparmor teardown; docker-compose down; systemctl start apparmor; unset -f f; }; f'
Usage :
$ docker-forcekill
I found that sometimes my docker containers were refusing to shutdown via docker-compose down
citing Permission Denied.
(And really, what the fuck do you mean by that? I OWN YOU.)
Take back your shattered sense of authority with this command, which forcefully kills all docker containers with little regard for their feelings. \
And that’s all I have for now. You should note that these are a result of me tinkering and playing around with a RasaX server install that should in no way be used in ANY production environment. They’re useful for you if you’re
tinkering in RasaX or trying to learn how to set it up and use it.
If you’re confused on where these commands should go, the bottom of your .bashrc
should look something like this:
Speaking of which, I might make a video tutorial for setting up RasaX on a Windows machine from scratch if you guys are interested.