Skip to content

Instantly share code, notes, and snippets.

View eladb's full-sized avatar
☁️
winging it

Elad Ben-Israel eladb

☁️
winging it
View GitHub Profile
@eladb
eladb / child.js
Created March 13, 2012 15:23
node.js test fails when pipes are not closed on Windows
require('child_process').spawn(process.execPath, ['grandchild']);
// exit after 500ms
setTimeout(function() { process.exit(1); }, 500);
@eladb
eladb / app.js
Created June 23, 2012 16:16
mylittlepaas - hello world
var http = require('http');
http.createServer(function(req, res) {
res.end('Hello, little PaaS\n');
}).listen(process.env.port || 5000);
console.log('My little PaaS started on port', process.env.port || 5000);
@eladb
eladb / app.js
Created June 23, 2012 16:21
mylittlepaas - hello world with post-receive hook endpoint
var http = require('http');
http.createServer(function(req, res) {
if (req.url === '/mysupersecretdeploymentendpoint' && req.method === 'POST') {
console.log('Post-receive trigger. Exiting in 1 second');
setTimeout(function() { process.exit(1); }, 1000);
return res.end();
}
res.end('Hello, little PaaS (v2)\n');
@eladb
eladb / gist:2979049
Created June 23, 2012 17:06
mylittlepaas - commit hello world
$ git add app.js package.json
$ git commit -m 'Hello world'
[master d8e0ac5] Hello world
2 files changed, 29 insertions(+), 0 deletions(-)
create mode 100644 app.js
create mode 100644 package.json
$ git push origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
@eladb
eladb / gist:2979054
Created June 23, 2012 17:08
mylittlepaas - GET /
$ curl http://ec2-11-111-11-111.eu-west-1.compute.amazonaws.com
Hello, little PaaS
@eladb
eladb / gist:2979056
Created June 23, 2012 17:08
mylittlepaas - Logs
$ ssh -i /path/to/keypair.pem ubuntu@ec2xxx.compute.amazonaws.com tail -f /var/log/paas.log
Starting app from https://github.com/eladb/mylittlepaas
16:01:59 - TRACE - done
My little PaaS started on port 80
@eladb
eladb / gist:2979059
Created June 23, 2012 17:09
mylittlepaas - Manual deployment
$ ssh -i /path/to/keypair.pem ubuntu@ec2xxx.compute.amazonaws.com sudo restart paas
paas start/running, process 8857
@eladb
eladb / gist:2979060
Created June 23, 2012 17:10
mylittlepaas - GET / (v2)
$ curl http://ec2-11-111-11-111.eu-west-1.compute.amazonaws.com
Hello, little PaaS (v2)
@eladb
eladb / gist:2979066
Created June 23, 2012 17:11
mylittlepaas - clone hello world
$ git clone git@github.com:eladb/mylittlepaas.git
Cloning into mylittlepaas...
@eladb
eladb / gist:2979574
Created June 23, 2012 19:17
mylittlepaas - commit trigger
$ git commit -am 'Adding post-receive hook endpoint'
[master 54b0128] Adding post-receive hook endpoint
1 files changed, 7 insertions(+), 1 deletions(-)
$ git push origin master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 538 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@github.com:eladb/mylittlepaas2.git