Git Product home page Git Product logo

binary-buildpack's Introduction

Cloud Foundry buildpack: Binary Files

A Cloud Foundry buildpack for running arbitrary binary web servers.

Additional information can be found at CloudFoundry.org.

Usage

Unlike most other Cloud Foundry buildpacks, the binary buildpack must be specified in order for it to be used in staging your binary file. You can specify the buildpack your app should use with the -b option for cf push:

cf push my_app -b https://github.com/cloudfoundry/binary-buildpack.git

There are two ways to provide Cloud Foundry with the shell command to execute your binary:

Procfile

Include in your app's root directory a Procfile that specifies a web task:

web: ./app

Command line

Alternatively, you can provide the start command when deploying your app with cf push by including a -c option:

cf push my_app -c './app' -b binary-buildpack

Compiling your Binary

Your binary is expected to bind to the port specified in the PORT environment variable. Here is an example in Go:

package main

import (
	"fmt"
	"net/http"
	"os"
)

func handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, %s", "world!")
}

func main() {
	http.HandleFunc("/", handler)
	http.ListenAndServe(":"+os.Getenv("PORT"), nil)
}

Your binary should run without any additional runtime dependencies on the cflinuxfs2 or lucid64 root filesystem (rootfs). Any such dependencies should be statically linked to the binary.

To boot a docker container running the cflinuxfs2 filesystem:

docker run -it cloudfoundry/cflinuxfs2 bash

To boot a docker container running the lucid64 filesystem:

docker run -it cloudfoundry/lucid64 bash

To compile the above Go application on the rootfs, golang must be installed. apt-get install golang and go build app.go will produce an app binary.

When deploying your binary to Cloud Foundry, you can specify the root filesystem it should run against with cf push's -s option flag:

cf push my_app -s (cflinuxfs2|lucid64)

To run docker on Mac OS X, we recommend boot2docker.

Contributing

Find our guidelines here.

Help and Support

Join the #buildpacks channel in our [Slack community] (http://slack.cloudfoundry.org/)

Reporting Issues

To report an issue with the buildpack, open an issue on this GitHub repo.

binary-buildpack's People

Contributors

crawsible avatar dannyzen avatar jtarchie avatar mhoran avatar styeung avatar

Watchers

James Cloos avatar  avatar  avatar

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.