Zero downtime redeploys of websites or services pulled down from a git repo.
Works with HTTP, Websockets and raw TCP.
Create a new proxy that pulls
ghub.io from github and serves it
8000. The website's stdout and stderr will be printed on the
var Proxy = ;var proxy ='git://github.com/juliangruber/ghub.io.git'__dirname + '/repos';proxy;proxy;proxystdout;proxystderr;
The site is served at
Then, when you want to redeploy, send a special request to the management server that listens on port 8001:
curl -XPUT http://localhost:8001/deploy/
Modifying checked out code
If you want to insert extra steps into the deployment process, like running
npm install, listen to the
All listeners for the
source event muss call
done() when finished.
Redeploy, and optionally overwrite
branch, which defaults to
remote, which defaults to the remote you passed to the
Authentication is basically up to you, since this only gives you a node core http server. Some easy ways would be to wrap the http server in something that does basic auth, or to make it listen on a unix socket that's only accessible via ssh.
$ npm install -g pull-proxy
$ pull-proxyGit pull based deployment solution.Usage: pull-proxy [options]Options:--git, -g Git url to pull from [required]--proxy, -p Proxy port [required]--repos, -r Path to pull repositories into [default: "./repos"]--manage, -m Management port--no-zero-downtime Turn of zero downtime deploys [boolean] [default: false]--stdout, --out Forward stdout output [boolean] [default: false]--stderr, --err Forward stderr output [boolean] [default: false]--log, -l Print internal events on stdout [boolean] [default: false]--help, -h Print usage instructionMissing required arguments: git, proxy
Create a new proxy that serves the repo at
remote. It will store the local
checkouts of repos in
repos, which defaults to
Turn off zero downtime deploys. This way there's always only one instance of the site running.
Create a http server for managing the proxy.
Create a http server that proxies requests to your site and ensures zero downtime redeploys.
Readable streams that contain the stdout or stderr from the spawned childprocess of the website that is being proxied to.
Redeploy. Optionally override
branch and get called back when
With npm do
$ npm install pull-proxy
Copyright (c) 2013 Wayla <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.