ドリコムのinfrastructure as code
DESCRIPTION
TRANSCRIPT
![Page 1: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/1.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 1
ドリコムのInfrastructure as Code
2014.05.23最新インフラエンジニア技術勉強会
![Page 2: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/2.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 2
名前 ひらしー ( とか狂犬?とか ) 出身 : グンマー
所属 サービス基盤本部 サービス基盤部 インフラグループ
職種 インフラエンジニア
![Page 3: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/3.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 3
⁃ ドリコムのインフラ規模
⁃ Chef 運用
⁃ コード管理
⁃ テスト駆動インフラ
![Page 4: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/4.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 4
ドリコムのインフラ規模
⁃ 1 日の全アプリ合計 PV
⁃ 1 日の全アプリ合計 DAU1億以上
100万以上
![Page 5: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/5.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 5
ドリコムのインフラ規模
⁃ サーバ台数
ホスティング
クラウド
約 300 台
約 1000 台
![Page 6: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/6.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 6
ドリコムのインフラ規模
⁃ サーバ台数
1 ヶ月の増加台数
約 30 台~ 50 台
![Page 7: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/7.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 7
ドリコムのインフラ規模
⁃ 上記サーバを診るインフラエンジニア
![Page 8: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/8.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 8
ドリコムのインフラ規模
3 人
![Page 9: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/9.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 9
ドリコムのインフラ規模
少人数で早く正確なインフラを回すには?
![Page 10: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/10.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 10
⁃ ドリコムのインフラ規模
⁃ Chef 運用
⁃ コード管理
⁃ テスト駆動インフラ
![Page 11: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/11.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 11
Chef の運用方法
米国 Chef 社 ( 旧 : Opscode 社 ) が開発オープンソースとして公開されている
サーバの構成管理を行うフレームワーク
![Page 12: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/12.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 12
Chef の運用方法
⁃ 特徴Ruby で書ける ( 内部 DSL)
べき等性という考え方
Ruby エンジニアが多いため、 構築状況が共有しやすい
![Page 13: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/13.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 13
Chef の運用方法
何度実行しても” nginx.conf.src” という Chef 管理のファイルと等しくなるべき
べき等性に沿った記述
![Page 14: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/14.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 14
Chef の運用方法
Chef-ServerChef-Solo
![Page 15: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/15.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 15
Chef の運用方法
Chef-Server 構成※Chef 社公式サイトから引
用
![Page 16: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/16.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 16
Chef の運用方法
Chef-Solo 構成※Chef 社公式サイトから引
用
![Page 17: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/17.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 17
Chef の運用方法
Chef-ServerChef-Solo
![Page 18: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/18.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 18
Chef の運用方法
⁃ Why 以前は Chef-Server 構成だったが
クライアント 100 台を超えたあたりから CouchDB がボトルネックになった※Chef11 から PostgreSQL が採用された
Chef-Server と Chef-Client 連携による定期的収束を既存サーバに適用できなかった
![Page 19: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/19.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 19
Chef の運用方法
⁃ Why プロビジョニング処理とサーバ情報の取得
という観点では Chef-Server が必要ない
現状 Chef-Solo とシェルスクリプト
の組み合わせで十分
![Page 20: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/20.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 20
Chef の運用方法
ドリコムの Chef 開発フロー
![Page 21: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/21.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 21
Chef の運用方法
レシピの開発
![Page 22: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/22.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 2222
CI
DC
DC
DC
本番環境インフラメンバ
git push
Chef の運用方法
![Page 23: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/23.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 23
Chef の運用方法
GitLab
![Page 24: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/24.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 2424
CI
DC
DC
DC
本番環境
GitLab
Chef の運用方法
インフラメンバ
![Page 25: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/25.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 25
Chef の運用方法
Jenkins
![Page 26: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/26.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 26
Chef の運用方法
Vagrant
vagrant snapshot back
OS インストール直後のスナップショット
vagrant provision
Chef の実行
![Page 27: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/27.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 27
Chef の運用方法
Foodcritic
![Page 28: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/28.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 28
Chef の運用方法
serverspec
nginx の状態をテストする例
![Page 29: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/29.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 2929
CI
DC
DC
DC
本番環境
GitLab
Jenkins Vagrant
Chef の運用方法
インフラメンバ
![Page 30: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/30.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 3030
CI
DC
DC
DC
本番環境
GitLab
Jenkins Vagrant
Chef の運用方法
インフラメンバ
![Page 31: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/31.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 3131
CI
DC
DC
DC
本番環境インフラメン
バ
GitLab
Jenkins Vagrant
Chef の運用方法
git push
![Page 32: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/32.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 3232
CI
DC
DC
DC
本番環境インフラメン
バ
GitLab
Jenkins Vagrant
Chef の運用方法
![Page 33: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/33.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 33
Rundeckホスト名や IP アドレスを正規表現で検索
Chef の運用方法
Zabbix-API にて取得済のホスト情報
![Page 34: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/34.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 34
Rundeck
ホスト毎の実行結果
Chef の運用方法
![Page 35: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/35.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 3535
CI
DC
DC
DC
本番環境インフラメン
バ
GitLab
Jenkins Vagrant
Chef の運用方法
![Page 36: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/36.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 36
⁃ ドリコムのインフラ規模
⁃ Chef 運用
⁃ コード管理
⁃ テスト駆動インフラ
![Page 37: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/37.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 37
コード管理
3つの「○○ Driven
Infrastracture 」
![Page 38: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/38.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 38
コード管理
Issue Driven Infrastructure
![Page 39: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/39.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 39
コード管理
Pull Request Driven Infrastructure
![Page 40: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/40.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 40
コード管理
マサカリ Driven Infrastructure
![Page 41: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/41.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 41
⁃ ドリコムのインフラ規模
⁃ Chef 運用
⁃ コード管理
⁃ テスト駆動インフラ
![Page 42: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/42.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 42
テスト駆動インフラ
テスト項目書 作業手順書
インフラ作業といえば…
![Page 43: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/43.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 43
テスト駆動インフラ
serverspec で作業項目を記載
GitLab を使ってコードレビュー
開発環境で実行・テスト
本番環境で実行・テスト
![Page 44: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/44.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 44
44
テストシナリオ (yaml)
drecom-serverspec実行する serverspec ファイルパス
テスト対象ホスト
テスト駆動インフラ
![Page 45: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/45.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 45
45
drecom-serverspec
テスト結果 ( コマンド出力 )
テスト項目 (describe)テスト対象サーバ
テスト駆動インフラ
![Page 46: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/46.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 46
まとめ
![Page 47: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/47.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 47
少人数で早く正確なインフラを回すには?
![Page 48: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/48.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 48
⁃ 早
⁃ 正確
Chef によるプロビジョニング自動化
CI ツールと serverspec によるテスト自動
化
PDCA サイクルによる品質管理
![Page 49: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/49.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 4949
PlanDoCheckAction
Chef,serverspec のコードレ
ビューChef,Rundeck による実行
serverspec 実行
Chef,serverspec コード修正
![Page 50: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/50.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 50
その他雑感
![Page 51: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/51.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 51
⁃ Chef-Server Chef-Server を有効に活用できている事例ってあ
る?
⁃ Rundeck リモートサーバのオペレーション管理が便利すぎるのに無名
![Page 52: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/52.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 52
ご静聴ありがとうございました! !
![Page 53: ドリコムのInfrastructure as code](https://reader036.vdocuments.pub/reader036/viewer/2022062613/540dcd018d7f72767e8b4b50/html5/thumbnails/53.jpg)
Copyright Drecom Co., Ltd. All Rights Reserved. 53
会社概要
社名:証券コード:本社:
電話番号:社員数:設立年月日:資本金:
事業内容:
株式会社ドリコム3793 東証マザーズ〒 153-0064東京都目黒区下目黒1丁目 8-1 アルコタワー 17FTEL:03-6682-5700 FAX:03-6682-5711239 名 (正社員・契約社員のみ)2001年 11 月 13 日1,124百万円(2014年 3 月末現在 )
ソーシャルゲーム事業ソーシャルラーニング事業アドソリューション事業
Copyright Drecom Co., Ltd. All Rights Reserved.