-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (63 loc) · 2.5 KB
/
Makefile
File metadata and controls
79 lines (63 loc) · 2.5 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
# Makefile to manage tasks for building, running, and testing the application
# Colors for echo messages
GREEN=\033[0;32m
RESET=\033[0m
# Variables
ORDER_SERVICE = order-service
STOCK_SERVICE = stock-service
EMAIL_SERVICE = email-service
BASE_DOMAINS = base-domains
# Define the list of services
SERVICES = $(ORDER_SERVICE) $(STOCK_SERVICE) $(EMAIL_SERVICE) $(BASE_DOMAINS)
run-zookeeper:
zookeeper-server-start /opt/homebrew/etc/kafka/zookeeper.properties
@echo "$(GREEN)🏗️ Zookeeper started successfully!$(RESET)"
run-kafka:
kafka-server-start /opt/homebrew/etc/kafka/server.properties
@echo "$(GREEN)🏗️ Kafka started successfully!$(RESET)"
clean:
for service in $(SERVICES); do \
(cd $$service && mvn clean); \
done
@echo "$(GREEN)🧹 Cleaned successfully!$(RESET)"
compile: clean
for service in $(SERVICES); do \
(cd $$service && mvn compile); \
done
@echo "$(GREEN)🛠️ Microservices compiled successfully!$(RESET)"
package: clean
mvn package
@echo "$(GREEN)📦 Microservices packaged successfully!$(RESET)"
test: clean
for service in $(SERVICES); do \
(cd $$service && mvn package); \
done
@echo "$(GREEN)✅ Tests executed successfully!$(RESET)"
install: clean
for service in $(SERVICES); do \
(cd $$service && mvn install); \
done
@echo "$(GREEN)✅ Install executed successfully!$(RESET)"
run-producer:
mvn spring-boot:run -pl kafka-producer-wikimedia
run-console-producer:
kafka-console-consumer --topic wikimedia_recentchange --from-beginning --bootstrap-server macbook-pro.home:9092 | jq .
run-consumer:
mvn spring-boot:run -pl kafka-consumer-database
# Declare targets as phony labels to avoid conflicts with real file names 🎭
.PHONY: run-zookeeper run-kafka clean compile package test install run-producer run-console-producer run-consumer
# Default target that displays help on using the Makefile 📚
help:
@echo "Usage: make [command]"
@echo ""
@echo "Commands:"
@echo " make run-zookeeper - Starts Zookeeper"
@echo " make run-kafka - Starts Kafka"
@echo " make clean - Cleans all projects"
@echo " make compile - Compiles all microservices"
@echo " make package - Packages all microservices"
@echo " make test - Executes tests on all microservices"
@echo " make run-producer - Runs the Kafka producer"
@echo " make run-console-producer - Runs the Kafka producer"
@echo " make run-consumer - Runs the Kafka consumer"
@echo " make help - Displays this help screen"