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

feat: add custom baseport for nodes #878

Merged
merged 4 commits into from
Jun 6, 2024
Merged

Conversation

Abdulkbk
Copy link
Contributor

This commit implements the feature that lets users set custom base ports for their nodes to avoid having port conflicts with other applications running on the same machine.

Closes #533

Description

I added a settings page with input fields to set the base ports and then save. The custom base ports persist in the settings.json file and are loaded whenever polar starts. If a node, for example, LND does not have a custom port set, the defaults from constant.ts are used

Steps to Test

  1. On the top navbar, locate the Network Setting tab and click on it.
  2. The settings page appears, fill in the custom ports and click on save.
  3. Create a network and check the ports of your nodes

Screenshots

Screenshot from 2024-04-23 18-07-58

Screenshot from 2024-04-23 18-09-15

Node Alice
Screenshot from 2024-04-23 18-10-45

Node Bob
Screenshot from 2024-04-23 18-11-05

@jamaljsr
Copy link
Owner

Hey @Abdulkbk Thanks for opening the PR. It looks like you're off to a great start.

My initial feedback just from looking at your screenshots is:

  1. I think we should add some text in the Base Ports section explaining what these values are, because it isn't obvious to users what these are and why/when you should change them. I would suggest the following text.

    Base Ports determine the starting port numbers that will be used for each node. When a network is started, Polar will use these values to detect the next open port on your machine to assign to the nodes. You usually do not need to change these unless you are running into port conflicts with other apps installed on your computer. If you change these values, try to maintain at decent size gap (roughly 100) between them to prevent them from overlapping as more nodes of each implementation are added to your networks.

  2. The base port for Taproot Assets is missing
  3. We should also allow changing the base ports for GRPC as well for the nodes that support it

@Abdulkbk
Copy link
Contributor Author

Hey @Abdulkbk Thanks for opening the PR. It looks like you're off to a great start.

My initial feedback just from looking at your screenshots is:

  1. I think we should add some text in the Base Ports section explaining what these values are, because it isn't obvious to users what these are and why/when you should change them. I would suggest the following text.

    Base Ports determine the starting port numbers that will be used for each node. When a network is started, Polar will use these values to detect the next open port on your machine to assign to the nodes. You usually do not need to change these unless you are running into port conflicts with other apps installed on your computer. If you change these values, try to maintain at decent size gap (roughly 100) between them to prevent them from overlapping as more nodes of each implementation are added to your networks.

  2. The base port for Taproot Assets is missing
  3. We should also allow changing the base ports for GRPC as well for the nodes that support it

Thanks for the feedback @jamaljsr. I'll work on the suggestions in next iteration.

@Abdulkbk
Copy link
Contributor Author

Abdulkbk commented May 4, 2024

This is how it looks now @jamaljsr

Screenshot from 2024-05-04 02-41-44

Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

The UI is looking great now. I left some feedback on the code. Once those changes are made, we just need to have the unit tests updated to prevent the failures and get the coverage back up. Then this should be all set to merge.

src/shared/types.ts Outdated Show resolved Hide resolved
src/shared/types.ts Outdated Show resolved Hide resolved
src/utils/network.ts Outdated Show resolved Hide resolved
src/store/models/app.ts Outdated Show resolved Hide resolved
src/components/common/NavMenu.tsx Outdated Show resolved Hide resolved
@Abdulkbk Abdulkbk marked this pull request as ready for review May 14, 2024 16:42
@Abdulkbk
Copy link
Contributor Author

The UI is looking great now. I left some feedback on the code. Once those changes are made, we just need to have the unit tests updated to prevent the failures and get the coverage back up. Then this should be all set to merge.

@jamaljsr I added a new commit addressing the feedbacks you left.

@Abdulkbk Abdulkbk requested a review from jamaljsr June 4, 2024 10:15
Abdulkbk and others added 4 commits June 6, 2024 11:10
This commit implement the feature that let users set custom
baseport for their nodes to avoid having port conflicts with other
applications running on the same machine.
In this commit, we allow the user to set grpc base ports for nodes
that support it in addition to setting rest base ports.
In this commit, we refactor/move some types from shared folder to
the main types. We also remove store import from utils file and
modified functions that need some values from store to accept them
as parameters
Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8edfccb) to head (fc749e2).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #878   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          140       141    +1     
  Lines         4582      4609   +27     
  Branches       887       861   -26     
=========================================
+ Hits          4582      4609   +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamaljsr
Copy link
Owner

jamaljsr commented Jun 6, 2024

Hey @Abdulkbk I want to get this merged. Instead of going back and forth for longer, I just added an extra commit with some minor code formatting changes. I also rebased this on master.

Thank you for implementing this feature 🚀

@jamaljsr jamaljsr merged commit 1e31b94 into jamaljsr:master Jun 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Ability to set base ports
2 participants