Skip to content

Commit 1fd0fe2

Browse files
committed
Ready to test sample
1 parent 545722d commit 1fd0fe2

4 files changed

Lines changed: 37 additions & 7 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## App Engine Memorystore for Redis Sample
2+
3+
[![Open in Cloud Shell][shell_img]][shell_link]
4+
5+
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
6+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=appengine/standard/migration/memorystore/README.md
7+
8+
This is a sample app for Google App Engine that demonstrates how to replace
9+
use of the [Memcache API](https://cloud.google.com/appengine/docs/standard/python/memcache)
10+
with the [Memorystore for Redis offering](https://cloud.google.com/memorystore).
11+
This newer library can be used on App Engine with either Python 2.7
12+
or Python 3.
13+
14+
Prior to deploying this sample, a
15+
[serverless VPC connector](https://cloud.google.com/vpc/docs/configure-serverless-vpc-access)
16+
must be created and then a
17+
[Memorystore for Redis instance](https://cloud.google.com/memorystore/docs/redis/quickstart-console)
18+
on the same VPC. The IP address and port number of the Redis instance, and
19+
the name of the VPC connector should be entered in either app.yaml
20+
(for Python 2.7) or app3.yaml (for Python 3).
21+
22+
To deploy and run this sample in App Engine standard for Python 2.7:
23+
24+
pip install -t lib -r requirements.txt
25+
gcloud app deploy
26+
27+
To deploy and run this sample in App Engine standard for Python 3.7:
28+
29+
gcloud app deploy app3.yaml
30+

appengine/standard/migration/memorystore/app.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ libraries:
1313
version: 1.0.0
1414

1515
env_variables:
16-
REDISHOST: '10.32.97.227'
17-
REDISPORT: '6379'
16+
REDISHOST: '<REDIS_IP>'
17+
REDISPORT: '<REDIS_PORT>'
1818

1919
vpc_access_connector:
20-
name: 'projects/engelke-vpc-sample/locations/us-central1/connectors/redis-access'
21-
20+
name: 'projects/<PROJECT_ID>/locations/<REGION>/connectors/<CONNECTOR_NAME>'
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
runtime: python38
22

33
env_variables:
4-
REDISHOST: '10.32.97.227'
5-
REDISPORT: '6379'
4+
REDISHOST: '<REDIS_IP>'
5+
REDISPORT: '<REDIS_PORT>'
66

77
vpc_access_connector:
8-
name: 'projects/engelke-vpc-sample/locations/us-central1/connectors/redis-access'
8+
name: 'projects/<PROJECT_ID>/locations/<REGION>/connectors/<CONNECTOR_NAME>'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pytest==4.6.11; python_version < '3.0'
2+
mock==3.0.5

0 commit comments

Comments
 (0)