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

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