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.
Related
I am learning how to move my existing PHP project to gCloud.
For the same, I created an AppEngine project and have placed my code there.
Everything seems to work except the PHP files.
When I launch my project, the index files launches (as specified in app.yaml) and then where the PHP should execute, it's renders the index.html file. This creates a deadly loop of index calling PHP calling index calling PHP :(
I am sure I have my app.yaml wrong, but am unable to figure out where the problem is.
My yaml looks like this:
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: /dialpad_research/(.*\.(appcache|manifest))
mime_type: text/cache-manifest
static_files: dialpad_research/static/\1
upload: dialpad_research/static/(.*\.(appcache|manifest))
- url: /dialpad_research/static
static_dir: dialpad_research/static
# image files
- url: /dialpad_research/static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
static_files: static/\1
upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
# dialpad root
- url: /dialpad_research.*
static_files: dialpad_research/static/index.html
upload: dialpad_research/static/index.html
- url: /dialpad_research/api/(.+\.php)$
script: api/\1
Any help is appreciated.
Folder structure is like this:
Root
|
---- app.yaml
---- dialpad_research (folder)
|
---- static (folder with index file)
---- api (folder with PHP files)
You have to be careful with your regex matching. This url pattern:
- url: /dialpad_research/static
will match:
- url: /dialpad_research/static(anything to follow)
So, it will never get to the handler below:
- url: /dialpad_research/static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
Same for:
- url: /dialpad_research.*
After that, it can never get to:
- url: /dialpad_research/api/(.+\.php)$
Reorder your handlers so that they don't short-circuit.
Next, /api/ and /static/ are not at the root so your paths to them are incorrect. See below:
handlers:
- url: /dialpad_research/(.*\.(appcache|manifest))
mime_type: text/cache-manifest
static_files: dialpad_research/static/\1
upload: dialpad_research/static/(.*\.(appcache|manifest))
# image files
- url: /dialpad_research/static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
static_files: dialpad_research/static/\1
upload: dialpad_research/static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
- url: /dialpad_research/api/(.+\.php)$
script: dialpad_research/api/\1
- url: /dialpad_research/static
static_dir: dialpad_research/static
# dialpad root
- url: /dialpad_research.*
static_files: dialpad_research/static/index.html
upload: dialpad_research/static/index.html
My app.yaml as:
runtime: php55
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
- url: /(.*)
static_files: www/\1
upload: www/(.*)
as seen above static files are under www dir. and php files are under the vendor dir and its sub sirs. I have read all days doc. to understand this yaml file to able to understand but unfortunately not yet :) . So, html and all static files works perfect. but when ajax calls php with sending data to php. gives 404 error. It works good on local wamp server. main opening page is index.html under www . And its ok. All day I tested many variant to able to deploy php files. Not able yet.
mainProjectRoot>app.yaml ( only this file and two directory "www and vendor")
www/index.html
/css
/js
vendor/smsgonder.php
/mail.php
/../../more php files
At least I gave up to try more variant and I need help to set up app.yaml page. (except above variant all extra code I received always error and no deployment)
Any help will be much appretiated. Thanks in advance !
final app.yaml is
runtime: php55
api_version: 2
threadsafe: true
handlers:
- url: /(.+\.php)$
script: vendor/\1
- url: /
static_files: www/index.html
upload: www/index.html
- url: /(.*)
static_files: www/\1
upload: www/(.*)
EDIT
this is final app.yaml ... (for a while I have deployed php files and some are were woring . But again for some php I receive "POST 500 error "
in case I like to share final app.yaml file here.
runtime: php55
api_version: 2
threadsafe: true
handlers:
- url: /(.*).php
script: \1.php
- url: /
static_files: www/index.html
upload: www/index.html
- url: /(.*)
static_files: www/\1
upload: www/(.*)
Any help will be very much appreciated. How could be :)) I spent 5-6 days just for deploying finished app :)'
add this immediately after handlers:
- url: /(.*)\.php$
script: vendor/\1.php
This will serve all request ending with .php to the php files within the vendor folder
The handlers section for PHP scripts following the documentation Example (works for vendor subdirectories as well):
# Serve php scripts.
- url: /(.+\.php)$
script: \1
Note: indentation matters!
Could not show images in Google App Engine
My need is deploy some png images to GAE. i have tried with these two codes in app.yaml. But the webpage does not show the png images
- url: /(.*\.(gif|png|jpg|ico|jpeg))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css|jpeg))
- url: /(.*\.(gif|png|jpg|ico|jpeg))
static_files: /\1
upload: /(.*\.(gif|png|jpg|ico|js|css|jpeg))
my current app.yaml file content
api_version: 1
threadsafe: yes
runtime: php
application: samplesite
version: 1
handlers:
- url: /
script: index.php
- url: /(.+\.php)$
script: \1
- url: /(.*\.(gif|png|jpg|ico|jpeg))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css|jpeg))
Move your root handler to the bottom. It is overriding all the other entries below it.
Many also place static files under a particular directory in their source so they are easily managed.
# All URLs ending in .gif .png or .jpg are treated as paths to static files in
# the static/ directory. The URL pattern is a regexp, with a grouping that is
# inserted into the path to the file.
- url: /(.*\.(gif|png|jpg))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg)$
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
Trying to get joomla working locally and ran into an issue with the Administror page. I have this error,
home page of site works - www.my-site.index.php
but with admin I find the following error - www.my-site/administrator.index.php
Warning: require(/Users/RichardClark/Sites/demo-test2/joomla/administrator): failed to open stream: No such file or directory in /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/php/setup.php on line 115
Fatal error: require(): Failed opening required '/Users/RichardClark/Sites/demo-test2/joomla/administrator' (include_path='/Users/RichardClark/Sites/demo-test2:/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/php/sdk') in /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/php/setup.php on line 115
I get the impressions joomla and google app engine aren't very compatible. I am really struggling to debug this. My app.yaml file is as follows;
application: fit-rig-517
version: 1
runtime: php
api_version: 1
handlers:
- url: /joomla/(.*\.(htm$|html$|css$|js$))
static_files: joomla/\1
upload: joomla/(.*\.(htm$|html$|css$|js$))
application_readable: true
## Admin
- url: /administrator(.+)
script: joomla/administrator\1
## Asset folders
- url: /media
static_dir: joomla/media
application_readable: true
mime_type: text/html
- url: /images
static_dir: joomla/images
application_readable: true
## Template folders
- url: /templates
static_dir: joomla/templates
application_readable: true
mime_type: application/(htm$|html$|css$|js$)
- url: /administrator/templates
static_dir: joomla/administrator/templates
application_readable: true
mime_type: text/html
## SEO robots
- url: /robots.txt
script: joomla/robots.txt
## Site access
- url: /(.+)?/?
script: joomla/index.php
thanks
App Engine does not have the concept of a default script (e.g. index.php) for directory access. Instead, it relies on the following rule in your app.yaml to locate the php script.
## Admin
- url: /administrator(.+)
script: joomla/administrator\1
Use /administrator/index.php to access your admin page instead.