在heroku上安装MaxMind GeoIP ruby​​库

编程入门 行业动态 更新时间:2024-10-28 10:32:49
本文介绍了在heroku上安装MaxMind GeoIP ruby​​库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个在heroku上运行的Rails应用程序。现在我想运行rake任务(使用我的rails应用程序的模型),并使用MaxMind GeoIP数据库对地理标记每个记录( www.maxmind/app/geolite )。

在Ruby应用程序中使用此数据库涉及: p>

  • 构建它的C-API( www.maxmind/app/c ),然后
  • 为此构建Ruby绑定(

    我可以在本地计算机上执行此操作,并成功从IP地址获取国家/地区代码。但是我不知道如何在Heroku上安装这些库。从我所了解的ruby绑定不可用作本地扩展的gem(heroku可以很好地处理)。另外他们的C-API似乎还有一些其他的依赖关系,这让我怀疑这样的事情是否可能。

    因此,任何人都安装了MaxMind GeoIP(又名Net :: GeoIP)在Heroku上?如果是的话,怎么样?

    我可以通过将本地设置指向生产数据库来运行笔记本电脑中的耙子任务。在此之前,我想知道是否可以从Heroku设置本身运行它,以避免延迟或连接故障等。

    我找到了捆绑MaxMind C-API并提供它自己的Ruby API的gem。它工作得很好 - rubygems/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 (www.maxmind/app/geolite).

    Using this database in a Ruby application involves :

  • Building it's C-API (www.maxmind/app/c) and then
  • Build the Ruby bindings for that (www.maxmind/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 - rubygems/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​​库

    本文发布于:2023-10-13 09:25:29,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:MaxMind   heroku   ruby   GeoIP

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!