demotomohiro / remocolab

remocolab is a Python module to allow remote access to Google Colaboratory using SSH or TurboVNC.
MIT License
317 stars 230 forks source link

Pure X Support & using a configuration file #60

Open realThirdpartycookie opened 4 years ago

realThirdpartycookie commented 4 years ago

Hello,

I really like using your Tool. However I think using X SSH Tunneling might be better for my usecases than VNC with its limitations. So I was trying to make by manually setting the $DISPLAY variable but even though the X was passed through, I was unable to see results.

Secondly, as you already mentioned passing the ngrok Authtoken and the region settings everytime is pretty annoying. As I frequently mount my GDrive, I could imagine using a configuration file.

So something like this would be the result:

!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupSSHDandXorg("/path/to/your/config/file")

Kind Regards.

demotomohiro commented 4 years ago

Hello,

remocolab.setupVNC() just run Xorg server for VirtualGL and when you use a runtime without GPU it doesn't run Xorg server. See _setup_nvidia_gl() function in remocolab.py for more detail. I think you need to run remocolab.setupSSHD(), install xfce and run startxfce4.

For example:

!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupSSHD()
!apt-get install -qq -o=Dpkg::Use-Pty=0 xfce4 xfce4-terminal > /dev/null

import subprocess
subprocess.Popen(["startxfce4"])

This code is not tested.

You can specify ngrok region to ngrok_region argument of remocolab.setupSSHD() and remocolab.setupVNC(). ngrok token must be kept secret. I don't think google drive is a safe place to keep secrets as files and folders in google drive can be shared.