mirror of
https://github.com/cytopia/devilbox.git
synced 2025-02-20 17:33:05 +00:00
MailHog fine-tuning
This commit is contained in:
parent
c77fd90472
commit
994df7d6da
@ -2,13 +2,13 @@ version: '2.1'
|
||||
|
||||
services:
|
||||
mailhog:
|
||||
image: mailhog/mailhog:${MAILHOG_SERVER:-latest}
|
||||
hostname: mailhog
|
||||
image: mailhog/mailhog:latest
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_CUSTOM_MAILHOG:-8025}:8025"
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MAILHOG:-8025}:8025"
|
||||
networks:
|
||||
app_net:
|
||||
ipv4_address: 172.16.238.201
|
||||
ipv4_address: 172.16.238.200
|
||||
depends_on:
|
||||
- bind
|
||||
- php
|
||||
|
@ -21,3 +21,33 @@
|
||||
<a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">
|
||||
Wikipedia: List of database timezones <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
|
||||
..
|
||||
============================================================
|
||||
Additional container
|
||||
============================================================
|
||||
|
||||
.. |ext_lnk_mailhog_github| raw:: html
|
||||
|
||||
<a target="_blank" href="https://github.com/mailhog/MailHog">
|
||||
Github: MailHog <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
.. |ext_lnk_mailhog_dockerhub| raw:: html
|
||||
|
||||
<a target="_blank" href="https://hub.docker.com/r/mailhog/mailhog/">
|
||||
Dockerhub: MailHog <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
.. |ext_lnk_rabbitmq_github| raw:: html
|
||||
|
||||
<a target="_blank" href="https://github.com/rabbitmq/rabbitmq-server">
|
||||
Github: RabbitMQ <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
.. |ext_lnk_rabbitmq_dockerhub| raw:: html
|
||||
|
||||
<a target="_blank" href="https://hub.docker.com/_/rabbitmq/">
|
||||
Dockerhub: RabbitMQ <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
@ -296,15 +296,3 @@
|
||||
<a target="_blank" href="https://github.com/devilbox/watcherp">
|
||||
watcherp <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
|
||||
..
|
||||
============================================================
|
||||
Additional container
|
||||
============================================================
|
||||
|
||||
.. |ext_lnk_container_mailhog| raw:: html
|
||||
|
||||
<a target="_blank" href="https://github.com/mailhog/MailHog">
|
||||
MailHog <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
@ -0,0 +1,18 @@
|
||||
The Devilbox ships various example configurations to overwrite the default stack. Those files are
|
||||
located under ``compose/`` in the Devilbox git directory.
|
||||
|
||||
``docker-compose.override.yml-all`` has all examples combined in one file for easy copy/paste.
|
||||
However, each example also exists in its standalone file as shown below:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> tree -L 1 compose/
|
||||
compose/
|
||||
├── docker-compose.override.yml-all
|
||||
├── docker-compose.override.yml-mailhog
|
||||
├── docker-compose.override.yml-rabbitmq
|
||||
└── README.md
|
||||
|
||||
0 directories, 4 files
|
||||
|
||||
.. seealso:: :ref:`custom_container_enable_all_additional_container`
|
@ -77,7 +77,7 @@ language = None
|
||||
# This pattern also affects html_static_path and html_extra_path .
|
||||
exclude_patterns = [
|
||||
u'_build/*',
|
||||
u'_includes/*',
|
||||
u'_includes/**',
|
||||
u'Thumbs.db',
|
||||
u'.DS_Store'
|
||||
]
|
||||
|
177
docs/custom-container/enable-mailhog.rst
Normal file
177
docs/custom-container/enable-mailhog.rst
Normal file
@ -0,0 +1,177 @@
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _custom_container_enable_mailhog:
|
||||
|
||||
****************************
|
||||
Enable and configure MailHog
|
||||
****************************
|
||||
|
||||
This section will guide you through getting MailHog integrated into the Devilbox.
|
||||
|
||||
.. seealso::
|
||||
* |ext_lnk_mailhog_github|
|
||||
* |ext_lnk_mailhog_dockerhub|
|
||||
* :ref:`custom_container_enable_all_additional_container`
|
||||
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
Available overwrites
|
||||
--------------------
|
||||
|
||||
.. include:: /_includes/snippets/docker-compose-override-tree-view.rst
|
||||
|
||||
|
||||
MailHog settings
|
||||
----------------
|
||||
|
||||
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-all`` or |br| ``compose/docker-compose.override.yml-mailhog`` |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| Container IP address | ``172.16.238.200`` |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| Container host name | ``mailhog`` |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| Container name | ``mailhog`` |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| Mount points | none |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| Exposed port | ``8025`` (can be changed via ``.env``) |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| Available at | ``http://localhost:8025`` |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| Further configuration | php.ini settings need to be applied per version |
|
||||
+-----------------------+-----------------------------------------------------------------------------------------------------+
|
||||
|
||||
MailHog env variables
|
||||
---------------------
|
||||
|
||||
Additionally the following ``.env`` variables can be created for easy configuration:
|
||||
|
||||
+------------------------------+---------------+---------------------------------------------------------------+
|
||||
| Variable | Default value | Description |
|
||||
+==============================+===============+===============================================================+
|
||||
| ``HOST_PORT_MAILHOG`` | ``8025`` | Controls the host port on which MailHog will be available at. |
|
||||
+------------------------------+---------------+---------------------------------------------------------------+
|
||||
| ``MAILHOG_SERVER`` | ``latest`` | Controls the MailHog version to use. |
|
||||
+------------------------------+---------------+---------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
Instructions
|
||||
============
|
||||
|
||||
1. Copy docker-compose.override.yml
|
||||
-----------------------------------
|
||||
|
||||
Copy the MailHog Docker Compose overwrite file into the root of the Devilbox git directory.
|
||||
(It must be at the same level as the default ``docker-compose.yml`` file).
|
||||
|
||||
.. 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`
|
||||
|
||||
|
||||
2. 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`
|
||||
|
||||
|
||||
3. Adjust ``.env`` settings (optional)
|
||||
--------------------------------------
|
||||
|
||||
By Default MailHog is using the host port ``8025``, this can be adjusted in the ``.env`` file.
|
||||
Add ``HOST_PORT__MAILHOG`` to *.env* and customize its value.
|
||||
|
||||
Additionally also the MailHog version can be controlled via ``MAILHOG_SERVER``.
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: .env
|
||||
|
||||
HOST_PORT_MAILHOG=8025
|
||||
MAILHOG_SERVER=latest
|
||||
|
||||
.. seealso:: :ref:`env_file`
|
||||
|
||||
|
||||
4. Start the Devilbox
|
||||
---------------------
|
||||
|
||||
The final step is to start the Devilbox with MailHog.
|
||||
|
||||
Let's assume you want to start ``php``, ``httpd``, ``bind`` and ``mailhog``.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> docker-compose up -d php httpd bind mailhog
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox`
|
||||
|
||||
|
||||
5. Start using it
|
||||
-----------------
|
||||
|
||||
* 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
|
||||
|
||||
|
||||
TL;DR
|
||||
=====
|
||||
|
||||
For the lazy readers, here are all commands required to get you started.
|
||||
Simply copy and paste the following block into your terminal from the root of your Devilbox git
|
||||
directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Copy compose-override.yml into place
|
||||
cp compose/docker-compose.override.yml-mailhog docker-compose.override.yml
|
||||
|
||||
# Create php.ini
|
||||
echo "[mail function]" > cfg/php-ini-7.2/mailhog.ini
|
||||
echo "sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr=\"mailhog:1025\"'" >> cfg/php-ini-7.2/mailhog.ini
|
||||
|
||||
# Create .env variable
|
||||
echo "HOST_PORT_MAILHOG=8025" >> .env
|
||||
echo "MAILHOG_SERVER=latest" >> .env
|
||||
|
||||
# Start container
|
||||
docker-compose up -d php httpd bind mailhog
|
@ -1,137 +0,0 @@
|
||||
.. 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`` (can be changed via ``.env``) |
|
||||
+-----------------------+-------------------------------------------------+
|
||||
| Available at | ``http://localhost:8025`` |
|
||||
+-----------------------+-------------------------------------------------+
|
||||
| Container name | ``mailhog`` |
|
||||
+-----------------------+-------------------------------------------------+
|
||||
| ``.env`` variable | ``HOST_PORT_CUSTOM_MAILHOG`` |
|
||||
+-----------------------+-------------------------------------------------+
|
||||
| Further configuration | php.ini settings need to be applied per version |
|
||||
+-----------------------+-------------------------------------------------+
|
||||
|
||||
|
||||
TL;DR
|
||||
=====
|
||||
|
||||
Copy and paste this block from the root of your Devilbox git directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cp compose/docker-compose.override.yml-mailhog docker-compose.override.yml
|
||||
printf "[mail function]\nsendmail_path = '/usr/local/bin/mhsendmail --smtp-addr=\"mailhog:1025\"'" > cfg/php-ini-7.2/mailhog.ini
|
||||
docker-compose stop
|
||||
docker-compose up -d php httpd bind mysql mailhog
|
||||
|
||||
|
||||
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`
|
||||
|
||||
|
||||
``.env`` settings
|
||||
-----------------
|
||||
|
||||
By Default MailHog is using the host port ``8025``, this can be adjusted in the ``.env`` file.
|
||||
Add ``HOST_PORT_CUSTOM_MAILHOG`` to *.env* and customize its value.
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: .env
|
||||
|
||||
HOST_PORT_CUSTOM_MAILHOG=8025
|
||||
|
||||
.. seealso:: :ref:`env_file`
|
||||
|
||||
|
||||
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
|
@ -4,6 +4,9 @@
|
||||
Email catch-all
|
||||
***************
|
||||
|
||||
Devilbox Intranet
|
||||
=================
|
||||
|
||||
All your projects can send emails to whatever recipient. You do not have to worry that they will
|
||||
actually being sent. Each PHP container runs a local postfix mailserver that intercepts
|
||||
all outgoing mails and puts them into a local mailbox by the user ``devilbox``.
|
||||
@ -15,3 +18,12 @@ There you can also test email sending and verify that they really stay locally.
|
||||
|
||||
In the above image from the intranet you can see that all emails sent to whatever recipient
|
||||
have been caught by the Devilbox and are available to be read.
|
||||
|
||||
|
||||
MailHog
|
||||
=======
|
||||
|
||||
Instead of using the very basic Devilbox intranet UI for emails, you can also enable MailHog
|
||||
and use this to view sent email.s
|
||||
|
||||
.. seealso:: :ref:`custom_container_enable_mailhog`
|
||||
|
@ -8,9 +8,14 @@ Available container
|
||||
:ref:`start_the_devilbox`
|
||||
Find out how to start some or all container.
|
||||
|
||||
The following table gives you an overview about all container that can be started.
|
||||
The following tables give you an overview about all container that can be started.
|
||||
When doing a selective start, use the ``Name`` value to specify the container to start up.
|
||||
|
||||
Core container
|
||||
==============
|
||||
|
||||
These container are well integrated into the Devilbox intranet and are considered core container:
|
||||
|
||||
+---------------------------+-------+----------+----------------+
|
||||
| Container | Name | Hostname | IP Address |
|
||||
+===========================+=======+==========+================+
|
||||
@ -30,3 +35,26 @@ When doing a selective start, use the ``Name`` value to specify the container to
|
||||
+---------------------------+-------+----------+----------------+
|
||||
| MongoDB | mongo | mongo | 172.16.238.16 |
|
||||
+---------------------------+-------+----------+----------------+
|
||||
|
||||
|
||||
Additional container
|
||||
====================
|
||||
|
||||
Additional container that are not yet integrated into the Devilbox intranet and are less
|
||||
frequently used are also available.
|
||||
Those container come via ``docker-compose.override.yml`` and must explicitly be enabled.
|
||||
They are disabled by default to prevent accidentally starting too many container and making your
|
||||
computer unresponsive.
|
||||
|
||||
+---------------------------+----------+----------+----------------+
|
||||
| Container | Name | Hostname | IP Address |
|
||||
+===========================+==========+==========+================+
|
||||
| MailHog | mailhog | mailhog | 172.16.238.200 |
|
||||
+---------------------------+----------+----------+----------------+
|
||||
| RabbitMQ | rabbit | rabbit | 172.16.238.210 |
|
||||
+---------------------------+----------+----------+----------------+
|
||||
|
||||
.. seealso::
|
||||
* :ref:`custom_container_enable_all_container`
|
||||
* :ref:`custom_container_enable_mailhog`
|
||||
* :ref:`custom_container_enable_rabbitmq`
|
||||
|
Loading…
x
Reference in New Issue
Block a user