Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHP Conf Taiwan 2016 自動化與持續整合實作工作坊

530 views

Published on

伴隨 DevOps 熱潮全球延燒,包含在 DevOps 之中 Continuous Integration、Continuous Delivery 及 Automation 等重要觀念已是軟體開發流程中不可或缺的重要關鍵。本工作坊將從 DevOps 的基本觀念切入,搭配 CI Server 為工具,引導學員實際演練如何進行自動化建置、測試與部署,透過實作演練,引導學員了解如何打造您專屬的自動化服務。

Published in: Technology

PHP Conf Taiwan 2016 自動化與持續整合實作工作坊

  1. 1. : https://unsplash.com/photos/qAShc5SV83M Cheng Wei Chen @ PHPConf 2016.10.29 PHPConf 2016
 自動化與持續整合實作工作坊
  2. 2. Cheng Wei Chen 陳 正瑋 DevOps Engineer @ TheQwan 得寬科技 chengweichen.com
  3. 3. DevOps Taiwan FB 社團 - https://www.facebook.com/ groups/DevOpsTaiwan/ : https://stock.tookapic.com/photos/17849 個人目前會浮出水面的社群
  4. 4. 四位助教 如在操作上遇到障礙, 可立即尋求助教協助!
  5. 5. 如果還未建置環境 請立即建立 !!
  6. 6. 工作坊範例檔案 讓你少打一些字,複製貼上即可。 https://goo.gl/Vcvag7
  7. 7. 實作環境說明
  8. 8. 實作環境說明 Local VM Azure
  9. 9. Local VM 你的筆電 (Host)
  10. 10. Local VM 你的筆電 (Host) VM (Guest)
  11. 11. Local VM 你的筆電 (Host) VM (Guest) CI Server Selenium Server CI Worker Web Server Docker Container
  12. 12. Local VM 你的筆電 (Host) VM (Guest) CI Server Selenium Server CI Worker Web Server
  13. 13. Local VM 你的筆電 (Host) VM (Guest) CI Server Selenium Server CI Worker Web Server
  14. 14. Local VM 你的筆電 (Host) VM (Guest) CI Server Selenium Server CI Worker Web ServerVM (80) <-> 容器 (80)
  15. 15. Local VM 你的筆電 (Host) VM (Guest) CI Server Selenium Server CI Worker Web ServerVM (80) <-> 容器 (80) Host (10080) <-> VM (80)
  16. 16. Local VM 你的筆電 (Host) VM (Guest) GitLab Selenium ServerRunner 測試機VM (80) <-> 容器 (80) Host (10080) <-> VM (80)
  17. 17. Local VM 你的筆電 (Host) VM (Guest) GitLab Selenium ServerRunner 測試機VM (80) <-> 容器 (80) Host (10080) <-> VM (80) DEMO code
  18. 18. Local VM 你的筆電 (Host) VM (Guest) GitLab Selenium ServerRunner 測試機VM (80) <-> 容器 (80) Host (10080) <-> VM (80) DEMO code
  19. 19. Local VM 你的筆電 (Host) VM (Guest) GitLab Selenium ServerRunner 測試機VM (80) <-> 容器 (80) Host (10080) <-> VM (80) DEMO code
  20. 20. Local VM 你的筆電 (Host) VM (Guest) GitLab Selenium ServerRunner 測試機VM (80) <-> 容器 (80) Host (10080) <-> VM (80) DEMO code
  21. 21. Local VM 你的筆電 (Host) VM (Guest) GitLab Selenium ServerRunner 測試機VM (80) <-> 容器 (80) Host (10080) <-> VM (80) DEMO code 172.17.0.4 172.17.0.7 172.17.0.6 172.17.0.8
  22. 22. 你的筆電 DEMO code Azure VM GitLab Selenium ServerRunner 測試機 Cloud (Azure) VM
  23. 23. 你的筆電 DEMO code Azure VM GitLab Selenium ServerRunner 測試機 Cloud (Azure)
  24. 24. 你的筆電 DEMO code Azure VM GitLab Selenium ServerRunner 測試機 Cloud (Azure)
  25. 25. 你的筆電 DEMO code Azure VM GitLab Selenium ServerRunner 測試機 Cloud (Azure)
  26. 26. : https://www.pexels.com/photo/coffee-writing-computer-blogging-34600/ 工程師 自動化 (
  27. 27. 實際狀況 : https://www.pexels.com/photo/photo-33343/ 你以為會是 現實情況是 更多真實的狀況是 很多時候是 經常期待是 目標是 : https://www.pexels.com/photo/photo-64609/ : https://www.pexels.com/photo/photo-65050/ : https://picjumbo.com/real-mens-tools/ : https://pixabay.com/photo-1510561/ : https://pixabay.com/en/photo-593313/
  28. 28. : https://www.pexels.com/photo/coffee-writing-computer-blogging-34600/ DevOps
  29. 29. code build test deploy operateplan Measurement Monitor Metrics Analytics Continuous Integration Continuous Delivery DevOps Monitoring Automation Dev release Ops Sharing Fast Iteration Feedback break silos LEAN Culture Agile
  30. 30. 資訊 透明度 文化 自動化
  31. 31. 自動化 Continuous Integration Continuous Delivery Automated Build Continuous Deployment Continuous Testing Continuous Monitoring Automated Testing Release Automation
  32. 32. code buildplan Continuous Integration Continuous Delivery deploy Feedback releasetest Feedback operate Automation
  33. 33. : https://stock.tookapic.com/photos/10628 最簡單的自動化 單元一
  34. 34. : https://stock.tookapic.com/photos/10628 shell scripts 單元一 示範一
  35. 35. : https://stock.tookapic.com/photos/10628 cron + shell scripts
  36. 36. : https://stock.tookapic.com/photos/10628 Job Queue
  37. 37. : https://stock.tookapic.com/photos/10628 Job Queue
  38. 38. : https://stock.tookapic.com/photos/10628 Trigger Action
  39. 39. : https://stock.tookapic.com/photos/10628 Trigger Action
  40. 40. : https://stock.tookapic.com/photos/10628 讓很多事都能自動化 API 單元一 示範二
  41. 41. Think : https://unsplash.com/photos/hANqC3_kTqU
  42. 42. Trigger Scripts Interface Service Flow
  43. 43. : https://unsplash.com/photos/Fixg8KipOg8 Bots IM Voice CMD Interface 舉例
  44. 44. : https://unsplash.com/photos/Fixg8KipOg8 BotsCI PaaS Service Worker 舉例
  45. 45. : https://unsplash.com/photos/Fixg8KipOg8 DateTime Trigger Webhook Event Trigger 舉例
  46. 46. : https://unsplash.com/photos/Fixg8KipOg8 shell scripts Ansible Azure Functions hubot scripts Scripts 舉例
  47. 47. : https://unsplash.com/photos/Fixg8KipOg8 Flow
  48. 48. Trigger Scripts Interface Service Flow
  49. 49. Trigger Scripts Interface Service Flow 環境設置與安裝軟體的先後順序 Command Line bash xxx.sh VM, BASH process xxx.sh shell script
  50. 50. Trigger Scripts Interface Service Flow 執行動作的先後順序, Crontab 觸發的條件 Command Line Crontab VM, BASH process xxx.sh shell + cron
  51. 51. Trigger Scripts Interface Service Flow Job 的生命週期, Job 內程式執行的流程 Web Job Queue VM, php process, worker xxx.php Job Queue
  52. 52. Trigger Scripts Interface Service Flow 呼叫 API 的順序, 流程 Command Line ansible-playbook … VM, ansible process ansible-playbook.yml Gitlab API
  53. 53. Trigger Scripts Interface Service Flow 開發流程, 自動化動作的流程 CI Server 的 GUI code push CI Server, Worker, Runner 設定於 CI Server 上的自動化腳本 CI / CD
  54. 54. 開發流程 : https://www.pexels.com/photo/black-and-white-industry-factory-lamp-5004/
  55. 55. 開發流程 code build test release deploy operateplan
  56. 56. 開發流程 code build test release deploy operateplan
  57. 57. 開發流程 code build test release deploy operateplan CIcommit dev stagingtest testprod deploy
  58. 58. 開發流程 code build test release deploy operateplan CIcommit dev stagingtest testprod deploy
  59. 59. 開發流程 code build test release deploy operateplan CIcommit dev stagingtest testprod deploy environment dev staging prod local
  60. 60. 開發流程 code build test release deploy operateplan CIcommit dev stagingtest testprod deploy environment dev staging prod local More Automation ?
  61. 61. 今日練習流程 VCScommit CI build devdeploy test mergeprod deploy trigger
  62. 62. : https://stock.tookapic.com/photos/10628 自動化建置 單元二
  63. 63. 流程 build devdeploy test mergeprod deploy VCScommit Code .gitlab-ci.yml CI
  64. 64. 流程 build devdeploy test mergeprod deploy VCScommit GitLab Code git push .gitlab-ci.yml CI
  65. 65. 流程 build devdeploy test mergeprod deploy VCScommit Runner GitLab Code git push Trigger .gitlab-ci.yml CI
  66. 66. 流程 VM build devdeploy test mergeprod deploy VCScommit Runner GitLab Code git push Trigger .gitlab-ci.yml Job CI
  67. 67. 流程 VM Docker build devdeploy test mergeprod deploy VCScommit CI Runner GitLab Code git push Trigger .gitlab-ci.yml Runner Trigger Job Job
  68. 68. : https://stock.tookapic.com/photos/10628 建立 .gitlab-ci.yml 單元二 練習一
  69. 69. 流程 devdeploy test mergeprod deploy VCScommit CI Code + Vendor Code composer install build
  70. 70. : https://stock.tookapic.com/photos/10628 composer install 單元二 練習二
  71. 71. 流程 devdeploy test mergeprod deploy VCScommit CI master-12345.tarCode + Vendor Code composer install tar build
  72. 72. : https://stock.tookapic.com/photos/10628 將程式碼打包 單元二 練習三
  73. 73. 流程 devdeploy test mergeprod deploy VCScommit CI master-12345.tarCode + Vendor Code composer install tar build Artifactsupload
  74. 74. : https://stock.tookapic.com/photos/10628 送入 Artifacts 歸檔 單元二 練習四
  75. 75. : https://stock.tookapic.com/photos/10628 自動化部署 單元三
  76. 76. 流程 test mergeprod deploy VCScommit CI build devdeploy
  77. 77. : https://stock.tookapic.com/photos/10628 新增 stages: deploy-dev 單元三 練習一
  78. 78. 流程 test mergeprod deploy VCScommit CI build devdeploy Temp Container Runner code run Ansible playbook dev server Artifacts deploy
  79. 79. 流程 test mergeprod deploy VCScommit CI build devdeploy Temp Container Runner code run Ansible playbook dev server Artifacts 1.upload artifact 2.unarchive deploy 3.setup .env 4.composer dump-autoload 5.update nginx config 6.nginx reload
  80. 80. : https://stock.tookapic.com/photos/10628 設定自動化部署動作 單元三 練習二
  81. 81. Think : https://unsplash.com/photos/hANqC3_kTqU env code
  82. 82. 流程 test mergeprod deploy VCScommit CI build devdeploy Temp Container Runner code run Ansible playbook dev server Artifacts deploy 驗證 deploy
  83. 83. : https://stock.tookapic.com/photos/10628 驗證部署是否成功 單元三 練習三
  84. 84. Think : https://unsplash.com/photos/hANqC3_kTqU code
  85. 85. : https://stock.tookapic.com/photos/10628 共用的自動化腳本 單元三 練習四
  86. 86. : https://stock.tookapic.com/photos/10628 自動化測試 單元四
  87. 87. 流程 mergeprod deploy VCScommit CI build devdeploy test
  88. 88. 流程 mergeprod deploy VCScommit CI build devdeploy test Temp Container Runner SSH dev server phpunitrun
  89. 89. : https://stock.tookapic.com/photos/10628 新增 stages: test-dev 單元四 練習一
  90. 90. 流程 mergeprod deploy VCScommit CI build devdeploy test Temp Container Runner SSH dev server run phpunit Selenium server
  91. 91. : https://stock.tookapic.com/photos/10628 設定 Selenium Server 單元四 練習二
  92. 92. Think : https://unsplash.com/photos/hANqC3_kTqU phpunit.xml code
  93. 93. : https://stock.tookapic.com/photos/10628 顯示測試覆蓋率 單元四 練習三
  94. 94. : https://stock.tookapic.com/photos/10628 GUI 顯示測試覆蓋率 單元四 練習四
  95. 95. : https://stock.tookapic.com/photos/10628 從 dev 至 master 單元五
  96. 96. 流程 mergeprod deploy VCScommit CI build devdeploy test
  97. 97. : https://stock.tookapic.com/photos/10628 新增 dev branch 單元五 練習一
  98. 98. 流程 mergeprod deploy VCScommit CI build devdeploy test dev branch dev -> master CI git push git push CI autoauto
  99. 99. : https://stock.tookapic.com/photos/10628 區分 dev 與 master 的 CI 流程 單元五 練習二
  100. 100. 流程 mergeprod deploy VCScommit CI build devdeploy test Curl CItrigger deploy prod trigger
  101. 101. : https://stock.tookapic.com/photos/10628 透過 Trigger 驅動 Master 部署 單元五 示範三
  102. 102. 流程 VCScommit CI build devdeploy test mergeprod deploy trigger
  103. 103. Think : https://unsplash.com/photos/hANqC3_kTqU
  104. 104. : https://unsplash.com/photos/j0g8taxHZa0 Summary
  105. 105. 開發流程 code build test release deploy operateplan CIcommit dev stagingtest testprod deploy environment dev staging prod local
  106. 106. Trigger Scripts Interface Service Flow
  107. 107. code buildplan Continuous Integration Continuous Delivery deploy Feedback releasetest Feedback operate Automation
  108. 108. 實際狀況 : https://www.pexels.com/photo/photo-33343/ 你以為會是 現實情況是 更多真實的狀況是 很多時候是 經常期待是 目標是 : https://www.pexels.com/photo/photo-64609/ : https://www.pexels.com/photo/photo-65050/ : https://picjumbo.com/real-mens-tools/ : https://pixabay.com/photo-1510561/ : https://pixabay.com/en/photo-593313/
  109. 109. 團隊規模 流程 產品架構 找出你的最佳實踐 最佳 實踐 文化轉變 工具平台 跨職能人才
  110. 110. Thank You : https://unsplash.com/photos/oxjo1IQBK7M

×