SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Nise-BOSHでCloudFoundryを1VMに構築
2014/04/26 NECソフト大塚元央
Page 2 © NEC Corporation 2013
▌ 導入
 自己紹介
 モチベーション
 Cloud Foundry 構成
▌ 1VM Cloud Foundry の構築
 流れ
 Nise-BOSH のインストール
 Cloud Foundry のリリース作成
 Cloud Foundry のインストール
目次
目次
大塚元央 (Yuanying)
▌ 所属: NECソフト ITシステム事業部
▌ Twitter: @yuanying
▌ 趣味
 トライアスロン
▌ 古い昔の趣味
 Mac
• iExtractMP3
 Ruby
• ConnectImporter (http://labs.3machinae.com/garmin2runkeeper)
Page 3 © NEC Corporation 2010
導入
自己紹介
もっと気軽に Cloud Foundry の最新版を試したい
▌ BOSH
 IaaS統合は良いんだけど、ローカルで環境作るのどうするの?
 BOSH 自体で 1VM+ も使いたくない。
▌ Nise-BOSH
 これがあれば Vagrant で試せる!
 複数ジョブテンプレートを一度にインストールすれば 1VM で Cloud
Foundry が動くんじゃ?
• https://github.com/yuanying/nise_bosh#multi-monitrc-spike
• https://github.com/yuanying/cf-release
– cf-release もちょっと修正する必要があった。
 参考
• https://github.com/cloudfoundry/micro
Page 4 © NEC Corporation 2013
導入
モチベーション
Cloud Foundry の最低構成は?
▌ cf-release/jobs
 たくさんあるけど全部使ったりしないよね?
 とりあえず service なんて無くて良い、動けば。
 最新のコンポーネントを使いたい。
• router よりgorouter
• cloud_controller_ng
Page 5 © NEC Corporation 2013
導入
Cloud Foundry 構成
Cloud Foundry を構成する最低インタフェース
Page 6 © NEC Corporation 2013
導入
Cloud Foundry 構成
じゃあこれらをcf-release の Job Template で実装すると?
Page 7 © NEC Corporation 2013
導入
Cloud Foundry 構成
依存関係を調査してみた。
(実行時には上にあるコンポーネント
から)
Page 8 © NEC Corporation 2013
導入
Cloud Foundry 構成
最新コンポーネントを試そうと思う
と、
こうなる。
Page 9 © NEC Corporation 2013
1. Nise-BOSH のインストール
2. Cloud Foundry のリリース作成
3. Cloud Foundry のインストール
1VM Cloud Foundry の構築
流れ
Page 10 © NEC Corporation 2013
▌ 本家でなく、複数ジョブテンプレートインストールに対応したブ
ランチを利用する。
 後々もっと奇麗な形で複数ジョブテンプレートのインストールに対応す
るので、この手順は多分非推奨…。
 dea_next用に gen-stemcellする必要があるかと思いきや、、最新版の
dea_nextだとrootfs用のパッケージがcf-release に用意してあるため必要
ない模様。
1VM Cloud Foundry の構築
Nise-BOSH のインストール
$ git clone https://github.com/yuanying/nise_bosh.git
$ git checkout –bmulti-monitrc-spike origin/multi-monitrc-spike
$ bundle install
$ ./bin/init
$ apt-get install debootstraprunit
Page 11 © NEC Corporation 2013
1VM Cloud Foundry の構築
Cloud Foundry のリリース作成
$ git clone https://github.com/cloudfoundry/cf-release.git
$ cd ./cf-release
$ git remote add yuanyinghttps://github.com/yuanying/cf-release.git
$ git pull yuanying master
From https://github.com/yuanying/cf-release
* branch master -> FETCH_HEAD
Updating 4fd9c30..c9d596a
Fast-forward
jobs/cloud_controller_ng/monit | 2 ++
jobs/dea_next/templates/dea.yml.erb | 12 ++++++++++++
jobs/dea_next/templates/warden_ctl | 18 ------------------
jobs/hbase_master/templates/+--hbase_zookeeper_ctl | 4 +
packages/nginx/packaging | 1 +
packages/nginx_next/packaging | 1 +
packages/ruby/packaging | 1 +
packages/ruby_next/packaging | 1 +
8 files changed, 20 insertions(+), 20 deletions(-)
1VM で動くように、いくつかcf-release を
修正。
cloud_controllerでのnginxの無効化
▌ 何故かnginxが 1VM で CF 構築時に、staging の邪魔をしていたの
でよくわからないけど使うのを止めた。
Page 12 © NEC Corporation 2010
1VM Cloud Foundry の構築
Cloud Foundry のリリース作成
--- a/jobs/cloud_controller_ng/monit
+++ b/jobs/cloud_controller_ng/monit
@@ -4,10 +4,8 @@ check process cloud_controller_ng
stop program "/var/vcap/jobs/cloud_controller_ng/bin/cloud_controller_ng_ctl stop"
group vcap
+<% if p("ccng.use_nginx", true) %>
check process nginx_ccng
with pidfile /var/vcap/sys/run/nginx_ccng/nginx.pid
start program "/var/vcap/jobs/cloud_controller_ng/bin/nginx_ctl start"
stop program "/var/vcap/jobs/cloud_controller_ng/bin/nginx_ctl stop"
group vcap
+<% end %>
warden_ctrからstemcell.tar.gz関連を削除
Page 13 © NEC Corporation 2010
1VM Cloud Foundry の構築
Cloud Foundry のリリース作成
--- a/jobs/dea_next/templates/warden_ctl
+++ b/jobs/dea_next/templates/warden_ctl
@@ -24,24 +24,6 @@ case $1 in
ulimit -c unlimited
- rootfs_path=$DATA_DIR/rootfs
- rootfs_tgz=/var/vcap/stemcell_base.tar.gz
-
- # Extract rootfs if needed
- if [ ! -d $rootfs_path ]
- then
- # Make sure its parent directory exists
- mkdir -p $(dirname $rootfs_path)
-
- # Extract to temporary path, then rename to target path.
- # This makes sure that it is not possible that we end up with directory
- # that contains a partially extracted archive.
- tmp_path=$(mktemp --tmpdir=$(dirname $rootfs_path) -d)
- chmod 755 $tmp_path
- tar -C $tmp_path -zxf $rootfs_tgz
- mv $tmp_path $rootfs_path
- fi
これはたぶん、本家の消し忘れ。
1VM なのでnfsの利用を削除
Page 14 © NEC Corporation 2010
1VM Cloud Foundry の構築
Cloud Foundry のリリース作成
--- a/jobs/serialization_data_server/templates/serialization_data_server_ctl
+++ b/jobs/serialization_data_server/templates/serialization_data_server_ctl
@@ -36,7 +36,9 @@ case $1 in
<% end %>
mkdir -p $SNAPSHOT_DIR
+ <% unless properties.micro %>
check_mount "$MT_OPTS" "$MT_EXPORT" "$SNAPSHOT_DIR"
+ <% end %>
mkdir -p $SDS_TMP_UPLOAD_DIR
chownvcap:vcap $SDS_TMP_UPLOAD_DIR
Page 15 © NEC Corporation 2013
▌ ここでNise-BOSH にリクエスト
 最新のリリースを試したいだけな場合にわざわざ bosh create release し
たくない!
• bosh sync blobs だけで大丈夫なんじゃ?
 Job Template と Package の取得方法がちょっとごっちゃになってる。
• Job Template はリリースレポジトリのソース(jobs ディレクトリ)そのまま使う
のに、
• Package はなんで .dev_builds / .final_buildsを使うのか?
 リリースファイルを指定したら .dev_builds / .final_buildsの jobs と
package を使う、
 リリースレポジトリを指定したら、レポジトリ下のソースを利用するよ
うにして欲しい(したい)。
1VM Cloud Foundry の構築
Cloud Foundry のリリース作成
$ ./update
$ gem install –no-ri –no-rdocbosh_cli
$ bosh create release --force
Page 16 © NEC Corporation 2013
▌ 最低構成の Job Template をインストール。
 問題は、deployment manifest (micro_ng.yml) の内容…。
 cloudfoundry/micro を参考に
• https://github.com/cloudfoundry/micro/blob/master/deploy/manifest-ng.yml
 実際に使った deployment manifest
• https://gist.github.com/yuanying/2b41f8bd3819de0bd520
1VM Cloud Foundry の構築
Cloud Foundry のインストール
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 postgres
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 nats
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 gorouter
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 dea_next
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 health_manager_next
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 cloud_controller_ng
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 serialization_data_server
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 uaa
$ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 vcap_redis
Page 17 © NEC Corporation 2013
▌ properties.microを true に
▌ ドメインにxip.ioを指定。
 IP アドレスベースのワイルドカードDNS。便利。
1VM Cloud Foundry の構築
Cloud Foundry のインストール
---
deployment: micro
properties:
micro: true
domain: 192.168.33.10.xip.io
cc_props: ccng
hm_props: health_manager_ccng
Page 18 © NEC Corporation 2013
▌ ccng.use_nginxを false に
▌ ccngのプロパティはデフォルト値が spec で決まっているものが
多いが、Nise-BOSH がプロパティのデフォルト値に対応していな
いため、すべて指定する必要があり大変。。
1VM Cloud Foundry の構築
Cloud Foundry のインストール
ccng: &ccng
use_nginx: false
default_quota_definition: free
srv_api_uri: http://api.192.168.33.10.xip.io
logging_level: debug
bulk_api_password: bulk_api_password
staging_upload_user: staging
staging_upload_password: staging
external_host: api
uaa_resource_id: cloud_controller
quota_definitions:
free:
total_services: 10
memory_limit: 1024
non_basic_services_allowed: false
… (以下略)
Page 19 © NEC Corporation 2013
▌ uaa.no_sslを true に
▌ cfクライアントを追加 (vmcの代わり)
 autoapproveに登録しないとブラウザベースの認証しないと使えない。
 cloud_controller.admin scope の追加。
1VM Cloud Foundry の構築
Cloud Foundry のインストール
uaa:
spring_profiles: postgresql
no_ssl: true
autoapprove:
- cf
scim:
users:
- micro@vcap.me|micro|scim.write,scim.read,openid
clients:
cf:
override: true
authorized-grant-types: implicit
authorities: uaa.none
scope:
cloud_controller.read,cloud_controller.write,openid,password.write,cloud_controller.admin,scim.read,scim.write
起動!
Page 20 © NEC Corporation 2013
1VM Cloud Foundry の構築
Cloud Foundry のインストール
$ mkdir -p /var/vcap/shared
$ chownvcap:vcap /var/vcap/shared
$ mkdir -p /var/vcap/store
$ ./bin/run-job start postgres
$ ./bin/run-job start nats
$ ./bin/run-job start gorouter
$ ./bin/run-job start dea_next
$ ./bin/run-job start health_manager_next
$ ./bin/run-job start cloud_controller_ng
$ ./bin/run-job start serialization_data_server
$ ./bin/run-job start uaa
$ ./bin/run-job start vcap_redis
Page 21 © NEC Corporation 2012

Contenu connexe

Dernier

TaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdf
TaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdfTaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdf
TaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdfMatsushita Laboratory
 
20240326_IoTLT_vol109_kitazaki_v1___.pdf
20240326_IoTLT_vol109_kitazaki_v1___.pdf20240326_IoTLT_vol109_kitazaki_v1___.pdf
20240326_IoTLT_vol109_kitazaki_v1___.pdfAyachika Kitazaki
 
2024 01 Virtual_Counselor
2024 01 Virtual_Counselor 2024 01 Virtual_Counselor
2024 01 Virtual_Counselor arts yokohama
 
持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見
持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見
持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見Shumpei Kishi
 
「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-Loopへ
「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-Loopへ「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-Loopへ
「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-LoopへTetsuya Nihonmatsu
 
IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)
IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)
IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)ssuser539845
 
2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~
2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~
2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~arts yokohama
 
情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法
情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法
情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法ssuser370dd7
 
ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦
ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦
ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦Sadao Tokuyama
 

Dernier (12)

TaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdf
TaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdfTaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdf
TaketoFujikawa_台本中の動作表現に基づくアニメーション原画システムの提案_SIGEC71.pdf
 
20240326_IoTLT_vol109_kitazaki_v1___.pdf
20240326_IoTLT_vol109_kitazaki_v1___.pdf20240326_IoTLT_vol109_kitazaki_v1___.pdf
20240326_IoTLT_vol109_kitazaki_v1___.pdf
 
2024 04 minnanoito
2024 04 minnanoito2024 04 minnanoito
2024 04 minnanoito
 
2024 01 Virtual_Counselor
2024 01 Virtual_Counselor 2024 01 Virtual_Counselor
2024 01 Virtual_Counselor
 
持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見
持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見
持続可能なDrupal Meetupのコツ - Drupal Meetup Tokyoの知見
 
「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-Loopへ
「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-Loopへ「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-Loopへ
「今からでも間に合う」GPTsによる 活用LT会 - 人とAIが協調するHumani-in-the-Loopへ
 
What is the world where you can make your own semiconductors?
What is the world where you can make your own semiconductors?What is the world where you can make your own semiconductors?
What is the world where you can make your own semiconductors?
 
IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)
IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)
IFIP IP3での資格制度を対象とする国際認定(IPSJ86全国大会シンポジウム)
 
2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~
2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~
2024 02 Nihon-Tanken ~Towards a More Inclusive Japan~
 
2024 03 CTEA
2024 03 CTEA2024 03 CTEA
2024 03 CTEA
 
情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法
情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法
情報処理学会86回全国大会_Generic OAMをDeep Learning技術によって実現するための課題と解決方法
 
ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦
ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦
ARスタートアップOnePlanetの Apple Vision Proへの情熱と挑戦
 

En vedette

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
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

En vedette (20)

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
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

Nise-BOSH で Cloud Foundry を 1VM に構築

  • 2. Page 2 © NEC Corporation 2013 ▌ 導入  自己紹介  モチベーション  Cloud Foundry 構成 ▌ 1VM Cloud Foundry の構築  流れ  Nise-BOSH のインストール  Cloud Foundry のリリース作成  Cloud Foundry のインストール 目次 目次
  • 3. 大塚元央 (Yuanying) ▌ 所属: NECソフト ITシステム事業部 ▌ Twitter: @yuanying ▌ 趣味  トライアスロン ▌ 古い昔の趣味  Mac • iExtractMP3  Ruby • ConnectImporter (http://labs.3machinae.com/garmin2runkeeper) Page 3 © NEC Corporation 2010 導入 自己紹介
  • 4. もっと気軽に Cloud Foundry の最新版を試したい ▌ BOSH  IaaS統合は良いんだけど、ローカルで環境作るのどうするの?  BOSH 自体で 1VM+ も使いたくない。 ▌ Nise-BOSH  これがあれば Vagrant で試せる!  複数ジョブテンプレートを一度にインストールすれば 1VM で Cloud Foundry が動くんじゃ? • https://github.com/yuanying/nise_bosh#multi-monitrc-spike • https://github.com/yuanying/cf-release – cf-release もちょっと修正する必要があった。  参考 • https://github.com/cloudfoundry/micro Page 4 © NEC Corporation 2013 導入 モチベーション
  • 5. Cloud Foundry の最低構成は? ▌ cf-release/jobs  たくさんあるけど全部使ったりしないよね?  とりあえず service なんて無くて良い、動けば。  最新のコンポーネントを使いたい。 • router よりgorouter • cloud_controller_ng Page 5 © NEC Corporation 2013 導入 Cloud Foundry 構成
  • 6. Cloud Foundry を構成する最低インタフェース Page 6 © NEC Corporation 2013 導入 Cloud Foundry 構成 じゃあこれらをcf-release の Job Template で実装すると?
  • 7. Page 7 © NEC Corporation 2013 導入 Cloud Foundry 構成 依存関係を調査してみた。 (実行時には上にあるコンポーネント から)
  • 8. Page 8 © NEC Corporation 2013 導入 Cloud Foundry 構成 最新コンポーネントを試そうと思う と、 こうなる。
  • 9. Page 9 © NEC Corporation 2013 1. Nise-BOSH のインストール 2. Cloud Foundry のリリース作成 3. Cloud Foundry のインストール 1VM Cloud Foundry の構築 流れ
  • 10. Page 10 © NEC Corporation 2013 ▌ 本家でなく、複数ジョブテンプレートインストールに対応したブ ランチを利用する。  後々もっと奇麗な形で複数ジョブテンプレートのインストールに対応す るので、この手順は多分非推奨…。  dea_next用に gen-stemcellする必要があるかと思いきや、、最新版の dea_nextだとrootfs用のパッケージがcf-release に用意してあるため必要 ない模様。 1VM Cloud Foundry の構築 Nise-BOSH のインストール $ git clone https://github.com/yuanying/nise_bosh.git $ git checkout –bmulti-monitrc-spike origin/multi-monitrc-spike $ bundle install $ ./bin/init $ apt-get install debootstraprunit
  • 11. Page 11 © NEC Corporation 2013 1VM Cloud Foundry の構築 Cloud Foundry のリリース作成 $ git clone https://github.com/cloudfoundry/cf-release.git $ cd ./cf-release $ git remote add yuanyinghttps://github.com/yuanying/cf-release.git $ git pull yuanying master From https://github.com/yuanying/cf-release * branch master -> FETCH_HEAD Updating 4fd9c30..c9d596a Fast-forward jobs/cloud_controller_ng/monit | 2 ++ jobs/dea_next/templates/dea.yml.erb | 12 ++++++++++++ jobs/dea_next/templates/warden_ctl | 18 ------------------ jobs/hbase_master/templates/+--hbase_zookeeper_ctl | 4 + packages/nginx/packaging | 1 + packages/nginx_next/packaging | 1 + packages/ruby/packaging | 1 + packages/ruby_next/packaging | 1 + 8 files changed, 20 insertions(+), 20 deletions(-) 1VM で動くように、いくつかcf-release を 修正。
  • 12. cloud_controllerでのnginxの無効化 ▌ 何故かnginxが 1VM で CF 構築時に、staging の邪魔をしていたの でよくわからないけど使うのを止めた。 Page 12 © NEC Corporation 2010 1VM Cloud Foundry の構築 Cloud Foundry のリリース作成 --- a/jobs/cloud_controller_ng/monit +++ b/jobs/cloud_controller_ng/monit @@ -4,10 +4,8 @@ check process cloud_controller_ng stop program "/var/vcap/jobs/cloud_controller_ng/bin/cloud_controller_ng_ctl stop" group vcap +<% if p("ccng.use_nginx", true) %> check process nginx_ccng with pidfile /var/vcap/sys/run/nginx_ccng/nginx.pid start program "/var/vcap/jobs/cloud_controller_ng/bin/nginx_ctl start" stop program "/var/vcap/jobs/cloud_controller_ng/bin/nginx_ctl stop" group vcap +<% end %>
  • 13. warden_ctrからstemcell.tar.gz関連を削除 Page 13 © NEC Corporation 2010 1VM Cloud Foundry の構築 Cloud Foundry のリリース作成 --- a/jobs/dea_next/templates/warden_ctl +++ b/jobs/dea_next/templates/warden_ctl @@ -24,24 +24,6 @@ case $1 in ulimit -c unlimited - rootfs_path=$DATA_DIR/rootfs - rootfs_tgz=/var/vcap/stemcell_base.tar.gz - - # Extract rootfs if needed - if [ ! -d $rootfs_path ] - then - # Make sure its parent directory exists - mkdir -p $(dirname $rootfs_path) - - # Extract to temporary path, then rename to target path. - # This makes sure that it is not possible that we end up with directory - # that contains a partially extracted archive. - tmp_path=$(mktemp --tmpdir=$(dirname $rootfs_path) -d) - chmod 755 $tmp_path - tar -C $tmp_path -zxf $rootfs_tgz - mv $tmp_path $rootfs_path - fi これはたぶん、本家の消し忘れ。
  • 14. 1VM なのでnfsの利用を削除 Page 14 © NEC Corporation 2010 1VM Cloud Foundry の構築 Cloud Foundry のリリース作成 --- a/jobs/serialization_data_server/templates/serialization_data_server_ctl +++ b/jobs/serialization_data_server/templates/serialization_data_server_ctl @@ -36,7 +36,9 @@ case $1 in <% end %> mkdir -p $SNAPSHOT_DIR + <% unless properties.micro %> check_mount "$MT_OPTS" "$MT_EXPORT" "$SNAPSHOT_DIR" + <% end %> mkdir -p $SDS_TMP_UPLOAD_DIR chownvcap:vcap $SDS_TMP_UPLOAD_DIR
  • 15. Page 15 © NEC Corporation 2013 ▌ ここでNise-BOSH にリクエスト  最新のリリースを試したいだけな場合にわざわざ bosh create release し たくない! • bosh sync blobs だけで大丈夫なんじゃ?  Job Template と Package の取得方法がちょっとごっちゃになってる。 • Job Template はリリースレポジトリのソース(jobs ディレクトリ)そのまま使う のに、 • Package はなんで .dev_builds / .final_buildsを使うのか?  リリースファイルを指定したら .dev_builds / .final_buildsの jobs と package を使う、  リリースレポジトリを指定したら、レポジトリ下のソースを利用するよ うにして欲しい(したい)。 1VM Cloud Foundry の構築 Cloud Foundry のリリース作成 $ ./update $ gem install –no-ri –no-rdocbosh_cli $ bosh create release --force
  • 16. Page 16 © NEC Corporation 2013 ▌ 最低構成の Job Template をインストール。  問題は、deployment manifest (micro_ng.yml) の内容…。  cloudfoundry/micro を参考に • https://github.com/cloudfoundry/micro/blob/master/deploy/manifest-ng.yml  実際に使った deployment manifest • https://gist.github.com/yuanying/2b41f8bd3819de0bd520 1VM Cloud Foundry の構築 Cloud Foundry のインストール $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 postgres $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 nats $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 gorouter $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 dea_next $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 health_manager_next $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 cloud_controller_ng $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 serialization_data_server $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 uaa $ bundle exec ./bin/nise-bosh ../cf-release ../micro_ng.yml -n 127.0.0.1 vcap_redis
  • 17. Page 17 © NEC Corporation 2013 ▌ properties.microを true に ▌ ドメインにxip.ioを指定。  IP アドレスベースのワイルドカードDNS。便利。 1VM Cloud Foundry の構築 Cloud Foundry のインストール --- deployment: micro properties: micro: true domain: 192.168.33.10.xip.io cc_props: ccng hm_props: health_manager_ccng
  • 18. Page 18 © NEC Corporation 2013 ▌ ccng.use_nginxを false に ▌ ccngのプロパティはデフォルト値が spec で決まっているものが 多いが、Nise-BOSH がプロパティのデフォルト値に対応していな いため、すべて指定する必要があり大変。。 1VM Cloud Foundry の構築 Cloud Foundry のインストール ccng: &ccng use_nginx: false default_quota_definition: free srv_api_uri: http://api.192.168.33.10.xip.io logging_level: debug bulk_api_password: bulk_api_password staging_upload_user: staging staging_upload_password: staging external_host: api uaa_resource_id: cloud_controller quota_definitions: free: total_services: 10 memory_limit: 1024 non_basic_services_allowed: false … (以下略)
  • 19. Page 19 © NEC Corporation 2013 ▌ uaa.no_sslを true に ▌ cfクライアントを追加 (vmcの代わり)  autoapproveに登録しないとブラウザベースの認証しないと使えない。  cloud_controller.admin scope の追加。 1VM Cloud Foundry の構築 Cloud Foundry のインストール uaa: spring_profiles: postgresql no_ssl: true autoapprove: - cf scim: users: - micro@vcap.me|micro|scim.write,scim.read,openid clients: cf: override: true authorized-grant-types: implicit authorities: uaa.none scope: cloud_controller.read,cloud_controller.write,openid,password.write,cloud_controller.admin,scim.read,scim.write
  • 20. 起動! Page 20 © NEC Corporation 2013 1VM Cloud Foundry の構築 Cloud Foundry のインストール $ mkdir -p /var/vcap/shared $ chownvcap:vcap /var/vcap/shared $ mkdir -p /var/vcap/store $ ./bin/run-job start postgres $ ./bin/run-job start nats $ ./bin/run-job start gorouter $ ./bin/run-job start dea_next $ ./bin/run-job start health_manager_next $ ./bin/run-job start cloud_controller_ng $ ./bin/run-job start serialization_data_server $ ./bin/run-job start uaa $ ./bin/run-job start vcap_redis
  • 21. Page 21 © NEC Corporation 2012