{"id":18937775,"url":"https://github.com/webkul/magento2-varnish-docker-compose","last_synced_at":"2025-04-15T18:32:32.639Z","repository":{"id":139265309,"uuid":"102750076","full_name":"webkul/magento2-varnish-docker-compose","owner":"webkul","description":"Magento 2 integration with Varnish Cache using Docker-compose tool","archived":false,"fork":false,"pushed_at":"2018-07-17T09:26:02.000Z","size":41272,"stargazers_count":8,"open_issues_count":0,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T01:05:30.550Z","etag":null,"topics":["containerization","devops","docker-compose","docker-compose-magento2-varnish","magento2","optimisation","varnish-cache"],"latest_commit_sha":null,"homepage":"https://cloudkul.com/blog/magento-2-and-varnish-cache-integration-with-docker-compose/","language":"VCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webkul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-07T14:54:16.000Z","updated_at":"2021-10-01T05:55:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"ff9fee1d-80bb-413c-a7f6-268adeb46f2d","html_url":"https://github.com/webkul/magento2-varnish-docker-compose","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkul%2Fmagento2-varnish-docker-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkul%2Fmagento2-varnish-docker-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkul%2Fmagento2-varnish-docker-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkul%2Fmagento2-varnish-docker-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webkul","download_url":"https://codeload.github.com/webkul/magento2-varnish-docker-compose/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249129343,"owners_count":21217337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containerization","devops","docker-compose","docker-compose-magento2-varnish","magento2","optimisation","varnish-cache"],"created_at":"2024-11-08T12:12:25.203Z","updated_at":"2025-04-15T18:32:32.631Z","avatar_url":"https://github.com/webkul.png","language":"VCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Setting Up Magento 2 and Varnish Cache on Multi-container Architecture Using Docker-Compose tool\n\nThis repository corresponds to architecture setup as mentioned in blog https://cloudkul.com/blog/magento-2-and-varnish-cache-integration-with-docker-compose/.\n\n\n##### Docker-Compose Tool\n\nAs mentioned in Docker docs, Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration. \n\nWith the help of docker-compose we can define containers to be built, their configuration, links, volumes, ports etc in a single file and it gets launched by a single command. We can add multiple servers and services just by adding them to docker-compose configuration file. This configuration file is in YAML format.\n\nGetting started with docker-compose is a few steps process:\n\n\u003e Create a Dockerfile defining the application environment. We can create separate Dockerfile for our different services. As Dockerfile are lightweight, so our application can be replicated anywhere.\n\n\u003e Create a docker-compose.yml file defining services that needed for application run. We can define volumes to be mapped, ports to be exposed, links to be created, arguments to be passed etc in our docker-compose.yml file.\n\n\u003e Run ‘docker-compose build’ to create Docker image. After creating Dockerfile, docker-compose.yml and placing our volumes at right places, we can create our image.\n\n\u003e Run ‘docker-compose up -d’ to run the docker containers. After image build up, we can run all of our containers as mentioned in configuration files by this single command.\n\n##### Dockerizing Magento 2 and Varnish Cache with Docker-Compose\n\nDocker is an open-source project that can be integrated with almost all the applications allowing scope of isolation and flexibility. It can be integrated with Magento 2 as well. Magento is an e-commerce platform written in PHP and based on zend framework available under both open-source and commercial licenses.\n\nVarnish cache is a web application accelerator also known as a caching HTTP reverse proxy. Varnish cache visits your server once to cache the page, then all future requests for the same page will be served by Varnish cache. Varnish acts a reverse proxy server that directs client requests to the back-end apache2 server. Whenever a client makes a request, Varnish server checks the content within the cache and in case data not found, it sends the request to backend server and fetch the content to client and keep a copy of the data as cache. When the same request is made, Varnish does not bother apache2 server, it just fetch the data from the cache. It provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.\n\nMagento 2 works out of box with Varnish Cache and provides its own VCL file for its setup. Also from Magento 2 docs, “We strongly recommend you use Varnish in production. 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.”\n\nIn this project, we are using:\n\n\u003e Operating system: Ubuntu 16.04\n\n\u003e Web Server: Apache2\n\n\u003e Database Server: Mysql-server-5.7\n\n\u003e Cache Server: Varnish 4.1\n\n\u003e PHP version: PHP-7.1\n\nTo begin with, please install docker and docker-compose on your ubuntu server. \n\nThen follow the following steps:\n\n1). Clone or download this repository as \n\n\u003e git clone https://github.com/webkul/magento2-varnish-docker-compose.git\n\n2) Set mysql root credentials and name of the database to be created in ~/magento2-varnish-docker-compose/docker-compose.yml.\n\n\u003e mysql_password=\n\n\u003e mysql_database=\n\n3). Download Magento 2 version you wish to dockerize and upload it in directory magento2 in parallel docker-compose.yml.\n\n\u003e Go to https://magento.com/tech-resources/download? .\n\n4). Build the docker image.\n\n\u003e docker-compose build\n\n5). Check the built image as:\n\n\u003e docker images\n\n6). Run the containers from built image as:\n\n\u003e docker-compose up -d\n\n7). Check the running docker containers by command:\n\n\u003e docker-compose ps\n\n\u003e docker ps\n\nNow, your server setup is all ready, now hit your domain name or IP to install Magento 2.\n\nNow to configure Varnish for Magento 2 and test its working, please refer to blog https://cloudkul.com/blog/magento-2-and-varnish-cache-integration-with-docker-compose/.\n\nAfter configuring Magento 2 for Varnish, go to varnish docker container as\n\n\u003e docker exec -ti varnish bash\n\nAnd run the command,\n\n\u003e varnishhist\n\n#### GETTING SUPPORT\n\nIf you have any issues, contact us at support@webkul.com or raise ticket at https://webkul.uvdesk.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebkul%2Fmagento2-varnish-docker-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebkul%2Fmagento2-varnish-docker-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebkul%2Fmagento2-varnish-docker-compose/lists"}