Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
169 lines (98 sloc) 3.74 KB
cf-plugins local-push, update-cli
CF meetup at Tokyo
31 Mar 2016
Taichi Nakashima
@deeeet
* About me
.image img/deeeet.png 200 _
- *@deeeet* (Twitter) / *@tcnksm* (GitHub)
- [[http://deeeet.com][http://deeeet.com]]
- CloudFoundry Dev&Ops in Rakuten
* Love golang
Tools
- [[https://github.com/tcnksm/gcli][gcli]] - The easy way to build Golang command-line application
- [[https://github.com/tcnksm/gotests][gotests]] - A tool to generate Go test functions from the given source code like gofmt
- [[https://github.com/tcnksm/ghr][ghr]] - Create Github Release and upload artifacts in parallel
- [[https://github.com/tcnksm/license][license]] - Generate LICENSE file you want
- kafka-firehose-nozzle (Coming soon) - Integrate CloudFoundry with [[http://kafka.apache.org/][Apache Kafka]]
Packages
- [[https://github.com/tcnksm/go-input][go-input]] - Go package for ideal tty prompt
- [[https://github.com/tcnksm/go-latest][go-latest]] - Simple way to check version is latest or not from various sources in Go
* Cf plugins
- [[https://github.com/tcnksm/cf-plugin-local-push][cf-plugin-local-push]]
- [[https://github.com/tcnksm/cf-plugin-update-cli][cf-plugin-update-cli]]
* Cf plugins
- cf/cli has functionality
- cf plugins enable developers to add custom commands to the cf/cli
* local-push
* local-push
`local-push` allows you to push your CF application to your local docker container with buildpacks 🐳
* local-push
_DEMO_
.image img/local-push.gif 500 _
* local-push
Target user?
- Application developer who deploys & runs their service on CF
Why?
Application developer (at least me) wants *debug* application on own PC
- It's fast
- You can play with test data and break it
- You can see what buildpack does
* local-push vs. Others
BOSH Lite?
- It's very very heavy
- It's for who operates CF. Not for application developer
Nanocf?
- It's also heavy (`7.4GB`)
- You don't need all components
* How local-push works? (1/2)
In one word, `local-push` emulates DEA environment with docker and cf-buildpack.
0. Bulding base docker image: `tcnksm/cf-buildstep`
- Forked `progrium/buildstep`
- Base image is `cloudfoundry/cflinuxfs2` (Same as DEA)
- Installing cf-buidpacks
(It's already uploaded on docker registry)
* How local-push works? (2/2)
1. Building docker image (tcnksm/local-push)
- Add application code
- Fetch dependencies and compile application with buildpack
2. Run container
- Parse `Procfile`
- `docker run -p 8080:8080 -e PORT=8080 tcnkms/local-push`
* Benefit?
- Very light-weight ( base image size is around `1.1` GB )
- Extreamly fast build & boot by docker cache function
- Login to container and see what's happening by `docker exec`
* Install
Use `install-plugin` command,
$ cf add-plugin-repo tcnksm https://t-plugins.au-syd.mybluemix.net
$ cf install-plugin -r tcnksm local-push
* Next step?
- Interact with DB or MQ
- Integrate with LB (sending special header)
- Parse `manifest.yml` ([[https://github.com/tcnksm/go-cf-manifest][tcnksm/cf-go-manifest]])
* update-cli
* update-cli
`update-cli` allows you to update cf/cli to the latest version.
* update-cli
_DEMO_
.image img/update-cli.gif 500 _
* update-cli
Why?
I want this function on cf/cli itself. Kind of proposal to show how it useful.
* How update-cli work?
Core of this plugin is [[https://github.com/tcnksm/go-latest][tcnksm/go-latest]]
githubTag := &latest.GithubTag{
Owner: "cloudfoundry",
Repository: "cli",
}
res, _ := latest.Check(githubTag, "0.1.0")
if res.Outdated {
fmt.Printf("0.1.0 is not latest, you should upgrade to %s", res.Current)
}
* Install
Use `install-plugin` command,
$ cf add-plugin-repo tcnksm https://t-plugins.au-syd.mybluemix.net
$ cf install-plugin -r tcnksm update-cli
* Next time?
- How to write good cf plugins