-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (99 loc) · 3.3 KB
/
Makefile
File metadata and controls
117 lines (99 loc) · 3.3 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
.PHONY: help build clean test start stop restart docker-up docker-down smoke-test stress-test
#==========================================
# Help (Default Target)
#==========================================
help:
@echo "Available targets:"
@echo ""
@echo "Build & Test:"
@echo " build - Build the application with Gradle"
@echo " clean - Clean build artifacts"
@echo " test - Run unit and integration tests"
@echo ""
@echo "Local Development:"
@echo " start - Start infrastructure (db+localstack) and run app locally"
@echo " stop - Stop infrastructure and local app"
@echo " restart - Restart local services"
@echo ""
@echo "Docker Operations:"
@echo " docker-up - Start full stack with Docker Compose"
@echo " docker-down - Stop all Docker Compose services"
@echo ""
@echo "Integration Testing:"
@echo " smoke-test - Run smoke tests against running services"
@echo " stress-test - Start services and run comprehensive stress test battery"
#==========================================
# Build & Test
#==========================================
build:
./gradlew clean build
clean:
./gradlew clean
rm -f scripts/test-notebook.ipynb
test:
./gradlew test
#==========================================
# Local Development
#==========================================
start:
@echo "Starting infrastructure services..."
docker compose up -d db localstack
@echo "Waiting for services to be ready..."
@sleep 10
@echo "Ensuring S3 bucket exists..."
@AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test \
aws --endpoint-url=http://localhost:4567 s3 mb s3://test-bucket --region us-east-1 2>/dev/null || true
@echo "Starting Spring Boot application..."
DB_USERNAME=jupytereverywhere \
DB_PASSWORD=jupytereverywhere \
DB_HOST=localhost \
DB_PORT=5433 \
DB_NAME=sharingservice \
AWS_S3_REGION=us-east-1 \
AWS_S3_BUCKET=test-bucket \
AWS_S3_ENDPOINT_OVERRIDE=http://localhost:4567 \
AWS_S3_ACCESS_KEY=test \
AWS_S3_SECRET_KEY=test \
STORAGE_TYPE=s3 \
JWT_SECRET_KEY=test-secret-key-for-local-development-only \
ADMIN_SECRET=admin-secret-for-dev \
./gradlew bootRun
stop:
@echo "Stopping Spring Boot application..."
-pkill -f "gradle.*bootRun" || true
@echo "Stopping infrastructure services..."
docker compose down
restart: stop start
#==========================================
# Docker Operations
#==========================================
docker-up:
docker compose up -d --build
docker-down:
docker compose down
#==========================================
# Integration Testing
#==========================================
# Detect if API_URL is set to a remote (non-localhost) URL
# If remote, skip docker-up; if local or unset, run docker-up
IS_REMOTE_URL := $(shell \
if [ -z "$(API_URL)" ]; then \
echo "false"; \
elif echo "$(API_URL)" | grep -qE "localhost|127\.0\.0\.1|0\.0\.0\.0"; then \
echo "false"; \
else \
echo "true"; \
fi)
wait-for-health:
ifeq ($(IS_REMOTE_URL),false)
@echo "Testing local service - starting Docker stack..."
@$(MAKE) docker-up
endif
@echo
@API_URL="$(API_URL)" ./scripts/wait-for-health.sh
smoke-test: wait-for-health
@echo
@API_URL="$(API_URL)" ./scripts/smoke-test.sh
stress-test: wait-for-health
@echo
@API_URL="$(API_URL)" CONTAINER_ID=$$(docker compose ps -q api) ./scripts/stress-test-battery.sh