Smart Incremental application update
Why should your development environment be any different from your production environment except for the number of instances?
FastPush allows you to instantly push updates of your code to Cloud Foundry/Heroku. If static files have changed, it just syncs those. If code has changed, it also restarts the app. As a result updating your application takes seconds instead of minutes. So no more getting coffee while waiting for cf push
and more importantly, your flow won't be interrupted.
Pros:
port = (env.process.PORT || 5000)
Cons:
We add a small http proxy (cf-fastpush-controller
, written in Go) between the app's http port and the PaaS routing layer. This http proxy just proxies everything to the application, except that it has a file synchronization api listening on /_fastpush/
. This allows us to modify the live file system of the container.
We transfer local files to the server with the cf-fastpush-plugin
, a cf cli plugin that talks to the controller. It tracks your local files and synchronizes those that have been changed or added.
The actual code does more than what is documented here. So we suggest you to read the source if you are really interested in how it works and what else it can do.
Current documentation is fairly low because this project is still very young. We invite others to contribute. The code quality is not great either and we plan to refactor it in the near future. Please keep in mind the current state is far from production ready but for its purpose it is good enough to be used as a developer tool ;)
staging
phase in Cloud Foundry for subsequent changes. This means that cf fast-push
cannot and will never replace the standard cf push
command.It is extremely easy to start using FastPush:
manifest.yml
to configure your application and cf-fastpush-controller
.cf push
you can incrementally push updates with cf fast-push
.For those that are still confused why FastPush is such an awesome tool just follow this short step-by-step tutorial where we deploy an example application:
Install cf-fastpush-plugin:
wget https://github.com/xiwenc/cf-fastpush-plugin/raw/master/cf-fastpush-plugin
chmod 755 cf-fastpush-plugin
cf install-plugin cf-fastpush-plugin
rm cf-fastpush-plugin
Let's prepare an example application. Here we choose python, but there are more examples:
git clone https://github.com/xiwenc/fastpush.git
cd fastpush/examples/python
Install cf-fastpush-controller
in our example application:
wget https://github.com/xiwenc/cf-fastpush-controller/raw/master/cf-fastpush-controller
chmod +x cf-fastpush-controller
Next push our example application:
time cf push samplefastpush
# ... snip ...
# #0 running 2016-01-29 09:31:06 PM 0.0% 15.7M of 128M 114.9M of 256M
# ... snip ...
#cf push samplefastpush 1.88s user 1.91s system 5% cpu 1:04.55 total
Now edit the source code a bit and re-push the app with fast-push
:
vim hello.py
time cf fast-push samplefastpush
# ... snip ...
# [MOD] hello.py
# [NEW] manifest.yml
# Restarting after updating 2 files
# cf fast-push samplefastpush 0.40s user 0.05s system 7% cpu 5.667 total
Please note that the initial push is not very representative of a real world scenario because it adds overhead of having to push the cf-fastpush-controller binary. We can speed it up for slow connections by incorporating it in buildpacks that fetches the executable if needed.