Skip to content

About

Deploy binaries to Cloud Foundry

Topics

Resources

Contributing

Security policy

Stars

29 stars

Watchers

26 watching

Forks

Repository files navigation

Cloud Foundry Binary Buildpack

CF Slack Join us on Slack

A Cloud Foundry buildpack for running arbitrary binary web servers.

Buildpack User Documentation

Official buildpack documentation can be found at binary buildpack docs.

Building the Buildpack

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

    go install github.com/cloudfoundry/libbuildpack/packager/buildpack-packager
  3. Build the buildpack

    buildpack-packager build [ --cached=(true|false) ]
  4. Use in Cloud Foundry

    Upload the buildpack to your Cloud Foundry and optionally specify it by name

    cf create-buildpack [BUILDPACK_NAME] [BUILDPACK_ZIP_FILE_PATH] 1
    cf push my_app [-b BUILDPACK_NAME]

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 unit tests

    ./scripts/unit.sh
  3. Run integration tests

    ./scripts/integration.sh

Dynatrace Integration

This buildpack can automatically inject the Dynatrace OneAgent into your application. When a Dynatrace service is bound to the app, the buildpack downloads the OneAgent during staging and configures LD_PRELOAD (via profile.d/dynatrace-env.sh) so the agent is loaded into your binary at launch.

Bind a Dynatrace user-provided service (the service name must contain dynatrace):

cf create-user-provided-service dynatrace -p '{"environmentid":"<env-id>","apitoken":"<paas-token>"}'
cf bind-service my_app dynatrace
cf restage my_app

Supported credential fields:

Key Type Description Required Default
environmentid string The ID for the Dynatrace environment. Yes N/A
apitoken string The API Token for the Dynatrace environment. Yes N/A
apiurl string Overrides the default Dynatrace API URL to connect to. No Default API URL
skiperrors boolean If true, staging does not fail when the OneAgent download fails. No false
networkzone string If set, the agent is configured to use communication endpoints located in this network zone. No empty
enablefips boolean If true, FIPS 140-2 mode is enabled. No false
addtechnologies string Comma-separated list of additional OneAgent code modules to download (e.g. go, java, nodejs). No empty

By default the buildpack downloads the generic process code module. Since the binary buildpack runs an opaque binary, it cannot detect the application's language. For language-specific code-level insights, set addtechnologies accordingly — e.g. "addtechnologies":"go" for a Go binary. Note that OneAgent injection relies on LD_PRELOAD, so the binary must be dynamically linked (for Go, built with CGO_ENABLED=1); a fully statically-linked binary ignores LD_PRELOAD and will not be instrumented.

Contributing

Find our guidelines here.

Help and Support

Join the #buildpacks channel in our Slack community if you need any further assistance.

Reporting Issues

Open a GitHub issue on this project here.

About

Deploy binaries to Cloud Foundry

Topics

Resources

Contributing

Security policy

Stars

29 stars

Watchers

26 watching

Forks

Releases

Packages

Used by

Contributors

Languages