-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
485 lines (438 loc) Β· 23.6 KB
/
Makefile
File metadata and controls
485 lines (438 loc) Β· 23.6 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# =============================================================================
# Root Makefile - Full Stack Docker Orchestration
# Manages: Hocuspocus Server + Webapp + Infrastructure
# =============================================================================
.PHONY: help build build-dev validate-prod-build build-backend-prod run-backend-prod-local up-prod up-dev up-local infra-up infra-down infra-logs dev-local dev-backend dev-webapp dev-admin dev-rest dev-ws dev-worker down logs logs-webapp logs-backend restart clean scale scale-webapp scale-hocuspocus ps stats supabase-start supabase-stop supabase-status deploy-prod rollback-prod status-prod logs-traefik
help:
@echo "Docsplus Full Stack Docker Commands"
@echo ""
@echo "Building:"
@echo " make build - Build all services (production)"
@echo " make build-dev - Build all services (development)"
@echo " make validate-prod-build - Build prod images with stub env (no .env.production needed)"
@echo " make build-backend-prod - Build only backend prod images (rest-api, hocuspocus, worker)"
@echo " make run-backend-prod-local - Run backend prod images locally (needs .env.local)"
@echo ""
@echo "Running:"
@echo " make up-prod - Start all services (production)"
@echo " make up-dev - Start all services (development - Docker)"
@echo " make up-local - Start local dev (infra in Docker, apps native)"
@echo ""
@echo "Local Development (macOS-friendly, no Docker IO):"
@echo " make infra-up - Start infrastructure only (postgres, redis)"
@echo " make infra-down - Stop infrastructure"
@echo " make infra-logs - View infrastructure logs"
@echo " make dev-local - Start all services (backend + frontend)"
@echo " make dev-backend - Start backend services (REST, WS, Worker)"
@echo " make dev-webapp - Start frontend only"
@echo " make dev-admin - Start admin dashboard only"
@echo " make dev-rest - Start REST API only"
@echo " make dev-ws - Start WebSocket server only"
@echo " make dev-worker - Start Worker only"
@echo " make migrate - Run database migrations"
@echo ""
@echo "Production Deployment (Traefik):"
@echo " make deploy-prod - Deploy full stack with Traefik"
@echo " make rollback-prod - Rollback to previous deployment"
@echo " make status-prod - Check production status"
@echo " make logs-traefik - View Traefik logs"
@echo ""
@echo "Scaling (production only):"
@echo " make scale-webapp - Scale webapp to 3 replicas"
@echo " make scale-hocuspocus - Scale hocuspocus services"
@echo ""
@echo "Management:"
@echo " make down - Stop all services (auto-detects dev/prod/local)"
@echo " make logs - View all logs (auto-detects dev/prod)"
@echo " make logs-webapp - View webapp logs (auto-detects dev/prod)"
@echo " make logs-backend - View backend logs (rest-api, hocuspocus-server, worker) (auto-detects dev/prod)"
@echo " make restart - Restart all services (auto-detects dev/prod)"
@echo " make clean - Clean everything (auto-detects dev/prod/local)"
@echo ""
@echo "Utilities:"
@echo " make ps - Show running containers (auto-detects dev/prod/local)"
@echo " make stats - Show resource usage"
@echo ""
@echo "Supabase (uses .env.local):"
@echo " make supabase-start - Start Supabase local instance"
@echo " make supabase-stop - Stop Supabase local instance"
@echo " make supabase-status - Show Supabase local instance status"
# =============================================================================
# BUILD COMMANDS
# =============================================================================
build:
@echo "ποΈ Building all services (production)..."
@docker compose -f docker-compose.prod.yml --env-file .env.production build
@echo "β
All services built"
# Build prod images with stub env β run before push to catch Docker build failures.
# Does not require .env.production. Uses same compose + BuildKit as CI deploy.
validate-prod-build:
@echo "ποΈ Validating production Docker build (stub env)..."
@test -f scripts/env.production.build-stub || (echo "β scripts/env.production.build-stub missing"; exit 1)
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f docker-compose.prod.yml --env-file scripts/env.production.build-stub build --parallel
@echo "β
Production build validation passed"
# Build only backend (rest-api, hocuspocus-server, hocuspocus-worker) prod images. Same image, 3 services.
# Use before pushing to verify backend Dockerfile builds; then run with run-backend-prod-local.
build-backend-prod:
@echo "ποΈ Building backend production images (rest-api, hocuspocus-server, hocuspocus-worker)..."
@test -f scripts/env.production.build-stub || (echo "β scripts/env.production.build-stub missing"; exit 1)
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f docker-compose.prod.yml --env-file scripts/env.production.build-stub build rest-api hocuspocus-server hocuspocus-worker
@echo "β
Backend production images built"
# Run backend prod images locally: Redis + rest-api + hocuspocus-server + hocuspocus-worker (1 replica each).
# Uses .env.local for DATABASE_URL and secrets. No Traefik; override publishes 4000/4001/4002.
run-backend-prod-local: build-backend-prod
@test -f .env.local || (echo "β .env.local required (DATABASE_URL, SUPABASE_*, JWT_SECRET, etc.)"; exit 1)
@echo "π Starting backend (prod images) + Redis locally..."
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f docker-compose.prod.yml -f docker-compose.backend-local.override.yml --env-file .env.local up -d redis rest-api hocuspocus-server hocuspocus-worker
@echo "β
Backend running. REST: http://localhost:4000 WS: ws://localhost:4001 Health: http://localhost:4000/health"
@echo " make logs-backend - view logs"
build-dev:
@echo "ποΈ Building all services (development)..."
@docker compose -f docker-compose.dev.yml --env-file .env.development build
@echo "β
All services built"
# =============================================================================
# RUN COMMANDS
# =============================================================================
up-prod: build
@echo "π Starting full stack production environment (Traefik)..."
@echo ""
@echo "Services:"
@echo " π Traefik (ports 80, 443) - reverse proxy + SSL"
@echo " π΄ Redis (internal) - cache & pub/sub"
@echo " π REST API - 2 replicas"
@echo " π Hocuspocus WS - 2 replicas"
@echo " βοΈ Worker - 1 replica"
@echo " π» Webapp - 2 replicas"
@echo ""
@docker compose -f docker-compose.prod.yml --env-file .env.production up -d \
--scale rest-api=2 \
--scale hocuspocus-server=2 \
--scale hocuspocus-worker=1 \
--scale webapp=2
@echo ""
@echo "β
Full stack started!"
@echo ""
@echo "URLs:"
@echo " Webapp: https://docs.plus"
@echo " API: https://prodback.docs.plus/api"
@echo " WebSocket: wss://prodback.docs.plus/hocuspocus"
@echo " Dashboard: https://traefik.docs.plus"
@echo ""
@echo "Commands:"
@echo " make logs - View all logs"
@echo " make logs-traefik - View Traefik logs"
@echo " make status-prod - Check production status"
@echo " make down - Stop all services"
up-dev: build-dev
@echo "π Starting full stack development environment..."
@echo "π§Ή Cleaning up any existing containers..."
@docker compose -f docker-compose.dev.yml --env-file .env.development down 2>/dev/null || true
@CONTAINERS=$$(docker ps -a -q --filter "name=docsy-" 2>/dev/null); \
if [ -n "$$CONTAINERS" ]; then \
echo "Removing stale containers..."; \
docker rm -f $$CONTAINERS 2>/dev/null || true; \
fi
@echo ""
@if [ ! -f .env.development ]; then \
echo "β οΈ Warning: .env.development not found. Creating from template..."; \
cp .env .env.development 2>/dev/null || true; \
fi
@echo "Services:"
@echo " π¦ PostgreSQL (port 5432)"
@echo " π΄ Redis (port 6379)"
@echo " π REST API (port 4000) - hot reload enabled"
@echo " π Hocuspocus WS (port 4001) - hot reload enabled"
@echo " βοΈ Worker (port 4002) - hot reload enabled"
@echo " π» Webapp (port 3000) - hot reload enabled"
@echo ""
@docker compose -f docker-compose.dev.yml --env-file .env.development up -d
@echo ""
@echo "β
Development environment started!"
@echo ""
@echo "Access points:"
@echo " Webapp: http://localhost:3000"
@echo " REST API: http://localhost:4000"
@echo " WebSocket: ws://localhost:4001"
@echo " Worker: http://localhost:4002"
@echo " PostgreSQL: localhost:5432"
@echo " Redis: localhost:6379"
@echo ""
@echo "π‘ Hot reload is enabled - code changes will auto-reload"
@echo ""
@echo "Common commands:"
@echo " make logs - View all logs (auto-detects dev/prod)"
@echo " make logs-webapp - View webapp logs (auto-detects dev/prod)"
@echo " make logs-backend - View backend logs (auto-detects dev/prod)"
@echo " make ps - Show running containers (auto-detects dev/prod)"
@echo " make down - Stop all services (auto-detects dev/prod)"
@echo " make restart - Restart all services (auto-detects dev/prod)"
# =============================================================================
# LOCAL DEVELOPMENT COMMANDS (Infrastructure Only in Docker)
# =============================================================================
infra-up:
@echo "π Starting infrastructure services (PostgreSQL + Redis)..."
@if [ ! -f .env.local ]; then \
echo "β οΈ Warning: .env.local not found. Creating from .env.development..."; \
cp .env.development .env.local 2>/dev/null || true; \
fi
@docker compose -f docker-compose.local.yml --env-file .env.local up -d
@echo ""
@echo "β
Infrastructure started!"
@echo ""
@echo "Services:"
@echo " π¦ PostgreSQL: localhost:${DB_PORT:-5432}"
@echo " π΄ Redis: localhost:${REDIS_PORT:-6379}"
@echo ""
@echo "Next steps:"
@echo " 1. Start Supabase: make supabase-start"
@echo " 2. Start apps: make dev-local"
@echo ""
@echo "Or run manually:"
@echo " Backend REST API: cd packages/hocuspocus.server && bun run dev:rest"
@echo " Backend WebSocket: cd packages/hocuspocus.server && bun run dev:hocuspocus.server"
@echo " Backend Worker: cd packages/hocuspocus.server && bun run dev:hocuspocus.worker"
@echo " Frontend: cd packages/webapp && bun run dev"
infra-down:
@echo "π Stopping infrastructure services..."
@docker compose -f docker-compose.local.yml --env-file .env.local down
@echo "β
Infrastructure stopped"
infra-logs:
@echo "π Infrastructure logs..."
@docker compose -f docker-compose.local.yml --env-file .env.local logs -f
dev-local:
@echo "π Starting local development (all services)..."
@if [ ! -f .env.local ]; then \
echo "β οΈ .env.local not found. Creating from .env.development..."; \
cp .env.development .env.local; \
echo "β
Created .env.local - please review and adjust for localhost if needed"; \
fi
@if ! docker ps | grep -q docsy-postgres-local; then \
echo "β οΈ PostgreSQL not running. Starting infrastructure..."; \
$(MAKE) infra-up; \
elif ! docker ps | grep -q docsy-redis-local; then \
echo "β οΈ Redis not running. Starting infrastructure..."; \
$(MAKE) infra-up; \
fi
@if ! lsof -Pi :54321 -sTCP:LISTEN -t >/dev/null 2>&1; then \
echo "β οΈ Starting Supabase..."; \
cd packages/supabase && dotenv -e ../../.env.local -- supabase start > /dev/null 2>&1 || true; \
fi
@echo "π§ Ensuring Prisma client is generated..."
@cd packages/hocuspocus.server && bun run prisma:generate > /dev/null 2>&1 || true
@echo "π§ Ensuring database migrations are applied..."
@cd packages/hocuspocus.server && bun --env-file ../../.env.local -e "import { $$ } from 'bun'; await $$\`bunx prisma migrate deploy\`" > /dev/null 2>&1 || true
@echo ""
@echo "Starting all services..."
@bunx concurrently -n "REST,WS,WORKER,WEBAPP" -c "blue,green,yellow,magenta" \
"$(MAKE) dev-rest" \
"$(MAKE) dev-ws" \
"$(MAKE) dev-worker" \
"$(MAKE) dev-webapp"
migrate:
@echo "π§ Running database migrations..."
@if [ ! -f .env.local ]; then \
echo "β οΈ .env.local not found. Using .env.development..."; \
cd packages/hocuspocus.server && bun --env-file ../../.env.development -e "import { $$ } from 'bun'; await $$\`bunx prisma migrate deploy\`"; \
else \
cd packages/hocuspocus.server && bun --env-file ../../.env.local -e "import { $$ } from 'bun'; await $$\`bunx prisma migrate deploy\`"; \
fi
dev-backend:
@echo "π Starting backend services (REST API, WebSocket, Worker)..."
@bunx concurrently -n "REST,WS,WORKER" -c "blue,green,yellow" \
"$(MAKE) dev-rest" \
"$(MAKE) dev-ws" \
"$(MAKE) dev-worker"
dev-webapp:
@echo "π Starting frontend..."
@cd packages/webapp && bunx dotenv -e ../../.env.local -- next dev --turbopack
dev-admin:
@echo "ποΈ Starting Admin Dashboard..."
@cd packages/admin-dashboard && bunx dotenv -e ../../.env.local -- next dev -p 3100 --turbopack
dev-rest:
@cd packages/hocuspocus.server && NODE_ENV=development bun --env-file ../../.env.local --watch src/index.ts
dev-ws:
@cd packages/hocuspocus.server && NODE_ENV=development bun --env-file ../../.env.local --watch src/hocuspocus.server.ts
dev-worker:
@cd packages/hocuspocus.server && NODE_ENV=development bun --env-file ../../.env.local --watch src/hocuspocus.worker.ts
up-local: infra-up
@echo ""
@echo "π‘ Infrastructure is ready. Run 'make dev-local' to start apps, or start them manually:"
@echo " Backend: cd packages/hocuspocus.server && bun run dev:rest"
@echo " Frontend: cd packages/webapp && bun run dev"
# =============================================================================
# SCALING COMMANDS
# =============================================================================
scale-webapp:
@echo "π Scaling webapp to 3 replicas..."
@docker compose -f docker-compose.prod.yml --env-file .env.production up -d --scale webapp=3
@echo "β
Webapp scaled to 3 replicas"
scale-hocuspocus:
@echo "π Scaling hocuspocus services..."
@docker compose -f docker-compose.prod.yml --env-file .env.production up -d --scale rest-api=3 --scale hocuspocus-server=5 --scale hocuspocus-worker=3
@echo "β
Hocuspocus services scaled"
# =============================================================================
# MANAGEMENT COMMANDS
# =============================================================================
down:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
echo "π Stopping all services (development)..."; \
docker compose -f docker-compose.dev.yml --env-file .env.development down; \
echo "β
All services stopped"; \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q 2>/dev/null | grep -q .; then \
echo "π Stopping all services (production)..."; \
docker compose -f docker-compose.prod.yml --env-file .env.production down; \
echo "β
All services stopped"; \
elif docker compose -f docker-compose.local.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
echo "π Stopping infrastructure services (local)..."; \
docker compose -f docker-compose.local.yml --env-file .env.development down; \
echo "β
Infrastructure stopped"; \
echo "π‘ Apps are running natively - stop them manually (Ctrl+C)"; \
else \
echo "β οΈ No running containers found. Start services with 'make up-dev', 'make up-prod', or 'make up-local'"; \
fi
logs:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
echo "π Detected development environment - showing all logs..."; \
docker compose -f docker-compose.dev.yml --env-file .env.development logs -f; \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q 2>/dev/null | grep -q .; then \
echo "π Detected production environment - showing all logs..."; \
docker compose -f docker-compose.prod.yml --env-file .env.production logs -f; \
else \
echo "β οΈ No running containers found. Start services with 'make up-dev' or 'make up-prod'"; \
fi
logs-webapp:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q webapp 2>/dev/null | grep -q .; then \
docker compose -f docker-compose.dev.yml --env-file .env.development logs -f webapp; \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q webapp 2>/dev/null | grep -q .; then \
docker compose -f docker-compose.prod.yml --env-file .env.production logs -f webapp; \
else \
echo "β οΈ Webapp container not found. Start services with 'make up-dev' or 'make up-prod'"; \
fi
logs-backend:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q rest-api 2>/dev/null | grep -q .; then \
docker compose -f docker-compose.dev.yml --env-file .env.development logs -f rest-api hocuspocus-server hocuspocus-worker; \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q rest-api 2>/dev/null | grep -q .; then \
docker compose -f docker-compose.prod.yml --env-file .env.production logs -f rest-api hocuspocus-server hocuspocus-worker; \
else \
echo "β οΈ Backend containers not found. Start services with 'make up-dev' or 'make up-prod'"; \
fi
restart:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
echo "π Restarting all services (development)..."; \
docker compose -f docker-compose.dev.yml --env-file .env.development restart; \
echo "β
All services restarted"; \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q 2>/dev/null | grep -q .; then \
echo "π Restarting all services (production)..."; \
docker compose -f docker-compose.prod.yml --env-file .env.production restart; \
echo "β
All services restarted"; \
else \
echo "β οΈ No running containers found. Start services with 'make up-dev' or 'make up-prod'"; \
fi
# =============================================================================
# CLEANUP COMMANDS
# =============================================================================
clean:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
echo "π§Ή Cleaning up (development)..."; \
docker compose -f docker-compose.dev.yml --env-file .env.development down -v; \
docker rmi docsplus-webapp:dev 2>/dev/null || true; \
echo "β
Development cleanup complete"; \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q 2>/dev/null | grep -q .; then \
echo "π§Ή Cleaning up (production)..."; \
docker compose -f docker-compose.prod.yml --env-file .env.production down -v; \
docker rmi docsplus-webapp:latest docsplus-hocuspocus:latest 2>/dev/null || true; \
echo "β
Production cleanup complete"; \
elif docker compose -f docker-compose.local.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
echo "π§Ή Cleaning up (local)..."; \
docker compose -f docker-compose.local.yml --env-file .env.development down -v; \
echo "β
Local cleanup complete"; \
else \
echo "π§Ή No running containers found. Cleaning up project images..."; \
docker rmi docsplus-webapp:dev docsplus-webapp:latest docsplus-hocuspocus:latest 2>/dev/null || true; \
docker volume rm docsy-postgres-dev docsy-redis-dev docsy-postgres-prod docsy-redis-prod docsy-postgres-local docsy-redis-local 2>/dev/null || true; \
docker network rm docsy-network-dev docsy-network docsy-network-local 2>/dev/null || true; \
echo "β
Cleanup complete"; \
fi
# =============================================================================
# UTILITY COMMANDS
# =============================================================================
ps:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
docker compose -f docker-compose.dev.yml --env-file .env.development ps; \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q 2>/dev/null | grep -q .; then \
docker compose -f docker-compose.prod.yml --env-file .env.production ps; \
elif docker compose -f docker-compose.local.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
docker compose -f docker-compose.local.yml --env-file .env.development ps; \
echo ""; \
echo "π‘ Apps are running natively (not shown above)"; \
else \
echo "β οΈ No running containers found. Start services with 'make up-dev', 'make up-prod', or 'make up-local'"; \
fi
stats:
@if docker compose -f docker-compose.dev.yml --env-file .env.development ps -q 2>/dev/null | grep -q .; then \
docker stats $$(docker compose -f docker-compose.dev.yml --env-file .env.development ps -q); \
elif docker compose -f docker-compose.prod.yml --env-file .env.production ps -q 2>/dev/null | grep -q .; then \
docker stats $$(docker compose -f docker-compose.prod.yml --env-file .env.production ps -q); \
else \
echo "β οΈ No running containers found. Start services with 'make up-dev' or 'make up-prod'"; \
fi
# =============================================================================
# SUPABASE COMMANDS
# =============================================================================
supabase-start:
@echo "π Starting Supabase local instance..."
@if [ ! -f .env.local ]; then \
echo "β οΈ Warning: .env.local not found. Creating from .env.development..."; \
cp .env.development .env.local 2>/dev/null || true; \
fi
@cd packages/supabase && bun run start
@echo "β
Supabase started"
supabase-stop:
@echo "π Stopping Supabase local instance..."
@cd packages/supabase && bun run stop
@echo "β
Supabase stopped"
supabase-status:
@echo "π Supabase local instance status:"
@cd packages/supabase && bun run status
# =============================================================================
# PRODUCTION DEPLOYMENT COMMANDS (Traefik)
# =============================================================================
deploy-prod:
@echo "π Deploying to production with Traefik..."
@if [ ! -f .env.production ]; then \
echo "β .env.production not found"; \
exit 1; \
fi
@echo "Building images..."
@docker compose -f docker-compose.prod.yml --env-file .env.production build
@echo "Deploying services (zero-downtime)..."
@docker compose -f docker-compose.prod.yml --env-file .env.production up -d \
--scale rest-api=2 \
--scale hocuspocus-server=2 \
--scale hocuspocus-worker=1 \
--scale webapp=2
@echo "β
Production deployed"
@docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | head -15
rollback-prod:
@echo "π Rolling back production..."
@PREV_TAG=$$(docker images docsplus-webapp --format "{{.Tag}}" | grep -v latest | head -1); \
if [ -n "$$PREV_TAG" ]; then \
echo "Rolling back to: $$PREV_TAG"; \
sed -i.bak "s/DEPLOY_TAG=.*/DEPLOY_TAG=$$PREV_TAG/" .env.production; \
docker compose -f docker-compose.prod.yml --env-file .env.production up -d; \
echo "β
Rollback complete"; \
else \
echo "β No previous version found"; \
fi
status-prod:
@echo "π Production Status"
@echo "===================="
@docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" 2>/dev/null || echo "No containers running"
@echo ""
@echo "Traefik Dashboard: https://traefik.docs.plus"
@echo ""
@echo "Health Checks:"
@curl -sf https://docs.plus/api/health 2>/dev/null && echo " β
docs.plus" || echo " β docs.plus"
@curl -sf https://prodback.docs.plus/api/health 2>/dev/null && echo " β
prodback.docs.plus/api" || echo " β prodback.docs.plus/api"
logs-traefik:
@docker logs traefik -f --tail 100