11 Aug 2014
Gems You Shouldn't Leave Development Without
A couple of weeks ago I gave a talk at Ottawa Ruby called ‘Gems you Shouldn’t Leave Development Without’.
You can find the video and slides below, as well as notes adapted from the slides:
Development Gems!
quiet_assets link
Makes assets shut the hell up in development.
better_errors link
Adds a much better error page for development.
Also a REPL if you add binding_of_caller
too!
pry + pry-debugger link
Pry is a great alternative to IRB.
Pry-debugger adds your favourite debug commands:
- step
- next
- continue
- finish
Allows you to set breakpoints too.
OK, Let’s Talk Production
Environment Management
figaro link
Figaro is a rails-specific environment management gem.
dotenv link
Dotenv is similar to Figaro but works with any rack-based ruby app.
Error Reporting
exception_notification link
Dirt simple error notification. Send errors by email, or to another service (e.g. group chat) using various adapters.
Exception Notification Services
- Airbrake
- Errbit
- Honeybadger
- Rollbar
- Lots more
Ruby Toolbox has a great list: https://www.ruby-toolbox.com/categories/exception_notification
Application Server
- WEBrick
- Thin
- Unicorn
- Passenger
- Puma
Go with Unicorn unless you have a reason not to.
Don’t use WEBrick in production.
How About… Middleware!
rack-canonical-host link
Redirect all requests to a specific host. Can also be used to force SSL. Great for custom domains on Heroku.
Supports tons of options including regex matching on host strings.
rack-attack link
Connection whitelists, blacklists, and throttling. Stops misbehaving clients from even hitting your app code.
Works well with Fail2Ban blacklists and others.
rack-google-analytics link
Adds an analytics code to every page of your app.
Heroku
rails_12factor link
Tells Rails to serve assets. This is usually delegated to the routing webserver (e.g. nginx or apache).
Redirects logs to stdout rather than logfiles.
Stops Heroku complaining every time you deploy.
Thanks for reading! If you like my writing, you may be interested in my book: Healthy Webhook Consumption with Rails
David at 11:00