Slide 1

Slide 1 text

Ernest Chiang, 2021 拆解整合 將 Laravel 運⾏在 Amazon ECS Running Laravel on Amazon ECS

Slide 2

Slide 2 text

Shared Notes • https://hackmd.io/@dwchiang/ laravel-on-amazon-ecs-2021- awsug • 短網址:
 https://bit.ly/ecs2021awsug • 問與答 Q&A 共筆筆記

Slide 3

Slide 3 text

拆.解.整.合.的.旅.⼈ • PAFERS
 Product & Technology Integration • AWS
 Community Hero • ex-TSMC
 Process Integration Engineer Ernest Chiang

Slide 4

Slide 4 text

COSCUP | https://bit.ly/yt-pkb 近期分享

Slide 5

Slide 5 text

Outline ⼤綱 • 拆解整合;思路介紹 • Laravel • Virtualization; Containerization; Orchestration • Amazon ECS • Laravel on Amazon ECS • Demo

Slide 6

Slide 6 text

資訊爆炸?無法消化? www.ErnestChiang.com 思路

Slide 7

Slide 7 text

藉由拆解、定義,釐清思緒。 1

Slide 8

Slide 8 text

藉由拆解、定義,釐清思緒。 再⽤整合、組合,實現產出。 1

Slide 9

Slide 9 text

藉由拆解、定義,釐清思緒。 再⽤整合、組合,實現產出。 1

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

先⼿動,再⾃動。 2

Slide 12

Slide 12 text

就。很。動。 2

Slide 13

Slide 13 text

1. 草稿初版流程。 2

Slide 14

Slide 14 text

1. 草稿初版流程。 2. 驗證流程產出。 2

Slide 15

Slide 15 text

1. 草稿初版流程。 2. 驗證流程產出。 3. 找⼯具⾃動化。 2

Slide 16

Slide 16 text

流程步驟 2

Slide 17

Slide 17 text

S. + V. + O. 流程步驟 2

Slide 18

Slide 18 text

input/trigger (S.) 👉 process (V.) 👉 output (O.) 流程步驟 2

Slide 19

Slide 19 text

input/trigger (S.) 👉 process (V.) 👉 output (O.) 流程步驟 2

Slide 20

Slide 20 text

input/trigger (S.) 👉 process (V.) 👉 output (O.) ⾃動化 2

Slide 21

Slide 21 text

先⼿動,再⾃動。 2

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Class vs. Instance 3

Slide 24

Slide 24 text

3

Slide 25

Slide 25 text

3

Slide 26

Slide 26 text

3

Slide 27

Slide 27 text

3

Slide 28

Slide 28 text

3

Slide 29

Slide 29 text

Class vs. Instance 3

Slide 30

Slide 30 text

img src: https://commons.wikimedia.org/wiki/File:Cair_Pavarel.jpg Laravel www.ErnestChiang.com issues?

Slide 31

Slide 31 text

That is Cair Paravel, the castle of the four thrones.

Slide 32

Slide 32 text

從 本機 開始

Slide 33

Slide 33 text

先⼿動,再⾃動。

Slide 34

Slide 34 text

我 👉 開發 👉 程式源碼 www.ErnestChiang.com

Slide 35

Slide 35 text

我 👉 安裝 👉 執⾏環境 www.ErnestChiang.com

Slide 36

Slide 36 text

我 👉 安裝 👉 作業系統 www.ErnestChiang.com

Slide 37

Slide 37 text

我 👉 安裝 👉 ⼀台電腦 www.ErnestChiang.com

Slide 38

Slide 38 text

我 👉 安裝 👉 ⼀台電腦 我 👉 安裝 👉 作業系統 我 👉 安裝 👉 執⾏環境 我 👉 開發 👉 程式源碼 www.ErnestChiang.com

Slide 39

Slide 39 text

我 👉 安裝 👉 ⼀台電腦 👈 別⼈做的 我 👉 安裝 👉 作業系統 👈 別⼈做的 我 👉 安裝 👉 執⾏環境 👈 別⼈做的 我 👉 開發 👉 程式源碼 👈 ⾃⼰做的 www.ErnestChiang.com

Slide 40

Slide 40 text

我 👉 安裝 👉 ⼀台電腦 我 👉 安裝 👉 作業系統 我 👉 安裝 👉 執⾏環境 我 👉 開發 👉 程式源碼 www.ErnestChiang.com

Slide 41

Slide 41 text

在我的電腦上,可以正常執⾏ www.ErnestChiang.com

Slide 42

Slide 42 text

在同事電腦上,就。很。炸。 www.ErnestChiang.com

Slide 43

Slide 43 text

就別提部署到量產主機了?!

Slide 44

Slide 44 text

www.ErnestChiang.com

Slide 45

Slide 45 text

www.ErnestChiang.com

Slide 46

Slide 46 text

所以?將 PHP Code 打包?

Slide 47

Slide 47 text

還是 加上 執⾏環境 ⼀起打包?

Slide 48

Slide 48 text

還是 外加 作業系統 ⼀起打包?

Slide 49

Slide 49 text

好,⾄少我們知道這台電腦不能打包。

Slide 50

Slide 50 text

就。不。包。

Slide 51

Slide 51 text

solution? Virtualization www.ErnestChiang.com

Slide 52

Slide 52 text

Virtualization 虛擬化 • Virtual • Virtual machine (VM) • Hypervisor • Guest OS • Virtual machine monitor (VMM) • KVM • Hyper-V • Xen • VirtualBox • QEMU • Docker • Amazon ECS • Kubernetes • OpenShift

Slide 53

Slide 53 text

Virtualization 虛擬化 • Virtual • Virtual machine (VM) • Hypervisor • Guest OS • Virtual machine monitor (VMM) • KVM • Hyper-V • Xen • VirtualBox • QEMU • Docker • Amazon ECS • Kubernetes • OpenShift

Slide 54

Slide 54 text

Virtualization 虛擬化 • Virtual • Virtual machine (VM) • Hypervisor • Guest OS • Virtual machine monitor (VMM) • KVM • Hyper-V • Xen • VirtualBox • QEMU • Docker • Amazon ECS • Kubernetes • OpenShift

Slide 55

Slide 55 text

Creating a virtual version of something;

Slide 56

Slide 56 text

Creating a virtual version of something;

Slide 57

Slide 57 text

A hypervisor (or virtual machine monitor, VMM, virtualizer) is computer software, firmware or hardware that creates and runs virtual machines.

Slide 58

Slide 58 text

www.ErnestChiang.com

Slide 59

Slide 59 text

www.ErnestChiang.com

Slide 60

Slide 60 text

img src: https://unsplash.com/photos/CJdZ800-Fbs part of virtualization Containerization www.ErnestChiang.com

Slide 61

Slide 61 text

Operating-system-level virtualization, also known as containerization, refers to an operating system feature in which the kernel allows the existence of multiple isolated user-space instances. Such instances, called containers, partitions, virtual environments (VEs) or jails (FreeBSD jail or chroot jail), may look like real computers from the point of view of programs running in them.

Slide 62

Slide 62 text

Operating-system-level virtualization, also known as containerization, refers to an operating system feature in which the kernel allows the existence of multiple isolated user-space instances. Such instances, called containers, partitions, virtual environments (VEs) or jails (FreeBSD jail or chroot jail), may look like real computers from the point of view of programs running in them.

Slide 63

Slide 63 text

Operating-system-level virtualization, also known as containerization, refers to an operating system feature in which the kernel allows the existence of multiple isolated user-space instances. Such instances, called containers, partitions, virtual environments (VEs) or jails (FreeBSD jail or chroot jail), may look like real computers from the point of view of programs running in them.

Slide 64

Slide 64 text

Operating-system-level virtualization, also known as containerization, refers to an operating system feature in which the kernel allows the existence of multiple isolated user-space instances. Such instances, called containers, partitions, virtual environments (VEs) or jails (FreeBSD jail or chroot jail), may look like real computers from the point of view of programs running in them.

Slide 65

Slide 65 text

www.ErnestChiang.com

Slide 66

Slide 66 text

www.ErnestChiang.com

Slide 67

Slide 67 text

www.ErnestChiang.com

Slide 68

Slide 68 text

www.ErnestChiang.com

Slide 69

Slide 69 text

www.ErnestChiang.com

Slide 70

Slide 70 text

www.ErnestChiang.com

Slide 71

Slide 71 text

www.ErnestChiang.com

Slide 72

Slide 72 text

www.ErnestChiang.com

Slide 73

Slide 73 text

> php artisan migrate www.ErnestChiang.com

Slide 74

Slide 74 text

www.ErnestChiang.com

Slide 75

Slide 75 text

www.ErnestChiang.com

Slide 76

Slide 76 text

www.ErnestChiang.com

Slide 77

Slide 77 text

www.ErnestChiang.com

Slide 78

Slide 78 text

www.ErnestChiang.com

Slide 79

Slide 79 text

www.ErnestChiang.com

Slide 80

Slide 80 text

www.ErnestChiang.com

Slide 81

Slide 81 text

www.ErnestChiang.com

Slide 82

Slide 82 text

www.ErnestChiang.com

Slide 83

Slide 83 text

www.ErnestChiang.com

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

www.ErnestChiang.com

Slide 86

Slide 86 text

www.ErnestChiang.com

Slide 87

Slide 87 text

Virtualization 虛擬化 • Virtual • Virtual machine (VM) • Hypervisor • Guest OS • Virtual machine monitor (VMM) • KVM • Hyper-V • Xen • VirtualBox • QEMU • Docker • Amazon ECS • Kubernetes • OpenShift

Slide 88

Slide 88 text

Virtualization 虛擬化 • Virtual • Virtual machine (VM) • Hypervisor • Guest OS • Virtual machine monitor (VMM) • KVM • Hyper-V • Xen • VirtualBox • QEMU • Docker • Amazon ECS • Kubernetes • OpenShift

Slide 89

Slide 89 text

Virtualization 虛擬化 • Virtual • Virtual machine (VM) • Hypervisor • Guest OS • Virtual machine monitor (VMM) • KVM • Hyper-V • Xen • VirtualBox • QEMU • Docker • Amazon ECS • Kubernetes • OpenShift

Slide 90

Slide 90 text

Virtualization ├── Hardware-Hypervisors │ ├── Type 1-Native │ │ └── KVM, Hyper-V, QNX, VMware vSphere, Xen │ └── Type 2-Hosted │ └── bhyve, Parallerls, QEMU, VirtualBox, VMware Fusion └── OperatingSystem ├── 1-OS Containers │ └── FreeBSD jail, LXC, OpenVZ, Virtuozzo ├── 2-Application Containers │ └── Docker, imctfy, rkt └── Orchestration └── Amazon ECS, Kubernetes, OpenShift www.ErnestChiang.com

Slide 91

Slide 91 text

Virtualization ├── Hardware-Hypervisors │ ├── Type 1-Native │ │ └── KVM, Hyper-V, QNX, VMware vSphere, Xen │ └── Type 2-Hosted │ └── bhyve, Parallerls, QEMU, VirtualBox, VMware Fusion └── OperatingSystem ├── 1-OS Containers │ └── FreeBSD jail, LXC, OpenVZ, Virtuozzo ├── 2-Application Containers │ └── Docker, imctfy, rkt └── Orchestration └── Amazon ECS, Kubernetes, OpenShift www.ErnestChiang.com

Slide 92

Slide 92 text

Virtualization ├── Hardware-Hypervisors │ ├── Type 1-Native │ │ └── KVM, Hyper-V, QNX, VMware vSphere, Xen │ └── Type 2-Hosted │ └── bhyve, Parallerls, QEMU, VirtualBox, VMware Fusion └── OperatingSystem ├── 1-OS Containers │ └── FreeBSD jail, LXC, OpenVZ, Virtuozzo ├── 2-Application Containers │ └── Docker, imctfy, rkt └── Orchestration └── Amazon ECS, Kubernetes, OpenShift www.ErnestChiang.com

Slide 93

Slide 93 text

Virtualization ├── Hardware-Hypervisors │ ├── Type 1-Native │ │ └── KVM, Hyper-V, QNX, VMware vSphere, Xen │ └── Type 2-Hosted │ └── bhyve, Parallerls, QEMU, VirtualBox, VMware Fusion └── OperatingSystem ├── 1-OS Containers │ └── FreeBSD jail, LXC, OpenVZ, Virtuozzo ├── 2-Application Containers │ └── Docker, imctfy, rkt └── Orchestration └── Amazon ECS, Kubernetes, OpenShift www.ErnestChiang.com

Slide 94

Slide 94 text

img src: https://unsplash.com/photos/aEnH4hJ_Mrs arrangement Orchestration www.ErnestChiang.com

Slide 95

Slide 95 text

No content

Slide 96

Slide 96 text

www.ErnestChiang.com

Slide 97

Slide 97 text

www.ErnestChiang.com

Slide 98

Slide 98 text

2 1 1 2

Slide 99

Slide 99 text

www.ErnestChiang.com

Slide 100

Slide 100 text

2 1 1 2

Slide 101

Slide 101 text

No content

Slide 102

Slide 102 text

1 2 www.ErnestChiang.com

Slide 103

Slide 103 text

img src: Photo by sergio souza on Unsplash orchestration Amazon ECS www.ErnestChiang.com

Slide 104

Slide 104 text

www.ErnestChiang.com

Slide 105

Slide 105 text

1 2

Slide 106

Slide 106 text

1 2 1 2

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

www.ErnestChiang.com

Slide 109

Slide 109 text

www.ErnestChiang.com

Slide 110

Slide 110 text

www.ErnestChiang.com

Slide 111

Slide 111 text

www.ErnestChiang.com

Slide 112

Slide 112 text

www.ErnestChiang.com

Slide 113

Slide 113 text

www.ErnestChiang.com

Slide 114

Slide 114 text

No content

Slide 115

Slide 115 text

www.ErnestChiang.com

Slide 116

Slide 116 text

www.ErnestChiang.com

Slide 117

Slide 117 text

img src: Photo by sergio souza on Unsplash on Amazon ECS Running Laravel www.ErnestChiang.com

Slide 118

Slide 118 text

www.ErnestChiang.com

Slide 119

Slide 119 text

www.ErnestChiang.com

Slide 120

Slide 120 text

www.ErnestChiang.com

Slide 121

Slide 121 text

No content

Slide 122

Slide 122 text

www.ErnestChiang.com ECR

Slide 123

Slide 123 text

S. (I) V. O. (image) ECR www.ErnestChiang.com

Slide 124

Slide 124 text

S. (ECS) V. O. ECR www.ErnestChiang.com

Slide 125

Slide 125 text

S. (CI) V. O. CI www.ErnestChiang.com

Slide 126

Slide 126 text

www.ErnestChiang.com

Slide 127

Slide 127 text

www.ErnestChiang.com Search "ernest laravel ecs workshop" to download.

Slide 128

Slide 128 text

www.ErnestChiang.com Search "ernest laravel ecs workshop" to download.

Slide 129

Slide 129 text

Demo www.ErnestChiang.com never live demo!

Slide 130

Slide 130 text

參考資料 www.ErnestChiang.com Reference

Slide 131

Slide 131 text

參考資料 Virtualization • Wikipedia - Virtualization • https://en.wikipedia.org/wiki/Virtualization • Playing With Firecracker VMM at COSCUP 2020 • https://www.ernestchiang.com/en/posts/2020/playing-with- fi recracker/ • Firecracker • https:// fi recracker-microvm.github.io/

Slide 132

Slide 132 text

參考資料 Virtualization • Linux 核⼼設計_發展動態回顧 • https://www.youtube.com/watch?v=-2Pn4B8S1EM • Embedded Virtualization applied in Mobile Devices • https://www.slideshare.net/jserv/mobile-virtualization

Slide 133

Slide 133 text

參考資料 Containerization • Wikipedia - OS-level virtualization • https://en.wikipedia.org/wiki/OS-level_virtualization

Slide 134

Slide 134 text

參考資料 Orchestration • Docker image of nginx + php-fpm (amd64/arm64) • https://hub.docker.com/r/dwchiang/nginx-php-fpm

Slide 135

Slide 135 text

參考資料 Amazon ECS • My study notes • https://www.ernestchiang.com/en/notes/aws/ecs/ • Nathan Peck's Awesome List • https://github.com/nathanpeck/awesome-ecs • 技術選型: Amazon ECS Launch Types: EC2 vs. Fargate • https://www.ernestchiang.com/zh/posts/2020/technology-selection-amazon-ecs-launch- type/ • 5 Steps: Using Amazon ECS Exec to pass through Fargate/ECS into containers • https://www.ernestchiang.com/en/posts/2021/using-amazon-ecs-exec/

Slide 136

Slide 136 text

參考資料 Running Laravel on Amazon ECS • Workshops: Running Laravel on AWS ECS (using CDK) • https://github.com/dwchiang/laravel-on-aws-ecs-workshops • CDK Construct Hub • https://constructs.dev/ • CDK patterns for modern application with serverless containers on AWS • https://github.com/aws-samples/serverless-container-constructs • My study notes on CDK • https://www.ernestchiang.com/en/notes/aws/cdk/

Slide 137

Slide 137 text

Virtualization software

Slide 138

Slide 138 text

Search "ernest aws ecs" to download.

Slide 139

Slide 139 text

Ernest's Blog • https://www.ernestchiang.com 拆 / 解 / 整 / 合

Slide 140

Slide 140 text

Ernest's Newsletter • https://bit.ly/3B2ksae 拆 / 解 / 整 / 合 電⼦報

Slide 141

Slide 141 text

問與答 www.ErnestChiang.com 更多對話

Slide 142

Slide 142 text

Shared Notes • https://hackmd.io/@dwchiang/ laravel-on-amazon-ecs-2021- awsug • 短網址:
 https://bit.ly/ecs2021awsug • 問與答 Q&A 共筆筆記