forked from ddev/ddev-varnish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.yaml
45 lines (41 loc) · 1.89 KB
/
install.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: varnish
# list of files and directories listed that are copied into project .ddev directory
project_files:
- docker-compose.varnish.yaml
- varnish
- commands/varnish
pre_install_actions:
# Make sure we have a ddev version that can support what we do here
- |
#ddev-nodisplay
#ddev-description:Checking DDEV version
(ddev debug capabilities | grep ddev-get-yaml-interpolation >/dev/null) || (echo "Please upgrade DDEV to v1.21.4+ for appropriate capabilities" && false)
post_install_actions:
- |
#ddev-nodisplay
if [ -f .ddev/docker-compose.varnish-extras.yaml ] && ! grep '#ddev-generated' .ddev/config.varnish-extras.yaml; then
echo "Existing docker-compose.varnish-extras.yaml does not have #ddev-generated, so can't be updated"
exit 2
fi
- |
#ddev-nodisplay
cat <<-END >docker-compose.varnish-extras.yaml
#ddev-generated
# This is the second half of the trick that puts varnish "in front of" the web
# container, just by switching the names.
{{ $project_tld := "ddev.site" }}
{{ if .DdevGlobalConfig.project_tld }}{{ $project_tld = .DdevGlobalConfig.project_tld }}{{ end }}
{{ if .DdevProjectConfig.project_tld }}{{ $project_tld = .DdevProjectConfig.project_tld }} {{ end }}
{{ $novarnish_hostnames := print "novarnish." .DdevProjectConfig.name "." $project_tld }}
{{ $sep := print "." $project_tld ",novarnish." }}
{{ if .DdevProjectConfig.additional_hostnames }}
{{ $novarnish_hostnames = print $novarnish_hostnames "," "novarnish." (.DdevProjectConfig.additional_hostnames | join $sep) "." $project_tld }}
{{ end }}
{{ if .DdevProjectConfig.additional_fqdns }}
{{ $novarnish_hostnames = print $novarnish_hostnames "," "novarnish." ( .DdevProjectConfig.additional_fqdns | join ",novarnish." ) }}
{{ end }}
services:
web:
environment:
- VIRTUAL_HOST={{ $novarnish_hostnames }}
END