Analytics for web and mobile rely on events to deliver insights. For chat bots, on the other hand, insights comes from analyzing the content of conversations. Botmetrics accomplishes this with several services—collectors, workers, and a web app for interfacing with the user. These need to be setup separately and configured to work in concert.
Setting up the Botmetrics App
Clone the Botmetrics repo and in your
botmetrics directory issue the following commands to set up the app:
convox apps createto create an application called
convox apps infoto check if the app has been created
Checking on App Status
We will use the RDS Postgres and ElastiCache Redis services from Amazon which allow us to scale as needed with minimal effort.
Provisioning a Postgres database and Redis key store is easy with Convox:
Getting Service Names
Deploying to Production and Initial Setup
Now it’s time to deploy the app. Kick it off with
convox deploy. (Time to go surf reddit.)
Setting up the Environment
Next, we need to set the environment variables for Redis and Postgres so that web and worker services can access the databases we just provisioned.
Setting the REDIS_URL and DATABASE_URL Environment Variables
convox env set RAILS_ENV=production SECRET_KEY_BASE=$(openssl rand -hex 32) JSON_WEB_TOKEN_SECRET=$(openssl rand -hex 32)
convox releases promote
convox apps infoto get the status of your app and once it is
running, you can proceed to migrate your database.
Migrating your database
Once the app is deployed set up your database for the first time with:
convox run web rake db:structure:load db:seed
Get the public URL for your app with:
convox apps info
Getting the App Hostname
Browse to the URL and start collecting data from your bots!
Updating your Botmetrics App
When future updates of Botmetrics land, you can
git pull the latest version from GitHub and run
convox deploy to deploy the changes to your private infrastructure.