WordPress on Docker with mSMTP and Traefik Support

Overview

In this tutorial I will share my WordPress on docker setup. The stack includes WordPress (with mSMTP), MariaDB, Adminer, Backup and Traefik support.

WordPress on docker Setup

  1. clone the repo https://github.com/RaveMaker/docker-wordpress
  2. edit .env file:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # Should be the same as folder
    podName=docker-wordpress
    # VirtualHost address
    hostRule=wordpress.docker.localhost
    adminerHostRule=adminer.wordpress.docker.localhost
    # Database credentials
    dbName=exampledatabase
    dbUser=exampleuser
    dbPass=examplepass
    # Time Zone
    timeZone=Asia/Jerusalem
  3. create msmtp/msmtprc from provided msmtprc.example
  4. change permissions and ownership of msmtprc file:
    1
    2
    chown 33:33 msmtprc
    chmod 600 msmtprc

Network settings

The stack is divided into two networks, backend and frontend.

the idea behind splitting the stack into two networks is to block the access of the reverse proxy to the backend containers.

both networks are unique and will be named with stackname_networname such as:

  • docker-wordpress_backend
  • docker-wordpress_frontend

after running docker-compose up you need to connect your reverse proxy to your new frontend network: you can do that manually using:

  • docker network connect docker-wordpress_frontend PROXY_CONTAINER_NAME

if you are using my Traefik setup there is a ‘connect.sh’ script included that will connect all your frontend networks to your Traefik container.

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.