Access Jupyter hub with FQDN

Hello guys,

I have a strange situation about accessing the Jupyterhub website. And i dont know how to solve this problem.
I open the 443 port and added ssl cert and key in the jupyterhub_config.py

c = get_config() #noqa
c.JupyterHub.ssl_key = ‘/etc/letsencrypt/live//privkey.pem’
c.JupyterHub.ssl_cert = ‘/etc/letsencrypt/live//fullchain.pem’
c.JupyterHub.ip = ‘xxx.xxx.xx.xxx’
c.JupyterHub.port = 443

After running jupyterhub, the website is accessable. The users will be redirected to the login Website. But after one moment, it is not accessable again. You have to wait for a while, until it is automatically accessable again. I also checked the process running on port 443, it indicates port 443 is still listening. Can some one help me please.

Could you post your JupyterHub logs here? Without logs it is impossible to help you debug your problem.

No, we will need JupyterHub logs. How did you deploy JupyterHub service?

If you have deployed JupyterHub as a systemd service, you can get the logs from journalctl -u <name_of_the_service>. If you have used docker/podman, you can get logs from docker/podman logs -f <name_of_container>.

There is no log from syystemd

– Logs begin at Tue 2024-02-06 10:44:03 UTC, end at Wed 2024-02-07 14:24:59 UTC. –
– No entries –

But this seems to be helpful?

[I 2024-02-07 14:18:01.099 JupyterHub log:191] 200 GET /hub/home (gyq@xx.xx.xxx.x) 2.99ms
[I 2024-02-07 14:18:02.068 JupyterHub login:44] User logged out: gyq
[I 2024-02-07 14:18:02.070 JupyterHub log:191] 302 GET /hub/logout → /hub/login (@xx.xx.xxx.x) 3.53ms
[I 2024-02-07 14:18:02.080 JupyterHub log:191] 200 GET /hub/login (@xx.xx.xxx.x) 1.60ms
[I 2024-02-07 14:18:05.320 JupyterHub log:191] 200 GET /hub/login (@xx.xx.xxx.x) 1.76ms
Starting here the website is no more accessable
14:22:18.237 [ConfigProxy] info: 200 GET /api/routes

I can only login for 2 minutes, and the website is no longer accessable.
[/quote]

There is nothing strange in the logs you posted. So, there are no logs between 14:18:05.320 and 14:22:18.237? If it is the case, I guess the issue is somewhere outside of JupyterHub, mostly on your edge. Maybe there is some firewall that is blocking the server?

2 Likes

Thanks for your reply. I will try it on another edge device!

What responses do your clients receive?

Hello Guys,

i think the erro is from Traefik.
I used Certbot to generate SSL Certificat automatically in location /etc/letsencrypt/live/mydomain/fullchain.pem.
It works well for a while. And after one day, the Certificat is not available any more. See the logs of trafik:

Feb 28 17:56:01 gruppe-a systemd[1]: Stopping traefik.service…
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=info msg=“I have to go…”
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=info msg=“Stopping server gracefully”
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=error msg=“accept tcp [::]:443: use of closed network connection” entryPointName=https
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=error msg=“accept tcp 127.0.0.1:8099: use of closed network connection” entryPointName=auth_api
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=error msg=“accept tcp [::]:80: use of closed network connection” entryPointName=http
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=error msg=“Error while starting server: accept tcp [::]:80: use of closed network connection” entryPointName=http
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=error msg=“Error while starting server: accept tcp [::]:443: use of closed network connection” entryPointName=https
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=error msg=“close tcp 127.0.0.1:8099: use of closed network connection” entryPointName=auth_api
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=info msg=“Server stopped”
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=info msg=“Shutting down”
Feb 28 17:56:01 gruppe-a traefik[63046]: time=“2024-02-28T17:56:01Z” level=error msg="Error while creating certificate store: unable to find certificate for domains "xxxxx": falling back to t>
Feb 28 17:56:01 gruppe-a systemd[1]: traefik.service: Succeeded.
Feb 28 17:56:01 gruppe-a systemd[1]: Stopped traefik.service.

And This error logs for find TLS Certoficate:

Feb 28 17:43:10 gruppe-a traefik[62410]: time=“2024-02-28T17:43:10Z” level=info msg=“Testing certificate renew…” providerName=letsencrypt.acme ACME CA="https://acme-v02.api.letsenc>
Feb 28 17:43:10 gruppe-a traefik[62410]: time=“2024-02-28T17:43:10Z” level=error msg="Error while creating certificate store: unable to find certificate for domains "17871e1f-ce3e-4>
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” providerName=file filename=rules.toml
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” providerName=file filename=rules.toml
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” providerName=file filename=rules.toml
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” filename=rules.toml providerName=file
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” providerName=file filename=rules.toml
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” providerName=file filename=rules.toml
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” providerName=file filename=rules.toml
Feb 28 17:43:11 gruppe-a traefik[62410]: time=“2024-02-28T17:43:11Z” level=warning msg=“TLS store default already configured, skipping” providerName=file filename=rules.toml

It sounds like the problem is with Traefik or Certbot and not JupyterHub. Some people on this forum may use Traefik, but if you don’t get an answer you may have more success if you ask on a Traefik forum instead.

Thank you for your advice, i just move this to Traefik.

Hello manics,

Maybe it is still the problem of Jupyterhub?
Because if i use command curl -i to access my Domain, there is no problem. And i got the logs as follow. (there is nothing strange) It just redirects me to hub api.

HTTP/2 302
access-control-allow-headers: accept, content-type, authorization
content-security-policy: frame-ancestors ‘self’; report-uri /hub/security/csp-report
content-type: text/html
date: Thu, 07 Mar 2024 09:15:06 GMT
location: /hub/
server: TornadoServer/6.4
x-jupyterhub-version: 4.0.2
content-length: 0

I can´t figure out, where the problem happens, so I list the strange phenomenon I’ve run into and hopefully someone can find some trajectory.

Strange phenomenon:

  1. open https url in browser is not possible. (but use curl -i is still no problem)
  2. If you have already logged in, you can still loggout, loggin and start your single user server. You cann still create files in it. But you can´t connect to a kernel or open a Notebook.
  3. If you have already logged in, you still can access to control panel, and start/stop user servers.

Can you open your browser console, and show us the full logs of a failed connection?

Are you able to connect directly to JupyterHub without using Traefik? If you can that implies the problem is with your Traefik configuration.

Also it sounds like you’re got two sets of letsencrypt certificates, one for JupyterHub and one for Traefik. That could be a problem, the letsencrypt certificates should be on the external proxy, so in this case Traefik.

It might be helpful if you shared your full JupyterHub and Traefik configurations.

Hello,

Thanks a lot for your reply! I hope my following answer can help to find my problem! Otherwise i am going to use http link. This is no problem for me!

Browser shows me this

Since I change to TLJH now, Traefik and Jupyterhub are not separated. And I can´t stop Traefik in this case. The problem still exists.

I don´t think, that I have two certs, because letsencrypt cert is generated by cerbot method. And I used tljh-cofig set command to enable the https url.

My config.yml of TLJH is like:

users:
admin:

  • admin
    https:
    enabled: true
    letsencrypt:
    email: my email
    domains:
    • my domain name

And jupyterhub_config.py:

c = get_config() #noqa

c.JupyterHub.load_roles =

c.JupyterHub.load_groups = {
# collaborative accounts get added to this group
# so it’s easy to see which accounts are collaboration accounts
“collaborative”: ,
}

members = [‘student-a’,‘student-b’]
c.JupyterHub.load_groups[‘Collaborate-group’] = members

c.JupyterHub.load_groups[“collaborative”].append(“shared-space”)

c.JupyterHub.load_roles.append(
{
“name”: “collab-access”,
“scopes”: [
“access:servers!user=shared-space”,
“admin:servers!user=shared-space”, ],
“groups”: [‘Collaborate-group’],
}
)
def pre_spawn_hook(spawner):
group_names = {group.name for group in spawner.user.groups}
if “collaborative” in group_names:
spawner.log.info(f"Enabling RTC for user {spawner.user.name}“)
spawner.args.append(”–LabApp.collaborative=True")

c.Spawner.pre_spawn_hook = pre_spawn_hook

Is your browser configured to use a proxy, or is there a firewall somewhere? That browser error means there’s a DNS problem:

Are you sure you’ve removed all traces of your previous JupyterHub and Traefik installs? Is it possible something is still running, or there’s a configuration file left behind?

Hi manics,

your suggestion is very useful!

I just found that, the network i was using is very problematic. It blocked my request to the URL, where Jupyterhub runs.

PS: Recording a Log-Table manually (like below) helps me to find the association between error and cause and localize the error.

Date/Time | Network | Device | Status

1 Like