From ad69497ce4f9bdc823e8c98915e37cab9b0b5c3d Mon Sep 17 00:00:00 2001 From: cytopia Date: Sun, 12 Aug 2018 13:20:17 +0200 Subject: [PATCH] Fix #202 Document MailHog integration --- compose/README.md | 3 + compose/docker-compose.override.yml-mailhog | 15 +++ docs/_includes/links/tools.rst | 12 +++ docs/custom-container/integrate-mailhog.rst | 108 ++++++++++++++++++++ docs/index.rst | 8 +- 5 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 compose/README.md create mode 100644 compose/docker-compose.override.yml-mailhog create mode 100644 docs/custom-container/integrate-mailhog.rst diff --git a/compose/README.md b/compose/README.md new file mode 100644 index 00000000..ff7307ed --- /dev/null +++ b/compose/README.md @@ -0,0 +1,3 @@ +# Docker Compose overwrites + +This directory container various `docker-compose.override.yml` examples to be used with the Devilbox. diff --git a/compose/docker-compose.override.yml-mailhog b/compose/docker-compose.override.yml-mailhog new file mode 100644 index 00000000..33f37f42 --- /dev/null +++ b/compose/docker-compose.override.yml-mailhog @@ -0,0 +1,15 @@ +version: '2.1' + +services: + mailhog: + hostname: mailhog + image: mailhog/mailhog:latest + ports: + - "${LOCAL_LISTEN_ADDR}8025:8025" + networks: + app_net: + ipv4_address: 172.16.238.201 + depends_on: + - bind + - php + - httpd diff --git a/docs/_includes/links/tools.rst b/docs/_includes/links/tools.rst index 1a4a16dc..5f98605e 100644 --- a/docs/_includes/links/tools.rst +++ b/docs/_includes/links/tools.rst @@ -296,3 +296,15 @@ watcherp + + +.. + ============================================================ + Additional container + ============================================================ + +.. |ext_lnk_container_mailhog| raw:: html + + + MailHog + diff --git a/docs/custom-container/integrate-mailhog.rst b/docs/custom-container/integrate-mailhog.rst new file mode 100644 index 00000000..d3f963ef --- /dev/null +++ b/docs/custom-container/integrate-mailhog.rst @@ -0,0 +1,108 @@ +.. include:: /_includes/all.rst + +.. _custom_container_ingegrate_mailhog: + +***************** +Integrate Mailhog +***************** + +This section will guide you through getting Mailhog integrated into the Devilbox. + +.. seealso:: |ext_lnk_container_mailhog| + + +**Table of Contents** + +.. contents:: :local: + + +Overview +======== + +The Devilbox ships various example configurations to overwrite the default stack. Those files are +located under ``compose/`` in the Devilbox git directory. + +In case of Mailhog, the file is ``compose/docker-compose.override.yml-mailhog``. This file +must be copied into the root of the Devilbox git directory. + ++-----------------------+-------------------------------------------------+ +| What | How and where | ++=======================+=================================================+ +| Example compose file | ``compose/docker-compose.override.yml-mailhog`` | ++-----------------------+-------------------------------------------------+ +| Container IP address | ``172.16.238.201`` | ++-----------------------+-------------------------------------------------+ +| Exposed port | ``8025`` | ++-----------------------+-------------------------------------------------+ +| Available at | ``http://localhost:8025`` | ++-----------------------+-------------------------------------------------+ +| Container name | ``mailhog`` | ++-----------------------+-------------------------------------------------+ +| Further configuration | php.ini settings need to be applied per version | ++-----------------------+-------------------------------------------------+ + + +Instructions +============ + +Copy example docker-compose.override.yml +---------------------------------------- + +Copy the mailhog Docker Compose overwrite file into the root of the Devilbox git directory. + +.. code-block:: bash + + host> cp compose/docker-compose.override.yml-mailhog docker-compose.override.yml + +.. seealso:: + * :ref:`docker_compose_override_yml` + * :ref:`add_your_own_docker_image` + * :ref:`overwrite_existing_docker_image` + + +Adjust PHP settings +------------------- + +The next step is to tell PHP that it should use a different mail forwarder. + +Let's assume you are using PHP 7.2. + + +.. code-block:: bash + + # Navigate to the PHP ini configuration directory of your chosen version + host> cd cfg/php-ini-7.2 + + # Create and open a new *.ini file + host> vi mailhog.ini + +Add the following content to the newly created ini file: + +.. code-block:: ini + :caption: mailhog.ini + + [mail function] + sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"' + +.. seealso:: :ref:`php_ini` + + +Start the Devilbox +------------------ + +The final step is to start the Devilbox with mailhog. + +Let's assume you want to start ``php``, ``httpd``, ``bind``, ``mysql`` and ``mailhog``. + +.. code-block:: bash + + host> docker-compose up -d php httpd bind mysql mailhog + +.. seealso:: :ref:`start_the_devilbox` + + +Functionality +------------- + +* Once the Devilbox is running, visit http://localhost:8025 in your browser. +* Any email send by any of the Devilbox managed projects will then appear in Mailhog diff --git a/docs/index.rst b/docs/index.rst index 55319b87..e7080956 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -83,18 +83,22 @@ host is ready to be served with your custom domain. .. toctree:: :caption: vhost-gen :maxdepth: 2 - :numbered: vhost-gen/virtual-host-templates vhost-gen/customize-all-virtual-hosts-globally vhost-gen/customize-specific-virtual-host vhost-gen/example-add-subdomains +.. toctree:: + :caption: Add custom container + :maxdepth: 2 + + custom-container/integrate-mailhog + .. toctree:: :caption: Corporate Usage :maxdepth: 2 - :numbered: corporate-usage/shared-devilbox-server-in-lan corporate-usage/use-external-databases