Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
316 lines (272 loc) · 10.3 KB
/
Copy pathTaskfile.yml
File metadata and controls
316 lines (272 loc) · 10.3 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
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# Task tool documentation:
# 1) Basics: https://taskfile.dev/usage
# 2) Naming conventions: https://taskfile.dev/styleguide
version: '3'
env:
AEM_ENV: '{{.AEM_ENV | default "local"}}'
AEM_INSTANCE_PROCESSING_MODE: auto
AEM_OUTPUT_VALUE: NONE
AEM_JAVA_ENABLED: true
dotenv:
- '.env' # VCS-ignored, user-specific
- '.env.{{.AEM_ENV}}' # VCS-ignored, env-specific
- '{{.AEM_ENV}}.env' # VCS-tracked, env-specific
tasks:
init:
desc: initialize project
cmds:
- sh aemw project init -V ALL
status:
desc: check status of AEM instances and dispatcher
cmds:
- task: aem:status
- task: dispatcher:status
check:
desc: check health of AEM instances and dispatcher
cmds:
- task: aem:check
- task: dispatcher:check
setup:
desc: setup AEM instances and dispatcher
cmds:
- task: aem:setup
- task: dispatcher:setup
- task: aem:check
- task: dispatcher:check
resetup:
desc: destroy then setup again AEM instances and dispatcher
cmds:
- task: destroy
- task: setup
start:
desc: start AEM instances and dispatcher
aliases: [ up ]
cmds:
- task: aem:up
- task: dispatcher:up
stop:
desc: stop AEM instances and dispatcher
aliases: [ down ]
cmds:
- task: dispatcher:down
- task: aem:down
restart:
desc: restart AEM instances and dispatcher
cmds:
- task: aem:down
- task: aem:up
- task: dispatcher:down
- task: dispatcher:up
destroy:
desc: destroy AEM instances and dispatcher
prompt: This will permanently delete all configured AEM instances and their data. Continue?
cmds:
- task: stop
- task: aem:destroy
- task: dispatcher:destroy
aem:setup:
desc: start and provision AEM instances then build and deploy AEM application
cmds:
- task: aem:start
- task: aem:provision
- task: aem:deploy
aem:start:
desc: start AEM instances
aliases: [ aem:up ]
cmd: sh aemw instance launch
aem:status:
desc: check status of AEM instances
env:
AEM_OUTPUT_VALUE: ALL
cmd: sh aemw instance status
aem:tail:
desc: tail logs of AEM instances
cmd: tail -f aem/home/var/instance/*/crx-quickstart/logs/{stdout,error}.log
aem:tail:author:
desc: tail logs of AEM author instance
cmd: tail -f aem/home/var/instance/author/crx-quickstart/logs/{stdout,error}.log
aem:tail:publish:
desc: tail logs of AEM publish instance
cmd: tail -f aem/home/var/instance/publish/crx-quickstart/logs/{stdout,error}.log
aem:provision:
desc: provision AEM instances by installing packages and applying configurations
aliases: [ aem:configure ]
cmds:
- task: aem:provision:repl-agent-publish
- task: aem:provision:repl-agent-flush
- task: aem:provision:crx
aem:provision:repl-agent-publish:
desc: configure replication agent on AEM author instance
internal: true
cmd: |
PROPS="
enabled: true
transportUri: {{.AEM_PUBLISH_HTTP_URL}}/bin/receive?sling:authRequestLogin=1
transportUser: {{.AEM_PUBLISH_USER}}
transportPassword: {{.AEM_PUBLISH_PASSWORD}}
userId: admin
"
echo "$PROPS" | sh aemw repl agent setup -A --location "author" --name "publish"
aem:provision:repl-agent-flush:
desc: configure replication agent on AEM publish instance
internal: true
cmd: |
PROPS="
enabled: true
transportUri: {{.AEM_DISPATCHER_HTTP_URL }}/dispatcher/invalidate.cache
protocolHTTPHeaders:
- 'CQ-Action: {action}'
- 'CQ-Handle: {path}'
- 'CQ-Path: {path}'
- 'Host: publish'
"
echo "$PROPS" | sh aemw repl agent setup -P --location "publish" --name "flush"
aem:provision:crx:
desc: enable CRX/DE on AEM instances
internal: true
cmd: 'sh aemw osgi config save --pid "org.apache.sling.jcr.davex.impl.servlets.SlingDavExServlet" --input-string "alias: /crx/server"'
aem:destroy:
desc: destroy AEM instances
deps: [ aem:stop ]
cmd: sh aemw instance destroy
aem:stop:
desc: stop AEM instances
aliases: [ aem:down ]
cmd: sh aemw instance stop
aem:build:
desc: build AEM application using Maven
sources: # https://github.com/go-task/task/issues/225 (generated clientlibs under 'ui.apps' should be excluded)
- pom.xml
- all/pom.xml
- all/src/**/*
- core/pom.xml
- core/src/**/*
- ui.apps/pom.xml
- ui.apps/src/**/*
- exclude: ui.apps/src/main/content/jcr_root/apps/*/clientlibs/clientlib-site/**/*
- exclude: ui.apps/src/main/content/jcr_root/apps/*/clientlibs/clientlib-dependencies/**/*
- exclude: ui.apps/src/main/content/jcr_root/apps/*/clientlibs/clientlib-angular/**/*
- exclude: ui.apps/src/main/content/jcr_root/apps/*/clientlibs/clientlib-react/**/*
- ui.apps.structure/pom.xml
- ui.apps.structure/src/**/*
- ui.config/pom.xml
- ui.config/src/**/*
- ui.content/pom.xml
- ui.content/src/**/*
- ui.frontend/pom.xml
- ui.frontend/*.js
- ui.frontend/package.json
- ui.frontend/src/**/*
generates:
- all/target/*.all-*.zip
vars:
ARGS: -PfedDev {{.AEM_BUILD_ARGS}}
cmd: sh mvnw clean package {{.ARGS}}
aem:build:version:
desc: check build tool versions
cmd: sh mvnw --version
aem:deploy:
desc: deploy AEM application
deps: [ aem:build ]
cmd: sh aemw package deploy --file "all/target/*.all-*.zip"
aem:check:
deps: [ aem:author:check, aem:publish:check ]
aem:author:check:
desc: check health of AEM author instance
cmds:
- sleep 3
- curl -s -u "{{.AEM_AUTHOR_USER}}:{{.AEM_AUTHOR_PASSWORD}}" "{{.AEM_AUTHOR_HTTP_URL}}/libs/granite/core/content/login.html" | grep -q "QUICKSTART_HOMEPAGE"
- curl -s -u "{{.AEM_AUTHOR_USER}}:{{.AEM_AUTHOR_PASSWORD}}" "{{.AEM_AUTHOR_HTTP_URL}}/etc/replication/agents.author/publish.test.html" | grep -q "Replication (TEST) of /content successful"
aem:publish:check:
desc: check health of AEM publish instance
cmds:
- sleep 3
- curl -s -u "{{.AEM_PUBLISH_USER}}:{{.AEM_PUBLISH_PASSWORD}}" "{{.AEM_PUBLISH_HTTP_URL}}/libs/granite/core/content/login.html" | grep -q "QUICKSTART_HOMEPAGE"
- curl -s -u "{{.AEM_PUBLISH_USER}}:{{.AEM_PUBLISH_PASSWORD}}" "{{.AEM_PUBLISH_HTTP_URL}}/etc/replication/agents.publish/flush.test.html" | grep -q "Replication (TEST) of /content successful"
dispatcher:setup:
desc: setup AEM dispatcher
cmds:
- task: dispatcher:start
- task: dispatcher:status
dispatcher:resetup:
desc: destroy then setup again AEM dispatcher
cmds:
- task: dispatcher:destroy
- task: dispatcher:setup
dispatcher:start:
desc: start AEM dispatcher using SDK image
aliases: [ dispatcher:up ]
dir: dispatcher
cmds:
- 'command -v {{.CONTAINER_COMMAND}} || { echo "Container engine \"{{.CONTAINER_COMMAND}}\" is not installed!"; exit 1; }'
- |
if [ "{{OS}}" = "windows" ] && [ "{{.CONTAINER_COMMAND}}" = "podman" ]; then
HOST_IP=$(powershell -command "Get-NetIpAddress | where { \$_.InterfaceAlias -Like '*WSL*' -and \$_.AddressFamily -EQ 'IPv4' } | select -ExpandProperty IPAddress")
if [ -z "$HOST_IP" ]; then
echo "Host IP cannot be determined! WSL cannot run in mirrored networking mode."
exit 1
fi
echo "EXTRA_HOST=host.docker.internal:$HOST_IP" > .env
else
echo "EXTRA_HOST=localhost.dummy:127.0.0.1" > .env
fi
- 'test -d ../aem/home/opt/sdk/dispatcher || { echo "Dispatcher SDK is not available. Try providing AEM SDK ZIP instead of JAR to directory: aem/home/lib"; exit 1; }'
- test -d home/sdk || (rm -fr home/sdk && mkdir -p home && cp -rL ../aem/home/opt/sdk/dispatcher home/sdk)
# - sh home/sdk/bin/validate.sh src > ../aem/home/var/log/dispatcher-validate.log
- "{{.CONTAINER_COMMAND}} tag \"$({{.CONTAINER_COMMAND}} load --input 'home/sdk/lib/dispatcher-publish-{{ARCH}}.tar.gz' | tail -n 1 | awk -v 'FS= ' '{print $3}')\" \"adobe/aem-ethos/dispatcher-publish:latest\""
- mkdir -p home/sdk/logs home/sdk/cache
- '{{.CONTAINER_COMPOSE_COMMAND}} up -d'
dispatcher:stop:
desc: stop AEM dispatcher
aliases: [ dispatcher:down ]
dir: dispatcher
cmd: '{{.CONTAINER_COMPOSE_COMMAND}} down'
dispatcher:restart:
desc: restart AEM dispatcher
cmds:
- task: dispatcher:stop
- task: dispatcher:start
dispatcher:status:
desc: check status of AEM dispatcher
dir: dispatcher
cmds:
- '{{.CONTAINER_COMPOSE_COMMAND}} ps'
- '{{.CONTAINER_COMPOSE_COMMAND}} logs --tail 20'
dispatcher:login:
desc: login to AEM dispatcher shell
cmd: '{{.CONTAINER_COMMAND}} exec -it dispatcher bash'
ignore_error: true
dispatcher:destroy:
desc: destroy AEM dispatcher
dir: dispatcher
cmds:
- '{{.CONTAINER_COMPOSE_COMMAND}} down -v --remove-orphans'
- rm -fr home
dispatcher:hosts:
desc: add AEM dispatcher domains to hosts file
cmds:
- task: dispatcher:hosts:windows
- task: dispatcher:hosts:darwin
- task: dispatcher:hosts:linux
dispatcher:hosts:windows:
platforms: [ windows ]
status:
- cat C:/Windows/System32/drivers/etc/hosts | grep -qxF '{{.AEM_DISPATCHER_IP}} {{.AEM_DISPATCHER_DOMAINS}} '
cmd: powershell -command "Start-Process cmd -ArgumentList \"/C echo "{{.AEM_DISPATCHER_IP}} {{.AEM_DISPATCHER_DOMAINS}}" >> C:\Windows\System32\drivers\etc\hosts\" -Verb runas"
dispatcher:hosts:darwin:
platforms: [ darwin ]
status:
- cat /etc/hosts | grep -qxF '{{.AEM_DISPATCHER_IP}} {{.AEM_DISPATCHER_DOMAINS}}'
cmd: osascript -e "do shell script \"echo '{{.AEM_DISPATCHER_IP}} {{.AEM_DISPATCHER_DOMAINS}}' >> /etc/hosts\" with prompt \"AEM - Add domains to host file\" with administrator privileges"
dispatcher:hosts:linux:
platforms: [ linux ]
status:
- cat /etc/hosts | grep -qxF '{{.AEM_DISPATCHER_IP}} {{.AEM_DISPATCHER_DOMAINS}}'
cmd: sudo echo '{{.AEM_DISPATCHER_IP}} {{.AEM_DISPATCHER_DOMAINS}}' >> /etc/hosts
dispatcher:check:
desc: check health of AEM dispatcher
deps: [ dispatcher:hosts ]
cmds:
- curl "http://{{.AEM_DISPATCHER_DOMAIN}}" -s -o /dev/null || true # warmup
- sleep 3
- curl "http://{{.AEM_DISPATCHER_DOMAIN}}" -s -o /dev/null -w "%{http_code}" | grep -q 200