ajout du TP5/6
This commit is contained in:
parent
64dc0e433d
commit
cc92379958
102
README.md
102
README.md
@ -70,7 +70,7 @@ services:
|
|||||||
- ./nginx:/etc/nginx/conf.d
|
- ./nginx:/etc/nginx/conf.d
|
||||||
```
|
```
|
||||||
|
|
||||||
**Étape 6** : Pour initialiser la base de données deux méthodes s'offrent à nous. La première en se connectant directement au serveur REDIS et la deuxième en utilisant l'interface REDISINSIGHT.
|
**Étape 7** : Pour initialiser la base de données deux méthodes s'offrent à nous. La première en se connectant directement au serveur REDIS et la deuxième en utilisant l'interface REDISINSIGHT.
|
||||||
- **Première solution**
|
- **Première solution**
|
||||||
- Démarrer docker avec la commande ``docker compose up -d``
|
- Démarrer docker avec la commande ``docker compose up -d``
|
||||||
- Effectuer la commande ``docker ps`` afin de lister tous conteneurs
|
- Effectuer la commande ``docker ps`` afin de lister tous conteneurs
|
||||||
@ -82,3 +82,103 @@ services:
|
|||||||
|
|
||||||
- **Deuxième solution**
|
- **Deuxième solution**
|
||||||
# TP 5/6
|
# TP 5/6
|
||||||
|
|
||||||
|
**Étape 1** : Il faut utiliser de nouveau ce qu'on a fait lors du TP4 afin de faire la mise en réseau.
|
||||||
|
Pour cela nous allons tout d'abord ajouter ceci :
|
||||||
|
```yml
|
||||||
|
networks:
|
||||||
|
- back
|
||||||
|
```
|
||||||
|
Sur le service REDIS, REDISINSIGHT
|
||||||
|
```yml
|
||||||
|
networks:
|
||||||
|
- front
|
||||||
|
```
|
||||||
|
Sur le service NGINX
|
||||||
|
```yml
|
||||||
|
networks:
|
||||||
|
- front
|
||||||
|
- back
|
||||||
|
```
|
||||||
|
Sur le service PHP
|
||||||
|
Et un bloc networks à la fin du fichier :
|
||||||
|
```yml
|
||||||
|
networks:
|
||||||
|
front:
|
||||||
|
back:
|
||||||
|
```
|
||||||
|
|
||||||
|
**Étape 2** : On va commencer par faire un docker compose contenant les services de cadvisor et de node exporter.
|
||||||
|
Pour la partie cadvisor on va mettre
|
||||||
|
```yml
|
||||||
|
services:
|
||||||
|
cadvisor:
|
||||||
|
image: google/cadvisor:latest
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /:/rootfs:ro
|
||||||
|
- /var/run:/var/run:rw
|
||||||
|
- /sys:/sys:ro
|
||||||
|
- /var/lib/docker/:/var/lib/docker:ro*
|
||||||
|
```
|
||||||
|
|
||||||
|
Et pour la partie node exporter
|
||||||
|
```yml
|
||||||
|
services:
|
||||||
|
node-exporter:
|
||||||
|
image: prom/node-exporter:latest
|
||||||
|
ports:
|
||||||
|
- "9100:9100"
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
|
||||||
|
**Étape 3** : Maintenant on va faire un docker compose pour le service de prometheus
|
||||||
|
```yml
|
||||||
|
services:
|
||||||
|
prometheus:
|
||||||
|
image: prom/prometheus:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./prometheus/:/etc/prometheus/
|
||||||
|
ports:
|
||||||
|
- "9090:9090"
|
||||||
|
```
|
||||||
|
|
||||||
|
⚠️ Attention, il ne faut pas oublier de faire le fichier de configuration de prometheus (prometheus.yml) et ensuite de la mettre dans un dossier prometheus
|
||||||
|
```yml
|
||||||
|
global:
|
||||||
|
scrape_interval: 1m
|
||||||
|
evaluation_interval: 1m
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: 'prometheus'
|
||||||
|
|
||||||
|
scrape_interval: 1m
|
||||||
|
|
||||||
|
static_configs:
|
||||||
|
- targets: ['localhost:9090']
|
||||||
|
|
||||||
|
- job_name: 'node'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['node-exporter:9100']
|
||||||
|
|
||||||
|
- job_name: 'cadvisor'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['cadvisor:8080']
|
||||||
|
```
|
||||||
|
|
||||||
|
Ce fichier de configuration va nous permettre de faire le lien entre le service prometheus et les services cadvisor et node exporter
|
||||||
|
|
||||||
|
**Étape 4** : Maintenant il ne reste plus qu'à faire le docker compose pour le service Grafana.
|
||||||
|
```yml
|
||||||
|
services:
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana:latest
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
|
||||||
|
**Étape 5** :
|
17
TP5-6/docker-compose-cadvisor.yml
Normal file
17
TP5-6/docker-compose-cadvisor.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
services:
|
||||||
|
cadvisor:
|
||||||
|
image: google/cadvisor:latest
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /:/rootfs:ro
|
||||||
|
- /var/run:/var/run:rw
|
||||||
|
- /sys:/sys:ro
|
||||||
|
- /var/lib/docker/:/var/lib/docker:ro*
|
||||||
|
|
||||||
|
node-exporter:
|
||||||
|
image: prom/node-exporter:latest
|
||||||
|
ports:
|
||||||
|
- 9100:9100
|
||||||
|
restart: unless-stopped
|
6
TP5-6/docker-compose-grafana.yml
Normal file
6
TP5-6/docker-compose-grafana.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
services:
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana:latest
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
restart: unless-stopped
|
8
TP5-6/docker-compose-prometheus.yml
Normal file
8
TP5-6/docker-compose-prometheus.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
services:
|
||||||
|
prometheus:
|
||||||
|
image: prom/prometheus:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./prometheus/:/etc/prometheus/
|
||||||
|
ports:
|
||||||
|
- 9090:9090
|
19
TP5-6/prometheus/prometheus.yml
Normal file
19
TP5-6/prometheus/prometheus.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
global:
|
||||||
|
scrape_interval: 1m
|
||||||
|
evaluation_interval: 1m
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: 'prometheus'
|
||||||
|
|
||||||
|
scrape_interval: 1m
|
||||||
|
|
||||||
|
static_configs:
|
||||||
|
- targets: ['localhost:9090']
|
||||||
|
|
||||||
|
- job_name: 'node'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['node-exporter:9100']
|
||||||
|
|
||||||
|
- job_name: 'cadvisor'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['cadvisor:8080']
|
Loading…
Reference in New Issue
Block a user