Skip to content

Commit

Permalink
use the SOCKPATH to control where we drop the socket
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Fisher committed Aug 12, 2010
1 parent e336791 commit a394fcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace :deploy do
task :start do
run "TWITTER_BASIC=dGFmMjp0b2RkY2hhb3Mx /usr/bin/nohup #{nodepath} #{current_path}/server.js > #{shared_path}/log/run.log &"
run "SOCKPATH=/var/www/apps/twitrack/shared/server.sock TWITTER_BASIC=dGFmMjp0b2RkY2hhb3Mx /usr/bin/nohup #{nodepath} #{current_path}/server.js > #{shared_path}/log/run.log &"
end
task :stop do
run "/usr/bin/pkill -f #{nodepath}"
Expand Down
6 changes: 5 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ var TWITTER_TRACK = "#inception";

// proxy buffered tweets to /tweets
(function() {
var socket_path = process.env['SOCKPATH'];
if (!socket_path) {
socket_path = (__dirname + "/tmp/server.sock");
}
http.createServer(function (request, response) {
if (request.method == 'GET' || request.method == 'HEAD') {
response.writeHead(200, {'Content-Type': 'text/plain'});
Expand All @@ -50,6 +54,6 @@ var TWITTER_TRACK = "#inception";
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end("Unsupported method");
}
}).listen("server.sock");
}).listen(socket_path);
console.log('Server running at server.sock');
})();

0 comments on commit a394fcd

Please sign in to comment.