Using Meteor shell to connect to a deployed app

Hi,

Meteor shell is awesome. What would be even more awesome is if it could work for a deployed app (i.e. what “meteor build” produces).

Has anyone managed to get this right? Any thoughts on how to hack this?

Tx,
G

1 Like

Agree this would be great. (Though also dangerous, but also great. But also very dangerous! ;))

I thought there would already be a similar thing existing for nodejs at least. But a quick google search gave absolutely no useful results. Maybe I’m just using the wrong search terms…
Actually, I just found something. Apparently there is a REPL core module in node (https://nodejs.org/api/repl.html) and it’s really easy to set up even in a running server, like so:

var repl = require('repl')
var net = require('net')

module.exports = net.createServer(function (socket) {
  var r = repl.start({
    prompt: '[' + process.pid + '] ' +socket.remoteAddress+':'+socket.remotePort+'> '
    , input: socket
    , output: socket
    , terminal: true
    , useGlobal: false
  })
  r.on('exit', function () {
    socket.end()
  })
  r.context.socket = socket
}).listen(1337);

(Source: http://qzaidi.github.io/2013/05/14/node-in-production/ - last part)

So it seems like it would be trivial to run at least a regular node shell that can be logged in to remotely. Just make sure to listen only on localhost and connect via ssh with port forwarding.

2 Likes