Spaces:
Build error
Build error
Add docker-compose service setup
Browse files- docker-compose.yml +118 -20
docker-compose.yml
CHANGED
|
@@ -1,65 +1,134 @@
|
|
| 1 |
-
version: '3.8'
|
| 2 |
-
|
| 3 |
services:
|
|
|
|
| 4 |
app:
|
| 5 |
build: .
|
|
|
|
| 6 |
ports:
|
| 7 |
- "7860:7860"
|
| 8 |
-
env_file:
|
|
|
|
|
|
|
|
|
|
| 9 |
networks:
|
| 10 |
- app-network
|
| 11 |
depends_on:
|
| 12 |
-
ollama:
|
| 13 |
-
condition: service_healthy
|
| 14 |
-
required: false
|
| 15 |
argilla:
|
|
|
|
|
|
|
|
|
|
| 16 |
condition: service_healthy
|
| 17 |
required: false
|
| 18 |
|
|
|
|
| 19 |
ollama:
|
|
|
|
| 20 |
image: ollama/ollama:${OLLAMA_HARDWARE:-latest}
|
| 21 |
profiles:
|
| 22 |
- with-ollama
|
| 23 |
ports:
|
| 24 |
- "11434:11434"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
volumes:
|
| 26 |
- ollama_data:/root/.ollama
|
|
|
|
|
|
|
|
|
|
| 27 |
networks:
|
| 28 |
- app-network
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
healthcheck:
|
| 30 |
test: ["CMD", "curl", "-f", "http://localhost:11434/api/health"]
|
| 31 |
interval: 30s
|
| 32 |
timeout: 10s
|
| 33 |
retries: 3
|
| 34 |
-
command: ollama serve
|
| 35 |
|
|
|
|
| 36 |
elasticsearch:
|
| 37 |
-
image: docker.elastic.co/elasticsearch/elasticsearch:
|
|
|
|
|
|
|
| 38 |
environment:
|
|
|
|
|
|
|
|
|
|
| 39 |
- discovery.type=single-node
|
|
|
|
| 40 |
- xpack.security.enabled=false
|
| 41 |
volumes:
|
| 42 |
- es_data:/usr/share/elasticsearch/data
|
| 43 |
networks:
|
| 44 |
- app-network
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
healthcheck:
|
| 46 |
test: ["CMD", "curl", "-f", "http://localhost:9200"]
|
| 47 |
interval: 30s
|
| 48 |
timeout: 10s
|
| 49 |
retries: 3
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
argilla:
|
| 52 |
image: argilla/argilla-server:latest
|
| 53 |
profiles:
|
| 54 |
- with-argilla
|
| 55 |
ports:
|
| 56 |
- "6900:6900"
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
environment:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
- USERNAME=${ARGILLA_USERNAME}
|
| 60 |
- PASSWORD=${ARGILLA_PASSWORD}
|
| 61 |
- API_KEY=${ARGILLA_API_KEY}
|
| 62 |
-
-
|
| 63 |
volumes:
|
| 64 |
- argilla_data:/argilla
|
| 65 |
networks:
|
|
@@ -67,17 +136,46 @@ services:
|
|
| 67 |
depends_on:
|
| 68 |
elasticsearch:
|
| 69 |
condition: service_healthy
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
retries: 3
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
networks:
|
| 82 |
app-network:
|
| 83 |
-
driver: bridge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
services:
|
| 2 |
+
# Base application
|
| 3 |
app:
|
| 4 |
build: .
|
| 5 |
+
image: synthetic-data-generator:app
|
| 6 |
ports:
|
| 7 |
- "7860:7860"
|
| 8 |
+
env_file:
|
| 9 |
+
- .env
|
| 10 |
+
environment:
|
| 11 |
+
- HF_TOKEN=${HF_TOKEN}
|
| 12 |
networks:
|
| 13 |
- app-network
|
| 14 |
depends_on:
|
|
|
|
|
|
|
|
|
|
| 15 |
argilla:
|
| 16 |
+
condition: service_started
|
| 17 |
+
required: false
|
| 18 |
+
ollama:
|
| 19 |
condition: service_healthy
|
| 20 |
required: false
|
| 21 |
|
| 22 |
+
# Ollama service
|
| 23 |
ollama:
|
| 24 |
+
# CPU/NVIDIA usa latest, AMD usa rocm
|
| 25 |
image: ollama/ollama:${OLLAMA_HARDWARE:-latest}
|
| 26 |
profiles:
|
| 27 |
- with-ollama
|
| 28 |
ports:
|
| 29 |
- "11434:11434"
|
| 30 |
+
command: serve #&& pull ${OLLAMA_MODEL} && run ${OLLAMA_MODEL}
|
| 31 |
+
env_file:
|
| 32 |
+
- .env
|
| 33 |
+
environment:
|
| 34 |
+
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-}
|
| 35 |
volumes:
|
| 36 |
- ollama_data:/root/.ollama
|
| 37 |
+
# only AMD if OLLAMA_HARDWARE=rocm
|
| 38 |
+
- /dev/kfd:/dev/kfd:${OLLAMA_HARDWARE:-none}=rocm
|
| 39 |
+
- /dev/dri:/dev/dri:${OLLAMA_HARDWARE:-none}=rocm
|
| 40 |
networks:
|
| 41 |
- app-network
|
| 42 |
+
deploy:
|
| 43 |
+
resources:
|
| 44 |
+
reservations:
|
| 45 |
+
devices:
|
| 46 |
+
- driver: nvidia
|
| 47 |
+
count: all
|
| 48 |
+
capabilities: [gpu]
|
| 49 |
healthcheck:
|
| 50 |
test: ["CMD", "curl", "-f", "http://localhost:11434/api/health"]
|
| 51 |
interval: 30s
|
| 52 |
timeout: 10s
|
| 53 |
retries: 3
|
|
|
|
| 54 |
|
| 55 |
+
# Elasticsearch service for Argilla
|
| 56 |
elasticsearch:
|
| 57 |
+
image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
|
| 58 |
+
profiles:
|
| 59 |
+
- with-argilla
|
| 60 |
environment:
|
| 61 |
+
- ES_JAVA_OPTS=-Xms512m -Xmx512m
|
| 62 |
+
- node.name=elasticsearch
|
| 63 |
+
- cluster.name=es-argilla-local
|
| 64 |
- discovery.type=single-node
|
| 65 |
+
- cluster.routing.allocation.disk.threshold_enabled=false
|
| 66 |
- xpack.security.enabled=false
|
| 67 |
volumes:
|
| 68 |
- es_data:/usr/share/elasticsearch/data
|
| 69 |
networks:
|
| 70 |
- app-network
|
| 71 |
+
ports:
|
| 72 |
+
- "9200:9200"
|
| 73 |
+
- "9300:9300"
|
| 74 |
+
ulimits:
|
| 75 |
+
memlock:
|
| 76 |
+
soft: -1
|
| 77 |
+
hard: -1
|
| 78 |
+
nofile:
|
| 79 |
+
soft: 65536
|
| 80 |
+
hard: 65536
|
| 81 |
healthcheck:
|
| 82 |
test: ["CMD", "curl", "-f", "http://localhost:9200"]
|
| 83 |
interval: 30s
|
| 84 |
timeout: 10s
|
| 85 |
retries: 3
|
| 86 |
|
| 87 |
+
# PostgreSQL service for Argilla
|
| 88 |
+
postgres:
|
| 89 |
+
image: postgres:14
|
| 90 |
+
profiles:
|
| 91 |
+
- with-argilla
|
| 92 |
+
environment:
|
| 93 |
+
POSTGRES_USER: postgres
|
| 94 |
+
POSTGRES_PASSWORD: postgres
|
| 95 |
+
POSTGRES_DB: argilla
|
| 96 |
+
networks:
|
| 97 |
+
- app-network
|
| 98 |
+
volumes:
|
| 99 |
+
- postgres_data:/var/lib/postgresql/data
|
| 100 |
+
|
| 101 |
+
# Redis service for Argilla
|
| 102 |
+
redis:
|
| 103 |
+
image: redis
|
| 104 |
+
profiles:
|
| 105 |
+
- with-argilla
|
| 106 |
+
networks:
|
| 107 |
+
- app-network
|
| 108 |
+
|
| 109 |
+
# Argilla service
|
| 110 |
argilla:
|
| 111 |
image: argilla/argilla-server:latest
|
| 112 |
profiles:
|
| 113 |
- with-argilla
|
| 114 |
ports:
|
| 115 |
- "6900:6900"
|
| 116 |
+
healthcheck:
|
| 117 |
+
test: ["CMD", "curl", "-f", "http://localhost:6900/api/ready"]
|
| 118 |
+
interval: 30s
|
| 119 |
+
timeout: 10s
|
| 120 |
+
retries: 3
|
| 121 |
+
env_file:
|
| 122 |
+
- .env
|
| 123 |
environment:
|
| 124 |
+
- ARGILLA_HOME_PATH=/var/lib/argilla
|
| 125 |
+
- ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
|
| 126 |
+
- ARGILLA_DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/argilla
|
| 127 |
+
- ARGILLA_REDIS_URL=redis://redis:6379/0
|
| 128 |
- USERNAME=${ARGILLA_USERNAME}
|
| 129 |
- PASSWORD=${ARGILLA_PASSWORD}
|
| 130 |
- API_KEY=${ARGILLA_API_KEY}
|
| 131 |
+
- WORKSPACE=default
|
| 132 |
volumes:
|
| 133 |
- argilla_data:/argilla
|
| 134 |
networks:
|
|
|
|
| 136 |
depends_on:
|
| 137 |
elasticsearch:
|
| 138 |
condition: service_healthy
|
| 139 |
+
postgres:
|
| 140 |
+
condition: service_started
|
| 141 |
+
redis:
|
| 142 |
+
condition: service_started
|
|
|
|
| 143 |
|
| 144 |
+
# Argilla Worker
|
| 145 |
+
worker:
|
| 146 |
+
image: argilla/argilla-server:latest
|
| 147 |
+
profiles:
|
| 148 |
+
- with-argilla
|
| 149 |
+
env_file:
|
| 150 |
+
- .env
|
| 151 |
+
environment:
|
| 152 |
+
- ARGILLA_HOME_PATH=/var/lib/argilla
|
| 153 |
+
- ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
|
| 154 |
+
- ARGILLA_DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/argilla
|
| 155 |
+
- ARGILLA_REDIS_URL=redis://redis:6379/0
|
| 156 |
+
- BACKGROUND_NUM_WORKERS=2
|
| 157 |
+
- USERNAME=${ARGILLA_USERNAME}
|
| 158 |
+
- PASSWORD=${ARGILLA_PASSWORD}
|
| 159 |
+
- API_KEY=${ARGILLA_API_KEY}
|
| 160 |
+
- WORKSPACE=default
|
| 161 |
+
networks:
|
| 162 |
+
- app-network
|
| 163 |
+
depends_on:
|
| 164 |
+
- postgres
|
| 165 |
+
- elasticsearch
|
| 166 |
+
- redis
|
| 167 |
+
command: sh -c 'python -m argilla_server worker --num-workers $${BACKGROUND_NUM_WORKERS}'
|
| 168 |
|
| 169 |
networks:
|
| 170 |
app-network:
|
| 171 |
+
driver: bridge
|
| 172 |
+
|
| 173 |
+
volumes:
|
| 174 |
+
es_data:
|
| 175 |
+
driver: local
|
| 176 |
+
argilla_data:
|
| 177 |
+
driver: local
|
| 178 |
+
ollama_data:
|
| 179 |
+
driver: local
|
| 180 |
+
postgres_data:
|
| 181 |
+
driver: local
|