Connect local runtime from Google Colab on laptop/pc to tljh on server

Hi,

we have tljh running on a server S.
I can open Google Colab on a laptop L.

What is necessary to adjust in the tljh installation on S, such that it can be used as a local runtime for Colab on L.

I have added to /opt/tljh/config/jupyterhub_config.d/GoogleColab.py on S

c.JupyterHub.tornado_settings = {
       'headers': {
           'Access-Control-Allow-Origin': 'https://colab.research.google.com',
           # 'Access-Control-Allow-Credentials': 'true',
       },
   }

followed by
tljh-config reload hub

I have a portforward on L
ssh -v -N -L 8888:S:80 alf@[gateway]

I have created an API token in tljh on S

I try to connect to a local runtime in Colab on L using
http://localhost:8888/?token=[API token]

However, Colab keeps on saying that it cannot connect to the local runtime.

Any suggestions?

Regards, Alf.

I don’t know anything about colab local runtime, but the URL for your server on the forwarded host ought to be http://localhost:8888/user/yourname/?token=..., and your server should already be running.

Yes, if I use that (with https instead of http and with a forward to port 443 (https) of the server) then I can access the tljh web interface from the browser on the laptop (logged in as username but without giving a password, so the token is applied). It is essential that the server for username has been started before, as you said. That is fine - thanks a lot.

However, if I paste that same link into the “Connect to a local runtime” of Google Colab then I still get that it cannot connect to it. So here I still need some help.

Alf.