LEMP stack with Docker Compose

lemp-stack-compose is a server stack that I have written for development (or even production) purposes. This is a project consists of Compose files that simply create LEMP stack with Docker Compose.

A LEMP stack consists of Linux, Nginx, MySQL, and PHP. For this Project, Docker does the containerization and isolation. And Compose is for defining and running multi-container Docker applications. The project creates one shared mysql, one nginx reverse proxy and multiple upstream server and separate php containers in brief.

In short, this Compose project spins up example.com in minutes.

The images used in the Project are listed below.

nginx

This image is build on the official Nginx Docker image by adding automatic configuration file creation feature, which creates well-commented configuration files using environment variables. Configuration file templates for “proxy” and “usptream” server roles are included in the image as well.

php-fpm

This image is also build on the official PHP Docker image’s fpm-* flavor, adding some common extensions and ssmtp for mail relay.

MySQL

This is pure official MySQL Docker image.

cron

A cron image for common tasks of server which also supports automatic configuration with environment variables. This image is build on runit image for zombie reaping and also can be used as a base image for you own images you want to create. See…link

rsyslog

rsyslog image if you want plain text logging for use with Docker’s syslog logging driver. (Do not use if you want to use other logging solutions. This is just an example of the image in action.)

The official Phpmyadmin Adminer and Portainer (GUI) images are included in the compilation as well.

Shared multiple Compose configurations, overriding files, extending services were all implemented as described at the official documentation.

Simple usage example:

$ docker-compose pull
$ docker-compose up –d

Production example:

$ docker-compose -f docker-compose.yml -f docker-compose.prod.yml pull
$ docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Source: https://volkan.xyz

 

You can share this blog post only by giving appropriate credit as described at Terms & Conditions.

 

Leave a Reply

Your email address will not be published. Required fields are marked *