Using Docker to clone the MAMP concept -- DAMP stack: Docker, Apache, MySQL, PHP

The DAMP stack is a tongue-in-cheek play on LAMP, MEAN, MAMP and other "stacks". It's not a serious attempt at a product, but instead it's an idea that folks can use on their own.

There was a product from Acquia almost 10 years ago, DAMP, that assisted with installing Drupal+Apache+MySQL+PHP for doing Drupal development. That DAMP product obviously had nothing to do with Docker, and the 'D' meant Drupal. Here, the 'D' is all about Docker.

This DAMP stack is Docker + Apache + MySQL + PHP, sort of. It's actually anything you want to install using Docker. The core idea is develop with Docker on your laptop, deploy with Docker to test or staging or production infrastructure, all from your laptop.

Docker makes that model easy. Within Docker your in-development-code on your laptop is running the exact same environment as is used on the deployment server. It means the days of it works on my laptop is no longer an excuse for why the service failed in production.

Consider the MAMP product for macOS-based software development. If LAMP is the deployment platform of choice, but developers are using macOS, MAMP was supposed to be the bridge. It is an easy-as-pie way to run LAMP-style code on a macOS system. A simple application install, and suddenly you have Apache, MySQL, PHP ready to go, and the modern version of MAMP supports a whole lot more.

Supposedly with MAMP the code running on your laptop will execute unchanged on the server. But macOS is not Linux, and there are inevitable version number differences, and all kinds of possible other differences, so will that really work in practice?

With Docker it's the same environment in development as in production because you've specified the environment in the Dockerfile.

With Docker - why do we need MAMP? With Docker we can do far more than MAMP ever thought possible.

Scheduling background tasks using cron in a Docker container

(May 27, 2018)

Sometimes you want a Docker container to execute background tasks, and therefore want cron to be installed and running. Having cron running in the background is part of normal Unix/Linux/etc system admin practices. Even though the crontab format is kind of hokey, we all learn it and set up automated background tasks to keep the world functioning. Let's see how to set this up in a Docker container.

Getting started with Docker: Installation, first steps

(April 5, 2018)

Let's start this journey into Docker by learning how to install it on popular systems. Installation is a lot simpler today than at the beginning, especially on Mac and Windows. You youngsters don't know how easy you have it now that Docker for Mac and Docker for Windows exist. In the old days we had to walk 10 miles through the snow, uphill both ways, to install VirtualBox along with a specialized virtual machine to use Docker.

HTTPS with nginx, using Lets Encrypt, proxying to Gogs and Jenkins back-end services

(March 31, 2018)

Modern development environments require a continuous integration system, along with a reasonable git-based repository hosting service. It's possible to rent these services, Github and Gitlab are both excellent hosted git repository services for example, and there are several hosted continuous integration systems. Gitlab in particular is a one-stop-shop offering both Git hosting and continuous integration in one service. But, you can easily host Git and Continuous Integration services on your own hardware. And with a little work the services can be HTTPS-protected using Lets Encrypt.

Connect with SSL to MySQL in Docker container

(March 5, 2018)

MySQL throws an error if you connect without using SSL, so therefore the MySQL team is making it clear it's best to use SSL. Clearly a database connection has critical data that you don't want to leak to 3rd parties, and encrypting the database connection is preferred. What's even more preferred is tight control to limit visibility of the database connection. The official MySQL Docker container automatically generates a set of SSL certificates to use for connections, so let's see how to put those certificates to use.

Set up MongoDB Docker image

(March 4, 2018)

MongoDB, as one of the popular NoSQL databases, is part of many software development projects. Hence, one must know how to configure and setup MongoDB in a Docker environment.

Set up MySQL Docker image on your laptop, then verify it works using phpMyAdmin

(November 30, 2017)

Setting up MySQL on Docker is fairly simple, and the MySQL team has done a credible job creating a flexible Docker image that can be used in many circumstances. Once the MySQL container is set up, you need a method to verify it can be accessed from other containers, and to manage the database it contains. Enter the mysql-client and phpMyAdmin Docker images. Both are easy to set up, and easy to use. Typically when deployed as part of an application stack, the MySQL container won't be visible to the public Internet but does need to be visible to other containers in your deployed application. Hence, there must be a private bridge network the containers use to communicate with each other, and the only ports published are what's required to supply the service to the public.

Unlike the MAMP product, what's shown here is equally applicable to macOS and Windows laptops.