File size: 4,399 Bytes
7758a4b
116bb4e
7758a4b
 
116bb4e
7758a4b
 
116bb4e
 
 
 
4d9d78e
 
 
 
116bb4e
 
 
4d9d78e
 
 
116bb4e
4d9d78e
116bb4e
4d9d78e
 
 
 
 
116bb4e
 
 
 
 
4d9d78e
 
116bb4e
 
 
4d9d78e
 
116bb4e
 
 
 
 
 
 
4d9d78e
 
 
 
 
 
116bb4e
4d9d78e
116bb4e
 
 
4d9d78e
116bb4e
 
 
4d9d78e
116bb4e
4d9d78e
 
 
 
 
116bb4e
 
 
 
 
 
 
 
 
 
4d9d78e
 
 
 
 
 
116bb4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d9d78e
 
 
 
 
 
116bb4e
 
 
 
 
 
 
4d9d78e
116bb4e
 
 
 
4d9d78e
 
 
116bb4e
4d9d78e
 
 
 
 
 
 
116bb4e
 
 
 
7758a4b
116bb4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7758a4b
 
 
116bb4e
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
services:
  # Base application
  app:
    build: .
    image: synthetic-data-generator:app
    ports:
      - "7860:7860"
    env_file:
      - .env
    environment:
      - HF_TOKEN=${HF_TOKEN}
    networks:
      - app-network
    depends_on:
      argilla:
        condition: service_started
        required: false
      ollama:
        condition: service_healthy
        required: false

  # Ollama service
  ollama:
    # CPU/NVIDIA usa latest, AMD usa rocm
    image: ollama/ollama:${OLLAMA_HARDWARE:-latest}
    profiles:
      - with-ollama
    ports:
      - "11434:11434"
    command: serve #&& pull ${OLLAMA_MODEL} && run ${OLLAMA_MODEL}
    env_file:
      - .env
    environment:
      - OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-}
    volumes:
      - ollama_data:/root/.ollama
      # only AMD if OLLAMA_HARDWARE=rocm
      - /dev/kfd:/dev/kfd:${OLLAMA_HARDWARE:-none}=rocm
      - /dev/dri:/dev/dri:${OLLAMA_HARDWARE:-none}=rocm
    networks:
      - app-network
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:11434/api/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  # Elasticsearch service for Argilla
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
    profiles:
      - with-argilla
    environment:
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
      - node.name=elasticsearch
      - cluster.name=es-argilla-local
      - discovery.type=single-node
      - cluster.routing.allocation.disk.threshold_enabled=false
      - xpack.security.enabled=false
    volumes:
      - es_data:/usr/share/elasticsearch/data
    networks:
      - app-network
    ports:
      - "9200:9200"
      - "9300:9300"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9200"]
      interval: 30s
      timeout: 10s
      retries: 3

  # PostgreSQL service for Argilla
  postgres:
    image: postgres:14
    profiles:
      - with-argilla
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: argilla
    networks:
      - app-network
    volumes:
      - postgres_data:/var/lib/postgresql/data

  # Redis service for Argilla
  redis:
    image: redis
    profiles:
      - with-argilla
    networks:
      - app-network

  # Argilla service
  argilla:
    image: argilla/argilla-server:latest
    profiles:
      - with-argilla
    ports:
      - "6900:6900"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:6900/api/ready"]
      interval: 30s
      timeout: 10s
      retries: 3
    env_file:
      - .env
    environment:
      - ARGILLA_HOME_PATH=/var/lib/argilla
      - ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
      - ARGILLA_DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/argilla
      - ARGILLA_REDIS_URL=redis://redis:6379/0
      - USERNAME=${ARGILLA_USERNAME}
      - PASSWORD=${ARGILLA_PASSWORD}
      - API_KEY=${ARGILLA_API_KEY}
      - WORKSPACE=default
    volumes:
      - argilla_data:/argilla
    networks:
      - app-network
    depends_on:
      elasticsearch:
        condition: service_healthy
      postgres:
        condition: service_started
      redis:
        condition: service_started

  # Argilla Worker
  worker:
    image: argilla/argilla-server:latest
    profiles:
      - with-argilla
    env_file:
      - .env
    environment:
      - ARGILLA_HOME_PATH=/var/lib/argilla
      - ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
      - ARGILLA_DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/argilla
      - ARGILLA_REDIS_URL=redis://redis:6379/0
      - BACKGROUND_NUM_WORKERS=2
      - USERNAME=${ARGILLA_USERNAME}
      - PASSWORD=${ARGILLA_PASSWORD}
      - API_KEY=${ARGILLA_API_KEY}
      - WORKSPACE=default
    networks:
      - app-network
    depends_on:
      - postgres
      - elasticsearch
      - redis
    command: sh -c 'python -m argilla_server worker --num-workers $${BACKGROUND_NUM_WORKERS}'

networks:
  app-network:
    driver: bridge

volumes:
  es_data:
    driver: local
  argilla_data:
    driver: local
  ollama_data:
    driver: local
  postgres_data:
    driver: local