[383a81]: / production / rasa-server / rasa / run_rasa.sh

Download this file

32 lines (26 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Set environment variables from .env file
set -a
source .env
set +a
##########
#datasets and events databases are seperated.
#and both of them are created at initialization
#so the following line is not necessary anymore
##########
# Create database in mysql-server to store rasa events
# python -c "import sqlalchemy;\
# sqlalchemy.create_engine('mysql://${SQL_USER}:${MYSQL_EVENTS_ROOT_PASSWORD}@${EVENTS_DB_HOST}?unix_socket=/var/run/mysqld/mysqld.sock')\
# .execute('CREATE DATABASE IF NOT EXISTS ${MYSQL_EVENTS_DATABASE}')"
# List of files which will be modified
declare -a files=("endpoints.yml" "credentials.yml")
# Substitute environment variables into the files
for file in "${files[@]}"; do
# Create a temporary file. This is needed because of asynchronous property of the pipe
tmpfile=$(mktemp)
cp --attributes-only --preserve $file $tmpfile
envsubst < $file > $tmpfile
mv $tmpfile $file
done
# Run rasa command
rasa run --log-file logs/rasa-server.log --enable-api --auth-token ${TOKEN}