-
Notifications
You must be signed in to change notification settings - Fork 126
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
Add grpc samples #65
Add grpc samples #65
Conversation
c22aa20
to
adfab6d
Compare
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.
Hi @qu1queee , thank you for putting together this sample! Looking forward to get it in finally. I do have a few comments mainly related to the run script, which I would like to discuss with you.
Next, I suggest that we plan a pairing session.
Best regards, Rico
grpc/run.sh
Outdated
@@ -0,0 +1,31 @@ | |||
#!/bin/bash | |||
|
|||
set -euo pipefail |
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 order to allow it being executed as part of test automation and to prevent users from having components being installed that incur costs, without the users understanding the full impact of them running the script, we'll need to add a cleanup routine to this script. See https://github.com/IBM/CodeEngine/blob/main/function2job/run for an example.
fmt.Printf("using local endpoint: %s\n", localEndpoint) | ||
conn, err := grpc.Dial(localEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) | ||
if err != nil { | ||
log.Fatalf("failed to connect: %v", err) |
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.
Shouldn't we and stop the app initialization at this point?
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.
log.Fatalf comes with an os.Exit(1)
Check the source code if you want to understand how this works. In general, | ||
we provided three directories: | ||
|
||
- `/ecommerce` directory hosts the protobuf files and declares the `grocery` |
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.
Is there every a need to regenerate this directory (e.g. after user made some adjustments to play around)? If so, I suggest to add the command to re-generate the files.
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.
done. Added a new script call `./regenerate-grpc-code.sh
grpc/run.sh
Outdated
|
||
# Buy an item from electronics and pay with 2000 | ||
echo "[INFO] Going to buy an iphone" | ||
curl -q "${URL}"/buygrocery/electronics/iphone/2000.0 |
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 suggest to add a command that checks whether the buy operation actually succeeded. If it doesn't we should end the script with exit code non-zero
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.
covered
5e6b323
to
5a0cc98
Compare
@reggeenr thanks for the review. I addressed all your comments. In addition, I added the following:
|
5a0cc98
to
8477d6e
Compare
Introduce grpc directory, containing a microservice architecture consisting of an internal grpc server, and a public client/server app. A run.sh script is provided, to easily deploy this architecture in Code Engine, as well as a README, explaining the ideas behind. Signed-off-by: Mahesh Kumawat <[email protected]> Signed-off-by: encalada <[email protected]> Signed-off-by: Mahesh Kumawat <[email protected]>
Addressing all good feedback, to inline with other CE samples. Signed-off-by: encalada <[email protected]>
5466c75
to
bd6d33c
Compare
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.
LGTM - Great job, @qu1queee ! Appreciate the work you put in to finish this sample.
bd6d33c
to
99de465
Compare
- Add architecture diagram to readme - Refactor proto interface, to inline fields - Add build script - Recompile proto files Signed-off-by: encalada <[email protected]>
99de465
to
0333a3f
Compare
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.
Great job. LGTM!!!
Introduce grpc directory, containing a microservice architecture consisting of an internal grpc server, and a public client/server app.
A run.sh script is provided, to easily deploy this architecture in Code Engine, as well as a README, explaining the ideas behind.