These are chat archives for rails-sqlserver/activerecord-sqlserver-adapter

20th
Jul 2017
Mason Hale
@masonhale
Jul 20 2017 16:10
Hello! I'm trying to get tiny_tds and freetds installed on heroku. All the buildpacks I've found fail to build freetds for various reasons. I've created a custom buildpack that builds freetds successfully, but I'm having trouble finding a way to put in in a path that tiny_tds will find when building the gem and/or passing a path to the gem (via bundler Gemfile). Do you have any suggestions?
I've tried building the tidy_tds gem in my buildpack, which fails -- evidently don't have permissions to run 'gem install' via a buildpack. And I can set path .bundler/config because heroku refuses to build if that file is present, and I can't build with a prefix of /usr/local because the filesystem is read-only. Surely someone has gotten tiny_tds working on Heroku?
Joe Bauser
@coderjoe
Jul 20 2017 16:21
Hello @masonhale , what version of tiny_tds are you trying to build?
Mason Hale
@masonhale
Jul 20 2017 16:22
Looks like 2.0.0 -- I didn't specify a version in my Gemfile, that is what bundler picked.
This is for a brand new Rails 5.1.2 app
Should I try a different version of tiny_tds?
Joe Bauser
@coderjoe
Jul 20 2017 16:25
Not just yet. I'm thinking through options.
Mason Hale
@masonhale
Jul 20 2017 16:26
It is simple enough for me to try with tiny_tds 1.3.0
Joe Bauser
@coderjoe
Jul 20 2017 16:26
So you're able to get freetds built, but tiny_tds won't use it during compliation because you can't install to a standard path, correct?
Mason Hale
@masonhale
Jul 20 2017 16:26
Correct, I can get freetds compiled via a custom buildpack, but I can't install it to /usr/local or /opt/local
Joe Bauser
@coderjoe
Jul 20 2017 16:27
When you do manage to get freetds compiled and installed, what path is it installed to?
Mason Hale
@masonhale
Jul 20 2017 16:27
Looking here, it appears it is only looking in /usr/local or /opt/local (admittedly I know very little about rbconfig or mkmf)
@coderjoe when freetds is compiled, I can specify a directory, but am confined to a directory space. I can write into the app's root directory, or I have a tmp/dynamic directory created by the build server and passed into my compile script as BUILD_DIR
Joe Bauser
@coderjoe
Jul 20 2017 16:30
ok that's fine. Are you able to set environment variables in your environment? I'm unfamiliar with heroku
Mason Hale
@masonhale
Jul 20 2017 16:30
There is also the potential for me to export an ENV var for later build steps (like the bundler install). I was hoping to find a "magic" env var like FREETDS_DIR I could set, that tiny_tds would see an use if available.
yes, I can export environment variables.
Joe Bauser
@coderjoe
Jul 20 2017 16:32
one moment please
Mason Hale
@masonhale
Jul 20 2017 16:32
Looking at the extconf.rb file I don't see where the --with-freetds-dir option gets used. But that may not matter, because I don't see a way to pass that option via a bundler/Gemfile (apart from .bundle/config, which is not supported on heroku)
FYI -- I just tried building tiny_tds version 1.3.0 and it worked!
Joe Bauser
@coderjoe
Jul 20 2017 16:46
--with-freetds-dir is a feature that is enabled by using dir_config within ruby's makemakefile library. It overrides any options passed to dir_config
or appends to them rather
Yeah 1.3.0 would work because it bundles its own versions of freetds, openssl, and libiconv, something we're not doing anymore.
Mason Hale
@masonhale
Jul 20 2017 16:47
Ah, so if I use 1.3.0, then I wouldn't need a custom build pack at all?
Joe Bauser
@coderjoe
Jul 20 2017 16:47
If you'd like to get on the latest version you might be able to append to your library path, and includes path using the standard unix environment variables.
Since that sounds like a pain in the ass can you create a github issue in the tiny_tds project to add the FREETDS_DIR configuration environment variable back to make installing in heroku a little easier?
Mason Hale
@masonhale
Jul 20 2017 16:48
This work is for a small/internal mostly throw-away project. I just need to get something that will work, as quickly as possible. Will be out of use in six months.
Joe Bauser
@coderjoe
Jul 20 2017 16:49
Fair enough
Mason Hale
@masonhale
Jul 20 2017 16:49
I can add a github issue though. But I think for my purposes, I'll just go with 1.3.0
Joe Bauser
@coderjoe
Jul 20 2017 16:49
Thanks. Good luck and have fun. :)
Mason Hale
@masonhale
Jul 20 2017 16:52
Confirmed deploying to heroku works fine in 1.3.0 without any custom buildpack.
Joe Bauser
@coderjoe
Jul 20 2017 16:52
Glad it works for you! Good luck with your project. :+1:
Mason Hale
@masonhale
Jul 20 2017 16:52
Thanks for the help.
Mason Hale
@masonhale
Jul 20 2017 16:59
@coderjoe FYI - rails-sqlserver/tiny_tds#371
Joe Bauser
@coderjoe
Jul 20 2017 17:00
Thanks, much appreciated. :)