Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Application port management #5185

Closed
andrevenancio opened this issue Jun 2, 2023 · 3 comments
Closed

Application port management #5185

andrevenancio opened this issue Jun 2, 2023 · 3 comments
Labels
linear: turbo Issues to sync to Linear for Turborepo team RFC: Open

Comments

@andrevenancio
Copy link

andrevenancio commented Jun 2, 2023

Which project is this feature idea for?

Turborepo

Describe the feature you'd like to request

Hi team. Turborepo is great, but there are some areas we could improve on.
One of the areas is how ports are attributed to nextjs repos inside the apps folder. I'm working on a monorepo with several applications (production and some prototypes) and its quite hard to find which port should I connect to because it changes every time I stop my dev process for whatever reason. I know we can hard code the ports on apps/my_app/package.json but I wonder if instead of assigning the ports randomly based on which process started first, they could be assigned alphabetically based of the apps folder. This way if you are working on localhost:3009 and you need to stop turbo dev to run some dependency install and then run turbo dev again at least your app is still on the same port and you dont have to go and try port 3000, 3001, 3002, etc until you find your app.

I understand that this might not be a out of the box feature, but it can be frustrating in a large monorepo with multiple applications always having to guess where your app is.

Describe the solution you'd like

I would like to call yarn dev --ports-sequence or someething to indicate to turborepo that each app needs to start in a sequence (alphabetical) and not cuncurrently.

Describe alternatives you've considered

I can manually go and assign a port to each application package.json but in my particular repo where prototypes are constantly added, its hard to see which ports are already assigned specially.
So for example if you think of an app looking like this

apps
  prototype-feature-1
  prototype-feature-2
  prototype-feature-3
  prototype-feature-4
  website

And you have to manually set the dev process inside each package.json individually next dev --port 3000.
And even if you are careful and make your ports assigned alphabetically and you add a new prototype then the port you manually have assigned to website will be incorrect. Or if you add a new app called docs then all of them are incorrect because docs comes before prototype... alphabetically.

So you either have to:

  • constantly update the ports manually to keep it alphabetically
  • start to assign ports that might not be alphabetically but incremented as you add more apps

On an application with 1-4 apps maybe this is nor relevant, but anything bigger than that it becomes quite frustrating to have to guess which port we need to go into.

Also considered running the apps with --filter so only 1 app runs + its dependencies.

TURBO-1521

@andrevenancio andrevenancio added needs: triage New issues get this label. Remove it after triage story labels Jun 2, 2023
@corbinday
Copy link

corbinday commented Aug 23, 2023

#1273

Would it be possible to define ports for all apps in a single config file? For example in turbo.json. We have many apps in our monorepo and would like to be able to easily see what app is running under what port. Would make adding a new app and port easier as well.

+1 The ability to define ports for apps in a config file would be awesome.

@mehulkar
Copy link
Contributor

This would indeed by cool, I'll take this to the team to see if we want to enhance support for our persistent tasks!

@mehulkar mehulkar added needs: team input Filter for core team meetings owned-by: turborepo and removed needs: triage New issues get this label. Remove it after triage labels Oct 19, 2023
@mehulkar
Copy link
Contributor

mehulkar commented Oct 23, 2023

We talked about this at the team meeting today, and we think this is ultimately part of #986 when we get to it. I'll leave this open since the scope is much narrower, but I think we'll want to think through it together.

In the meantime, hardcoding the port in each package.json is the best workaround I can think of

@mehulkar mehulkar added linear: turbo Issues to sync to Linear for Turborepo team and removed needs: team input Filter for core team meetings labels Oct 23, 2023
@vercel vercel locked and limited conversation to collaborators Feb 21, 2024
@anthonyshew anthonyshew converted this issue into discussion #7462 Feb 21, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
linear: turbo Issues to sync to Linear for Turborepo team RFC: Open
Projects
None yet
Development

No branches or pull requests

4 participants