diff --git a/.devilbox/www/config.php b/.devilbox/www/config.php index dd973652..cba741d4 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-02-23'; +$DEVILBOX_DATE = '2019-02-27'; $DEVILBOX_API_PAGE = 'devilbox-api/status.json'; // diff --git a/.devilbox/www/htdocs/vhosts.php b/.devilbox/www/htdocs/vhosts.php index 629ba180..89881992 100644 --- a/.devilbox/www/htdocs/vhosts.php +++ b/.devilbox/www/htdocs/vhosts.php @@ -110,6 +110,14 @@ */ function checkDns(vhost) { var xhttp = new XMLHttpRequest(); + var proto; + var port; + var name = vhost + '.getTldSuffix();?>' + + var url = window.location.href.split("/"); + var tmp = url[2].split(":"); + proto = url[0]; + port = tmp.length == 2 ? ':' + tmp[1] : ''; // Timeout after XXX seconds and mark it invalid DNS xhttp.timeout = getEnv('DNS_CHECK_TIMEOUT');?>000; @@ -125,12 +133,12 @@ if (el_valid.innerHTML != 'WARN') { el_valid.innerHTML = 'OK'; } - el_href.innerHTML = ''+vhost+'.getTldSuffix().loadClass('Httpd')->getPort();?>' + el_href.innerHTML; + el_href.innerHTML = ''+name+port+'' + el_href.innerHTML; } else { //console.log(vhost); } } - xhttp.open('POST', '//'+vhost+'.getTldSuffix().loadClass('Httpd')->getPort();?>/devilbox-api/status.json', true); + xhttp.open('POST', proto+'//'+name+port+'/devilbox-api/status.json', true); xhttp.send(); // Timeout to abort in 1 second diff --git a/CHANGELOG.md b/CHANGELOG.md index 617ecc2d..30bea691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ major versions. - RabbitMQ - Solr - Varnish + - HAProxy - New binaries - `blackfire` - `dep` (Deployer) diff --git a/README.md b/README.md index e597aa87..dce78e2f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ![Devilbox](docs/img/banner.png) **[Usage](#usage)** | -**[Available Container](#available-container)** | +**[Architecture](#architecture)** | **[Community](#community)** | **[Features](#feature-overview)** | **[Intranet](#intranet-overview)** | @@ -56,16 +56,39 @@ Before updating the Devilbox ensure to always check for breaking changes until t 2. [Changelog](CHANGELOG.md) 3. [Updating](UPDATING.md) -## Available Container +## Architecture -The Devilbox ships the following pre-configured Docker container in any available version. +The Devilbox aims to be a swiss army knife for local development by providing you all the services +you would ever need. To get an idea about the architecture behind it and to also see what's available +have a look at the following diagrams and tables. -| Accel | Frontend | SQL | NoSQL | Queue & Search | ELK | Misc | -|---------|------------|------------|-----------|----------------|---------------|-----------| -| Varnish | Apache | MariaDB | Memcached | RabbitMQ | ElasticSearch | Bind | -| | Nginx | MySQL | MongoDB | Solr | Logstash | Blackfire | -| | PHP | PerconaDB | Redis | | Kibana | MailHog | -| | | PostgreSQL | | | | | +#### Smallest Stack +This is the smallest possible and fully functional stack you can run: + + + +> [Devilbox artwork](https://github.com/devilbox/artwork) + +#### Full Stack +To better understand what is actually possible have a look at the full example: + + + +> [Devilbox artwork](https://github.com/devilbox/artwork) + +#### Available Container + +The following table lists all integrated and pre-configured Docker container shipped by the Devilbox. +Only the webserver and PHP container are mandatory, all others are optional and don't need to be started. + +Each of them is also available in multiple different versions in order to reflect your exact desired environment. + +| Accel | Frontend | SQL | NoSQL | Queue | Search | ELK | Utils | +|---------|------------|------------|-----------|----------|--------|---------------|-----------| +| HAProxy | Apache | MariaDB | Memcached | RabbitMQ | Solr | ElasticSearch | Bind | +| Varnish | Nginx | MySQL | MongoDB | | | Logstash | Blackfire | +| | PHP | PerconaDB | Redis | | | Kibana | MailHog | +| | | PostgreSQL | | | | | | > **Documentation:** > [Available Container](https://devilbox.readthedocs.io/en/latest/readings/available-container.html) @@ -342,6 +365,7 @@ Additionally to the default stack, there are a variety of other services that ca MailHog RabbitMQ Solr + HAProxy Varnish @@ -352,6 +376,7 @@ Additionally to the default stack, there are a variety of other services that ca v1.0.0 3.6 5 + 1.X 4 @@ -360,6 +385,7 @@ Additionally to the default stack, there are a variety of other services that ca latest 3.7 6 + 5 @@ -368,6 +394,7 @@ Additionally to the default stack, there are a variety of other services that ca latest 7 + 6 @@ -376,6 +403,7 @@ Additionally to the default stack, there are a variety of other services that ca latest + latest diff --git a/compose/docker-compose.override.yml-all b/compose/docker-compose.override.yml-all index 6f879cf3..683a5185 100644 --- a/compose/docker-compose.override.yml-all +++ b/compose/docker-compose.override.yml-all @@ -90,7 +90,7 @@ services: # Varnish # ----------------------------------------------------------------------------------------------- varnish: - image: devilbox/varnish:${VARNISH_SERVER:-6} + image: devilbox/varnish:${VARNISH_SERVER:-6}-0.3 hostname: varnish ports: - "${LOCAL_LISTEN_ADDR}${HOST_PORT_VARNISH:-6081}:6081" @@ -110,6 +110,31 @@ services: - php - httpd + haproxy: + image: devilbox/haproxy:0.2 + hostname: haproxy + ports: + - "${LOCAL_LISTEN_ADDR}${HOST_PORT_HAPROXY:-8080}:80" + - "${LOCAL_LISTEN_ADDR}${HOST_PORT_HAPROXY_SSL:-8443}:443" + networks: + app_net: + ipv4_address: 172.16.238.231 + environment: + - BACKEND_ADDR=varnish + - BACKEND_PORT=6081 + - DEVILBOX_UI_SSL_CN + - TLD_SUFFIX + volumes: + # Certificate Authority public key + - ${DEVILBOX_PATH}/ca:/ca:rw${MOUNT_OPTIONS} + # Mount custom mass virtual hosting + - ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:rw${MOUNT_OPTIONS} + depends_on: + - bind + - php + - httpd + - varnish + # ----------------------------------------------------------------------------------------------- # ELK Stack # ----------------------------------------------------------------------------------------------- diff --git a/compose/docker-compose.override.yml-varnish b/compose/docker-compose.override.yml-varnish index 390c0f89..f2e673dd 100644 --- a/compose/docker-compose.override.yml-varnish +++ b/compose/docker-compose.override.yml-varnish @@ -7,7 +7,7 @@ services: # Varnish # ----------------------------------------------------------------------------------------------- varnish: - image: devilbox/varnish:${VARNISH_SERVER:-6} + image: devilbox/varnish:${VARNISH_SERVER:-6}-0.3 hostname: varnish ports: - "${LOCAL_LISTEN_ADDR}${HOST_PORT_VARNISH:-6081}:6081" @@ -26,3 +26,28 @@ services: - bind - php - httpd + + haproxy: + image: devilbox/haproxy:0.2 + hostname: haproxy + ports: + - "${LOCAL_LISTEN_ADDR}${HOST_PORT_HAPROXY:-8080}:80" + - "${LOCAL_LISTEN_ADDR}${HOST_PORT_HAPROXY_SSL:-8443}:443" + networks: + app_net: + ipv4_address: 172.16.238.231 + environment: + - BACKEND_ADDR=varnish + - BACKEND_PORT=6081 + - DEVILBOX_UI_SSL_CN + - TLD_SUFFIX + volumes: + # Certificate Authority public key + - ${DEVILBOX_PATH}/ca:/ca:rw${MOUNT_OPTIONS} + # Mount custom mass virtual hosting + - ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:rw${MOUNT_OPTIONS} + depends_on: + - bind + - php + - httpd + - varnish diff --git a/docs/_includes/snippets/additional-container.rst b/docs/_includes/snippets/additional-container.rst index b01738dd..06142b72 100644 --- a/docs/_includes/snippets/additional-container.rst +++ b/docs/_includes/snippets/additional-container.rst @@ -1,19 +1,21 @@ -+---------------------------+-----------+-----------+----------------+ -| Container | Name | Hostname | IP Address | -+===========================+===========+===========+================+ -| Blackfire | blackfire | blackfire | 172.16.238.200 | -+---------------------------+-----------+-----------+----------------+ -| MailHog | mailhog | mailhog | 172.16.238.201 | -+---------------------------+-----------+-----------+----------------+ -| RabbitMQ | rabbit | rabbit | 172.16.238.210 | -+---------------------------+-----------+-----------+----------------+ -| Solr | solr | solr | 172.16.238.220 | -+---------------------------+-----------+-----------+----------------+ -| Varnish | varnish | varnish | 172.16.238.230 | -+---------------------------+-----------+-----------+----------------+ -| ELK: Elastic Search | elastic | elastic | 172.16.238.240 | -+---------------------------+-----------+-----------+----------------+ -| ELK: Logstash | logstash | logstash | 172.16.238.241 | -+---------------------------+-----------+-----------+----------------+ -| ELK: Kibana | kibana | kibana | 172.16.238.242 | -+---------------------------+-----------+-----------+----------------+ ++-------------------------------------+-----------+-----------+----------------+ +| Container | Name | Hostname | IP Address | ++=====================================+===========+===========+================+ +| Blackfire | blackfire | blackfire | 172.16.238.200 | ++-------------------------------------+-----------+-----------+----------------+ +| MailHog | mailhog | mailhog | 172.16.238.201 | ++-------------------------------------+-----------+-----------+----------------+ +| RabbitMQ | rabbit | rabbit | 172.16.238.210 | ++-------------------------------------+-----------+-----------+----------------+ +| Solr | solr | solr | 172.16.238.220 | ++-------------------------------------+-----------+-----------+----------------+ +| Varnish | varnish | varnish | 172.16.238.230 | ++-------------------------------------+-----------+-----------+----------------+ +| HAProxy (SSL offloader for Varnish) | haproxy | haproxy | 172.16.238.231 | ++-------------------------------------+-----------+-----------+----------------+ +| ELK: Elastic Search | elastic | elastic | 172.16.238.240 | ++-------------------------------------+-----------+-----------+----------------+ +| ELK: Logstash | logstash | logstash | 172.16.238.241 | ++-------------------------------------+-----------+-----------+----------------+ +| ELK: Kibana | kibana | kibana | 172.16.238.242 | ++-------------------------------------+-----------+-----------+----------------+ diff --git a/docs/custom-container/enable-varnish.rst b/docs/custom-container/enable-varnish.rst index b352cadc..4c89c645 100644 --- a/docs/custom-container/enable-varnish.rst +++ b/docs/custom-container/enable-varnish.rst @@ -8,6 +8,10 @@ Enable and configure Varnish This section will guide you through getting Varnish integrated into the Devilbox. +As Varnish itself does not handle HTTPS, its Docker Compose override definition also defines an +optional HAProxy that can be started and run in front of Varnish to provide HTTPS support and take +care of the SSL offloading before requests hit Varnish. + .. seealso:: * |ext_lnk_varnish_github| * |ext_lnk_varnish_dockerhub| @@ -29,8 +33,8 @@ Available overwrites .. include:: /_includes/snippets/docker-compose-override-tree-view.rst -Varnish settings ----------------- +Stack 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. @@ -40,6 +44,13 @@ must be copied into the root of the Devilbox git directory. +=======================+======================================================================================================+ | Example compose file | ``compose/docker-compose.override.yml-all`` or |br| ``compose/docker-compose.override.yml-varnish`` | +-----------------------+------------------------------------------------------------------------------------------------------+ + +Varnish +^^^^^^^ + ++-----------------------+------------------------------------------------------------------------------------------------------+ +| What | How and where | ++=======================+======================================================================================================+ | Container IP address | ``172.16.238.230`` | +-----------------------+------------------------------------------------------------------------------------------------------+ | Container host name | ``varnish`` | @@ -55,11 +66,35 @@ must be copied into the root of the Devilbox git directory. | Further configuration | none | +-----------------------+------------------------------------------------------------------------------------------------------+ -Varnish env variables ---------------------- +HAProxy +^^^^^^^ + ++-----------------------+------------------------------------------------------------------------------------------------------+ +| What | How and where | ++=======================+======================================================================================================+ +| Container IP address | ``172.16.238.231`` | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Container host name | ``haproxy`` | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Container name | ``haproxy`` | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Mount points | none | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Exposed port | ``8080`` for HTTP and ``8443`` for HTTPS (can be changed via ``.env``) | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Available at | ``http://localhost:8080``, ``http://localhost:8443`` (or via ``http:.:8080|8443``) | ++-----------------------+------------------------------------------------------------------------------------------------------+ +| Further configuration | none | ++-----------------------+------------------------------------------------------------------------------------------------------+ + +Stack env variables +------------------- Additionally the following ``.env`` variables can be created for easy configuration: +Varnish +^^^^^^^ + +------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ | Variable | Default value | Description | +==============================+===============================================+====================================================================+ @@ -74,6 +109,16 @@ Additionally the following ``.env`` variables can be created for easy configurat | ``VARNISH_PARAMS`` | ``-p default_ttl=3600 -p default_grace=3600`` | Additional Varnish startup parameter. | +------------------------------+-----------------------------------------------+--------------------------------------------------------------------+ +HAProxy +^^^^^^^ + ++------------------------------+-----------------------------------------------+-------------------------------------------------------------------------------+ +| Variable | Default value | Description | ++==============================+===============================================+===============================================================================+ +| ``HOST_PORT_HAPROXY`` | ``8080`` | Controls the host port on which HTTP requests will be available for HAProxy. | ++------------------------------+-----------------------------------------------+-------------------------------------------------------------------------------+ +| ``HOST_PORT_HAPROXY_SSL`` | ``8443`` | Controls the host port on which HTTPS requests will be available for HAProxy. | ++------------------------------+-----------------------------------------------+-------------------------------------------------------------------------------+ Instructions ============ @@ -97,8 +142,8 @@ Copy the Varnish Docker Compose overwrite file into the root of the Devilbox git 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. +Varnish and HAProxy are 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: @@ -116,6 +161,11 @@ Add the following variables to ``.env`` and adjust them to your needs: VARNISH_PARAMS=-p default_ttl=3600 -p default_grace=3600 HOST_PORT_VARNISH=6081 + # HAProxy settings + HOST_PORT_HAPROXY=8080 + HOST_PORT_HAPROXY_SSL=8443 + + .. seealso:: :ref:`env_file` @@ -154,13 +204,25 @@ For this example we will assume you are using Varnish 6 The final step is to start the Devilbox with Varnish. +.. seealso:: :ref:`start_the_devilbox` + +4.1 Varnish only +^^^^^^^^^^^^^^^^ + 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` +4.2 HTTPS offloading with HAProxy in front of Varnish +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you also want full HTTPS support, simply start HAproxy as well with Varnish. + +.. code-block:: bash + + host> docker-compose up -d php httpd bind haproxy varnish TL;DR @@ -185,6 +247,9 @@ directory: echo "VARNICS_CACHE_SIZE=128m" >> .env echo "VARNISH_PARAMS=-p default_ttl=3600 -p default_grace=3600" >> .env echo "HOST_PORT_VARNISH=6081" >> .env + echo "# HAProxy settings" >> .env + echo "HOST_PORT_HAPROXY=8080" >> .env + echo "HOST_PORT_HAPROXY_SSL=8443" >> .env # Start container docker-compose up -d php httpd bind varnish diff --git a/docs/support/troubleshooting.rst b/docs/support/troubleshooting.rst index 55d45d5e..78ddb6c0 100644 --- a/docs/support/troubleshooting.rst +++ b/docs/support/troubleshooting.rst @@ -69,7 +69,7 @@ experience similar issues as well, check for any unattended Windows updates or updates to Docker itself. If those exist, try to revert them and see if that was the cause. I heard many bug stories from fellow Windows users so far. -A good contact point for that is the Docker forum itself: https://forums.docker.com/c/docker-for-windows +A good contact point for that is the Docker forum itself: https://forums.docker.com/c/docker-desktop-for-windows A few general things you should always do before attempting to open up issues are: