eletrotupi / tcc/ docker-compose.ymlc121404b00d29de6d91827ce3a3fc0ede1a0c5ab
2.3 KB | 92 lines Raw
1
services:
2
  db:
3
    image: postgres:17-alpine
4
    shm_size: 1g
5
    user: postgres
6
    restart: always
7
    healthcheck:
8
      test: "pg_isready -U user --dbname=postgres"
9
      interval: 10s
10
      timeout: 5s
11
      retries: 5
12
    ports:
13
      - 5430:5432
14
    environment:
15
      POSTGRES_USER: user
16
      POSTGRES_DB: orbit_dev
17
      POSTGRES_PASSWORD: password
18
    volumes:
19
      - db_data:/var/lib/postgresql/data
20
    logging: &default-logging
21
      driver: json-file
22
      options:
23
        max-size: "${LOG_MAX_SIZE:-10m}"
24
        max-file: "${LOG_MAX_FILE:-3}"
25

26
  valkey:
27
    image: valkey/valkey:9.0-alpine
28
    ports:
29
      - '6379:6379'
30
    volumes:
31
      - valkey_data:/data
32
      - ./ansible/roles/app/files/valkey.conf:/etc/valkey/valkey.conf
33
    command: valkey-server /etc/valkey/valkey.conf
34
    environment:
35
      - ALLOW_EMPTY_PASSWORD=yes
36
    healthcheck:
37
      test: ["CMD", "valkey-cli", "ping"]
38
      interval: 10s
39
      timeout: 5s
40
      retries: 5
41
      start_period: 5s
42
    logging: *default-logging
43

44
  api:
45
    build: ./api
46
    volumes:
47
      - ./api:/app
48
      - /app/node_modules
49
    ports:
50
      - 3000:3000
51
    env_file:
52
      - api/.env.development
53
    depends_on:
54
      valkey:
55
        condition: service_healthy
56
      db:
57
        condition: service_healthy
58
    restart: always
59
    logging: *default-logging
60

61
  # Logs store — UI at http://localhost:9428/logs/select/vmui/ (loopback only)
62
  victorialogs:
63
    image: victoriametrics/victoria-logs:${VICTORIALOGS_TAG:-v1.53.0}
64
    command:
65
      - "-storageDataPath=/vlogs"
66
      - "-http.pathPrefix=/logs"
67
      - "-retentionPeriod=${VICTORIALOGS_RETENTION:-14d}"
68
      - "-retention.maxDiskSpaceUsageBytes=${VICTORIALOGS_MAX_DISK:-2GiB}"
69
    volumes:
70
      - vlogs_data:/vlogs
71
    ports:
72
      - "127.0.0.1:${VICTORIALOGS_PORT:-9428}:9428"
73
    restart: unless-stopped
74
    logging: *default-logging
75

76
  # Reads container logs through the Docker API and ships them to VictoriaLogs
77
  # `docker compose logs` keeps working: this does not replace the log driver
78
  vector:
79
    image: timberio/vector:${VECTOR_TAG:-0.59.X-distroless-libc}
80
    user: root
81
    volumes:
82
      - /var/run/docker.sock:/var/run/docker.sock:ro
83
      - ./ansible/roles/app/files/vector.yaml:/etc/vector/vector.yaml:ro
84
    depends_on:
85
      - victorialogs
86
    restart: unless-stopped
87
    logging: *default-logging
88

89
volumes:
90
  db_data:
91
  valkey_data:
92
  vlogs_data: