Introducción a Google App Engine

14
Introducción a r Perez de Albeniz Villarroel p://ikeralbeniz.net

description

Introduccion del curso de Google App Engine impartido para GTUG Bilbao. Mas info en: https://sites.google.com/a/gtugs.org/bilbao/eventos

Transcript of Introducción a Google App Engine

Page 1: Introducción a Google App Engine

Introducción a

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

Page 2: Introducción a Google App Engine

Introducción

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

•Aplicaciones Web en infraestructura de Google

•Integración con Google Apps

•Soporta tanto Java como Python

•Gratuito hasta superar cuotas

Pagas por lo que consumes

Gratis Hasta 5mill de visitas/mes (aprox)

Page 3: Introducción a Google App Engine

Funcionalidad

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

•Servidor Web Dinámico

•Sistemas de almacenamiento de datos persistentes (BBDD)

•Escalado automático y balanceo de carga

•Autenticación Google Account (LOPD)

•Tareas Programadas

•Encolado de Tareas

•Entrono de desarrollo y simulación

Page 4: Introducción a Google App Engine

SandBox

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

•La aplicación corre en un entorno seguro

Aislado del SO

Replicable en multiples servidores

•Limitaciones

Comunicación entre servidores solo a través de HTTP(S)

Escritura en disco no permitida

Timeout máximo de respuesta 30 segundos

Solo se ejecuta código en respuesta a una petición Web

Page 5: Introducción a Google App Engine

Entorno Java

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

•Java SE Runtime Environment (JRE) 6

•JVM Limitada Genera excepciones•Sockets•Escritura en disco

•Almacenamiento de Datos

•Java Data Objects (JDO)

•Java Persistence API (JPA)

•JavaMail

Page 6: Introducción a Google App Engine

Entorno Java

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

•Java SE Runtime Environment (JRE) 6

•JVM Limitada Genera excepciones•Sockets•Escritura en disco

•Almacenamiento de Datos

•Java Data Objects (JDO)

•Java Persistence API (JPA)

•JavaMail

Page 7: Introducción a Google App Engine

Entorno Python

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

•Version 2.5.2

•Limitada: Sockets, escritura en disco…

•Módulos de Django

•Módulos extra: DataStore, UrlFetch, Mail…

•Librerías de 3º (escritas en python)

•Entorno mas popular

Page 8: Introducción a Google App Engine

app.yaml

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

application: myapp version: 1 runtime: python api_version: 1

handlers:

- url: /.* script: main.py

- url: /stylesheets static_dir: stylesheets

- url: /admin/.* script: admin.py login: admin

Page 9: Introducción a Google App Engine

index.yaml

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

indexes:

- kind: Cat ancestor: no properties: - name: name - name: age direction: desc

- kind: Cat properties: - name: name direction: asc - name: whiskers direction: desc

Page 10: Introducción a Google App Engine

cron.yaml

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

cron:- description: updates from google url: /update schedule: every 25 minutes

Page 11: Introducción a Google App Engine

main.py

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

print 'Content-Type: text/plain'print ''

print 'Hello, world!'

from google.appengine.ext import webappfrom google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):    def get(self):        self.response.headers['Content-Type'] = 'text/plain'        self.response.out.write('Hello, webapp World!')

application = webapp.WSGIApplication(                                     [('/', MainPage)],                                     debug=True)

def main():    run_wsgi_app(application)

if __name__ == "__main__":    main()

Page 12: Introducción a Google App Engine

Entorno de Pruebas / Producción

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

•Servidor de Local•python …/dev_appserver.py --port="8080" /mi/proyecto/gae/•Web: http://127.0.0.1:8080/•Admin: http://127.0.0.1:8080/_ah/admin/

•Subir a Google•python …/appcfg.py [email protected] update /mi/proyecto/gae/

Page 14: Introducción a Google App Engine

¿Preguntas?

Iker Perez de Albeniz Villarroelhttp://ikeralbeniz.net

¿[email protected]