Skip to content

Instantly share code, notes, and snippets.

@rgstephens
Last active September 5, 2019 16:15
Show Gist options
  • Save rgstephens/23bb8309a46b08661253add932e5f3b2 to your computer and use it in GitHub Desktop.
Save rgstephens/23bb8309a46b08661253add932e5f3b2 to your computer and use it in GitHub Desktop.
Rasa X Update Script
#!/bin/bash
UPDATE_SCRIPT="do_update.sh"
ENV="${RASA_HOME}/.env"
TMP_PLAYBOOK="/tmp/playbook.yml"
TMP_COMPOSE="/tmp/compose.yml"
rm ${TMP_PLAYBOOK}
rm ${TMP_COMPOSE}
wget -qO ${TMP_PLAYBOOK} https://storage.googleapis.com/rasa-x-releases/stable/rasa_x_playbook.yml
wget -O ${TMP_COMPOSE} https://storage.googleapis.com/rasa-x-releases/stable/docker-compose.ce.yml
echo \#\!/bin/bash > ${UPDATE_SCRIPT}
echo export `grep RASA_X_VERSION ${TMP_PLAYBOOK} | head -n 1` >> ${UPDATE_SCRIPT}
echo export `grep RASA_X_DEMO_VERSION ${TMP_PLAYBOOK} | head -n 1` >> ${UPDATE_SCRIPT}
echo export `grep RASA_VERSION ${TMP_PLAYBOOK} | head -n 1` >> ${UPDATE_SCRIPT}
export `grep RASA_X_VERSION ${TMP_PLAYBOOK} | head -n 1`
export `grep RASA_VERSION ${TMP_PLAYBOOK} | head -n 1`
echo "sudo docker-compose down" >> ${UPDATE_SCRIPT}
IMAGES=`grep image ${TMP_COMPOSE} | awk -F '"' '{print $2}'`
for i in ${IMAGES}
do
echo "sudo docker pull ${i}" >> ${UPDATE_SCRIPT}
done
echo "sudo docker pull rasa/rasa-sdk:latest" >> ${UPDATE_SCRIPT}
echo "Rasa Container Ver: ${RASA_VERSION}"
echo "Rasa X Container Ver: ${RASA_X_VERSION}"
echo Press enter to stop the containers using docker-compose and pull the latest images
read x
# Update the .env settings for RASA_VERSION & RASA_X_VERSION
sed -i '/VERSION/d' ${ENV}
echo `grep RASA_X_VERSION ${TMP_PLAYBOOK} | head -n 1` >> ${ENV}
echo `grep RASA_X_DEMO_VERSION ${TMP_PLAYBOOK} | head -n 1` >> ${ENV}
echo `grep RASA_VERSION ${TMP_PLAYBOOK} | head -n 1` >> ${ENV}
# Replace the docker-compose & playbook files
mv ${TMP_PLAYBOOK} rasa_x_playbook.yml
mv ${TMP_COMPOSE} docker-compose.ce.yml
# Run script to stop containers, pull updated images and restart
. ./${UPDATE_SCRIPT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment