Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploy Flow at Wantedly

Deploy Flow at Wantedly

Wantedly の Deploy Flow の解説です。
規約とそれを強制する仕組みとして Wantedly が行っていることを紹介しています。

Shimpei Otsubo

March 10, 2020
Tweet

More Decks by Shimpei Otsubo

Other Decks in Technology

Transcript

  1. ©2020 Wantedly, Inc.
    Deploy Flow at Wantedly
    ن໿ͱڧ੍
    FORCIA Meetup #1 ʙDevOps΍͍͔ͬͯnightʙ
    Mar 10, 2020 - Shimpei OTSUBO @potsbo

    View Slide

  2. ©2020 Wantedly, Inc.
    4IJNQFJ0UTVCP!QPUTCP
    Developer Experience Squad
    Wantedly, Inc.
    Kubernetes
    Dev Tools
    CI / CD
    AuthN / Z
    Productivity Dvorak

    View Slide

  3. ©2020 Wantedly, Inc.
    લఏͱͳΔ Wantedly ͷ؀ڥ
    AWS ͕ϝΠϯ
    40 Engineers
    6 Infrastructure Engineers
    5 Kubernetes Clusters
    300 namespaces in total
    GCP ͕Ұ෦
    ΦϯϓϨϛε͸Ұ੾ͳ͍
    99% of services are on Kubernetes
    60 deploys per weekday

    View Slide

  4. ©2020 Wantedly, Inc.
    implement configure
    ask / help
    Wantedly ͕ආ͚Δ΍Γํ
    App Engineers
    Products infrastructure
    Infra Engineers

    View Slide

  5. ©2020 Wantedly, Inc.
    App Engineers
    Infra Engineers
    implement Access through tools and APIs
    Products infrastructure
    Provide tools
    automate
    Wantedly ͷ΍Γํ

    View Slide

  6. ©2020 Wantedly, Inc.
    App Engineers
    Infra Engineers
    implement Access through tools and APIs
    Products infrastructure
    Provide tools
    automate
    Wantedly ͷ΍Γํ
    Infra engineer ͱ App engineer ͕ૄ݁߹

    View Slide

  7. ©2020 Wantedly, Inc.
    ڧ੍Ͱ͖Δ࢓૊ΈΛߏங͢Δ
    •CI ͱϩʔΧϧͰಉҰͷπʔϧΛ࢖͏
    ن໿Ͱੜ࢈ੑΛҡ࣋͢Δ
    •commit hash Λ tag ʹ͢Δ
    •ࣗಈ deploy
    •The Twelve Factors ʹଇΔ
    Ͳ͏΍Δ͔
    •Interface ͷΈΛकΓཪ͸υϥεςΟοΫʹม͍͑ͯ͘

    View Slide

  8. ©2020 Wantedly, Inc.
    ن໿
    same third-party services across all services
    commit hash Λ image tag
    PR merge Ͱࣗಈ deploy
    build/deploy
    monitoring
    etc…
    ಉҰͷ docker image Λશ؀ڥͰ࢖͏

    View Slide

  9. ©2020 Wantedly, Inc.
    The Latest k8s ops flow
    set image
    check
    pull
    deploy
    push push
    hook
    build
    build

    View Slide

  10. ©2020 Wantedly, Inc.
    1 commit ʹରͯ͠ 1 docker image
    GitHub commit status Ͱ image ͷ࡞੒ঢ়گΛ feedback
    ΄΅͢΂ͯͷ commit ͕ deploy Մೳ
    push push
    hook
    build
    build
    The Latest k8s ops flow

    View Slide

  11. ©2020 Wantedly, Inc.
    `kube prod deploy master` Ͱ deploy
    `kubectl set image` Λ wrap ͍ͯ͠Δ
    શ؀ڥͰಉҰͷ image Λ࢖͍؀ڥม਺͚͕ͩࠩ෼
    set image
    check
    pull
    deploy
    The Latest k8s ops flow
    ࣗಈͰ deploy ͞ΕΔ

    View Slide

  12. ©2020 Wantedly, Inc.
    ن໿Ͱੜ࢈ੑΛҡ࣋͢Δ
    •commit hash Λ tag ʹ͢Δ
    •ࣗಈ deploy
    •The Twelve Factors ʹଇΔ

    View Slide

  13. ©2020 Wantedly, Inc.
    ඞཁͳ΋ͷ͕͢΂ͯἧ͏ࣾ಺ϥΠϒϥϦ
    servicex
    • Log format ͱૹ৴
    • Error ऩू
    • ύϑΥʔϚϯεϞχλϦϯά
    • ෼ࢄτϨʔγϯά
    • ଞͷαʔϏε
    Golang, Ruby, Python, Node Λαϙʔτ
    ڧ੍Ͱ͖Δ࢓૊ΈΛߏங͢Δ
    ϧʔϧΛकΔͷ͕Ұ൪؆୯Ͱ͋ΔੈքΛҡ࣋͢Δ

    View Slide

  14. ©2020 Wantedly, Inc.
    ڧ੍Ͱ͖Δ࢓૊ΈΛߏங͢Δ
    ͢΂ͯͷ ops ͕ kube ίϚϯυͰՄೳ
    ϧʔϧΛकΔͷ͕Ұ൪؆୯Ͱ͋ΔੈքΛҡ࣋͢Δ
    ࣾ಺πʔϧͰ build / deploy / ops ͷ͢΂ͯͷ࡞ۀ͕Մೳ
    CI Ͱ΋ laptops Ͱ΋ಉ͡΋ͷΛ࢖͏
    ͲΜͳࣗಈԽ͕ߦΘΕ͍ͯΔͷ͔Θ͔Γ΍͍͢
    kube build
    kube prod deploy master
    Ͱ docker image Λ build ͯ͠ push
    Ͱ production ΁ deploy
    Ͱੜ੒
    manifests ࣗಈੜ੒
    kube generate autoscale

    View Slide

  15. ©2020 Wantedly, Inc.
    language: bash
    env:
    - // encrypted credentials here
    install:
    - bash <(curl -sL https://get.wantedlyapp.com/kube)
    script:
    - kube build
    deploy:
    - skip_cleanup: true
    provider: script
    script: kube prod deploy $TRAVIS_COMMIT
    on:
    branch: master
    Travis ͷઃఆͷྫ

    View Slide

  16. ©2020 Wantedly, Inc.
    language: bash
    env:
    - // encrypted credentials here
    install:
    - bash <(curl -sL https://get.wantedlyapp.com/kube)
    script:
    - kube build
    deploy:
    - skip_cleanup: true
    provider: script
    script: kube prod deploy $TRAVIS_COMMIT
    on:
    branch: master
    Install kube
    Travis ͷઃఆͷྫ

    View Slide

  17. ©2020 Wantedly, Inc.
    language: bash
    env:
    - // encrypted credentials here
    install:
    - bash <(curl -sL https://get.wantedlyapp.com/kube)
    script:
    - kube build
    deploy:
    - skip_cleanup: true
    provider: script
    script: kube prod deploy $TRAVIS_COMMIT
    on:
    branch: master
    Install kube
    build and push a docker image
    Travis ͷઃఆͷྫ

    View Slide

  18. ©2020 Wantedly, Inc.
    language: bash
    env:
    - // encrypted credentials here
    install:
    - bash <(curl -sL https://get.wantedlyapp.com/kube)
    script:
    - kube build
    deploy:
    - skip_cleanup: true
    provider: script
    script: kube prod deploy $TRAVIS_COMMIT
    on:
    branch: master
    deploy the revision
    Install kube
    build and push a docker image
    Travis ͷઃఆͷྫ

    View Slide

  19. ©2020 Wantedly, Inc.
    Travis ͷઃఆͷྫ
    language: bash
    env:
    - // encrypted credentials here
    install:
    - bash <(curl -sL https://get.wantedlyapp.com/kube)
    script:
    - kube build
    deploy:
    - skip_cleanup: true
    provider: script
    script: kube prod deploy $TRAVIS_COMMIT
    on:
    branch: master
    deploy the revision
    Install kube
    build and push a docker image
    Interface ͑͞ม͑ͳ͚Ε͹৽͍͠มߋΛ؆୯ʹ͹Β·͚Δ
    ࣾ಺ඪ४ͷπʔϧΛ࢖͏ͷ͕Ұ൪ָͩ͠উखʹྑ͘ͳΔ
    Infra Engineers
    App Engineers

    View Slide

  20. ©2020 Wantedly, Inc.
    ڧ੍Ͱ͖Δ࢓૊ΈΛߏங͢Δ
    •CI ͱϩʔΧϧͰಉҰͷπʔϧΛ࢖͏
    ن໿Ͱੜ࢈ੑΛҡ࣋͢Δ
    •commit hash Λ tag ʹ͢Δ
    •ࣗಈ deploy
    •The Twelve Factors ʹଇΔ
    Ͳ͏΍Δ͔
    •Interface ͷΈΛकΓཪ͸υϥεςΟοΫʹม͍͑ͯ͘

    View Slide