-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
162 lines (135 loc) Β· 6.98 KB
/
Makefile
File metadata and controls
162 lines (135 loc) Β· 6.98 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
.PHONY: help setup docker-setup docker-up docker-down docker-restart docker-logs docker-build heroku-deploy dev test test-cov lint format type-check clean docs-serve docs-build docs-deploy install install-dev
help: ## Show this help message
@echo "AgentShip - Available Commands:"
@echo ""
@echo "π³ Docker (Local Development):"
@echo " make docker-setup - First-time setup (builds + starts)"
@echo " make docker-up - Start everything (API, Swagger, Docs at :7001)"
@echo " make docker-down - Stop containers"
@echo " make docker-restart - Restart containers (quick restart)"
@echo " make docker-reload - Hard reload (rebuilds image + restarts)"
@echo " make docker-logs - View Docker logs"
@echo " make docker-build - Rebuild Docker images only"
@echo ""
@echo "βοΈ Deployment:"
@echo " make heroku-deploy - Deploy to Heroku (one command, includes PostgreSQL)"
@echo " make heroku-postgres - Set up Heroku PostgreSQL only"
@echo ""
@echo "Setup & Installation:"
@echo " make setup - Run automated setup script (local development)"
@echo " make install - Install production dependencies"
@echo " make install-dev - Install development dependencies"
@echo ""
@echo "Development:"
@echo " make dev - Start development server (http://localhost:7001)"
@echo " Studio available at http://localhost:7001/studio"
@echo " make test - Run all tests"
@echo " make test-cov - Run tests with coverage report"
@echo " make lint - Run code linters (flake8)"
@echo " make format - Format code with black"
@echo " make type-check - Run type checking with mypy"
@echo ""
@echo "Documentation:"
@echo " make docs-serve - Build docs and serve at http://localhost:7001/docs"
@echo " make docs-build - Build Sphinx documentation (single source of truth)"
@echo " Note: All docs (API + user guides) available at http://localhost:7001/docs"
@echo ""
@echo "Utilities:"
@echo " make clean - Clean temporary files and caches"
@echo ""
docker-setup: ## One-command Docker setup (recommended)
@echo "π³ Running Docker setup..."
@chmod +x scripts/setup/docker-setup.sh
@./scripts/setup/docker-setup.sh
docker-up: ## Start Docker containers (API, Swagger, Docs - everything at :7001)
@echo "π Starting AgentShip (API, Swagger, Docs)..."
@echo "π¦ Building Docker image (includes docs build)..."
@echo "π Available at: http://localhost:7001"
@echo " - API: http://localhost:7001"
@echo " - Swagger: http://localhost:7001/swagger"
@echo " - Docs: http://localhost:7001/docs (Sphinx docs built automatically)"
@echo " - Studio: http://localhost:7001/studio"
@DOCKER_BUILDKIT=1 docker compose up -d --build || DOCKER_BUILDKIT=1 docker-compose up -d --build
docker-down: ## Stop Docker containers
@echo "π Stopping AgentShip containers..."
@docker compose down || docker-compose down
docker-restart: ## Restart Docker containers (keeps everything running)
@echo "π Restarting AgentShip containers..."
@docker compose restart || docker-compose restart
docker-reload: ## Hard reload (rebuilds image, restarts everything)
@echo "π Hard reloading AgentShip (rebuilding image, restarting containers)..."
@echo "π Everything will be available at http://localhost:7001 after restart"
@docker compose down || docker-compose down
@DOCKER_BUILDKIT=1 docker compose build || DOCKER_BUILDKIT=1 docker-compose build
@docker compose up -d || docker-compose up -d
docker-logs: ## View Docker logs
@docker compose logs -f || docker-compose logs -f
docker-build: ## Rebuild Docker images
@DOCKER_BUILDKIT=1 docker compose build || DOCKER_BUILDKIT=1 docker-compose build
docker-build-clean: ## Rebuild Docker images from scratch (no cache)
@DOCKER_BUILDKIT=1 docker compose build --no-cache || DOCKER_BUILDKIT=1 docker-compose build --no-cache
heroku-deploy: ## Deploy to Heroku (one command, includes PostgreSQL)
@echo "βοΈ Deploying to Heroku..."
@chmod +x service_cloud_deploy/heroku/deploy_heroku.sh
@./service_cloud_deploy/heroku/deploy_heroku.sh
heroku-postgres: ## Set up Heroku PostgreSQL only
@echo "π Setting up Heroku PostgreSQL..."
@chmod +x agent_store_deploy/setup_heroku_postgres.sh
@./agent_store_deploy/setup_heroku_postgres.sh
setup: ## Run automated setup script (local development)
@echo "π Running AgentShip setup..."
@chmod +x scripts/setup/setup.sh
@./scripts/setup/setup.sh
install: ## Install production dependencies
pipenv install
install-dev: ## Install development dependencies
pipenv install --dev
dev: ## Start development server
@echo "π Starting AgentShip development server..."
@echo "π API docs will be available at http://localhost:7001/docs"
@echo "π Server will auto-reload on code changes"
@echo ""
pipenv run uvicorn src.service.main:app --reload --host 0.0.0.0 --port 7001
test: ## Run all tests
pipenv run pytest tests/ -v
test-memory: ## Run memory optimization tests
pipenv run pytest tests/unit/test_memory_optimizations.py -v
test-cov: ## Run tests with coverage
pipenv run pytest tests/ --cov=src --cov-report=html --cov-report=term
@echo ""
@echo "π Coverage report generated in htmlcov/index.html"
test-docker: ## Test memory optimizations in Docker (512MB limit)
@chmod +x scripts/test_memory_docker.sh
@./scripts/test_memory_docker.sh
lint: ## Run code linters
@echo "π Running linters..."
pipenv run flake8 src/ tests/ --max-line-length=120 --exclude=__pycache__,*.pyc
format: ## Format code with black
@echo "π¨ Formatting code with black..."
pipenv run black src/ tests/
type-check: ## Run type checking
@echo "π Running type checks..."
pipenv run mypy src/ --ignore-missing-imports || true
clean: ## Clean temporary files and caches
@echo "π§Ή Cleaning temporary files..."
find . -type d -name "__pycache__" -exec rm -r {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -r {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -r {} + 2>/dev/null || true
find . -type d -name ".mypy_cache" -exec rm -r {} + 2>/dev/null || true
find . -type d -name "htmlcov" -exec rm -r {} + 2>/dev/null || true
find . -type f -name ".coverage" -delete 2>/dev/null || true
@echo "β
Clean complete"
docs-serve: docs-build ## Build and serve documentation at http://localhost:7001/docs
@echo "π Building Sphinx documentation..."
@echo "π Starting AgentShip server with documentation at http://localhost:7001/docs"
@echo "π Server will auto-reload on code changes"
@echo ""
pipenv run uvicorn src.service.main:app --reload --host 0.0.0.0 --port 7001
docs-build: ## Build Sphinx documentation (single source of truth - API + user guides)
cd docs_sphinx && pipenv run sphinx-build -b html source build/html
docs-html: docs-build ## Alias for docs-build
@echo "π Documentation built in docs_sphinx/build/html/"
docs-clean: ## Clean Sphinx build files
rm -rf docs_sphinx/build/*
rm -rf docs_sphinx/source/_build