CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

82
Cheng Wei Chen @ Agile Tour Kaohsiung 2017 Photo by Alex Jones on Unsplash CI / CD / 自動化 你還沒準備好!?

Transcript of CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Page 1: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Cheng Wei Chen @ Agile Tour Kaohsiung 2017Photo by Alex Jones on Unsplash

CI / CD / 自動化

你還沒準備好!?

Page 2: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Cheng Wei Chen 陳 正瑋

DevOps Engineer @ 得寬科技

http://chengweichen.com

Page 3: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

2013

100 % Laravel

JetBrains

( )

Page 4: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

PHP/Laravel http://www.laravel-dojo.com

Page 5: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

你是老闆 / 決策者嗎?

Page 6: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

對於實際負責現場的員工

Page 7: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

有時候很怕遇到一種狀況

Page 8: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

老闆:「我昨天聽見⋯⋯我覺

得我們公司應該要導入⋯⋯」

NEWWAY

Page 9: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Photo by Paul on Unsplash

!!!???

Page 10: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

DevOps CI / CD

社群真實案例

Page 11: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Photo by Matthew Henry on Unsplash

CI / CD

Page 12: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

201620051930 1995 20001990

Agile 2008 conference, Andrew Clay Shafer and Patrick Debois discussed “Agile Infrastructure”

2009/06/23, O’Reilly Velocity, “10+ Deploys per Day Dev and Ops Cooperation at Flickr”

2009 - DevOpsDays Ghent in Belgium

2010 - Book Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation

2013 - Book The Phoenix Project

2010

: http://finding-marbles.com/2012/04/15/a-brief-history-of-agile-and-lean-events/ , https://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software , http://www.jianshu.com/p/f40209023006 , http://itrevolution.com/the-history-of-devops/ , http://www.tocinstitute.org/history-of-toc.html

Page 13: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

201620051930 1995 20001990

Agile 2008 conference, Andrew Clay Shafer and Patrick Debois discussed “Agile Infrastructure”

2009/06/23, O’Reilly Velocity, “10+ Deploys per Day Dev and Ops Cooperation at Flickr”

2009 - DevOpsDays Ghent in Belgium

2010 - Book Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation

2013 - Book The Phoenix Project

2010

: http://finding-marbles.com/2012/04/15/a-brief-history-of-agile-and-lean-events/ , https://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software , http://www.jianshu.com/p/f40209023006 , http://itrevolution.com/the-history-of-devops/ , http://www.tocinstitute.org/history-of-toc.html

Page 14: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Photo by Sweet Ice Cream Photography on Unsplash

CI / CD / Automation

軟體開發新顯學

!!!???

Photo by Paul on Unsplash

Page 15: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

1930s – PDCA-Cycle

201620051992 – Crystal

1930

2002 – TDD

2007 – Kanban for Software Development

2009 – Lean Startup

1995 20001990 2010

1999 – User Stories

1999 – eXtreme Programming

1995 – Scrum

2001 – Agile Manifesto 2007 – Agile Retrospectives

1993 – Refactoring

1995 – Pair Programming

1999 – Continuous Integration

2006 – BDD

1940s – Kanban & Toyota Production Systems / Lean

2003 – Lean Software Development

2009 – Software Craftsmanship Manifesto

2008 – Clean Code2009 - DevOps

2006 – AWS

2012 – Ansible

2009 – Chef

2005 – Puppet

2007 – VirtualBox

1999 – VMware

2005 – Git

2010 - Continuous Delivery

: http://finding-marbles.com/2012/04/15/a-brief-history-of-agile-and-lean-events/ , https://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software , http://www.jianshu.com/p/f40209023006 , http://itrevolution.com/the-history-of-devops/ , http://www.tocinstitute.org/history-of-toc.html

1984 – TOC

Page 16: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

: http://finda.photo/image/11418

工程師 自動化

Page 17: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

工程師愛自動化 https://www.youtube.com/watch?v=WRkJn5N77jM

Page 18: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

: https://unsplash.com/photos/Fixg8KipOg8

Trigger ScriptsInterface ServiceFlow

什麼是自動化?

Page 19: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

: https://unsplash.com/photos/Fixg8KipOg8

shell scripts (provisioning) cron + shell scripts CI Server + CI Jobs

IFTTT Event triggered / Alerts

Trigger ScriptsInterface ServiceFlow

舉例

Page 20: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

code build test release deploy operateplan

Continuous Integration

Continuous Delivery

Automation

CI/CD/Automation

Continuous Deployment

CIcommit dev stagingtest

testprod deploy

environment

dev

staging

prod

local

Infrastructure as

Code

Page 21: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

自動化能夠帶來許多好處

Page 22: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

消除重複的工作

Page 23: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

提升軟體的交付速度(節省時間?)

Page 24: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

降低成本、消除浪費

Page 25: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

降低人為錯誤

Page 26: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

消除對個體或團隊的依賴

Page 27: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

more…

Page 28: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

通常當我們聽見

自動化的好處時

Page 29: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Photo by Andrew Neel on Unsplash

Page 30: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

等到實際換你上場時...

Page 31: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

https://www.offworlddesigns.com/game-over-t-shirt/

梗圖:陣亡的瑪莉歐(水管工人)

Page 32: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

理想與現實的差距

Page 33: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

_____萬事起頭難

Page 34: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

會遇到的坑,比想像的多

Oooops

Page 35: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

該從何處開始著手?

Page 36: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

code build test release deploy operateplan

Continuous Integration

Continuous Delivery

Automation

從何處開始著手?

Continuous Deployment

CIcommit dev stagingtest

testprod deploy

environment

dev

staging

prod

local

Infrastructure as

Code

Page 37: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Deploy

從痛點開始

stagingdev test test production

staging test production

Project-1

Project-2

production Project-3x10

x5

x3

舉例

Page 38: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

應用程式所需的 environment?

Deploy

從小處開始

如何取得 Artifacts?

是否有其他初始化的動作?

如何因應「部署失敗」?

如何連上主機? 需要額外的組態管理?

如何因應「重新部署」?

舉例

Page 39: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

該選用哪種技術 / 工具?

Page 40: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

技術及工具的決策?

add or delete AWS Route53 DNS

AWS SDK for Python

Ansible Module - route53

AWS SDK for PHP

• php • API • Ansible •

舉例

Page 41: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

技術及工具的決策?

Ansible AWS SDK

梗圖:料理東西軍,你要選哪道菜?

Page 42: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

標準與客製

Page 43: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

應用程式所需的 environment?

Deploy

自動化前,先標準化

如何取得 Artifacts?

是否有其他初始化的動作?

如何因應「部署失敗」?

如何連上主機? 需要額外的組態管理?

如何因應「重新部署」?

x2 x2 x3

x3x2

x3 x2

舉例

Page 44: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

大致標準化,預留客製空間

tasks: - name: download artifacts get_url: artifacts.zip - name: setup env templates: nginx.conf - name: reload nginx services: nginx reload

tasks: - name: download scripts get_url: deploy.sh - name: run scripts command: sh deploy.sh

Page 45: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

為了自動化而自動化不要

Page 46: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

https://xkcd.com/1205/

Page 47: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

即是 Code 就有

需求與優先順序

Page 48: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

看見全貌!

不過度專注局部感謝 Ruddy 老師

Page 49: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

在非瓶頸設備省下的

每個小時都是虛幻的。

感謝 高德拉特博士

感謝 葉秉哲 前輩

Page 50: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

多而繁雜的細節

Page 51: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

code build test release deploy operateplan

Continuous Integration

Continuous Delivery

Automation

以 pipeline 為例

Continuous Deployment

CIcommit dev stagingtest

testprod deploy

environment

dev

staging

prod

local

Infrastructure as

Code

Page 52: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Photo by Mike Wilson on Unsplash

你就是水管工人!

Page 53: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

好書非讀不可

Page 54: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

好書非讀不可

Page 55: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

技術轉移及技能喪失

Page 56: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

In their efforts to compensate for the unreliability of human performance, the designers of automated control systems have unwittingly created opportunities for new error types that can be even more serious than those they were seeking to avoid.

—James Reason

Page 57: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

更多的文件、培訓、訓練

Page 58: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

持續改善及持續維護

Page 59: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

持續改善勝過追求完美

START

Page 60: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

自動化需要人力、工時

Page 61: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

好書非讀不可

https://landing.google.com/sre/book.html

Page 62: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Summary

Page 63: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

: http://finda.photo/image/11418

工程師 自動化

Page 64: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

: http://finda.photo/image/11418

工程師 自動化老闆 省時、省錢、省資源

Page 65: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

: https://unsplash.com/photos/Fixg8KipOg8

Trigger ScriptsInterface ServiceFlow

什麼是自動化?

Page 66: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

自動化能夠帶來許多好處

Page 67: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

但自動化的坑,比你想像的多

Oooops

Page 68: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

自動化需要的資源(人力、工時),

也比你想像的多

Page 69: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

自動化需要的評估關鍵,

也同樣比你想像的多

Page 70: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

• • • • •

思考並評估

Photo by Paul on Unsplash

Page 71: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

• • • • •

思考並評估

Photo by Paul on Unsplash

Page 72: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

好書非讀不可

Page 73: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

CD

https://www.infoq.com/articles/Continuous-Delivery-Maturity-Model

Page 74: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

好書非讀不可

https://landing.google.com/sre/book.html

Page 75: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

• Operator-triggered manual action • Operator-written, system-specific automation • Externally maintained generic automation • Internally maintained, system-specific automation • Autonomous systems that need no human intervention

自動化的演進

https://landing.google.com/sre/book.html Photo by Paul on Unsplash

Page 76: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Photo by Sweet Ice Cream Photography on Unsplash

自動化是一種力量倍增器,但不是萬靈丹!

Page 77: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

反覆評估、持續改善

Photo by Sweet Ice Cream Photography on Unsplash

迭代

Page 78: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

工商服務

Page 79: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

https://devopstw.club

Page 80: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

尋求志工、贊助

: https://pixabay.com/en/building-joy-planning-plans-1080592/ , https://pixabay.com/en/baby-hand-dad-200760/

Page 81: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

尋求講者及講題

: https://www.pexels.com/photo/man-person-suit-united-states-of-america-2281/

Page 82: CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)

Photo by Clark Tibbs on Unsplash

Thank You