-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
167 lines (157 loc) · 5.04 KB
/
Copy pathdocker-compose.yml
File metadata and controls
167 lines (157 loc) · 5.04 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
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
# north-star — two ways to run:
#
# docker compose up -d # INFRA only (MinIO+Postgres+Redis);
# # backend/frontend run natively (MPS/CUDA)
# docker compose --profile app up -d --build # EVERYTHING in Docker (api+worker+web too;
# # torch on CPU — fine for restore/serve,
# # train natively for GPU speed)
#
# All credentials/ports come from ./.env (see .env.example). MPS is not available
# inside Docker on macOS — the native path stays the fast one for training.
name: north-star
services:
postgres:
image: postgres:16-alpine
container_name: northstar-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- pg-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
networks: [northstar]
redis:
image: redis:7-alpine
container_name: northstar-redis
restart: unless-stopped
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes"]
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "--no-auth-warning", "ping"]
interval: 5s
timeout: 5s
retries: 10
networks: [northstar]
minio:
image: minio/minio:latest
container_name: northstar-minio
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
MINIO_REGION_NAME: ${MINIO_REGION:-us-east-1}
ports:
- "9000:9000"
- "${MINIO_CONSOLE_PORT:-9001}:9001"
volumes:
- minio-data:/data
healthcheck:
# ubi-micro based image: probe readiness via the minio binary itself.
test: ["CMD-SHELL", "mc ready local 2>/dev/null || curl -fsS http://localhost:9000/minio/health/live || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 10s
networks: [northstar]
# One-shot: wait for MinIO, then create the four buckets idempotently.
createbuckets:
image: minio/mc:latest
container_name: northstar-createbuckets
depends_on:
minio:
condition: service_started
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
B_RAW: ${MINIO_BUCKET_RAW}
B_DERIVED: ${MINIO_BUCKET_DERIVED}
B_MODELS: ${MINIO_BUCKET_MODELS}
B_STAGING: ${MINIO_BUCKET_STAGING}
entrypoint: >
/bin/sh -c "
until mc alias set local http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD; do
echo 'waiting for minio...'; sleep 2;
done;
for b in $$B_RAW $$B_DERIVED $$B_MODELS $$B_STAGING; do
mc mb --ignore-existing local/$$b && echo \"bucket ok: $$b\";
mc anonymous set none local/$$b || true;
done;
echo 'createbuckets: done';
"
networks: [northstar]
# ---- full-stack profile: docker compose --profile app up -d --build ----
api:
profiles: ["app"]
build: ./backend
container_name: northstar-api
restart: unless-stopped
env_file: .env
environment:
POSTGRES_HOST: postgres
REDIS_HOST: redis
MINIO_ENDPOINT: minio:9000
TORCH_DEVICE: cpu
NORTH_STAR_CKPT_URL: ${NORTH_STAR_CKPT_URL:-}
ports:
- "${API_PORT:-8000}:8000"
volumes:
- ckpt-cache:/root/.cache/north-star
- ml-cache:/app/backend/.cache
- ${MUSIC_DIR:-./music}:/music:ro # your library → import from /music
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
minio: { condition: service_started }
networks: [northstar]
worker:
profiles: ["app"]
build: ./backend
container_name: northstar-worker
restart: unless-stopped
command: ["celery", "-A", "app.workers.celery_app:celery_app", "worker", "--loglevel=info"]
env_file: .env
environment:
POSTGRES_HOST: postgres
REDIS_HOST: redis
MINIO_ENDPOINT: minio:9000
TORCH_DEVICE: cpu
NORTH_STAR_CKPT_URL: ${NORTH_STAR_CKPT_URL:-}
volumes:
- ckpt-cache:/root/.cache/north-star
- ml-cache:/app/backend/.cache
- ${MUSIC_DIR:-./music}:/music:ro
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
minio: { condition: service_started }
networks: [northstar]
web:
profiles: ["app"]
build: ./frontend
container_name: northstar-web
restart: unless-stopped
ports:
- "${WEB_PORT:-8080}:80"
depends_on: [api]
networks: [northstar]
volumes:
pg-data:
redis-data:
minio-data:
ckpt-cache:
ml-cache:
networks:
northstar:
name: north-star