在heroku上安装MaxMind GeoIP ruby库 [英] Installing MaxMind GeoIP ruby library on heroku
问题描述
我有一个在heroku上运行的Rails应用程序。现在我想运行rake任务(使用我的rails应用程序的模型),并使用MaxMind GeoIP数据库对地理标记每个记录( http://www.maxmind.com/app/geolite )。
在Ruby应用程序中使用此数据库涉及: p>
- 构建它的C-API( http://www.maxmind.com/app/c ),然后
- 为此构建Ruby绑定(
我可以在本地计算机上执行此操作,并成功从IP地址获取国家/地区代码。但是我不知道如何在Heroku上安装这些库。从我所了解的ruby绑定不可用作本地扩展的gem(heroku可以很好地处理)。另外他们的C-API似乎还有一些其他的依赖关系,这让我怀疑这样的事情是否可能。
因此,任何人都安装了MaxMind GeoIP(又名Net :: GeoIP)在Heroku上?如果是的话,怎么样?我可以通过将本地设置指向生产数据库来运行笔记本电脑中的耙子任务。在此之前,我想知道是否可以从Heroku设置本身运行它,以避免延迟或连接故障等。
我找到了捆绑MaxMind C-API并提供它自己的Ruby API的gem。它工作得很好 - http://rubygems.org/gems/geoip我会暂时接受这个答案。然而,如果有人能告诉我如何在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库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!