问题描述
我有一个在heroku上运行的Rails应用程序。现在我想运行rake任务(使用我的rails应用程序的模型),并使用MaxMind GeoIP数据库对地理标记每个记录()。
在Ruby应用程序中使用此数据库涉及: p>
- 构建它的C-API(),然后
- 为此构建Ruby绑定(
我会暂时接受这个答案。然而,如果有人能告诉我如何在Heroku上安装Ruby的二进制扩展,这将是非常棒的。
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 :
- Building it's C-API (http://www.maxmind.com/app/c) and then
- 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.
解决方案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.
这篇关于在heroku上安装MaxMind GeoIP ruby库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!