開放源碼技術如何運用 windows azure 平台

27
開開開開開開開開開開 WINDOWS AZURE 開開 Eric ShangKuan ( 開開開開 ) Technical Evangelist Microsoft Facebook: @EricSkript Twitter: @ericsk

Upload: rae-garza

Post on 01-Jan-2016

85 views

Category:

Documents


0 download

DESCRIPTION

開放源碼技術如何運用 Windows Azure 平台. Eric ShangKuan ( 上官林傑 ) Technical Evangelist Microsoft Facebook: @ EricSkript Twitter: @ ericsk. 大綱. 跨平台命令列工具:使用、整合及擴充 使用網站服務 使用儲存體服務 管理 Windows Azure 其它未提及的服務. 跨平台命令列工具. 支援 Windows 、 Mac 、 Linux. 使用命令列執行 Windows Azure 操作 ( 如 : 建立網站、擴充虛擬機器資源等 ) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 開放源碼技術如何運用  Windows Azure  平台

開放源碼技術如何運用 WINDOWS AZURE 平台Eric ShangKuan ( 上官林傑 )Technical EvangelistMicrosoft

Facebook: @EricSkriptTwitter: @ericsk

Page 2: 開放源碼技術如何運用  Windows Azure  平台

大綱• 跨平台命令列工具:使用、整合及擴充• 使用網站服務• 使用儲存體服務• 管理 Windows Azure• 其它未提及的服務

Page 3: 開放源碼技術如何運用  Windows Azure  平台

跨平台命令列工具

Page 4: 開放源碼技術如何運用  Windows Azure  平台

支援 Windows 、 Mac 、 Linux

• 使用命令列執行 Windows Azure 操作 ( 如 : 建立網站、擴充虛擬機器資源等 )

• 可結合其它 script 進行操作• 命令列工具以 node.js 寫成,相依 :

Azure SDK for Node.js• 使用教學 :

http://www.windowsazure.com/en-us/manage/linux/how-to-guides/command-line-tools/

• 原始碼可以參考:https://github.com/WindowsAzure/azure-sdk-tools-xplat https://github.com/WindowsAzure/azure-sdk-for-node

Page 5: 開放源碼技術如何運用  Windows Azure  平台

使用命令列建立 Website# 先下載帳號設定檔$ azure account download

# 此時會開瀏覽器登入 Windows Azure 下載 publisher settings 檔案$ azure account import <PublisherSettings 檔案 >

...

# 建立一個放在東亞的網站 , 可以交談式操作也可以直接用參數下# 以下指令會建立一個 website, 用 git 部署 ,

$ azure site create azuredaydemo --git --location "East Asia"

...

...

help: Please provide the username for Git deployment.

Publishing username: ericsk

...

Page 6: 開放源碼技術如何運用  Windows Azure  平台

demo

Windows Azure 命令列工具 (Mac OSX)

Page 7: 開放源碼技術如何運用  Windows Azure  平台

自訂或擴充命令列工具• 修改 /usr/local/azure ( 或安裝路徑 ) 下的相關檔案• 從 github 下載需搭配 azure-sdk-for-node 以及 azure-

sdk-tools-xplat 這兩個專案• 修改原則:

• 命令列選項、操作邏輯是修改 azure-sdk-tools-xplat• 與 Windows Azure 溝通或是 REST API 的操作則是

修改 azure-sdk-for-node 的部份

Page 8: 開放源碼技術如何運用  Windows Azure  平台

Windows Azure 網站服務

Page 9: 開放源碼技術如何運用  Windows Azure  平台

立刻上線的網站服務• 支援 ASP.NET 、 PHP 、 Node.js 以及 Python 所寫成的網站

應用程式• ASP.NET 3.5, 4.5• PHP 5.3, 5.4• Node.js 使用 iisnode 來運作 , 支援 0.6.17, 0.6.20 或 0.8.4• Python 則透過 Python 2.7 以及 wfastcgi.py

• 可透過 Web Deploy 、 FTP 、 Dropbox 、 TFS 、 Git 、 Mercurial 等方式部署網站

• 有免費、共享、保留模式• 支援 auto-scale 以應付需求

Page 10: 開放源碼技術如何運用  Windows Azure  平台

使用版本控制部署網站可以切換各個 Repositories 作上線

Page 11: 開放源碼技術如何運用  Windows Azure  平台

demo

使用 Git 部署 PHP 網站到 Windows Azure 網站服務

Page 12: 開放源碼技術如何運用  Windows Azure  平台

Windows Azure 虛擬機器服務

Page 13: 開放源碼技術如何運用  Windows Azure  平台

demo

Windows Azure 虛擬機器服務設定

Page 14: 開放源碼技術如何運用  Windows Azure  平台

Windows Azure 儲存體服務

Page 15: 開放源碼技術如何運用  Windows Azure  平台

Windows Azure Storage

• 提供 Blob storage service, Table Service (nosql), 以及 Queue service

• 提供權限管理• 提供 REST API 存取• 提供地理複寫 (geo-replication) 以提升檔

案可用度

Page 16: 開放源碼技術如何運用  Windows Azure  平台

Blob Storage 結構

Page 17: 開放源碼技術如何運用  Windows Azure  平台

範例:上傳檔案至 Windows Azure Blob Storage (PHP)<?php

# 按照說明安裝 Windows Azure SDK for PHP

require_once 'vendor/autoload.php';

use WindowsAzure\Common\ServicesBuilder;

use WindowsAzure\Blob\Models\CreateBlobOptions;

use WindowsAzure\Common\ServiceException;

# 建立 blob service instance 進行操作$blobRestProxy = ServicesBuilder::getInstance()->createBlobService(<connection string>);

# 讀取上傳的檔案$file = fopen($_FILES['file']['tmp_name’], 'r');

$blobName = $_FILES['file']['name'];

# 設定 blob storage 的屬性$createBlobOptions = new CreateBlobOptions();

$createBlobOptions->setBlobContentType('image/jpeg');

# 上傳檔案$blobRestProxy->createBlockBlob(<container name>, $blobName, $file, $createBlobOptions);

Page 18: 開放源碼技術如何運用  Windows Azure  平台

demo

使用 Windows Azure SDK for PHP 來存取 Windows Azure 儲存服務的檔案

Page 19: 開放源碼技術如何運用  Windows Azure  平台

Windows Azure Service Bus

Page 20: 開放源碼技術如何運用  Windows Azure  平台

Windows Azure Service Bus 總覽

MessagingQueuing Pub/SubReliable Transfer

Reliable, transaction-aware cloud messaging infrastructure for business apps.

NotificationMultiplatformEasily Scale out

Push notifications to large number of mobile devices.

ConnectivityService RelayProtocol Tunnel Eventing

Rich options for interconnecting apps across network boundaries

Integration RoutingCoordination Transformation

Content-based routing, document transformation, and process coordination.

Svc Management Naming, DiscoveryMonitoring

Consistent management surface and service observation capabilities

Page 21: 開放源碼技術如何運用  Windows Azure  平台

跨應用程式類型、雲端或機房

也可使用 AMQP 1.0 協定傳輸

Page 22: 開放源碼技術如何運用  Windows Azure  平台

各種通訊方式

Queue

Queue

TopicSubSubSub

Page 23: 開放源碼技術如何運用  Windows Azure  平台

demo

使用 Windows Azure SDK 處理訊息佇列的傳遞 (PHP & Python)

Page 24: 開放源碼技術如何運用  Windows Azure  平台

還有什麼沒提到的服務?• Windows Azure Media Services• Windows Azure Mobile Services• Windows Azure Notification Hubs• Windows Azure HDInsight (Hadoop)• Windows Azure Service Management

API

Page 25: 開放源碼技術如何運用  Windows Azure  平台

回想一下• Windows Azure 是一大堆雲端服務的集合• 很多服務都有提供 REST API 來操作• 先找找 http://github.com/WindowsAzure

看看有沒有工具或 SDK

Page 26: 開放源碼技術如何運用  Windows Azure  平台

http://www.windowsazure.com/zh-tw/

Page 27: 開放源碼技術如何運用  Windows Azure  平台

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.