-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
74 lines (63 loc) · 4.51 KB
/
Makefile
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
# Default shell to use
SHELL := bash
# Reuse the same shell instance within a target
.ONESHELL:
# Set bash to fail immediately (-e), to error on unset variables (-u) and to fail on piped commands (pipefail)
.SHELLFLAGS := -eu -o pipefail -c
# Delete any generated target on failure
.DELETE_ON_ERROR:
# Make flags
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
# Shortcuts
DOCKER = $(shell which docker)
DOCKER_COMPOSE = $(DOCKER) compose
HTTPIE = docker run --network=host -ti --rm alpine/httpie
PHP = $(DOCKER_COMPOSE) exec app php
# Default target when run with just 'make'
default: start
.PHONY: start
start:
$(DOCKER_COMPOSE) up -d --remove-orphans
.PHONY: deps
deps:
$(PHP) composer.phar install
.PHONY: infrastructure
infrastructure:
$(DOCKER_COMPOSE) exec redis redis-cli flushall
$(HTTPIE) --auth guest:guest DELETE http://localhost:15672/api/queues/%2F/events/contents
$(HTTPIE) --auth guest:guest DELETE http://localhost:15672/api/queues/%2F/commands/contents
$(HTTPIE) --auth guest:guest DELETE http://localhost:15672/api/queues/%2F/projections/contents
$(HTTPIE) --auth guest:guest DELETE http://localhost:15672/api/queues/%2F/failed_messages/contents
$(PHP) bin/console doc:sch:drop --force
$(PHP) bin/console doc:sch:create
$(PHP) bin/console messenger:setup-transports
.PHONY: stop
stop:
$(DOCKER_COMPOSE) --profile async-events --profile async-commands --profile async-projections stop
.PHONY: demo
demo:
$(HTTPIE) --json --body http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/followers-counter
$(HTTPIE) --json --body http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/timeline
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/author author_id='a64a52cc-3ee9-4a15-918b-099e18b43119' username='bob' email='[email protected]'
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/author author_id='1fd7d739-2ad7-41a8-8c18-565603e3733f' username='alice' email='[email protected]'
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/author author_id='1da1366f-b066-4514-9b29-7346df41e371' username='charlie' email='[email protected]'
$(PHP) bin/console messenger:consume events_async --limit 3 -vv
$(HTTPIE) --json --body http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/followers-counter
$(HTTPIE) --json --body http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/timeline
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/follow follow_id='8cc71bf2-f827-4c92-95a5-43bb1bc622ad' from_author_id='1fd7d739-2ad7-41a8-8c18-565603e3733f' to_author_id='a64a52cc-3ee9-4a15-918b-099e18b43119'
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/follow follow_id='f3088920-841e-4577-a3c2-efdc80f0dea5' from_author_id='1da1366f-b066-4514-9b29-7346df41e371' to_author_id='a64a52cc-3ee9-4a15-918b-099e18b43119'
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/follow follow_id='f3088920-841e-4577-a3c2-efdc80f0dea5' from_author_id='1da1366f-b066-4514-9b29-7346df41e371' to_author_id='a64a52cc-3ee9-4a15-918b-099e18b43119'
$(PHP) bin/console messenger:consume commands_async --limit 3 -vv
$(HTTPIE) --json http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/followers-counter
$(PHP) bin/console messenger:consume events_async --limit 2 -vv
$(HTTPIE) --json http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/followers-counter
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/cheep cheep_id='28bc90bd-2dfb-4b71-962f-81f02b0b3149' author_id='a64a52cc-3ee9-4a15-918b-099e18b43119' message='Hello world, this is Bob'
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/cheep cheep_id='04efc3af-59a3-4695-803f-d37166c3af56' author_id='1fd7d739-2ad7-41a8-8c18-565603e3733f' message='Hello world, this is Alice'
$(HTTPIE) --json --body POST http://127.0.0.1:8000/chapter7/cheep cheep_id='8a5539e6-3be2-4fa7-906e-179efcfca46b' author_id='1da1366f-b066-4514-9b29-7346df41e371' message='Hello world, this is Charlie'
$(PHP) bin/console messenger:consume commands_async --limit 3 -vv
$(PHP) bin/console messenger:consume events_async --limit 3 -vv
$(PHP) bin/console messenger:consume projections_async --limit 2 -vv
$(HTTPIE) --json --body http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/timeline
$(HTTPIE) --json --body http://127.0.0.1:8000/chapter7/author/1fd7d739-2ad7-41a8-8c18-565603e3733f/timeline
$(HTTPIE) --json --body http://127.0.0.1:8000/chapter7/author/1da1366f-b066-4514-9b29-7346df41e371/timeline