Skip to content

use gnutls #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Or at least, that's the hope!

## Stack compatibility

This buildpack is tested primarily against the `cedar-18` stack.
This buildpack is tested primarily against the `heroku-22` stack.

Allows for usage of [TinyTDS](https://github.com/rails-sqlserver/tiny_tds) on Heroku.

Expand Down Expand Up @@ -94,6 +94,9 @@ Print TinyTDS build logs to the screen:
echo -e "\n\n----------------------- $cmd------------------\n\n"; eval "$cmd"; done ; )
```

### Connection Timeout
If you receive connection timeout errors (e.g. "Adaptive Server connection failed"), consider whether TLS/gnutls is interacting poorly with heroku or the server where your mssql server lives. You can set the environment variable `heroku config:set USE_GNUTLS=" "` and temporarily set `heroku config:set FREETDS_REBUILD=true` to rebuild the code using TLS. See https://github.com/FreeTDS/freetds/issues/336 for more information.

License
-------

Expand Down
10 changes: 9 additions & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ load_env_vars() {
local env_var; env_var="${1:-}"
until [ -z "$env_var" ]; do [ -f "$ENV_DIR/$env_var" ] && export "$env_var=$(cat "$ENV_DIR/$env_var")"; shift ; env_var="${1:-}" ; done
}
load_env_vars "FREETDS_VERSION" "FREETDS_ARCHIVE_NAME" "TDS_VERSION" "FREETDS_REBUILD"
load_env_vars "FREETDS_VERSION" "FREETDS_ARCHIVE_NAME" "TDS_VERSION" "FREETDS_REBUILD" "USE_GNUTLS"

FREETDS_VERSION="${FREETDS_VERSION:-1.00.109}"
FREETDS_ARCHIVE_NAME="${FREETDS_ARCHIVE_NAME:-freetds-${FREETDS_VERSION}}"
TDS_VERSION="${TDS_VERSION:-7.3}" # or TDSVER
USE_GNUTLS="${USE_GNUTLS:---with-gnutls}"

CACHED_TAR="${CACHE_DIR}/freetds-${FREETDS_VERSION}-heroku.tar.bz2"
# Default rebuild to true since I'm having issues linking the library to tiny_tds gem with a cached build.
Expand Down Expand Up @@ -137,9 +138,16 @@ build_and_install_freetds() {
# FreeTDS advises caching the build options as below
# adding --disable-odbc making linking easier and we don't need it
# adding --disable-debug to speed up compile

# As of Oct. 2022, heroku-22 stack currently only works with gnutls.
# Allow this to be toggled off in the future with `export USE_GNUTLS=" "`
# See https://github.com/FreeTDS/freetds/issues/336
# and https://www.freetds.org/userguide/config.html
# for more information.
cat <<EOF > ".build_options"
./configure \
"--prefix=${APP_TARGET_DIR}" \
"${USE_GNUTLS}" \
--disable-odbc \
--disable-debug \
"--with-tdsver=${TDS_VERSION}"
Expand Down