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

CakePHP in a containerized CI-CD environment

CakePHP in a containerized CI-CD environment

A short talk about putting CakePHP in a (Docker) container environment for CI and CD purposes, what obstacles we have encountered doing that and what advantages it has provided us.

Stefan van Gastel

June 09, 2017
Tweet

Other Decks in Programming

Transcript

  1. CAKEPHP
    IN A CONTAINERIZED CI/CD ENVIRONMENT

    View Slide

  2. WHO IS THIS GUY?
    STEFAN VAN GASTEL
    ▸ Age 32
    ▸ Netherlands
    ▸ Zundert
    ▸ Vincent van Gogh
    ▸ Flower parade
    ▸ CakePHP since 1.2
    ▸ CakeFest since 2012
    2

    View Slide

  3. WHO IS THIS GUY?
    STEFAN VAN GASTEL
    ▸ Dutch Ministry Of Defence (MOD)
    ▸ Since 2006
    ▸ Technical lead ‘Mobile Apps Military Police’
    ▸ Front-end
    ▸ Back-end
    ▸ Services
    ▸ Infrastructure
    ▸ Architecture
    3

    View Slide

  4. WHO IS THIS GUY?
    Not this kind of guy… More like this guy…
    4

    View Slide

  5. CONTAINERS
    WHAT ARE CONTAINERS?
    Unlike VMs, containers do not bundle a full operating system -
    only libraries and settings required to make the software work
    are needed. This makes for efficient, lightweight, self-contained
    systems and guarantees that software will always run the same,
    regardless of where it’s deployed.
    Source: https://docker.com
    5
    Vary in:
    - Speed
    - Resource usage
    - Footprint
    - Isolation

    View Slide

  6. CONTAINERS
    WHAT IS DOCKER?
    Docker is the world’s leading software container platform.
    Developers use Docker to eliminate “works on my
    machine”
    Operators use Docker to run and manage apps side-by-
    side in isolated containers to get better compute density.
    Source: https://docker.com
    6

    View Slide

  7. CONTAINERS
    CAN RUN ON ANY LINUX BASED OS AND WINDOWS SERVER 2016
    Source: https://docker.com
    7

    View Slide

  8. USAGE WITHIN THE MOD
    USING CONTAINERS
    8
    DOCKER FOR OVER 10 YEARS

    View Slide

  9. BRACE YOURSELF
    WARNING!
    Everything we build and run is in an offline, on-premise intranet infrastructure.
    9

    View Slide

  10. CAKEPHP
    WHERE DOES CAKEPHP FIT IN?
    10

    View Slide

  11. CI/CD PIPELINES
    HOW OUR CAKE MOVES
    Development
    Commit & Push
    Gitlab Container Registry
    Test Qa Review / Staging
    Build
    Build & Push Pull & Test Pull & Check Pull & Deploy
    11

    View Slide

  12. PRODUCTION
    HOW OUR CAKE GETS EATEN
    Event Same old sh*t
    12

    View Slide

  13. LESSONS LEARNED 1 OF 3
    MINDSET
    13

    View Slide

  14. LESSONS LEARNED 2 OF 3
    12 FACTOR APPS
    III. Config | Store config in the environment
    IV. Backing services | Treat backing services as attached resources
    IX. Disposability | Maximize robustness with fast startup and graceful shutdown
    https://12factor.net
    14

    View Slide

  15. LESSONS LEARNED 2 OF 3
    12 FACTOR APPS
    III. Config | Store config in the environment
    15

    View Slide

  16. LESSONS LEARNED 2 OF 3
    12 FACTOR APPS
    IV. Backing services | Treat backing services as attached resources
    16

    View Slide

  17. LESSONS LEARNED 2 OF 3
    12 FACTOR APPS
    IX. Disposability
    Maximize robustness
    with
    fast startup
    and
    graceful shutdown
    17

    View Slide

  18. LESSONS LEARNED 3 OF 3
    CONTAINERS ARE REVOLUTION, NOT EVOLUTION
    18

    View Slide

  19. LESSONS LEARNED 3 OF 3
    CONTAINERS ARE REVOLUTION, NOT EVOLUTION
    19

    View Slide

  20. CAKEPHP AND DOCKER
    DEMO

    View Slide

  21. CAKEPHP AND DOCKER
    RESOURCES
    ▸ Examples
    ▸ https://github.com/stefanvangastel/docker-cakephp
    ▸ http://blog.danielcorreia.net/practical-docker-apache-php-and-
    mysql-cakephp-example/
    ▸ https://hub.docker.com/r/occitech/cakephp/
    ▸ Docker
    ▸ https://docs.docker.com/engine/userguide/eng-image/
    dockerfile_best-practices/
    ▸ https://blog.replicated.com/engineering/refactoring-a-dockerfile-
    for-image-size/

    View Slide

  22. BE HONEST
    ANY QUESTIONS?
    $ docker run -i answers:latest
    ▸ Feedback
    ▸ https://joind.in/talk/095fd
    ▸ Contact me
    [email protected] / [email protected]
    ▸ https://www.linkedin.com/in/stefan-van-gastel
    ▸ Slides
    ▸ https://speakerdeck.com/stefanvangastel/cakephp-in-a-containerized-ci-cd-environment

    View Slide