Top Banner
Docker with Cloud Service Caesar Chi @clonncd May 28 2015
74

Docker with Cloud Service GCPUG

Aug 06, 2015

Download

Technology

Caesar Chi
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Docker with Cloud Service  GCPUG

Docker with Cloud Service

Caesar Chi @clonncd

May 28 2015

Page 2: Docker with Cloud Service  GCPUG

Communication is most important in development.

開發中資訊通透是最重要的關鍵

Page 3: Docker with Cloud Service  GCPUG

溝通

Page 4: Docker with Cloud Service  GCPUG

版本控制其中⺫⽬目的,讓團隊程式碼具有可追蹤,可掌控度

Page 5: Docker with Cloud Service  GCPUG

Rails ActiveRecord

資料庫也可以具有版本控管,可追蹤性

Page 6: Docker with Cloud Service  GCPUG

https://www.pixelapse.com/

圖⽚片版本控管⼯工具

Page 7: Docker with Cloud Service  GCPUG
Page 8: Docker with Cloud Service  GCPUG

為何使⽤用版本控制

• 明確了解版本之間疊代過程

• 知道開發過程的始末

• 明確了解團隊開發⽚片段經驗

• 掌控團隊進度

• 確保資訊通透度,維持溝通順暢

Page 9: Docker with Cloud Service  GCPUG

How about OS/ ENV

Page 10: Docker with Cloud Service  GCPUG

環境佈署,與開發通常是不同⼈人負責

Page 11: Docker with Cloud Service  GCPUG

通常希望的開發循環會是如此

Page 12: Docker with Cloud Service  GCPUG
Page 13: Docker with Cloud Service  GCPUG
Page 14: Docker with Cloud Service  GCPUG

開發對開發

• 規格實例化 • 規格的釐清 • 確認需求 • 前後端整合 • 第三⽅方 API 串接

Page 15: Docker with Cloud Service  GCPUG

開發對資料庫

• ORM Model • schema 版本控制 • 資料庫效能調教 • 資料庫正規化 • 報表製作

Page 16: Docker with Cloud Service  GCPUG

開發對視覺• 知道微變動之處 • 明確了解設計變動之處 • 掌握開發動線流程 • 促進雙⽅方溝通協議 • 儘快動⼯工,完成可操作第⼀一版本

Page 17: Docker with Cloud Service  GCPUG

開發對環境

• 開發系統環境規格 • 系統佈署⽅方式 • 正式環境與開發環境建置 • 正式環境與開發環境差異 • 異常釐清

Page 18: Docker with Cloud Service  GCPUG
Page 19: Docker with Cloud Service  GCPUG
Page 20: Docker with Cloud Service  GCPUG

productiondevelopme

OSX

UBUNTU

Same environment

Windows

Page 21: Docker with Cloud Service  GCPUG

find more services : https://registry.hub.docker.com/

Dockerlize

社群環境,擁有許多不同 OS 環境

Page 22: Docker with Cloud Service  GCPUG

開發環境變動更為⽅方便,服務調整更為簡潔

Page 23: Docker with Cloud Service  GCPUG
Page 24: Docker with Cloud Service  GCPUG
Page 25: Docker with Cloud Service  GCPUG
Page 26: Docker with Cloud Service  GCPUG
Page 27: Docker with Cloud Service  GCPUG

Dockerfile

Page 28: Docker with Cloud Service  GCPUG

ubuntu 14.04

ruby and nodejs

sails framework

ubuntu 14.04

ruby and nodejs

loopback

ubuntu 14.04

ruby and nodejs

Ruby on Rails

基於相同環境基礎,打造不同開發環境

Page 29: Docker with Cloud Service  GCPUG

ubuntu 14.04

ruby and nodejs

sails framework

ubuntu 14.04

ruby and nodejs

loopback

ubuntu 14.04

ruby and nodejs

Ruby on Rails

基於相同環境基礎,打造不同開發環境

Page 30: Docker with Cloud Service  GCPUG

extendable

ubuntu 14.04

ruby and nodejs

sails frameworkFROM smlsunxie/rudy-node:latest

Page 31: Docker with Cloud Service  GCPUG

ubuntu 14.04

ruby and nodejs

sails frameworkFROM smlsunxie/rudy-node:latest

RUN gem install compass RUN gem install bootstrap-sass

RUN npm install -g grunt-cli RUN npm install -g bower RUN npm install -g coffee-script RUN npm install -g sails

環境具有可讀性,通透度 打開環境設定,⿊黑盒⼦子的祕密

Page 32: Docker with Cloud Service  GCPUG
Page 33: Docker with Cloud Service  GCPUG

Dockerfile

https://github.com/enokd/docker-node-hello/blob/master/Dockerfile

$docker build .$docker run -p 49160:8080 -d gasi/centos-node-hello

Page 34: Docker with Cloud Service  GCPUG

$docker build .$docker run -p 49160:8080 -d gasi/centos-node-hello

centOS

nodejs

Page 35: Docker with Cloud Service  GCPUG

Docker Simple Waydocker-compose / fig

Page 36: Docker with Cloud Service  GCPUG

• $docker pull mysql:latest

• $docker run \ -p 3306:3306 \ -v /data/mysql:/var/lib/mysql \-e MYSQL_ROOT_PASSWORD=root \ mysql

fig.yml / compose.yml

Page 37: Docker with Cloud Service  GCPUG

VS

• $docker pull mysql:latest

• $docker run \ -p 3306:3306 \-v /data/mysql:/var/lib/mysql \-e MYSQL_ROOT_PASSWORD=root \mysql

Page 38: Docker with Cloud Service  GCPUG

• 查詢所有環境變數:fig run SERVICE_NAME env

• 環境變數清楚可⾒見

Page 39: Docker with Cloud Service  GCPUG

Mysql

Redis

2.8

5.7

Page 40: Docker with Cloud Service  GCPUG

環境與程式共存

Page 41: Docker with Cloud Service  GCPUG

https://github.com/enokd/docker-node-hello/

Page 42: Docker with Cloud Service  GCPUG
Page 43: Docker with Cloud Service  GCPUG
Page 44: Docker with Cloud Service  GCPUG

機制

Page 45: Docker with Cloud Service  GCPUG
Page 46: Docker with Cloud Service  GCPUG
Page 47: Docker with Cloud Service  GCPUG
Page 48: Docker with Cloud Service  GCPUG

環境透過不斷堆疊,重複使⽤用,讓環境進⼊入版本控制

Page 49: Docker with Cloud Service  GCPUG

Docker 架構

Page 50: Docker with Cloud Service  GCPUG
Page 51: Docker with Cloud Service  GCPUG

ubuntu 14.04

ruby and nodejs

sails framework

ubuntu 14.04

ruby and nodejs

loopback

Windows azure VM -> create coreOS

Page 52: Docker with Cloud Service  GCPUG

ubuntu 14.04

ruby and nodejs

sails framework

ubuntu 14.04

ruby and nodejs

loopback

Windows azure VM -> create coreOS

10082:80 10083:80

Page 53: Docker with Cloud Service  GCPUG

ubuntu 14.04

ruby and nodejs

sails framework

ubuntu 14.04

ruby and nodejs

loopback

Windows azure VM -> create coreOS

10082:80 10083:80

Page 54: Docker with Cloud Service  GCPUG

ubuntu 14.04

Haproxy

ubuntu 14.04

ruby and nodejs

loopback

80:80

10081:80

ubuntu 14.04

ruby and nodejs

loopback

10082:80

ubuntu 14.04

ruby and nodejs

loopback

10083:80

Page 55: Docker with Cloud Service  GCPUG

ubuntu 14.04

Haproxyubuntu 14.04

ruby and nodejs

loopback

ubuntu 14.04

ruby and nodejs

loopback

Page 56: Docker with Cloud Service  GCPUG

混搭不同雲端服務,打造完整⽣生態

Page 57: Docker with Cloud Service  GCPUG

傻⽠瓜版本https://www.tutum.co/

Page 58: Docker with Cloud Service  GCPUG

https://www.tutum.co/

Page 59: Docker with Cloud Service  GCPUG

https://www.tutum.co/

Page 60: Docker with Cloud Service  GCPUG
Page 61: Docker with Cloud Service  GCPUG

ubuntu 14.04

Haproxyubuntu 14.04

ruby and nodejs

loopback

ubuntu 14.04

ruby and nodejs

loopback

https://support.tutum.co/support/solutions/articles/5000050235-load-balancing-a-web-service

Page 62: Docker with Cloud Service  GCPUG

ubuntu 14.04

ruby and nodejs

loopback

ubuntu 14.04

ruby and nodejs

loopback

ubuntu 14.04

ruby and nodejs

loopback

https://github.com/kelonye/node-tutum-deploy

Page 63: Docker with Cloud Service  GCPUG

統⼀一管理 Web GUI 監控程式執⾏行狀況

Page 64: Docker with Cloud Service  GCPUG

後記

Page 65: Docker with Cloud Service  GCPUG

Docker 讓 OS / 開發環境變得更容易掌控,清晰

Page 66: Docker with Cloud Service  GCPUG

Dockerfile 讓 Dev & Ops 交流更為清晰

Page 67: Docker with Cloud Service  GCPUG

Cloud service ⽀支援 docker ,讓佈署變得簡單

Page 68: Docker with Cloud Service  GCPUG

節省時間達到最⾼高的效益

Page 69: Docker with Cloud Service  GCPUG

確保⼈人員間順暢溝通

Page 70: Docker with Cloud Service  GCPUG

Communication is most important in development.

開發中資訊通透是最重要的關鍵

Page 71: Docker with Cloud Service  GCPUG

node-js-500-samples

https://www.gitbook.com/book/peihsinsu/node-js-500-samples/details

Page 72: Docker with Cloud Service  GCPUG

Ref

• http://www.slideshare.net/smlsun/docker-42790855

• http://www.slideshare.net/kojilin/docker-intro-35870496

• https://www.gitbook.com/book/philipzheng/docker_practice/details

• http://www.meetup.com/Docker-Taipei/

Page 73: Docker with Cloud Service  GCPUG
Page 74: Docker with Cloud Service  GCPUG