-
Notifications
You must be signed in to change notification settings - Fork 2
/
harness.yml
255 lines (252 loc) · 8.31 KB
/
harness.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
---
harness('inviqa/magento2'):
description: A docker based development environment for magento2
require:
services:
- proxy
- mail
confd:
- harness:/
attributes:
standard:
- magento.edition
secret:
- magento.username
- magento.password
---
attributes:
app:
web_owner: www-data
web_group: www-data
web_writable_dirs:
- '/app/pub/media'
- '/app/pub/static'
- '/app/var'
- '/app/var/export'
- '/app/pub/static/frontend'
- "= (@('app.mode') !== 'production' ? '/app/generated' : '')"
services:
- chrome
- cron
- mysql
- redis
- redis-session
- elasticsearch
web_directory: /app/pub
export_directory: /app/var/export
media_directory: = @('app.web_directory') ~ '/media'
php:
composer:
major_version: "= version_compare(@('magento.version'), '2.4.2', '>=') ? 2 : 1"
fpm:
ini:
max_execution_time: 18000
ini:
opcache.interned_strings_buffer: 64
opcache.max_accelerated_files: 65407
opcache.memory_consumption: 512
install_extensions:
- "= @('services.blackfire.enabled') ? 'blackfire' : ''"
- "= @('services.tideways.enabled') ? 'tideways' : ''"
- redis
- sockets
version: 7.4
composer:
auth:
basic:
magento:
path: repo.magento.com
username: = @('magento.username')
password: = @('magento.password')
database:
user: magento
pass: magento
name: magento
magento:
edition: enterprise
config:
session:
save: redis
crypt:
key: WmpzgYLfW8jwxTRKbACKqudJXcjJ4jqu
run:
code: []
type: []
static_content:
adminhtml:
languages: []
themes: []
frontend:
languages: []
themes: []
version: 2.4.2
mysql:
image: mariadb
tag: '10.4'
backend:
build:
steps:
- task composer:install
- task magento:tidy
- |
if [ "$APP_BUILD" == "static" ] ; then
run mv app/etc/env.php app/etc/env-backup.php
run composer dump-autoload --optimize
passthru bin/magento setup:di:compile
run mv app/etc/env-backup.php app/etc/env.php
task composer:autoload
fi
- |
if [ "$APP_BUILD" == "static" ] && validate-magento-config ; then
task magento:static_content_deploy
else
echo -n "$(date +%s)" > pub/static/deployed_version.txt
fi
- run mkdir -p /app/var/export
install:
steps:
# the magento installer will not work if the dpeloyment config is present so we remove and
# restore it after installation.
- run rm -f /app/app/etc/env.php
- run rm -f /app/app/etc/config.php
- run rm -rf /tmp/php-file-cache/*/app/app/etc/ || true
- |
if [[ "$HAS_ELASTICSEARCH" == "true" ]]; then
task http:wait "${ELASTICSEARCH_URL:-${ELASTICSEARCH_SCHEME:-http}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}}" ${ELASTICSEARCH_USERNAME:+--user "${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}"}
fi
- |
passthru "magento setup:install \
--key='${MAGENTO_CRYPT_KEY}' \
\
--backend-frontname=admin \
--base-url='https://${APP_HOST}/' \
\
--admin-user=admin \
--admin-password='${ADMIN_DEFAULT_PASSWORD}' \
--admin-firstname=First \
--admin-lastname=Last \
\
--db-host='${DB_HOST}' \
--db-name='${DB_NAME}' \
--db-user='${DB_USER}' \
--db-password='${DB_PASS}' \
\
--session-save=redis \
--session-save-redis-host='${REDIS_SESSION_HOST}' \
--session-save-redis-port='${REDIS_SESSION_PORT}' \
--session-save-redis-db=1 \
\
--cache-backend=redis \
--cache-backend-redis-server='${REDIS_HOST}' \
--cache-backend-redis-port='${REDIS_PORT}' \
--cache-backend-redis-db=2 \
\
--page-cache=redis \
--page-cache-redis-server='${REDIS_HOST}' \
--page-cache-redis-port='${REDIS_PORT}' \
--page-cache-redis-db=3 \
\
--search-engine=elasticsearch7 \
--elasticsearch-host='${ELASTICSEARCH_HOST}' \
--elasticsearch-port='${ELASTICSEARCH_PORT}' \
\
--language=en_GB"
# magento doesn't respond with an exit code when it fails so we check
# if the install succeeded or not here.
if [ ! -f /app/app/etc/env.php ]; then
(>&2 cat /tmp/my127ws-stdout.txt)
(>&2 cat /tmp/my127ws-stderr.txt)
exit 1
fi
- run rm -f /app/app/etc/env.php
- task overlay:apply
- task magento:dump-config
- run rm -rf /tmp/php-file-cache/*/app/app/etc/ || true
- task assets:dump
init:
steps:
- |
if [[ -f app/etc/env-backup.php ]]; then
run mv app/etc/env-backup.php app/etc/env.php
fi
- task rabbitmq:vhosts
- |
if [[ "$HAS_ELASTICSEARCH" == "true" ]]; then
task http:wait "${ELASTICSEARCH_URL:-${ELASTICSEARCH_SCHEME:-http}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}}" ${ELASTICSEARCH_USERNAME:+--user "${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}"}
fi
- run magento setup:upgrade --keep-generated --no-interaction
- run magento config:set 'web/unsecure/base_url' "https://${APP_HOST}/"
- run magento config:set 'web/secure/base_url' "https://${APP_HOST}/"
- run magento config:set 'web/secure/use_in_frontend' 1
- run magento config:set 'web/secure/use_in_adminhtml' 1
- run magento config:set 'web/seo/use_rewrites' 1
- if [[ "$HAS_VARNISH" == "true" ]]; then
run magento config:set 'system/full_page_cache/caching_application' 2;
fi
migrate:
steps:
- |
if [[ "$HAS_ELASTICSEARCH" == "true" ]]; then
task http:wait "${ELASTICSEARCH_URL:-${ELASTICSEARCH_SCHEME:-http}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}}" ${ELASTICSEARCH_USERNAME:+--user "${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}"}
fi
- run magento setup:upgrade --keep-generated --no-interaction
- run magento cache:clean
cron:
jobs:
- "= (@('app.mode') == 'production' ? '* * * * * /cron-run-with-env.sh \"/app/bin/magento cron:run & wait\"' : '')"
framework:
readme_blocks:
- xml_urn_generation
rabbitmq:
vhosts:
default: 'magento'
persistence:
enabled: false
magento:
export:
claimName: magento-export-pvc
mountPath: = @('app.export_directory')
accessMode: ReadWriteMany # the requirement if persistence is enabled
#storageClass: "..." most clusters need a custom storageclass
#hostPath: "..." alternatively for single node testing
size: 512Mi
media:
claimName: magento-media-pvc
mountPath: = @('app.media_directory')
accessMode: ReadWriteMany # the requirement if persistence is enabled
#storageClass: "..." most clusters need a custom storageclass
#hostPath: "..." alternatively for single node testing
size: 1Gi
nginx:
# Magento has a complex webroot structure
copy_directories:
- = @('app.web_directory')
# additional endpoints we don't need by default
#- /app/setup/pub
#- /app/update/pub
php_fpm:
conf:
fastcgi_buffer_size: 128k
# fastcgi_buffer_size (128k) + fastcgi_buffers's size (16k)
fastcgi_busy_buffers_size: 144k
---
command('redis-flush'): |
#!bash
ws redis flush
command('redis flush'):
env:
COMPOSE_BIN: = @('docker.compose.bin')
COMPOSE_PROJECT_NAME: = @('namespace')
exec: |
#!bash(harness:/)|@
$COMPOSE_BIN exec redis redis-cli flushall
command('magento %'):
exec: |
#!bash(workspace:/)|=
passthru ws exec bin/magento ={input.argument('%')}
---
import:
- harness/config/*.yml
- harness/attributes/*.yml
- harness/attributes/environment/={env('MY127WS_ENV','local')}.yml