Instructions

  1. Push changes from local machine to github. (Or create a pull request and wait until change has been pulled)

    git commit -m 'Always include a description message in your commits'
    git push
    
  2. Open chatbot SSH through Google Cloud Platform Compute Engine page.

  3. Select window using tmux.

    tmux
    

    After starting, press Control+b then 's' to see active sessions and select appropriate sesstion.

  4. Control+c to stop the running bot.

  5. Navigate to bot folder, if not already:

    cd chatbot/gpt3_chatbot
    
  6. Pull latest repo from git

    git pull
    
  7. Upload any new credentials to chatbot/gpt3_chatbot/api_keys. Delete any obsolete credentials.

  8. Verify requirements are up to date

    pip3 install -r requirements.txt
    
  9. If this is a new deployment ensure the proper API_keys are in the api_keys folder. You may need to create this folder. Use the upload feature in the top left of the SSH session.

  10. Set up ngrok tunnel to listen on port 8000

    ./ngrok http 8000
    

    ngrok - secure introspectable tunnels to localhost

  11. In another tmux window Restart the server

    gunicorn -b 0.0.0.0:8000 main:app
    
  12. Make sure Facebook messenger is pointing to the ngrok tunnel:

    1. Copy the forwarding address from Ngrok:

      https://s3-us-west-2.amazonaws.com/secure.notion-static.com/51392d54-c370-4d15-90be-5f0afe07d736/Untitled.png

    2. Paste into Facebook Messenger API call back URL followed by "/messenger"

      Use 'whoohoo' as verify token

      https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e9aed0cd-c33b-4406-a6f8-0fcd535676aa/Untitled.png

  13. Use another tmux session to check for any new errors or create the error log if it doesn't exist

    vim logs/errors/errorlog.txt
    
  14. File structure should look like this:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c4068527-f540-4111-914b-18b7bb1717f4/Untitled.png