Movable Type 
for AWS 
JAWS-UG沖縄 CMS祭り! 
! 
2014.10.18 
YUJI TAKAYAMA@SIX APART
My Social 
icon 
YUJI TAKAYAMA 
Six Apart 
Senior Product Manager 
Movable Type Lead Engineer 
! 
Twitter: @yuji 
Facebook: Yuji Takayama 
Github: yuji 
Mail: ytakayama@sixapart.com
Happy 13th Anniversary
2001年 10 月 に Ver. 1.0 リリース 
2013年 10月 に Movable Type 6 リリース 
最新バージョンは 6.0.5 
Data API (JSON/REST API) 搭載 
CMS Platform / Application Platform
Six Apart によるテクニカルサポート有り 
開発者用ライセンスあります 
Movable Type for AWS 
Movable Type クラウド版 
Movable Type Advanced
agenda 
Movable Type “を” AWS で使う 
Movable Type “で” AWS を使う 
Movable Type + AWS の事例
Movable Type 
を “AWS” で使う
Install / Setup 
Movable Type
ファイル転送が途中で止まる 
FTP / SCP などで Movable Type のファイル 
をアップロード 
SSH? CPAN? 
足りない Perl モジュールのインストール 
MySQL にデータベSQL? 
ースを準備 
Movable Type のインストール 
パーミッション
まぁ手間ですよね
Movable Type 
for AWS
AWS Marketplace
All in one package 
Amazon Linux 2014.09 
Movable Type 6.0.5 
nginx 1.6.2 
starman(PSGI) 0.4009 
! 
MySQL 5.5 
Perl 5.16.3 
PHP-FPM 5.3.29 
2014.10.18 現在申請中 
必要なPerl モジュールもインストール済み
Features 
Free Tier Eligible 
7days Free Trial 
HVM / PV 
yum update movabletype 
Paid Technical Support (Japanese)
DEMO
Why Movable Type on AWS 
Software license fee: $0.07 / h 
All in one package 
Easy start / Easy update 
T2 Family
T2と相性いい? 
実際のところどうなの?
Benchmark 
記事数: 約3500件 
t2.micro, medium, c3.large, xlarge 
再構築勝負 (browser) 
Data API へ高負荷アタック(siege)
t2.micro - 再構築
t2.micro - Data API 
$ siege --concurrent=50 --reps=100 —time=10M 
! 
Transactions: 19,970 hits 
Availability: 100.00 % 
Elapsed time: 599.13 secs 
Data transferred: 128.19 MB 
Response time: 1.00 secs 
Transaction rate: 33.33 trans/sec 
Throughput: 0.21 MB/sec 
Concurrency: 33.30 
Successful transactions: 19,970 
Failed transactions: 0 
Longest transaction: 4.06 
Shortest transaction: 0.11
t2.medium - 再構築
t2.medium - Data API 
$ siege --concurrent=50 --reps=100 —time=10M 
! 
Transactions: 29,950 hits 
Availability: 100.00 % 
Elapsed time: 599.42 secs 
Data transferred: 196.27 MB 
Response time: 0.50 secs 
Transaction rate: 49.96 trans/sec 
Throughput: 0.33 MB/sec 
Concurrency: 25.13 
Successful transactions: 29,950 
Failed transactions: 0 
Longest transaction: 2.38 
Shortest transaction: 0.05
c3.large- 再構築
c3.large - Data API 
$ siege --concurrent=50 --reps=100 —time=10M 
! 
Transactions: 25,412 hits 
Availability: 100.00 % 
Elapsed time: 599.73 secs 
Data transferred: 169.31 MB 
Response time: 0.68 secs 
Transaction rate: 42.37 trans/sec 
Throughput: 0.28 MB/sec 
Concurrency: 28.80 
Successful transactions: 25,412 
Failed transactions: 0 
Longest transaction: 2.69 
Shortest transaction: 0.09
c3.xlarge- 再構築
c3.xlarge - Data API 
$ siege --concurrent=50 --reps=100 —time=10M 
! 
Transactions: 29,991 hits 
Availability: 100.00 % 
Elapsed time: 599.89 secs 
Data transferred: 195.08 MB 
Response time: 0.50 secs 
Transaction rate: 49.99 trans/sec 
Throughput: 0.33 MB/sec 
Concurrency: 25.10 
Successful transactions: 29,991 
Failed transactions: 0 
Longest transaction: 2.40 
Shortest transaction: 0.09
Result 
t2.medium, c3.xlarge > c3.large > t2.micro
T2 medium 最高
Movable Type 
for AWS の勘所
Starman の Worker数 
初期設定では Worker 数は 2 
運用環境に応じて適宜変更 
リクエストへの応答が Timeout す 
るようなら増やす契機
環境設定ファイルを編集 
$ sudo vi /data/conf/movabletype.conf 
WORKERS の値を適切な値に変更 
PORT="5000" 
WORKERS=“2" 
movabletype のプロセスを再起動 
$ sudo /etc/init.d/movabletype restart
Process 監視 
初期導入ではプロセス監視はなし 
適宜管理ツールの導入を 
Monit とか
yum で monit をインストール 
$ sudo yum install monit 
nginx用の監視設定 
$ sudo vi /etc/monit.d/nginx 
check process nginx with pidfile /var/run/nginx.pid 
start program = "/etc/init.d/nginx start" 
stop program = "/etc/init.d/nginx stop" 
movable type用の監視設定 
$ sudo vi /etc/monit.d/nginx 
check process movabletype with pidfile /app/run/movabletype.pid 
start program = "/etc/init.d/movabletype start" 
stop program = "/etc/init.d/movabletype stop"
cpan モジュール 
yum で提供されているものはyumからイ 
ンストール 
ただし、バージョンが古いことが多い 
yumにない場合、自分で入れる場合は 
cpanmおすすめ
yum で cpanm をインストール 
$ sudo yum install perl-App-cpanminus 
cpan モジュールのインストール 
$ sudo cpanm Text::SimpleTable 
movabletype のプロセスを再起動 
$ sudo /etc/init.d/movabletype restart
Movable Type 
で “AWS” を使う
AWS のサービスと 
組み合わせてみる
S3 を使う
MT 
静的ファイルを 
すべて配信 
Direct Hosting 
静的生成S3 である 
EC2 
アプリケーションとコンテンツの分離 
Visitors Admin
S3 に配信するには? 
S3FS + rsync 
AWS CLI S3 sync + lsyncd
http://tec.toi-planning.net/mt/amazon/mt-amazons3/
S3 に配信するには? 
S3FS + rsync 
AWS CLI S3 sync + lsyncd 
Movable Type Plugin 
再構築をトリガーに S3 に配信
S3 + CloudFrontを使う
MT 
静的ファイルを 
すべて配信 
S3 EC2 
Visitors 
Cache Distribution 
S3 
世界各地にエッジサーバー 
キャッシュコントロールが必要 
Admin 
CloudFront 
Edge Server 
CloudFront 
Edge Server 
CloudFront 
Edge Server 
Visitors Visitors
MT 
EC2 
S3 
画像など変更が少ない 
静的ファイルを配信 
Admin 
更新が掛かるHTMLを配信 
Cache Distribution + Web Storage 
Cache Distribution 
CloudFront 
Edge Server 
Visitors 
CloudFront 
Edge Server 
CloudFront 
Edge Server 
Visitors Visitors 
Web 
EC2 
キャッシュコントロールを併用
RDS (MySQL)を使う
ELB 
出力ファイルは、 
Data API 
RDS 
Zone 1a 
MT 
EC2 
MT 
EC2 
MT 
EC2 
を複数台用意するとか 
RDS 
Zone 1b 
Replication
MT で RDS を使うには? 
mt-config.cgi に書くだけ 
DBHost mt.c9pv2bda4o…ds.amazonaws.com 
Database mt 
DBPort 3306 
DBUser master 
DBPassword password
ElastiCache (memcahced) 
を使う
MT 
EC2 
RDS 
ElastiCache 
(Memcached) 
DB Cache 
Movable Type 
Auto-Discovery
MT で ElastiCache を使うには? 
mt-config.cgi に書くだけ 
MemcachedServers mt.c9pvo…ds.amazonaws.com:11211 
MemcachedServers mt.c8ffga…ds.amazonaws.com:11211
SESでメール配信
MT 
EC2 
Movable Type 
SES 
SMTP Interface 
メール配信をスケール 
メールマガジン
MT で SES を使うには? 
mt-config.cgi に書くだけ 
MailTransfer smtp 
SMTPServer email-smtp.us-east-1.amazonaws.com 
SMTPPort 587 
SMTPUser your-iam-annout 
SMTPPassword your-iam-password 
SMTPAuth starttls
AWS + Movable Type 
Case Study
- Case Study 1 - 
! 
Event Web Site
北海道の人気 
なんとかどうでしょう 
大人の事情 
去年開催されたイベント用サイト
MT 
EC2 
S3 
画像ファイルを配置 
Admin 
イベント期間中は、負荷状況に応じて 
S3 
動的に切り替えて運用 
CloudFront 
Edge Server 
Visitors 
CloudFront 
Edge Server 
CloudFront 
Edge Server 
HTMLを配置 
Visitors Visitors 
Web 
EC2 
Web 
EC2 
Web 
EC2 
ELB
Movable Type on EC2 + S3 + CloudFront 
動的生成では膨大なサーバ負荷が予想された 
Yahoo! Japan、新聞掲載によるトラフィック増 
イベント中も更新が随時発生する 
イベント参加者もスマフォで閲覧している
Movable Type on EC2 + S3 + CloudFront 
HTML は EC2 に配置、画像などは S3 に配置 
アクセス状況に応じて、CloudFront へ切り替え 
現場で迅速な対応が求められる 
AWS を採用することで臨機応変に対応可能
Movable Type on EC2 + S3 + CloudFront 
イベント終了後は、AWS から、自社サーバ内にコ 
ンテンツを収容して、イベントサイトは残しつつ、 
コストを掛けない運用に切り替え 
Movable Type が出力した静的ファイルをすべて 
移動することで対応
- Case Study 2 - 
! 
Data API
COACH UNITED 
http://www.sixapart.jp/business/coach_united.html
Movable Type for AWS + Data API 
記事の増加による再構築のコストも nginx + PSGIで 
解決 
高トラフィックへの対応 
スマフォ向けサイトも併用 
Data API による Infinite Scroll
- Case Study 3 - 
! 
EC Site
某アウトドア用品メーカー 
EC 大人の事情
By NetConcierge Co.,LTD. 
https://netconcierge.jp/mtcommerce/
株式会社ネットコンシェルジェの製品 
MT で本格的な EC サイトを構築 
実際に多数の EC サイトを構築
Admin 
Visitors 
ELB 
RDS 
Web 
App 
EC2 
Master Server 
再構築 
メール送信 
非セール時、最小構成で運用 
ELB + EC2 + RDS 
1インスタンスで管理画面、ウェブサイト、 
再構築、メール送信をおこなう
Admin 
CloudWatch + Alarm 
セール時、冗長構成で運用 
WebApp + Master + Task + ELB + RDS 
再構築、メール送信をタスクサーバに一元 
各サーバは 
memcached 
ELB 
Visitors 
RDS 
Web 
App 
EC2 
再構築 
メール送信 
Task 
Server 
EC2 
memcached 
Master 
Server 
EC2 
Web 
App 
EC2 
Web 
App 
EC2 
Visitors Visitors Visitors Visitors
Movable Type
自分でメンテしたくない(*´Д`) 
そんなあなたには、Movable Type クラウド版
告知
沖縄上陸記念 
MT Live in OKINAWA
MT Live in OKINAWA 
開催日時: 2014年 10月 19日 (日) 13:00 ~ 18:00 
開催地: Tab’spot さん 
参加費: 無料 
内容: MT ユーザーの交流、お悩み相談、陳情、  
お友達募集 などなんでもどうぞ。       
ミニセッションもアリマス
Thank you for listening

Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

  • 1.
    Movable Type forAWS JAWS-UG沖縄 CMS祭り! ! 2014.10.18 YUJI TAKAYAMA@SIX APART
  • 2.
    My Social icon YUJI TAKAYAMA Six Apart Senior Product Manager Movable Type Lead Engineer ! Twitter: @yuji Facebook: Yuji Takayama Github: yuji Mail: ytakayama@sixapart.com
  • 4.
  • 5.
    2001年 10 月に Ver. 1.0 リリース 2013年 10月 に Movable Type 6 リリース 最新バージョンは 6.0.5 Data API (JSON/REST API) 搭載 CMS Platform / Application Platform
  • 6.
    Six Apart によるテクニカルサポート有り 開発者用ライセンスあります Movable Type for AWS Movable Type クラウド版 Movable Type Advanced
  • 7.
    agenda Movable Type“を” AWS で使う Movable Type “で” AWS を使う Movable Type + AWS の事例
  • 8.
    Movable Type を“AWS” で使う
  • 9.
    Install / Setup Movable Type
  • 10.
    ファイル転送が途中で止まる FTP /SCP などで Movable Type のファイル をアップロード SSH? CPAN? 足りない Perl モジュールのインストール MySQL にデータベSQL? ースを準備 Movable Type のインストール パーミッション
  • 11.
  • 12.
  • 14.
  • 15.
    All in onepackage Amazon Linux 2014.09 Movable Type 6.0.5 nginx 1.6.2 starman(PSGI) 0.4009 ! MySQL 5.5 Perl 5.16.3 PHP-FPM 5.3.29 2014.10.18 現在申請中 必要なPerl モジュールもインストール済み
  • 16.
    Features Free TierEligible 7days Free Trial HVM / PV yum update movabletype Paid Technical Support (Japanese)
  • 17.
  • 18.
    Why Movable Typeon AWS Software license fee: $0.07 / h All in one package Easy start / Easy update T2 Family
  • 19.
  • 20.
    Benchmark 記事数: 約3500件 t2.micro, medium, c3.large, xlarge 再構築勝負 (browser) Data API へ高負荷アタック(siege)
  • 21.
  • 22.
    t2.micro - DataAPI $ siege --concurrent=50 --reps=100 —time=10M ! Transactions: 19,970 hits Availability: 100.00 % Elapsed time: 599.13 secs Data transferred: 128.19 MB Response time: 1.00 secs Transaction rate: 33.33 trans/sec Throughput: 0.21 MB/sec Concurrency: 33.30 Successful transactions: 19,970 Failed transactions: 0 Longest transaction: 4.06 Shortest transaction: 0.11
  • 24.
  • 25.
    t2.medium - DataAPI $ siege --concurrent=50 --reps=100 —time=10M ! Transactions: 29,950 hits Availability: 100.00 % Elapsed time: 599.42 secs Data transferred: 196.27 MB Response time: 0.50 secs Transaction rate: 49.96 trans/sec Throughput: 0.33 MB/sec Concurrency: 25.13 Successful transactions: 29,950 Failed transactions: 0 Longest transaction: 2.38 Shortest transaction: 0.05
  • 27.
  • 28.
    c3.large - DataAPI $ siege --concurrent=50 --reps=100 —time=10M ! Transactions: 25,412 hits Availability: 100.00 % Elapsed time: 599.73 secs Data transferred: 169.31 MB Response time: 0.68 secs Transaction rate: 42.37 trans/sec Throughput: 0.28 MB/sec Concurrency: 28.80 Successful transactions: 25,412 Failed transactions: 0 Longest transaction: 2.69 Shortest transaction: 0.09
  • 30.
  • 31.
    c3.xlarge - DataAPI $ siege --concurrent=50 --reps=100 —time=10M ! Transactions: 29,991 hits Availability: 100.00 % Elapsed time: 599.89 secs Data transferred: 195.08 MB Response time: 0.50 secs Transaction rate: 49.99 trans/sec Throughput: 0.33 MB/sec Concurrency: 25.10 Successful transactions: 29,991 Failed transactions: 0 Longest transaction: 2.40 Shortest transaction: 0.09
  • 33.
    Result t2.medium, c3.xlarge> c3.large > t2.micro
  • 34.
  • 35.
    Movable Type forAWS の勘所
  • 36.
    Starman の Worker数 初期設定では Worker 数は 2 運用環境に応じて適宜変更 リクエストへの応答が Timeout す るようなら増やす契機
  • 37.
    環境設定ファイルを編集 $ sudovi /data/conf/movabletype.conf WORKERS の値を適切な値に変更 PORT="5000" WORKERS=“2" movabletype のプロセスを再起動 $ sudo /etc/init.d/movabletype restart
  • 38.
    Process 監視 初期導入ではプロセス監視はなし 適宜管理ツールの導入を Monit とか
  • 39.
    yum で monitをインストール $ sudo yum install monit nginx用の監視設定 $ sudo vi /etc/monit.d/nginx check process nginx with pidfile /var/run/nginx.pid start program = "/etc/init.d/nginx start" stop program = "/etc/init.d/nginx stop" movable type用の監視設定 $ sudo vi /etc/monit.d/nginx check process movabletype with pidfile /app/run/movabletype.pid start program = "/etc/init.d/movabletype start" stop program = "/etc/init.d/movabletype stop"
  • 40.
    cpan モジュール yumで提供されているものはyumからイ ンストール ただし、バージョンが古いことが多い yumにない場合、自分で入れる場合は cpanmおすすめ
  • 41.
    yum で cpanmをインストール $ sudo yum install perl-App-cpanminus cpan モジュールのインストール $ sudo cpanm Text::SimpleTable movabletype のプロセスを再起動 $ sudo /etc/init.d/movabletype restart
  • 42.
    Movable Type で“AWS” を使う
  • 43.
  • 45.
  • 46.
    MT 静的ファイルを すべて配信 Direct Hosting 静的生成S3 である EC2 アプリケーションとコンテンツの分離 Visitors Admin
  • 47.
    S3 に配信するには? S3FS+ rsync AWS CLI S3 sync + lsyncd
  • 48.
  • 49.
    S3 に配信するには? S3FS+ rsync AWS CLI S3 sync + lsyncd Movable Type Plugin 再構築をトリガーに S3 に配信
  • 50.
  • 51.
    MT 静的ファイルを すべて配信 S3 EC2 Visitors Cache Distribution S3 世界各地にエッジサーバー キャッシュコントロールが必要 Admin CloudFront Edge Server CloudFront Edge Server CloudFront Edge Server Visitors Visitors
  • 52.
    MT EC2 S3 画像など変更が少ない 静的ファイルを配信 Admin 更新が掛かるHTMLを配信 Cache Distribution + Web Storage Cache Distribution CloudFront Edge Server Visitors CloudFront Edge Server CloudFront Edge Server Visitors Visitors Web EC2 キャッシュコントロールを併用
  • 53.
  • 54.
    ELB 出力ファイルは、 DataAPI RDS Zone 1a MT EC2 MT EC2 MT EC2 を複数台用意するとか RDS Zone 1b Replication
  • 55.
    MT で RDSを使うには? mt-config.cgi に書くだけ DBHost mt.c9pv2bda4o…ds.amazonaws.com Database mt DBPort 3306 DBUser master DBPassword password
  • 56.
  • 57.
    MT EC2 RDS ElastiCache (Memcached) DB Cache Movable Type Auto-Discovery
  • 58.
    MT で ElastiCacheを使うには? mt-config.cgi に書くだけ MemcachedServers mt.c9pvo…ds.amazonaws.com:11211 MemcachedServers mt.c8ffga…ds.amazonaws.com:11211
  • 59.
  • 60.
    MT EC2 MovableType SES SMTP Interface メール配信をスケール メールマガジン
  • 61.
    MT で SESを使うには? mt-config.cgi に書くだけ MailTransfer smtp SMTPServer email-smtp.us-east-1.amazonaws.com SMTPPort 587 SMTPUser your-iam-annout SMTPPassword your-iam-password SMTPAuth starttls
  • 62.
    AWS + MovableType Case Study
  • 63.
    - Case Study1 - ! Event Web Site
  • 64.
    北海道の人気 なんとかどうでしょう 大人の事情 去年開催されたイベント用サイト
  • 65.
    MT EC2 S3 画像ファイルを配置 Admin イベント期間中は、負荷状況に応じて S3 動的に切り替えて運用 CloudFront Edge Server Visitors CloudFront Edge Server CloudFront Edge Server HTMLを配置 Visitors Visitors Web EC2 Web EC2 Web EC2 ELB
  • 66.
    Movable Type onEC2 + S3 + CloudFront 動的生成では膨大なサーバ負荷が予想された Yahoo! Japan、新聞掲載によるトラフィック増 イベント中も更新が随時発生する イベント参加者もスマフォで閲覧している
  • 67.
    Movable Type onEC2 + S3 + CloudFront HTML は EC2 に配置、画像などは S3 に配置 アクセス状況に応じて、CloudFront へ切り替え 現場で迅速な対応が求められる AWS を採用することで臨機応変に対応可能
  • 68.
    Movable Type onEC2 + S3 + CloudFront イベント終了後は、AWS から、自社サーバ内にコ ンテンツを収容して、イベントサイトは残しつつ、 コストを掛けない運用に切り替え Movable Type が出力した静的ファイルをすべて 移動することで対応
  • 69.
    - Case Study2 - ! Data API
  • 70.
  • 71.
    Movable Type forAWS + Data API 記事の増加による再構築のコストも nginx + PSGIで 解決 高トラフィックへの対応 スマフォ向けサイトも併用 Data API による Infinite Scroll
  • 72.
    - Case Study3 - ! EC Site
  • 73.
  • 74.
    By NetConcierge Co.,LTD. https://netconcierge.jp/mtcommerce/
  • 75.
    株式会社ネットコンシェルジェの製品 MT で本格的なEC サイトを構築 実際に多数の EC サイトを構築
  • 76.
    Admin Visitors ELB RDS Web App EC2 Master Server 再構築 メール送信 非セール時、最小構成で運用 ELB + EC2 + RDS 1インスタンスで管理画面、ウェブサイト、 再構築、メール送信をおこなう
  • 77.
    Admin CloudWatch +Alarm セール時、冗長構成で運用 WebApp + Master + Task + ELB + RDS 再構築、メール送信をタスクサーバに一元 各サーバは memcached ELB Visitors RDS Web App EC2 再構築 メール送信 Task Server EC2 memcached Master Server EC2 Web App EC2 Web App EC2 Visitors Visitors Visitors Visitors
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
    MT Live inOKINAWA 開催日時: 2014年 10月 19日 (日) 13:00 ~ 18:00 開催地: Tab’spot さん 参加費: 無料 内容: MT ユーザーの交流、お悩み相談、陳情、  お友達募集 などなんでもどうぞ。       ミニセッションもアリマス
  • 84.
    Thank you forlistening