You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: step2-flask-cloudndb-py3/README.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ Porting from Python 2 to 3 is not within the scope of this tutorial, and our sim
15
15
1. Delete the `lib` folder for the same reason.
16
16
1. Migrate from App Engine NDB to Cloud NDB
17
17
18
+
In addition to *actually* porting your app from Python 2.x to 3.x, you would also be migrating from the original App Engine runtime ("Gen1") to the next-gen runtime ("Gen2"), and there are some important differences you need to know which are [listed here](https://cloud.google.com/appengine/docs/standard/python3/python-differences).
19
+
18
20
### Configuration
19
21
20
22
The only real change for this sample app is to significantly shorten `app.yaml` down to just these lines for the runtime as well as routing:
@@ -27,7 +29,21 @@ handlers:
27
29
script: auto
28
30
```
29
31
30
-
`requirements.txt` and `templates/index.html` remain unchanged while the `appengine_config.py` file and `lib` folder are deleted.
32
+
An additional improvement you can make is to get rid of the `handlers:` section altogether (especially since `script: auto` is the only accepted directive regardless of URL path) and replace it with an `entrypoint:` directive. In Gen1, handlers were necessary to help route requests to your app, but in Gen2, routing is the responsibility of the web framework, not as an App Engine configuration.
33
+
34
+
35
+
TODO
36
+
37
+
If you do that, you're `app.yaml` may look like the following (assuming there is a "main" function in your `main.py` which we not have in ours until Step 4):
38
+
39
+
```yml
40
+
runtime: python38
41
+
entrypoint: python main.py
42
+
```
43
+
44
+
Check out [this page in the documentation](https://cloud.google.com/appengine/docs/standard/python3/runtime#application_startup) to find out more about the `entrypoint:` directive for `app.yaml` files.
45
+
46
+
The `requirements.txt` and `templates/index.html` files remain unchanged while the `appengine_config.py` file and `lib` folder are deleted.
31
47
32
48
---
33
49
@@ -36,4 +52,4 @@ handlers:
36
52
From here, your options are:
37
53
38
54
- [**Step 4:**](/step4-cloudds-cloudrun-py3) Migrate your app to a container executing serverlessly on Cloud Run
39
-
- [**Step 3:**](/step3-flask-datastore-py3) Further modernize Datastore access from Cloud NDB to the (official) Cloud Datastore library (how users *outside of* App Engine access Cloud Datastore)
55
+
- [**Step 3:**](/step3-flask-datastore-py3) Further modernize Datastore access from Cloud NDB to the (official) Cloud Datastore library (how users *outside of* App Engine access Cloud Datastore)
Copy file name to clipboardExpand all lines: step4-cloudds-cloudrun-py3/README.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,9 +75,18 @@ Doublecheck there are no files/folders named, `app.yaml`, `appengine_config.py`,
75
75
76
76
---
77
77
78
+
## Deploy
79
+
80
+
We didn't show you the deploy steps for the App Engine samples, but since some of you will be new to containers and Cloud Run, here is how you build & deploy your container on Cloud Run (fully-managed) once you've got all prior steps completed:
81
+
82
+
1. Build container: `gcloud builds submit --tag gcr.io/PROJECT_ID/IMG_NAME` (think `docker build` followed by `docker push`)
Congratulations... your app is fully modernized now, concluding this tutorial. From here, there is only one more thing you can investigate:
81
90
82
91
-[**Step 4a:**](/step4a-cloudrun-bldpks-py3) An alternative to app in *this* tutorial, containerizing your app with [Cloud Buildpacks](https://github.com/GoogleCloudPlatform/buildpacks) instead of Docker.
83
-
-[**Step 3a:**](/step3a-flask-firestore-py3) For those who are considering migrating from Cloud Datastore to Firestore (NOTE: that app is not containerized & runs on App Engine)
92
+
-[**Step 3a:**](/step3a-flask-firestore-py3) For those who are considering migrating from Cloud Datastore to Firestore (NOTE: that app is not containerized & runs on App Engine)
Copy file name to clipboardExpand all lines: step4-cloudndb-cloudrun-py2/README.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,6 +75,15 @@ Doublecheck there are no files/folders named, `app.yaml`, `appengine_config.py`,
75
75
76
76
---
77
77
78
+
## Deploy
79
+
80
+
We didn't show you the deploy steps for the App Engine samples, but since some of you will be new to containers and Cloud Run, here is how you build & deploy your container on Cloud Run (fully-managed) once you've got all prior steps completed:
81
+
82
+
1. Build container: `gcloud builds submit --tag gcr.io/PROJECT_ID/IMG_NAME` (think `docker build` followed by `docker push`)
Copy file name to clipboardExpand all lines: step4a-cloudrun-bldpks-py3/README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Introduction
4
4
5
-
This codelab represents an alternative to Step 4 (just the Python 3 version) where you're migrating your App Engine app to Cloud Run, but using Cloud Buildpacks instead of Docker. As Docker is an industry standard for containers, users choosing to follow this path are those who don't want to be dependent on a single company (and its control) or do not wish to become familiar with the Docker product and instead, opting for a more standardized approach to container-building that has multiple supporters in industry (more below).
5
+
This codelab represents an alternative to Step 4 (just the Python 3 version) where you're migrating your App Engine app to Cloud Run, but using Cloud Buildpacks instead of Docker. As Docker is an industry standard for containers, users choosing to follow this path are those who don't want to have to become familiar with working with Docker product or carefully curating their `Dockerfile` and instead, opting for a more standardized approach to container-building that has multiple supporters in industry (more below).
6
6
7
7
---
8
8
@@ -21,7 +21,7 @@ While Docker is an industry standard, some developers may prefer to avoid learni
21
21
### Configuration
22
22
23
23
1. Convert your `app.yaml` to a `service.yaml` with [the tool](http://googlecloudplatform.github.io/app-engine-cloud-run-converter).
24
-
1. Update `service.yaml` with your `PROJECT-ID`, `REGION`, and `SERVICE`.
24
+
1. Update `service.yaml` with your `PROJECT_ID`, `REGION`, `CONT_NAME`, and `SVC_NAME`.
25
25
1. Run the appropriate `gcloud` commands to build the container (see below).
26
26
1. Create a [`Procfile`](https://devcenter.heroku.com/articles/procfile) specifying the entrypoint of your app; see [example](https://devcenter.heroku.com/articles/getting-started-with-python#define-a-procfile).
27
27
@@ -31,7 +31,7 @@ Since this is only for Gen2 runtimes, we have to paste the contents of `step3-fl
- OR `gcloud run services add-iam-policy-binding my-service --member="allUsers" --role="roles/run.invoker" --region us-central1 --platform managed` (public services)
51
51
52
52
Delete the `app.yaml` (or back it up somewhere) as it is no longer needed. Then create a `Procfile` file specifying the application entry-point. The one for this app:
0 commit comments