movable type for aws - jaws-ug 沖縄 cms祭り!

84
Movable Type for AWS JAWS-UG沖縄 CMS祭り! 2014.10.18 YUJI TAKAYAMA@SIX APART

Upload: yuji-takayama

Post on 30-Jun-2015

1.510 views

Category:

Engineering


8 download

DESCRIPTION

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

TRANSCRIPT

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

Movable Type for AWS

JAWS-UG沖縄 CMS祭り! !

2014.10.18 YUJI TAKAYAMA@SIX APART

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

YUJI TAKAYAMASix Apart

Senior Product Manager Movable Type Lead Engineer

!Twitter: @yuji

Facebook: Yuji Takayama Github: yuji

Mail: [email protected]

My Social

icon

Page 3: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 4: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

Happy 13th Anniversary

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

2001年 10 月 に Ver. 1.0 リリース

2013年 10月 に Movable Type 6 リリース

最新バージョンは 6.0.5

Data API (JSON/REST API) 搭載

CMS Platform / Application Platform

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

Six Apart によるテクニカルサポート有り

開発者用ライセンスあります

Movable Type for AWS

Movable Type クラウド版

Movable Type Advanced

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

agenda

Movable Type “を” AWS で使う

Movable Type “で” AWS を使う

Movable Type + AWS の事例

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

Movable Type を “AWS” で使う

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

Install / Setup Movable Type

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

FTP / SCP などで Movable Type のファイルをアップロード

足りない Perl モジュールのインストール

MySQL にデータベースを準備

Movable Type のインストール

ファイル転送が途中で

止まる

SSH? CPAN?

SQL?

パーミッション

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

まぁ手間ですよね

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

Movable Type for AWS

Page 13: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 14: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

AWS Marketplace

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

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 モジュールもインストール済み

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

Features

Free Tier Eligible

7days Free Trial

HVM / PV

yum update movabletype

Paid Technical Support (Japanese)

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

DEMO

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

Why Movable Type on AWS

Software license fee: $0.07 / h

All in one package

Easy start / Easy update

T2 Family

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

T2と相性いい?

実際のところどうなの?

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

Benchmark

記事数: 約3500件

t2.micro, medium, c3.large, xlarge

再構築勝負 (browser)

Data API へ高負荷アタック(siege)

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

t2.micro - 再構築

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

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

Page 23: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 24: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

t2.medium - 再構築

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

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

Page 26: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 27: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

c3.large- 再構築

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

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

Page 29: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 30: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

c3.xlarge- 再構築

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

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

Page 32: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 33: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

Result

t2.medium, c3.xlarge > c3.large > t2.micro

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

T2 medium 最高

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

Movable Type for AWS の勘所

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

Starman の Worker数初期設定では Worker 数は 2

運用環境に応じて適宜変更

リクエストへの応答が Timeout するようなら増やす契機

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

環境設定ファイルを編集 $ sudo vi /data/conf/movabletype.conf

WORKERS の値を適切な値に変更

PORT="5000" WORKERS=“2"

movabletype のプロセスを再起動

$ sudo /etc/init.d/movabletype restart

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

Process 監視初期導入ではプロセス監視はなし

適宜管理ツールの導入を

Monit とか

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

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"

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

cpan モジュールyum で提供されているものはyumからインストール

ただし、バージョンが古いことが多い

yumにない場合、自分で入れる場合はcpanmおすすめ

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

yum で cpanm をインストール

$ sudo yum install perl-App-cpanminus

cpan モジュールのインストール

$ sudo cpanm Text::SimpleTable

movabletype のプロセスを再起動

$ sudo /etc/init.d/movabletype restart

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

Movable Type で “AWS” を使う

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

AWS のサービスと

組み合わせてみる

Page 44: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 45: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

S3 を使う

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

MT

EC2S3

静的ファイルを すべて配信

Visitors Admin

Direct Hosting

静的生成であるアプリケーションとコンテンツの分離

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

S3 に配信するには?

S3FS + rsync

AWS CLI S3 sync + lsyncd

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

http://tec.toi-planning.net/mt/amazon/mt-amazons3/

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

S3 に配信するには?

S3FS + rsync

AWS CLI S3 sync + lsyncd

Movable Type Plugin

再構築をトリガーに S3 に配信

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

S3 + CloudFrontを使う

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

MT

EC2S3

静的ファイルを すべて配信

VisitorsAdmin

CloudFront Edge Server

CloudFront Edge Server

CloudFront Edge Server

Visitors Visitors

Cache Distribution

S3

世界各地にエッジサーバーキャッシュコントロールが必要

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

MT

EC2S3

画像など変更が少ない 静的ファイルを配信

Admin

Visitors

CloudFront Edge Server

CloudFront Edge Server

CloudFront Edge Server

Visitors Visitors

Web

EC2

更新が掛かるHTMLを配信

Cache Distribution + Web Storage

Cache Distribution

キャッシュコントロールを併用

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

RDS (MySQL)を使う

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

ELB

RDS

Zone 1a

MT

EC2

MT

EC2

MT

EC2

Zone 1b

RDS

Replication

出力ファイルは、を複数台用意するとか

Data API

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

MT で RDS を使うには?

mt-config.cgi に書くだけDBHost mt.c9pv2bda4o…ds.amazonaws.com Database mt DBPort 3306 DBUser master DBPassword password

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

ElastiCache (memcahced)を使う

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

RDS

MT

EC2

ElastiCache (Memcached)

DB Cache

Movable Type

Auto-Discovery

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

MT で ElastiCache を使うには?

mt-config.cgi に書くだけ

MemcachedServers mt.c9pvo…ds.amazonaws.com:11211 MemcachedServers mt.c8ffga…ds.amazonaws.com:11211

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

SESでメール配信

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

MT

EC2

SES

SMTP InterfaceMovable Type

メール配信をスケールメールマガジン

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

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

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

AWS + Movable Type Case Study

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

- Case Study 1 - !

Event Web Site

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

北海道の人気なんとかどうでしょう

去年開催されたイベント用サイト大人の事情

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

MT

EC2S3

画像ファイルを配置

Admin

Visitors

CloudFront Edge Server

CloudFront Edge Server

CloudFront Edge Server

Visitors Visitors

Web

EC2

HTMLを配置

Web

EC2

Web

EC2

ELB

イベント期間中は、負荷状況に応じてS3

動的に切り替えて運用

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

Movable Type on EC2 + S3 + CloudFront

動的生成では膨大なサーバ負荷が予想された

Yahoo! Japan、新聞掲載によるトラフィック増

イベント中も更新が随時発生する

イベント参加者もスマフォで閲覧している

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

Movable Type on EC2 + S3 + CloudFront

HTML は EC2 に配置、画像などは S3 に配置

アクセス状況に応じて、CloudFront へ切り替え

現場で迅速な対応が求められる

AWS を採用することで臨機応変に対応可能

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

Movable Type on EC2 + S3 + CloudFront

イベント終了後は、AWS から、自社サーバ内にコンテンツを収容して、イベントサイトは残しつつ、コストを掛けない運用に切り替え

Movable Type が出力した静的ファイルをすべて移動することで対応

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

- Case Study 2 - !

Data API

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

COACH UNITED http://www.sixapart.jp/business/coach_united.html

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

Movable Type for AWS + Data API

記事の増加による再構築のコストも nginx + PSGIで解決

高トラフィックへの対応

スマフォ向けサイトも併用

Data API による Infinite Scroll

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

- Case Study 3 - !

EC Site

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

某アウトドア用品メーカーEC大人の事情

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

https://netconcierge.jp/mtcommerce/

By NetConcierge Co.,LTD.

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

株式会社ネットコンシェルジェの製品

MT で本格的な EC サイトを構築

実際に多数の EC サイトを構築

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

Admin

Visitors

ELB

RDS

Web App

EC2 Master Server

再構築

メール送信

非セール時、最小構成で運用ELB + EC2 + RDS

1インスタンスで管理画面、ウェブサイト、再構築、メール送信をおこなう

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

Admin

Visitors

ELB

RDS

Web App

EC2

再構築

メール送信

Task Server

EC2

memcached

Master Server

EC2

Web App

EC2

Web App

EC2

Visitors Visitors Visitors Visitors

セール時、冗長構成で運用WebApp + Master + Task + ELB + RDS

再構築、メール送信をタスクサーバに一元各サーバはmemcached

CloudWatch + Alarm

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

Movable Type

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

自分でメンテしたくない(*´Д`)そんなあなたには、Movable Type クラウド版

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

告知

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

沖縄上陸記念 MT Live in OKINAWA

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

MT Live in OKINAWA

開催日時: 2014年 10月 19日 (日) 13:00 ~ 18:00

開催地: Tab’spot さん

参加費: 無料

内容: MT ユーザーの交流、お悩み相談、陳情、 お友達募集 などなんでもどうぞ。      ミニセッションもアリマス

Page 83: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!
Page 84: Movable Type for AWS - JAWS-UG 沖縄 CMS祭り!

Thank you for listening