Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

Commit 1ed94f5

Browse files
committed
shorten README
1 parent 2988bbf commit 1ed94f5

File tree

1 file changed

+38
-59
lines changed

1 file changed

+38
-59
lines changed

README.md

100644100755
Lines changed: 38 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Python 2 App Engine app migration: data storage
2-
### To modern datastores, Python 3, and Cloud Run containers
1+
# Python 2 App Engine app migration
2+
### To modern runtime, Cloud services, Python 3, and Cloud Run containers
33

4-
[Google App Engine](https://cloud.google.com/appengine) (standard) has undergone a number of product upgrades over the past few years, leaving some early adopters unable to easily move off the original platform. These codelabs (free, self-paced, hands-on tutorials) aim to help developers modernize their applications by experiencing individual migration steps via a sample application meant to model theirs.
4+
[Google App Engine](https://cloud.google.com/appengine) (standard) has undergone a number of product upgrades over the past few years, leaving some early adopters unable to easily move off the original platform. This repo supports various migration codelabs (free, self-paced, hands-on tutorials) aim to give developers hands-on experience and develop muscle memory in doing individual migrations so they can modernize their applications. This is done via a sample application meant to model basic elements found in existing first-generation apps and applying individual migration steps to each.
55

66
## Prerequisites
77

@@ -11,63 +11,60 @@
1111
- General skills in [Python](http://python.org) 2 and/or 3
1212
- Familiarity with the App Engine Python 2 runtime
1313

14-
The intended audiences of this tutorial and corresponding video content are Information Technology decision-makers (ITDMs) as well as technical practitioners tasked with investigating and/or carrying out these migrations.
14+
The intended audiences of this tutorial and corresponding video content are Software Engineers, Information Technology decision-makers (ITDMs) as well as other technical practitioners tasked with investigating and/or carrying out such migrations.
1515

1616
## Cost
1717

1818
Use of GCP products & APIs is not free. While you may not have needed to enable billing with early App Engine applications, all applications now require an active billing account. App Engine's [pricing](https://cloud.google.com/appengine/pricing) and [quota](https://cloud.google.com/appengine/quotas) information should be referenced. App Engine and other GCP products have an ["Always Free" tier](https://cloud.google.com/free/docs/gcp-free-tier#always-free). Users only incur billing when these daily/monthly quotas are exceeded. The migration exercises in these tutorials should not incur any billing so long as you stay within the limits described above.
1919

2020
## Support for Python 2 & 3
2121

22-
It's important to note that for App Engine (Standard), Python 2 is only supported as a first-generation ("Gen1") runtime whereas Python3 is only supported as a next generation ("Gen2") runtime. This means that porting application from Python 2 to 3 also means migrating from Gen1 to Gen2 where things are different.
23-
24-
The most notable changes for developers are that bundled App Engine built-in services are absent from Gen2. The Gen1 bundled services have "grown-up" to become standalone products or have been deprecated. Gen2 also expects web apps to perform their own application (not network) routing.
22+
It's important to note that for App Engine (Standard), Python 2 is only supported as a 1st generation ("Gen1") runtime whereas Python 3 is only supported by the 2nd generation ("Gen2") runtime. This means that porting application from Python 2 to 3 also means migrating from Gen1 to Gen2 where things are different. (Python 2 belongs in the same class as Java 6-8, PHP 5, and Go 1.8-1.11 first-gen apps.) See the exact differences on the [App Engine runtime documentation page](https://cloud.google.com/appengine/docs/standard/runtimes). The most notable changes for developers are that bundled App Engine built-in services are absent from Gen2. The Gen1 bundled services have "grown-up" to become standalone products or have been deprecated. Gen2 also expects web apps to perform their own application (not network) routing.
2523

2624
> **NOTE:** App Engine ([Flexible](https://cloud.google.com/appengine/docs/flexible/python/runtime?hl=en#interpreter)) is a Gen2 service but is not within the scope of these tutorials. Developers who are curious can compare App Engine [Standard vs. Flexible](https://cloud.google.com/appengine/docs/the-appengine-environments).
2725
2826
## Description
2927

30-
We present a very basic first-generation Python 2.7 App Engine app and walk developers through modernization migration steps where each is represented by a codelab and corresponding video. Some of the steps are more crucial while most steps are optional, depending on user needs & preference. Think of it as a train ride where passengers can "get off" at their desired stops or continue their onward journey.
31-
32-
The sample app does not address complexities in your apps but serves as a guide to give you an idea of what is required for each of the migrations. The baseline sample is a Python 2.7 (Gen1) app built on the `webapp2` micro web framework and uses the `ndb` App Engine Datastore library.
33-
34-
> **NOTE:**
35-
- If your app does not have a user interface, i.e., mobile backends, etc., you still need to migrate to the Flask (or another) web framework to handle mobile app requests. An alternative is to use Cloud Endpoints or migrate your app to the [Firebase mobile & web app platform](https://firebase.google.com) where you can port your App Engine "API handlers" to [Cloud Functions for Firebase](https://firebase.google.com/products/functions).
36-
- Users interested in bringing back their dead apps that originally ran on the original Python 2.5 runtime ([deprecated in 2013](http://googleappengine.blogspot.com/2013/03/python-25-thanks-for-good-times.html) and [shutdown in 2017](https://cloud.google.com/appengine/docs/standard/python/python25) must [migrate from `db` to `ndb`](http://cloud.google.com/appengine/docs/standard/python/ndb/db_to_ndb) before attempting the techniques shown in this tutorial.
37-
38-
As mentioned above, some steps are more critical while others are *optional*. We recommend incremental updates. We designed each step to be relatively easy, so you experience each migration individually. However, there are some of you for whom the migration process may be easier where you may be able to take larger migration leaps.
39-
40-
We suggest considering where you want to end up eventually, playing with each migration step, then choose how you want to migrate your application then plan your path forward accordingly. For your app, determine how much migration you want to do, execute it, ensure all your unit tests & CI/CD work perfectly, and get to a stable place before taking the next step.
28+
Each folder represents a single migration step, and the plan is to have a corresponding code repo and developer video as well. It all starts with a basic Gen1 Python 2.7 app then makes the minimum "required" migrations away from built-in App Engine services such as `webapp2` micro web framework and the `ndb` Datastore library. These comprise the [Step 0](/step0-webapp2-gaendb-py2) 2.7 app.
4129

4230
## Table of Contents
4331

4432
Each major migration step has its own codelab & corresponding overview video. The step numbers correspond to their own folders, and generally each have folders for Python 2 & 3 ports. Some have an alternative or secondary succeeding migration—these end with "a", i.e., "Step 3a".
4533

46-
1. **Migrate from `webapp2` to [Flask](https://flask.palletsprojects.com/)**
47-
- Strongly recommended
48-
- Need to do this port regardless of whether you have a web UI
49-
- You can use another web framework as long as it supports routing
50-
- `webapp2` does not do routing so unsupported in Gen2 (meaning N/A in Python 3)
51-
1. **Migrate from App Engine NDB to [Cloud NDB](https://googleapis.dev/python/python-ndb/latest)**
52-
- Also strongly recommended
34+
1. **Migrate from `webapp2` to [Flask](https://flask.palletsprojects.com/)** ([2.x-only](/step1-flask-gaendb-py2))
35+
- Required/strongly recommended
36+
- Can select another web framework as long as it supports routing
37+
- `webapp2` [exists for 3.x](https://github.com/fili/webapp2-gae-python37) but does not do routing thus unsupported by App Engine
38+
1. **Migrate from App Engine NDB to [Cloud NDB](https://googleapis.dev/python/python-ndb/latest)** ([2.x](/step2-flask-cloudndb-py2) or [3.x](/step2-flask-cloudndb-py3))
39+
- Required/strongly recommended (`ndb` does not support 3.x)
5340
- More options available after completing this step
54-
- Can migrate from Python 2 to 3 after this step
55-
- Can migrate to Cloud Run after this step (Step 4)
56-
- Remaining datastore migration steps optional as Cloud NDB works in Python 2 & 3
57-
- App Engine NDB N/A in Python 3, so must move to Cloud NDB to move to 3.x
58-
1. **Migrate from Cloud NDB to [Cloud Datastore](http://cloud.google.com/datastore)**
59-
- Optional if you only have App Engine apps & only using Cloud NDB
60-
- Only recommended if you're already using Cloud Datastore in other apps
61-
- "Other apps" means App Engine *and* non-App Engine) apps
62-
- Help make codebase more consistent with possibly reusable components
63-
- Help consistent & reusable codebase may mean reduce maintenance costs
64-
- Can migrate to [Cloud Firestore](http://cloud.google.com/firestore) after this step (Step 3a)
65-
- Quite optional: infrequent/uncommon as it is "expensive"
66-
- Requires new project & Datastore has better write performance
67-
- For those who **must have** Firestore Firebase features
41+
- Can port to 3.x after this step (Cloud NDB Python 2 & 3-compatible)
42+
- Can migrate to Cloud Run after this step (Step 4 below)
43+
- No additional Datastore migrations required
44+
1. **Migrate from Cloud NDB to [Cloud Datastore](http://cloud.google.com/datastore)** ([2.x](/step3-flask-datastore-py2) or [3.x](/step3-flask-datastore-py3))
45+
- Only recommended if using Cloud Datastore elsewhere (GAE *and* non-App Engine) apps
46+
- Helps w/code consistency & reusability, reduces maintenance costs
47+
- Can migrate to [Cloud Firestore](http://cloud.google.com/firestore) after this step ([Step 3a](/migrate-python2-appengine/tree/master/step3a-flask-firestore-py2); 3.x-only)
48+
- **Very** optional: infrequent/uncommon & "expensive" migration
49+
- Requires new project & Datastore has better write performance (currently)
50+
- If you **must have** Firestore's Firebase features
6851
1. **Migrate from App Engine to [Cloud Run](http://cloud.google.com/run)**
69-
- Migrate your app to a container with [Docker](http://docker.com)
70-
- Alternative container migration with [Cloud Buildpacks](https://github.com/GoogleCloudPlatform/buildpacks) (Step 4a)
52+
- "Containerize" your app (migrate your app to a container) with...
53+
- [Docker](http://docker.com) ([2.x w/Cloud NDB](/step4-cloudndb-cloudrun-py2) or [3.x w/Cloud Datastore](/step4-cloudds-cloudrun-py3))
54+
- Cloud Buildpacks ([Step 4a](/step4-cloudrun-bldpks-py3)) ; 3.x-only w/Cloud Datastore)
55+
56+
Think of it as a train ride where the first pair of stops are required, then the passengers can "get off" at any upcoming station or continue their onward journey.
57+
58+
> **ATTN mobile developers:**
59+
If your original app users does *not* have a user interface, i.e., mobile backends, etc., but still uses `webapp2` for routing, some migration must still be completed. Your options:
60+
- Migrate to Flask (or another) web framework but keep app on App Engine
61+
- Use Cloud Endpoints for your mobile endpoints
62+
- Break-up your monolithic app to "microservices" and migrate your app to either:
63+
- Google Cloud Functions](https://cloud.google.com/functions)
64+
- [Firebase mobile & web app platform](https://firebase.google.com) (and [Cloud Functions for Firebase](https://firebase.google.com/products/functions) [customized for Firebase])
65+
66+
> **NOTE:**
67+
- Long-time users wishing to bring back their dead/deprecated apps on the original Python 2.5 runtime ([deprecated in 2013](http://googleappengine.blogspot.com/2013/03/python-25-thanks-for-good-times.html) and [shutdown in 2017](https://cloud.google.com/appengine/docs/standard/python/python25) must [migrate from `db` to `ndb`](http://cloud.google.com/appengine/docs/standard/python/ndb/db_to_ndb) (and 2.5 to 2.7) before attempting any of these migrations.
7168

7269
## Summary
7370

@@ -80,24 +77,6 @@ Python 2 | Next | Python 3 | Description
8077
[`step2-flask-cloudndb-py2`](/step2-flask-cloudndb-py2) | ↓ or → or ⤓ª | [`step2-flask-cloudndb-py3`](/step2-flask-cloudndb-py3) | Migrate to Cloud NDB
8178
[`step3-flask-datastore-py2`](/step3-flask-datastore-py2) | ↓ or → or ⤓+º | [`step3-flask-datastore-py3`](/step3-flask-datastore-py3) | Migrate to Cloud Datastore
8279
[ª`step4-cloudndb-cloudrun-py2`](/step4-cloudndb-cloudrun-py2) | → | [`step4-cloudds-cloudrun-py3`](/step4-cloudds-cloudrun-py3) | Migrate to Cloud Run (with Docker)
83-
84-
- We recommend users perform the minimal migration of Steps 1 & 2.
85-
- To modernize a Python 2 App Engine app by containerizing, jump over Step 3 and go straight to Step 4 then stay there forever if desired.
86-
- Step 3's migration to Cloud Datastore is most useful if you have other apps using Cloud Datastore; you can make your codebase consistent by migrating from Cloud NDB to Cloud Datastore so all your Datastore access is consistent, possibly lowering your maintenance costs.
87-
- Migrating to Step 4 is only useful if you wish to containerize your app and run it serverlessly with Cloud Run. The Python 2 app uses Cloud NDB while the Python 3 equivalent uses Cloud Datastore.
88-
89-
### Alternatives
90-
91-
There are several alternatives to consider to the main steps above: 1) migrating to Cloud Firestore for those who desire to take advantage of the next-generation of Cloud Datastore that has features from the Firebase real-time database, and 2) an alternative to building containers using [Cloud Buildpacks](https://github.com/GoogleCloudPlatform/buildpacks) instead of Docker.
92-
93-
- Cloud Datastore & Cloud Firestore are mutually-exclusive, thus requiring a new project
94-
- Thus it is much less likely users perform this migration; see Step 3a if it's a **must-have**
95-
- Step 4a is for developers who want to containerize their apps but **without** Docker
96-
- Users either don't want to learn it nor curate a Dockerfile.
97-
- Both alternatives are only available in Python 3; users can extrapolate for Python 2
98-
99-
Python 2 | Next | Python 3 | Description
100-
--- | --- | --- | ---
10180
_N/A_ | _N/A_ | º[`step3a-flask-firestore-py3`](/step3a-flask-firestore-py3) | Migrate to Cloud Firestore (uncommon; see above)
10281
_N/A_ | _N/A_ | +[`step4a-cloudrun-bldpks-py3`](/step4a-cloudrun-bldpks-py3) | Migrate to Cloud Run (with Cloud Buildpacks)
10382

0 commit comments

Comments
 (0)