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

[2016.10 Meetup #6] [TALK #2] Luís Pedro Algarv...

[2016.10 Meetup #6] [TALK #2] Luís Pedro Algarvio - Emulating a Datacenter deployed LAMP application in Docker with multiple containers

In today's world, developers and sysops often struggle to keep pace with newer technologies, often ignoring areas of knowledge which are not their focus. This culture leads to a misunderstanding of techniques and workings of the IT world in a operations perspective by developers, which is still very visible in the PHP world. Part of the solution for this problem is to provide the right tools and development environment to developers, which we will address this in this talk by exploring an open source project called "High Performance PHP Stack", which aims to create a full LAMP stack in Docker, segregating services in different containers, as we would expect in a datacenter environment.

Find the featured project at https://github.com/solict/docker-high-performance-php-stack.

DevOps Lisbon

October 17, 2016
Tweet

More Decks by DevOps Lisbon

Other Decks in Technology

Transcript

  1. DHPPS 1 Docker High Performance PHP Stack Your PHP application

    stack containerized, modular, scalable, performant
  2. DHPPS 4 Introduction Developers don't know operations. Sysops don't follow

    evolution. QA can't guarantee quality. Managers aren't closing the gap.
  3. DHPPS 8 PHP Stack Multiple operating systems. No universal setup.

    Many software options. Future comes every day. Legacy is not a thing of the past.
  4. DHPPS 9 PHP Stack Incompatibilities are common. Bad configuration is

    rampant. Performance by default is abysmal. Lifecycle is chaotic. Vendors don't follow progress.
  5. DHPPS 10 PHP Stack And a PHP stack can be

    complex! But how complex?
  6. DHPPS 11 Web HTTPd nginx Interpreter PHP HHVM Cache Memcache

    Redis Search Solr ElasticSearch NoSQL MongoDB CouchDB SQL MariaDB PostgreSQL PHP Stack
  7. DHPPS 12 PHP Stack There's more actually. Threaded or non-threaded

    HTTPd? Embedded PHP or via CGI or FastCGI? Care for security and performance? Opcode caching? Clustering?
  8. DHPPS 13 PHP Stack Looks like a lost cause! Everyone

    for themselves! Can we fix this world?
  9. DHPPS 16 Standard Environment Requirement: It has to fit development,

    qa and production in some way. Even so, options for setups can be numerous...
  10. DHPPS 17 Standard Environment Local Environments Using: - AMP bundle

    (XAMP, WAMP, etc) - Distribution packages - Custom packages or compilations - Configuration management
  11. DHPPS 18 Standard Environment Pros: no need for additional systems

    or virtualization complexity Cons: easy to break your system, system changes can affect projects, a project can affect others, hard to upgrade, not portable, not optimized by default, hard to maintain
  12. DHPPS 19 Standard Environment Para or full Virtualization Pros: separation

    of environments and projects and thus problems, can use different systems, relatively portable Cons: additional overhead and complexity, cumbersome to manage and share
  13. DHPPS 20 Standard Environment OS level Virtualization (Containers) Pros: faster,

    lighter, smaller and more portable than traditional virtualization, does not need an Hypervisor, same pros as Para or Full Virtualization Cons: uses kernel of host system, less friendly for beginners
  14. DHPPS 21 Standard Environment Given this, containers have big advantages

    over other methods and are a natural selection for our ambitions. There are many container solutions but we will focus on Docker, the most popular.
  15. DHPPS 23 Docker Great features: Differentiation: Images and containers. Build

    one time, run everywhere (portability). Scriptable recipe support (dockerfiles). Hierarchical images (reutilization). Public repository (Docker Hub).
  16. DHPPS 24 Docker More features: Private repositories (Docker Registry). Multi-container

    support (Docker Compose). Orchestration APIs (Docker Swarm, Kubernetes, Mesos and Rancher). Many more official / unofficial tools.
  17. DHPPS 25 Docker Yet more features: Layered Filesystem (AuFS). Mounted

    volumes. Network autoconfiguration. Resource limits. Managed logging.
  18. DHPPS 26 Docker In sum, Docker is an excellent container

    tool, providing the all common needs, with a great potential for reproducibility. As such, it will pave the way for our solution.
  19. DHPPS 29 Our solution A fully modular Linux PHP stack.

    Your new Application Environment. For Development, Staging and Production.
  20. DHPPS 32 Our solution For Developers • Conformity • Portability

    For Sysops • Modularity • Evolution For Managers • Trust • Control For Datacenters • Scalability • Performance
  21. DHPPS 34 Our solution Docker • Docker • Docker Compose

    (for multi-container / modularity) • Any Orchestration API for the Datacenter (for scalability, optional) System • Host or guest system (para or full virtualization) • Any Linux distribution that supports the official docker repositories
  22. DHPPS 36 Our solution Other • Docker General Purpose System

    Distro (automatically pulled by the builder) Linux Distro • Debian 7-8 • CentOS 6-7 Modern AMP+ Stack • HTTPd 2.2-2.4 • PHP 5.4-5.6 • MariaDB 10.1 • Memcached 1.4 • Redis 3.2
  23. DHPPS 37 Our solution HTTPd • MPM Worker/Event for threading

    • Mod Proxy Fcgi for FastCGI PHP • PHP-FPM for process management • Opcache for opcode caching Misc • Each service in a dedicated container MySQL • MariaDB for maximum continuity • InnoDB and UTF8 by default
  24. DHPPS 40 Our solution Scripted and configurable. Easy to setup

    and launch. Images maintained periodically and built automatically. Multiple distribution support.
  25. DHPPS 41 Our solution Modern software and versions. Developed with

    the best solutions. Optimized for performance (WIP). Compatible for the datacenter. Usable by the developer.
  26. DHPPS 43 Our solution Production quality. Volumes and mount points.

    PHP tools (composer, drush) inclusion. Rancher UI/API native compatibility. Configuration management. Managed scalability. May spin-off projects for Ruby, Python, etc.
  27. DHPPS 45 Demonstration Build images and create and start containers.

    cd debian8 docker-compose build docker-compose create docker-compose start
  28. DHPPS 46 Demonstration Scale and verify containers. docker-compose scale httpd24_web=2

    php56=2 docker-compose ps docker inspect debian8_httpd24_web_1 http://<ip>/phpinfo.php
  29. DHPPS 47 Credits Hope you enjoyed! This work is licensed

    under a Creative Commons Attribution- ShareAlike 4.0 International License.
  30. DHPPS 48 Credits Docker High Performance PHP Stack This project

    is free software under the terms of the GNU General Public License v3 published by the FSF. https://github.com/solict/docker-high-performance-php-stack https://hub.docker.com/r/solict/high-performance-php-stack Luís Pedro Algarvio [email protected] https://lp.algarvio.org/
  31. DHPPS 49 Bonus HTTPd and PHP diagram Web HTTPd Prefork

    Worker Event Mod MPM ? ? FastCGI CGI Embed cgi cgid fastcgi proxy_fcgi php5_zts php5 fcgid PHP php-cgi ? libphp php5-fcgi php5-cgi php-fpm Connectors PHP HTTPd