-
Notifications
You must be signed in to change notification settings - Fork 1
/
start-dev.yml
180 lines (167 loc) · 4.96 KB
/
start-dev.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
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
---
- hosts: localhost
vars_files:
- "{{ playbook_dir }}/vars.yml"
tasks:
- debug:
msg: "========= 🚀 HOUSTON, WE ARE GO FOR LAUNCH 🚀 ========="
- name: Install docker on localhost
pip:
name: docker
state: present
- name: Create docker network
docker_network:
name: ps2alerts
state: present
- name: Start Traefik Router
docker_container:
name: ps2alerts-router
image: traefik:v2.9
state: started
recreate: yes
ports:
- 80:80
- 443:443
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- "{{ certs_dir }}:/etc/traefik/certs:ro"
- ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro
- ./traefik/dynamic_conf.yml:/etc/traefik/dynamic_conf.yml:ro
networks:
- name: "ps2alerts"
- name: Start Database
docker_container:
name: ps2alerts-db
image: mongo:6.0.5
state: started
volumes:
- "{{ db_dir }}:/data/db"
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_DATABASE: ps2alerts
MONGO_INITDB_ROOT_PASSWORD: "foobar" # Matches API's default
ports:
- 27017-27019:27017-27019
networks:
- name: "ps2alerts"
labels:
traefik.enable: "false"
- name: Start Redis
docker_container:
name: ps2alerts-redis
image: redis:6
state: started
volumes:
- "{{ redis_dir }}:/data"
ports:
- 6379:6379
networks:
- name: "ps2alerts"
labels:
traefik.enable: "false"
- name: Start RabbitMQ
docker_container:
name: ps2alerts-mq
image: rabbitmq:3.10-management
ports:
- 4369:4369
- 5672:5672
- 15672:15672
- 25672:25672
volumes:
- "{{ mq_dir }}:/var/lib/rabbitmq"
networks:
- name: "ps2alerts"
labels:
traefik.enable: "false"
- name: Start Prometheus
docker_container:
name: ps2alerts-prom
image: prom/prometheus
state: started
ports:
- 9090:9090
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- "{{ monitoring_dir }}/prometheus:/prometheus"
networks:
- name: "ps2alerts"
labels:
traefik.enable: "false"
- name: Start Grafana
docker_container:
name: ps2alerts-grafana
image: grafana/grafana
state: started
ports:
- 9091:3000
# We purposefully don't provision the alerts as you cannot edit them once they are provisioned!
volumes:
# - ./monitoring/grafana/provisioning/alerting:/etc/grafana/provisioning/alerting
- ./monitoring/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
- ./monitoring/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- ./monitoring/grafana/lib/dashboards:/var/lib/grafana_docker/dashboards
- "{{ monitoring_dir }}/grafana:/var/lib/grafana"
networks:
- name: "ps2alerts"
labels:
traefik.enable: "false"
- name: Wait for Rabbit to be fully available...
shell: curl --head --silent http://localhost:15672
register: result
until: result.stdout.find("200 OK") != -1
retries: 20
delay: 5
- name: Create RabbitMQ ps2alerts Exchange
rabbitmq_exchange:
name: ps2alerts
vhost: /
login_user: guest
login_password: "guest"
- name: Create RabbitMQ ps2alerts-census Exchange
rabbitmq_exchange:
name: ps2alerts-census
vhost: /
login_user: guest
login_password: "guest"
exchange_type: fanout
durable: no
- name: Create RabbitMQ ps2alerts-topic Exchange
rabbitmq_exchange:
name: ps2alerts-topic
vhost: /
login_user: guest
login_password: "guest"
exchange_type: topic
durable: yes
# - name: Create RabbitMQ ps2alerts Exchange
# rabbitmq_exchange:
# name: ps2alerts
# vhost: /
# login_user: guest
# login_password: "guest"
#
# - name: Create RabbitMQ ps2alerts-census Exchange
# rabbitmq_exchange:
# name: ps2alerts-census
# vhost: /
# login_user: guest
# login_password: "guest"
# exchange_type: fanout
# durable: no
#
# - name: Create RabbitMQ ps2alerts-topic Exchange
# rabbitmq_exchange:
# name: ps2alerts-topic
# vhost: /
# login_user: guest
# login_password: "guest"
# exchange_type: topic
# durable: yes
#
# - name: Create RabbitMQ census->topic exchange binding
# rabbitmq_binding:
# name: ps2alerts-census
# destination: ps2alerts-topic
# destination_type: exchange