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

Delicious Brains Blog:
Behind-the-Scenes: How We’re Automating Acceptance Testing
Aug 15, 2017 @ 10:57:04

On the Delicious Brains site Ian has written up a lengthy post sharing how they automate their acceptance testing for their PHP applications.

Have you ever had the joy of carrying out acceptance tests? For our team at Delicious Brains, testing our releases, in the past, has been one of the most dreaded tasks on the to-do list. We hold our plugins to a high quality standard so it’s a must but manual tests are brain-numbingly tedious and can take hours of expensive developer time.

Recently, we decided it was high-time to fix that. [...] Read on for more about how the automation of testing our plugins ahead of release is shaping up – including how we manually tested in the past and a look at some of the automated acceptance tests we’ve already implemented.

He starts by defining what acceptance testing is and how they're different from other types of testing. He then shows the manual method they were using to run their tests previously and what prompted the move towards automation. He talks about the tools that they use for their automated testing including Codeception and Docker. Configurations and scripts are included that make the automation work and some of the issues they came across during the move from manual to automated processes.

tagged: automated testing codeception docker tutorial setup configuration manual

Link: https://deliciousbrains.com/how-were-automating-acceptance-testing/

Kevin Schroeder:
Magento 2 Performance on Docker (a preliminary test)
Aug 14, 2017 @ 09:58:17

Kevin Schroeder has a post to his site sharing some of the results from his initial testing with Magento in a Docker-built environment.

I can’t speak to the cost of Docker experts (I’m not one, but my experience is that once you get through the annoyance of the Dockerfile it doesn’t require much more advanced knowledge than a regular sysadmin), but I found the response interesting because my experience with Docker in production has been so good that I’ve Dockerized practically everything, including this blog. But this guy knows his stuff, and I give a lot of weight to his perspective. But my experience has been different.

Except in one place. Magento 2 on Docker on Mac is a horrible experience and it is specifically because of file system performance. But on Linux I’ve had good experiences. However, those experiences were with Magento 1 and not Magento 2. Magento 2 relies on the file system more than Magento 1 so it is quite plausible that Magento 2 is slow as molasses on Docker.

He decided that he'd try a different platform and see if the results were similar to those on an OSX system. He includes a list of four caveats and the setup including the fact that it is a "smoke test" (prelimary results) and that the rest was being done on a bit older machine. He shares the testing setup and what he used to test and compares the results to it running on "bare metal" (a normal custom setup server). His findings show that the "bare metal" instance ran only slightly better than the Dockerized version. He includes graphs for the requests handled, CPU usage and throughput from each of the tests executed.

tagged: magento docker performance testing results

Link: http://www.eschrade.com/page/magento-2-performance-on-docker

Jakub Zalas:
Static analysis tools for PHP in a single docker image
Jul 21, 2017 @ 10:56:07

Jakub Zalas has a new post to his site sharing a Docker image he's created to help make static analysis for your PHP code simpler: the phpqa image.

As part of my job I often perform application reviews and code quality analysis for clients who wish to have their code base looked at by an independent company. Running static analysis tools is usually a starting point to the review as it gives a general overview of a state of the project. I also like to run those tools as part of an introduction to an inherited code base.

For an easy access to the most popular static analysis tools for PHP I recently created a docker image - phpqa.

He lists out the tools that are included with the current version (a quite lengthy list) including:

  • analyze
  • box
  • deptrac
  • php-code-fixer
  • phpDocumentor
  • phpa
  • phploc
  • phpmd
  • phpstan
  • psalm

...and many more. Check out the full post for more of the tools in the list and links to more information about each one.

tagged: docker image static analysis tool image phpqa

Link: http://zalas.eu/phpqa-static-analysis-tools-for-php-docker-image/

Colin O'Dell:
Testing PHP 7.2 With Docker
Jul 07, 2017 @ 11:58:07

Colin O'Dell has posted a guide that you can follow to help you test your applications with the latest version of the PHP 7.2 pre-releases using a simple Docker setup.

PHP 7.2 is slated for release in November 2017, but you don't have to wait until then to start testing your applications! We can easily use Docker to test against the latest pre-release versions of 7.2.

He's even created a Docker image that's posted on DockerHub to make the process even simpler. He shows how to reference specific types (php-fpm, apache, etc) and specific tags for the PHP pre-releases on each. He encourages you to log bugs in the PHP if found and report issues to him if there's a problem with the Docker setup. He also mentions that, since the mcrypt extension was removed by default from PHP 7.2, you'll need some special commands to get it set up and working (via a PECL install).

tagged: testing php72 prerelease version docker image dockerhub

Link: https://www.colinodell.com/blog/201707/testing-php-72-docker

Stephan Hochdöfer:
Dockerizing GitLab Review Apps
Jun 07, 2017 @ 10:28:15

On the BitExpert blog Stephan Hochdöfer has written up a post showing how to "Dockerize" GitLab review apps to create a consistent platform for these self-contained environments.

Last year GitLab introduced the Review Apps feature. Review Apps are app environments that are created dynamically every time you push a new branch up to GitLab. As a bonus point the app environments are automatically deleted when the branch is deleted. Since we moved to using docker for quite a few of our projects I was keen on figuring out how to combine Docker and the GitLab Review Apps functionality as the documentation only mentions NGINX as a way to run Review Apps. As it turns out, it is rather simple to deploy docker containers as a Review App.

He describes the environment he needs and which tools he'll be using to perform the build of the environments. He then defines the sample GitLab configuration file including the "build" stage. He briefly explains the steps this follows then shows the configuration for the "deploy" step, grabbing the latest image from his Docker repo and running it. He ends the post with an "undeploy" stage that removes the Docker build automatically when the environment is no longer needed.

tagged: gitlab review application apps tutorial docker deploy undeploy

Link: https://blog.bitexpert.de/blog/dockerizing-gitlab-review-apps/

Master Zend Framework:
How to Go From Development to Deployment with Docker
Jun 01, 2017 @ 13:13:58

The Master Zend Framework series has posted the third part in their series covering deployment and development setups with Docker. In this latest article Matthew Setter builds on the knowledge from the first and second parts of the series and shows how to deploy your environment to production.

In my search to learn how to use Docker as a complete solution to develop with, I've found a range of tutorials which discuss or walk through some part of the process.

Sadly, no one tutorial contains all the steps necessary to step you through containerizing an (existing) application through to deploying said application in a production environment. Given that, my aim in writing this tutorial is to show you how to do this.

The challenge in doing so, unfortunately, is that there's a lot to learn and absorb. [...] So this is going to be a lengthy post. But I've aimed to provide the most direct path to your first production deployment, as well as to structure it so that it's easy to work through or navigate to the specific part you need.

He starts off with a few prerequisites you'll need to complete the process - a DigitalOcean account, a Docker Hub account, Docker installed and working and a project to deploy. The rest of the post is broken down into a few sections to make it a bit more consumable:

  • Create & Build the Container
  • Store the Image in an Accessible Registry
  • Build a Deployment Configuration
  • Make the Deployment

For each step in the process all of the code, configurations an commands you'll need are included. In some places screenshots are also included to help you ensure you're on the right path.

tagged: development deployment docker tutorial series production

Link: http://www.masterzendframework.com/docker-from-development-to-deployment/

Laravel in Docker
May 05, 2017 @ 12:13:32

On the Hackernoon.com site they've posted a tutorial showing you how to set up a Docker image of a Laravel application to help speed up your development using the framework and standardize the environment it lives in.

With this article you’ll learn how to prepare a Docker image of a Laravel application, push it to the registry, and use Docker in Continuous Delivery.

The post starts with a brief introduction of the two technologies at play, the Laravel framework and Docker, and what they provide. The tutorial then walks you through the entire process of setup, configuration and deployment of the Docker image:

  • Install Docker
  • Write a Dockerfile (including the install of Laravel)
  • Build Docker image (and Run)

At this point you have the image set up and ready to serve Laravel requests so they move on to sharing the image out on a Docker registry. In this case they opt to deploy it to hub.docker.com and use the login and push commands to quickly and easily share your creation. Finally they provide some use cases for this kind of deployment including creating standard development environments, using them for testing and keeping a consistent environment between development, staging and production.

tagged: laravel framework docker tutorial configure deploy dockerhub environment

Link: https://hackernoon.com/laravel-in-docker-ceed4465352

Adam Culp:
Easy Docker dev environments for PHP with CloudEstuary
Apr 17, 2017 @ 15:14:09

Adam Culp has written up a new post to his site showing you how to use the CloudEstuary service to easily create Docker development environments for your day to day work.

Lately I’ve been messing around with Docker, and specifically with containerizing PHP applications to perform quick services, such as static analysis of PHP code, compatibility of existing PHP code to specific versions of PHP, and performing security checks on PHP libraries included in my projects. However, I’ve not created a development environment for my projects using Docker.

[...] But today I found another way [besides using Vagrant]. A way to easily create PHP development environments with Docker. The fine folks at CloudEstuary have created an easy to use web-based tool to create PHP development environments (yml files) for use with Docker-compose.

He then walks you through the process of creating a new environment, selecting the framework to be installed by default and other "add-ons" to be include (it also allows for the addition of workers). After clicking on the "Generate Docker Compose" button the service spits out the YAML configuration file you can then use to create the environment. There's a few tweaks he recommends making to the config and, finally, the command to use the configuration and bring the environment up.

tagged: docker cloudestuary service compose tutorial configuration

Link: http://www.geekyboy.com/archives/1321

Rob Allen:
Using CircleCI for a PHP project
Apr 03, 2017 @ 09:56:20

In a post to his site Rob Allen shares a basic setup for using Circle CI with a PHP project for continuous integration. Circle CI provides the resources to build your project and perform tasks such as run unit tests or even deploy the resulting code to the production environment.

For a new client project, I've decided to use CircleCI to run my tests every time I push to GitHub. This turned out to be quite easy; this is how I did it.

He shares the contents of his .circleci/config.yml configuration file creating a Docker environment each time the build is executed, installing the required software, executing Composer install and running PHPCS and PHPUnit tests. He shares an example of the output from a build and how he hooked in Slack to receive notifications when the builds were complete (and pass/fail status).

tagged: circleci service continuous integration project tutorial configuration docker

Link: https://akrabat.com/using-circleci-for-a-php-project/

Stefan Koopmanschap:
Sculpin and Docker
Mar 22, 2017 @ 12:49:05

Stefan Koopmanschap has written up a tutorial on his site introducing the use of Docker and Sculpin to create an easily reproducible and manageable blogging setup.

I've been running this blog on Sculpin for quite a while now, and I'm quite happy with how that works. We've been in a process of migrating some of our websites off a standard VPS towards a setup with Docker, Gitlab CI and Rancher. I've now migrated some websites, which is relatively easy, but most of those sites were dynamic PHP websites. Migrating a site that generates static HTML and running that is a slightly different thing. Here's how I ended up doing it.

First he covers his old setup - essentially the manual run of a shell command to generate the latest version of a the static Sculpin site. He decided to update the process and help makes things more automatic using Docker and a Gitlab pipeline flow. He then documents his attempts and configuration options as he built up the Docker configuration he wanted. This ultimately resulted in a Docker setup that installed PHP and Nginx to serve up the site, Composer to load in the required dependencies (like Sculpin) and the commands to "deploy" the latest version of the site publicly.

tagged: sculpin docker setup configuration tutorial dockerfile php7

Link: https://leftontheweb.com/blog/2017/03/18/sculpin-and-docker/