Slide 1

Slide 1 text

UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER © 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. 在 AWS 上運⾏ Laravel/PHP 容器應⽤程式 Ernest Chiang Director of Product & Technology Integration at PAFERS Tec h AWS Community Hero

Slide 2

Slide 2 text

UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER © 2022, Amazon Web Services, Inc. or its affiliates. © 2022, Amazon Web Services, Inc. or its affiliates. 在 AWS 上運⾏ Laravel/PHP 容器應⽤程式 Ernest Chiang Director of Product & Technology Integration at PAFERS Tec h AWS Community Hero

Slide 3

Slide 3 text

© 2022, Amazon Web Services, Inc. or its affiliates. 拆.解.整.合.的.旅.⼈ • PAFERS
 Product & Technology Integration • AWS
 Community Hero • ex-TSMC
 Process Integration Engineer Ernest Chiang 3

Slide 4

Slide 4 text

PAFERS We Build Connected Fitness

Slide 5

Slide 5 text

PAFERS Bluetooth Classic Fitness Consoles

Slide 6

Slide 6 text

Bluetooth Event Europe

Slide 7

Slide 7 text

PAFERS Contributes Industry Knowledge to Bluetooth Spec https://www.bluetooth.com/specifications/gatt/

Slide 8

Slide 8 text

PAFERS Fitness Services (PFS) The integrated products and services for fitness. Smart 
 Fitness 
 Consoles Video 
 Streaming Services Gym Management Services 
 (GMS) Training Content 
 Services 
 (TCS)

Slide 9

Slide 9 text

Global PAFERS Edges Footprints

Slide 10

Slide 10 text

© 2022, Amazon Web Services, Inc. or its affiliates. Outline ⼤綱 • Laravel/PHP • Virtualization 👉 Containerization 👉 Orchestration • Amazon ECS • Laravel on Amazon ECS • Reference • Q & A 10

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

© 2022, Amazon Web Services, Inc. or its affiliates. 12 That is Cair Paravel, the castle of the four thrones.

Slide 13

Slide 13 text

© 2022, Amazon Web Services, Inc. or its affiliates. 從 本機 開始 13

Slide 14

Slide 14 text

© 2022, Amazon Web Services, Inc. or its affiliates. 先⼿動,再⾃動。 14

Slide 15

Slide 15 text

© 2022, Amazon Web Services, Inc. or its affiliates. 我 👉 開發 👉 程式源碼 15

Slide 16

Slide 16 text

© 2022, Amazon Web Services, Inc. or its affiliates. 我 👉 安裝 👉 執⾏環境 16

Slide 17

Slide 17 text

© 2022, Amazon Web Services, Inc. or its affiliates. 我 👉 安裝 👉 作業系統 17

Slide 18

Slide 18 text

© 2022, Amazon Web Services, Inc. or its affiliates. 我 👉 安裝 👉 ⼀台電腦 18

Slide 19

Slide 19 text

© 2022, Amazon Web Services, Inc. or its affiliates. 我 👉 安裝 👉 ⼀台電腦 我 👉 安裝 👉 作業系統 我 👉 安裝 👉 執⾏環境 我 👉 開發 👉 程式源碼 19 www.ErnestChiang.com

Slide 20

Slide 20 text

© 2022, Amazon Web Services, Inc. or its affiliates. 我 👉 安裝 👉 ⼀台電腦 👈 別⼈做的 我 👉 安裝 👉 作業系統 👈 別⼈做的 我 👉 安裝 👉 執⾏環境 👈 別⼈做的 我 👉 開發 👉 程式源碼 👈 ⾃⼰做的 20 www.ErnestChiang.com

Slide 21

Slide 21 text

© 2022, Amazon Web Services, Inc. or its affiliates. 我 👉 安裝 👉 ⼀台電腦 我 👉 安裝 👉 作業系統 我 👉 安裝 👉 執⾏環境 我 👉 開發 👉 程式源碼 21 www.ErnestChiang.com

Slide 22

Slide 22 text

© 2022, Amazon Web Services, Inc. or its affiliates. 在我的電腦上,可以正常執⾏ 22 www.ErnestChiang.com

Slide 23

Slide 23 text

© 2022, Amazon Web Services, Inc. or its affiliates. 在同事電腦上,就。很。炸。 23 www.ErnestChiang.com

Slide 24

Slide 24 text

© 2022, Amazon Web Services, Inc. or its affiliates. 就別提部署到量產主機了?! 24

Slide 25

Slide 25 text

© 2022, Amazon Web Services, Inc. or its affiliates. 25 www.ErnestChiang.com

Slide 26

Slide 26 text

© 2022, Amazon Web Services, Inc. or its affiliates. 26 www.ErnestChiang.com

Slide 27

Slide 27 text

© 2022, Amazon Web Services, Inc. or its affiliates. 所以?將 PHP Code 打包? 27

Slide 28

Slide 28 text

© 2022, Amazon Web Services, Inc. or its affiliates. 還是 加上 執⾏環境 ⼀起打包? 28

Slide 29

Slide 29 text

© 2022, Amazon Web Services, Inc. or its affiliates. 還是 外加 作業系統 ⼀起打包? 29

Slide 30

Slide 30 text

© 2022, Amazon Web Services, Inc. or its affiliates. 好,⾄少我們知道這台電腦不能打包。 30

Slide 31

Slide 31 text

solution? Virtualization www.ErnestChiang.com

Slide 32

Slide 32 text

© 2022, Amazon Web Services, Inc. or its affiliates. Creating a virtual version of something; 32

Slide 33

Slide 33 text

© 2022, Amazon Web Services, Inc. or its affiliates. Creating a virtual version of something; 33

Slide 34

Slide 34 text

© 2022, Amazon Web Services, Inc. or its affiliates. A hypervisor (or virtual machine monitor, VMM, virtualizer) is computer software, firmware or hardware that creates and runs virtual machines. 34

Slide 35

Slide 35 text

© 2022, Amazon Web Services, Inc. or its affiliates. 35 www.ErnestChiang.com

Slide 36

Slide 36 text

© 2022, Amazon Web Services, Inc. or its affiliates. 36 www.ErnestChiang.com

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

© 2022, Amazon Web Services, Inc. or its affiliates. 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. 38

Slide 39

Slide 39 text

© 2022, Amazon Web Services, Inc. or its affiliates. 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. 39

Slide 40

Slide 40 text

© 2022, Amazon Web Services, Inc. or its affiliates. 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. 40

Slide 41

Slide 41 text

© 2022, Amazon Web Services, Inc. or its affiliates. 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. 41

Slide 42

Slide 42 text

© 2022, Amazon Web Services, Inc. or its affiliates. 42 www.ErnestChiang.com

Slide 43

Slide 43 text

© 2022, Amazon Web Services, Inc. or its affiliates. 43 www.ErnestChiang.com

Slide 44

Slide 44 text

© 2022, Amazon Web Services, Inc. or its affiliates. 44 www.ErnestChiang.com

Slide 45

Slide 45 text

© 2022, Amazon Web Services, Inc. or its affiliates. 45 www.ErnestChiang.com

Slide 46

Slide 46 text

© 2022, Amazon Web Services, Inc. or its affiliates. 46 www.ErnestChiang.com

Slide 47

Slide 47 text

© 2022, Amazon Web Services, Inc. or its affiliates. 47 www.ErnestChiang.com

Slide 48

Slide 48 text

© 2022, Amazon Web Services, Inc. or its affiliates. 48 www.ErnestChiang.com

Slide 49

Slide 49 text

© 2022, Amazon Web Services, Inc. or its affiliates. 49 www.ErnestChiang.com

Slide 50

Slide 50 text

© 2022, Amazon Web Services, Inc. or its affiliates. 50 > php artisan migrate www.ErnestChiang.com

Slide 51

Slide 51 text

© 2022, Amazon Web Services, Inc. or its affiliates. 51 www.ErnestChiang.com

Slide 52

Slide 52 text

© 2022, Amazon Web Services, Inc. or its affiliates. 52 www.ErnestChiang.com

Slide 53

Slide 53 text

© 2022, Amazon Web Services, Inc. or its affiliates. 53 www.ErnestChiang.com

Slide 54

Slide 54 text

© 2022, Amazon Web Services, Inc. or its affiliates. 54 www.ErnestChiang.com

Slide 55

Slide 55 text

© 2022, Amazon Web Services, Inc. or its affiliates. 55 www.ErnestChiang.com

Slide 56

Slide 56 text

© 2022, Amazon Web Services, Inc. or its affiliates. 56 www.ErnestChiang.com

Slide 57

Slide 57 text

© 2022, Amazon Web Services, Inc. or its affiliates. 57 www.ErnestChiang.com

Slide 58

Slide 58 text

© 2022, Amazon Web Services, Inc. or its affiliates. 58 www.ErnestChiang.com

Slide 59

Slide 59 text

© 2022, Amazon Web Services, Inc. or its affiliates. 59 www.ErnestChiang.com

Slide 60

Slide 60 text

© 2022, Amazon Web Services, Inc. or its affiliates. 60 www.ErnestChiang.com

Slide 61

Slide 61 text

© 2022, Amazon Web Services, Inc. or its affiliates. 61 www.ErnestChiang.com

Slide 62

Slide 62 text

img src: https://unsplash.com/photos/aEnH4hJ_Mrs /,ɔrkʌs`treɪʃʌn/ arrangement Orchestration www.ErnestChiang.com

Slide 63

Slide 63 text

© 2022, Amazon Web Services, Inc. or its affiliates. 63

Slide 64

Slide 64 text

© 2022, Amazon Web Services, Inc. or its affiliates. 64 www.ErnestChiang.com

Slide 65

Slide 65 text

© 2022, Amazon Web Services, Inc. or its affiliates. 65 www.ErnestChiang.com

Slide 66

Slide 66 text

© 2022, Amazon Web Services, Inc. or its affiliates. 66 2 1 1 2

Slide 67

Slide 67 text

© 2022, Amazon Web Services, Inc. or its affiliates. 67 www.ErnestChiang.com

Slide 68

Slide 68 text

© 2022, Amazon Web Services, Inc. or its affiliates. 68 2 1 1 2

Slide 69

Slide 69 text

© 2022, Amazon Web Services, Inc. or its affiliates. 69

Slide 70

Slide 70 text

© 2022, Amazon Web Services, Inc. or its affiliates. 70 1 2 www.ErnestChiang.com

Slide 71

Slide 71 text

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

Slide 72

Slide 72 text

© 2022, Amazon Web Services, Inc. or its affiliates. 72 www.ErnestChiang.com

Slide 73

Slide 73 text

© 2022, Amazon Web Services, Inc. or its affiliates. 73 1 2

Slide 74

Slide 74 text

© 2022, Amazon Web Services, Inc. or its affiliates. 74 1 2 1 2

Slide 75

Slide 75 text

© 2022, Amazon Web Services, Inc. or its affiliates. 75

Slide 76

Slide 76 text

© 2022, Amazon Web Services, Inc. or its affiliates. 76 www.ErnestChiang.com

Slide 77

Slide 77 text

© 2022, Amazon Web Services, Inc. or its affiliates. 77 www.ErnestChiang.com

Slide 78

Slide 78 text

© 2022, Amazon Web Services, Inc. or its affiliates. 78 www.ErnestChiang.com

Slide 79

Slide 79 text

© 2022, Amazon Web Services, Inc. or its affiliates. 79 www.ErnestChiang.com

Slide 80

Slide 80 text

© 2022, Amazon Web Services, Inc. or its affiliates. 80 www.ErnestChiang.com

Slide 81

Slide 81 text

© 2022, Amazon Web Services, Inc. or its affiliates. 81 www.ErnestChiang.com

Slide 82

Slide 82 text

© 2022, Amazon Web Services, Inc. or its affiliates. 82

Slide 83

Slide 83 text

© 2022, Amazon Web Services, Inc. or its affiliates. 83 www.ErnestChiang.com AWS Fargate Amazon EC2

Slide 84

Slide 84 text

© 2022, Amazon Web Services, Inc. or its affiliates. 84 www.ErnestChiang.com AWS Fargate Amazon EC2

Slide 85

Slide 85 text

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

Slide 86

Slide 86 text

© 2022, Amazon Web Services, Inc. or its affiliates. 86 www.ErnestChiang.com AWS Fargate Fargate LT

Slide 87

Slide 87 text

© 2022, Amazon Web Services, Inc. or its affiliates. 87 www.ErnestChiang.com AWS Fargate Fargate LT

Slide 88

Slide 88 text

© 2022, Amazon Web Services, Inc. or its affiliates. 88 www.ErnestChiang.com AWS Fargate Fargate LT

Slide 89

Slide 89 text

© 2022, Amazon Web Services, Inc. or its affiliates. 89

Slide 90

Slide 90 text

© 2022, Amazon Web Services, Inc. or its affiliates. 90 www.ErnestChiang.com ECR AWS Fargate Fargate LT

Slide 91

Slide 91 text

© 2022, Amazon Web Services, Inc. or its affiliates. 91 S. (I) V. O. (image) ECR www.ErnestChiang.com AWS Fargate Fargate LT

Slide 92

Slide 92 text

© 2022, Amazon Web Services, Inc. or its affiliates. 92 S. (ECS) V. O. ECR www.ErnestChiang.com AWS Fargate Fargate LT

Slide 93

Slide 93 text

© 2022, Amazon Web Services, Inc. or its affiliates. 93 S. (CI) V. O. CI www.ErnestChiang.com AWS Fargate Fargate LT

Slide 94

Slide 94 text

© 2022, Amazon Web Services, Inc. or its affiliates. 94 www.ErnestChiang.com

Slide 95

Slide 95 text

© 2022, Amazon Web Services, Inc. or its affiliates. 95 www.ErnestChiang.com Search "ernest laravel ecs workshop" to download.

Slide 96

Slide 96 text

© 2022, Amazon Web Services, Inc. or its affiliates. 96 www.ErnestChiang.com Search "ernest laravel ecs workshop" to download. Amazon ECR

Slide 97

Slide 97 text

Demo www.ErnestChiang.com never live demo!

Slide 98

Slide 98 text

© 2022, Amazon Web Services, Inc. or its affiliates. Laravel 8.49.1 with PHP 7.4.21 on Different Docker Base Images 98

Slide 99

Slide 99 text

© 2022, Amazon Web Services, Inc. or its affiliates. 99 www.ErnestChiang.com

Slide 100

Slide 100 text

© 2022, Amazon Web Services, Inc. or its affiliates. 100 www.ErnestChiang.com

Slide 101

Slide 101 text

© 2022, Amazon Web Services, Inc. or its affiliates. 101 www.ErnestChiang.com

Slide 102

Slide 102 text

© 2022, Amazon Web Services, Inc. or its affiliates. Laravel 8.19.0 with PHP 8.0/7.4/7.3 on Buster/Alpine 3.12 102

Slide 103

Slide 103 text

© 2022, Amazon Web Services, Inc. or its affiliates. 103 www.ErnestChiang.com

Slide 104

Slide 104 text

© 2022, Amazon Web Services, Inc. or its affiliates. 104 www.ErnestChiang.com

Slide 105

Slide 105 text

© 2022, Amazon Web Services, Inc. or its affiliates. 105 www.ErnestChiang.com

Slide 106

Slide 106 text

參考資料 www.ErnestChiang.com Reference

Slide 107

Slide 107 text

© 2022, Amazon Web Services, Inc. or its affiliates. 參考資料 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/ 107

Slide 108

Slide 108 text

© 2022, Amazon Web Services, Inc. or its affiliates. 參考資料 Virtualization • Linux 核⼼設計_發展動態回顧 • https://www.youtube.com/watch?v=-2Pn4B8S1EM • Embedded Virtualization applied in Mobile Devices • https://www.slideshare.net/jserv/mobile-virtualization 108

Slide 109

Slide 109 text

© 2022, Amazon Web Services, Inc. or its affiliates. 參考資料 Containerization • Wikipedia - OS-level virtualization • https://en.wikipedia.org/wiki/OS-level_virtualization 109

Slide 110

Slide 110 text

© 2022, Amazon Web Services, Inc. or its affiliates. 參考資料 Docker / Laravel / PHP • Docker image of nginx + php-fpm (amd64/arm64) • https://hub.docker.com/r/dwchiang/nginx-php-fpm • Open source (Apache-2.0 license) • https://github.com/dwchiang/nginx-php-fpm • 50 Stars / 17 Forks 110

Slide 111

Slide 111 text

© 2022, Amazon Web Services, Inc. or its affiliates. 參考資料 Amazon ECS • Ernest's Study Notes on ECS • 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/ 111

Slide 112

Slide 112 text

© 2022, Amazon Web Services, Inc. or its affiliates. 參考資料 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/ 112

Slide 113

Slide 113 text

© 2022, Amazon Web Services, Inc. or its affiliates. 113 Search "ernest aws ecs" to download.

Slide 114

Slide 114 text

© 2022, Amazon Web Services, Inc. or its affiliates. Ernest's Blog • https://www.ernestchiang.com 拆解整合的旅⼈ 114

Slide 115

Slide 115 text

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

Slide 116

Slide 116 text

UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER © 2022, Amazon Web Services, Inc. or its affiliates. Thank you! © 2022, Amazon Web Services, Inc. or its affiliates. Ernest Chiang Twitter @dwchiang AWSUG TW https://www.facebook.com/ groups/awsugtw