Your SlideShare is downloading. ×
真Drone入門
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

真Drone入門

305
views

Published on

時雨祭 2015/03 資料

時雨祭 2015/03 資料

Published in: Software

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
305
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 真 drone 入門 0
  • 2. 自己紹介 自己紹介 ∙ Yutaka Matsubara ∙ Abby CTO ∙ twiter: @mopemope ∙ github: @mopemope Abby 社員募集中です 1
  • 3. 宣伝 CoreOS Meetup で喋ります CoreOS Meetup Tokyo #1 http://coreos-meetup-tokyo.connpass.com/event/12596/ 2
  • 4. drone.io 3
  • 5. drone.io とは ∙ Brad Rydzewski が開発・運用 ∙ Docker ベースの CI サービス ∙ github, bitbucket などに対応 ∙ OSS バージョンが存在 今回は OSS の drone について話します 4
  • 6. drone 5
  • 7. drone OSS drone 基本は udzura さんの資料を見よ http://www.slideshare.net/udzura/droneio 6
  • 8. できないこと OSS 版では以下ができない ∙ 成果物の管理 (Artifact) ∙ GUI での操作 7
  • 9. 本題 8
  • 10. ドキュメントにあまり出てない話 9
  • 11. インストール 10
  • 12. インストール drone 自体 dockerize されている dockerize されているのでディストリビューションを問わない $ git clone git@github.com:drone/drone.git && cd drone $ sudo docker build -t drone/drone . 11
  • 13. 実行 設定はほぼ環境変数で可能 $ sudo docker run -d -v /home/ma2/drone:/var/lib/drone --net=host --name="drone" DRONE_DATABASE_DATASOURCE=/var/lib/drone/drone.sqlite -e DRONE_WORKER_NODES="tcp://0.0.0.0:2375" -e DRONE_BITBUCKET_CLIENT=XXXXXXXXXXXXXX -e DRONE_BITBUCKET_SECRET=XXXXXXXX drone/drone VOLUME が /var/lib/drone になっているので注意 12
  • 14. 対応しているサービス 13
  • 15. 対応しているサービス プライベートリポジトリも可能 ∙ GitHub ∙ GitHub Enterprise ∙ Gitlab ∙ Gogs ∙ Bitbucket 特に Bitbucket はプライベートリポジトリ作り放題なので個人に はもってこい 14
  • 16. Image 15
  • 17. Docker Image author 指定なしだとオフィシャル 実体は bradrydzewski/xxxx これらの Dockerfile も公開されている image: go:1.2 カスタムイメージ image: mopemope/gox:1.4 16
  • 18. オフィシャルとカスタムの違い オフィシャルは特別 オフィシャルは ubuntu 12.04 ベース ∙ 実行ユーザーが ubuntu ∙ HOME が /home/ubuntu ∙ リンクを解決するための proxy が入っている ∙ docker で link されているコンテナを localhost 経由で操作 17
  • 19. コード share/build/build.go case strings.HasPrefix(b.Build.Image, "bradrydzewski/") strings.HasPrefix(b.Build.Image, "drone/"): dockerfile.WriteUser("ubuntu") ... default: dockerfile.WriteUser("root") ... 18
  • 20. Services .drone.yml に書くデータベースなどもカスタマイズ可能 author/middleware:tag services: - mopemope/mysql:5.6 middleware 部がリンク名として使われる 19
  • 21. Publish 20
  • 22. Publish 成果物の Publish 先 ∙ S3 ∙ Swift ∙ NPM ∙ PYPI ∙ Docker ∙ Dropbox ∙ Github ∙ Bintray ∙ Azure ドキュメントに出てないものが幾つかある 21
  • 23. Dropbox Dropbox Application を作成し、TOKEN をもらう シェルとして展開されるので環境変数は展開される env: - TARGET=foo_$CI_BRANCH ... publish: dropbox: access_token: $$DROPBOX_TOKEN source: /bin/target.zip target: /artifact/latest/$TARGET.zip 22
  • 24. Deploy 23
  • 25. Deploy 成果物の Deploy 先 ∙ CloudFoundry ∙ Git ∙ Heroku ∙ Deis ∙ Modulus ∙ Nodejitsu ∙ SSH ∙ Tsuru ∙ Bash drone.io 参照 24
  • 26. カスタマイズ 25
  • 27. プラグインによるカスタマイズ シェルコマンドを書き込むプラグイン ∙ publish ∙ deploy go のコードとして展開 ∙ notify 26
  • 28. 例 dropbox publish cmd := "curl --upload-file %s -H "Authorization: Bearer %s" "https://api-content.dropbox.com/1/files_put/auto/%s? f.WriteCmd(fmt.Sprintf(cmd, d.Source, d.AccessToken, d.Targ 27
  • 29. 0.4 28
  • 30. .drone.yml .drone.yml の構造が大きく変わる build: image: go:$$go_version commands: - env ... compose: redis: image: redis matrix: go_version - 1.2 - 1.4 29
  • 31. Matrix 指定したイメージごとにビルドを実行 ∙ ディストリビューションを変えてのテスト ∙ 言語の別バージョンごとにビルド/テスト ∙ データベースのバージョンごとにビルド/テスト bradrydzewski/drone で開発中 30
  • 32. Matrix build: image: go:$$go_version matrix: go_version - 1.2 - 1.4 31
  • 33. Q & A 32