-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
134 lines (129 loc) · 3.77 KB
/
docker-compose.yml
File metadata and controls
134 lines (129 loc) · 3.77 KB
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
services:
api:
image: joegaffney/deferred-diffusion:api-latest
build:
context: .
dockerfile: Dockerfile.api
tty: true
stdin_open: true
ports:
- "5000:5000"
volumes:
- storage:/STORAGE
environment:
- PYTHONUNBUFFERED=1
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/1
- DDIFFUSION_ADMIN_KEY=${DDIFFUSION_ADMIN_KEY} # Must be set in environment
- DDIFFUSION_STORAGE_ADDRESS=${DDIFFUSION_STORAGE_ADDRESS:-http://127.0.0.1:5000} # Change to your host IP or domain
- FASTMCP_EXPERIMENTAL_ENABLE_NEW_OPENAPI_PARSER=true
healthcheck:
test:
["CMD-SHELL", "wget -q --spider http://127.0.0.1:5000/health || exit 1"]
start_period: 3s
redis:
image: redis:latest
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
gpu-workers:
image: joegaffney/deferred-diffusion:worker-latest
command: celery -A worker worker --loglevel=info --pool=threads --concurrency=1 -Q gpu,comfy
build:
context: .
dockerfile: Dockerfile.workers
tty: true
stdin_open: true
volumes:
- hf_cache:/WORKSPACE
- storage:/STORAGE
environment:
- PYTHONUNBUFFERED=1
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/1
- CELERYD_PREFETCH_MULTIPLIER=1
- OPENAI_API_KEY=${OPENAI_API_KEY}
- REPLICATE_API_TOKEN=${REPLICATE_API_TOKEN}
- HF_TOKEN=${HF_TOKEN}
- HF_HOME=/WORKSPACE
- TORCH_HOME=/WORKSPACE
- HF_ENABLE_PARALLEL_LOADING=yes
- HF_HUB_DISABLE_XET=1 # Disable for now until hub v1.0
# Point to host machine or external IP.
# Use http://host.docker.internal:8188 for local Windows/Mac
# Use http://192.168.x.x:8188 for a remote machine
- COMFY_API_URL=${COMFY_API_URL:-http://host.docker.internal:8188}
depends_on:
redis:
condition: service_started
api:
condition: service_healthy
deploy:
replicas: 1
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
cpu-workers:
image: joegaffney/deferred-diffusion:worker-latest
command: celery -A worker worker --concurrency=4 --loglevel=info -Q cpu
build:
context: .
dockerfile: Dockerfile.workers
tty: true
stdin_open: true
volumes:
- hf_cache:/WORKSPACE
- storage:/STORAGE
environment:
- PYTHONUNBUFFERED=1
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/1
- CELERYD_PREFETCH_MULTIPLIER=1
- OPENAI_API_KEY=${OPENAI_API_KEY}
- REPLICATE_API_TOKEN=${REPLICATE_API_TOKEN}
- HF_TOKEN=${HF_TOKEN}
- HF_HOME=/WORKSPACE
- TORCH_HOME=/WORKSPACE
depends_on:
redis:
condition: service_started
api:
condition: service_healthy
deploy:
replicas: 1
flower:
image: mher/flower:latest
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/1
- FLOWER_PERSISTENT=True
- FLOWER_DB=/data/flower.db
- FLOWER_STATE_SAVE_INTERVAL=5000
- FLOWER_UNAUTHENTICATED_API=true
ports:
- "5555:5555"
volumes:
- flower_data:/data
depends_on:
- gpu-workers
- cpu-workers
- redis
volumes:
hf_cache:
name: deferred-diffusion_hf_cache
redis_data:
name: deferred-diffusion_redis_data
flower_data:
name: deferred-diffusion_flower_data
storage:
name: deferred-diffusion_storage
driver: local
driver_opts:
type: none
o: bind
device: ${DDIFFUSION_STORAGE_PATH:-Y:/STORAGE} # Change this path as needed