eletrotupi / tcc/ commit / 96e7fe0

all: wait for valkey to be healthy

Pedro Lucas Porcellis porcellis@eletrotupi.com · 5 months ago 96e7fe0f1dcc90b9ddef3032a78b7040d2068378 Browse files
Parents 031a372
Changed files
1
Additions
+7
Deletions
-1
docker-compose.yml modified+7 -1
docker-compose.yml
1 1
services:
2 2
  db:
3 3
    image: postgres:17-alpine
4 4
    shm_size: 1g
5 5
    user: postgres
26 26
      - valkey_data:/data
27 27
      - ./etc/valkey.conf:/etc/valkey/valkey.conf
28 28
    command: valkey-server /etc/valkey/valkey.conf
29 29
    environment:
30 30
      - ALLOW_EMPTY_PASSWORD=yes
31 +
    healthcheck:
32 +
      test: ["CMD", "valkey-cli", "ping"]
33 +
      interval: 10s
34 +
      timeout: 5s
35 +
      retries: 5
36 +
      start_period: 5s
31 37

32 38
  api:
33 39
    build: ./api
34 40
    volumes:
35 41
      - ./api:/app
38 44
      - 3000:3000
39 45
    env_file:
40 46
      - api/.env.development
41 47
    depends_on:
42 48
      valkey:
43 -
        condition: service_started
49 +
        condition: service_healthy
44 50
      db:
45 51
        condition: service_healthy
46 52
    restart: always
47 53

48 54
volumes:
49 55
  db_data:
50 56
  valkey_data: