feat(service): add healthchecks to evolution-api service (#6607)

This commit is contained in:
desarrollonextpro
2026-01-04 15:52:05 -05:00
committed by GitHub
parent 5899b4b241
commit c5ba28b686
2 changed files with 1604 additions and 6482 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8,14 +8,16 @@
version: '3.8' version: '3.8'
services: services:
api: api:
image: 'evoapicloud/evolution-api:latest' # Change to specific version if needed. image: 'evoapicloud/evolution-api:v2.3.4'
restart: always
depends_on: depends_on:
- redis postgres:
- postgres condition: service_healthy
redis:
condition: service_healthy
environment: environment:
- SERVICE_URL_EVO_8080 - SERVICE_URL_EVO_8080
- SERVER_URL=$SERVICE_URL_EVO - SERVER_URL=${SERVICE_URL_EVO}
- DB_TYPE=${DB_TYPE:-postgresdb} - DB_TYPE=${DB_TYPE:-postgresdb}
- 'DB_POSTGRESDB_DATABASE=${POSTGRES_DB:-postgres}' - 'DB_POSTGRESDB_DATABASE=${POSTGRES_DB:-postgres}'
- DB_POSTGRESDB_HOST=${DB_POSTGRESDB_HOST:-postgres} - DB_POSTGRESDB_HOST=${DB_POSTGRESDB_HOST:-postgres}
@@ -137,13 +139,32 @@ services:
volumes: volumes:
- 'evolution_instances:/evolution/instances' - 'evolution_instances:/evolution/instances'
expose: expose:
- 8080 - "8080"
healthcheck:
# Internal healthcheck: success if "/" returns 2xx (sin curl/wget)
test:
- CMD-SHELL
- >
node -e "require('http')
.get('http://127.0.0.1:8080/',r=>process.exit(r.statusCode>=200&&r.statusCode<300?0:1))
.on('error',()=>process.exit(1))"
interval: 10s
timeout: 5s
retries: 30
start_period: 60s
redis: redis:
image: 'redis:latest' image: 'redis:7-alpine'
command: "redis-server --port 6379 --appendonly yes\n" command: "redis-server --port 6379 --appendonly yes\n"
restart: always
volumes: volumes:
- 'evolution_redis:/data' - 'evolution_redis:/data'
healthcheck:
test: ["CMD", "redis-cli", "-h", "127.0.0.1", "ping"]
interval: 5s
timeout: 3s
retries: 20
start_period: 5s
postgres: postgres:
image: 'postgres:16-alpine' image: 'postgres:16-alpine'
command: command:
@@ -155,10 +176,18 @@ services:
- 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}' - 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}'
- 'POSTGRES_DB=${POSTGRES_DB:-postgres}' - 'POSTGRES_DB=${POSTGRES_DB:-postgres}'
- 'AUTHENTICATION_API_KEY=${SERVICE_PASSWORD_AUTHENTICATIONAPIKEY}' - 'AUTHENTICATION_API_KEY=${SERVICE_PASSWORD_AUTHENTICATIONAPIKEY}'
restart: always
volumes: volumes:
- 'postgres_data:/var/lib/postgresql/data' - 'postgres_data:/var/lib/postgresql/data'
healthcheck:
test:
- CMD-SHELL
- 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB} -h 127.0.0.1'
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
volumes: volumes:
evolution_instances: null evolution_instances:
evolution_redis: null evolution_redis:
postgres_data: null postgres_data: