diff --git a/.devilbox/www/config.php b/.devilbox/www/config.php index f78db620..ee571c34 100644 --- a/.devilbox/www/config.php +++ b/.devilbox/www/config.php @@ -14,7 +14,7 @@ putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1'); $DEVILBOX_VERSION = 'v0.15'; -$DEVILBOX_DATE = '2019-01-30'; +$DEVILBOX_DATE = '2019-02-17'; $DEVILBOX_API_PAGE = 'devilbox-api/status.json'; // diff --git a/CHANGELOG.md b/CHANGELOG.md index ab69206c..88bc45fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ major versions. - MailHog - RabbitMQ - Solr + - Varnish - New binaries - `blackfire` - `dep` (Deployer) diff --git a/README.md b/README.md index d9538591..affe0d9f 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,12 @@ Before updating the Devilbox ensure to always check for breaking changes until t The Devilbox ships the following pre-configured Docker container in any available version. -| Web server | SQL | NoSQL | Queue & Search | Misc | -|------------|------------|-----------|----------------|-----------| -| Apache | MariaDB | Memcached | RabbitMQ | Bind | -| Nginx | MySQL | MongoDB | Solr | Blackfire | -| | PerconaDB | Redis | | MailHog | -| | PostgreSQL | | | PHP | +| Web server | SQL | NoSQL | Queue & Search | Cache | Misc | +|------------|------------|-----------|----------------|---------|-----------| +| Apache | MariaDB | Memcached | RabbitMQ | Varnish | Bind | +| Nginx | MySQL | MongoDB | Solr | | Blackfire | +| | PerconaDB | Redis | | | MailHog | +| | PostgreSQL | | | | PHP | > **Documentation:** > [Available Container](https://devilbox.readthedocs.io/en/latest/readings/available-container.html) @@ -341,6 +341,7 @@ Additionally to the default stack, there are a variety of other services that ca MailHog RabbitMQ Solr + Varnish @@ -349,24 +350,28 @@ Additionally to the default stack, there are a variety of other services that ca v1.0.0 3.6 5 + 4 ... latest 3.7 6 + 5 1.18.0 latest 7 + 6 latest latest + latest diff --git a/compose/docker-compose.override.yml-all b/compose/docker-compose.override.yml-all index 4f42d3ab..e0a7fdad 100644 --- a/compose/docker-compose.override.yml-all +++ b/compose/docker-compose.override.yml-all @@ -70,5 +70,24 @@ services: - php - httpd + varnish: + image: devilbox/varnish:${VARNISH_SERVER:-6} + hostname: varnish + ports: + - "${LOCAL_LISTEN_ADDR}${HOST_PORT_VARNISH:-6081}:6081" + networks: + app_net: + ipv4_address: 172.16.238.230 + environment: + - VARNISH_CONFIG=/etc/varnish/default.vcl + - CACHE_SIZE=${VARNISH_CACHE_SIZE:-128m} + - VARNISHD_PARAMS=${VARNISH_PARAMS:--p default_ttl=3600 -p default_grace=3600} + - BACKEND_HOST=httpd + - BACKEND_PORT=80 + depends_on: + - bind + - php + - httpd + volumes: data-solr: diff --git a/compose/docker-compose.override.yml-varnish b/compose/docker-compose.override.yml-varnish new file mode 100644 index 00000000..b60570b8 --- /dev/null +++ b/compose/docker-compose.override.yml-varnish @@ -0,0 +1,21 @@ +version: '2.1' + +services: + varnish: + image: devilbox/varnish:${VARNISH_SERVER:-6} + hostname: varnish + ports: + - "${LOCAL_LISTEN_ADDR}${HOST_PORT_VARNISH:-6081}:6081" + networks: + app_net: + ipv4_address: 172.16.238.230 + environment: + - VARNISH_CONFIG=/etc/varnish/default.vcl + - CACHE_SIZE=${VARNISH_CACHE_SIZE:-128m} + - VARNISHD_PARAMS=${VARNISH_PARAMS:--p default_ttl=3600 -p default_grace=3600} + - BACKEND_HOST=httpd + - BACKEND_PORT=80 + depends_on: + - bind + - php + - httpd diff --git a/docker-compose.yml b/docker-compose.yml index c8810b3b..ef1164aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -95,7 +95,7 @@ services: # PHP # ------------------------------------------------------------ php: - image: devilbox/php-fpm:${PHP_SERVER}-work-0.75 + image: devilbox/php-fpm:${PHP_SERVER}-work-0.76 hostname: php ## diff --git a/docs/_includes/links/documentation.rst b/docs/_includes/links/documentation.rst index 724873a0..4f062473 100644 --- a/docs/_includes/links/documentation.rst +++ b/docs/_includes/links/documentation.rst @@ -75,3 +75,15 @@ Dockerhub: Solr + +.. |ext_lnk_varnish_github| raw:: html + + + Github: Varnish + + +.. |ext_lnk_varnish_dockerhub| raw:: html + + + Dockerhub: Varnish + diff --git a/docs/_includes/snippets/additional-container.rst b/docs/_includes/snippets/additional-container.rst index b435f917..0976dd26 100644 --- a/docs/_includes/snippets/additional-container.rst +++ b/docs/_includes/snippets/additional-container.rst @@ -9,3 +9,5 @@ +---------------------------+-----------+-----------+----------------+ | Solr | solr | solr | 172.16.238.220 | +---------------------------+-----------+-----------+----------------+ +| Varnish | varnish | varnish | 172.16.238.230 | ++---------------------------+-----------+-----------+----------------+ diff --git a/docs/_includes/snippets/docker-compose-override-tree-view.rst b/docs/_includes/snippets/docker-compose-override-tree-view.rst index 09f63e8e..34bd4e89 100644 --- a/docs/_includes/snippets/docker-compose-override-tree-view.rst +++ b/docs/_includes/snippets/docker-compose-override-tree-view.rst @@ -13,6 +13,7 @@ However, each example also exists in its standalone file as shown below: ├── docker-compose.override.yml-mailhog ├── docker-compose.override.yml-rabbitmq ├── docker-compose.override.yml-solr + ├── docker-compose.override.yml-varnish └── README.md 0 directories, 6 files diff --git a/docs/custom-container/enable-all-container.rst b/docs/custom-container/enable-all-container.rst index 65ac6141..5354d64c 100644 --- a/docs/custom-container/enable-all-container.rst +++ b/docs/custom-container/enable-all-container.rst @@ -59,3 +59,4 @@ In order to fully customize each container, refer to their own documentation sec * :ref:`custom_container_enable_mailhog` * :ref:`custom_container_enable_rabbitmq` * :ref:`custom_container_enable_solr` + * :ref:`custom_container_enable_varnish` diff --git a/docs/custom-container/enable-varnish.rst b/docs/custom-container/enable-varnish.rst new file mode 100644 index 00000000..6e857096 --- /dev/null +++ b/docs/custom-container/enable-varnish.rst @@ -0,0 +1,158 @@ +.. include:: /_includes/all.rst + +.. _custom_container_enable_varnish: + +**************************** +Enable and configure Varnish +**************************** + +This section will guide you through getting Varnish integrated into the Devilbox. + +.. seealso:: + * |ext_lnk_varnish_github| + * |ext_lnk_varnish_dockerhub| + * :ref:`custom_container_enable_all_additional_container` + * :ref:`docker_compose_override_yml_how_does_it_work` + + +**Table of Contents** + +.. contents:: :local: + + +Overview +======== + +Available overwrites +-------------------- + +.. include:: /_includes/snippets/docker-compose-override-tree-view.rst + + +Varnish settings +---------------- + +In case of Varnish, the file is ``compose/docker-compose.override.yml-varnish``. 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-varnish`` | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Container IP address | ``172.16.238.230`` | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Container host name | ``varnish`` | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Container name | ``varnish`` | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Mount points | none | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Exposed port | ``6081`` (can be changed via ``.env``) | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Available at | ``http://localhost:6081`` (or via ``http:.:6081``) | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Further configuration | none | ++-----------------------+------------------------------------------------------------------------------------------------------+ + +Varnish env variables +--------------------- + +Additionally the following ``.env`` variables can be created for easy configuration: + ++------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ +| Variable | Default value | Description | ++==============================+===============================================+====================================================================+ +| ``HOST_PORT_VARNISH`` | ``6081`` | Controls the host port on which Varnish will be available at. | ++------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ +| ``VARNISH_SERVER`` | ``6`` | Controls the Varnish version to use. | ++------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ +| ``VARNISH_CONFIG`` | ``/etc/varnish/default.vcl`` | Path to Varnish configuration file (custom config can be mounted). | ++------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ +| ``VARNICS_CACHE_SIZE`` | ``128m`` | Varnish Cache size. | ++------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ +| ``VARNISH_PARAMS`` | ``-p default_ttl=3600 -p default_grace=3600`` | Additional Varnish startup parameter. | ++------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ + + +Instructions +============ + +1. Copy docker-compose.override.yml +----------------------------------- + +Copy the Varnish 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-varnish 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) +-------------------------------------- + +Varnish 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 + + # Varnish version to choose + #VARNISH_SERVER=4 + #VARNISH_SERVER=5 + VARNISH_SERVER=6 + + # Varnish settings + VARNICS_CACHE_SIZE=128m + VARNISH_PARAMS=-p default_ttl=3600 -p default_grace=3600 + HOST_PORT_VARNISH=6081 + +.. seealso:: :ref:`env_file` + + +4. Start the Devilbox +--------------------- + +The final step is to start the Devilbox with Varnish. + +Let's assume you want to start ``php``, ``httpd``, ``bind``, ``varnish``. + +.. code-block:: bash + + host> docker-compose up -d php httpd bind varnish + +.. 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-varnish docker-compose.override.yml + + # Create .env variable + echo "# Varnish version to choose" >> .env + echo "#VARNISH_SERVER=4" >> .env + echo "#VARNISH_SERVER=5" >> .env + echo "VARNISH_SERVER=6" >> .env + echo "# Varnish settings" >> .env + echo "VARNICS_CACHE_SIZE=128m" >> .env + echo "VARNISH_PARAMS=-p default_ttl=3600 -p default_grace=3600" >> .env + echo "HOST_PORT_VARNISH=6081" >> .env + + # Start container + docker-compose up -d php httpd bind varnish diff --git a/docs/index.rst b/docs/index.rst index 7a9abd19..dcecffc5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -117,6 +117,7 @@ host is ready to be served with your custom domain. custom-container/enable-mailhog custom-container/enable-rabbitmq custom-container/enable-solr + custom-container/enable-varnish .. toctree::