Nearly three months into 2019 and it’s time for me to start looking at my development workflow once again. Anyone who’s regularly looked at my site over the last year or so will notice that I’ve been constantly trying to improve and build on the way I work with both back and front end web code, from looking at frameworks such as Symfony, to environments such as Node.js and using Gulp to streamline and make my code more manageable. I’ve recently upgraded my day-job tech to working with a much faster, more powerful desktop PC rather than the portable but slow and inefficient laptop I’ve been using for the last couple of years. I’m still using Windows 10 as a) that’s what the University standard is and b) I need to work with Power BI which doesn’t have a desktop client on other OS’s yet. So, new machine but I still needed to transfer my old work and environment over. Time to take a look at some optimisations, and what better place to start than my local development stack.

For years (years!) I’ve been using WAMPserver to run Apache, MySQL and PHP in a local web-dev environment and, while it’s suited me just fine, I’ve always felt like their should be a better way. Sure, there’s other AMP stack alternatives such as XAMPP, but I’ve been wanting to get to grips with the now 6 year old virtualisation tool Docker, and saw an opportunity to jump in and start using that to run my local dev environment. I did some research and settled on the wonderfully named Devilbox to power my stack. The setup was relatively painless although some teething issues crept in, but after a couple of days figuring out the foibles and learning some Docker lingo, I’m happy to say that I’ll be sticking with Devilbox for the forseeable future.

So, what is Docker? To be honest I’m still getting my head around the concept myself, but in basic terms it’s a service which allows containers to be run on host computers to provide virtualised environments. These environments can be spun up and down as required, often run in pre-configured ways and allow applications to be easily distributed and installed. Devilbox, for example, comes with a number of different server tools, from the usual Apache, MySQL and PHP to also including alternatives such as Nginx, MariaDB, MongoDB and others, and the environment can be easily rebuilt to include these different components as needed.

If you’re interested in getting up and running with Devilbox, the instructions on the website are incredibly comprehensive, so go check them out. They cover installation and running on Windows, Mac and Linux, and the tool itself comes with a http based intranet service which lets you monitor the individual services as well as run things like PHPMyAdmin. So long as you’re happy with using command line and git, the installation is very painless.

I’ve only come across a couple of issues so far, and the main one is with Docker itself – a couple of times I’ve restarted my PC, autoloading Docker, only to get a problem starting the bind process in Devilbox. I’ve been able to rectify this by restarting Docker. You’ll also have to be comfortable (in Windows at least) in editing the host file so that you can use the <project-name>.loc format that Devilbox projects are accessed via. You’ll also need to pay attention to the hostnames that Devilbox deploys its services under; for example, you’ll need to use the hostname “mysql” to access the mysql database while setting up a site like WordPress.

If you’re a VS Code user , you should also check out the Docker extension which will let you check your running containers and start/stop them as you need to.

As always, hopefully this has been of some use to you – shout out in the comments!

Advertisements