SlideShare a Scribd company logo
1 of 28
Download to read offline
第3回 Cloud Foundry 輪読会



         dev_setupを利用した

      Cloud Foundry
   マルチノードセットアップ

                    Katsunori Kawaguchi
                               @hamakn
                           2011-12-15
dev_setupを利用した
 マルチノード(ホスト、VM)での
VCAPのセットアップ方法の説明と、
 その際のハマりポイントや工夫を
    共有したいと思います。
アジェンダ
1.   dev_setupの基本的な使い方とコード読み
2.   設定ファイルの書き方
3.   ハマりポイント
4.   dev_setupの改造
     1. ログの集約
     2. 大量のノードの管理
     3. コンポーネントの追加
                     TODO: 端折ることなく
                     20分で終わらせる!!
自己紹介
• 川口 克則 @hamakn
• NTTコム所属
• Web/スマートフォンアプリの開発
  主にRails

• Cloud Foundryを検証中(2011年10月~)
 – 最近は、アカウント払出/管理アプリを作ったり、
   vcapノードの追加/管理ツールを作ったり。
ATNDアンケート結果-1

   輪読会で最も知りたいこと、
 やりたいことは何ですか?(1つ選択)

 ・コードリーディング          11
 ・VCAPの構築の情報共有        9
 ・CF上でのアプリケーションの構築    4
 に関する情報共有
この辺の人向け
 ・CFを使い始めるための        5
 概要や設定などの入門的内容
追加アンケート
• dev_setup (chefを使うやつ) を
  使った人どれぐらいいますか?

 – Yesが多い
   → dev_setupの説明は飛ばし気味にして、
     後半や質疑の時間を多めにする
 – Noが多い
   → dev_setupの説明からきっちりやる
      後半のネタは懇親会行き
VCAPのdev_setupフォルダとは
• VCAPコンポーネントをマルチノードで
  セットアップするためのツール群
• 内部でchef(chef-solo)を利用
• CF本家の見解
 – We’ve been working on a replacement for
   the vcap_setup script based on Chef.
• 現状セットアップできるコンポーネント
 – RT, CC, DEA, HM, Service(Gateway, Node)
   NATS Server, CCDB
dev_setupの基本的な使い方
1. yaml形式のconfigファイルを作る
 – dev_setup/deployments にいくつかサンプル
2. dev_setup/bin/vcap_dev_setup を実行
 – -cオプションで1.で作ったconfigファイルを指定
 – 時間かかります
3. 成功したら、
   Command to run cloudfoundry:
   を実行してコンポーネント起動
configファイルの構造
• 例: deaの場合
deployment:
 name: "dea"
 domain: “yourdomain.net"

jobs:
  install:
    - dea:
       local_route: “dea001"
       logging: "debug"          セットアップするコンポーネントの情報
       secure: "true“
       multi_tenant: “true”      (この場合、DEA)
       enforce_ulimit: "false"
  installed:
    - nats_server:
       host: “nats001"           セットアップ済のコンポーネントの情報
       port: "4222"
       user: "nats"              (この場合、DEAの通信するNATS)
       password: "nats"
configファイルの書き方
• 設定可能な値
 – dev_setup/cookbooks/*/templates 内の
   configのひな形(erb)を見て確認
• デフォルト値
 – dev_setup/cookbooks/*/attributes/default.rb
   を見て確認
デモ

 セットアップ開始から
コンポーネントの起動まで
ハマりポイント
• いろいろあります!
• トラブルシュート お品書き
 1.   Gem not foundが出る
 2.   Service Gatewayが動かない
 3.   CCDBのないCCのセットアップに失敗する
 4.   Rubyのパスが通らない あるいは、
      CCDBにrails consoleからつなぎたい
Gem not foundが出る
• 症状
 – vcap_logger, eventmachine-cloudfoundry
   などの、CF独自gemが not found
 – HM, DEAなどのセットアップで発生
• 原因
 – CCのvender/cacheにしかgemが置かれていないこと
• 対処法
 – Gemをコピー cp cloud_controller/vender/cache/*
   dea/vender/cache/
 – commonの場合はフォルダから作る
Service Gatewayが動かない
• 症状
 – Service Gatewayの起動はするが、ログを見ると
  Failed registering with cloud controller, status=404
• 原因
 – Service GatewayからCCへのRESTアクセスで
   apiの名前解決に失敗
• 対処法
 – Service GatewayのhostsにRTを設定
   • 間違い: RTの上にLBがいる場合はLB
   • LBがいる場合はBounce Back通信 (t.co/4w38LIIs)
     にならないように設定する必要アリ
CCDBのないCCの
    セットアップに失敗する
• 症状
 – vcap_dev_setup 実行中に
   FATAL: ArgumentError: bash[Setup PostgreSQL..
• 原因
 – CCのchefの構成情報(role)にCCDBがあるのに、
   configファイルにはCCDBの情報がない
• 対処法
 – dev_setup/roles/cloud_controller.json から
   recipe[ccdb] の行を消す
RubyのPATHが通らない あるいは
CCDBにrails consoleからつなぎたい
• 症状
 – ruby –v # => 1.8.7 ..
• 対処法
 – {vcap_root}/.deployments/*/deploy/rubies/..
   にrubyがいるのでPATHを通す
 – rails consoleへのつなげ方
   • {vcap_root}/.deployments/*/config/*.yml を
     {vcap_root}/vcap/cloud_controller/config に cp
   • {vcap_root}/vcap/cloud_controller/ で
     bundle exec rails console production
改造
1. ログの集約
 vcapのログを1つのサーバに集約する
2. 大量ノードの管理
 デプロイサーバから大量ノードを管理する
3. コンポーネントの追加
 新しく追加されたコンポーネント
 stager, package_cache, warden の
 cookbookを作成して、dev_setupできるようにする
ログの集約
• (r)syslogを使う
 – gem vcap_logger の仕事
   VCAP::Logging::Sink::SyslogSink
 – コンポーネントの起動configファイルに
   log: syslog: を設定すればOK


• 他のログ収集ツールを使う
 – VCAP::Logging::Sink::FluentSink とか誰か!
大量ノードの管理
• hamaknの解: Capistranoを使う
 – やりたいこと
   • コードの(ローリング && 手動)アップデート
   • デプロイサーバでの集中管理
 – とりあえず作った / 使い方
   • cap deploy -S paas_config=mypaas.yml
   • cap deploy –S host=cf001 –S component=dea


• 別解: 構成管理ツールを使う
 – Chef, Pappet
コンポーネントの追加
• 例: stagerを追加した
 – 追加が必要なもの
   • 既存のコードを参考に作る
   • dev_setup/cookbooks/stager
     attributes, recipes, templatesなど
   • dev_setup/roles/stager.json
 – 修正が必要なもの 全部で5行でした。
   • dev_setup/bin/vcap
   • dev_setup/lib/job_dependency.rake
   • Dev_setup/lib/job_manager.rb
振り返り
1.   dev_setupの基本的な使い方とコード読み
2.   設定ファイルの書き方
3.   ハマりポイント
4.   dev_setupの改造
     1. ログの集約
     2. 大量のノードの管理
     3. コンポーネントの追加
                     CHECK: 端折ることなく
                      20分で終われたか?
まとめ
• dev_setupを利用した
  マルチノード(ホスト、VM)での
  VCAPのセットアップ方法の説明と、
  その際のハマりポイントや工夫を話ました。

• ブログにも一部書いています
  http://d.hatena.ne.jp/hamakn
• Google Groups等で共有していきましょう!
第3回
  Cloud Foundry 輪読会
        19:05開始~
     しばらくおまちください

Wifi: SSID: **** KEY: **********
Heroku Drinkupに行かずに
 こちらに来ていただき、
 ありがとうございます。
ATNDアンケート結果-1

   輪読会で最も知りたいこと、
 やりたいことは何ですか?(1つ選択)

 ・コードリーディング          11
 ・VCAPの構築の情報共有        9
 ・CF上でのアプリケーションの構築    4
 に関する情報共有
 ・CFを使い始めるための        5
 概要や設定などの入門的内容
ATNDアンケート結果-2

     どちら方面からの参加ですか?
        (複数回答可)
 ・開発(Java系)           10
 ・開発(LL言語系)           10
 ・インフラ構築              10
 ・インフラ運用               7
 ・その他
  ・CF自身に興味がある          2
  ・Node.jsでのサービス開発     1
  ・テクニカルサポート           1
  ・UX系                 1
自己紹介タイム

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Cloud Foundry multinode setup using dev_setup(Chef)

  • 1. 第3回 Cloud Foundry 輪読会 dev_setupを利用した Cloud Foundry マルチノードセットアップ Katsunori Kawaguchi @hamakn 2011-12-15
  • 3. アジェンダ 1. dev_setupの基本的な使い方とコード読み 2. 設定ファイルの書き方 3. ハマりポイント 4. dev_setupの改造 1. ログの集約 2. 大量のノードの管理 3. コンポーネントの追加 TODO: 端折ることなく 20分で終わらせる!!
  • 4. 自己紹介 • 川口 克則 @hamakn • NTTコム所属 • Web/スマートフォンアプリの開発 主にRails • Cloud Foundryを検証中(2011年10月~) – 最近は、アカウント払出/管理アプリを作ったり、 vcapノードの追加/管理ツールを作ったり。
  • 5. ATNDアンケート結果-1 輪読会で最も知りたいこと、 やりたいことは何ですか?(1つ選択) ・コードリーディング 11 ・VCAPの構築の情報共有 9 ・CF上でのアプリケーションの構築 4 に関する情報共有 この辺の人向け ・CFを使い始めるための 5 概要や設定などの入門的内容
  • 6. 追加アンケート • dev_setup (chefを使うやつ) を 使った人どれぐらいいますか? – Yesが多い → dev_setupの説明は飛ばし気味にして、 後半や質疑の時間を多めにする – Noが多い → dev_setupの説明からきっちりやる 後半のネタは懇親会行き
  • 7. VCAPのdev_setupフォルダとは • VCAPコンポーネントをマルチノードで セットアップするためのツール群 • 内部でchef(chef-solo)を利用 • CF本家の見解 – We’ve been working on a replacement for the vcap_setup script based on Chef. • 現状セットアップできるコンポーネント – RT, CC, DEA, HM, Service(Gateway, Node) NATS Server, CCDB
  • 8. dev_setupの基本的な使い方 1. yaml形式のconfigファイルを作る – dev_setup/deployments にいくつかサンプル 2. dev_setup/bin/vcap_dev_setup を実行 – -cオプションで1.で作ったconfigファイルを指定 – 時間かかります 3. 成功したら、 Command to run cloudfoundry: を実行してコンポーネント起動
  • 9. configファイルの構造 • 例: deaの場合 deployment: name: "dea" domain: “yourdomain.net" jobs: install: - dea: local_route: “dea001" logging: "debug" セットアップするコンポーネントの情報 secure: "true“ multi_tenant: “true” (この場合、DEA) enforce_ulimit: "false" installed: - nats_server: host: “nats001" セットアップ済のコンポーネントの情報 port: "4222" user: "nats" (この場合、DEAの通信するNATS) password: "nats"
  • 10. configファイルの書き方 • 設定可能な値 – dev_setup/cookbooks/*/templates 内の configのひな形(erb)を見て確認 • デフォルト値 – dev_setup/cookbooks/*/attributes/default.rb を見て確認
  • 12. ハマりポイント • いろいろあります! • トラブルシュート お品書き 1. Gem not foundが出る 2. Service Gatewayが動かない 3. CCDBのないCCのセットアップに失敗する 4. Rubyのパスが通らない あるいは、 CCDBにrails consoleからつなぎたい
  • 13. Gem not foundが出る • 症状 – vcap_logger, eventmachine-cloudfoundry などの、CF独自gemが not found – HM, DEAなどのセットアップで発生 • 原因 – CCのvender/cacheにしかgemが置かれていないこと • 対処法 – Gemをコピー cp cloud_controller/vender/cache/* dea/vender/cache/ – commonの場合はフォルダから作る
  • 14. Service Gatewayが動かない • 症状 – Service Gatewayの起動はするが、ログを見ると Failed registering with cloud controller, status=404 • 原因 – Service GatewayからCCへのRESTアクセスで apiの名前解決に失敗 • 対処法 – Service GatewayのhostsにRTを設定 • 間違い: RTの上にLBがいる場合はLB • LBがいる場合はBounce Back通信 (t.co/4w38LIIs) にならないように設定する必要アリ
  • 15. CCDBのないCCの セットアップに失敗する • 症状 – vcap_dev_setup 実行中に FATAL: ArgumentError: bash[Setup PostgreSQL.. • 原因 – CCのchefの構成情報(role)にCCDBがあるのに、 configファイルにはCCDBの情報がない • 対処法 – dev_setup/roles/cloud_controller.json から recipe[ccdb] の行を消す
  • 16. RubyのPATHが通らない あるいは CCDBにrails consoleからつなぎたい • 症状 – ruby –v # => 1.8.7 .. • 対処法 – {vcap_root}/.deployments/*/deploy/rubies/.. にrubyがいるのでPATHを通す – rails consoleへのつなげ方 • {vcap_root}/.deployments/*/config/*.yml を {vcap_root}/vcap/cloud_controller/config に cp • {vcap_root}/vcap/cloud_controller/ で bundle exec rails console production
  • 17. 改造 1. ログの集約 vcapのログを1つのサーバに集約する 2. 大量ノードの管理 デプロイサーバから大量ノードを管理する 3. コンポーネントの追加 新しく追加されたコンポーネント stager, package_cache, warden の cookbookを作成して、dev_setupできるようにする
  • 18. ログの集約 • (r)syslogを使う – gem vcap_logger の仕事 VCAP::Logging::Sink::SyslogSink – コンポーネントの起動configファイルに log: syslog: を設定すればOK • 他のログ収集ツールを使う – VCAP::Logging::Sink::FluentSink とか誰か!
  • 19. 大量ノードの管理 • hamaknの解: Capistranoを使う – やりたいこと • コードの(ローリング && 手動)アップデート • デプロイサーバでの集中管理 – とりあえず作った / 使い方 • cap deploy -S paas_config=mypaas.yml • cap deploy –S host=cf001 –S component=dea • 別解: 構成管理ツールを使う – Chef, Pappet
  • 20. コンポーネントの追加 • 例: stagerを追加した – 追加が必要なもの • 既存のコードを参考に作る • dev_setup/cookbooks/stager attributes, recipes, templatesなど • dev_setup/roles/stager.json – 修正が必要なもの 全部で5行でした。 • dev_setup/bin/vcap • dev_setup/lib/job_dependency.rake • Dev_setup/lib/job_manager.rb
  • 21. 振り返り 1. dev_setupの基本的な使い方とコード読み 2. 設定ファイルの書き方 3. ハマりポイント 4. dev_setupの改造 1. ログの集約 2. 大量のノードの管理 3. コンポーネントの追加 CHECK: 端折ることなく 20分で終われたか?
  • 22. まとめ • dev_setupを利用した マルチノード(ホスト、VM)での VCAPのセットアップ方法の説明と、 その際のハマりポイントや工夫を話ました。 • ブログにも一部書いています http://d.hatena.ne.jp/hamakn • Google Groups等で共有していきましょう!
  • 23.
  • 24. 第3回 Cloud Foundry 輪読会 19:05開始~ しばらくおまちください Wifi: SSID: **** KEY: **********
  • 26. ATNDアンケート結果-1 輪読会で最も知りたいこと、 やりたいことは何ですか?(1つ選択) ・コードリーディング 11 ・VCAPの構築の情報共有 9 ・CF上でのアプリケーションの構築 4 に関する情報共有 ・CFを使い始めるための 5 概要や設定などの入門的内容
  • 27. ATNDアンケート結果-2 どちら方面からの参加ですか? (複数回答可) ・開発(Java系) 10 ・開発(LL言語系) 10 ・インフラ構築 10 ・インフラ運用 7 ・その他 ・CF自身に興味がある 2 ・Node.jsでのサービス開発 1 ・テクニカルサポート 1 ・UX系 1