cf-plugin-local-push
is a cloudfoundry/cli plugin. It allows you to push your cloudfoundry application to your local docker container with actual buildpacks 🐳. This plugin manipulates DEA (where cf application is runnging) enviroment. This can be used for setting up very light weight debug environment for application developers or running unit tests. And power of docker build cache, start up application is really fast.
This plugin is still PoC, so please be careful to use this plugin.
I gave a talk about cf-plugin-local-push
at CloudFoundry Tokyo Meetup #1, slide
Why we need this? Because the application developers (at least, me) want to debug their cf app on local environment before push
to actual environment. Since it's faster and you don't need care about breaking the app or wasting resources (you may not have internet access when they need to run it), it's important to have local development environment.
Cloudfoundry community provides bosh-lite for local dev environment for BOSH using warden containers. But for me, it's too heavy and not for user. It's only for CF operators.
The following demo runs sample ruby application (the code is available here). Just cf local-push
, it detects application runtime and starts building it with its buildpack. While it takes time at first time, it's really fast at the second time because of docker build cache.
To install this plugin, use go get
(make sure you have already setup golang enviroment like $GOPATH
),
$ go get -d github.com/tcnksm/cf-plugin-local-push
$ cd $GOPATH/src/github.com/tcnksm/cf-plugin-local-push
$ make install # if you have already installed, then run `make uninstall` before
Or you can install it from my experimental plugin repository.
$ cf add-plugin-repo tcnksm http://t-plugin.mybluemix.net
$ cf install-plugin -r tcnksm local-push
Since this plugin is still immature, it's not on Community Plugin Repo.
To use this plugin, you need to setup docker environment, docker daemon running and docker client cli (See Docker Toolbox). Then run the following command in the directory where your application source is.
$ cf local-push
NOTE1: This plugins does not support parsing manifest.yml
yet. Currently, it's only manipulate executing buildpack and parsing Procfile
.
NOTE2: Currently it uses gliderlabs/herokuish inside base image, so buildpack is heroku's one. So it' a bit different from cf buildpack. It will be replaced with CF buildpack.
NOTE3: It's not allowed to use arbittrary buildpack now. Check the available buildpack here.
local-push
will a build docker image with compiling your application source code by appropriate buildpack. After building, you can access to an application runnging (by default, port is 8080
),
$ curl $(docker-machine ip):8080
While container is running, you can enter the container and can see what's happening there,
$ cf local-push -enter
The main idea comes from CenturyLinkLabs/building. While it focuses on Heroku application, local-push
does Cloud Foundry application (There are slight difference between them).
- Fork (https://github.com/tcnksm/cf-plugin-local-push/fork)
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
go test ./...
command and confirm that it passes - Run
gofmt -s
- Create a new Pull Request