generated from ddev/ddev-addon-template
-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathinstall.yaml
More file actions
61 lines (56 loc) · 2.9 KB
/
install.yaml
File metadata and controls
61 lines (56 loc) · 2.9 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: varnish
project_files:
- docker-compose.varnish.yaml
- varnish
- commands/varnish
ddev_version_constraint: '>= v1.24.10'
pre_install_actions:
- |
#ddev-description:Removing old docker-compose.varnish-extras.yaml
if [ -f ${DDEV_APPROOT}/.ddev/docker-compose.varnish-extras.yaml ]; then
if grep -q '#ddev-generated' ${DDEV_APPROOT}/.ddev/docker-compose.varnish-extras.yaml; then
rm -f ${DDEV_APPROOT}/.ddev/docker-compose.varnish-extras.yaml
else
echo "${DDEV_APPROOT}/.ddev/docker-compose.varnish-extras.yaml needs to be removed but has been modified by the user. Please check it and remove it"
exit 2
fi
fi
post_install_actions:
- |
#ddev-description:Checking docker-compose.varnish_extras.yaml for changes
if [ -f docker-compose.varnish_extras.yaml ] && ! grep -q '#ddev-generated' docker-compose.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-description:Modify HTTP_EXPOSE and HTTPS_EXPOSE for web container
cat <<'EOF' > docker-compose.varnish_extras.yaml
#ddev-generated
# This configuration modifies HTTP_EXPOSE and HTTPS_EXPOSE for web container
# to exclude 80 port, which is handled by Varnish.
services:
web:
environment:
{{- $base_http_ports := list (printf "%s:8025" (or (index .DdevProjectConfig "mailpit_http_port") (env "DDEV_MAILPIT_PORT"))) }}
{{- $base_https_ports := list (printf "%s:8025" (or (index .DdevProjectConfig "mailpit_https_port") (env "DDEV_MAILPIT_HTTPS_PORT"))) }}
{{- $extra_http_ports := list }}
{{- $extra_https_ports := list }}
{{- range .DdevProjectConfig.web_extra_exposed_ports }}
{{- $extra_http_ports = append $extra_http_ports (printf "%d:%d" .http_port .container_port) }}
{{- $extra_https_ports = append $extra_https_ports (printf "%d:%d" .https_port .container_port) }}
{{- end }}
{{- $all_http_ports := concat $base_http_ports $extra_http_ports }}
{{- $all_https_ports := concat $base_https_ports $extra_https_ports }}
- HTTP_EXPOSE={{ range $i, $p := $all_http_ports }}{{ $p }}{{ if lt (add1 $i) (len $all_http_ports) }},{{ end }}{{ end }}
- HTTPS_EXPOSE={{ range $i, $p := $all_https_ports }}{{ $p }}{{ if lt (add1 $i) (len $all_https_ports) }},{{ end }}{{ end }}
EOF
removal_actions:
- |
#ddev-description:Remove docker-compose.varnish_extras.yaml file
if [ -f docker-compose.varnish_extras.yaml ]; then
if grep -q '#ddev-generated' docker-compose.varnish_extras.yaml; then
rm -f docker-compose.varnish_extras.yaml
else
echo "Unwilling to remove '$DDEV_APPROOT/.ddev/docker-compose.varnish_extras.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete."
fi
fi