Skip to content

Commit 941b279

Browse files
authored
Merge pull request #192 from ByteInternet/add-varnish-cluster-documentation
Add additional varnish documentation for cluster setups
2 parents efa98df + ba026f2 commit 941b279

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

docs/ecommerce-applications/magento-2/how-to-configure-varnish-for-magento-2-x.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ To do this, run the following command:
7373

7474
```console
7575
$ cd /data/web/magento2
76-
$ bin/magento setup:config:set --http-cache-hosts=127.0.0.1:6081
76+
$ bin/magento setup:config:set --http-cache-hosts=varnish:6081
7777
```
7878

7979
Now when you flush your caches in cache management, your varnish full_page cache will be flushed too.
@@ -112,6 +112,20 @@ backend default {
112112

113113
Make sure you change this to the aforementioned configuration (without the health_check probe), since this will break on our Nginx configuration and will therefore result in a `503 Guru Meditation` error.
114114

115+
**Note:** If you are using a cluster setup, you need to add some additional configuration to your vcl.
116+
The `acl purge` block inside your vcl should contain the private ip range of your cluster.
117+
You can find your private ip range using the `hypernode-cluster-info` command on one of your cluster nodes.
118+
119+
As example, our private ip range is `192.168.1.0/24`.
120+
You can add this to the `acl purge` block. It should like something similar as the example below:
121+
122+
```
123+
acl purge {
124+
"localhost";
125+
"192.168.1.0/24";
126+
}
127+
```
128+
115129
## Import Your VCL into the Varnish Daemon
116130

117131
Import your VCL into Varnish and save as `mag2`:

docs/ecommerce-applications/shopware-5/how-to-configure-varnish-for-shopware-5.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ Please follow Shopware's [documentation about configuring Shopware 5 to work wit
4040

4141
Copy the VCL configuration from [Shopware's documentation](https://developers.shopware.com/sysadmins-guide/varnish-setup/) and save it on your Hypernode, for example at `/data/web/shopware5.vcl`.
4242

43+
**Note:** If you are using a cluster setup, you need to add some additional configuration to your vcl.
44+
The `acl purgers` block inside your vcl should contain the private ip range of your cluster.
45+
You can find your private ip range using the `hypernode-cluster-info` command on one of your cluster nodes.
46+
47+
As example, our private ip range is `192.168.1.0/24`.
48+
You can add this to the `acl purgers` block. It should like something similar as the example below:
49+
50+
```vcl
51+
acl purgers {
52+
"127.0.0.1";
53+
"localhost";
54+
"::1";
55+
"192.168.1.0/24";
56+
}
57+
```
58+
4359
Now we can load in the configuration with the following command:
4460

4561
`varnishadm vcl.load shopware5_debug /data/web/shopware5.vcl`

docs/ecommerce-applications/shopware-6/how-to-configure-varnish-for-shopware-6.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ Go to [Shopware's Reverse Http Cache documentation](https://developer.shopware.c
9292

9393
To actually use Varnish you need to implement a varnish config file, a .vcl. If you're on Shopware >= 6.4, fetch the [Varnish configuration from their documentation](https://developer.shopware.com/docs/guides/hosting/infrastructure/reverse-http-cache#configure-varnish) (copy the code block starting with *vcl 4.0;*). Or you can create your own.
9494

95+
**Note:** If you are using a cluster setup, you need to add some additional configuration to your vcl.
96+
The `acl purgers` block inside your vcl should contain the private ip range of your cluster.
97+
You can find your private ip range using the `hypernode-cluster-info` command on one of your cluster nodes.
98+
99+
As example, our private ip range is `192.168.1.0/24`.
100+
You can add this to the `acl purgers` block. It should like something similar as the example below:
101+
102+
```vcl
103+
acl purgers {
104+
"127.0.0.1";
105+
"localhost";
106+
"::1";
107+
"192.168.1.0/24";
108+
}
109+
```
110+
95111
So, the steps to implement the Varnish configuration into Varnish are:
96112

97113
- Create a file on your node, for example: **data/web/shopware6.vcl** with the Varnish config

0 commit comments

Comments
 (0)