Skip to content

Gerg/java-debug-buildpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Debug Buildpack

About

Proof-of-concept Cloud Foundry buildpack for collecting debug information about java applications at runtime.

How it Works

This buildpack adds a sidecar process to any application built with it. The sidecar is a simple web server. If a route is mapped to the web server and an HTTP request is issued to it, then the sidecar collects a java thread dump from the running java application.

Usage

  1. Build the sidecar binary
    $ GOOS=linux GOARCH=amd64 go build java_debug_sidecar.go
    
  2. Zip it up:
    # from the root of this repo, zip up buildpack excluding the .git directory 
    $ zip -r java-debug-buildpack.zip . -x "*.git*"
    
  3. Upload the buildpack to cloudfoundry
    $ cf create-buildpack java_debug_buildpack java-debug-buildpack.zip <index>
    
  4. Push a java app
    $ cd <app-rootdir>
    # note the debug buildpack cannot be the final buildpack
    $ cf push my-app -b java_debug_buildpack -b java_buildpack
    

In a real use case, you would set up an external route to the sidecar via the v3 API, but it is not currently well-supported via the CLI. For simplicity, it's easier to ssh in and call the sidecar on localhost:

$ cf ssh my-app
...
$ curl localhost:8081/threaddump

The thread dump will then be added to the app's logs.

About

Proof-of-concept for Cloud Foundry buildpack that adds debug sidecar for java apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published