Skip to content

GoogleCloudPlatform/terraform-ecommerce-microservices-on-gke

Ecommerce web app deployed on Kubernetes

This GitHub repository contains the Terraform and Kubernetes YAML used by the Jump Start Solution (JSS) entitled Ecommerce web app deployed on Kubernetes, available on Google Cloud.

The Deploy this solution section below contains a brief summary of how you can deploy this solution to your Google Cloud project. For more detailed instructions including troubleshooting guidance, see the solution guide.

What's deployed?

The following is a description of what's deployed by this solution:

  1. Cymbal Shops: This solution deploys a demo application called Cymbal Shops (also known as Online Boutique). Cymbal Shops consists of about 10 microservices. The source code of each microservice is available in a separate, open source GitHub repository.
  2. 3 Google Kubernetes Engine (GKE) clusters: This solution provisions a total of 3 GKE cluster — 2 clusters in the US, and 1 cluster in Europe. One of the US clusters will be used for configuring multi-cluster ingress, while the other 2 clusters will host the microservices of the Cymbal Shops application (including the frontend microservice).
  3. Static external IP address: The Cymbal Shops application will be pubicly acessible via an IP address, reserved and output (into your command line interface) by the Terraform. The IP address may take about 5 minutes to actually serve the frontend since multi-cluster ingress takes a few minutes to warm up.
  4. Single Redis cart database: The items in users' carts are managed in a single Redis databases, only deployed to a US cluster — for data consistency.

Architectural diagram showing the Cymbal Shops application's microservices deployed into 2 GKE clusters — one in the US, and one in Europe. A third cluster in the US contains Kubernetes resources for MultiClusterIngress and MultiClusterService.

To learn more about the deployed infrastructure, read the solution guide on cloud.google.com.

Deploy this solution

The best way to deploy this solution is through the Jump Start Solutions page on Google Cloud Console. But if you specifically want to deploy the Terraform inside this git branch or commit, follow the instructions below.

Prerequisites

  • A terminal environment with the following CLI tools available:
    • terraform
    • gcloud
  • A Google Cloud project that is not currently using a Multi Cluster Ingress.

Steps

1. Clone this git repository.

git clone https://github.com/GoogleCloudPlatform/terraform-ecommerce-microservices-on-gke

2. Go into the infra/ folder.

cd terraform-ecommerce-microservices-on-gke/infra

The infra/ directory contains all the Terraform code for this solution.

3. Run the Terraform.

terraform init
terraform apply -var 'project_id=MY_PROJECT_ID'

Replace MY_PROJECT_ID with your Google Cloud Project ID. We recommend creating a new project so you can easily clean up all resources by deleting the entire project.

You may need to type "Yes", after you run terraform apply.

4. Report any bugs as a GitHub Issue.

a. Search the existing list of GitHub issues.

b. If there isn't already a GitHub issue for your bug, create a new GitHub issue.

5. Get the IP address of the deployment.

Get the external IP address where Cymbal Shops will be accessible about 5 minutes after terraform apply successfully completes:

gcloud compute addresses list \
    --filter="name=('multi-cluster-ingress-ip-address-1')" \
    --project=MY_PROJECT_ID

Replace MY_PROJECT_ID with your Google Cloud Project ID.

Inputs

Name Description Type Default Required
labels A set of key/value label pairs to assign to the resources deployed by this blueprint. map(string) {} no
project_id The Google Cloud project ID. string n/a yes
resource_name_suffix Optional string added to the end of resource names, allowing project reuse.
This should be short and only contain dashes, lowercase letters, and digits.
It shoud not end with a dash.
string "-1" no

Outputs

Name Description
deployment_ip_address Public IP address of the deployment
neos_toc_url Neos Tutorial URL

Contributing

If you would like to contribute to this repository, read CONTRIBUTING.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See Code of Conduct for more information.

License

Apache 2.0 - See LICENSE for more information.