Slide 1

Slide 1 text

如何在微服務系統架構上導入 CI/CD Hash Lin MOPCON 2021 商務部長 Lead Engineer @ Askmiso

Slide 2

Slide 2 text

Who am I # Askmiso Lead Engineer # Lead SRE & Backend # Remote work # MOPCON Organizer Hash Lin

Slide 3

Slide 3 text

Agenda Why we need CI/CD How to deploy our service with CD Best practice of CI/CD 1 2 3

Slide 4

Slide 4 text

CI CD Continuous Integration Continuous Deployment 名詞解釋

Slide 5

Slide 5 text

Integration 檢查程式是否吻合專案文化 檢查程式是否吻合 Coding Style 執行單元測試 安裝專案所需套件 檢查程式是否有問題 手動進行程式測試 CI

Slide 6

Slide 6 text

Continuous Integration

Slide 7

Slide 7 text

逐一推送上所有 Production 環境 部屬流程 抓取最新的程式碼 將程式碼進行安裝流程並且打包

Slide 8

Slide 8 text

Deployment 手動執行部署流程 ○ 打包程式上傳到 Server ○ 透過 rsync 來進行同步 一鍵部署流程 ○ 撰寫 Shell Script ○ 使用 Ansible CD

Slide 9

Slide 9 text

太多瑣事了

Slide 10

Slide 10 text

導入 CI/CD 解決了什麼問題 推送即檢查 減少人為介入 全自動化的流程

Slide 11

Slide 11 text

導入一二三 撰寫 CI config file 選擇 CI/CD 平台 給予 CI 權限進行部署

Slide 12

Slide 12 text

CI/CD Platform

Slide 13

Slide 13 text

Github Action Github CI/CD platform open source action model Support service

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Gitlab CI Open source Self hosted Support service

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Gitlab x JIRA

Slide 20

Slide 20 text

Gitlab x ClickUp

Slide 21

Slide 21 text

Container Management

Slide 22

Slide 22 text

Without container management Not easy to manage container Use docker run or docker-compose Not easy to scale

Slide 23

Slide 23 text

Easy to transfer environment to different cloud Interface of infrastructure yaml or helm Kubernetes

Slide 24

Slide 24 text

Nomad Jar / shell script ... Secret management: Vault Service Mesh: Consul Light

Slide 25

Slide 25 text

Cloud solution Google Cloud Run Google App Engine Aws Elastic Container Service

Slide 26

Slide 26 text

Deploy Process Push docker image to docker registry Authentication Update config of deployment Update Strategy

Slide 27

Slide 27 text

Let Run It

Slide 28

Slide 28 text

Implement CI/CD 決定每個 Stage 要做的事情 決定要在 CI 中跑哪些檢查 開始撰寫 Config File 放上 CI platform

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Sending Merge Request Develop Review & Merge Request Run CI Pipeline 1. Install Project 2. Unit Test Build Docker Image Docker Hub / Private Docker Registry Continuous Integration Continuous Deployment

Slide 31

Slide 31 text

Conclusion

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Continuous Integration (CI) 安裝 套件相依性、應用程式 檢查 Coding Style 、 Syntax Error 測試 Unit Test 、 Integration Test 、 E2E Testing

Slide 34

Slide 34 text

Continuous Integration (CI) 將繁瑣的事情全部自動化 可以更快速的發掘問題 更放心的提交程式碼

Slide 35

Slide 35 text

Container Management Kubernetes Nomad

Slide 36

Slide 36 text

Best Practice with CI/CD 敏感資訊不要放在 code base 中 善用 Environment Variable / dotenv 給 CI Runner 適量的權限

Slide 37

Slide 37 text

Thank You!