-
Notifications
You must be signed in to change notification settings - Fork 353
/
Building Event-Driven Orchestration on Google Cloud
421 lines (356 loc) · 16.8 KB
/
Building Event-Driven Orchestration on Google Cloud
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
export REGION=
export PROJECT_NUMBER=$(gcloud projects describe $DEVSHELL_PROJECT_ID --format='value(projectNumber)')
gcloud services enable \
workflows.googleapis.com \
workflowexecutions.googleapis.com \
eventarc.googleapis.com \
tasks.googleapis.com \
cloudscheduler.googleapis.com \
storage.googleapis.com \
vision.googleapis.com \
run.googleapis.com \
cloudfunctions.googleapis.com \
firestore.googleapis.com \
appengine.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
gcloud storage buckets create \
--location=$REGION gs://${UPLOAD_BUCKET}
gcloud storage buckets update \
gs://${UPLOAD_BUCKET} --uniform-bucket-level-access
gcloud storage buckets add-iam-policy-binding \
gs://${UPLOAD_BUCKET} \
--member=allUsers --role=roles/storage.objectViewer
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
--member="serviceAccount:[email protected]" \
--role="roles/iam.serviceAccountTokenCreator"
export GENERATED_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
gcloud storage buckets create \
--location=$REGION gs://${GENERATED_BUCKET}
gcloud storage buckets update \
gs://${GENERATED_BUCKET} --uniform-bucket-level-access
gcloud storage buckets add-iam-policy-binding \
gs://${GENERATED_BUCKET} \
--member=allUsers --role=roles/storage.objectViewer
export FIRESTORE_LOCATION=$REGION
gcloud firestore databases create \
--location=${FIRESTORE_LOCATION} \
--type=firestore-native
gcloud firestore indexes composite create \
--collection-group=images \
--field-config field-path=thumbnail,order=descending \
--field-config field-path=created,order=descending \
--async
export QUEUE_REGION=$REGION
gcloud tasks queues create thumbnail-task-queue \
--location=${QUEUE_REGION}
git clone --depth=1 https://github.com/GoogleCloudPlatform/training-data-analyst
ln -s ~/training-data-analyst/courses/orchestration-and-choreography/lab1 ~/code
export REPO_NAME=image-app-repo
export REPO_REGION=$REGION
gcloud artifacts repositories create ${REPO_NAME} \
--location=${REPO_REGION} --repository-format=docker
export REPO_NAME=image-app-repo
export REPO_REGION=$REGION
export THUMBNAIL_SERVICE_NAME=create-thumbnail
cd ~/code/cloud-run/create-thumbnail
gcloud builds submit \
. \
--tag ${REPO_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${REPO_NAME}/${THUMBNAIL_SERVICE_NAME}
export REPO_NAME=image-app-repo
export REPO_REGION=$REGION
export THUMBNAIL_SERVICE_REGION=$REGION
export THUMBNAIL_SERVICE_NAME=create-thumbnail
export GENERATED_IMAGES_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
cd ~/code/cloud-run/create-thumbnail
gcloud config set run/region ${THUMBNAIL_SERVICE_REGION}
gcloud config set run/platform managed
gcloud run deploy ${THUMBNAIL_SERVICE_NAME} \
--image ${REPO_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${REPO_NAME}/${THUMBNAIL_SERVICE_NAME} \
--no-allow-unauthenticated \
--memory=1Gi \
--max-instances=1 \
--update-env-vars GENERATED_IMAGES_BUCKET=${GENERATED_IMAGES_BUCKET}
export REPO_NAME=image-app-repo
export REPO_REGION=$REGION
export COLLAGE_SERVICE_REGION=$REGION
export COLLAGE_SERVICE_NAME=create-collage
export GENERATED_IMAGES_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
cd ~/code/cloud-run/create-collage
gcloud builds submit \
. \
--tag ${REPO_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${REPO_NAME}/${COLLAGE_SERVICE_NAME}
gcloud config set run/region ${COLLAGE_SERVICE_REGION}
gcloud config set run/platform managed
gcloud run deploy ${COLLAGE_SERVICE_NAME} \
--image ${REPO_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/${REPO_NAME}/${COLLAGE_SERVICE_NAME} \
--no-allow-unauthenticated \
--memory=1Gi \
--max-instances=1 \
--update-env-vars GENERATED_IMAGES_BUCKET=${GENERATED_IMAGES_BUCKET}
export DELETE_SERVICE_REGION=$REGION
export DELETE_SERVICE_NAME=delete-image
export GENERATED_IMAGES_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
cd ~/code/cloud-run/delete-image
gcloud config set run/region ${DELETE_SERVICE_REGION}
gcloud config set run/platform managed
gcloud run deploy ${DELETE_SERVICE_NAME} \
--source . \
--no-allow-unauthenticated \
--max-instances=1 \
--update-env-vars GENERATED_IMAGES_BUCKET=${GENERATED_IMAGES_BUCKET} \
--quiet
#TASK 5
export EXTRACT_FUNCTION_REGION=$REGION
export EXTRACT_FUNCTION_NAME=extract-image-metadata
cd ~/code/cloud-functions/${EXTRACT_FUNCTION_NAME}
gcloud config set functions/region ${EXTRACT_FUNCTION_REGION}
gcloud functions deploy ${EXTRACT_FUNCTION_NAME} \
--source . \
--runtime=nodejs18 \
--entry-point=extract_image_metadata \
--trigger-http \
--no-allow-unauthenticated
export WORKFLOWS_SA=workflows-sa
gcloud iam service-accounts create ${WORKFLOWS_SA}
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/datastore.user"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/cloudtasks.enqueuer"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/logging.logWriter"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/iam.serviceAccountUser"
export WORKFLOWS_SA=workflows-sa
export THUMBNAIL_SERVICE_NAME=create-thumbnail
export THUMBNAIL_SERVICE_REGION=$REGION
export EXTRACT_FUNCTION_NAME=extract-image-metadata
gcloud functions add-iam-policy-binding ${EXTRACT_FUNCTION_NAME} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/cloudfunctions.invoker"
gcloud run services add-iam-policy-binding ${THUMBNAIL_SERVICE_NAME} \
--region=${THUMBNAIL_SERVICE_REGION} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/run.viewer"
gcloud run services add-iam-policy-binding ${THUMBNAIL_SERVICE_NAME} \
--region=${THUMBNAIL_SERVICE_REGION} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/run.invoker"
export WORKFLOW_NAME=image-add-workflow
export WORKFLOW_REGION=$REGION
export WORKFLOWS_SA=workflows-sa
cd ~/code/workflows
gcloud workflows deploy ${WORKFLOW_NAME} \
--source=${WORKFLOW_NAME}.yaml \
--location=${WORKFLOW_REGION} \
--service-account="${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com"
export WORKFLOW_TRIGGER_SA=workflow-trigger-sa
gcloud iam service-accounts create ${WORKFLOW_TRIGGER_SA}
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOW_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/workflows.invoker"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member "serviceAccount:${WORKFLOW_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/eventarc.eventReceiver"
export CLOUD_STORAGE_SA="$(gcloud storage service-agent)"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${CLOUD_STORAGE_SA}" \
--role="roles/pubsub.publisher"
export WORKFLOW_TRIGGER_REGION=$REGION
export WORKFLOW_NAME=image-add-workflow
export WORKFLOW_REGION=$REGION
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export WORKFLOW_TRIGGER_SA=workflow-trigger-sa
gcloud eventarc triggers create image-add-trigger \
--location=${WORKFLOW_TRIGGER_REGION} \
--destination-workflow=${WORKFLOW_NAME} \
--destination-workflow-location=${WORKFLOW_REGION} \
--event-filters="type=google.cloud.storage.object.v1.finalized" \
--event-filters="bucket=${UPLOAD_BUCKET}" \
--service-account="${WORKFLOW_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com"
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export IMAGE_NAME=neon.jpg
gcloud storage cp ~/code/images/${IMAGE_NAME} gs://${UPLOAD_BUCKET}
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export GENERATED_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
export IMAGE_NAME=neon.jpg
echo "uploaded image: https://storage.googleapis.com/${UPLOAD_BUCKET}/${IMAGE_NAME}"
echo "generated image: https://storage.googleapis.com/${GENERATED_BUCKET}/${IMAGE_NAME}"
echo "Listing of generated-images bucket:"
gcloud storage ls gs://${GENERATED_BUCKET}
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export GENERATED_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
export IMAGE_NAME=neon.jpg
echo "uploaded image: https://storage.googleapis.com/${UPLOAD_BUCKET}/${IMAGE_NAME}"
echo "generated image: https://storage.googleapis.com/${GENERATED_BUCKET}/${IMAGE_NAME}"
echo "Listing of generated-images bucket:"
gcloud storage ls gs://${GENERATED_BUCKET}
#subscribe to btecky
export COLLAGE_SCHED_SA=collage-schedule-sa
export COLLAGE_SERVICE=create-collage
export COLLAGE_SERVICE_REGION=$REGION
gcloud iam service-accounts create ${COLLAGE_SCHED_SA}
gcloud run services add-iam-policy-binding ${COLLAGE_SERVICE} \
--region=${COLLAGE_SERVICE_REGION} \
--member="serviceAccount:${COLLAGE_SCHED_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/run.invoker"
export SERVICE_REGION=$REGION
export SERVICE_NAME=create-collage
gcloud run services describe ${SERVICE_NAME} \
--platform managed \
--region ${SERVICE_REGION} \
--format 'value(status.url)'
#repeat
export EXTRACT_FUNCTION_REGION=$REGION
export EXTRACT_FUNCTION_NAME=extract-image-metadata
cd ~/code/cloud-functions/${EXTRACT_FUNCTION_NAME}
gcloud config set functions/region ${EXTRACT_FUNCTION_REGION}
gcloud functions deploy ${EXTRACT_FUNCTION_NAME} \
--source . \
--runtime=nodejs18 \
--entry-point=extract_image_metadata \
--trigger-http \
--no-allow-unauthenticated
export WORKFLOWS_SA=workflows-sa
gcloud iam service-accounts create ${WORKFLOWS_SA}
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/datastore.user"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/cloudtasks.enqueuer"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/logging.logWriter"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/iam.serviceAccountUser"
export WORKFLOWS_SA=workflows-sa
export THUMBNAIL_SERVICE_NAME=create-thumbnail
export THUMBNAIL_SERVICE_REGION=$REGION
export EXTRACT_FUNCTION_NAME=extract-image-metadata
gcloud functions add-iam-policy-binding ${EXTRACT_FUNCTION_NAME} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/cloudfunctions.invoker"
gcloud run services add-iam-policy-binding ${THUMBNAIL_SERVICE_NAME} \
--region=${THUMBNAIL_SERVICE_REGION} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/run.viewer"
gcloud run services add-iam-policy-binding ${THUMBNAIL_SERVICE_NAME} \
--region=${THUMBNAIL_SERVICE_REGION} \
--member="serviceAccount:${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/run.invoker"
export WORKFLOW_NAME=image-add-workflow
export WORKFLOW_REGION=$REGION
export WORKFLOWS_SA=workflows-sa
cd ~/code/workflows
gcloud workflows deploy ${WORKFLOW_NAME} \
--source=${WORKFLOW_NAME}.yaml \
--location=${WORKFLOW_REGION} \
--service-account="${WORKFLOWS_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com"
export WORKFLOW_TRIGGER_SA=workflow-trigger-sa
gcloud iam service-accounts create ${WORKFLOW_TRIGGER_SA}
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${WORKFLOW_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/workflows.invoker"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member "serviceAccount:${WORKFLOW_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/eventarc.eventReceiver"
export CLOUD_STORAGE_SA="$(gcloud storage service-agent)"
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member="serviceAccount:${CLOUD_STORAGE_SA}" \
--role="roles/pubsub.publisher"
export WORKFLOW_TRIGGER_REGION=$REGION
export WORKFLOW_NAME=image-add-workflow
export WORKFLOW_REGION=$REGION
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export WORKFLOW_TRIGGER_SA=workflow-trigger-sa
gcloud eventarc triggers create image-add-trigger \
--location=${WORKFLOW_TRIGGER_REGION} \
--destination-workflow=${WORKFLOW_NAME} \
--destination-workflow-location=${WORKFLOW_REGION} \
--event-filters="type=google.cloud.storage.object.v1.finalized" \
--event-filters="bucket=${UPLOAD_BUCKET}" \
--service-account="${WORKFLOW_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com"
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export IMAGE_NAME=neon.jpg
gcloud storage cp ~/code/images/${IMAGE_NAME} gs://${UPLOAD_BUCKET}
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export GENERATED_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
export IMAGE_NAME=neon.jpg
echo "uploaded image: https://storage.googleapis.com/${UPLOAD_BUCKET}/${IMAGE_NAME}"
echo "generated image: https://storage.googleapis.com/${GENERATED_BUCKET}/${IMAGE_NAME}"
echo "Listing of generated-images bucket:"
gcloud storage ls gs://${GENERATED_BUCKET}
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
export GENERATED_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
export IMAGE_NAME=neon.jpg
echo "uploaded image: https://storage.googleapis.com/${UPLOAD_BUCKET}/${IMAGE_NAME}"
echo "generated image: https://storage.googleapis.com/${GENERATED_BUCKET}/${IMAGE_NAME}"
echo "Listing of generated-images bucket:"
gcloud storage ls gs://${GENERATED_BUCKET}
export UPLOAD_BUCKET=uploaded-images-${GOOGLE_CLOUD_PROJECT}
gcloud storage cp ~/code/images/alley.jpg \
gs://${UPLOAD_BUCKET}
gcloud storage cp ~/code/images/desktop.jpg \
gs://${UPLOAD_BUCKET}
gcloud storage cp ~/code/images/rainbow.jpg \
gs://${UPLOAD_BUCKET}
gcloud storage cp ~/code/images/vegas.jpg \
gs://${UPLOAD_BUCKET}
export COLLAGE_SCHED_SA=collage-schedule-sa
export COLLAGE_SERVICE=create-collage
export COLLAGE_SERVICE_REGION=$REGION
gcloud iam service-accounts create ${COLLAGE_SCHED_SA}
gcloud run services add-iam-policy-binding ${COLLAGE_SERVICE} \
--region=${COLLAGE_SERVICE_REGION} \
--member="serviceAccount:${COLLAGE_SCHED_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/run.invoker"
export SERVICE_REGION=$REGION
export SERVICE_NAME=create-collage
export URL=$(gcloud run services describe ${SERVICE_NAME} \
--platform managed \
--region ${SERVICE_REGION} \
--format 'value(status.url)')
gcloud scheduler jobs create http collage-schedule \
--location=$REGION \
--schedule="* * * * *" \
--time-zone="UTC" \
--http-method=POST \
--uri="$URL" \
--oidc-service-account-email=collage-schedule-sa@$DEVSHELL_PROJECT_ID.iam.gserviceaccount.com \
--oidc-token-audience="$URL"
export GENERATED_BUCKET=generated-images-${GOOGLE_CLOUD_PROJECT}
export IMAGE_NAME=collage.png
echo "generated collage: https://storage.googleapis.com/${GENERATED_BUCKET}/${IMAGE_NAME}"
echo "Listing of generated-images bucket:"
gcloud storage ls gs://${GENERATED_BUCKET}
export DELETE_TRIGGER_SA=delete-image-trigger-sa
export DELETE_SERVICE_REGION=$REGION
export DELETE_SERVICE=delete-image
gcloud iam service-accounts create ${DELETE_TRIGGER_SA}
gcloud projects add-iam-policy-binding ${GOOGLE_CLOUD_PROJECT} \
--member "serviceAccount:${DELETE_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/eventarc.eventReceiver"
gcloud run services add-iam-policy-binding ${DELETE_SERVICE} \
--region=${DELETE_SERVICE_REGION} \
--member="serviceAccount:${DELETE_TRIGGER_SA}@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com" \
--role="roles/run.invoker"
gcloud eventarc triggers create image-delete-trigger \
--location=$REGION \
--service-account=delete-image-trigger-sa@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com \
--destination-run-service=delete-image \
--destination-run-region=$REGION \
--destination-run-path="/" \
--event-filters="bucket=uploaded-images-$GOOGLE_CLOUD_PROJECT" \
--event-filters="type=google.cloud.storage.object.v1.deleted"
gcloud firestore indexes composite create \
--collection-group=images \
--field-config field-path=thumbnail,order=descending \
--field-config field-path=created,order=descending \
--async