-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (63 loc) · 2.37 KB
/
Makefile
File metadata and controls
80 lines (63 loc) · 2.37 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
.PHONY: help build dev deploy-github deploy-docker deploy-supervisor clean
help: ## Show this help
@echo "SnapCode - Deployment Commands"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## Generate file lists
@echo "🔨 Building..."
python3 build.py
@echo "✅ Build complete!"
dev: ## Run local development server
@echo "🚀 Starting dev server..."
python3 server.py
deploy-github: build ## Deploy to GitHub Pages
@echo "📦 Deploying to GitHub Pages..."
git add .
git commit -m "Deploy: $$(date '+%Y-%m-%d %H:%M:%S')" || true
git push origin main
@echo "✅ Deployed to GitHub Pages!"
deploy-docker: build ## Deploy with Docker Compose
@echo "🐳 Deploying with Docker..."
docker-compose up -d --build
@echo "✅ Docker deployment complete!"
@echo "🌐 Access: http://localhost:8000"
deploy-docker-nginx: build ## Deploy with Docker + Nginx
@echo "🐳 Deploying with Docker + Nginx..."
docker-compose --profile with-nginx up -d --build
@echo "✅ Docker + Nginx deployment complete!"
@echo "🌐 Access: http://localhost"
deploy-supervisor: build ## Deploy with Supervisor
@echo "🖥️ Deploying with Supervisor..."
sudo cp deployment/supervisor/snapcode.conf /etc/supervisor/conf.d/
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart snapcode
@echo "✅ Supervisor deployment complete!"
logs-docker: ## View Docker logs
docker-compose logs -f
logs-supervisor: ## View Supervisor logs
sudo tail -f /var/log/snapcode/access.log
stop-docker: ## Stop Docker containers
docker-compose down
stop-supervisor: ## Stop Supervisor service
sudo supervisorctl stop snapcode
restart-docker: ## Restart Docker containers
docker-compose restart
restart-supervisor: ## Restart Supervisor service
sudo supervisorctl restart snapcode
status-docker: ## Check Docker status
docker-compose ps
status-supervisor: ## Check Supervisor status
sudo supervisorctl status snapcode
clean: ## Clean build artifacts
@echo "🧹 Cleaning..."
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
@echo "✅ Clean complete!"
test: ## Test the application
@echo "🧪 Testing..."
@echo "Testing file generation..."
python3 build.py
@echo "Testing server..."
timeout 2 python3 server.py || true
@echo "✅ Tests complete!"