-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
63 lines (59 loc) · 2.51 KB
/
docker-compose.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
version: "3.7"
services:
publisher:
restart: on-failure
build: ./publisher
image: jooki997/your-delivery-producer
ports:
- 8090:8090
environment:
- SPRING_PROFILES_ACTIVE=docker
depends_on:
- aws-setup
container_name: publisher
consumer:
restart: on-failure
build: ./consumer
image: jooki997/your-delivery-consumer
ports:
- 8095:8095
environment:
- SPRING_PROFILES_ACTIVE=docker
depends_on:
- aws-setup
container_name: consumer
localstack:
image: localstack/localstack:2.0.2
container_name: localstack
ports:
- "4566-4597:4566-4597"
environment:
SERVICES: sns,sqs
AWS_DEFAULT_REGION: eu-central-1
AWS_ACCESS_KEY_ID: ACCESS_KEY
AWS_SECRET_ACCESS_KEY: SECRET_ACCESS_KEY
aws-setup:
image: amazon/aws-cli:2.11.21
container_name: aws-setup
environment:
AWS_DEFAULT_REGION: eu-central-1
AWS_ACCESS_KEY_ID: ACCESS_KEY
AWS_SECRET_ACCESS_KEY: SECRET_ACCESS_KEY
entrypoint: /bin/sh -c
command: >
"
sleep 20
aws sns create-topic --name delivery --endpoint-url http://localstack:4566
echo Topic created
aws sqs create-queue --endpoint-url http://localstack:4566 --queue-name notification
aws sqs create-queue --endpoint-url http://localstack:4566 --queue-name inventory
aws sqs create-queue --endpoint-url http://localstack:4566 --queue-name shipment
echo Queues created
aws --endpoint-url http://localstack:4566 sns subscribe --topic-arn arn:aws:sns:eu-central-1:000000000000:delivery --protocol sqs --notification-endpoint arn:aws:sqs:eu-central-1:000000000000:notification --attributes '{\"RawMessageDelivery\": \"true\", \"FilterPolicy\": \"{\\\"type\\\": [\\\"NOTIFICATION\\\"]}\"}'
aws --endpoint-url http://localstack:4566 sns subscribe --topic-arn arn:aws:sns:eu-central-1:000000000000:delivery --protocol sqs --notification-endpoint arn:aws:sqs:eu-central-1:000000000000:inventory --attributes '{\"RawMessageDelivery\": \"true\", \"FilterPolicy\": \"{\\\"type\\\": [\\\"INVENTORY\\\"]}\"}'
aws --endpoint-url http://localstack:4566 sns subscribe --topic-arn arn:aws:sns:eu-central-1:000000000000:delivery --protocol sqs --notification-endpoint arn:aws:sqs:eu-central-1:000000000000:shipment --attributes '{\"RawMessageDelivery\": \"true\", \"FilterPolicy\": \"{\\\"type\\\": [\\\"SHIPMENT\\\"]}\"}'
echo Subscribed queues to topic
echo All done
"
depends_on:
- localstack