Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a basic app.yaml file for a nodejs Google App Engine project

I am making a nodejs project for google app engine. Testing is all fine and the app is functional, but when prompted to deploy my code files via gcloud app deploy, I am given the following error:

ERROR: An app.yaml (or appengine-web.xml) file is required to deploy this directory as an App Engine application

I have never used yaml before. What should the contents of a basic yaml file look like to fix this problem and deploy my code?

like image 469
ipsa scientia potestas Avatar asked Aug 24 '26 16:08

ipsa scientia potestas


2 Answers

As you can see at https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html, YAML's basic is simple as as follows:

Dictionary - key: value


List/Array (1) -
name: - item1 - item2
List/Array (2) - name: ["item1", "item2"]
Nested Properties (1) -
nest: nestedKey: value nestedList: - item1 - item2

Regarding the specific YAML file you specified, read up on https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml for more information.
Here's a simple example from that page:

runtime: java
env: flex

handlers:
- url: /.*
  script: this field is required, but ignored
like image 122
James Conway Avatar answered Aug 26 '26 10:08

James Conway


For node your current options are nodejs10 and nodejs12:

Accepted runtimes are: [php, php55, python27, java, java7, java8, go111, go112, go113, go114, java11, nodejs10, nodejs12, php72, php73, php74, python37, python38, ruby25]

So an example app.yaml file, using a node server and the standard environment, would be:

runtime: nodejs12
env: standard

handlers:
- url: /.*
  script: auto

Note that some versions may have additional requirements eg:

script field for handler '/.*' must be set to 'auto' for runtime nodejs12.

like image 30
Jeremy Jones Avatar answered Aug 26 '26 10:08

Jeremy Jones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!