mirror of
https://github.com/cytopia/devilbox.git
synced 2025-04-08 03:24:15 +00:00
Fix #57: Add RabbitMQ
This commit is contained in:
parent
994df7d6da
commit
0c7a9234bf
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,6 +20,7 @@
|
||||
/data/mysql/*
|
||||
/data/pqsql/*
|
||||
/data/www/*
|
||||
/data/rabbit/*
|
||||
/backups/*
|
||||
|
||||
# Ignore Certificate Authority
|
||||
|
36
compose/docker-compose.override.yml-all
Normal file
36
compose/docker-compose.override.yml-all
Normal file
@ -0,0 +1,36 @@
|
||||
version: '2.1'
|
||||
|
||||
services:
|
||||
|
||||
mailhog:
|
||||
image: mailhog/mailhog:${MAILHOG_SERVER:-latest}
|
||||
hostname: mailhog
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_MAILHOG:-8025}:8025"
|
||||
networks:
|
||||
app_net:
|
||||
ipv4_address: 172.16.238.200
|
||||
depends_on:
|
||||
- bind
|
||||
- php
|
||||
- httpd
|
||||
|
||||
rabbit:
|
||||
image: rabbitmq:${RABBIT_SERVER:-management}
|
||||
hostname: rabbit
|
||||
environment:
|
||||
- RABBITMQ_DEFAULT_VHOST=${RABBIT_DEFAULT_VHOST:-my_vhost}
|
||||
- RABBITMQ_DEFAULT_USER=${RABBIT_DEFAULT_USER:-guest}
|
||||
- RABBITMQ_DEFAULT_PASS=${RABBIT_DEFAULT_PASS:-guest}
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_RABBIT:-5672}:5672"
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_RABBIT_MGMT:-15672}:15672"
|
||||
networks:
|
||||
app_net:
|
||||
ipv4_address: 172.16.238.210
|
||||
volumes:
|
||||
- ${HOST_PATH_RABBIT_DATADIR:-./data/rabbit}/${RABBIT_SERVER:-management}:/var/lib/rabbitmq
|
||||
depends_on:
|
||||
- bind
|
||||
- php
|
||||
- httpd
|
22
compose/docker-compose.override.yml-rabbitmq
Normal file
22
compose/docker-compose.override.yml-rabbitmq
Normal file
@ -0,0 +1,22 @@
|
||||
version: '2.1'
|
||||
|
||||
services:
|
||||
rabbit:
|
||||
image: rabbitmq:${RABBIT_SERVER:-management}
|
||||
hostname: rabbit
|
||||
environment:
|
||||
- RABBITMQ_DEFAULT_VHOST=${RABBIT_DEFAULT_VHOST:-my_vhost}
|
||||
- RABBITMQ_DEFAULT_USER=${RABBIT_DEFAULT_USER:-guest}
|
||||
- RABBITMQ_DEFAULT_PASS=${RABBIT_DEFAULT_PASS:-guest}
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_RABBIT:-5672}:5672"
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_RABBIT_MGMT:-15672}:15672"
|
||||
networks:
|
||||
app_net:
|
||||
ipv4_address: 172.16.238.210
|
||||
volumes:
|
||||
- ${HOST_PATH_RABBIT_DATADIR:-./data/rabbit}/${RABBIT_SERVER:-management}:/var/lib/rabbitmq
|
||||
depends_on:
|
||||
- bind
|
||||
- php
|
||||
- httpd
|
174
docs/custom-container/enable-rabbitmq.rst
Normal file
174
docs/custom-container/enable-rabbitmq.rst
Normal file
@ -0,0 +1,174 @@
|
||||
.. include:: /_includes/all.rst
|
||||
|
||||
.. _custom_container_enable_rabbitmq:
|
||||
|
||||
*****************************
|
||||
Enable and configure RabbitMQ
|
||||
*****************************
|
||||
|
||||
This section will guide you through getting RabbitMQ integrated into the Devilbox.
|
||||
|
||||
.. seealso::
|
||||
* |ext_lnk_rabbitmq_github|
|
||||
* |ext_lnk_rabbitmq_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
|
||||
|
||||
|
||||
RabbitMQ settings
|
||||
-----------------
|
||||
|
||||
In case of RabbitMQ, the file is ``compose/docker-compose.override.yml-rabbitmq``. 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-rabbitmq`` |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Container IP address | ``172.16.238.210`` |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Container host name | ``rabbit`` |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Container name | ``rabbit`` |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Mount points | ``./data/rabbit`` (can be changed via ``.env``) |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Exposed port | ``5672`` and ``15672`` (can be changed via ``.env``) |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Available at | ``http://localhost:15672`` (Admin WebUI) |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
| Further configuration | none |
|
||||
+-----------------------+------------------------------------------------------------------------------------------------------+
|
||||
|
||||
RabbitMQ env variables
|
||||
----------------------
|
||||
|
||||
Additionally the following ``.env`` variables can be created for easy configuration:
|
||||
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| Variable | Default value | Description |
|
||||
+==============================+===================+============================================================================+
|
||||
| ``HOST_PORT_RABBIT`` | ``5672`` | Controls the host port on which RabbitMQ API will be available at. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``HOST_PORT_RABBIT_MGMT`` | ``15672`` | Controls the host port on which RabbitMQ Admin WebUI will be available at. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``RABBIT_SERVER`` | ``management`` | Controls the RabbitMQ version to use. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``HOST_PATH_RABBIT_DATADIR`` | ``./data/rabbit`` | Default mount point for persistent data. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``rabbit_default_vhost`` | ``my_vhost`` | Default RabbitMQ vhost name. (not a webserver vhost name) |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``RABBIT_DEFAULT_USER`` | ``guest`` | Default username for Admin WebUI. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``RABBIT_DEFAULT_PASS`` | ``guest`` | Default password for Admin WebUI. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
Instructions
|
||||
============
|
||||
|
||||
1. Copy docker-compose.override.yml
|
||||
-----------------------------------
|
||||
|
||||
Copy the RabbitMQ 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-rabbitmq docker-compose.override.yml
|
||||
|
||||
.. seealso::
|
||||
* :ref:`docker_compose_override_yml`
|
||||
* :ref:`add_your_own_docker_image`
|
||||
* :ref:`overwrite_existing_docker_image`
|
||||
|
||||
|
||||
2. Adjust ``.env`` settings (optional)
|
||||
--------------------------------------
|
||||
|
||||
RabbitMQ is using sane defaults, which can be changed by adding variables to the ``.env`` file
|
||||
and assigning custom values.
|
||||
|
||||
Add the following variables to ``.env`` and adjust them to your needs:
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: .env
|
||||
|
||||
# RabbitMQ version to choose
|
||||
#RABBIT_SERVER=3.6
|
||||
#RABBIT_SERVER=3.6-management
|
||||
#RABBIT_SERVER=3.7
|
||||
#RABBIT_SERVER=3.7-management
|
||||
#RABBIT_SERVER=latest
|
||||
RABBIT_SERVER=management
|
||||
|
||||
RABBIT_DEFAULT_VHOST=my_vhost
|
||||
RABBIT_DEFAULT_USER=guest
|
||||
RABBIT_DEFAULT_PASS=guest
|
||||
|
||||
HOST_PORT_RABBIT=5672
|
||||
HOST_PORT_RABBIT_MGMT=15672
|
||||
HOST_PATH_RABBIT_DATADIR=./data/rabbit
|
||||
|
||||
.. seealso:: :ref:`env_file`
|
||||
|
||||
|
||||
4. Start the Devilbox
|
||||
---------------------
|
||||
|
||||
The final step is to start the Devilbox with RabbitMQ.
|
||||
|
||||
Let's assume you want to start ``php``, ``httpd``, ``bind``, ``rabbit``.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> docker-compose up -d php httpd bind rabbitmq
|
||||
|
||||
.. seealso:: :ref:`start_the_devilbox`
|
||||
|
||||
|
||||
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-rabbitmq docker-compose.override.yml
|
||||
|
||||
# Create .env variable
|
||||
echo "# RabbitMQ version to choose" >> .env
|
||||
echo "#RABBIT_SERVER=3.6" >> .env
|
||||
echo "#RABBIT_SERVER=3.6-management" >> .env
|
||||
echo "#RABBIT_SERVER=3.7" >> .env
|
||||
echo "#RABBIT_SERVER=3.7-management" >> .env
|
||||
echo "#RABBIT_SERVER=latest" >> .env
|
||||
echo "RABBIT_SERVER=management" >> .env
|
||||
echo "RABBIT_DEFAULT_VHOST=my_vhost" >> .env
|
||||
echo "RABBIT_DEFAULT_USER=guest" >> .env
|
||||
echo "RABBIT_DEFAULT_PASS=guest" >> .env
|
||||
echo "HOST_PORT_RABBIT=5672" >> .env
|
||||
echo "HOST_PORT_RABBIT_MGMT=15672" >> .env
|
||||
echo "HOST_PATH_RABBIT_DATADIR=./data/rabbit" >> .env
|
||||
|
||||
# Start container
|
||||
docker-compose up -d php httpd bind rabbit
|
@ -90,10 +90,12 @@ host is ready to be served with your custom domain.
|
||||
vhost-gen/example-add-subdomains
|
||||
|
||||
.. toctree::
|
||||
:caption: Add custom container
|
||||
:caption: Enable custom container
|
||||
:maxdepth: 2
|
||||
|
||||
custom-container/integrate-mailhog
|
||||
custom-container/enable-all-container
|
||||
custom-container/enable-mailhog
|
||||
custom-container/enable-rabbitmq
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
Loading…
x
Reference in New Issue
Block a user