2020-02-14
Error Tracking
The best tool to do this is Erribt, which is an open source gem in Rails, that is basically an app that tracks the app errors in any environment. But the vast majority of time helps to track errors in productions, staging and other important branches of the project (not so in dev or test environments).
This app is self-hosted, that means that we need a simple server to deploy it to production. It uses MongoDB, so we need to have an account with
Mongo Atlas. More on the official documentation here:
https://github.com/errbit/errbit. A good advantage of this gem is that we just need to create the app once and we can add any amount of apps and environments to track inside it
There are two ways to configure this gem, but none of them is easy. So we use a combined approach. The list of steps is here:
1- MongoDB Atlas
2- Deploy in the Hard Way
3- Gotchas
- * You may be required to add a credit card. But that doesn't mean that the service is not free. We’ll be using free dyons
- * Some ENV variables won’t work, and you’ll need to add it manually via Heroku app (settings/reveal config vars)
- * Name of Env var (MONGO_URL not MONGO_URI): MONGO_URL is the correct name for this env variable
- Inside Mongo Atlas to “Connect” the account, you need to choose for Ruby 2.4 or later and the MONGO_URL looks like this:
- * mongodb://errbit-parso:<password>@cluster0-shard-00-00.gmsvz.mongodb.net:27017,cluster0-shard-00-01.gmsvz.mongodb.net:27017,cluster0-shard-00-02.gmsvz.mongodb.net:27017/myFirstDatabase?ssl=true&replicaSet=atlas-gy6qcz-shard-0&authSource=admin&retryWrites=true&w=majority
- * To create the admin, you need to add a Figaro gem to the project and create these two env vars: ERRBIT_ADMIN_EMAIL and ERRBIT_ADMIN_PASSWORD. However you can also create these two variables directly in the Heroku app and add it manually. After this, you’ll need to run the seed command: “heroku run rake db:seed”