forked from cambierelliot/E4-DataEngineerProject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
83 lines (75 loc) · 2.19 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
version: '3.8'
services:
elasticsearch:
container_name: elasticsearch
image: elasticsearch:8.15.2
ports:
- "9200:9200"
- "9300:9300"
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- logger.level=warn
healthcheck:
test: ["CMD", "curl", "-f", "http://elasticsearch:9200"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s # Allow Elasticsearch time to initialize
networks:
- mynetwork
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
- ./aws_config:/usr/share/elasticsearch/.aws:ro # If using S3 plugin
mongodb:
container_name: mongodb
image: mongo:6.0
ports:
- "27017:27017"
networks:
- mynetwork
volumes:
- mongodb_data:/data/db # Volume for MongoDB data persistence
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=examplepassword
command: ["mongod", "--bind_ip_all"] # Ensure MongoDB listens for connections on all interfaces
scraping:
container_name: scraping
build:
context: ./gaultmillau_scraper
depends_on:
elasticsearch:
condition: service_healthy
networks:
- mynetwork
command: >
sh -c "
if curl -s http://elasticsearch:9200/gaultmillau_restaurants | grep 'index_not_found_exception';
then scrapy crawl gaultmillau;
else echo 'Data already present in Elasticsearch, skipping scraping';
fi"
restart: "no"
flask:
container_name: flask
build:
context: ./Api_WEB # Dossier contenant le code Flask (à adapter si nécessaire)
depends_on:
scraping:
condition: service_completed_successfully # Démarre une fois le scraping terminé
ports:
- "5000:5000"
networks:
- mynetwork
environment:
- ELASTICSEARCH_HOST=http://elasticsearch:9200
- MONGO_URI=mongodb://root:examplepassword@mongodb:27017 # MongoDB URI for Flask
- FLASK_APP=FlaskApp/app.py
- FLASK_ENV=development
command: ["flask", "run", "--host=0.0.0.0", "--port=5000"]
networks:
mynetwork:
driver: bridge
volumes:
elasticsearch_data:
mongodb_data: