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..fe27775d4f --- /dev/null +++ b/appengine/analytics/app.flexible_os.yaml @@ -0,0 +1,22 @@ +# 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 +# +# 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..874af6591b --- /dev/null +++ b/appengine/datastore/app.flexible_os.yaml @@ -0,0 +1,19 @@ +# 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 +# +# 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/hello-world/flexible/app.yaml b/appengine/hello-world/flexible/app.yaml index 0fd3991ca9..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, @@ -14,7 +15,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..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, @@ -13,3 +14,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/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..c970c73507 --- /dev/null +++ b/appengine/pubsub/app.flexible_os.yaml @@ -0,0 +1,20 @@ +# 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 +# +# 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. + +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..874af6591b --- /dev/null +++ b/appengine/static-files/app.flexible_os.yaml @@ -0,0 +1,19 @@ +# 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 +# +# 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/storage/flexible/app.yaml b/appengine/storage/flexible/app.yaml index bc7994b422..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, @@ -14,6 +15,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",