Skip to content

Latest commit

 

History

History
202 lines (140 loc) · 4.92 KB

GoogleGettingStarted.md

File metadata and controls

202 lines (140 loc) · 4.92 KB
id title
GoogleGettingStarted
GCP Getting Started

This document describes how to get started with GruCloud on the Google Cloud Platform.

import TOCInline from '@theme/TOCInline';

Use Cases

usecase.svg

Workflow

gc-new-workflow

Requirements

GCP Account

Access to the GCP console is required to run this tutorial.

gcloud

Ensure the GCP CLI called gcloud is installed:

gcloud -v
Google Cloud SDK 363.0.0
beta 2021.10.29
bq 2.0.71
core 2021.10.29
gsutil 5.4

Installing the GruCloud CLI

The GruCloud CLI, gc, is written in Javascript running on Node.js

Install it globally with:

npm i -g @grucloud/core

gc-cli-install.svg

GruCloud CLI commands

gc new Create a new project

The new command guides you on how to create and configure a new project.

gc-new-aws

Below is the screencast of gc new:

<iframe data-autoplay src="https://asciinema.org/a/lskiblzLpXqnPsZ5Z1W7Bf2Kd/iframe?autoplay=true&speed=1&loop=true" id="asciicast-iframe-13761" name="asciicast-iframe-13761" scrolling="no" style={{ width: "100%", height: "600px" }} ></iframe>

The boilerplate project is now created and configured.

gc init Initialisation

A few actions need to be performed before deploying the resources.

  • Setup billing for that project
  • Enable the API services
  • Create a service account
  • Create and save the credential file for this service account
  • Update the IAM policy by binding roles to the service account

Don't worry, these preparation steps are fully automated:

gc init
<iframe data-autoplay src="https://asciinema.org/a/7ZjVCYhCV5IpFJix3o8MWCfpm/iframe?autoplay=true&speed=1&loop=true" id="asciicast-iframe-13761" name="asciicast-iframe-13761" scrolling="no" style={{ width: "100%", height: "600px" }} ></iframe>

gc list List the live resources

Visualize your current infrastructure with the list command:

gc list --graph

diagram-live.svg

gc gencode Code Generation

The gencode command fetches the live resources and generate the code in resource.js

gc gencode

The following flowchart explains in more detail the process of generating the code from the live infrastructure.

gc-gencode.svg

<iframe data-autoplay src="https://asciinema.org/a/cG8dNLRpUbjcpGmg1HajmZdcJ/iframe?autoplay=true&speed=1&loop=true" id="asciicast-iframe-13761" name="asciicast-iframe-13761" scrolling="no" style={{ width: "100%", height: "610px" }} ></iframe>

Congratulation, the infrastructure code has been created automatically.

gc graph Target Graph

The graph command creates a dependency graph of the target resources:

gc graph

diagram-live.svg

gc tree Resource mind map

Given the target resources defined in resources.js, let's generate a mindmap of the target resources by group and type.

gc tree

diagram-live.svg

gc apply Update

To update the infrastructure, either use the GCP console and run gc gencode, or modify directly the file resource.js. Once done, use the apply command to update the infrastructure:

gc apply
<iframe data-autoplay src="https://asciinema.org/a/0VjCmyE8bW8Jq4FdEnFxyjaFd/iframe?autoplay=true&speed=1&loop=true" id="asciicast-iframe-13761" name="asciicast-iframe-13761" scrolling="no" style={{ width: "100%", height: "640px" }} ></iframe>

gc destroy Destroy

To destroy the infrastructure, use the destroy command:

gc destroy
<iframe data-autoplay src="https://asciinema.org/a/Rla0m3E70stbH5faMTS5ZWAIw/iframe?autoplay=true&speed=1&loop=true" id="asciicast-iframe-13761" name="asciicast-iframe-13761" scrolling="no" style={{ width: "100%", height: "640px" }} ></iframe>

Next Steps