Skip to main content

Google Cloud Solutions Builder

A solution framework to generate code with built-in structure and modules to accelerate your project setup.

TL;DR

Solutions Builder is a boilerplate tool for building repeatable solutions with the best practices in architecture on Google Cloud, including Cloud Run, GKE clusters, Test Automation, CI/CD, etc, with built-in modules including:

  • Terraform boilerplate modules
  • Modular microservice templates, deployable to Cloud Run or a Kubernetes cluster.
  • Generating code from templates at remote Git repo (e.g. a private Git repo)
  • Container image building and deploying with Skaffold
  • Modules and templates based on Copier.
  • CI/CD deployment templates.

Build a solution by adding modules

Solutions Builder is designed with modules and templates. When creating a new solution folder, it starts from a base template with a terraform foundation and project skeleton. Then, you can start adding modules into this solution folder.

For example, these are examples of creating a new solution:

  • Start a new solution with a base (skeleton) code from a "root template"
  • Add a Cloud Run microservice with APIs
  • Add a Load Balancer with Identity-Aware Proxy
  • Add CI/CD for deployment

alt text

Check out the Quick Start section to create a sample solution.

Prerequisite

Tool Required Version Installation
Python >= 3.11
gcloud CLI Latest https://cloud.google.com/sdk/docs/install
Terraform >= v1.3.7 https://developer.hashicorp.com/terraform/downloads
Skaffold >= v2.4.0 https://skaffold.dev/docs/install/#standalone-binary

[Optional] For deploying to a GKE cluster, please install the following:

Tool Required Version Installation
Kustomize >= v5.0.0 https://kubectl.docs.kubernetes.io/installation/kustomize/

Install all packages:

Mac:

brew install gcloud terraform skaffold

Windows:

choco install gcloud terraform skaffold

Install Solutions Builder CLI

pip install solutions-builder

Quick Start - Create a new solution

This quick start steps will create the following:

  • Create a new solution folder.
  • Create a new GCP project and initialize Terraform infrastructure.
  • Add a FastAPI-based microservice with a sample API.
  • Deploy the service to Cloud Run.

Generate a new solution in my-solution-folder folder.

sb new my-solution-folder

This will prompt options and variables:

🎤 What is your project name? (Spaces are allowed.)
   my awesome solution name
🎤 What is your Google Cloud project ID?
   my-project-id
🎤 Create GCP project 'my-project-id'? (yes/no)
   yes
🎤 Which Google Cloud region?
   us-central1
🎤 Default deploy method? (cloudrun or gke)
   Cloud Run

(...Leave the rest as default)

Once answered, it will generate the code from the template:

Copying from template
    create  .
    create  .pylintrc
    create  .copier-answers.yml
    ...

Answer questions when adding terraform_base module:

Adding module 'terraform_base'...
🎤 Use GCS Bucket for Terraform backend?
   Yes
🎤 What is your GCP billing account?
   12345-12345-12345
🎤 Use GCS Bucket for Terraform backend?
   Yes

Copying from template
 identical  .
    create  terraform
    create  terraform/stages
    ...


Complete. New solution folder created at ./my-solution-folder.

Add a Sample Cloud Run microservice using blank_service module template:

cd my-solution-folder
sb add component sample_service -t blank_service
  • Alternatively, use a template from a remote Git repo like:
     sb add component sample_service -t git@github.com:GoogleCloudPlatform/solutions-builder.git/modules/blank_service
    

And answer the following:

This will add component 'sample_service' to 'components' folder. Continue? [Y/n]:
🎤 Resource name (lower case, alphanumeric characters, '-')?
   sample-service
🎤 Which Google Cloud region?
   us-central1
🎤 Add a sample API?
   Yes
🎤 Does this component require the Common image?
   No
🎤 Default deploy method? (cloudrun or gke)
   Cloud Run

Apply all Terraform stages (in terraform/stages folder)

sb terraform apply --all --yes

The command above will run the following:

  • Init and apply all Terraform stages. (terraform init and terraform apply))
  • Build the sample_service container image and published to Artifact Registry. (using Skaffold)
  • Deploy the sample_service container to Cloud Run. (using Terraform)

Optionally, manually build and deploy sample_service using sb deploy.

sb deploy -m sample_service

Once deployed, you can test the Cloud Run instance at: https://console.cloud.google.com/run/detail/us-central1/sample-service

CLI Usage

Check out CLI_USAGE.md for more CLI usages and tutorials.

Additional Guides

  • cloudshell.md - Step-by-step guidance to run Solutions Builder on Google Cloud Shell.
  • cloudrun.md - The guidance if you want to deploy microservice to Cloud Run.
  • gke.md - The overall development guidance on Google Kubernetes Engine.

Development and contributions

  • CONTRIBUTIONS.md - How to contribute this project, code submission process.
  • DEVELOPMENT.md - Guidances on developing new templates, modules, and components.

Troubleshooting

FAQ

  • Who are the target audience/users for this Solutions Builder?

    • A: Any engineering team to start a new solution development project.
  • Can I use this template for non-Google or multi-Cloud environments?

    • A: We design this Solutions Builder to work 100% out of the box with Google Cloud products. However, you could customize the solution to meet your needs on multi-Cloud environment. See Why Google Cloud for details.

Metadata

Release files for solutions-builder 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solutions-builder 2.0.0
File Size Uploaded
solutions_builder-2.0.0.tar.gz 138.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for solutions-builder 2.0.0
File Interpreter ABI Platform
solutions_builder-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 408.0 kB

Release files / solutions_builder-2.0.0.tar.gz

Download URL solutions_builder-2.0.0.tar.gz
Size 138.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7d6a816f8fe7289c2c5d35efc2e4827c663a990df74b223a6c75689ae90940fb
BLAKE2b-256 checksum
How to use checksums
ce3015a070fb550f7b7706fdd9db664d297614c95d5f8c1349ef71c281463b5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.5.0

Release files / solutions_builder-2.0.0-py3-none-any.whl

Download URL solutions_builder-2.0.0-py3-none-any.whl
Size 269.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1871190bb8008cac9e6d9e77ba9496b509e21a7f4c0ae85b52d838c9a820c66a
BLAKE2b-256 checksum
How to use checksums
e351e716f8bdd6f83c1c9d014311ac65ec984f2e693358b137596114dc293357
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Darwin/23.5.0
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page