Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7a74440
Added Streams tutorial for RedisInsight v2.0
ajeetraina Mar 1, 2022
9f1d29f
A Minor Numbering fix
ajeetraina Mar 1, 2022
f453f84
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
f848c21
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
2eaf244
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
25bc1e7
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
3acf83a
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
d5e22f6
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
bead7a9
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
0320f60
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
8c7ec3e
Update docs/explore/redisinsightv2/streams/index-streams.mdx
ajeetraina Mar 2, 2022
0aa52d5
Merge branch 'redis-developer:master' into master
ajeetraina Mar 2, 2022
693fd7c
Minor formatting
ajeetraina Mar 2, 2022
a632a68
Added Cloud Run and Redis tutorial
ajeetraina Mar 2, 2022
65e1bd1
Update index.deno.mdx
ajeetraina Mar 2, 2022
2d5009b
Update index.deno.mdx
ajeetraina Mar 2, 2022
0f2ac99
Merge pull request #1 from redis-developer/master
ajeetraina Mar 2, 2022
f89269e
Added New Google Cloud Run tutorial
ajeetraina Mar 2, 2022
6ab8198
Removed Streams
ajeetraina Mar 2, 2022
f3ce9aa
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
de978b0
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
afe535d
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
817295f
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
06f1744
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
11741de
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
58cc22e
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
f2da416
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
1186044
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
68bd812
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
eea40c9
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
90eae24
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
b3c1a37
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
ade6234
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
7258036
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
016417b
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
6797525
Update docs/create/cloudrun/index-cloudrun.mdx
ajeetraina Mar 2, 2022
9da2e3a
Update index-cloudrun.mdx
ajeetraina Mar 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/cloudrun_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/gcloud1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/gcloud2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/gcloud3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/gcloud4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/gcloud5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/gcloud6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/create/cloudrun/images/ratelimit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
286 changes: 286 additions & 0 deletions docs/create/cloudrun/index-cloudrun.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
---
id: index-cloudrun
title: Getting Started with Google Cloud Run and Redis
sidebar_label: Getting Started with Google Cloud Run and Redis
slug: /create/cloudrun
authors: [ajeet]
---


![alt_text](images/cloudrun_logo.png "image_tooltip")


If you’re looking for a solution that lets you go from container to URL within seconds, check out Google Cloud Run. [Cloud Run](https://cloud.google.com/run) is Google’s fully managed compute platform for running stateless, HTTP-driven containers. By using a single command (“[gcloud run deploy”](https://cloud.google.com/sdk/gcloud/reference/run/deploy)) you can convert a container image to a fully managed web application and run it in a production environment with auto-scalability, high availability, and security.

[Google Cloud Run](https://cloud.google.com/run/docs) allows you to deploy and scale serverless HTTP containers without worrying about provisioning servers, scaling servers up and down to meet demands, or overpaying by consuming more resources than necessary. It makes container deployment much easier. It is good for developing software in cloud applications, hence delivering web apps, [APIs](https://cloud.google.com/run/docs/reference/rest), background jobs, etc.

Cloud Run is [powered and built on Knative](https://cloud.google.com/knative). Knative is an open source community project which adds components for deploying, running, and managing serverless, cloud-native applications to Kubernetes. It allows you to easily run your containers either in your [https://cloud.google.com/kubernetes-engine](https://cloud.google.com/kubernetes-engine/) (GKE) cluster with Cloud Run on GKE or fully managed with Cloud Run. Cloud Run helps developers focus on writing high-value code, regardless of where their organizations are on the path to the cloud.


### Compelling features of Google Cloud Run



- Cloud Run provides you with the option to write your code in your preferred programming languages such as [NodeJS](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/run/helloworld/), [Python](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/run/), [Go](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/run/), and [Java](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/run/).
- Cloud Run provides you a better ROI as you get charged only for the resources used.
- Cloud Run offers a[ longer request timeout duration of up to 60 minutes](https://cloud.google.com/run/docs/configuring/request-timeout).
- Cloud Run is configured to [send multiple concurrent requests on each container instance. ](https://cloud.google.com/run/docs/configuring/concurrency)This is helpful to improve latency and reduce costs if you’re expecting large volumes.
- Cloud Run lets you [create microservice-based applications that are scalable and extensible](https://cloud.google.com/blog/products/serverless/build-event-driven-applications-in-cloud-run).

In this tutorial, you will learn how to deploy a simple Redis rate limiting application to Google Cloud Run in just 5 minutes.

### Table of Contents




* Step 1. Set up a free Redis Enterprise Cloud account
* Step 2. Install Google Cloud CLI
* Step 3. Authenticate your GCP account
* Step 4. Enable Google Services
* Step 5. Deploy to Google Cloud Run from source
* Step 6. Verify if service is listed
* Step 7. Set up environment variables
* Step 8. Access your app

### Step 1. Set up a free Redis Enterprise Cloud account

Visit [developer.redis.com/create/rediscloud/](https://developer.redis.com/create/rediscloud/) and create [a free Redis Enterprise Cloud account](https://redis.com/try-free/). Once you complete the signup tutorial, you will be provided with the database endpoint URL, port and password. Save these for future reference.




![Registering for Redis Cloud](images/rediscloud_register.png "image_tooltip")


### Step 2. Install Google Cloud CLI

Run the following command to install Google Cloud CLI Core Libraries and dependencies:


```
brew install --cask google-cloud-sdk

```


### Step 3. Authenticate your GCP account

To deploy your app you must first download, install, and initialize the [gcloud CLI](https://cloud.google.com/sdk/docs).

Download and install gcloud SDK via [https://cloud.google.com/sdk/docs](https://cloud.google.com/sdk/docs)


```
gcloud auth login
```


Allow Google Cloud SDK access to your Google Account:





![Authenticating with Google Cloud](images/authenticate_gcloud.png "image_tooltip")


### Step 4. Enable Google Services


```
gcloud services enable \
artifactregistry.googleapis.com \
cloudbuild.googleapis.com \
run.googleapis.com
Operation "operations/acat.p2-406459833831-88327c08-1fe9-4d9a-a6b9-db8c8b007863" finished successfully.


```


### Step 5 . Deploy to Google Cloud Run from source

Deploying from source automatically builds a container image from source code and deploys it.


```
gcloud run deploy
Deploying from source. To deploy a container use [--image]. See https://cloud.google.com/run/docs/deploying-source-code for more details.
Source code location (/Users/ajeetraina/projects/googlecloud/basic-rate-limiting-demo-python/google-cloud-run):
Next time, use `gcloud run deploy --source .` to deploy the current directory.

Service name (google-cloud-run):
Please specify a region:
[1] asia-east1
[2] asia-east2
[3] asia-northeast1
[4] asia-northeast2
[5] asia-northeast3
[6] asia-south1
[7] asia-south2
[8] asia-southeast1
[9] asia-southeast2
[10] australia-southeast1
[11] australia-southeast2
[12] europe-central2
[13] europe-north1
[14] europe-west1
[15] europe-west2
[16] europe-west3
[17] europe-west4
[18] europe-west6
[19] northamerica-northeast1
[20] northamerica-northeast2
[21] southamerica-east1
[22] southamerica-west1
[23] us-central1
[24] us-east1
[25] us-east4
[26] us-west1
[27] us-west2
[28] us-west3
[29] us-west4
[30] cancel
Please enter your numeric choice: 1

To make this the default region, run `gcloud config set run/region asia-east1`.

Deploying from source requires an Artifact Registry Docker repository to store built containers. A repository named
[cloud-run-source-deploy] in region [asia-east1] will be created.

Do you want to continue (Y/n)? Y

This command is equivalent to running `gcloud builds submit --tag [IMAGE] /Users/ajeetraina/projects/googlecloud/basic-rate-limiting-demo-python/google-cloud-run` and `gcloud run deploy google-cloud-run --image [IMAGE]`

Allow unauthenticated invocations to [google-cloud-run] (y/N)? y

Building using Dockerfile and deploying container to Cloud Run service [google-cloud-run] in project [redislabs-marketing-project] region [asia-east1]
⠼ Building and deploying new service... Uploading sources.
✓ Creating Container Repository...
✓ Uploading sources...
. Building Container...
. Creating Revision...
. Routing traffic...
. Setting IAM Policy…

Please enter your numeric choice: 1

To make this the default region, run `gcloud config set run/region asia-east1`.

Allow unauthenticated invocations to [django-redis-rate-limiting-example] (y/N)? y

Deploying container to Cloud Run service [django-redis-rate-limiting-example] in project [redislabs-marketing-project] region [asia-east1]
✓ Deploying new service... Done.
✓ Creating Revision... Revision deployment finished. Waiting for health check to begin.
✓ Routing traffic...
✓ Setting IAM Policy...
Done.
Service [django-redis-rate-limiting-example] revision [django-redis-rate-limiting-example-00001-mog] has been deployed and is serving 100 percent of traffic.
Service URL: https://django-redis-rate-limiting-example-opcboau66a-de.a.run.app


```



### Step 6. Verify if the service is listed under Cloud Run dashboard




![Verifying if the service is listed](images/gcloud1.png "image_tooltip")



![Verifying if the service is listed](images/gcloud2.png "image_tooltip")


#### Verifying the service via terminal UI


```
$ gcloud run services describe django-redis-rate-limiting-example

✔ Service django-redis-rate-limiting-example in region asia-east1

URL: https://django-redis-rate-limiting-example-opcboau66a-de.a.run.app
Ingress: all
Traffic:
100% LATEST (currently django-redis-rate-limiting-example-00001-mog)

Last updated on 2022-02-19T02:50:03.100357Z by ajeet.raina@redis.com:
Revision django-redis-rate-limiting-example-00001-mog
Image: gcr.io/redislabs-marketing-project/django-redis-rate-limiting-example@sha256:95bf8d5705c4ab52d2c9ba07d7dcf0c651431d8d5d38ad8806487aaa8a8a870d at 95bf8d57...
Port: 8080
Memory: 512Mi
CPU: 1000m
Service account: 406459833831-compute@developer.gserviceaccount.com
Concurrency: 80
Max Instances: 100
Timeout: 300s

```


### Step 7. Set up environment variables



- Adding Redis URL to point to Redis Enterprise Cloud




![Setting up environment variables](images/gcloud3.png "image_tooltip")




- Enable HTTPS




![Enabling HTTPS](images/gcloud4.png "image_tooltip")



- Ensuring the VPC connector shows as “none”



![Configuring the VPC connector](images/gcloud5.png "image_tooltip")



- Allowing all traffic



![Allowing all traffic](images/gcloud6.png "image_tooltip")


### Step 8. Access your app


Wait for the build and deploy to complete. When finished, a message with unique URL will be displayed.
Please note that the URL shown in your case will be different from the one shown below:

Open [https://django-redis-rate-limiting-example-opcboau66a-de.a.run.app/](https://django-redis-rate-limiting-example-opcboau66a-de.a.run.app/) and access your app.



![Running the application](images/ratelimit.png "image_tooltip")


This app allows you to choose the desired number of requests in each 10 second period. The app blocks connections from a client after surpassing a certain amount of requests (default: 10) in the time window (default: 10 sec). That will let the user know how many requests they have remaining before they run over the limit. On the tenth run, the server should return an HTTP status code of 429 (“Too Many Requests”).

### Additional references:



- [Google Cloud Run](https://cloud.google.com/run)
- [Features of Google Run](https://cloud.google.com/run#section-13)
- [Create Redis Database using Google Cloud](https://developer.redis.com/create/gcp)

8 changes: 7 additions & 1 deletion docs/explore/redisinsightv2/index-redisinsightv2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
page="/explore/redisinsightv2/redisearch"
/>
</div>

<div class="col">
<RedisCard
title="Using Redis Streams Consumer Groups with RedisInsight v2.0"
description="Use Redis Streams Consumer Groups with RedisInsight"
page="/explore/redisinsightv2/streams"
/>
</div>

</div>

Expand Down
Loading