-
Notifications
You must be signed in to change notification settings - Fork 147
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
Accept an unset command
to proxy to an already started process (unmanaged process)
#339
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Hi @ryshoooo, if/when I need to start the proxied service manually I use the anonymous proxy URL, e.g. |
Hi @ryanlovett, yes it is exactly not desired :) To give you a specific example of what we're facing, we're using Z2JH with Kubernetes and we wish to provide code-server for each single-user environment. The old way we used to do this, was that we pre-installed code-server into the single-user base image and then used j-s-p the way it's supposed to be used, i.e. the command starts code-server and we open it up at some random open port. We're moving away from this solution in order to have even more micro-service architecture in place, so now we start the code-server as an additional extra container in the single-user pod during spawning. This approach has quite a few advantages, mainly that now we can do upgrades of code-server without touching the single-user base image. Anyway, the users got very much used to the fact that URL |
I think the general idea sounds good. Did you consider any other options, e.g. something like |
A little bit yes, I just decided not to go this way fully just yet :) I merely just wanted to have something quickly working without too many changes to the codebase. Which this does for me :) But I do like your suggestion and I do think it is the better solution with the If you think it's the right way, I can try and turn it into |
That's a good point! Maybe we could make the command argument optional instead of adding the new flag. If command is empty just setup the port-fowarding? |
@manics That seems reasonable to me. |
Co-authored-by: Yuvi Panda <yuvipanda@gmail.com>
Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.2. - [Release notes](https://github.com/moment/moment/releases) - [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) - [Commits](moment/moment@2.29.1...2.29.2) --- updated-dependencies: - dependency-name: moment dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
I've added the changes, removed the |
Thanks @ryshoooo ! Yes, I'm guessing we need to add |
The tests should be fixed by #340 Would you mind adding a test for this new configuration, e.g. based on jupyter-server-proxy/tests/resources/jupyter_server_config.py Lines 39 to 41 in 099fce2
jupyter-server-proxy/tests/test_proxies.py Lines 141 to 150 in 099fce2
For the backend service you can just connect to one of the existing ones, so effectively the new configuration would be an alias. |
Thanks for the guidance :) I've added an additional test for the new functionality. |
Looks like the pipeline is failing again, but the logs are a bit vague. Does anybody have any idea what's going on? |
command
to proxy to an already started process
command
to proxy to an already started processcommand
to proxy to an already started process (unmanaged process)
jupyter_server_proxy/handlers.py
Outdated
if not cmd: | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this called to late? Should self.state['proc']
be set to a new SupervisedProcess
object? The idea was that if the command is unset, it shouldn't be supervised - right?
If it is correct, a comment is needed to clarify why it is correct in my mind as this is quite unexpected for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides this, the changes looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it is now, it won't be awaited readiness either. I'll push a commit to move this logic upwards: d6fbbd8
Please ignore them. I'm not sure, but its related to jupyter_server 2 being released and that the jupyterlab extension isn't doing well with it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM as it is now. I added two commits, one updating docs and another one relocating a return statement to happen sooner rather than later when an unmanaged process is involved.
- The test failures should be unrelated, see Tests broken for jupyter_server 2 - help wanted! #362.
@ryshoooo does this look good to you as it is now?
Yes this looks totally fine to me, thanks a lot for your help! :) |
Thank you @ryshoooo! ❤️ 🎉 |
Updated PR description by Erik
jupyter-server-proxy enables users to proxy to already started processes by
{base_url}/proxy/{port}/{proxied_path}
, but for a better user experience it could be nice to just be able to use{base_url}/{proxied_path}
. This would rely on someone having configured how that should be proxied ahead of time. This PR adds support for this.By providing a server process configuration like this, omitting the previousy required
command
, jupyter-server-proxy will assume the server process isn't to be managed/started by jupyter-server-proxy, and that its already started and accepting traffic. jupyter-server-proxy won't try to await it either before proxying traffic to it.Not providing a command to a server process definition means that its an "jupyter-server-proxy unmanaged server process" that we proxy to, supposed to be started ahead of time.
Outdated PR description
This PR introduces additional parameter for the server proxy configuration, which specifies whether the port availability checking is necessary to perform or not. This is useful to disable if the application is already running (started by something else) and the user just wants to create a simple proxy for it (not start it through proxy directly).