0

我有一个想在 heroku 上部署的 sinatra rack ruby​​ 应用程序。该应用程序需要连接到 SQL Server 数据库。为此,我需要 TinyTds gem。

宝石文件

source 'http://rubygems.org'
ruby "1.9.3"
gem 'sinatra'
gem 'tiny_tds'

捆绑安装后的 Gemfile.lock

GEM
  remote: http://rubygems.org/
  specs:
    rack (1.6.0)
    rack-protection (1.5.3)
      rack
    sinatra (1.4.5)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (~> 1.3, >= 1.3.4)
    tilt (1.4.1)
    tiny_tds (0.6.2)

PLATFORMS
  ruby

DEPENDENCIES
  sinatra
  tiny_tds

TinyTds 需要 Heroku 显然没有的 FreeTDS。因此,互联网上有一些疯狂的解决方案,在类似 heroku 的虚拟机中进行静态编译和类似的东西。最合理的解决方案是为我的应用程序设置一个包含 FreeTDS 的自定义 buildpack:

heroku create my_new_app --buildpack https://github.com/firmhouse/heroku-buildpack-ruby-freetds.git

然而

$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Ruby/Rack app detected
remote: Installing freetds into /tmp/build_7b7e059c43475a97d6c091bcf9162e16/vendor/freetds
remote:
remote:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
remote:                                  Dload  Upload   Total   Spent    Left  Speed
remote: 100 3590k  100 3590k    0     0  17.8M      0 --:--:-- --:--:-- --:--:-- 17.8M
remote:
remote: -----> Using Ruby version: ruby-1.9.3
remote: -----> Installing dependencies using Bundler version 1.7.12
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
remote:        Could not load OpenSSL.
remote:        You must recompile Ruby with OpenSSL support or change the sources in your
remote:        Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
remote:        RVM are available at http://rvm.io/packages/openssl.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:
remote:  !     Push rejected, failed to compile Ruby/Rack app
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to my_new_app.
remote:
To https://git.heroku.com/my_new_app.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my_new_app.git'

编辑:我的问题是如何让 heroku 使用 tiny_tds。

4

0 回答 0