ankane/production_rails

Add Geocoding for production?

massens opened this issue · 1 comments

Maybe add the geocoding specs that you have in https://github.com/ankane/ahoy/blob/master/README.md as a production best practice?


Geocoding Performance

To avoid calls to a remote API, download the GeoLite2 City database and configure Geocoder to use it.

Add this line to your application’s Gemfile:

gem 'maxminddb'

And create an initializer at config/initializers/geocoder.rb with:

Geocoder.configure(
  ip_lookup: :geoip2,
  geoip2: {
    file: Rails.root.join("lib", "GeoLite2-City.mmdb")
  }
)

Hey @massens, thanks for the suggestion 👍 My first thought is that it's a bit too specialized to include.