-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (108 loc) · 4.06 KB
/
Copy pathMakefile
File metadata and controls
135 lines (108 loc) · 4.06 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
.PHONY: help build dev prod stop clean logs shell test
# Colors for output
CYAN := \033[36m
RESET := \033[0m
help:
@echo "$(CYAN)pgAdmin-rs Development Commands$(RESET)"
@echo ""
@echo "Development:"
@echo " make dev - Start development environment with Docker Compose"
@echo " make build - Build Docker image"
@echo " make logs - View application logs"
@echo " make shell - Open shell in running container"
@echo " make stop - Stop Docker Compose services"
@echo " make clean - Remove containers and volumes"
@echo ""
@echo "Production:"
@echo " make prod - Start production environment"
@echo " make prod-build - Build production Docker image"
@echo ""
@echo "Local Development:"
@echo " make test - Run all tests with Docker"
@echo " make test-no-docker - Run tests (requires local PostgreSQL)"
@echo " make test-integration - Run integration tests only"
@echo " make check - Run cargo check"
@echo " make clippy - Run clippy linter"
@echo " make fmt - Format code"
@echo ""
# ============================================================================
# Development Commands
# ============================================================================
dev:
@echo "$(CYAN)Starting development environment...$(RESET)"
docker-compose up
dev-detached:
@echo "$(CYAN)Starting development environment (detached)...$(RESET)"
docker-compose up -d
build:
@echo "$(CYAN)Building Docker image...$(RESET)"
docker build -t pgadmin-rs:latest .
@echo "$(CYAN)Image built successfully!$(RESET)"
logs:
docker-compose logs -f app
shell:
docker exec -it pgadmin-rs-app /bin/bash
stop:
@echo "$(CYAN)Stopping services...$(RESET)"
docker-compose down
clean:
@echo "$(CYAN)Removing containers and volumes...$(RESET)"
docker-compose down -v
@echo "$(CYAN)Cleanup complete!$(RESET)"
# ============================================================================
# Production Commands
# ============================================================================
prod:
@echo "$(CYAN)Starting production environment...$(RESET)"
docker-compose -f docker-compose.prod.yml up -d
prod-build:
@echo "$(CYAN)Building production Docker image...$(RESET)"
docker build -t pgadmin-rs:latest .
# ============================================================================
# Local Development Commands
# ============================================================================
test:
@echo "$(CYAN)Running tests...$(RESET)"
docker-compose up -d postgres
@echo "$(CYAN)Waiting for PostgreSQL to be ready...$(RESET)"
@sleep 5
TEST_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/pgadmin_test cargo test --all-features
docker-compose down
test-no-docker:
@echo "$(CYAN)Running tests (requires local PostgreSQL)...$(RESET)"
TEST_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/pgadmin_test cargo test --all-features
test-integration:
@echo "$(CYAN)Running integration tests...$(RESET)"
docker-compose up -d postgres
@sleep 5
TEST_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/pgadmin_test cargo test --test integration_test -- --test-threads=1
docker-compose down
check:
@echo "$(CYAN)Running cargo check...$(RESET)"
cargo check
clippy:
@echo "$(CYAN)Running clippy...$(RESET)"
cargo clippy --all-targets --all-features -- -D warnings
fmt:
@echo "$(CYAN)Formatting code...$(RESET)"
cargo fmt --all
fmt-check:
@echo "$(CYAN)Checking code format...$(RESET)"
cargo fmt --all -- --check
# ============================================================================
# Utility Commands
# ============================================================================
# Show image size
size:
@echo "$(CYAN)Docker image size:$(RESET)"
@docker images pgadmin-rs:latest --format "table {{.Repository}}\t{{.Size}}"
# Run health check
health:
curl -f http://localhost:3000/health || echo "Health check failed"
# View image layers
layers:
docker history pgadmin-rs:latest
# Inspect running container
inspect:
docker inspect pgadmin-rs-app
.DEFAULT_GOAL := help