-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve Cloud Run deployment template (#404)
- Loading branch information
Showing
2 changed files
with
163 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,55 @@ | ||
# Google Cloud Run Deployment | ||
|
||
## Overview | ||
|
||
This example provides a basic Terraform project to deploy the playground | ||
on Google Cloud as a [Cloud Run](https://cloud.google.com/run?hl=en) app. | ||
|
||
HCL defines: | ||
|
||
* Cloud Run service with the app. | ||
* Simple bucket with shared Go mod and WASM builds cache. | ||
* IAM rules for a cache bucket. | ||
|
||
## Prerequisites | ||
|
||
* [Terraform](https://www.terraform.io/) or [OpenTofu](https://opentofu.org). | ||
* [gcloud](https://cloud.google.com/sdk/docs/install) tool. | ||
* [Google Cloud CLI (`gcloud`)](https://cloud.google.com/sdk/docs/install). | ||
* [Google Cloud](https://cloud.google.com/) project. | ||
|
||
## Setup | ||
## Deployment | ||
|
||
### First-time setup | ||
|
||
Initialize a Terraform project and prepare a TF variables file: | ||
|
||
* Initialize project using `terraform init` command. | ||
* Copy `example.tfvars` to `prod.tfvars` and edit the file. | ||
* Prepare Terraform plan using variables file: \ | ||
`terraform plan -var-file="prod.tfvars" -out=tfplan` | ||
* Apply a plan using `terraform apply tfplan` command. | ||
```shell | ||
# Auth on gcloud and init TF project. | ||
# This action should be called only once. | ||
make init | ||
|
||
## Configuration | ||
# Create a var file from a template | ||
# and fill it with correct values: | ||
cp example.tfvars prod.tfvars | ||
vim prod.tfvars | ||
``` | ||
|
||
### App Configuration | ||
|
||
See environment variables section in [Docker](../docker/README.md) docs. | ||
|
||
### Deploying changes | ||
|
||
```shell | ||
# Prepare a Terraform plan | ||
make plan | ||
|
||
# Apply a plan | ||
make apply | ||
``` | ||
|
||
### Destroying a deployment | ||
|
||
```shell | ||
make destroy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters