-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
174 lines (165 loc) · 4.81 KB
/
Copy pathdocker-compose.yml
File metadata and controls
174 lines (165 loc) · 4.81 KB
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
#version: '3.8'
services:
# API FastAPI
api:
build:
context: .
dockerfile: infrastructure/docker/Dockerfile
container_name: sentiment-api
ports:
- "8080:8080" # API
- "8000:8000" # Metrics Prometheus
volumes:
- model-cache:/app/models/cache
- dataset-volume:/app/data/datasets/cached:rw
- ./results:/app/results
environment:
- METRICS_PORT=8000
networks:
- sentiment-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
# Prometheus
prometheus:
image: prom/prometheus:latest
container_name: sentiment-prometheus
ports:
- "9090:9090"
volumes:
- ./infrastructure/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
networks:
- sentiment-network
depends_on:
- api
restart: unless-stopped
# Grafana
grafana:
image: grafana/grafana:latest
container_name: sentiment-grafana
ports:
- "3000:3000"
volumes:
- ./infrastructure/grafana/provisioning:/etc/grafana/provisioning
- ./infrastructure/grafana/dashboards:/var/lib/grafana/dashboards
- grafana-data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
networks:
- sentiment-network
depends_on:
- prometheus
restart: unless-stopped
# Airflow
airflow-init:
build:
context: .
dockerfile: infrastructure/airflow/Dockerfile
image: apache/airflow:2.6.3
depends_on:
- postgres
environment:
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=46BKJoQYlPPOexq0OhDZnIlNepKFf87WFwLbfzqDDho=
- AIRFLOW__CORE__LOAD_EXAMPLES=False
volumes:
- ./infrastructure/airflow/dags:/opt/airflow/dags
- ./infrastructure/airflow/logs:/opt/airflow/logs
- ./infrastructure/airflow/plugins:/opt/airflow/plugins
entrypoint: /bin/bash
command: -c "airflow db init"
networks:
- sentiment-network
airflow-webserver:
build:
context: .
dockerfile: infrastructure/airflow/Dockerfile
container_name: airflow-webserver
image: apache/airflow:2.6.3
environment:
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=46BKJoQYlPPOexq0OhDZnIlNepKFf87WFwLbfzqDDho=
- AIRFLOW__CORE__LOAD_EXAMPLES=False
- AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION=True
ports:
- "8088:8080"
volumes:
- ./infrastructure/airflow/dags:/opt/airflow/dags
- ./infrastructure/airflow/logs:/opt/airflow/logs
- ./infrastructure/airflow/plugins:/opt/airflow/plugins
depends_on:
- postgres
networks:
- sentiment-network
command: webserver
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 5
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
airflow-scheduler:
build:
context: .
dockerfile: infrastructure/airflow/Dockerfile
container_name: airflow-scheduler
image: apache/airflow:2.6.3
environment:
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=46BKJoQYlPPOexq0OhDZnIlNepKFf87WFwLbfzqDDho=
- AIRFLOW__CORE__LOAD_EXAMPLES=False
volumes:
- ./infrastructure/airflow/dags:/opt/airflow/dags
- ./infrastructure/airflow/logs:/opt/airflow/logs
- ./infrastructure/airflow/plugins:/opt/airflow/plugins
depends_on:
- postgres
networks:
- sentiment-network
command: scheduler
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
postgres:
image: postgres:13
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
volumes:
- postgres-db-volume:/var/lib/postgresql/data
networks:
- sentiment-network
restart: always
networks:
sentiment-network:
driver: bridge
volumes:
model-cache:
dataset-volume:
prometheus-data:
grafana-data:
postgres-db-volume: