@scandipwa/magento-scripts 1.14.1-alpha.5 → 1.14.1-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/config/docker.js +12 -8
  2. package/lib/config/templates/nginx.template.conf +17 -0
  3. package/lib/config/templates/varnish.template.vcl +15 -6
  4. package/lib/config/varnish/varnish-6-0.js +11 -0
  5. package/lib/config/varnish/varnish-6-6.js +11 -0
  6. package/lib/config/varnish/varnish-7-0.js +11 -0
  7. package/lib/config/versions/magento-2.3.0.js +2 -5
  8. package/lib/config/versions/magento-2.3.1.js +2 -5
  9. package/lib/config/versions/magento-2.3.2-p2.js +2 -5
  10. package/lib/config/versions/magento-2.3.2.js +2 -5
  11. package/lib/config/versions/magento-2.3.3-p1.js +2 -5
  12. package/lib/config/versions/magento-2.3.3.js +2 -5
  13. package/lib/config/versions/magento-2.3.4-p2.js +2 -5
  14. package/lib/config/versions/magento-2.3.4.js +2 -5
  15. package/lib/config/versions/magento-2.3.5-p1.js +2 -5
  16. package/lib/config/versions/magento-2.3.5-p2.js +2 -5
  17. package/lib/config/versions/magento-2.3.5.js +2 -5
  18. package/lib/config/versions/magento-2.3.6-p1.js +2 -5
  19. package/lib/config/versions/magento-2.3.6.js +2 -5
  20. package/lib/config/versions/magento-2.3.7-p1.js +2 -5
  21. package/lib/config/versions/magento-2.3.7-p2.js +2 -5
  22. package/lib/config/versions/magento-2.3.7-p3.js +2 -5
  23. package/lib/config/versions/magento-2.3.7.js +2 -5
  24. package/lib/config/versions/magento-2.4.0-p1.js +2 -5
  25. package/lib/config/versions/magento-2.4.0.js +2 -5
  26. package/lib/config/versions/magento-2.4.1-p1.js +2 -5
  27. package/lib/config/versions/magento-2.4.1.js +2 -5
  28. package/lib/config/versions/magento-2.4.2-p1.js +2 -5
  29. package/lib/config/versions/magento-2.4.2-p2.js +2 -5
  30. package/lib/config/versions/magento-2.4.2.js +2 -5
  31. package/lib/config/versions/magento-2.4.3-p1.js +2 -5
  32. package/lib/config/versions/magento-2.4.3-p2.js +2 -5
  33. package/lib/config/versions/magento-2.4.3.js +2 -5
  34. package/lib/config/versions/magento-2.4.4.js +2 -5
  35. package/lib/tasks/docker/containers.js +4 -1
  36. package/lib/tasks/file-system/create-nginx-config.js +5 -2
  37. package/lib/tasks/file-system/create-varnish-config.js +6 -5
  38. package/lib/tasks/magento/setup-magento/varnish-config.js +7 -1
  39. package/lib/tasks/php/update-env-php.js +2 -2
  40. package/lib/tasks/php/update-env.php +2 -0
  41. package/package.json +2 -2
  42. package/typings/context.d.ts +2 -1
@@ -43,6 +43,7 @@ module.exports = async ({ configuration, ssl, host }, config) => {
43
43
  const isLinux = os.platform() === 'linux';
44
44
  const isWsl = await getIsWsl();
45
45
  const isArm = (await getArch()) === 'arm64';
46
+ const isNotNativeLinux = (!isLinux || isWsl);
46
47
 
47
48
  if (!isLinux) {
48
49
  /**
@@ -76,10 +77,10 @@ module.exports = async ({ configuration, ssl, host }, config) => {
76
77
 
77
78
  if (varnish.enabled) {
78
79
  volumes.varnish = {
79
- name: `${ prefix }_varnish-vcl-data`,
80
+ name: `${ prefix }_varnish-data`,
80
81
  opts: {
81
82
  type: 'nfs',
82
- device: `${ path.join(cacheDir, 'varnish', 'default.vcl') }`,
83
+ device: `${ path.join(cacheDir, 'varnish') }`,
83
84
  o: 'bind'
84
85
  }
85
86
  };
@@ -90,7 +91,7 @@ module.exports = async ({ configuration, ssl, host }, config) => {
90
91
  const dockerConfig = {
91
92
  nginx: {
92
93
  _: 'Nginx',
93
- ports: (!isLinux || isWsl) ? [
94
+ ports: isNotNativeLinux ? [
94
95
  `${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.app }:80`
95
96
  ] : [],
96
97
  healthCheck: {
@@ -110,7 +111,7 @@ module.exports = async ({ configuration, ssl, host }, config) => {
110
111
  ],
111
112
  restart: 'on-failure:5',
112
113
  // TODO: use connect instead
113
- network: (!isLinux || isWsl) ? network.name : 'host',
114
+ network: isNotNativeLinux ? network.name : 'host',
114
115
  image: `nginx:${ nginx.version }`,
115
116
  imageDetails: {
116
117
  name: 'nginx',
@@ -216,16 +217,19 @@ module.exports = async ({ configuration, ssl, host }, config) => {
216
217
  },
217
218
  name: `${ prefix }_varnish`,
218
219
  mountVolumes: isLinux ? [
219
- `${ path.join(cacheDir, 'varnish', 'default.vcl') }:/etc/varnish/default.vcl:ro`
220
+ `${ path.join(cacheDir, 'varnish') }:/etc/varnish`
220
221
  ] : [
221
- `${ volumes.varnish.name }:/etc/varnish/default.vcl`
222
+ `${ volumes.varnish.name }:/etc/varnish`
222
223
  ],
224
+ ports: isNotNativeLinux ? [
225
+ `${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.varnish }:80`
226
+ ] : [],
223
227
  env: {
224
228
  VARNISH_SIZE: '2G'
225
229
  },
226
230
  restart: 'on-failure:30',
227
- network: (!isLinux || isWsl) ? network.name : 'host',
228
- command: `varnishd -F -a :${ ports.varnish } -t 600 -f /etc/varnish/default.vcl`,
231
+ network: isNotNativeLinux ? network.name : 'host',
232
+ command: `varnishd -F -a :${ isNotNativeLinux ? 80 : ports.varnish } -t 600 -f /etc/varnish/default.vcl`,
229
233
  tmpfs: [
230
234
  '/var/lib/varnish:exec'
231
235
  ]
@@ -39,6 +39,16 @@ server {
39
39
  }
40
40
 
41
41
  location / {
42
+ # proxy_set_header X-Real-IP $remote_addr;
43
+ # proxy_set_header X-Forwarded-For $remote_addr;
44
+ # proxy_set_header Host $http_host;
45
+
46
+ # if ($request_method = PURGE) {
47
+ # rewrite ^/(.*)$ $1 break;
48
+ # proxy_pass http://<%= it.hostMachine %>:<%= it.ports.varnish %>/;
49
+ # break;
50
+ # }
51
+
42
52
  try_files $uri $uri/ /index.php$is_args$args;
43
53
  }
44
54
 
@@ -212,4 +222,11 @@ server {
212
222
  location @webp-to-jpg {
213
223
  rewrite ^(.*)\.webp$ $1.jpg last;
214
224
  }
225
+
226
+ # location @purgepass {
227
+ # # some other configuration
228
+ # proxy_pass http://<%= it.hostMachine %>:<%= it.ports.varnish %>;
229
+ # proxy_set_header Host $host;
230
+ # proxy_set_header X-Real-IP $remote_addr;
231
+ # }
215
232
  }
@@ -7,19 +7,28 @@ import std;
7
7
 
8
8
  backend default {
9
9
  .host = "<%= it.hostMachine %>";
10
- .port = "<%= it.hostPort %>";
10
+ .host_header = "Host: localhost";
11
+ .port = "<%= it.nginxPort %>";
11
12
  .first_byte_timeout = 600s;
12
13
  .probe = {
13
- .url = "/health_check.php";
14
- .timeout = 2s;
15
- .interval = 5s;
16
- .window = 10;
17
- .threshold = 5;
14
+ # .url = "/health_check.php";
15
+ .request =
16
+ "GET /health_check.php HTTP/1.1"
17
+ "Host: localhost"
18
+ "Connection: close"
19
+ "User-Agent: Varnish Health Probe";
20
+ .interval = 10s;
21
+ .timeout = 5s;
22
+ .window = 5;
23
+ .threshold = 3;
18
24
  }
19
25
  }
20
26
 
21
27
  acl purge {
22
28
  "<%= it.hostMachine %>";
29
+ "localhost";
30
+ "172.0.0.0"/8;
31
+ "192.168.0.0"/16;
23
32
  }
24
33
 
25
34
  sub vcl_recv {
@@ -0,0 +1,11 @@
1
+ const path = require('path');
2
+
3
+ const varnish60 = ({ templateDir }) => ({
4
+ enabled: true,
5
+ version: '6.0',
6
+ configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
7
+ });
8
+
9
+ module.exports = {
10
+ varnish60
11
+ };
@@ -0,0 +1,11 @@
1
+ const path = require('path');
2
+
3
+ const varnish66 = ({ templateDir }) => ({
4
+ enabled: true,
5
+ version: '6.6',
6
+ configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
7
+ });
8
+
9
+ module.exports = {
10
+ varnish66
11
+ };
@@ -0,0 +1,11 @@
1
+ const path = require('path');
2
+
3
+ const varnish70 = ({ templateDir }) => ({
4
+ enabled: true,
5
+ version: '7.0',
6
+ configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
7
+ });
8
+
9
+ module.exports = {
10
+ varnish70
11
+ };
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.0',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.1',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.2-p2',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.2',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.3-p1',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.3',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.4-p2',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.4',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.5-p1',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.5-p2',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.5',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.6-p1',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.6',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.7-p1',
@@ -42,11 +43,7 @@ module.exports = ({ templateDir } = {}) => ({
42
43
  composer: {
43
44
  version: '2'
44
45
  },
45
- varnish: {
46
- enabled: true,
47
- version: '6.6',
48
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
49
- }
46
+ varnish: varnish66({ templateDir })
50
47
  },
51
48
  magento: defaultMagentoConfig,
52
49
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.7-p2',
@@ -42,11 +43,7 @@ module.exports = ({ templateDir } = {}) => ({
42
43
  composer: {
43
44
  version: '2'
44
45
  },
45
- varnish: {
46
- enabled: true,
47
- version: '6.6',
48
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
49
- }
46
+ varnish: varnish66({ templateDir })
50
47
  },
51
48
  magento: defaultMagentoConfig,
52
49
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.7-p3',
@@ -42,11 +43,7 @@ module.exports = ({ templateDir } = {}) => ({
42
43
  composer: {
43
44
  version: '2'
44
45
  },
45
- varnish: {
46
- enabled: true,
47
- version: '6.6',
48
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
49
- }
46
+ varnish: varnish66({ templateDir })
50
47
  },
51
48
  magento: defaultMagentoConfig,
52
49
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.3.7',
@@ -42,11 +43,7 @@ module.exports = ({ templateDir } = {}) => ({
42
43
  composer: {
43
44
  version: '2'
44
45
  },
45
- varnish: {
46
- enabled: true,
47
- version: '6.6',
48
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
49
- }
46
+ varnish: varnish66({ templateDir })
50
47
  },
51
48
  magento: defaultMagentoConfig,
52
49
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish60 } = require('../varnish/varnish-6-0');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.4.0-p1',
@@ -42,11 +43,7 @@ module.exports = ({ templateDir } = {}) => ({
42
43
  composer: {
43
44
  version: '1'
44
45
  },
45
- varnish: {
46
- enabled: true,
47
- version: '6.0',
48
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
49
- }
46
+ varnish: varnish60({ templateDir })
50
47
  },
51
48
  magento: defaultMagentoConfig,
52
49
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish60 } = require('../varnish/varnish-6-0');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.4.0',
@@ -42,11 +43,7 @@ module.exports = ({ templateDir } = {}) => ({
42
43
  composer: {
43
44
  version: '1'
44
45
  },
45
- varnish: {
46
- enabled: true,
47
- version: '6.0',
48
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
49
- }
46
+ varnish: varnish60({ templateDir })
50
47
  },
51
48
  magento: defaultMagentoConfig,
52
49
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish66 } = require('../varnish/varnish-6-6');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.1-p1',
@@ -44,11 +45,7 @@ module.exports = ({ templateDir } = {}) => ({
44
45
  composer: {
45
46
  version: '1'
46
47
  },
47
- varnish: {
48
- enabled: true,
49
- version: '6.6',
50
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
51
- }
48
+ varnish: varnish66({ templateDir })
52
49
  },
53
50
  magento: defaultMagentoConfig,
54
51
  host: 'localhost',
@@ -1,5 +1,6 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
+ const { varnish66 } = require('../varnish/varnish-6-6');
3
4
 
4
5
  module.exports = ({ templateDir } = {}) => ({
5
6
  magentoVersion: '2.4.1',
@@ -42,11 +43,7 @@ module.exports = ({ templateDir } = {}) => ({
42
43
  composer: {
43
44
  version: '1'
44
45
  },
45
- varnish: {
46
- enabled: true,
47
- version: '6.6',
48
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
49
- }
46
+ varnish: varnish66({ templateDir })
50
47
  },
51
48
  magento: defaultMagentoConfig,
52
49
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish66 } = require('../varnish/varnish-6-6');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.2-p1',
@@ -46,11 +47,7 @@ module.exports = ({ templateDir } = {}) => ({
46
47
  composer: {
47
48
  version: '2'
48
49
  },
49
- varnish: {
50
- enabled: true,
51
- version: '6.6',
52
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
53
- }
50
+ varnish: varnish66({ templateDir })
54
51
  },
55
52
  magento: defaultMagentoConfig,
56
53
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish66 } = require('../varnish/varnish-6-6');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.2-p2',
@@ -46,11 +47,7 @@ module.exports = ({ templateDir } = {}) => ({
46
47
  composer: {
47
48
  version: '2'
48
49
  },
49
- varnish: {
50
- enabled: true,
51
- version: '6.6',
52
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
53
- }
50
+ varnish: varnish66({ templateDir })
54
51
  },
55
52
  magento: defaultMagentoConfig,
56
53
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish66 } = require('../varnish/varnish-6-6');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.2',
@@ -45,11 +46,7 @@ module.exports = ({ templateDir } = {}) => ({
45
46
  composer: {
46
47
  version: '2'
47
48
  },
48
- varnish: {
49
- enabled: true,
50
- version: '6.6',
51
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
52
- }
49
+ varnish: varnish66({ templateDir })
53
50
  },
54
51
  magento: defaultMagentoConfig,
55
52
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish66 } = require('../varnish/varnish-6-6');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.3-p1',
@@ -46,11 +47,7 @@ module.exports = ({ templateDir } = {}) => ({
46
47
  composer: {
47
48
  version: '2'
48
49
  },
49
- varnish: {
50
- enabled: true,
51
- version: '6.6',
52
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
53
- }
50
+ varnish: varnish66({ templateDir })
54
51
  },
55
52
  magento: defaultMagentoConfig,
56
53
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish66 } = require('../varnish/varnish-6-6');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.3-p2',
@@ -46,11 +47,7 @@ module.exports = ({ templateDir } = {}) => ({
46
47
  composer: {
47
48
  version: '2'
48
49
  },
49
- varnish: {
50
- enabled: true,
51
- version: '6.6',
52
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
53
- }
50
+ varnish: varnish66({ templateDir })
54
51
  },
55
52
  magento: defaultMagentoConfig,
56
53
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish66 } = require('../varnish/varnish-6-6');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.3',
@@ -46,11 +47,7 @@ module.exports = ({ templateDir } = {}) => ({
46
47
  composer: {
47
48
  version: '2'
48
49
  },
49
- varnish: {
50
- enabled: true,
51
- version: '6.6',
52
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
53
- }
50
+ varnish: varnish66({ templateDir })
54
51
  },
55
52
  magento: defaultMagentoConfig,
56
53
  host: 'localhost',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { defaultMagentoConfig } = require('../magento-config');
3
3
  const { libsodium } = require('../php/extensions');
4
+ const { varnish70 } = require('../varnish/varnish-7-0');
4
5
 
5
6
  module.exports = ({ templateDir } = {}) => ({
6
7
  magentoVersion: '2.4.4',
@@ -46,11 +47,7 @@ module.exports = ({ templateDir } = {}) => ({
46
47
  composer: {
47
48
  version: '2'
48
49
  },
49
- varnish: {
50
- enabled: true,
51
- version: '7.0',
52
- configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
53
- }
50
+ varnish: varnish70({ templateDir })
54
51
  },
55
52
  magento: defaultMagentoConfig,
56
53
  host: 'localhost',
@@ -30,9 +30,11 @@ const run = (options) => {
30
30
  command = '',
31
31
  healthCheck,
32
32
  securityOptions = [],
33
- tmpfs = []
33
+ tmpfs = [],
34
+ expose = []
34
35
  } = options;
35
36
 
37
+ const exposeArg = expose && expose.map((e) => `--expose=${ e }`);
36
38
  const restartArg = restart && `--restart ${ restart }`;
37
39
  const networkArg = network && `--network ${ network }`;
38
40
  const portsArgs = ports.map((port) => `-p ${ port }`).join(' ');
@@ -53,6 +55,7 @@ const run = (options) => {
53
55
  networkArg,
54
56
  restartArg,
55
57
  portsArgs,
58
+ exposeArg,
56
59
  mountsArgs,
57
60
  mountVolumesArgs,
58
61
  envArgs,
@@ -63,6 +63,9 @@ const createNginxConfig = () => ({
63
63
 
64
64
  const networkToBindTo = isIpAddress(host) ? host : '127.0.0.1';
65
65
  const isLinux = os.platform() === 'linux';
66
+ const isNativeLinux = isLinux && !isWsl;
67
+ const hostMachine = isNativeLinux ? '127.0.0.1' : 'host.docker.internal';
68
+ const hostPort = isNativeLinux ? ports.app : 80;
66
69
 
67
70
  try {
68
71
  await setConfigFile({
@@ -77,8 +80,8 @@ const createNginxConfig = () => ({
77
80
  templateArgs: {
78
81
  ports,
79
82
  mageRoot: baseConfig.magentoDir,
80
- hostMachine: (isLinux && !isWsl) ? '127.0.0.1' : 'host.docker.internal',
81
- hostPort: (isLinux && !isWsl) ? ports.app : 80,
83
+ hostMachine,
84
+ hostPort,
82
85
  config: overridenConfiguration,
83
86
  networkToBindTo
84
87
  }
@@ -1,4 +1,3 @@
1
- const os = require('os');
2
1
  const path = require('path');
3
2
  const setConfigFile = require('../../util/set-config');
4
3
 
@@ -17,7 +16,8 @@ const createVarnishConfig = () => ({
17
16
  cacheDir
18
17
  }
19
18
  },
20
- isWsl
19
+ isWsl,
20
+ platform
21
21
  } = ctx;
22
22
 
23
23
  const {
@@ -26,7 +26,8 @@ const createVarnishConfig = () => ({
26
26
  }
27
27
  } = overridenConfiguration;
28
28
 
29
- const isLinux = os.platform() === 'linux';
29
+ const isLinux = platform === 'linux';
30
+ const isNativeLinux = isLinux && !isWsl;
30
31
 
31
32
  try {
32
33
  await setConfigFile({
@@ -38,8 +39,8 @@ const createVarnishConfig = () => ({
38
39
  template: varnish.configTemplate,
39
40
  overwrite: true,
40
41
  templateArgs: {
41
- hostMachine: (isLinux && !isWsl) ? '127.0.0.1' : 'host.docker.internal',
42
- hostPort: (isLinux && !isWsl) ? ports.app : 80
42
+ hostMachine: isNativeLinux ? '127.0.0.1' : 'host.docker.internal',
43
+ nginxPort: ports.app
43
44
  }
44
45
  });
45
46
  } catch (e) {
@@ -1,4 +1,6 @@
1
+ const os = require('os');
1
2
  const { updateTableValues } = require('../../../util/database');
3
+ const getIsWsl = require('../../../util/is-wsl');
2
4
 
3
5
  /**
4
6
  * @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
@@ -20,6 +22,10 @@ const varnishConfigSetup = () => ({
20
22
  ports
21
23
  } = ctx;
22
24
 
25
+ const isLinux = os.platform() === 'linux';
26
+ const isWsl = await getIsWsl();
27
+ // const host = (isLinux && !isWsl) ? 'localhost' : 'host.docker.internal';
28
+
23
29
  if (varnishEnabled) {
24
30
  await updateTableValues('core_config_data', [
25
31
  {
@@ -32,7 +38,7 @@ const varnishConfigSetup = () => ({
32
38
  },
33
39
  {
34
40
  path: 'system/full_page_cache/varnish/access_list',
35
- value: 'localhost'
41
+ value: (!isLinux || isWsl) ? 'host.docker.internal,localhost' : 'localhost'
36
42
  },
37
43
  {
38
44
  path: 'system/full_page_cache/caching_application',
@@ -14,7 +14,7 @@ const updateEnvPHP = () => ({
14
14
  return;
15
15
  }
16
16
 
17
- const useVarinsh = ctx.config.overridenConfiguration.configuration.varnish.enabled ? '1' : '';
17
+ const useVarnish = ctx.config.overridenConfiguration.configuration.varnish.enabled ? '1' : '';
18
18
  const varnishHost = '127.0.0.1';
19
19
  const varnishPort = ctx.ports.varnish;
20
20
  const previousVarnishPort = ctx.cachedPorts
@@ -25,7 +25,7 @@ const updateEnvPHP = () => ({
25
25
  phpTask(`-f ${ path.join(__dirname, 'update-env.php') }`, {
26
26
  noTitle: true,
27
27
  env: {
28
- USE_VARNISH: useVarinsh,
28
+ USE_VARNISH: useVarnish,
29
29
  VARNISH_PORT: `${ varnishPort }`,
30
30
  VARNISH_HOST: varnishHost,
31
31
  PREVIOUS_VARNISH_PORT: `${ previousVarnishPort }`
@@ -161,6 +161,8 @@ class EnvUpdater
161
161
  } else {
162
162
  $this->config['http_cache_hosts'] = [$varnishConfig];
163
163
  }
164
+ } else {
165
+ unset($this->config['http_cache_hosts']);
164
166
  }
165
167
  }
166
168
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Scripts and configuration used by CMA.",
4
4
  "homepage": "https://docs.create-magento-app.com/",
5
5
  "repository": "github:scandipwa/create-magento-app",
6
- "version": "1.14.1-alpha.5",
6
+ "version": "1.14.1-alpha.8",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -51,5 +51,5 @@
51
51
  "mysql",
52
52
  "scandipwa"
53
53
  ],
54
- "gitHead": "91adc2e400b0b00e9160680d04d8c1588d41fae7"
54
+ "gitHead": "a59a530f5ebb1946f3138b57fb1674fe7df305c9"
55
55
  }
@@ -16,6 +16,7 @@ export interface ListrContext {
16
16
  }
17
17
  arch: 'arm64' | 'x64'
18
18
  isArm: boolean
19
+ isWsl: boolean
19
20
  platform?: NodeJS.Platform
20
21
  platformVersion?: string
21
22
  /**
@@ -52,7 +53,7 @@ export interface ListrContext {
52
53
  o: string
53
54
  }
54
55
  }>
55
- getContainers(): Record<'nginx' | 'redis' | 'mysql' | 'elasticsearch', {
56
+ getContainers(): Record<'nginx' | 'redis' | 'mysql' | 'elasticsearch' | 'varnish', {
56
57
  _: string
57
58
  ports: string[]
58
59
  healthCheck: {