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: deploy shopping example as a Kubernetes cluster #268

Open
wants to merge 7 commits into
base: master
from

Conversation

@raymondfeng
Copy link
Member

raymondfeng commented Sep 9, 2019

This PR represents an experiment to decompose the shopping app into multiple microservices, each of which is packaged as a docker image. It's possible to communicate between microservices usign REST and/or gRPC.

A helm chart is added as kubernetes/shopping-app so that we can use helm to install the application. Please note it depends on mongodb and redis charts.

See https://github.com/strongloop/loopback4-example-shopping/blob/microservices/kubernetes/create-k8s.sh for instructions to get the application up and running with minikube.

diagram

@raymondfeng raymondfeng force-pushed the microservices branch 2 times, most recently from 37a07b6 to f26b4c9 Sep 9, 2019
@bajtos

This comment has been minimized.

Copy link
Member

bajtos commented Sep 10, 2019

Great initiative, @raymondfeng.

It's possible to communicate between microservices usign REST and/or gRPC.

IIUC, the recommender microservice is providing gRPC server only, but the Shopping application is making requests over REST, letting the Kubernetes runtime/sidecars bridge the protocols. Could you please confirm?

@emonddr

This comment has been minimized.

Copy link
Contributor

emonddr commented Sep 10, 2019

Very cool, you are using minikube.

@raymondfeng

This comment has been minimized.

Copy link
Member Author

raymondfeng commented Sep 10, 2019

IIUC, the recommender microservice is providing gRPC server only, but the Shopping application is making requests over REST, letting the Kubernetes runtime/sidecars bridge the protocols. Could you please confirm?

At this point, we expose both REST and gRPC endpoints from the recommender. gRPC does allow extensions to add http mappings. And there are some gateways to support REST requests:

@raymondfeng raymondfeng force-pushed the microservices branch 3 times, most recently from dfbd7fb to 2beefe9 Sep 10, 2019
@raymondfeng raymondfeng force-pushed the microservices branch 2 times, most recently from 0cb5eab to 72cfda7 Sep 18, 2019
@raymondfeng raymondfeng marked this pull request as ready for review Sep 20, 2019
@raymondfeng raymondfeng requested review from emonddr and jannyHou as code owners Sep 20, 2019
@raymondfeng raymondfeng force-pushed the microservices branch 8 times, most recently from c518ae8 to 2562cb0 Sep 24, 2019
@raymondfeng raymondfeng force-pushed the microservices branch 7 times, most recently from 3cd4d46 to f39b49f Sep 26, 2019
@raymondfeng raymondfeng force-pushed the microservices branch from 578cc97 to bedeb5a Oct 15, 2019
kubernetes/docs/deploy-to-ibmcloud.md Outdated Show resolved Hide resolved

## Connect to IBM Cloud with CLI

If this is your first time connecting to an IBM Cloud cluster, see the

This comment has been minimized.

Copy link
@emonddr

emonddr Oct 15, 2019

Contributor

I find this documentation may be overwhelming to the user.
I personally go to the Access tab of my cluster, and there is a small set of instructions.

The first command updated/installed all the CLIs I need:

image

This comment has been minimized.

Copy link
@emonddr

emonddr Oct 15, 2019

Contributor

output:

[install_ibmcloud] Running 'ibmcloud --version'...
ibmcloud version 0.14.0+3303164-2019-02-07T02:13:34+00:00
[install_plugins] Installing/updating IBM Cloud CLI plugins...
[install_plugins] Checking status of plugin: cloud-functions
[install_plugins] Installing plugin 'cloud-functions'
Looking up 'cloud-functions' from repository 'IBM Cloud'...
Plug-in 'cloud-functions 1.0.35' found in repository 'IBM Cloud'
Attempting to download the binary file...
 13.01 MiB / 13.01 MiB [==================================================================================================] 100.00% 2s
13643792 bytes downloaded
Installing binary...
OK
Plug-in 'cloud-functions 1.0.35' was successfully installed into /Users/dremond/.bluemix/plugins/cloud-functions. Use 'ibmcloud plugin show cloud-functions' to show its details.
[install_plugins] Checking status of plugin: cloud-object-storage
[install_plugins] Installing plugin 'cloud-object-storage'
Looking up 'cloud-object-storage' from repository 'IBM Cloud'...
Plug-in 'cloud-object-storage 1.1.0' found in repository 'IBM Cloud'
Attempting to download the binary file...
 13.64 MiB / 13.64 MiB [==================================================================================================] 100.00% 2s
14300144 bytes downloaded
Installing binary...
OK
Plug-in 'cloud-object-storage 1.1.0' was successfully installed into /Users/dremond/.bluemix/plugins/cloud-object-storage. Use 'ibmcloud plugin show cloud-object-storage' to show its details.
[install_plugins] Checking status of plugin: container-registry
[install_plugins] Updating plugin 'container-registry' from version '0.1.368   Update Available'
Plug-in 'container-registry 0.1.368' was installed.
Checking upgrades for plug-in 'container-registry' from repository 'IBM Cloud'...
Update 'container-registry 0.1.368' to 'container-registry 0.1.431'
Attempting to download the binary file...
 26.78 MiB / 26.78 MiB [==================================================================================================] 100.00% 3s
28083352 bytes downloaded
Updating binary...
OK
The plug-in was successfully upgraded.
[install_plugins] Checking status of plugin: container-service
[install_plugins] Installing plugin 'container-service'
Looking up 'container-service' from repository 'IBM Cloud'...
Plug-in 'container-service/kubernetes-service 0.4.3' found in repository 'IBM Cloud'
Attempting to download the binary file...
 26.83 MiB / 26.83 MiB [==================================================================================================] 100.00% 3s
28133508 bytes downloaded
Installing binary...
OK
Plug-in 'container-service 0.4.3' was successfully installed into /Users/dremond/.bluemix/plugins/container-service. Use 'ibmcloud plugin show container-service' to show its details.
[install_plugins] Checking status of plugin: dev
[install_plugins] Updating plugin 'dev' from version '2.1.15    Update Available'
Plug-in 'dev 2.1.15' was installed.
Checking upgrades for plug-in 'dev' from repository 'IBM Cloud'...
Update 'dev 2.1.15' to 'dev 2.4.0'
Attempting to download the binary file...
 18.38 MiB / 18.38 MiB [==================================================================================================] 100.00% 2s
19277096 bytes downloaded
Updating binary...
OK
The plug-in was successfully upgraded.
[install_plugins] Running 'ibmcloud plugin list'...
Listing installed plug-ins...

Plugin Name                            Version   Status   
container-registry                     0.1.431      
container-service/kubernetes-service   0.4.3        
dev                                    2.4.0        
icp                                    2.1.343      
sdk-gen                                0.1.12       
cloud-functions/wsk/functions/fn       1.0.35       
cloud-object-storage                   1.1.0        

[install_plugins] Finished installing/updating plugins
[env_setup] WARN: Please restart your shell to enable 'ic' alias for ibmcloud!
[install] Install finished.
[main] --==[ Total time: 39 seconds ]==-- 

https://cloud.ibm.com/kubernetes/registry/main/start

## Upload images to IBM Cloud container registry

This comment has been minimized.

Copy link
@emonddr

emonddr Oct 15, 2019

Contributor

mention the pattern of the urls you are entering:

docker tag shopping us.icr.io/<my_namespace>/<my_repository>:<my_tag>

where is raymondfeng
<my_repository> is loopback4-example-shopping
<my_tag> is 1.0.0

and

docker tag recommender us.icr.io/<my_namespace>/<my_repository>:<my_tag>

where is raymondfeng
<my_repository> is loopback4-example-recommender
<my_tag> is 1.0.0

kubernetes/docs/deploy-to-ibmcloud.md Show resolved Hide resolved
## Upload images to IBM Cloud container registry

```sh
ibmcloud cr login

This comment has been minimized.

Copy link
@emonddr

emonddr Oct 15, 2019

Contributor

Probably best to indicate this is to log into the container registry VS logging into the IBM account

      ibmcloud login -a cloud.ibm.com -r us-south -g default
        
        is required, but so is 

       ibmcloud cr login 
    The latter is to log into container registry. 
@raymondfeng raymondfeng force-pushed the microservices branch 2 times, most recently from 4242b5c to 8fa3386 Oct 15, 2019
```sh
ibmcloud cr login
docker tag loopback4-example-shopping:1.0.0 us.icr.io/raymondfeng/loopback4-example-shopping:1.0.0

This comment has been minimized.

Copy link
@emonddr

emonddr Oct 15, 2019

Contributor

These are working now. Great!

kubernetes/docs/deploy-to-ibmcloud.md Show resolved Hide resolved
kubernetes/docs/deploy-to-ibmcloud.md Show resolved Hide resolved
kubernetes/docs/try-with-minikube.md Show resolved Hide resolved
@raymondfeng raymondfeng force-pushed the microservices branch 4 times, most recently from ab51a39 to 17c7444 Oct 15, 2019
kubernetes/docs/deploy-to-ibmcloud.md Outdated Show resolved Hide resolved
kubernetes/docs/deploy-to-ibmcloud.md Outdated Show resolved Hide resolved
kubernetes/docs/deploy-to-ibmcloud.md Outdated Show resolved Hide resolved
@raymondfeng raymondfeng force-pushed the microservices branch 9 times, most recently from 96a0c90 to b21e938 Oct 16, 2019
raymondfeng added 2 commits Aug 30, 2019
- improve recommendation service with rest and grpc
- fix user recommendation tests
- add support to invoke recommender using gRPC

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
@raymondfeng raymondfeng force-pushed the microservices branch 2 times, most recently from 0d7bbfe to 74812d5 Oct 23, 2019
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
raymondfeng added 4 commits Sep 2, 2019
- make datasources aware of kubernetes deployment
- detect k8s and use environment variables to set up datasources
- enable lifecycle support for datasources

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
@raymondfeng raymondfeng force-pushed the microservices branch from 74812d5 to 390b67a Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.