As a PHP Developer I’ve always had instances of webserver, php & database server running as first level services on my Development machines. I can claim that configuring LAMP (recently LEMP) stack was always one of the first things I’d do when I get a new machine.
I’ve been using Docker for running other services such as Redis, Mongo, Elasticsearch, Neo4J and … but today I am going to completely configure my development environment on top of containers on my new Mac.
Thanks to LaraDock this process should be much easier and smooth. For those of you who don’t know about LaraDock, it’s a set of containers with configurations templates that can come handy to any PHP developers.
Although the project is targeting Laravel developers, but any PHP developer can benefit from these tools.
Why the change?
Running a traditional LAMP/LEMP stack setup has no issues, but occasionally there are some glitches time to time that I’m hoping to avoid by fully going Dockerized.
- I realised sometimes OS updates (Specially Major Updates) can mess up with services installed on the machine. This is simply inevitable and has happened to me multiple times so far. So this way I only need to make sure my Docker service is running.
- I realised that I hesitate more on updating my services fearing that they may break. I believe going with Docker should make the process of upgrading those services easier.
- Things sometimes break! I remember when homebrew simply changed where formulas for PHP were, they added it to the core formulas and I had a hard time updating from PHP 7.0 to 7.2.
I’ll however install php itself on the machine for times that I want to run php scripts within the console or work with the PHP Built-in Webserver.
LaraDock comes with many containers, but I am more interested in a LAMP stack of containers, so we will be starting nginx, mariadb, php-fpm and make sure they will be always up by modifying the restart-policy variable.
Continue reading “LaraDock: Dockerizing my PHP Development Environment”