Reputation: 87
I am working on this app.yaml file to put Magento app on GAE. I have read most replies related to app.yaml files. Here is one for wordpress app. However, I feel very confused with so many different versions. https://github.com/eGlobeBizCom/appengine-php-wordpress-starter-project/blob/9130e8ca06fa52a84821b8faffa49b83792b8ebf/app.yaml
But, the Magento app and Drupal structures are different from Wordpress app. I have tried several versions of app.yaml, not working. I really wish to find out what are the exact rules for the correct code in the app.yaml file for PHP apps, thus newbies can test apps on GAE very quickly without this big huddle. Thank you !
Upvotes: 0
Views: 1123
Reputation: 21
It depends, the app.yaml must always be present and corresponds to your default module. You can see your modules at the google developer console -> appengine -> versions (should be modules). Each module can have lots of versions.
E.g.: To serve your application files (php files only) and your static files (everything else) from different modules, have a look at the following app.yaml and xml.yaml files:
app.yaml:
application: viewneo-eu
version: pro # production
runtime: php
api_version: 1
threadsafe: true
instance_class: F4
automatic_scaling:
min_idle_instances: 1 # one instance idleing forever
max_idle_instances: 4 # 4 x 50 = 200 max requests
min_pending_latency: 10ms # wait at least, before launching a new instance
max_pending_latency: automatic # after this time, create a new instance
max_concurrent_requests: 50
default_expiration: "0m"
handlers:
- url: /(.+)?/?
secure: always
script: build/mod_rewrite.php
- url: /.*
secure: always
script: build/mod_rewrite.php
xml.yaml:
application: viewneo-eu
module: xml
version: pro
runtime: php
api_version: 1
threadsafe: true
instance_class: F1
automatic_scaling:
min_idle_instances: 1 # one instance idleing forever
max_idle_instances: 4 # 4 x 50 = 200 max requests
min_pending_latency: 10ms # wait at least, before launching a new instance
max_pending_latency: automatic # after this time, create a new instance
max_concurrent_requests: 50
default_expiration: "0m"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
static_files: static/html/\1
upload: static/html/(.*\.(appcache|manifest))
expiration: "0m"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.atom)
mime_type: application/atom+xml
static_files: static/html/\1
upload: static/html/(.*\.atom)
expiration: "1h"
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.htc)
mime_type: text/x-component
static_files: static/html/\1
upload: static/html/(.*\.htc)
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.html)
mime_type: text/html
static_files: static/html/\1
upload: static/html/(.*\.html)
expiration: "7d"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.tpl)
mime_type: text/html
static_files: static/html/\1
upload: static/html/(.*\.tpl)
expiration: "7d"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.rss)
mime_type: application/rss+xml
static_files: static/html/\1
upload: static/html/(.*\.rss)
expiration: "1h"
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.txt)
mime_type: text/plain
static_files: static/html/\1
upload: static/html/(.*\.txt)
http_headers:
Access-Control-Allow-Origin: "*"
- url: /(.*\.xml)
mime_type: application/xml
static_files: static/html/\1
upload: static/html/(.*\.xml)
expiration: "1h"
application_readable: true
http_headers:
Access-Control-Allow-Origin: "*"
I've split various content types to different modules, which requires dispatch.yaml:
dispatch.yaml:
application: viewneo-eu
dispatch:
- url: "fonts.viewneo-eu.appspot.com/*"
module: fonts
- url: "img.viewneo-eu.appspot.com/*"
module: img
- url: "css.viewneo-eu.appspot.com/*"
module: css
- url: "js.viewneo-eu.appspot.com/*"
module: js
- url: "html.viewneo-eu.appspot.com/*"
module: html
- url: "cdn.viewneo-eu.appspot.com/*"
module: cdn
- url: "video.viewneo-eu.appspot.com/*"
module: cdn
- url: "audio.viewneo-eu.appspot.com/*"
module: cdn
- url: "dev.viewneo-eu.appspot.com/*"
module: dev
- url: "beta.viewneo-eu.appspot.com/*"
module: beta
As we're using secure always in our app.yaml and ssl won't work for wildcard sub sub domains, you can always access these through
https://fonts-dot-viewneo-eu.appspot.com, https://img-dot-viewneo-eu.appsport.com, ...
and so on.
Hope that helps.
Regards
Ron
Upvotes: 0