在 Heroku 上安装 GEOS
Installing GEOS on Heroku
我正在尝试将 Rails 应用程序(ruby 2.3.0、rails 4.2.6)部署到 Heroku使用 RGeo gem, but I'm having no luck installing the underlying GEOS library upon which the RGeo gem relies (See https://github.com/rgeo/rgeo#dependencies).
根据 Heroku's own instructions, this should be possible by using the heroku-geo-buildpack,但它不起作用。
将构建包添加到应用程序:
$ heroku buildpacks:set https://github.com/cyberdelia/heroku-geo-buildpack.git
$ heroku buildpacks:add heroku/ruby
构建过程看起来不错:
remote: Building source:
remote:
remote: -----> geos/gdal/proj app detected
remote: Using geos version: 3.4.2
remote: Using gdal version: 1.11.1
remote: Using proj version: 4.8.0_1
remote: -----> Vendoring geo libraries done
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.0
测试依赖项:
>>> require 'rgeo'
=> false
>>> RGeo::CoordSys::Proj4.supported?
=> true
>>> RGeo::Geos.supported?
=> false
在 heroku 上获取特定的 geos buildpack 似乎有问题,主要是因为 geos 的构建参数。有关完整详细信息,您可以查看 this pull request to the buildpack where a lot of this is discussed. The solution using a fork of the webpack is described in detail in this blog post.
第 1 步:在项目的根目录中创建此 .vendor_urls
文件:
https://s3.amazonaws.com/diowa-buildpacks/geos-3.5.0-heroku.tar.gz
https://s3.amazonaws.com/diowa-buildpacks/proj-4.9.1-heroku.tar.gz
将此文件添加到 git 并确保它以换行符结尾。
第 2 步:设置您的 Heroku 配置:
heroku buildpacks:set https://github.com/diowa/heroku-buildpack-rgeo-prep.git
heroku buildpacks:add https://github.com/peterkeen/heroku-buildpack-vendorbinaries.git
heroku buildpacks:add heroku/ruby
heroku config:set LD_LIBRARY_PATH=/app/lib
(见https://github.com/diowa/heroku-buildpack-rgeo-prep#setup)
最后注意,如果你已经安装了rgeo,你需要重新编译gem。您可以通过使用 heroku repo plugin、运行 heroku repo:purge_cache -a appname
并再次部署来做到这一点。
(见http://www.diowa.com/blog/heroku/2016/02/26/using-rgeo-with-geos-on-heroku#deploy)
我正在尝试将 Rails 应用程序(ruby 2.3.0、rails 4.2.6)部署到 Heroku使用 RGeo gem, but I'm having no luck installing the underlying GEOS library upon which the RGeo gem relies (See https://github.com/rgeo/rgeo#dependencies).
根据 Heroku's own instructions, this should be possible by using the heroku-geo-buildpack,但它不起作用。
将构建包添加到应用程序:
$ heroku buildpacks:set https://github.com/cyberdelia/heroku-geo-buildpack.git
$ heroku buildpacks:add heroku/ruby
构建过程看起来不错:
remote: Building source:
remote:
remote: -----> geos/gdal/proj app detected
remote: Using geos version: 3.4.2
remote: Using gdal version: 1.11.1
remote: Using proj version: 4.8.0_1
remote: -----> Vendoring geo libraries done
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.0
测试依赖项:
>>> require 'rgeo'
=> false
>>> RGeo::CoordSys::Proj4.supported?
=> true
>>> RGeo::Geos.supported?
=> false
在 heroku 上获取特定的 geos buildpack 似乎有问题,主要是因为 geos 的构建参数。有关完整详细信息,您可以查看 this pull request to the buildpack where a lot of this is discussed. The solution using a fork of the webpack is described in detail in this blog post.
第 1 步:在项目的根目录中创建此 .vendor_urls
文件:
https://s3.amazonaws.com/diowa-buildpacks/geos-3.5.0-heroku.tar.gz
https://s3.amazonaws.com/diowa-buildpacks/proj-4.9.1-heroku.tar.gz
将此文件添加到 git 并确保它以换行符结尾。
第 2 步:设置您的 Heroku 配置:
heroku buildpacks:set https://github.com/diowa/heroku-buildpack-rgeo-prep.git
heroku buildpacks:add https://github.com/peterkeen/heroku-buildpack-vendorbinaries.git
heroku buildpacks:add heroku/ruby
heroku config:set LD_LIBRARY_PATH=/app/lib
(见https://github.com/diowa/heroku-buildpack-rgeo-prep#setup)
最后注意,如果你已经安装了rgeo,你需要重新编译gem。您可以通过使用 heroku repo plugin、运行 heroku repo:purge_cache -a appname
并再次部署来做到这一点。
(见http://www.diowa.com/blog/heroku/2016/02/26/using-rgeo-with-geos-on-heroku#deploy)