![private cache magento 2 private cache magento 2](https://amasty.com/docs/lib/exe/fetch.php?media=magento_2:full-page-cache-warmer:fpc-warmer-m2-cache-flushes-log.png)
Our directory architecture will be something like: To begin with create a directory on your Ubuntu 16.04 server for this project. Apart from controlling these servers, supervisor is also running various commands and scripts that will be mentioned later in this blog. We are also using supervisor to control all three of our servers in their respective containers. These magento files will be mapped from host to running docker container. As it is a good practice to keep application files on host so that it will not be lost if containers or images get accidentally removed. Take a note that: following the same approach, Magento 2 files will be placed on our host. Here we are creating separate directories for apache2, mysql server and varnish cache server setup that hold their Dockerfile(s) and their associated volumes.
![private cache magento 2 private cache magento 2](https://www.bingdigital.com/wp-content/uploads/2016/08/cache-management-config.jpg)
Custom project name can also be in set docker-compose.yml file. The parent directory holding all the files/directories will be considered as the project name. As separate containers will require inter-linking with each other, we will be using docker-compose tool to achieve this architecture.
![private cache magento 2 private cache magento 2](https://mirasvit.com/media/blog/page-cache/page-cache-headers.png)
Magento 2 And Varnish Cache Setup With Docker-ComposeĪs we are still on our multi-container docker architecture, we will be using separate containers for apache2 server, mysql-server and varnish cache server for its integration with Magento 2 on Ubuntu 16.04. The built-in full-page caching (to either the file system or database) is much slower than Varnish, and Varnish is designed to accelerate HTTP traffic.” “We strongly recommend you use Varnish in production. Luckily for us, Magento 2 works out of box with Varnish Cache and provides its own VCL file for its setup. If you consider Varnish Cache as a radio, then you have it tune it according your server needs. Default VCL file does not work directly with all the applications. VCL files are needed to be customised for specific frameworks or applications. The key element in Varnish cache setup is its Varnish Configuration Language (VCL) file. Unlike other web-accelerators, Varnish cache deals only with HTTP traffic. It is a powerful open source HTTP engine/reverse HTTP proxy that can speed up a website by up to 1000 percent by doing exactly what its name implies: caching (or storing) a copy of a webpage the first time a user visits. Varnish cache visits your server once to cache the page, then all future requests for the same page will be served by Varnish cache. Quoting from Varnish docs, Varnish cache is a web application accelerator also known as a caching HTTP reverse proxy. Those who are not familiar with Varnish cache, following lines are for you,
![private cache magento 2 private cache magento 2](https://www.cruisedeckplans.com/DP/cabinpics/171/org/LibPan185-20532-1520613368.jpg)
If not all of you, then those who are struggling with high traffic on their Magento 2 store, they must have considered using some cache server at some point. If you are familiar with Magento 2 and own your store then you might have heard of Varnish cache once in a while. Moving further, in this blog we will discuss integration of Varnish cache with Magento 2 on the architecture of Docker and of course we will be using docker-compose to setup this architecture as we did earlier. We were focused on infrastructure performance rather than application optmisation. In our previous blogs, we have installed Magento 2 with default configurations. We had also discussed the volume mapping, ports allocation, containers linking etc techniques for docker-compose.yml file.Īs we are now familiar with docker and docker-compose, their working and their integration with applications (Magento 2 in our case), we will now take a further step ahead. Using this tool we had setup Magento 2 running with apache2 server and mysql-server on separate containers interlinked with each other. In our last blog, after being introduced to docker-compose, we had discussed the deployment of multi-container architecture in Docker.