Is your business ready for PHP7? – Find out with Docker! – The problem



Is your business ready for PHP7? – Find out with Docker! – The problem

0 0


php7-docker-presentation


On Github KamilKopaczyk / php7-docker-presentation

Is your business ready for PHP7?

Find out with Docker!

Kamil Kopaczyk

Intro

PHP7 hype

PHP 7 hype

The problem

Will it work with my application?

Jest sie czego bac What we'll have to face

Testing the whole thing

no time/resources to click through OR no automated tests to test it fast - we can't overcome that

Environment

Where and how

upgrade environment OR create separate machine and test there no time/resources to setup separate machine/environment

Application

Legacy code

Spaghetti code

Application size

Server settings

who wants to go through all the spaghetti code and fix/revamp it

Dependencies

the ones without tests and semantic versioning legacy/"unknown" - niewiadomo jak napisane

Methodology

The solution

Virtualization

Docker

Easy to set up

Docker Toolbox:

  • Docker Client
  • Docker Machine
  • Docker Compose
  • Docker Kitematic
  • VirtualBox

Disposable

even if it fails on other version, you lost only fraction of your time

Resilient

Easy to switch environment

  • apache/nginx
  • php5/php7/hack
  • anything?

Theory

What do we need:

  • docker environment
  • source code + php + nginx
Who used Docker before? Who is familiar with docker-compose?

Prerequisites

  • docker engine
  • docker client
  • docker-compose

Docker Compose

docker run -p "80" --link some_fpm_container \
    --volumes-from some_data_container \
    -v ./config:/etc/nginx/conf.d \
    -e VIRTUAL_HOST=php7szczecin.docker nginx
# docker-compose.yml
application:
    image: iteraptor/symfony_app
    volumes:
        - ./:/var/www
    tty: true

fpm:
    image: php:5.6-fpm
    working_dir: /var/www
    expose:
        - "9000"
    volumes_from:
        - application

nginx:
    image: nginx
    ports:
        - "80"
    links:
        - fpm
    volumes_from:
        - application
    volumes:
        - ./config:/etc/nginx/conf.d
    environment:
        VIRTUAL_HOST: php7szczecin.docker
# docker-compose.php7.yml
fpm:
    image: php:7.0-fpm

Demo time!

To sum things up

It was fast...

...cheap...

...we're one step closer...

CI, testing, staging, prod etc.

...but there are some caveats

http://www.nkode.io/2014/08/24/valuable-docker-links.html

Thank you

Is your business ready for PHP7? Find out with Docker! Kamil Kopaczyk