Skip to content

JaysonBH/solutions-template

 
 

Repository files navigation

Google Cloud Solutions Template

A template to generate a new project with built-in structure and features to accelerate your project setup.

TL;DR

Solutions Template is a boilerplate template for building repeatable solutions with the best practices in architecture on Google Cloud, including GKE clusters, Test Automation, CI/CD, as well as development process.

This template provides built-in and ready-to-ship sample features including:

  • Kubernetes-based microservices
  • Simplified deployment using Skaffold and Kustomize
  • Terraform Google Cloud foundation setup
  • CI/CD deployment (with Github Actions)
  • CloudRun templates
  • [In Progress] CI/CD deployment with CloudBuild

Getting Started

Prerequisites

Install Cookiecutter (Github):

Install other required dependencies:

  • For MacOS:

    brew install --cask skaffold kustomize google-cloud-sdk
    
  • For Windows:

    choco install -y skaffold kustomize gcloudsdk
    

Project Requirements

Tool Current Version
Skaffold v1.39.2
GKE v1.22
Kustomize v4.3.1

Create a new project with Cookiecutter

Run the following to generate skeleton code in a new folder:

cookiecutter git@github.com:GoogleCloudPlatform/solutions-template.git

Provide the required variables to Cookiecutter prompt, e.g.:

project_id: my-project-id
project_name [My Awesome Project]:
project_short_description [My Awesome Project]:
project_slug [my_project]:
Google Cloud_region [us-central1]:
version [0.1.0]:
admin_email [admin@example.com]:
  • You may leave variables as blank if you'd like to use the default value (except projdct_id).
  • Notes: If you run into any issues with cookiecutter, please add --verbose at the end of the command to show detailed errors.

Once cookiecutter completes, you will see the folder <project_id> created in the path where you ran cookiecutter command.

Inside the newly created folder

You will see the file structure like below:

<project_id>/
│   README.md
│   skaffold.yaml
│
└───microservices/
│   └───sample_service/
│       └───kustomize/
│       └───src/
│       │   Dockerfile
│       │   requirements.txt
│       │   skaffold.yaml
│       │   ...
│
└───common/
│   └───src/
│   │   Dockerfile
│   │   requirements.txt
│   │   skaffold.yaml
│   │   ...
│
└───.github/

File structure details

  • README.md - This contains all details regarding the development and deployment.
  • skaffold.yaml - This is the master Skaffold YAML file that defines how everything is built and deployed, depending on different profiles.
  • microservices - The main directory for all microservices, can be broken down into individual folder for each microservie, e.g. sample_service.
    • [microservice subfolder] - Each microservice folder is a Docker container with Skaffold + Kustomize to build images in different environments.
  • common - The common image contains shared data models and util libraries used by all other microservices.

Built-in Features

In a nutshell, Solutions Template offers the following built-in features with working sample code:

  • A sample microservice with CRUD API endpoints on Kubernetes (GKE).
  • A built-in Ingress supporting custom DNS domain.
  • Test Automation and CI/CD with Github Action.
  • CloudRun Services

We are also working on the following features:

  • Test Automation and Ci/CD with CloudBuild

Roadmap

TBD

FAQ

TBD

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 49.9%
  • Python 34.1%
  • Shell 15.0%
  • Dockerfile 1.0%