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

dynamic port assignment while creating user session #736

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AnuravModak
Copy link
Member

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

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 11, 2023
@keithshum
Copy link

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?

Copy link

@keithshum keithshum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# 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)
Copy link
Member

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?

Copy link
Member Author

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.

@Djelibeybi
Copy link
Member

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]>
@Djelibeybi
Copy link
Member

I'm going to shift this PR to draft. When you're ready for us to review again, you can switch it back.

@Djelibeybi Djelibeybi marked this pull request as draft February 12, 2024 05:31
@Djelibeybi
Copy link
Member

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.

@AnuravModak
Copy link
Member Author

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.

@Djelibeybi
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants