Make a bare git repo on your server. I follow these instructions. Add the post-receive hook.
Install node and haibu. Start haibu. Drop deploy.js somewhere. Push with git on your local machine to your server. Done!
#! /path/to/node | |
var haibu = require('/path/to/haibu'); | |
var client = new haibu.drone.Client(); | |
process.stdin.resume(); | |
process.stdin.on('data', function(data){ | |
var package = JSON.parse(data.toString()); | |
package.repository = { | |
type: "git", | |
url: "/path/to/dir/containing/repos/"+package.name+".git" | |
}; | |
client.get(package.name, function(err){ | |
if (!err) { | |
client.stop(package.name, function(){ | |
client.clean(package, function(){ | |
client.start(package, function(err, result){ | |
if (err) { | |
console.log('Error', err); | |
return; | |
} | |
console.log("Client updated! " + package.name + " running at " + result.drone.port ); | |
}); | |
}); | |
}); | |
} | |
else { | |
client.start(package, function(err, result){ | |
if (err) { | |
console.log('Error', err); | |
return; | |
} | |
console.log("Success! " + package.name + " running at " + result.drone.port ); | |
}); | |
} | |
}); | |
}); |
Make a bare git repo on your server. I follow these instructions. Add the post-receive hook.
Install node and haibu. Start haibu. Drop deploy.js somewhere. Push with git on your local machine to your server. Done!
#! /usr/bin/env bash | |
git show master:package.json | /path/to/deploy.js |