35
株式会社CMSコミュニケーションズ 1 Plone + AWS スケールアウト可能な ハイパフォーマンスPloneサイトを クラウドに構築 Manabu TERADA 2015/6/13 Plone Symposium Tokyo 2015 株式会社CMSコミュニケーションズ

Plone + AWS at Plone Symposium tokyo 2015

Embed Size (px)

Citation preview

Page 1: Plone + AWS at Plone Symposium tokyo 2015

株式会社CMSコミュニケーションズ

1

Plone + AWS スケールアウト可能な

ハイパフォーマンスPloneサイトを クラウドに構築Manabu TERADA

2015/6/13

Plone Symposium Tokyo 2015

株式会社CMSコミュニケーションズ

Page 2: Plone + AWS at Plone Symposium tokyo 2015

@terapyon

Owner of CMS communications Inc.

Chair of PyCon APAC 2013 in Japan

Plone Foundation Ambassador

Member of NVDA Japanese Team

About me株式会社CMSコミュニケーションズ

Manabu TERADA

We use Plone for building web site

Universities, Public institutions

Engineering company

Supporting education tools

CMScom

2

Page 3: Plone + AWS at Plone Symposium tokyo 2015

Case Study by us株式会社CMSコミュニケーションズ

http://www.osaka-u.ac.jp/

http://todai.tv/

http://www.osaka-cu.ac.jp/

http://ocw.kyoto-u.ac.jp/

http://ocw.osaka-u.ac.jp/

https://crdeg2.cf.ocha.ac.jp/ocha/plone

https://my.osaka-u.ac.jp/ (need login)

http://typemoon.com/

3

Page 4: Plone + AWS at Plone Symposium tokyo 2015

Case Study by us株式会社CMSコミュニケーションズ 4

Page 5: Plone + AWS at Plone Symposium tokyo 2015

Case Study by us株式会社CMSコミュニケーションズ 5

Page 6: Plone + AWS at Plone Symposium tokyo 2015

Case Study by us株式会社CMSコミュニケーションズ 6

Page 7: Plone + AWS at Plone Symposium tokyo 2015

株式会社CMSコミュニケーションズ

Small system / Large system / System elements システム構成の例

2

3

1System structure for Plone

Contents of this session

How to use AWS? AWSの使いどころなど。

Using Amazon Web Services (AWS)

Motivation

4 Q & A

7

なぜ、何かをしたいのか?

Page 8: Plone + AWS at Plone Symposium tokyo 2015

Ploneをホストする上で、どのように何をすべきか。

Speed Up (スピードアップ)

Support of large number of access (大量アクセス)

Cost down (コスト削減)

Flexible system (柔軟なシステム)

Motivation株式会社CMSコミュニケーションズ 8

Page 9: Plone + AWS at Plone Symposium tokyo 2015

System structure (minimum)株式会社CMSコミュニケーションズ 9

Plone (スタンドアローン)

1台の物理サーバ又はクラウドサーバ管理者

管理用アクセス パスワード必要

Apache (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

ZODB (データベースサーバ)

閲覧者

閲覧者

Page 10: Plone + AWS at Plone Symposium tokyo 2015

System structure (Large system)株式会社CMSコミュニケーションズ 10

管理者

nginx (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

MySQL/PostgreSQL (スレーブ)

(データベースサーバ)

閲覧者

閲覧者

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Apache (Webサーバ)(ログイン用)

Varnish (キャッシュサーバ)

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Varnish (キャッシュサーバ)

HAProxy (ロードバランサ)

MySQL/PostgreSQL (マスター)

(データベースサーバ)

Memcached (一時保存ファイル)

LDAP (ユーザディレクトリ)

外部SSO 認証サーバ

CDN

Page 11: Plone + AWS at Plone Symposium tokyo 2015

System structure (Middle size)株式会社CMSコミュニケーションズ 11

管理者管理用アクセス パスワード必要nginx (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

ZODB (データベースサーバ)

閲覧者

閲覧者

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Apache (Webサーバ)(ログイン用)Varnish (キャッシュサーバ)

Page 12: Plone + AWS at Plone Symposium tokyo 2015

株式会社CMSコミュニケーションズ 12

海外からもゲストが来ます。

nginx or Apache

フロントエンドでリクエストを受る

バーチャルホストやSSLを担当

構成要素の説明 (structural element)

Webサーバ

HAProxy

セッションを維持した振り分け

ロードバランス

Varnish

HTML / CSS / 画像などをキャッシュ

ロードバランシング機能

キャッシュサーバ

CloudFront や アカマイ

静的なコンテンツを別ネットワークから

CDN

Page 13: Plone + AWS at Plone Symposium tokyo 2015

System structure (Large system)株式会社CMSコミュニケーションズ 13

管理者

nginx (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

MySQL/PostgreSQL (スレーブ)

(データベースサーバ)

閲覧者

閲覧者

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Apache (Webサーバ)(ログイン用)

Varnish (キャッシュサーバ)

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Varnish (キャッシュサーバ)

HAProxy (ロードバランサ)

MySQL/PostgreSQL (マスター)

(データベースサーバ)

Memcached (一時保存ファイル)

LDAP (ユーザディレクトリ)

外部SSO 認証サーバ

CDN

Page 14: Plone + AWS at Plone Symposium tokyo 2015

株式会社CMSコミュニケーションズ 14

海外からもゲストが来ます。

Zope / Plone サーバ

メモリとCPUを消費

ZEOで複数のアプリケーションサーバ

構成要素の説明 (structural element)

アプリケーションサーバ

memchaced

関数・メソッドをキャッシュ

Zope再起動でキャッシュを消さない

メモリキャッシュ

ZODB

Data.fs と blob

データベース

RelStorage / NEO

MySQL / PostgreSQL

その他のデータベース

Page 15: Plone + AWS at Plone Symposium tokyo 2015

System structure (Large system)株式会社CMSコミュニケーションズ 15

管理者

nginx (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

MySQL/PostgreSQL (スレーブ)

(データベースサーバ)

閲覧者

閲覧者

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Apache (Webサーバ)(ログイン用)

Varnish (キャッシュサーバ)

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Varnish (キャッシュサーバ)

HAProxy (ロードバランサ)

MySQL/PostgreSQL (マスター)

(データベースサーバ)

Memcached (一時保存ファイル)

LDAP (ユーザディレクトリ)

外部SSO 認証サーバ

CDN

Page 16: Plone + AWS at Plone Symposium tokyo 2015

Webサーバ ・・・ nginxを使いましょう

キャッシュサーバ・・・Varnishをきちんとセットアップ

Plone 4 からのデフォルトblob化で効果あり

ZEO・・・負荷が高いのであれば導入検討

メモリキャッシュ・・・ZEOでキャッシュ共有可能

ZODBチューニングは難しいので、RelStrageなどを検討

キャッシュのチューニング/パージは、plone.app.caching

を設定

構成要素のまとめ株式会社CMSコミュニケーションズ 16

Page 17: Plone + AWS at Plone Symposium tokyo 2015

Using Amazon Web Services (AWS)株式会社CMSコミュニケーションズ 17

EC2

RDS

EBS

CloudFront

ElastiCacheS3

R53

Page 18: Plone + AWS at Plone Symposium tokyo 2015

System structure (on AWS)株式会社CMSコミュニケーションズ 18

管理者

nginx (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

MySQL/PostgreSQL (スレーブ)

(データベースサーバ)

閲覧者

閲覧者

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Apache (Webサーバ)(ログイン用)

Varnish (キャッシュサーバ)

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Varnish (キャッシュサーバ)

HAProxy (ロードバランサ)

MySQL/PostgreSQL (マスター)

(データベースサーバ)

Memcached (一時保存ファイル)

LDAP (ユーザディレクトリ)

外部SSO 認証サーバ

CDNEC2

Page 19: Plone + AWS at Plone Symposium tokyo 2015

System structure (on AWS)株式会社CMSコミュニケーションズ 19

管理者

nginx (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

MySQL/PostgreSQL (スレーブ)

(データベースサーバ)

閲覧者

閲覧者

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Apache (Webサーバ)(ログイン用)

Varnish (キャッシュサーバ)

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Varnish (キャッシュサーバ)

HAProxy (ロードバランサ)

MySQL/PostgreSQL (マスター)

(データベースサーバ)

Memcached (一時保存ファイル)

LDAP (ユーザディレクトリ)

外部SSO 認証サーバ

CDNDB

Page 20: Plone + AWS at Plone Symposium tokyo 2015

System structure (on AWS)株式会社CMSコミュニケーションズ 20

管理者

nginx (Webサーバ)

Ploneコアシステム(アプリケーションサーバ)

MySQL/PostgreSQL (スレーブ)

(データベースサーバ)

閲覧者

閲覧者

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Apache (Webサーバ)(ログイン用)

Varnish (キャッシュサーバ)

Ploneコアシステム(アプリケーションサーバ)

Ploneコアシステム(アプリケーションサーバ)

Varnish (キャッシュサーバ)

HAProxy (ロードバランサ)

MySQL/PostgreSQL (マスター)

(データベースサーバ)

Memcached (一時保存ファイル)

LDAP (ユーザディレクトリ)

外部SSO 認証サーバ

CDNCDN

Page 21: Plone + AWS at Plone Symposium tokyo 2015

Using Amazon Web Services (AWS)株式会社CMSコミュニケーションズ 21

EC2

RDS

EBS

CloudFront

ElastiCacheS3

EFS

R53

Page 22: Plone + AWS at Plone Symposium tokyo 2015

株式会社CMSコミュニケーションズ

Small system / Large system / System elements システム構成の例

2

3

1System structure for Plone

Summary of this session

How to use AWS? AWSの使いどころなど。

Using Amazon Web Services (AWS)

Motivation

22

なぜ、何かをしたいのか?

Page 23: Plone + AWS at Plone Symposium tokyo 2015

One More thing

株式会社CMSコミュニケーションズ 23

Page 24: Plone + AWS at Plone Symposium tokyo 2015

Using CDN

株式会社CMSコミュニケーションズ 24

Page 25: Plone + AWS at Plone Symposium tokyo 2015

Only a few changing on

nginx config

Server Setting株式会社CMSコミュニケーションズ 25

Page 26: Plone + AWS at Plone Symposium tokyo 2015

System structure w/o CDN株式会社CMSコミュニケーションズ 26

nginx Varnish

Plone1

Plone2

Plone3

Page 27: Plone + AWS at Plone Symposium tokyo 2015

System structure w/ CDN株式会社CMSコミュニケーションズ 27

nginx Varnish

Plone1

Plone2

Plone3

CDN CloudFront

Page 28: Plone + AWS at Plone Symposium tokyo 2015

nginx Config株式会社CMSコミュニケーションズ 28

location / { if ($uri ~* \.(jpe?g|png|gif|pdf|gz|tgz|bz2|tbz|zip|tiff|tif)$) { set $no_plone A; } if ($uri ~* /(image|(image_(?:[^/]|(?!view.*).+)))$) { set $no_plone A; } if ($uri ~* \.(svg|swf|ico|mp3|mp4|m4a|ogg|mov|avi|wmv|flv)$) { set $no_plone A; } if ($uri ~* \.(css|js)$) { set $no_plone A; } if ( $http_user_agent != "Amazon CloudFront" ) { set $no_plone "${no_plone}B"; } if ($no_plone = AB) { expires 1h; rewrite ^ http://YOUR_SUBDOMAIN.cloudfront.net$request_uri? last; } proxy_pass http://to_varnish/VirtualHostBase/http/YOUR_DOMAIN:80/Plone/VirtualHostRoot/; }

Page 29: Plone + AWS at Plone Symposium tokyo 2015

Data delivery first time株式会社CMSコミュニケーションズ 29

nginx Varnish

Plone1

Plone2

Plone3

CDN CloudFront

1

Redirect

2

3 4

56

7

8

Page 30: Plone + AWS at Plone Symposium tokyo 2015

Data delivery株式会社CMSコミュニケーションズ 30

nginx Varnish

Plone1

Plone2

Plone3

CDN CloudFront

1

Redirect

2

Page 31: Plone + AWS at Plone Symposium tokyo 2015

Other usage

株式会社CMSコミュニケーションズ 31

Page 32: Plone + AWS at Plone Symposium tokyo 2015

Streaming video株式会社CMSコミュニケーションズ

Streaming video with access control by Plone login

CloudFront provides Streaming and one time URL

system. https://bitbucket.org/cmscom/c2.app.streamingaws

32

Page 33: Plone + AWS at Plone Symposium tokyo 2015

サンプル株式会社CMSコミュニケーションズ 33

Page 34: Plone + AWS at Plone Symposium tokyo 2015

Thank youCMSPlone

株式会社CMSコミュニケーションズ 34

Page 35: Plone + AWS at Plone Symposium tokyo 2015

Q&ACMSPlone

株式会社CMSコミュニケーションズ

4

35