-
Notifications
You must be signed in to change notification settings - Fork 23
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
ENDOC-628 generate MS and MFE Tutorial edit commands #652
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,31 +100,113 @@ You have now generated a Spring Boot microservice with database integration and | |
* ```/src/main/docker``` contains Docker files to help with local development environments. | ||
|
||
## Configure the Components | ||
1. From the root directory of the project, edit the `entando.json` and update `microservices/conference-ms` to set the `healthCheckPath` and `dbms`: | ||
1. From the root directory of the project, edit the `entando.json` file and update `microservices/conference-ms` to set the `healthCheckPath` and `dbms`: | ||
```json | ||
"healthCheckPath":"/management/health", | ||
"dbms":"postgresql" | ||
``` | ||
|
||
2. Move the generated `conference-table` MFE into the microfrontends directory in the bundle project. If you chose a different entity name, you'll need to adjust these commands accordingly. | ||
2. Move the generated `conference-table` MFE into the `microfrontends` directory in the bundle project. If you chose a different entity name, you'll need to adjust these commands accordingly. | ||
```shell | ||
ent bundle mfe add conference-table | ||
mv microservices/conference-ms/ui/widgets/conference/tableWidget microfrontends/ && mv microfrontends/tableWidget microfrontends/conference-table | ||
mv microservices/conference-ms/ui/widgets/conference/tableWidget/{.,}* microfrontends/conference-table | ||
``` | ||
>Note: In some shells (e.g. zsh), you may receive an "invalid argument" warning that can be ignored as long as the folders are relocated correctly. | ||
|
||
3. Now add an API claim to connect the `conference-table` MFE to the `conference-ms` microservice. The connection information is stored in `entando.json`. | ||
```shell | ||
ent bundle api add conference-table conference-api --serviceName=conference-ms --serviceUrl=http://localhost:8081 | ||
``` | ||
|
||
4. Repeat the previous steps for the `conference-details` and `conference-form` MFEs: | ||
```shell | ||
ent bundle mfe add conference-details | ||
ent bundle mfe add conference-form | ||
mv microservices/conference-ms/ui/widgets/conference/detailsWidget microfrontends/ && mv microfrontends/detailsWidget microfrontends/conference-details | ||
mv microservices/conference-ms/ui/widgets/conference/formWidget microfrontends/ && mv microfrontends/formWidget microfrontends/conference-form | ||
|
||
a. Add the MFEs: | ||
```shell | ||
ent bundle mfe add conference-details | ||
ent bundle mfe add conference-form | ||
``` | ||
b. Relocate the folders: | ||
```shell | ||
mv microservices/conference-ms/ui/widgets/conference/detailsWidget/{.,}* microfrontends/conference-details | ||
mv microservices/conference-ms/ui/widgets/conference/formWidget/{.,}* microfrontends/conference-form | ||
``` | ||
c. Add the API claims: | ||
```shell | ||
ent bundle api add conference-details conference-api --serviceName=conference-ms --serviceUrl=http://localhost:8081 | ||
ent bundle api add conference-form conference-api --serviceName=conference-ms --serviceUrl=http://localhost:8081 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a/b/c here don't end with : but the other instructions do |
||
``` | ||
5. For local development and testing, a custom command is needed in the `entando.json` to use a different port for each MFE as shown below: | ||
``` | ||
"microfrontends": [ | ||
{ | ||
"name": "conference-table", | ||
"customElement": "conference-table", | ||
"stack": "react", | ||
"type": "widget", | ||
"group": "free", | ||
"publicFolder": "public", | ||
"titles": { | ||
"en": "conference-table", | ||
"it": "conference-table" | ||
}, | ||
"commands": { | ||
"run": "npm install && PORT=3000 npm start" | ||
}, | ||
"apiClaims": [ | ||
{ | ||
"name": "conference-api", | ||
"type": "internal", | ||
"serviceName": "conference-ms" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "conference-details", | ||
"customElement": "conference-details", | ||
"stack": "react", | ||
"type": "widget", | ||
"group": "free", | ||
"publicFolder": "public", | ||
"titles": { | ||
"en": "conference-details", | ||
"it": "conference-details" | ||
}, | ||
"commands": { | ||
"run": "npm install && PORT=3001 npm start" | ||
}, | ||
"apiClaims": [ | ||
{ | ||
"name": "conference-api", | ||
"type": "internal", | ||
"serviceName": "conference-ms" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "conference-form", | ||
"customElement": "conference-form", | ||
"stack": "react", | ||
"type": "widget", | ||
"group": "free", | ||
"publicFolder": "public", | ||
"titles": { | ||
"en": "conference-form", | ||
"it": "conference-form" | ||
}, | ||
"commands": { | ||
"run": "npm install && PORT=3002 npm start" | ||
}, | ||
"apiClaims": [ | ||
{ | ||
"name": "conference-api", | ||
"type": "internal", | ||
"serviceName": "conference-ms" | ||
} | ||
] | ||
} | ||
], | ||
``` | ||
|
||
5. Finally, move the Blueprint-provided auxiliary service definitions into the `svc` directory in the bundle project and enable the `keycloak` service for local tests: | ||
6. Finally, move the Blueprint-provided auxiliary service definitions into the `svc` directory in the bundle project and enable the `keycloak` service for local testing: | ||
```shell | ||
mv microservices/conference-ms/src/main/docker/* svc/ | ||
ent bundle svc enable keycloak | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
i think this is less clarified... prefer nathan's tweak to your original wording: In local development, the run command can be used to modify the port for a microservice, but in production microservices must run on port 8081.
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.
I wanted to include cases where there are multiple microservices because that's when this applies, not when there is just one
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.
In local development, the run command can be used to modify the port number so that multiple microservices can run in parallel on separate ports, but in production microservices must run on port 8081