Skip to content

Qarik-Group/freetds-buildpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FreeTDS Cloud Foundry buildpack

FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases.

This Cloud Foundry supply buildpack can be used in conjunction with your normal application buildpack (ruby_buildpack for example), to allow dependencies to be installed that require TinyTDS (the Ruby tiny_tds rubygem for example).

The FreeTDS library and binaries are already precompiled, so this buildpack is very fast to use from your first deployment.

Without this buildpack, your application deployment to Cloud Foundry might fail with an error like:

  Installing tiny_tds 2.1.2 with native extensions
  Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
...
Failed! Do you have FreeTDS 0.95.80 or higher installed?
...
  In Gemfile:
    tiny_tds
  **ERROR** Unable to install gems: exit status 5

This buildpack's CI pipeline automatically watches for new releases of FreeTDS and self-publishes new releases of the buildpack. Watch this repo for new releases.

Usage

Simple add freetds_buildpack or https://github.com/starkandwayne/freetds-buildpack to the start of your manifest.yml buildpacks list.

For example, from fixtures/rubyapp/manifest.yml:

applications:
- name: rubyapp
  buildpacks:
  - freetds_buildpack
  - ruby_buildpack

If you use freetds_buildpack then your Cloud Foundry administrator will need to install the freetds_buildpack using cf create-buildpack.

If you cannot get a Cloud Foundry administrator to do this, then use the Git URL:

applications:
- name: rubyapp
  buildpacks:
  - https://github.com/starkandwayne/freetds-buildpack
  - ruby_buildpack

Buildpack Developer Documentation

To build this buildpack, run the following command from the buildpack's directory:

  1. Source the .envrc file in the buildpack directory.

    source .envrc

    To simplify the process in the future, install direnv which will automatically source .envrc when you change directories.

  2. Install buildpack-packager

    ./scripts/install_tools.sh
  3. Build the buildpack

    buildpack-packager build -stack cflinuxfs3 -cached
  4. Use in Cloud Foundry

    Upload the buildpack to your Cloud Foundry.

    cf create-buildpack freetds_buildpack freetds_buildpack-*.zip 100
    cf push -p fixtures/rubyapp -f fixtures/rubyapp/manifest.yml

Testing

Buildpacks use the Cutlass framework for running integration tests.

To test this buildpack, run the following command from the buildpack's directory:

  1. Source the .envrc file in the buildpack directory.

    source .envrc

    To simplify the process in the future, install direnv which will automatically source .envrc when you change directories.

  2. Run integration tests

    ./scripts/integration.sh

    To run integration tests against CFDev:

    cf login -a https://api.dev.cfdev.sh --skip-ssl-validation -u admin -p admin
    CUTLASS_SCHEMA=https CUTLASS_SKIP_TLS_VERIFY=true ./scripts/integration.sh

    More information can be found on Github cutlass.

Reporting Issues

Open an issue on this project.