exoframejs / exoframe

Exoframe is a self-hosted tool that allows simple one-command deployments using Docker
https://exoframejs.github.io/exoframe/
1.13k stars 56 forks source link

Shell access to running services #4

Closed yamalight closed 7 years ago

yamalight commented 7 years ago

Investigate if it's possible to provide direct shell access to running services. Question is basically - can you proxy shell with REST? (websockets?)

yamalight commented 7 years ago

Docker method to be used is Exec Create. Dockerode has Container.exec method for it.

yamalight commented 7 years ago

Following code creates the interactive exec session and pipes stdin to container:

  const options = {
    Cmd: ['bash'],
    Tty: true,
    AttachStdin: true,
    AttachStdout: true,
    AttachStderr: true,
  };

  const exec = await container.execAsync(options);
  const stream = await exec.startAsync({stdin: true});
  container.modem.demuxStream(stream, process.stdout, process.stderr);
  process.stdin.pipe(stream);
yamalight commented 7 years ago

Challenges:

  1. This needs a stream between cli and server (websockets?)
  2. Either output stream or user input needs to be filtered because code in previous comment doubles input string on send (might be not needed when websockets are used?)
yamalight commented 7 years ago

Closing since core has changed significantly.