Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHP Roundtable:
048: Docker & PHP
Jun 27, 2016 @ 11:19:36

The PHP Roundtable podcast, hosted by PHP community member Sammy K Powers, has posted their latest episode today. In Episode #48 Sammy is joined by Phillip Shipley and Chris Tankersley to talk about Docker.

The demand for DevOps skills is growing more and more in modern web development. But all the hype and demand is met with myriad DevOps tools. Staying abreast of how these tools can help make our jobs easier can be daunting. So today we take a closer look at one of these tools called Docker which takes a microservices-architecture approach to managing your servers.

You can catch this latest episode in a few different ways: either through the in-page audio or video players or by checking it out directly over on YouTube. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter to get the latest updates on shows as they're released.

tagged: phproundtable podcast ep48 docker christankersly phillipshipley

Link: https://www.phproundtable.com/episode/docker-and-php

James Wade:
Getting started with Docker and Wordpress
May 06, 2016 @ 11:57:31

James Wade has posted a tutorial to his site showing you how to combine Docker and WordPress after some experimentation of his own.

I’ve been meaning to get started with Docker since hearing about it in 2014. Having really enjoyed working with Vagrant, I’ve struggled to make a leap into the Docker realm. [...] My understanding at the moment is that docker takes up less resources, which for me is becoming more and more of an issue as I attempt to expand my development environments. Also, I’ve recently inherited a number of Vagrants that I discovered have varying operating systems and application versions, that vary from production.

This has unravelled a dependency hell when I came to build a continuous integration process. In light of this, at this stage, a complete rewrite of the architecture seems to be emerging as the most sensible way to being all the services in to line. I’ll be looking whether I can solve these problems (amongst others) with Docker.

He starts by helping you get all the tools you'll need installed with examples for multiple platforms (OSX, Windows, Unix-based). With those in place he helps you set up a VM as a Docker machine then get WordPress installed (complete with its database). He also shows how to use Docker Compose, using an existing WordPress instance and creating a custom image from the results (including database, environmental settings and hostname configuration).

tagged: docker wordpres tutorial example compose setup configure vm virtualmachine

Link: http://wade.be/development/2016/05/02/docker.html

Phillip Shipley:
Docker makes upgrading to PHP7 easy
Apr 25, 2016 @ 11:13:07

In this post to his site Phillip Shipley talks about Docker and how using it for your PHP deployments can make it much easier to upgrade to PHP 7.

Last year at php[tek] 2015 during the hack time I messed around and created a Docker image to run and test PHP7. It was surprisingly easy and I quickly learned that the app I was working on at the time ran fine in PHP7, good deal. So since then I’ve been awaiting the general availability release of PHP7 to move forward with upgrading my apps.

The main thing holding me back was I just didn’t want to maintain an image based on compiling from source. Not that it’s a problem, it just didn’t feel as clean and simple as using supported packages.

He points out that Ubuntu 16.04 was released and that does now have PHP 7 as a standard package so he's happily upgrading. He gets into a bit of detail about how upgrade process and some of the smaller issue he faced along the way. He also includes the update to his Dockerfile he made to change to PHP 7 (only a few characters) to rebuild with PHP 7.0.4.

tagged: upgrade php7 docker ubuntu package official release

Link: http://www.phillipshipley.com/2016/04/docker-makes-upgrading-to-php7-easy/

SitePoint PHP Blog:
Containerized PHP Development Environments with Vagga
Apr 13, 2016 @ 10:19:07

The SitePoint PHP blog recently posted a tutorial showing you how to use Vagga to "containerize" your development environment and help prevent some of the common incompatibility issues that come with setting up/configuring them.

It happens to all of us once in a while. We clone a project, and then we try to run it. However, something doesn’t work. It may be our version of NGINX or Apache. It might be that npm isn’t doing something right. Maybe the project needs an extension, and we don’t have it installed, and now we have to build the extension from source because the dependency does not exist in the repositories for our distribution. No matter the reason, the more complex the setup, the higher the probability of failure.

He sets up a scene where a developer, the primary on a certain product/project is out of the loop and changes need to be made. He steps through the problems another developer could have with setting up a similar environment and, unfortunately, the issues that come from it. Enter Vagga a tool that helps to set up development environments with containers, handle dependencies and run simple processes.

The tutorial then introduces the tool, helps you get it installed and shows how to create a simple environment. Their example uses just Nginx and PHP containers along with mounted volumes, custom configurations and simple command execution to automagically build the environment exactly as needed.

tagged: vagga container development environment docker tutorial

Link: http://www.sitepoint.com/containerized-php-development-environments-with-vagga/

Geeky Platypus Blog:
Dockerise your PHP application with Nginx and PHP7-FPM
Apr 06, 2016 @ 11:57:58

The Geeky Platypus Blog has a new post showing you exactly how to Dockerise your PHP application with a PHP7-FPM and Nginx setup.

The goal that we will try to achieve is to run a simple PHP application using the official Docker repositories for both PHP and Nginx. There are several docker repositories combining PHP-FPM with Nginx, but depending on the official repositories gives you several benefits, like using a service which is configured by its maintainers and you can always choose between the latest and greatest or different versions of both services, instead of relying on someone else’s choices.

The tutorial assumes you already have both Docker and Docker Compose installed, so do that first if you don't. Then you can follow along with the rest of the steps:

  • Setting up Nginx
  • Adding PHP-FPM
  • Setting up a mount point (in the filesystem) to your code

If all goes well you should have a complete setup of PHP 7 and Nginx running your application. If you'd like to see the complete project for reference, you can find it over on GitHub.

tagged: docker nginx php7fpm tutorial setup configure

Link: http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/

Semaphore CI Blog:
Dockerizing a PHP Application
Mar 24, 2016 @ 13:06:09

On the Semaphore CI blog they've posted a great tutorial that wants to help you Docker-ize your PHP application and deploy the application easily out to Heroku (with some help from Semaphore, naturally).

In this tutorial, you will learn what Docker is and how you can use it to create sophisticated working environments. If you already have experience using VMs such as VirtualBox, Vagrant, etc., you'll grasp the concept quickly.

To make things more concrete, we will use a demo application which interacts with the 500px API to list popular photos, view, upvote and comment on them. The application is built using Laravel 4, but this shouldn't present an issue in our case.

They start with a brief introduction to what Docker is for those not familiar with the technology and some of the requirements you'll need to use it. They help you get Docker installed on your local system and how to work with Docker images and containers to create a custom environment for the Laravel application. Next, he talks about Dockerfiles (configurations for Docker), spinning up the environment and an alternative to manual commands: Docker YAML configuration. The next move is to deploy to Heroku using the "heroku' command line tool and integrating it all with Semaphore for continuous deployment.

tagged: docker application laravel configuration setup container tutorial

Link: https://semaphoreci.com/community/tutorials/dockerizing-a-php-application

Medium.com:
How to scale Laravel horizontally with Docker
Mar 24, 2016 @ 11:16:19

In this new Medium.com post Andrew McLagan shows you some strategies you can use to scale your Laravel application horizontally with the help of Docker and a relatively simple configuration.

Homestead was created by Taylor [Otwell] to ease creation of PHP development environments, it offers developers a consistent environment across projects and is fully compatible with the Laravel ecosphere.

[...] Docker is basically programmable infrastructure, or more simply: Docker lets you create a server environment for your project from a configuration file. [...] I will demonstrate the power of the Docker ecosystem through another tool called Docker Compose a container orchestration tool built upon Docker. This tool enables us to start multiple Docker containers at once from a single configuration file, rather then starting each container individually.

He shows you how to get the required tools installed including a fresh Laravel installation. He then includes the Docker YAML configuration to create the environment, setting up a load balancer, Redis, MySQL and a HHVM instance. He then creates the docker machine to tie all of the pieces together as a VirtualBox VM instance. With this setup up and running, you can then test a URL to be sure the Laravel install is up and running correctly. He then gets to the horizontal scaling part and talks about docker's "scale" functionality making it simple to set up multiple "web" container instances to handle the incoming requests.

tagged: laravel application scale docker horizontally tutorial virtualmachine container

Link: https://medium.com/@andrewmclagan/you-thought-laravel-homestead-was-easy-say-hello-to-docker-2c0639a0501#.ordx0lrwv

Yappa Blog:
Docker PHP development flow
Dec 16, 2015 @ 11:14:57

On the Yappa blog there's a new post about their "trip" towards a PHP and Docker based development environment and the steps they took along the way. The post even includes the full commands and configuration changes you'll need to replicate it.

During a regular work day we work on several PHP projects. Sometimes new projects, but also legacy code which still require earlier versions of PHP. We all work on Macbooks and want to switch quickly and easily between projects. The project requirements vary, the PHP version may be different, or additional services may be required (such as Redis, Elasticsearch, ..).

Unable to mimic the production environment without spending countless hours installing packages on a virtual box for each project.

They start with some of the initial steps they tried including a single local development server and remote servers but points out the issues with each. Ultimately they decided to give Docker a try and came up with their ("almost perfect") development environment. From there they get into the steps to reproduce, the more technical parts, and list the requirements you'll need and the steps in the setup process.

tagged: docker development flow environment tutorial reproduce commands configuration

Link: http://tech.yappa.be/docker-php-development

JetBrains Blog:
Docker Support in PhpStorm
Nov 03, 2015 @ 10:08:35

In this recent post to the JetBrains blog they show how to set up and configure the Docker support the latest version includes built in to the IDE.

Docker is an open platform for building, shipping and running distributed applications. It gives programmers, development teams and operations engineers the common toolbox they need to take advantage of the distributed and networked nature of modern applications.

With the new Docker integration plugin for PhpStorm, you can add Docker support to existing projects, view logs, manage Docker containers, and debug PHP web applications from right inside PhpStorm.

They help you get the integration plugin installed and show you where the machine should be located and how to set it up under PHPStorm's deployment options. Next up they include the steps for getting the Docker machine up and running (again, inside the IDE) and managing the containers related to the machine.

tagged: docker support phpstorm ide jetbrains container machine

Link: http://blog.jetbrains.com/phpstorm/2015/10/docker-support-in-phpstorm/

SitePoint PHP Blog:
Docker and Dockerfiles Made Easy!
Oct 16, 2015 @ 15:56:58

The SitePoint PHP blog has a post that aims to help you with Docker and introduces some of the basic concepts and steps to understand the Dockerfile configuration.

It’s become second nature for developers to use Virtual Machines to configure and manage their working environments. Most professionals who use VMs use Vagrant for dealing with their development environments. In this article, we’ll be moving from Vagrant to Docker, and use a small Laravel application to test that everything is working as expected.

They walk you through the installation of necessary tools, creation of a simple Docker machine and the concepts behind images and containers. They show you how to create a simple Ubuntu-based machine and configuring it to serve up the default Ubuntu+Apache page. They also cover container volumes, a method for keeping a local folder in sync with one in your instance. They help you set this up with a Laravel installation. Next up they help you configure the database container running MySQL and connect it to the Laravel instance. The tutorial also shows how to set up links between the containers, gets into some of the details of the Dockerfile structure and using "docker compose" to easily create environments based off a YAML configuration.

tagged: docker dockerfiles tutorial environment container image laravel

Link: http://www.sitepoint.com/docker-and-dockerfiles-made-easy/