Slide 1

Slide 1 text

LaravelΛ ຊ൪؀ڥʹ σϓϩΠ͢Δ·Ͱ @yukure3

Slide 2

Slide 2 text

ࣗݾ঺հ • ໊લɿߚྛ ༏ (@yukure3) • ॴଐɿגࣜձࣾ͏ΔΔ • ܦྺɿ৽ଔ̍೥໨ΤϯδχΞ • ࠷ۙ΍͍ͬͯΔ͜ͱɿLaravel / Vue.js • ͓఻͑ͨ͜͠ͱɿࠓճͷLT͕ਓੜॳొஃͰ͢…!!

Slide 3

Slide 3 text

ࣗݾ঺հ • ໊લɿߚྛ ༏ (@yukure3) • ॴଐɿגࣜձࣾ͏ΔΔ • ܦྺɿ৽ଔ̍೥໨ΤϯδχΞ • ࠷ۙ΍͍ͬͯΔ͜ͱɿLaravel / Vue.js • ͓఻͑ͨ͜͠ͱɿࠓճͷLT͕ਓੜॳొஃͰ͢…!!

Slide 4

Slide 4 text

͜Μͳํʹ • ʮͳΜ͔LaravelΑͦ͞͏͔ͩΒ࢖ͬͯΈ͍ͨͳ͊ɻʯ • ʮ։ൃ؀ڥͲ͏্ཱͪ͛Δͷָ͔ͳͷ͔ͳ͊ɻʯ • ʮຊ൪ӡ༻΋ߟ͑ͳ͍ͱ͍͚ͳ͍͚ͲָͰ͖ͳ͍͔ͳ͊ɻʯ

Slide 5

Slide 5 text

͜Μͳ͜ͱΛ఻͍͑ͨ Laravel ʹूதͰ͖Δํ๏ ※Laravelࣗମͷྑ͞͸ଞͷํʑ͕ͨ͘͞Μઆ໌ͯ͘͠Ε·͢ʂʂ

Slide 6

Slide 6 text

ΞδΣϯμ • ࣮ݱ͍ͨ͜͠ͱ • ։ൃ؀ڥͱӡ༻؀ڥʹखؒΛ͔͚ͣʹߏங͢Δ • ඞཁͳ΋ͷ • ্هΛ࣮ݱ͢ΔͨΊʹඞཁͳ΋ͷΛ঺հ • ·ͱΊ

Slide 7

Slide 7 text

࣮ݱ͍ͨ͜͠ͱ

Slide 8

Slide 8 text

࣮ݱ͍ͨ͜͠ͱ

Slide 9

Slide 9 text

ඞཁͳ΋ͷ

Slide 10

Slide 10 text

ϩʔΧϧ։ൃ؀ڥ => Laradock ຊ൪؀ڥ => AWS Elastic Beanstalk CI/CDύΠϓϥΠϯ => CircleCI όʔδϣϯ؅ཧ => GitHub ඞཁͳ΋ͷ

Slide 11

Slide 11 text

ϩʔΧϧ։ൃ؀ڥ

Slide 12

Slide 12 text

ϩʔΧϧ։ൃ؀ڥ ͜͜Λ࡞͍͖ͬͯ·͢ʂ

Slide 13

Slide 13 text

ϩʔΧϧ։ൃ؀ڥ # σΟϨΫτϦ࡞੒ & ͦͷσΟϨΫτϦʹҠಈ $ mkdir project && cd project # laradockΛΫϩʔϯ $ git clone https://github.com/Laradock/laradock.git # laravel(࠷৽൛)ΛΠϯετʔϧ $ composer create-project --prefer-dist laravel/laravel src # LaradockσΟϨΫτϦҠಈ & .envΛ࡞੒ $ cd laradock $ cp env-example .env # σΟϨΫτϦߏ଄ project !"" laradock ←ΠϚίίʂʂ #"" src

Slide 14

Slide 14 text

.env(laradock)ͷमਖ਼ # nginx ͷport & mysqlͷ version มߋ - APP_CODE_PATH_HOST=../ + APP_CODE_PATH_HOST=../src - NGINX_HOST_HTTP_PORT=80 + NGINX_HOST_HTTP_PORT=8001 - MYSQL_VERSION=latest + MYSQL_VERSION=5.7

Slide 15

Slide 15 text

.env(laravel)ͷमਖ਼ # ઀ଓઌͷDBมߋ - DB_HOST=127.0.0.1 + DB_HOST=mysql - DB_DATABASE=homestead + DB_DATABASE=default - DB_USERNAME=homestead + DB_USERNAME=root - DB_PASSWORD=secret + DB_PASSWORD=root

Slide 16

Slide 16 text

ϩʔΧϧ։ൃ؀ڥΛ্ཱͪ͛Δ # ΠϝʔδΛϏϧυͯ͠ىಈ͢Δ docker-compose up -d nginx mysql workspace MPDBMIPTUʹΞΫηε

Slide 17

Slide 17 text

ຊ൪؀ڥ

Slide 18

Slide 18 text

ຊ൪؀ڥ ͜͜Λ࡞͍͖ͬͯ·͢ʂ

Slide 19

Slide 19 text

ίϯιʔϧͰBeanstalkΛݕࡧ

Slide 20

Slide 20 text

৽͍͠ΞϓϦέʔγϣϯͷ࡞੒

Slide 21

Slide 21 text

ΞϓϦέʔγϣϯ໊Λઃఆ

Slide 22

Slide 22 text

ΞϓϦέʔγϣϯ಺ʹ؀ڥΛ࡞੒

Slide 23

Slide 23 text

΢Σϒαʔόʔ؀ڥΛߏங

Slide 24

Slide 24 text

؀ڥ৘ใͷઃఆ

Slide 25

Slide 25 text

؀ڥ৘ใͷઃఆ

Slide 26

Slide 26 text

DB(RDS)ͷઃఆ

Slide 27

Slide 27 text

DB(RDS)ͷઃఆ

Slide 28

Slide 28 text

΢Σϒαʔόʔ؀ڥ࡞੒

Slide 29

Slide 29 text

Ͱ͖·ͨ͠ʂ

Slide 30

Slide 30 text

όʔδϣϯ؅ཧ

Slide 31

Slide 31 text

όʔδϣϯ؅ཧ ͜͜Λ࡞͍͖ͬͯ·͢ʂ

Slide 32

Slide 32 text

ϦϞʔτϦϙδτϦ࡞੒

Slide 33

Slide 33 text

ϦϞʔτϦϙδτϦ࡞੒ ΫϦοϓϘʔυʹίϐʔ

Slide 34

Slide 34 text

ϦϞʔτϦϙδτϦ΁push # src΁Ҡಈ cd src # gitϦϙδτϦ࡞੒ git init # ઌ΄Ͳ࡞੒ͨ͠ϦϞʔτϦϙδτϦͷ௥Ճ git remote add upstream [email protected]:yukure/laravel-vue.git # first commit ͸͔ΒίϛοτͰʂ git commit --allow-empty -m "first commit!!" # laravelΛόʔδϣϯ؅ཧͷର৅ͱͯ͠௥Ճ git add . # ίϛοτ git commit -m "add: laravel app" # ϦϞʔτϦϙδτϦʹΞοϓϩʔυ git push upstream master

Slide 35

Slide 35 text

ϦϞʔτϦϙδτϦ΁push

Slide 36

Slide 36 text

σϑΥϧτϒϥϯνΛมߋ

Slide 37

Slide 37 text

σϑΥϧτϒϥϯνΛมߋ

Slide 38

Slide 38 text

σϑΥϧτϒϥϯνΛมߋ

Slide 39

Slide 39 text

CI/CDύΠϓϥΠϯ

Slide 40

Slide 40 text

CI/CDύΠϓϥΠϯ ͜͜Λ࡞͍͖ͬͯ·͢ʂ

Slide 41

Slide 41 text

σϓϩΠ༻ͷIAMͷ࡞੒

Slide 42

Slide 42 text

σϓϩΠ༻ͷIAMͷ࡞੒

Slide 43

Slide 43 text

σϓϩΠ༻ͷIAMͷ࡞੒

Slide 44

Slide 44 text

σϓϩΠ༻ͷIAMͷ࡞੒

Slide 45

Slide 45 text

σϓϩΠ༻ͷIAMͷ࡞੒

Slide 46

Slide 46 text

σϓϩΠ༻ͷIAMͷ࡞੒

Slide 47

Slide 47 text

EB CLIͷΠϯετʔϧ # EB CLIͷΠϯετʔϧ brew install awsebcli # EB CLI͕Πϯετʔϧ͞Ε͍ͯΔ͔֬ೝ eb --version

Slide 48

Slide 48 text

# srcσΟϨΫτϦ಺Ͱߦ͍ͬͯͩ͘͞ # ॳظઃఆ(.elasticbeanstalk/config.ymlͷ࡞੒) eb init # ͜Μͳײ͡Ͱ౴͍͖͑ͯ·͢ Select a default region 1) us-east-1 : US East (N. Virginia) 2) us-west-1 : US West (N. California) 3) us-west-2 : US West (Oregon) 4) eu-west-1 : EU (Ireland) 5) eu-central-1 : EU (Frankfurt) 6) ap-south-1 : Asia Pacific (Mumbai) 7) ap-southeast-1 : Asia Pacific (Singapore) 8) ap-southeast-2 : Asia Pacific (Sydney) 9) ap-northeast-1 : Asia Pacific (Tokyo) 10) ap-northeast-2 : Asia Pacific (Seoul) 11) sa-east-1 : South America (Sao Paulo) 12) cn-north-1 : China (Beijing) 13) cn-northwest-1 : China (Ningxia) 14) us-east-2 : US East (Ohio) 15) ca-central-1 : Canada (Central) 16) eu-west-2 : EU (London) 17) eu-west-3 : EU (Paris) (default is 3): 9 Select an application to use 1) laravel-vue 2) [ Create new Application ] (default is 1): 1 Select the default environment. You can change this later by typing "eb use [environment_name]". 1) laravel-vue (default is 1): 1 Note: Elastic Beanstalk now supports AWS CodeCommit; a fully-managed source control service. To learn more, see Docs: https://aws.amazon.com/codecommit/ Do you wish to continue with CodeCommit? (y/N) (default is n): n Ϧʔδϣϯͷબ୒ ͲͷΞϓϦέʔγϣϯΛ࢖͏͔ Ͳͷ؀ڥʹσϓϩΠ͢Δ͔ $PEF$PNNJU࢖͏͔

Slide 49

Slide 49 text

config.global.ymlͷઃఆ # ઃఆϑΝΠϧ࡞੒ vim .elasticbeanstalk/config.global.yml # ͜ͷΑ͏ʹઃఆ͢Δ global: application_name: laravel-vue default_region: ap-northeast-1 ͖͞΄Ͳ࡞੒ͨ͠ͷΞϓϦέʔγϣϯ໊

Slide 50

Slide 50 text

CircleCIͷઃఆ

Slide 51

Slide 51 text

.circleci/config.ymlͷઃఆ # ※srcσΟϨΫτϦ಺Ͱ↓Λߦ͍ͬͯͩ͘͞ # .circleciσΟϨΫτϦ࡞੒ & σΟϨΫτϦʹҠಈ mkdir .circleci && cd .circleci # ઃఆϑΝΠϧΛ࡞੒ vim config.yml

Slide 52

Slide 52 text

version: 2 defaults: &defaults working_directory: ~/app docker: - image: circleci/php:7.1-node-browsers - image: circleci/mysql:5.7 environment: - AWS_REGION: ap-northeast-1 - APP_DEBUG: true - APP_ENV: testing - APP_KEY: base64:cNWYphm1YWH+RGYFLZpn6MBKj/TRiMm46KbuWA8Ei8c= - DB_DATABASE: circle_test - DB_USERNAME: root - MYSQL_ALLOW_EMPTY_PASSWORD: true jobs: build: <<: *defaults steps: - checkout - run: name: install pdo_mysql command: | sudo apt update sudo docker-php-ext-install pdo_mysql sudo docker-php-ext-enable pdo_mysql # Download and cache dependencies - restore_cache: keys: - v1-dependencies-{{ checksum "composer.json" }} # fallback to using the latest cache if no exact match is found - v1-dependencies- - run: composer install -n --prefer-dist - save_cache: paths: - ./vendor key: v1-dependencies-{{ checksum "composer.json" }} # run seeding - run: php artisan migrate - run: php artisan db:seed # run test - run: ./vendor/bin/phpunit deploy: <<: *defaults steps: - checkout - run: name: Install awsebcli command: | sudo apt-get -y -qq update sudo apt-get install python-pip python-dev build-essential sudo pip install awsebcli --upgrade - run: name: eb deploy command: eb deploy laravel-vue workflows: version: 2 build_and_deploy: jobs: - build - deploy: filters: branches: only: - master ίϯςφͷΠϝʔδ΍ ؀ڥม਺Λఆٛ Ϗϧυɾςετͷ࣮ߦ 8PSLqPX δϣϒͷॱ൪ ӡ༻؀ڥ΁σϓϩΠ

Slide 53

Slide 53 text

.circleci/config.ymlͷઃఆ deploy: <<: *defaults steps: - checkout - run: name: Install awsebcli command: | sudo apt-get -y -qq update sudo apt-get install python-pip python-dev build-essential sudo pip install awsebcli --upgrade - run: name: eb deploy command: eb deploy laravel-vue ͷ؀ڥ໊ $-*Πϯετʔϧ HJUIVC͔ΒίʔυΛνΣοΫΞ΢τ

Slide 54

Slide 54 text

ͳΜͷઃఆΛͨ͠ͷ͔ • PR͕࡞੒͞ΕͨΒɺϏϧυɾςετΛ࣮ߦɻ • masterϒϥϯνʹPR͕Ϛʔδ͞ΕͨΒ 
 eb deployίϚϯυΛ࣮ߦɻ

Slide 55

Slide 55 text

CircleCIͷઃఆ

Slide 56

Slide 56 text

CircleCIͷઃఆ

Slide 57

Slide 57 text

CircleCIͷઃఆ

Slide 58

Slide 58 text

CircleCIͷઃఆ

Slide 59

Slide 59 text

؀ڥม਺ͷઃఆ

Slide 60

Slide 60 text

؀ڥม਺ͷઃఆ

Slide 61

Slide 61 text

؀ڥม਺ͷઃఆ $47ʹهࡌͷ͋ΔΩʔΛೖྗ $47ʹهࡌͷ͋Δ஋Λೖྗ

Slide 62

Slide 62 text

σϓϩΠͷςετ # ϒϥϯνͷ੾Γସ͑ git checkout -b edit_readme # readme.mdΛฤू͢Δ vim readme.md # Laravel/Vue.jsษڧձ#8 Φʔϧελʔζ **Let's Enjoy Laravel!!!!!!!!!!!!!!!!!!!!!!!!!!** readme.md

Slide 63

Slide 63 text

github΁push git add . git commit -m "edit: readme.md" git push upstream edit_readme

Slide 64

Slide 64 text

PR࡞੒

Slide 65

Slide 65 text

PRΛϚʔδ

Slide 66

Slide 66 text

CircleCIͷδϣϒΛ֬ೝ workflow

Slide 67

Slide 67 text

CircleCIͷδϣϒΛ֬ೝ workflow

Slide 68

Slide 68 text

ϖʔδΛ֬ೝͯ͠ΈΔ

Slide 69

Slide 69 text

͋Εɺɺɺ

Slide 70

Slide 70 text

υΩϡϝϯτϧʔτͷઃఆ

Slide 71

Slide 71 text

APP_KEYͷઃఆ TSDFOWͷ"11@,&:Λίϐϖ͍ͯͩ͘͠͞

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

·ͱΊ

Slide 75

Slide 75 text

·ͱΊ • ։ൃ؀ڥ͸LaradockΛ࢖ͬͯ؆୯ʹߏஙͰ͖Δʂ • ӡ༻؀ڥ͸EBΛ࢖ͬͯ؆୯ʹߏஙͰ͖Δ! • CIʗCDύΠϓϥΠϯͰ͓ؾܰӡ༻ʂ

Slide 76

Slide 76 text

Let’s Enjoy Laravel Life!!!

Slide 77

Slide 77 text

͋Γ͕ͱ͏͍͟͝·ͨ͠ʂʂ#