-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
82 lines (71 loc) · 2.1 KB
/
Copy pathmakefile
File metadata and controls
82 lines (71 loc) · 2.1 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
# Define variables
USER_SERVICE_DIR=user
MESSAGE_SERVICE_DIR=message
WORKSPACE_SERVICE_DIR=workspace
DOCKER_COMPOSE_FILE=docker-compose.yaml
# Platform-specific commands
ifeq ($(OS), Windows_NT)
ECHO := @echo
RM := del /Q
MVN_CMD := mvnw.cmd
DOCKER_COMPOSE_CMD := docker-compose
START_CMD := start
else
ECHO := @echo
RM := rm -f
MVN_CMD := ./mvnw
DOCKER_COMPOSE_CMD := docker-compose
START_CMD := nohup
endif
# Targets
.PHONY: all compose start-user start-message start-workspace stop-user stop-message stop-workspace clean
# Run Docker Compose before starting services
compose:
$(ECHO) Running Docker Compose...
@if exist $(DOCKER_COMPOSE_FILE) ( \
$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d \
) else ( \
$(ECHO) $(DOCKER_COMPOSE_FILE) not found! \
)
all: compose start-user start-message start-workspace
start-user:
$(ECHO) Starting User Service...
@if exist $(USER_SERVICE_DIR) ( \
cd $(USER_SERVICE_DIR) && $(START_CMD) cmd /c $(MVN_CMD) spring-boot:run \
) else ( \
$(ECHO) $(USER_SERVICE_DIR) directory not found! \
)
start-message:
$(ECHO) Starting Message Service...
@if exist $(MESSAGE_SERVICE_DIR) ( \
cd $(MESSAGE_SERVICE_DIR) && $(START_CMD) cmd /c $(MVN_CMD) spring-boot:run \
) else ( \
$(ECHO) $(MESSAGE_SERVICE_DIR) directory not found! \
)
start-workspace:
$(ECHO) Starting Workspace Service...
@if exist $(WORKSPACE_SERVICE_DIR) ( \
cd $(WORKSPACE_SERVICE_DIR) && $(START_CMD) cmd /c $(MVN_CMD) spring-boot:run \
) else ( \
$(ECHO) $(WORKSPACE_SERVICE_DIR) directory not found! \
)
stop-user:
$(ECHO) Stopping User Service...
# Provide a mechanism to stop the service.
stop-message:
$(ECHO) Stopping Message Service...
# Provide a mechanism to stop the service.
stop-workspace:
$(ECHO) Stopping Workspace Service...
# Provide a mechanism to stop the service.
clean:
$(ECHO) Cleaning up...
@if exist $(USER_SERVICE_DIR) ( \
cd $(USER_SERVICE_DIR) && $(MVN_CMD) clean \
)
@if exist $(MESSAGE_SERVICE_DIR) ( \
cd $(MESSAGE_SERVICE_DIR) && $(MVN_CMD) clean \
)
@if exist $(WORKSPACE_SERVICE_DIR) ( \
cd $(WORKSPACE_SERVICE_DIR) && $(MVN_CMD) clean \
)