Code Monkey home page Code Monkey logo

heroku-buildpack-freetds's People

Contributors

beathyate avatar bf4 avatar ddollar avatar gaffneyc avatar gmanley avatar jewlsiob avatar mikepack avatar nelseric avatar oguzbilgic avatar tpiekos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

heroku-buildpack-freetds's Issues

Heroku 18 build not working

The TinyTDS gem does not load when deploying to Heroku with the Heroku-18 stack. I have specified heroku-buildpack-freetds as the first buildpack in the sequence, followed by the standard heroku/ruby pack.
The app is running Rails 6, but I encountered the same error with 5.8. I've attached a copy of the trace of the push.

trace.txt

Incorrect .profile.d

The current .profile.d is broken in a few ways. It does not take into account the difference between build time and runtime differences. On Heroku the build directory will be different than the runtime directory. To account for this other buildpacks do not hardcode paths, but instead use $HOME in their .profile.d scripts. The other problem is that you're completely obliterating any prior $PATH, so if any other buildpack profile.d script runs before this one, this will wipe it out. That's because it does not include a :$PATH at the end to indicate you want to prepend to the PATH instead of overwriting it.

An example from heroku run bash

~ $ cat .profile.d/freetds.sh  | grep " PATH="
  export PATH="/app/freetds/bin:/tmp/build_b5beced7/.heroku/activestorage-preview/usr/bin:/usr/local/bin:/usr/bin:/bin"

Should be:

~ $ cat .profile.d/freetds.sh  | grep " PATH="
  export PATH="$HOME/freetds/bin:$PATH"

You can see this pattern used in other buildpacks:

~ $ cat .profile.d/000_activestorage_preview.sh  | grep " PATH="
export PATH="$HOME/.heroku/activestorage-preview/usr/bin:$PATH"

While the $HOME part isn't strictly necessary, it's a good practice. Not preserving prior $PATH can and does cause problems. When you use this buildpack along with the activestorage preview buildpack then ffmpeg cannot be found:

โ›„๏ธ 3.1.2 ๐Ÿš€ /tmp/3ce01b21867258f6d576c61710222b89 (main)
$ heroku run which ffmpeg
Running which ffmpeg on โฌข warm-spire-40708... up, run.2284 (Free)
/app/.heroku/activestorage-preview/usr/bin/ffmpeg
$ heroku buildpacks:add https://github.com/rails-sqlserver/heroku-buildpack-freetds
Buildpack added. Next release on warm-spire-40708 will use:
  1. https://github.com/heroku/heroku-buildpack-activestorage-preview
  2. https://github.com/rails-sqlserver/heroku-buildpack-freetds
Run git push heroku main to create a new release using these buildpacks.
$ git push heroku main
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 270 bytes | 270.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. https://github.com/heroku/heroku-buildpack-activestorage-preview
remote:        2. https://github.com/rails-sqlserver/heroku-buildpack-freetds
remote: -----> ActiveStorage Preview app detected
remote: -----> Installing binary dependencies for ActiveStorage Preview
remote:        Reusing cache
remote:        Downloading packages..
remote:        Installing packages.....
remote: -----> FreeTDS app detected
remote:        BIN_DIR=/tmp/codon/tmp/buildpacks/89c5ba58d4a923295058e848b2f0751fa8f4f45e/bin, ROOT_DIR=/tmp/codon/tmp/buildpacks/89c5ba58d4a923295058e848b2f0751fa8f4f45e, BUILD_DIR=/tmp/build_59bb7b24, CACHE_DIR=/tmp/codon/tmp/cache, pwd=/tmp/codon/tmp/buildpacks/89c5ba58d4a923295058e848b2f0751fa8f4f45e
remote: -----> [2022-04-25 11:59:17] FreeTDS 1.00.109 building in /tmp/build_59bb7b24
remote: -----> [2022-04-25 11:59:17] Creating .profile.d entry
remote:        configured APP env vars:
remote:          export PATH="/app/freetds/bin:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/bin:/usr/local/bin:/usr/bin:/bin"
remote:          # tiny_tds extconf.rb uses FREETDS_DIR
remote:          # https://github.com/rails-sqlserver/tiny_tds/blob/5046755ca91594003f8b3ca541d136f3ed859973/ext/tiny_tds/extconf.rb#L36-L38
remote:          export FREETDS_DIR="/app/freetds"
remote:          export LD_LIBRARY_PATH="/app/freetds/lib:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu/nss"
remote:          export LD_RUN_PATH="/app/freetds/lib:/usr/local/lib"
remote:          export LIBRARY_PATH="/app/freetds/lib:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu/nss"
remote:          export SYBASE="/app/freetds"
remote:        Cached files not found - downloading and unpacking...
remote: -----> [2022-04-25 11:59:18] Building FreeTDS against OpenSSL OpenSSL 1.1.1f  31 Mar 2020
remote: -----> [2022-04-25 12:00:56] Testing build
remote:        Compile-time settings (established with the "configure" script)
remote:                                    Version: freetds v1.00.109
remote:                     freetds.conf directory: /app/freetds/etc
remote:             MS db-lib source compatibility: no
remote:                Sybase binary compatibility: no
remote:                              Thread safety: yes
remote:                              iconv library: yes
remote:                                TDS version: 7.3
remote:                                      iODBC: no
remote:                                   unixodbc: no
remote:                      SSPI "trusted" logins: no
remote:                                   Kerberos: no
remote:                                    OpenSSL: yes
remote:                                     GnuTLS: no
remote:                                       MARS: no
remote: -----> [2022-04-25 12:00:56] Caching FreeTDS installation
remote:        Unpacking cached files...
remote:        configured BUILDPACK env vars:
remote:        declare -x FREETDS_DIR="/tmp/build_59bb7b24/freetds"
remote:        declare -x LD_LIBRARY_PATH="/tmp/build_59bb7b24/freetds/lib:/app/freetds/lib:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu/nss"
remote:        declare -x LIBRARY_PATH="/tmp/build_59bb7b24/freetds/lib:/app/freetds/lib:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/lib/x86_64-linux-gnu/nss"
remote:        declare -x PATH="/tmp/build_59bb7b24/freetds/bin:/app/freetds/bin:/tmp/build_59bb7b24/.heroku/activestorage-preview/usr/bin:/usr/local/bin:/usr/bin:/bin"
remote:        declare -x SYBASE="/app/freetds"
remote:        Install of FreeTDS 1.00.109 complete
remote:        END Running script: compile
remote: -----> Discovering process types
remote:        Procfile declares types -> (none)
remote:
remote: -----> Compressing...
remote:        Done: 55.4M
remote: -----> Launching...
remote:        Released v5
remote:        https://warm-spire-40708.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/warm-spire-40708.git
   78d310e..5439868  main -> main
โ›„๏ธ 3.1.2 ๐Ÿš€ /tmp/3ce01b21867258f6d576c61710222b89 (main)
$ heroku run which ffmpeg
Running which ffmpeg on โฌข warm-spire-40708... up, run.7308 (Free)

Note that before adding this buildpack which ffmpeg returns a result, after adding this buildpack it does not.

Issue interacting with another shared object

Hello! I've run into an issue using an Aptfile and the heroku-community/apt buildpack alongside FreeTDS that I can't seem to get sorted.

I've created a minimum reproducible example here. Note that without the FreeTDS buildpack, the application runs successfully. The application itself deploys successfully, but running heroku run rails console is enough to trigger the exception (captured in the repo above).

I'm not quite sure how to proceed here and would love to hear any workarounds others have tried.

buildpack not working on heroku-22 stack

I believe there is some configuration problem with this heroku buildpack and the heroku-22 stack. Here are a few things I have tried:

  • Installing with different FREETDS_VERSION settings (and none at all)
  • with the main branch of this code, 1.1.2 and 1.1.1 versions, and same problem
  • On my local macbook, I can run the freetds tsql connection command to connect almost instantaneously to a variety of mssql databases (one on ec2 and two on azure), but the same command times out on heroku bash prompt:
~ $ tsql -H ***.rds.amazonaws.com -p 1433 -U *** -P ***
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
103Error 20002 (severity 9):
	Adaptive Server connection failed
Error 20002 (severity 9):
	Adaptive Server connection failed
There was a problem connecting to the server
  • I can ping the server from heroku bash:
~ $ nslookup <host1>.us-east-1.rds.amazonaws.com
Server:		<ip address>
Address:	<ip address>#53

Non-authoritative answer:
<host1>.rds.amazonaws.com	canonical name = <host name>.compute-1.amazonaws.com.
Name:	<host name>.compute-1.amazonaws.com
Address: <another ip address>

~ $ nc -zv <host1>us-east-1.rds.amazonaws.com 1433
Connection to <host1>.us-east-1.rds.amazonaws.com (<another ip address>) 1433 port [tcp/ms-sql-s] succeeded!

Any ideas would be greatly appreciated!

"grep: command not found" when trying to build the buildpack

After this PR was merged, we immediately started seeing the following error during heroku deployment

-----> FreeTDS app detected
       BIN_DIR=/tmp/codon/tmp/buildpacks/89c5ba58d4a923295058e848b2f0751fa8f4f45e/bin, ROOT_DIR=/tmp/codon/tmp/buildpacks/89c5ba58d4a923295058e848b2f0751fa8f4f45e, BUILD_DIR=/tmp/build_c95bba3f, CACHE_DIR=/tmp/codon/tmp/cache, pwd=/tmp/codon/tmp/buildpacks/89c5ba58d4a923295058e848b2f0751fa8f4f45e
-----> [2023-01-18 09:57:46] FreeTDS 1.1.15 building in /tmp/build_c95bba3f
-----> [2023-01-18 09:57:46] Creating .profile.d entry
       configured APP env vars:
         export PATH="/app/freetds/bin:$PATH"
         # tiny_tds extconf.rb uses FREETDS_DIR
         # https://github.com/rails-sqlserver/tiny_tds/blob/5046755ca91594003f8b3ca541d136f3ed859973/ext/tiny_tds/extconf.rb#L36-L38
         export FREETDS_DIR="/app/freetds"
         export LD_LIBRARY_PATH="/app/freetds/lib:/usr/local/lib"
         export LD_RUN_PATH="/app/freetds/lib:/usr/local/lib"
         export LIBRARY_PATH="/app/freetds/lib:/usr/local/lib"
         export SYBASE="/app/freetds"
       Unpacking cached files...
/tmp/codon/tmp/buildpacks/89c5ba58d4a923295058e848b2f0751fa8f4f45e/bin/compile: line 113: grep: command not found
       END Running script: compile
 !     Push rejected, failed to compile FreeTDS app.
 !     Push failed

Switching to the commit just before the last one resolved the issue.

This is on heroku-18 stack, not sure about the recent versions.

Support for heroku-18 stack

Hi,

We upgraded to heroku-18 and now the buildpack breaks on new deploys / our review apps.
Help would be much appreciated ๐Ÿ™๐Ÿ‘๐Ÿ˜„

Which project to use?

The README refers to the x-b-e fork, which appears to be the same code. Is that just a typo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.