-
Notifications
You must be signed in to change notification settings - Fork 185
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
dynamic port assignment while creating user session #736
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Anurav Modak <[email protected]>
Thanks for opening this, I am also facing issue on this hardcoded 8181, OCI team, what do we need to do on pushing this change? |
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.
LGTM
src/oci_cli/cli_setup_bootstrap.py
Outdated
# try to set up http server so we can fail early if the required port is in use | ||
try: | ||
# Firstly, we will check if PORT is available or not | ||
BOOTSTRAP_SERVICE_PORT=is_port_available(BOOTSTRAP_SERVICE_PORT) |
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.
Convention requires constants to be referenced in uppercase and immutable, so I would suggest creating DEFAULT_BOOTSTRAP_SERVICE_PORT
as 8181
(at the top of the file) and then setting boot_strap_service_port
here in lowercase, as it's a variable, not a constant.
Also, shouldn't this be calling find_port
instead of is_port_available
?
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.
yes, it should be calling find_port, just saw that typo.
The other option is to add a command-line parameter with associated environment variable that allows the end user the ability to specific which port to use. Which is better from a security perspective, becuase having a dynamic port wouldn't work with restrictive firewalls. |
Signed-off-by: Anurav Modak <[email protected]>
Signed-off-by: Anurav Modak <[email protected]>
Signed-off-by: Anurav Modak <[email protected]>
Signed-off-by: Anurav Modak <[email protected]>
I'm going to shift this PR to draft. When you're ready for us to review again, you can switch it back. |
btw, this is how I approached implementing this improvement: https://github.com/Djelibeybi/oci-cli/tree/gh-732 I'm still waiting to hear from some internal teams as changing this port cannot be done only the client side. We need server-side support as well. |
yes, i have gone through your changes, and after seeing your implementation, now even i am doubtful whether we can add this implementation from frontend alone, anyways if u find anyone from server side, you can always ping me up on slack at @anumodak. |
A variation on my version is currently being tested internally and should hopefully be released soon. I don't have an ETA for release yet, though. |
Towards #732.
Description:
In this pull request, I've reviewed the code for creating a user session, specifically focusing on
src\oci_cli\cli_setup_bootstrap.py.
The current implementation statically assigns a port, which is hard-coded. This limitation can pose challenges for users who need to ensure port availability manually, interrupting the workflow and installation process.Proposed Changes:
I propose enhancing the code by introducing a dynamic port assignment approach. The current implementation restricts users to the default port (8181), and the proposed changes aim to provide flexibility by dynamically selecting an available port. This improvement ensures a smoother user experience during the user session creation process.
Open Discussion:
As this is my initial review of the code, I welcome contributions and insights from fellow collaborators to ensure the proposed changes align with the project's goals and requirements.
@harshkumar-dev , @HamadaGabrIbrahim, @mross22, @vish1, @kernleee , @karthik-k-kamath