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

nx run-many only serves the first 3 specified projects #2088

Closed
4 tasks done
timoklingenhoefer opened this issue Nov 21, 2019 · 9 comments
Closed
4 tasks done

nx run-many only serves the first 3 specified projects #2088

timoklingenhoefer opened this issue Nov 21, 2019 · 9 comments
Labels

Comments

@timoklingenhoefer
Copy link

timoklingenhoefer commented Nov 21, 2019

  • I am running the latest version "@nrwl/workspace": "^8.8.0"
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

all specified projects get served, when running nx run-many --target=serve --projects=<more than 3 projects> --parallel

Current Behavior

only the first 3 projects get served

Failure Information (for bugs)

console outputs:

nx run-many --target=serve --projects=one,two,three,four --parallel

NX  Running target serve for projects:

  - one
  - two
  - three
  - four
nx-min@0.0.0 nx <path-to-project>\nx-min
nx "run" "two:serve"

nx-min@0.0.0 nx <path-to-project>\nx-min
nx "run" "three:serve"

nx-min@0.0.0 nx <path-to-project>\nx-min
nx "run" "one:serve"

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. npx create-nx-workspace@latest nx-min
  2. cd nx-min
  3. nx g @nrwl/nest:application one
  4. nx g @nrwl/nest:application two
  5. nx g @nrwl/nest:application three
  6. nx g @nrwl/nest:application four
  7. change ports so that all four have unique ports
  8. nx run-many --target=serve --projects=one,two,three,four --parallel

Context

Please provide any relevant information about your setup:

  • nx report :
  @nrwl/angular : Not Found
  @nrwl/cli : 8.8.0
  @nrwl/cypress : Not Found
  @nrwl/eslint-plugin-nx : 8.8.0
  @nrwl/express : Not Found
  @nrwl/jest : 8.8.0
  @nrwl/linter : 8.8.0
  @nrwl/nest : 8.8.0
  @nrwl/next : Not Found
  @nrwl/node : 8.8.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 8.8.0
  @nrwl/web : Not Found
  @nrwl/workspace : 8.8.0
  typescript : 3.5.3
@AdamVig
Copy link
Contributor

AdamVig commented Nov 22, 2019

You should be able to work around this by setting the --maxParallel flag to a high number, for example:

nx run-many --target=serve --projects=one,two,three,four --parallel --maxParallel=100

The default value for --maxParallel is three, meaning that it runs tasks in batches of three by default. Since the "serve" target never exits, the run-many command never made it to the second batch of tasks.

To avoid further confusion about this situation, there could be a warning logged when the "serve" target is used with the run-many command.

@mbriggs
Copy link
Contributor

mbriggs commented Nov 22, 2019

This is actually a use-case for run-many we didn't consider :) @AdamVig a warning is a good idea, probably not something we are going to do right now, but we would likely accept a PR for it

@mbriggs mbriggs closed this as completed Nov 22, 2019
@timoklingenhoefer
Copy link
Author

@AdamVig thanks for the tip
my use-case is running multiple nest services. And I didn`t like the method I used before (here) and when i saw the addition of run-many I had to try it

@henriqueweiand
Copy link

I'm using nx in a kind of microfront ends and I also want to run several at the same time on the same port, but with different paths ... how would it be possible to do that? do these solutions work or should i go for the idea of a proxy?

@mkashifsnyder
Copy link

Just have a quick question how we can serve multiple applications with port as well...
For example previously we were doing like that
ng serve appname --port=5200
ng serve appname2 --port=5201

Can we do that with nx run-many based on following example apps
AngularApp1
AngularApp2
NestApp1
NestApp2

then the command should be like that
nx run-many --target=serve --projects=AngularApp1,AngularApp2,NestApp1,NestApp2 --port=5200,5201 --parallel --maxParallel=4

notice i have provided port numbers for only angular applications and for the nest we can control that from environment files

@gingerwilliams
Copy link

Just have a quick question how we can serve multiple applications with port as well...
For example previously we were doing like that
ng serve appname --port=5200
ng serve appname2 --port=5201

Can we do that with nx run-many based on following example apps
AngularApp1
AngularApp2
NestApp1
NestApp2

then the command should be like that
nx run-many --target=serve --projects=AngularApp1,AngularApp2,NestApp1,NestApp2 --port=5200,5201 --parallel --maxParallel=4

notice i have provided port numbers for only angular applications and for the nest we can control that from environment files

add the port for each app in its respective serve option in workspace.json

@Bulletninja
Copy link

Bulletninja commented Jul 6, 2021

Just have a quick question how we can serve multiple applications with port as well...
For example previously we were doing like that
ng serve appname --port=5200
ng serve appname2 --port=5201
Can we do that with nx run-many based on following example apps
AngularApp1
AngularApp2
NestApp1
NestApp2
then the command should be like that
nx run-many --target=serve --projects=AngularApp1,AngularApp2,NestApp1,NestApp2 --port=5200,5201 --parallel --maxParallel=4
notice i have provided port numbers for only angular applications and for the nest we can control that from environment files

add the port for each app in its respective serve option in workspace.json

Could you provide an example or link? Unsure how to pass that param to "serve": {

EDIT:
Found this example

#1248 (comment)

@StallionV
Copy link

I'm using nx in a kind of microfront ends and I also want to run several at the same time on the same port, but with different paths ... how would it be possible to do that? do these solutions work or should I go for the idea of a proxy?
@henriqueweiand or anyone else do you have an answer to this question?

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants