Comparer les révisions
5 Révisions
84bce44478
...
4aba88ab26
Auteur | SHA1 | Date |
---|---|---|
Mickael Asseline | 4aba88ab26 | |
Mickael Asseline | a99005205b | |
Mickael Asseline | a0fe21d322 | |
Mickael Asseline | e9a6068de4 | |
Mickael Asseline | b68fe1d560 |
|
@ -2,7 +2,7 @@
|
|||
title: Healthcheck
|
||||
description: S’assurer du bon fonctionnement de ses containers !
|
||||
published: true
|
||||
date: 2021-06-14T07:30:20.026Z
|
||||
date: 2022-05-13T13:33:50.088Z
|
||||
tags:
|
||||
editor: markdown
|
||||
dateCreated: 2021-05-24T10:34:19.750Z
|
||||
|
@ -32,7 +32,7 @@ Dans ce moment là, plusieurs solutions :
|
|||
- La supervision finit par vous remonter l'information et vous intervenez ( de façon automatique ou non ),
|
||||
- On intègre un healthcheck à notre service pour vérifier sa bonne santé et ainsi avoir l'information en temps réel.
|
||||
|
||||
# Healthcheck
|
||||
# Créer un healthcheck
|
||||
|
||||
Il est possible de déclarer un `HEALTHCHECK` de deux façons :
|
||||
|
||||
|
@ -162,5 +162,55 @@ Enfin sachez qu'il est tout simplement possible de désactiver dans votre `docke
|
|||
healthcheck:
|
||||
disable: true
|
||||
```
|
||||
Source : [grottedubarbu.fr](https://www.grottedubarbu.fr/docker-healthcheck/)
|
||||
|
||||
Source : [grottedubarbu.fr](https://www.grottedubarbu.fr/docker-healthcheck/)
|
||||
# Listes de Heathchecks
|
||||
|
||||
## MariaDB / MySQL
|
||||
```yaml
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
```
|
||||
|
||||
## PostgreSQL
|
||||
```yaml
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $DB_USER"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
```
|
||||
## Curl
|
||||
```yaml
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost:80 || exit 1
|
||||
interval: 1m
|
||||
timeout: 30s
|
||||
retries: 3
|
||||
```
|
||||
## Wget
|
||||
```yaml
|
||||
healthcheck:
|
||||
test: wget -nv -t1 --spider 'http://localhost:80'
|
||||
interval: 1m
|
||||
timeout: 30s
|
||||
retries: 3
|
||||
```
|
||||
## Sans curl ou wget
|
||||
```yaml
|
||||
healthcheck:
|
||||
test: ["CMD", "bash", "-c", "exec 5<>/dev/tcp/127.0.0.1/8000"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
```
|
||||
|
||||
```yaml
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "apt-get update -y && apt-get install -y curl && curl --fail http://localhost:8000 || exit 1"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
```
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket