Installing MaxMind GeoIP ruby library on heroku

我只是一个虾纸丫 提交于 2019-12-24 19:30:01

问题


I have a Rails app running on heroku. Now I want to run a rake task (which uses a model of my rails app) and geo-tag each record using the MaxMind GeoIP database (http://www.maxmind.com/app/geolite).

Using this database in a Ruby application involves :

  1. Building it's C-API (http://www.maxmind.com/app/c) and then
  2. Build the Ruby bindings for that (http://www.maxmind.com/app/ruby).

I could do this on my local machine and successfully get the country codes from IP addresses. However I do not know how to install these libraries on Heroku. From what I understand the ruby bindings are not available as a gem with native extensions (which heroku would have handled just fine). Also their C-API seems to have a few other dependencies which makes me wonder whether such a thing is possible at all.

So has anyone installed the MaxMind GeoIP (a.k.a Net::GeoIP) on Heroku? If yes how?

I could run the rake task from my laptop by pointing my local setup to the production DB. Before that I would like to know if I can run it from my Heroku setup itself to avoid latency or connection breakdown etc.


回答1:


I found a gem which bundles the MaxMind C-API and provides it's own Ruby API. It works just fine - http://rubygems.org/gems/geoip

I ll tentatively accept this as the answer. However it would be awesome if someone can tell me how to install binary extensions to Ruby on Heroku.



来源:https://stackoverflow.com/questions/11368461/installing-maxmind-geoip-ruby-library-on-heroku

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!