Google App Engine app.yaml file for PHP app (Magenta App) - php

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 !

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

Related

CodeIgniter deploy in Google Cloud

I have deployed CodeIgniter framework in Google Cloud app engine. But when I am trying to access website it is showing 404. I have attached screenshot of file structure .
Please help.
runtime: php55
threadsafe: yes
api_version: 1
handlers:
- url: /user_guide/
static_files: user_guide/index.html
upload: user_guide/index.html
- url: /user_guide/(.*)
static_files: user_guide/\1
upload: user_guide/(.*)
- url: /static/(.*)
static_files: static/\1
upload: static/(.*)
- url: .*
script: index.php
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^(.*/)?.*\.bak$

Error [13] in deploying App Engine Application using Jenkins and gcloud

I am trying to deploy a mediawiki application to app engine using Jenkins as described in Google's push to deploy method https://cloud.google.com/tools/cloud-repositories/docs/push-to-deploy.
I am deploying mediawiki based on the same configurations here: https://github.com/tyolab/mediawiki-on-gae.
Some times I deploy the app and it is a success, but many times it fails with the following error:
Updating module [default].../
Updating module [default]...-
Updating module [default]...\
Updating module [default]...|
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [13]
Build step 'Execute shell' marked build as failure
Finished: FAILURE
There is no specific pattern, and the error is not descriptive, but I noticed the following:
If I deploy to a new staging container and a new version it usually works the first time, but later on it doesn't
I suspect it has something to do with static resources, as if I add some more static resources files "The ones commented out in the app.yaml sample below" the deployment fails
I suspected it is related to the issue described here, but the set +e solution didn't work for me How/When does Execute Shell mark a build as failure in Jenkins?
This is the build command that I use
set +e
gcloud --project=projectid preview app deploy app.yaml --version=3 --promote --bucket gs://projectstagingbucket --force
And here is a sample of the app.yaml file:
handlers:
# Static pages
#- url: /(.*\.(htm|html|css|js))
# static_files: \1
# upload: .*\.(htm|html|css|js)
# application_readable: true
# Serve images as static resources.
#- url: /resources/(.*\.(ico|jpg|jpeg|png|xcf|gif|woff|woff2|cur|ttf|otf|eot|svg))
# static_files: resources/\1
# upload: /resources/.*\.(ico|jpg|jpeg|png|xcf|gif|woff|woff2|cur|ttf|otf|eot|svg)
# application_readable: true
# Serve images as static resources.
#- url: /vendor/(.*\.(ico|jpg|jpeg|png|xcf|gif|woff|woff2|cur|ttf|otf|eot|svg))
# static_files: vendor/\1
# upload: vendor/.*\.(ico|jpg|jpeg|png|xcf|gif|woff2|cur|woff|ttf|otf|eot|svg)
# application_readable: true
# Serve images as static resources.
#- url: /skins/(.*\.(ico|jpg|jpeg|png|xcf|woff2|gif|woff|cur|ttf|otf|eot|svg))
# static_files: skins/\1
# upload: skins/.*\.(ico|jpg|jpeg|png|xcf|gif|woff2|woff|cur|ttf|otf|eot|svg)
# application_readable: true
- url: /favicon.ico
static_files: favicon.ico
upload: favicon.ico
application_readable: true
#- url: /(.+\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
# static_files: \1
# upload: .+\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)
# application_readable: true
- url: /robots.txt
static_files: robots.txt
upload: robots.txt
application_readable: true
# Misc files.
- url: /(.+\.(xsd|txt|sql|))
static_files: \1
upload: .+\.(xsd|txt|sql)
application_readable: true
# Serve MediaWiki installation scripts
# can be removed after installation
#- url: /mw-config/
# script: mw-config/index.php
# secure: always
# Serve mw-config images as static resources.
#- url: /mw-config/images/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
# static_files: mw-config/images/\1
# upload: mw-config/images/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)
# application_readable: true
# Serve images from Google Cloud Storage
- url: /images/(.*\.(ico|jpg|jpeg|xcf|png|gif|woff|woff2|cur|ttf|otf|eot|svg))
script: extensions/CloudStorage/GoogleCloudStorageFileServe.php
secure: optional
# Serve php5 scripts.
- url: /(.+\.php5)
script: \1
# Serve php scripts.
- url: /(.+\.php)
script: \1
#
- url: (.*)/(.*)
script: index.php
secure: optional
# redirect root to wiki path
- url: /?
script: index.php
secure: optional
# 404
- url: /(.*)
# script: /wiki/Special:Error404
#
#- url: /wiki/Special:Error404
script: index.php
Thanks in advance.

Some fonts dont work Google App Engine (wordpress)

I have installed wordpress in GAE. My wordpress installation has the popular Woocommerce plugin activated. The problem with this setup is that some of my fonts are not working. This is what I see :
The boxes should actually be stars. I am not sure, but I think this is happening because the mime type cant be guessed by GAE. In my browser console, I get the following messages
Resource interpreted as Image but transferred with MIME type
application/x-javascript:
this is my app.yaml:
application: XXXXXXX
version: 101
runtime: php
api_version: 1
handlers:
- url: /(.*\.(htm$|html$|css$|js$))
static_files: wordpress/\1
upload: wordpress/.*\.(htm$|html$|css$|js$)
application_readable: true
- url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/wp-content/\1
upload: wordpress/wp-content/.*\.(ico$|jpg$|png$|gif$)
application_readable: true
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/\1
upload: wordpress/.*\.(ico$|jpg$|png$|gif$)
- url: /wp-admin/(.+)
script: wordpress/wp-admin/\1
secure: always
- url: /wp-admin/
script: wordpress/wp-admin/index.php
secure: always
- url: /wp-login.php
script: wordpress/wp-login.php
secure: always
- url: /wp-cron.php
script: wordpress/wp-cron.php
login: admin
- url: /xmlrpc.php
script: wordpress/xmlrpc.php
- url: /wp-(.+).php
script: wordpress/wp-\1.php
- url: /(.+)?/?
script: wordpress/index.php
- url: /(.*\.woff)
static_files: wordpress/\1
upload: wordpress/(.*\.woff)
mime_type: application/font-woff
- url: /(.*\.svg)
static_files: wordpress/\1
upload: wordpress/(.*\.svg)
mime_type: image/svg+xml
- url: /(.*\.eot)
static_files: wordpress/\1
upload: wordpress/(.*\.eot)
mime_type: application/vnd.ms-fontobject
- url: /(.*\.ttf)
static_files: wordpress/\1
upload: wordpress/(.*\.ttf)
mime_type: application/x-font-ttf
- url: /(.*\.otf)
static_files: wordpress/\1
upload: wordpress/(.*\.otf)
mime_type: application/x-font-otf
My limited (and possibly stale) experience with pagespeed suggests that you might consider disabling it until you have everything else working.
The only thing that jumps out is that the first two - url: stanzas in your app.yaml should be exchanged. These stanzas are consulted in order. /wp-content/foo.js will be matched by the more general first stanza, which looks like it isn't what you want. I doubt that's what's causing the mime type confusion, but turning off pagespeed should give you better info for further debugging.

wordpress in GAE wp-admin area css and js not loading

I recently add wordpress to Google App Engine
Everything is working fine in the local PHP SDK
I used git it deploy the site to GAE, problem is in the live site admin area (wp-admin) one css and one js is not loading so I'm getting a display like this
I checked the missing resource they are
myappid.appspot../wp-admin/load-styles.php?c=0&dir=ltr&load=admin-bar,wp-admin,buttons,wp-auth-check&ver=3.6.1
and
myappid.appspot.../wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,json2&ver=3.6.1
These resources are loading fine in the local GAE PHP SDK. I'm using the same app.yaml that given in the google wordpress tutorial
I spend 2 days finding a solution for this Please help me out :)
This is my app.yaml file
application: entersys-wordpress
version: wp
runtime: php
api_version: 1
threadsafe: no
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /(.*\.(htm$|html$|css$|js$))
static_files: wordpress/\1
upload: wordpress/(.*\.(htm$|html$|css$|js$))
application_readable: true
- url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/wp-content/\1
upload: wordpress/wp-content/(.*\.(ico$|jpg$|png$|gif$))
application_readable: true
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/\1
upload: wordpress/(.*\.(ico$|jpg$|png$|gif$))
- url: /wp-admin/(.+)
script: wordpress/wp-admin/\1
secure: always
- url: /wp-admin/
script: wordpress/wp-admin/index.php
secure: always
- url: /wp-login.php
script: wordpress/wp-login.php
secure: always
- url: /wp-cron.php
script: wordpress/wp-cron.php
login: admin
- url: /xmlrpc.php
script: wordpress/xmlrpc.php
- url: /(.+)?/?
script: wordpress/index.php
I think there is a bug if you use git to deploy not correctly pushing the static content.
I would try using the appcfg.py method to push your app to check (Follow Step 8 here).

php app update: Invalid character in filename

Problem when uploading php application which uses Wordpress
* version - 1.8.0
* language - php
* operating system - Windows 7
Update to the GAE shows the below error for many files. Tried renaming few files but the error pops for another file and so on. These are wordpress 3.5.1 files.
Error 400: --- begin server output ---
Invalid character in filename: __static__\wordpress/wp-includes/css/admin-bar.css
--- end server output ---
The app.yaml content:
-------------------------------------------
application: fargocricketclub
version: 1
runtime: php
api_version: 1
threadsafe: yes
handlers:
- url: /(.*\.(htm$|html$|css$|js$))
static_files: wordpress/\1
upload: wordpress/(.*\.(htm$|html$|css$|js$))
application_readable: true
- url: /wp-content/(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/wp-content/\1
upload: wordpress/wp-content/(.*\.(ico$|jpg$|png$|gif$))
application_readable: true
- url: /(.*\.(ico$|jpg$|png$|gif$))
static_files: wordpress/\1
upload: wordpress/(.*\.(ico$|jpg$|png$|gif$))
- url: /wp-admin/(.+)
script: wordpress/wp-admin/\1
secure: always
- url: /wp-admin/
script: wordpress/wp-admin/index.php
secure: always
- url: /wp-login.php
script: wordpress/wp-login.php
secure: always
- url: /wp-cron.php
script: wordpress/wp-cron.php
login: admin
- url: /xmlrpc.php
script: wordpress/xmlrpc.php
- url: /(.+)?/?
script: wordpress/index.php
I believe that this is fixed in the 1.8.1 release of App Engine, using the solution proposed above to join the path using the OS specific path separator.
Issue seen in PHP & Python 1.8.1 deployments on Windows when using application_readable. Issue flagged: https://code.google.com/p/googleappengine/issues/detail?id=9558
Work around:
replaced os.path.join with posixpath.join in google\appengine\tools\appcfg.py

Categories