From 22e26777a5664fe0b55060745434e6ec10145172 Mon Sep 17 00:00:00 2001 From: kennethye1 Date: Wed, 5 Apr 2023 23:34:45 +0000 Subject: [PATCH 1/3] Update sample configurations for new Flex runtimes --- appengine/hello-world/flexible/app.yaml | 3 ++- appengine/hello-world/flexible/package.json | 2 +- appengine/metadata/flexible/app.yaml | 2 ++ appengine/metadata/flexible/package.json | 2 +- appengine/storage/flexible/app.yaml | 2 ++ appengine/storage/flexible/package.json | 2 +- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/appengine/hello-world/flexible/app.yaml b/appengine/hello-world/flexible/app.yaml index 0fd3991ca9..2f016a6113 100644 --- a/appengine/hello-world/flexible/app.yaml +++ b/appengine/hello-world/flexible/app.yaml @@ -14,7 +14,8 @@ # [START gae_flex_quickstart_yaml] runtime: nodejs env: flex - +runtime_config: + operating_system: ubuntu22 # This sample incurs costs to run on the App Engine flexible environment. # The settings below are to reduce costs during testing and are not appropriate # for production use. For more information, see: diff --git a/appengine/hello-world/flexible/package.json b/appengine/hello-world/flexible/package.json index cf34423120..e6879a3924 100644 --- a/appengine/hello-world/flexible/package.json +++ b/appengine/hello-world/flexible/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": "=v16.19.1" + "node": ">=18.x.x" }, "scripts": { "start": "node app.js", diff --git a/appengine/metadata/flexible/app.yaml b/appengine/metadata/flexible/app.yaml index 4dfe96aa23..bf30d096b2 100644 --- a/appengine/metadata/flexible/app.yaml +++ b/appengine/metadata/flexible/app.yaml @@ -13,3 +13,5 @@ runtime: nodejs env: flex +runtime_config: + operating_system: ubuntu22 \ No newline at end of file diff --git a/appengine/metadata/flexible/package.json b/appengine/metadata/flexible/package.json index 71f7b309ef..98383dffc7 100644 --- a/appengine/metadata/flexible/package.json +++ b/appengine/metadata/flexible/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": "16.x.x" + "node": ">= 18.x.x" }, "scripts": { "system-test": "mocha --exit test/*.test.js", diff --git a/appengine/storage/flexible/app.yaml b/appengine/storage/flexible/app.yaml index bc7994b422..64b75523a4 100644 --- a/appengine/storage/flexible/app.yaml +++ b/appengine/storage/flexible/app.yaml @@ -14,6 +14,8 @@ # [START gae_flex_storage_yaml] runtime: nodejs env: flex +runtime_config: + operating_system: ubuntu22 env_variables: GCLOUD_STORAGE_BUCKET: YOUR_BUCKET_NAME diff --git a/appengine/storage/flexible/package.json b/appengine/storage/flexible/package.json index 7fd45aa65f..ed302074d1 100644 --- a/appengine/storage/flexible/package.json +++ b/appengine/storage/flexible/package.json @@ -6,7 +6,7 @@ "test": "mocha system-test/*.test.js --exit --timeout=30000" }, "engines": { - "node": ">=12.20.0" + "node": ">=18.x.x" }, "dependencies": { "@google-cloud/storage": "^6.9.3", From 2cdb04b4fe17f3f508b89fb75084a2f1c0c6a371 Mon Sep 17 00:00:00 2001 From: kennethye1 Date: Thu, 6 Apr 2023 19:37:40 +0000 Subject: [PATCH 2/3] Update README and create yaml files for 18 and later --- appengine/README.md | 8 ++++++-- appengine/analytics/README.md | 8 +++++++- appengine/analytics/app.flexible_os.yaml | 21 ++++++++++++++++++++ appengine/datastore/README.md | 6 +++++- appengine/datastore/app.flexible_os.yaml | 18 +++++++++++++++++ appengine/pubsub/README.md | 6 +++++- appengine/pubsub/app.flexible_os.yaml | 22 +++++++++++++++++++++ appengine/static-files/app.flexible_os.yaml | 18 +++++++++++++++++ 8 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 appengine/analytics/app.flexible_os.yaml create mode 100644 appengine/datastore/app.flexible_os.yaml create mode 100644 appengine/pubsub/app.flexible_os.yaml create mode 100644 appengine/static-files/app.flexible_os.yaml diff --git a/appengine/README.md b/appengine/README.md index 4e117c00da..44861b17c0 100644 --- a/appengine/README.md +++ b/appengine/README.md @@ -55,7 +55,7 @@ Refer to the `README.md` file in the sample folder. Many samples in this folder can be deployed to both App Engine Node.js standard environment and flexible environment. Those samples come with two different -App Engine configuration files: `app.flexible.yaml` for flexible environment, +App Engine configuration files: `app.flexible.yaml` for flexible environment Node.js 16 and earlier, `app.flexible_os.yaml` for Node.js 18 and later and `app.standard.yaml` for standard environment. Samples with one single configuration file, `app.yaml`, can only be deployed @@ -76,9 +76,13 @@ Generally speaking, to deploy a sample application: gcloud app deploy app.standard.yaml - To deploy to App Engine Node.js Flexible Environment, run + To deploy to App Engine Flexible Environment Node.js 16 and earlier , run gcloud app deploy app.flexible.yaml + + For App Engine Flexible Environment Node.js 18 and later, run + + gclooud app deploy app.flexible_os.yaml For samples with one configuration file (`app.yaml`), run diff --git a/appengine/analytics/README.md b/appengine/analytics/README.md index de654af183..6552ad0792 100644 --- a/appengine/analytics/README.md +++ b/appengine/analytics/README.md @@ -34,12 +34,18 @@ Before you can run or deploy the sample, you need to do the following: gcloud app deploy app.standard.yaml ``` -## Deploying to App Engine flexible Environment +## Deploying to App Engine flexible Environment for Node.js 16 and earlier ``` gcloud app deploy app.flexible.yaml ``` +## Deploying to App Engine flexible Environment for Node.js 18 and later + +``` +gcloud app deploy app.flexible_os.yaml +``` + ## Running the tests diff --git a/appengine/analytics/app.flexible_os.yaml b/appengine/analytics/app.flexible_os.yaml new file mode 100644 index 0000000000..971f2dcb8d --- /dev/null +++ b/appengine/analytics/app.flexible_os.yaml @@ -0,0 +1,21 @@ +# Copyright 2023, Google, Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: nodejs +env: flex +runtime_config: + operating_system: ubuntu22 + runtime_version: 18 + +env_variables: + GA_TRACKING_ID: YOUR_TRACKING_ID \ No newline at end of file diff --git a/appengine/datastore/README.md b/appengine/datastore/README.md index 3f3536204a..95eef15cae 100644 --- a/appengine/datastore/README.md +++ b/appengine/datastore/README.md @@ -30,10 +30,14 @@ Before you can run or deploy the sample, you need to do the following: gcloud app deploy app.standard.yaml -## Deploying to App Engine flexible environment +## Deploying to App Engine flexible environment for Node.js 16 and earlier gcloud app deploy app.flexible.yaml +## Deploying to App Engine flexible environment for Node.js 18 and later + + gcloud app deploy app.flexible_os.yaml + ## Running the tests See [Contributing][contributing]. diff --git a/appengine/datastore/app.flexible_os.yaml b/appengine/datastore/app.flexible_os.yaml new file mode 100644 index 0000000000..246bf39c34 --- /dev/null +++ b/appengine/datastore/app.flexible_os.yaml @@ -0,0 +1,18 @@ +# Copyright 2023, Google, Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: nodejs +env: flex +runtime_config: + operating_system: ubuntu22 + runtime_version: 18 \ No newline at end of file diff --git a/appengine/pubsub/README.md b/appengine/pubsub/README.md index d74e1c2269..e10d86b081 100644 --- a/appengine/pubsub/README.md +++ b/appengine/pubsub/README.md @@ -96,8 +96,12 @@ In the current directory, deploy using `gcloud`: gcloud app deploy app.standard.yaml -To deploy to App Engine Node.js Flexible Environment, run +To deploy to App Engine Node.js Flexible Environment for Node.js 16 and earlier, run: gcloud app deploy app.flexible.yaml +For App Engine Flexible deployments for 18 and later, deploy via: + + gcloud app deploy app.flexible_os.yaml + You can now access the application at https://[your-app-id].appspot.com. You can use the form to submit messages, but it's non-deterministic which instance of your application will receive the notification. You can send multiple messages and refresh the page to see the received message. diff --git a/appengine/pubsub/app.flexible_os.yaml b/appengine/pubsub/app.flexible_os.yaml new file mode 100644 index 0000000000..afee8bca3d --- /dev/null +++ b/appengine/pubsub/app.flexible_os.yaml @@ -0,0 +1,22 @@ +# Copyright 2023, Google, Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: nodejs +env: flex + +env_variables: + PUBSUB_TOPIC: YOUR_TOPIC_NAME + # This token is used to verify that requests originate from your + # application. It can be any sufficiently random string. + PUBSUB_VERIFICATION_TOKEN: YOUR_VERIFICATION_TOKEN + diff --git a/appengine/static-files/app.flexible_os.yaml b/appengine/static-files/app.flexible_os.yaml new file mode 100644 index 0000000000..246bf39c34 --- /dev/null +++ b/appengine/static-files/app.flexible_os.yaml @@ -0,0 +1,18 @@ +# Copyright 2023, Google, Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime: nodejs +env: flex +runtime_config: + operating_system: ubuntu22 + runtime_version: 18 \ No newline at end of file From 66ca6371f3bcdea63d60487933d759c6de277d98 Mon Sep 17 00:00:00 2001 From: kennethye1 Date: Fri, 7 Apr 2023 19:27:50 +0000 Subject: [PATCH 3/3] Fix header licenses --- appengine/analytics/app.flexible_os.yaml | 5 +++-- appengine/datastore/app.flexible_os.yaml | 5 +++-- appengine/hello-world/flexible/app.yaml | 5 +++-- appengine/metadata/flexible/app.yaml | 5 +++-- appengine/pubsub/app.flexible_os.yaml | 8 +++----- appengine/static-files/app.flexible_os.yaml | 5 +++-- appengine/storage/flexible/app.yaml | 5 +++-- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/appengine/analytics/app.flexible_os.yaml b/appengine/analytics/app.flexible_os.yaml index 971f2dcb8d..fe27775d4f 100644 --- a/appengine/analytics/app.flexible_os.yaml +++ b/appengine/analytics/app.flexible_os.yaml @@ -1,9 +1,10 @@ -# Copyright 2023, Google, Inc. +# Copyright 2023 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/appengine/datastore/app.flexible_os.yaml b/appengine/datastore/app.flexible_os.yaml index 246bf39c34..874af6591b 100644 --- a/appengine/datastore/app.flexible_os.yaml +++ b/appengine/datastore/app.flexible_os.yaml @@ -1,9 +1,10 @@ -# Copyright 2023, Google, Inc. +# Copyright 2023 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/appengine/hello-world/flexible/app.yaml b/appengine/hello-world/flexible/app.yaml index 2f016a6113..5be91b6d06 100644 --- a/appengine/hello-world/flexible/app.yaml +++ b/appengine/hello-world/flexible/app.yaml @@ -1,9 +1,10 @@ -# Copyright 2017, Google, Inc. +# Copyright 2023 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/appengine/metadata/flexible/app.yaml b/appengine/metadata/flexible/app.yaml index bf30d096b2..b4a73e03e9 100644 --- a/appengine/metadata/flexible/app.yaml +++ b/appengine/metadata/flexible/app.yaml @@ -1,9 +1,10 @@ -# Copyright 2016, Google, Inc. +# Copyright 2023 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/appengine/pubsub/app.flexible_os.yaml b/appengine/pubsub/app.flexible_os.yaml index afee8bca3d..c970c73507 100644 --- a/appengine/pubsub/app.flexible_os.yaml +++ b/appengine/pubsub/app.flexible_os.yaml @@ -1,9 +1,10 @@ -# Copyright 2023, Google, Inc. +# Copyright 2023 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -11,9 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -runtime: nodejs -env: flex - env_variables: PUBSUB_TOPIC: YOUR_TOPIC_NAME # This token is used to verify that requests originate from your diff --git a/appengine/static-files/app.flexible_os.yaml b/appengine/static-files/app.flexible_os.yaml index 246bf39c34..874af6591b 100644 --- a/appengine/static-files/app.flexible_os.yaml +++ b/appengine/static-files/app.flexible_os.yaml @@ -1,9 +1,10 @@ -# Copyright 2023, Google, Inc. +# Copyright 2023 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/appengine/storage/flexible/app.yaml b/appengine/storage/flexible/app.yaml index 64b75523a4..99d0867485 100644 --- a/appengine/storage/flexible/app.yaml +++ b/appengine/storage/flexible/app.yaml @@ -1,9 +1,10 @@ -# Copyright 2015-2016, Google, Inc. +# Copyright 2023 Google LLC +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,