From 59d2bf17e1649d80cd09415b5bf5286afe4ace39 Mon Sep 17 00:00:00 2001 From: James Halliday Date: Sat, 10 Dec 2011 15:19:04 -0800 Subject: [PATCH] updated readme for the new project pivot --- README.markdown | 124 ++++++++++++------------------------------------ 1 file changed, 31 insertions(+), 93 deletions(-) diff --git a/README.markdown b/README.markdown index 694e865..54d8411 100644 --- a/README.markdown +++ b/README.markdown @@ -1,112 +1,50 @@ stagecoach ========== -Shuffle servers around to make staging instances super simple for continuous -integration and load balancing. - -examples -======== - -forward.js ----------- - -Spin up 2 http servers and forward localhost:8000 to :9000 and $(hostname):8000 -to :9001. - -````javascript -var stagecoach = require('stagecoach'); -var exec = require('child_process').exec; -var http = require('http'); - -http.createServer(function (req, res) { - res.setHeader('content-type', 'text/plain'); - res.end('servers[0]\n'); -}).listen(9000); - -http.createServer(function (req, res) { - res.setHeader('content-type', 'text/plain'); - res.end('servers[1]\n'); -}).listen(9001); - -exec('hostname', function (err, hostname) { - var coach = stagecoach().listen(8000); - coach.add('localhost', 9000); - coach.add(hostname.trim(), 9001); -}); -```` - -swap.js -------- - -Spin up 2 servers and swap the servers every 2 seconds between sitting at -localhost:8000 and $(hostname):8000. - -````javascript -var stagecoach = require('../'); -var exec = require('child_process').exec; -var http = require('http'); - -http.createServer(function (req, res) { - res.setHeader('content-type', 'text/plain'); - res.end('servers[0]\n'); -}).listen(9000); - -http.createServer(function (req, res) { - res.setHeader('content-type', 'text/plain'); - res.end('servers[1]\n'); -}).listen(9001); - -exec('hostname', function (err, out) { - var hostname = out.trim(); - - var coach = stagecoach().listen(8000); - coach.add('localhost', 9000); - coach.add(hostname, 9001); - - setInterval(function () { - coach.swap('localhost', hostname); - }, 2000); -}); -```` - -methods -======= +Stagecoach is a git deploy server and http router for continuous deployment. -````javascript -var stagecoach = require('stagecoach'); -var coach = stagecoach(); -```` +When you `git push` to stagecoach, the code spins up on a new subdomain based on +the commit hash. -coach.listen(port) ------------------- +You can then alias commit hash domains to client-facing subdomains using custom +routing logic to do feature splits, A/B tests, or incremental phased deployment. -Listen on a port. +status +====== -coach.add(from, to) -------------------- +The first part of the CLI tool that hosts a git server over http and brings up +new domains works. -Map the hostname string `from` to the host, port, "host:port", or -`{ host : ..., port : ... }` value `to`. +The ports are hard-coded which is lame. Authentication over basic auth needs to +be implemented too. -Incoming requests for the hostname `from` will be forwarded to `to`. -Incoming `from` hostnames will have any ":port" values stripped out. +The API for modifying the routing logic needs merged from the old code into the +bin script. -coach.swap(x, y) ----------------- +get started +=========== -Swap the routes for hostnames `x` and `y`. +Create a `deploy.json` file in a git repo with a `"start"` key: -todo -==== +``` js +{ "start" : "node server.js" } +``` -* hooks for load-balancing (an array or callback for .add()'s `to`) +Fire up a new git deploy server using the `stagecoach` command: -install -======= + stagecoach + +Push to the deploy server from your repo: + + git push http://localhost:7070 master + +Navigate to the commit hash subdomain on the deploy server: + + curl -H host:f117c05cb138b360e2d4dcd5b354ab2a5408adeb.localhost localhost:7070 -With [npm](http://npmjs.org) do: +Hooray it worked. - npm install stagecoach +TODO: feature routing license =======