-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (104 loc) · 3.64 KB
/
Copy pathMakefile
File metadata and controls
139 lines (104 loc) · 3.64 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
# =============================================================================
# LuxView Cloud Platform — Makefile
# =============================================================================
.PHONY: dev prod build logs migrate clean status stop restart backup
COMPOSE = docker compose
COMPOSE_DEV = $(COMPOSE) -f docker-compose.yml -f docker-compose.dev.yml
MIGRATIONS_DIR = luxview-engine/migrations
# -- Development --------------------------------------------------------------
## Start all services in development mode (hot reload, exposed ports)
dev:
$(COMPOSE_DEV) up --build
## Start dev in background
dev-detach:
$(COMPOSE_DEV) up --build -d
# -- Production ---------------------------------------------------------------
## Start all services in production mode (detached)
prod:
$(COMPOSE) up -d
## Rebuild and start production
prod-build:
$(COMPOSE) up -d --build
# -- Build --------------------------------------------------------------------
## Build all images without starting
build:
$(COMPOSE) build
## Build without cache
build-fresh:
$(COMPOSE) build --no-cache
# -- Logs ---------------------------------------------------------------------
## Follow logs for all services
logs:
$(COMPOSE) logs -f
## Follow logs for a specific service (usage: make log-service SVC=engine)
log-service:
$(COMPOSE) logs -f $(SVC)
# -- Migrations ---------------------------------------------------------------
## Run all SQL migrations against pg-platform
migrate:
@echo "Running migrations against pg-platform..."
@for f in $(MIGRATIONS_DIR)/*.sql; do \
echo " -> $$(basename $$f)"; \
$(COMPOSE) exec -T pg-platform psql -U luxview -d luxview_platform -f /dev/stdin < "$$f"; \
done
@echo "Migrations complete."
## Run migrations in dev mode
migrate-dev:
@echo "Running migrations against pg-platform (dev)..."
@for f in $(MIGRATIONS_DIR)/*.sql; do \
echo " -> $$(basename $$f)"; \
$(COMPOSE_DEV) exec -T pg-platform psql -U luxview -d luxview_platform -f /dev/stdin < "$$f"; \
done
@echo "Migrations complete."
# -- Lifecycle ----------------------------------------------------------------
## Stop all services
stop:
$(COMPOSE) down
## Restart all services
restart:
$(COMPOSE) restart
## Stop and remove all containers, networks, and volumes (DESTRUCTIVE)
clean:
$(COMPOSE) down -v --remove-orphans
@echo "All containers, networks, and volumes removed."
# -- Status -------------------------------------------------------------------
## Show running containers and their status
status:
$(COMPOSE) ps
## Show resource usage per container
stats:
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}"
# -- Backup -------------------------------------------------------------------
## Backup databases to ./backups/
backup:
@bash scripts/backup.sh
# -- Helpers ------------------------------------------------------------------
## Shell into a service container (usage: make shell SVC=engine)
shell:
$(COMPOSE) exec $(SVC) sh
## Connect to platform database
psql:
$(COMPOSE) exec pg-platform psql -U luxview -d luxview_platform
## Connect to shared database
psql-shared:
$(COMPOSE) exec pg-shared psql -U luxview_admin -d luxview_shared
## Build the V Rising server image (slow — downloads Wine + SteamCMD)
vrising-build:
$(COMPOSE) build vrising
## Start V Rising server
vrising-start:
$(COMPOSE) up -d vrising
## Stop V Rising server
vrising-stop:
$(COMPOSE) stop vrising
## Follow V Rising logs
vrising-logs:
$(COMPOSE) logs -f vrising
## Print help
help:
@echo "LuxView Cloud Platform"
@echo ""
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@grep -E '^##' Makefile | sed 's/^## / /'