Note: This is fork from the GoogleCloudPlatform/microservices-demo repository and additional changes are included in order to deploy the application on Choreo.
You will create the services that the web application needs to consume. Before you proceed, sign into Choreo Console.
Let's create your first Service.
-
On the Home page, click on the project you created.
-
Click Create in the Service card.
-
Enter a unique name and a description for the Service. For example, you can enter the name and the description given below:
Field Value Name Email Service Description Send Emails. -
Click Next.
-
To allow Choreo to connect to your GitHub account, click Authorize with GitHub.
-
If you have not already connected your GitHub repository to Choreo, enter your GitHub credentials, and select the repository you created by forking https://github.com/wso2/microservices-demo to install the Choreo GitHub App.
-
In the Connect Repository dialog box, enter the following information:
Field Value GitHub Account Your account GitHub Repository microservices-demo Branch main Build Preset Click Dockerfile Dockerfile Path /src/emailservice/Dockerfile Docker Context Path /src/emailservice -
Click Create to initialize a Service with the implementation from your GitHub repository.
-
The Service opens on a separate page where you can see deploy details.
-
Click Deploy Manually on the Build Area to deploy the service.
-
Navigate to the Overview area after the service has been successfully deployed. The internal endpoint of the service is something like https://email-service-3192360657:8080/. Make a note of the endpoint value for future reference.
-
Follow the steps in step 1.1 and create the services with the following information.
Service Name Dockerfile Path Docker Context Path Currency Service /src/currencyservice/Dockerfile /src/currencyservice Product Catalog Service /src/productcatalogservice/Dockerfile /src/productcatalogservice Shipping Service /src/shippingservice/Dockerfile /src/shippingservice Ad Service /src/adservice/Dockerfile /src/adservice Payment Service /src/paymentservice/Dockerfile /src/paymentservice Cart Service /src/cartservice/src/Dockerfile /src/cartservice/src Recommendation Service /src/recommendationservice/Dockerfile /src/recommendationservice Checkout Service /src/checkoutservice/Dockerfile /src/checkoutservice -
The below services are having environment variables. Follow the below steps to add environment variables.
-
Navigate to Configs & Secrets section on the left navigation menu in the Deploy section.
-
Click Create.
-
Select config type as ConfigMap and mount type as Environment Variables. Then click Next.
-
Provide the following information and click Create. Use the host and port of the internal endpoints of the services as environment variables. eg: If the internal endpoint is https://email-service-3192360657:8080/, then environment variable value should be email-service-3192360657:8080.
-
Recommendation Service
Environment Variable Name Environment Variable Value PRODUCT_CATALOG_SERVICE_ADDR Product catalog service endpoint. eg: product-catalog-service-3192360657:3550 -
Checkout Service
Environment Variable Name Environment Variable Value PRODUCT_CATALOG_SERVICE_ADDR Product catalog service endpoint. eg: product-catalog-service-3192360657:3550 SHIPPING_SERVICE_ADDR Shipping service endpoint. eg: shipping-service-3192360657:3550 PAYMENT_SERVICE_ADDR Payment service endpoint. eg: payment-service-3192360657:50051 EMAIL_SERVICE_ADDR Email service endpoint. eg: email-service-3192360657:8080 CURRENCY_SERVICE_ADDR Currency service endpoint. eg: currency-service-3192360657:7000 CART_SERVICE_ADDR Cart service endpoint. eg: cart-service-3192360657:7070
-
- After adding environment variables, you can click Deploy Manually on the Build Area to deploy the services.
-
Navigate to Choreo Console.
-
Navigate to the Components section from the left navigation menu.
-
Click on the Create button.
-
Click on the Create button in the Web Application Card.
-
Enter a unique name and a description for the Web Application. For example you can provide the following sample values.
Field Value Name Front-end Web App Description Front-end application -
Click on the Next button.
-
To allow Choreo to connect to your GitHub account, click Authorize with GitHub.
-
In the Connect Repository dialog box, enter the following information:
Field Value GitHub Account Your account GitHub Repository microservices-demo Branch main Dockerfile Path /src/frontend/Dockerfile Docker Context Path /src/frontend Port 8080 -
Click on the Create button.
-
The Web Application opens on a separate page where you can see its overview.
-
Navigate to Configs & Secrets section on the left navigation menu in the Deploy section.
-
Click Create.
-
Select config type as ConfigMap and mount type as Environment Variables. Then click Next.
-
Provide the following information and click Create.
Environment Variable Name Environment Variable Value PRODUCT_CATALOG_SERVICE_ADDR Product catalog service endpoint. eg: product-catalog-service-3192360657:3550 SHIPPING_SERVICE_ADDR Shipping service endpoint. eg: shipping-service-3192360657:3550 CURRENCY_SERVICE_ADDR Currency service endpoint. eg: currency-service-3192360657:7000 CART_SERVICE_ADDR Cart service endpoint. eg: cart-service-3192360657:7070 RECOMMENDATION_SERVICE_ADDR Recommendation service endpoint. eg: recommendationservice-3192360657:8080 CHECKOUT_SERVICE_ADDR Checkout service endpoint. eg: checkoutservice-3192360657:5050 AD_SERVICE_ADDR Ad service endpoint. eg: adservice-3192360657:9555
- Navigate to Build and Deploy section on the left navigation menu.
- Click Deploy Manually on the Build Area.
- When the application is deployed successfully you will get an url in the section Web App URL.
You can use the Web App URL to access the Online Boutique application.
Home Page | Checkout Screen |
---|---|