Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade singleuser.py to JupyterHub 4 #267

Merged
merged 5 commits into from
Mar 8, 2024

Conversation

mahendrapaipuri
Copy link
Contributor

jupyterhub-singleuser is a subclass of ExtensionApp and after a brief discussion with @minrk at JupyterCon, he told me that the new implementation of jupyterhub-singleuser does not expect any CLI args. If we use batchspawner with JupyterHub 4, we end up getting an error as follows:

[W 2023-05-13 15:27:12.537 ServerApp] Permission to listen on port 443 denied.
[C 2023-05-13 15:27:12.537 ServerApp] ERROR: the Jupyter server could not be started because port 443 is not available.
[D 2023-05-13 15:27:12.537 ServerApp] Exiting application: jupyter-server

The JUPYTERHUB_SERVICE_URL env var is set to http(s)://0.0.0.0:0/user/<user>/servers/<server> at the spawn time in batchspawner and due to this code here, depending on the HTTP scheme, the server will be either launched on 80/443 ports.

This PR replaces the port in JUPYTERHUB_SERVICE_URL with free port that we find and updates the env var. Consequently, CLI arg --port is removed as it is not used anymore.

mahendrapaipuri and others added 2 commits May 13, 2023 17:34
jupyterhub-singleuser is an extension in JH 4 and it does not expect any CLI args.

We need to pass the free port that we found in batchspawner singleuser script to jupyterhub-singleuser via `JUPYTERHUB_SERVICE_URL` env variable.
@consideRatio consideRatio requested a review from minrk March 7, 2024 10:16
@consideRatio
Copy link
Member

@minrk are you able to help review this?

Note that batchspawner is in main branch currently requires jupyterhub 1.5.1+, up from the latest release that required jupyterhub 0.9+.

JupyterHub 2.0 uses $JUPYTERHUB_SERVICE_URL instead of `--port` CLI argument
@minrk minrk changed the title Upgrade singleuser.py to JupyterHub 4 Upgrade singleuser.py for JupyterHub >= 2 Mar 8, 2024
@minrk minrk changed the title Upgrade singleuser.py for JupyterHub >= 2 Upgrade singleuser.py to JupyterHub 4 Mar 8, 2024
@minrk
Copy link
Member

minrk commented Mar 8, 2024

Updated the handling a tiny bit. JUPYTERHUB_SERVICE_URL is added in JupyterHub 2.0, so it's only 1.5.1 that needs the --port

@minrk minrk merged commit 2b4102a into jupyterhub:main Mar 8, 2024
9 of 10 checks passed
Copy link

welcome bot commented Mar 8, 2024

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants