Azure Mobile Services per Windows Phone e smartphones
-
Upload
marco-parenzan -
Category
Software
-
view
534 -
download
0
description
Transcript of Azure Mobile Services per Windows Phone e smartphones
Azure Mobile Services per Windows Phone e Smartphones
Edizione AppDaysFiera del Radioamatore/2014Marco Parenzan
Marco Parenzan
Formazione & Divulgazione con 1nn0va
Ricerca e Innovazione con Servizi Cgn www.slideshare.net/marco.parenzan
marco [dot] parenzan [at] libero/live [dot] it
www.innovazionefvg.net
Developer e Architect in .NET e Web
Cloud Developer
Lo scenario Mobile/Smartphone/Apps
Mobile (oggi)…
…domani ci saranno tanti nomi: Devices
Intelligente Devices
Internet of Things
App è il modello delle applicazioni che provengono da uno «shop» Tipico per questo tipo di dispositivi
Anche nei PC (es. Windows 8) ora si chiamano App
App=Client+Services
Quando parliamo di app, pensiamo subito allo smartphone e alla «grafica»
Una app non funziona mai da sola
Parliamo di applicazioni «connesse» Il valore dello smartphone è essere «online»
Sei online perché comunichiamo con dei servizi Identità (Facebook, live.it, gmail.com, linkedin, …)
Email (Live, Gmail, …)
Storage drives (OneDrive, GoogleDrive, DropBox, ….)
…
Se tutti percepiamo come scrivere una app, come scriviamo un servizio?
Servizi per le App
I servizi per le app sono composti da due parti fondamentali Il Codice
L’infrastruttura
Il codice è la parte «che fa il lavoro» Lo scriviamo in qualche linguaggio (Javascript+HTML, C# e XAML, Java, PHP, ….)
L’infrastruttura dà gli «attributi» al servizio Qualità
Disponibilità
Funzionalità
Introduzione al Cloud Computing
e Microsoft Azure
Cos’è il Cloud Computing
L’approccio moderno alla implementazione di servizi per le App
Cos’è il Cloud Computing
An approach to computing that’s about internet scale and connecting to a variety of devices and endpoints
Cos’è il Cloud Computing
Time
Dem
an
d Cloud Provisioning
OverprovisionedUnderprovisioned
On-demand, scalable, multi-tenant, self-service compute and storage resources
Windows Azure
Comprehensive set of services that enable you to quickly build, deploy and manage applications across a global network of Microsoft-managed datacenters
Global Footprint
Pay only for what you use
Windows Azure Scenarios
Ideal for Applications Needing:
Scalability
Availability
Fault Tolerance
Common Application Uses:
Web Sites
Compute Intensive apps
Device Applications
Web APIs
Social Games
Types of “cloud” offerings
Software-as-a-Service
consume
SaaSPlatform-as-a-Service
build
PaaSInfrastructure-as-a-
Service
host
IaaS
PaaS for the Modern Web
Paas is secureEnterprise Grade Availability with support for SSL and AD
PaaS is flexibleWeb hosting your way with choice of language, framework, database, and platform
PaaS is scalableScale out or up in seconds on a Load Balanced, Always up to date, Global Infrastructure
web sites virtual machines mobile servicescloud services
The modern offering (2013+)
On-Premises
Models for Building and Running Apps
Virtualization
O/S
Hardware
Native Code
Custom Software
Network
Data
Applications
Firewall
Web Sites
Applications
Data
Cloud Services
Native Code
Startup Tasks
Applications
Firewall Rules
Data
Virtual Network
Virtual Machines
Native Code
Custom Software
Virtual Network
Data
Applications
Firewall Rules
O/S
Mobile ServicesApplications
Data
Auth
Notifications
Go Live
Rapid deployment for quick iteration
Integrated source control with Team Foundation Server (TFS) and Git
Built-in monitoring of perf and usage data
Quick access to request logs, failed requests diagnostics and diagnostics
Enterprise grade
High availability with SLA on reserve instances.
A global network of data centers.
Guaranteed SLA and 24/7 support.
Load balanced Up to date Easily scale Economical
Scalability
Scaling up and scaling out
0 1 2 3 4 5 6 7 8
Instances
Throughput
Instance Capacity
Quota
Scaling
Free
Shared
Standard
Multi-tenant. Daily quotas
Multi-tenant. Daily quotas
Dedicated VMs. No quotas
Open and flexible
Choice of languages.
Choice of databases.
Web app gallery. Zero lock in.
Choice of language
Node.js: 0.6.17, 0.6.20, 0.8.2
PHP: 5.3PHP: 5.4
ASP.NETNET: 3.5, 4.5, 4.5.1 Python: 2.7
Bring a stack: FastCGI basedRubyJava
Azure Mobile Services
Mobile Services
Easily build cloud back-ends
Data, identity, push notifications, and scheduled scripts
Windows Store, Windows Phone, iOS, and Android
Mobile Services
Cdn
Services for Cloud and Mobile Applications
Caching
Media
Big data
Analytics
Web Sites
Integration
Service bus
SQL database noSQL DB
Blob storage
Cloud services
Virtual Machines
Identity
Messaging
Networking
Traffic
Storage
What are Mobile Services?
Data
Notifications
Auth
Server Scripts + Custom API
Scheduler
Logging & Diag
Scale
Structured Storage
Powered by SQL Database
Same DB – Multiple Mobile Services AppX.Todoitem
AppY.Todoitem
Data management in Windows Azure Portal
SQL Portal, SQL Management Studio
REST API
CLI Tools
The REST API
Action HTTP Verb URL Suffix
Create POST /TodoItem
Read GET /TodoItem?$filter=id%3D42
Update PATCH /TodoItem/id
Delete DELETE /TodoItem/id
Data Operations and their REST Equivalents
Base REST API Endpoint URL
https://Mobileservice.azure-mobile.net/tables/*
JSON to SQL Type Mappings
JSON Value T-SQL Type
Numeric values (integer, decimal, floating point)
Float(53)
Boolean Bit
DateTime DateTimeOffset(3)
String Nvarchar(max)
Auth*
Authenticate against Microsoft Account, Twitter, Facebook, Google
Table level permissions for each CRUD operation Everyone
Anyone with the Application Key
Only Authenticated Users
Only Scripts and Admins
More granular control with server side scripts user.level: {admin, authenticated, anonymous}
user.userId: id or undefined if not authenticated
The User object
User.level Anonymous
Authenticated
Admin
User.userId Provider:id or undefined
User.getIdentities() UserId
Provider Access Token / Secret
Raggiungere l’utente: push notifications
Push Notifications
Integrates with WNS to provide Toast, Tile, Badge and Raw notifications
Portal captures your WNS client secret and package SID
push.wns.* provides: clean easy object model to compose notifications
Performs auth against WNS for you
How Push Notifications Work
Retrieve device handle
PNS(APNS, WNS, GCM)
Store handle in app back-end Send notification to handle
Device notified (even when app is inactive)
Server Side Scripts
Customizing logic on the server
Node.js scripts
Passes through to SQL by default
Intercept CRUD requests to tables
Fully customizable logic flow
Node Modules
Extensibility through numerous included modules
request
console
push.*
mssql
statusCodes azure
sendgrid
pusher
twilio
How Service Bus Notification Hub Works
Retrieve device handle
PNS
Registration with tagsSend notification to handle
Push notification
Azure Mobile Services:other goodies
More on script options: Custom API
Non-table based scripts
Accessible from Get
Post
Put
Patch
Delete
Same permissions as tables
Storage: What are our options?
Benefits: Non-relational structured storage
Massive scale-out
Tables Storage
Benefits: Big filesBlobs
Benefits: Persistent Async Messaging
Enqueue, Dequeue
Queues
Benefits: Relational database
Highly available
Managed for you as a service
SQL Database
Script Source Control
Handled through GIT repo
• Access to table, scheduler, custom API, shared scripts, and permissions
Shared Scripts
• Make scripts accessible from other scripts
• Just like creating Node.js modules NPM
• Ability to use ‘npm install module’ to download NPM modules
Mobile Services Tiers
Free Standard Premium
Usage Restrictions
Up to 10 services,Up to 500 Active
Devices*
N/A N/A
API Calls 500K (per subscription)
1.5M(per unit)
15M(per unit)
Scale N/A Up to 6 Standard units
Up to 10 Enterprise units
Scheduled Jobs
Limited Included Included
SQL Database (required)
20MB Included, Standard rates apply for more capacity
20MB Included, Standard rates apply
for more capacity
20MB Included, Standard rates apply for more capacity
Conclusions
Conclusions
il Cloud Computing è la piattaforma di riferimento per complementare la parte «client» di una App
Microsoft Azure è la piattaforma Cloud di riferimento per ricchezza di servizi e molteplicità di modelli per lo sviluppo
Azure Mobile Services sono una piattaforma che semplifica l’acceso al Cloud per chiunque voglia scrivere app… …avendo subito servizi di classe enterprise
…ma potrà scalare a modelli e livelli di servizio ancora più alti
Grazie!
www.slideshare.net/marco.parenzan
marco [dot] parenzan [at] libero/live [dot] it
www.innovazionefvg.net
@marco_parenzan
it.linkedin.com/in/marcoparenzan
www.facebook.com/parenzan.marco
www.marcoparenzan.it
www.slideshare.net/marco.parenzan
github.com/marcoparenzan
www.scoop.it/u/marco-parenzan
Q&A