Upload
tsunenori-oohara
View
87
Download
0
Embed Size (px)
Citation preview
itamae plugin CI
@ohrdev
自己紹介
おーはらtwitter: @ohrdev
仕事:- 目黒の会社-基盤技術部- Ruby/Lisp/Erlang/Elixir/Scala/AWS
趣味:-仏像制作,寺社仏閣,VR,FF14(白68),etc
今日のお話(3行で)
•Itamaeのプラグインのテストをしたいので
•Wercker,ServerspecでCIを整備しました
•その紹介(デモ)をします
参考情報(元ネタ)
34歳になった&Itamaeプラグイを本気でCIするhttp://sue445.hatenablog.com/entry/2016/04/07/195627
serverspechttp://serverspec.org/
>>デモ<<
• 先にデモします• https://github.com/ohr486/itamae-plugin-recipe-scala/
• 内容• 1) commitをpush
• 2) CIが起動
• 3) Vagrantが起動
• 4) itamaeを実行
• 5) serverspecを実行
• 6) 結果を表示
利用ツール・サービスの説明
• Itamae
• Serverspec
• Wercker
• Vagrant
• DigitalOcean
Itamae/pluginとは?
• https://github.com/itamae-kitchen/itamae
• Chefにインスパイヤされて作られた構成管理ツール
• pluginはgemとして作成できる
• 類似のツール• Ansible
• Chef
• Pupet
Serverspecとは?
• https://www.amazon.co.jp/dp/4873117097
• サーバの環境をrspecのDSLで書くことができるテストツール
Werckerとは?
• http://www.wercker.com/
• CIサービス、LXC,dockerが利用可能(現在はLXCは利用非推奨)
• 類似のサービス/ツール• TravisCI
• CircleCI
• CideCI
• Jenkins
Vagrantとは?
• https://www.vagrantup.com/
• HashCorp製の仮想環境構築・管理ツール
• 今回はDigitalOcean pluginを使って、ローカル(のVirtualBox)の代わりに、DigitalOcean上に環境を作る
Digital Oceanとは?
• https://www.digitalocean.com/
• アメリカの格安VPS
• Vagrantと連携できる(DOのvagrant pluginがある)
• SSDなので起動が早い
• 類似のサービス• AWS
• GCP
• Azure
流れ( PR -> Wercker -> DO )
• https://github.com/ohr486/itamae-plugin-recipe-scala
• GithubのPRが作成されるとWerckerが起動• https://github.com/ohr486/itamae-plugin-recipe-
scala/blob/master/wercker.yml
• Wercker上で• https://github.com/ohr486/itamae-plugin-recipe-
scala/blob/master/ci/setup.sh
• Dockerコンテナが起動
• Vagrant, DigitalOceanPluginをインストール
• SSHの鍵を設定(情報はwerckerの環境変数から取得)
• VagrantをDigitalOcean上に作成
流れ( DO -> Wercker )
• DigitalOcean上で• https://github.com/ohr486/itamae-plugin-recipe-
scala/blob/master/ci/build.sh
• Itamaeを流して環境作成
• Serverspecを実行してテスト
• Wercker上で• DigitalOceanのサーバーを削除
めでたしめでたし
• デモリポジトリ• github
• https://github.com/ohr486/itamae-plugin-recipe-scala
• wercker
• https://app.wercker.com/ohr486/itamae-plugin-recipe-scala/runs
まとめ
• サーバー構成管理のテストは安心(serverspec)
• CIに組み込むとお手軽にチェックできる
• DigitalOcean安くて便利
• 構成管理もテスト/CIしましょう