Upload
taketoshi-yagishita
View
461
Download
3
Embed Size (px)
DESCRIPTION
MTDDC 2012 で好評(?)だったセッションの2013年バージョンです。Windows Azure 上でMovable Type を構築する時の様々なノウハウをご紹介します。
Citation preview
© 2013 Six Apart, Ltd. All rights reserved.
Azure と MT のフシギな関係 ~ 2013 夏バージョン ~
Windows Azure 上で Movable Type を構築する時のノウハウ
© 2013 Six Apart, Ltd. All rights reserved.
Infrastructure as Code
2
© 2013 Six Apart, Ltd. All rights reserved. 3
•起動時に実行する処理をプログラム化•プログラムをバージョン管理•容易なバージョン切替
© 2013 Six Apart, Ltd. All rights reserved.
構築の流れ
1. 管理ポータル上でリソースを作成2. 起動時に実行するプログラムを準備3. プログラムをパッケージ化4. 構築に必要なファイルをアップロード5. 管理ポータルでインスタンスを更新
4
© 2013 Six Apart, Ltd. All rights reserved. 5
© 2013 Six Apart, Ltd. All rights reserved.
•インスタンスのサイズや個数の指定•ウェブサーバー (IIS)の構成変更•アプリケーションの実行に必要な各種設定
•PowerShell スクリプティング言語6
スタートアップ タスク
© 2013 Six Apart, Ltd. All rights reserved. 7
<?xml version="1.0"?><ServiceConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" serviceName="mtdemo" osFamily="2" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"> <Role name="MovableTypeOnAzure"> <ConfigurationSettings> <Setting name="MovableType.Database" value="mtdb" /> <Setting name="MovableType.DBHost" value="XXXX.database.windows.net" /> <Setting name="MovableType.DBUser" value="mtadmin@XXXX" /> <Setting name="MovableType.DBPassword" value="XXXX" /> <Setting name="MovableType.ODBCDriver" value="SQL Server Native Client 11.0" /> <Setting name="MovableType.SiteURL" value="http://mtdemo.cloudapp.net/" /> <Setting name="MovableType.DefaultLanguage" value="ja" /> <Setting name="MovableType.AppPath" value="C:\mt" /> <Setting name="MovableType.DataPath" value="C:\webdata" /> <Setting name="MovableType.SubDirectories" value="contents,support_files" /> <Setting name="MovableType.SyncURI" value="https://mtdemo.blob.core.windows.net" /> <Setting name="MovableType.SyncKey" value="XXXX" /> <Setting name="Microsoft.IIS.BasicAuthCredentials" value="XXXX:XXXX!" /> <Setting name="Perl.Modules.Install" value="XXXX" /> </ConfigurationSettings> <Instances count="2" /> <Certificates> <Certificate name="SSLCert" thumbprint="XXXX" thumbprintAlgorithm="sha1" /> </Certificates> </Role></ServiceConfiguration>
© 2013 Six Apart, Ltd. All rights reserved. 8
####################################################################### create mt-config.cgi#printLog "## create mt-config.cgi"Set-Content $mt_config ''Add-Content $mt_config 'CGIPath /mt/'Add-Content $mt_config 'StaticWebPath /mt-static/'Add-Content $mt_config 'SupportDirectoryURL /support_files/'Add-Content $mt_config "StaticFilePath $mt_dir\mt-static"Add-Content $mt_config "SupportDirectoryPath $data_dir\support_files"Add-Content $mt_config "BaseSitePath $data_dir\contents"Add-Content $mt_config 'ImageDriver GD'Add-Content $mt_config 'ObjectDriver UMSSQLServer'Add-Content $mt_config 'EnabledCloudFunctions config_directives'
# database configuration$lists = 'Database', 'DBHost', 'DBUser', 'DBPassword', 'ODBCDriver', 'DefaultLanguage'Foreach ( $key in $lists ) { $val = $key + ' ' + $package::GetConfigurationSettingValue("MovableType." + $key) Add-Content $mt_config $val}
# 'TempDir' directive$val = 'TempDir ' + $package::GetLocalResource('TempStorage').RootPathAdd-Content $mt_config $val
© 2013 Six Apart, Ltd. All rights reserved. 9
プログラムのバージョン管理
•.cspkg 形式でパッケージ- Save-AzureServiceProjectPackage- 内部的には zip フォーマット
•名称をアップロード時に指定
© 2013 Six Apart, Ltd. All rights reserved. 10
© 2013 Six Apart, Ltd. All rights reserved. 11
構築する上での注意点
•インスタンスのサイズは medium- Perl/PHP を実行するインスタンス
•パッケージから MT/Perl は除外- ストレージの有効活用
•静的/動的のコンテンツをわけて処理- ストレージを簡易ウェブサーバーに利用可能