deploy a php app on google app engine
Post on 26-Jun-2015
1.073 Views
Preview:
DESCRIPTION
TRANSCRIPT
Deploy !a PHP Application!on Google App Engine
PHP for App Engine
https://developers.google.com/events/io/sessions/333055646
The GAE platform
Platform as A Service (PaaS)!
Build, deploy & scale!
Don’t care about infrastructure
https://appengine.google.com/https://developers.google.com/appengine/
Google App Engine: services
All PaaS have limitations!
PHP is in preview phase!
Not all services are available
https://developers.google.com/appengine/features
Google App Engine: data storage
Google Cloud Sql !
Memcache!
Google Cloud Storage
Google App Engine: ext services
Email (internal or SendGrid)!
Twilio!
UrlFetch
Google App Engine: offline work
TaskQueue!
Cron
Google App Engine: auth
User Auth!
Application Identity
PHP on GAE
PHP 5.4!
Runs in a sandbox
https://developers.google.com/appengine/docs/php/
PHP on GAE
Some well-know extension are disabled: imagick, intl, pcntl, curl
PHP on GAE
Some well-know extension are disabled: imagick, intl, pcntl, curl
PHP on GAE
whaaat?
Some function are disabled!
permanently: exec, tmpfile!
partially: /e on preg_replace!
softly: gc_*, parse_str
PHP on GAE
File System is Read only: you can store files on Cloud Storage or external services
PHP on GAE
PHP on GAE
How to invoke external services (no curl remember? :-P)
PHP on GAE
PHP on GAE
Dynamic response max 32 MB!
Timeout on long response
PHP on GAE
Sessions are stored on Memcache !
session_*, $_SESSION work as expected!
use session_set_save_handler to change handler
PHP on GAE
Log are managed via syslog!
use PHP’s native syslog function!
use custom logging lib (eg. Monolog)
PHP on GAE
PHP on GAE: DB
PHP on GAE: sending mails
get the sdk!
requirements: python 2.7, php-cgi, mysql?!
local web server
wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.4.zip
App Engine SDK
# app.yaml application: propane-forge-391 version: 1 runtime: php api_version: 1 threadsafe: true
Base Config
# app.yaml application: propane-forge-391 version: 2 runtime: php api_version: 1 threadsafe: true
Base Config
# app.yaml — continued handlers: - url: /css static_dir: web/css - url: /js static_dir: web/js - url: .* script: web/index.php
Base Config
# php.ini google_app_engine.enable_functions = “…”
Base Config
!dev_appserver.py --php_executable_path=/usr/bin/php-cgi /
var/www/todo/ --host=gae.dev
Test Locally
!dev_appserver.py --php_executable_path=/usr/bin/php-cgi /
var/www/todo/
Test Locally
Deploy
!appcgf.py update /var/www/todo/!
(or git push)
A kitchen sink app
https://github.com/ideatosrl/silex-todo-gae
PHP on GAE: task queues
Execute offline work!
Expose endpoint(s) doing the work
PHP on GAE: task queues
# queue.yaml
PHP on GAE: task queues
PHP on GAE: task queues
PHP on GAE: task queues
# app.yaml
PHP on GAE: cronjobs
Schedule repetitive tasks!
Expose endpoint(s) doing the work
PHP on GAE: cronjobs
# cron.yaml
PHP on GAE: cronjobs
# app.yaml
PHP on GAE: users
PHP on GAE: modules
what we learned
integration is quite smooth for simple apps!!
some few common pattern
!apply to cloud.google.com/starterpack and get $ 500!
wanna try?
That’s all folks
Thank you!@_orso_ mo@ideato.it
feedback please! https://joind.in/11804
top related