-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yaml
106 lines (99 loc) · 2.83 KB
/
compose.yaml
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
services:
mongo:
image: mongo:latest
ports:
- 27017:27017
volumes:
- mongo_data:/data/db
command: ["mongod", "--replSet", "rs0", "--bind_ip_all"]
setup-mongo-replica:
image: mongo:latest
depends_on:
- mongo
entrypoint: >
sh -c "
until mongosh --eval 'print(1)' &>/dev/null; do
sleep 1
done;
mongosh --eval '
rs.initiate({
_id: \"rs0\",
members: [{ _id: 0, host: \"mongodb:27017\" }]
})'"
pubsub-emulator:
image: gcr.io/google.com/cloudsdktool/cloud-sdk:455.0.0-emulators
command: >
gcloud beta emulators pubsub start --project=dummy-project --host-port=0.0.0.0:8085 --quiet
environment: # TODO: use environment variables
PUBSUB_PROJECT_ID: "dummy-project"
PUBSUB_EMULATOR_HOST: "localhost:8085"
PUBSUB_TOPIC_ID: "dymmy-topic"
ports:
- "8085:8085"
entrypoint: /bin/bash
setup-pubsub-emulator:
image: gcr.io/google.com/cloudsdktool/cloud-sdk:455.0.0-emulators
depends_on:
- pubsub-emulator
environment:
PUBSUB_EMULATOR_HOST: "pubsub-emulator:8085"
command: |
bash -c "
until curl -X GET \"http://pubsub-emulator:8085\"; do
sleep 1
done
curl -X PUT "http://pubsub-emulator:8085/v1/projects/dummy-project/topics/dummy-topic"
"
mongo-streamer:
build:
context: .
restart: always
depends_on:
- setup-mongo-replica
- setup-pubsub-emulator
ports:
- "8080:8080"
develop:
watch:
- action: rebuild
path: .
ignore:
- .git
- .gitignore
- README.md
- ./bin
- ./monitors
environment:
MONGO_DB_URI: "mongodb://mongo:27017/test?tls=false&directConnection=true&retryWrites=false&replicaSet=rs0"
MONGO_DB_COLLECTION: tweets
MONGO_DB_DATABASE: test
METRICS_ADDR: :8080
PUBSUB_PROJECT_ID: "dummy-project"
PUBSUB_TOPIC_ID: "dummy-topic"
PUBSUB_EMULATOR_HOST: "pubsub-emulator:8085"
PUBSUB_PUBLISH_FORMAT: "json"
prometheus:
image: prom/prometheus
ports:
- "9090:9090"
volumes:
- ./monitors/prometheus/prometheus.yaml:/etc/prometheus/prometheus.yaml
- prometheus_data:/prometheus
command: "--config.file=/etc/prometheus/prometheus.yaml"
restart: always
grafana:
image: grafana/grafana
depends_on:
- prometheus
volumes:
- ./monitors/grafana/dashboards:/var/lib/grafana/dashboards
- ./monitors/grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
- ./monitors/grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
- grafana_data:/var/lib/grafana
ports:
- "3000:3000"
restart: always
volumes:
mongo_data:
prometheus_data:
grafana_data: