The new index on the `user_id` column in the `profiles` table improves query performance when filtering or joining by user identifier, reducing full table scans during authentication and profile retrieval operations.
73 lines
2.2 KiB
Makefile
73 lines
2.2 KiB
Makefile
LOCUST_PORT ?= 10502
|
|
LOCUST_WEB_PORT ?= 10503
|
|
LOCUST_DB_DIR ?= /tmp/devplace_locust
|
|
LOCUST_DB ?= $(LOCUST_DB_DIR)/datastore.db
|
|
LOCUST_USERS ?= 20
|
|
LOCUST_SPAWN_RATE ?= 5
|
|
LOCUST_RUN_TIME ?= 120s
|
|
|
|
.PHONY: install dev clean test test-headed demo locust locust-headless
|
|
|
|
install:
|
|
pip install -e .
|
|
|
|
dev:
|
|
uvicorn devplacepy.main:app --reload --host 0.0.0.0 --port 10500 --backlog 4096
|
|
|
|
prod:
|
|
uvicorn devplacepy.main:app --host 0.0.0.0 --port 10500 --workers 2 --backlog 8192 --proxy-headers --forwarded-allow-ips '*'
|
|
|
|
test:
|
|
PLAYWRIGHT_HEADLESS=1 python -m pytest tests/ -v --tb=line -x
|
|
|
|
test-headed:
|
|
PLAYWRIGHT_HEADLESS=0 python -m pytest tests/ -v -n auto --tb=line -x
|
|
|
|
demo:
|
|
PLAYWRIGHT_HEADLESS=0 python -m pytest tests/test_demo.py -v -s --tb=line -x
|
|
|
|
locust:
|
|
export DEVPLACE_DATABASE_URL="sqlite:///$(LOCUST_DB)"; \
|
|
mkdir -p $(LOCUST_DB_DIR); \
|
|
rm -f $(LOCUST_DB); \
|
|
uvicorn devplacepy.main:app --host 127.0.0.1 --port $(LOCUST_PORT) --backlog 8192 > /tmp/devplace_locust_server.log 2>&1 & \
|
|
PID=$$!; \
|
|
while ! curl -s http://127.0.0.1:$(LOCUST_PORT)/ > /dev/null 2>&1; do sleep 0.5; done; \
|
|
locust --host http://127.0.0.1:$(LOCUST_PORT) --web-port $(LOCUST_WEB_PORT); \
|
|
kill $$PID 2>/dev/null || true; \
|
|
rm -rf $(LOCUST_DB_DIR)
|
|
|
|
locust-headless:
|
|
export DEVPLACE_DATABASE_URL="sqlite:///$(LOCUST_DB)"; \
|
|
mkdir -p $(LOCUST_DB_DIR); \
|
|
rm -f $(LOCUST_DB); \
|
|
uvicorn devplacepy.main:app --host 127.0.0.1 --port $(LOCUST_PORT) --backlog 8192 > /tmp/devplace_locust_server.log 2>&1 & \
|
|
PID=$$!; \
|
|
while ! curl -s http://127.0.0.1:$(LOCUST_PORT)/ > /dev/null 2>&1; do sleep 0.5; done; \
|
|
locust --host http://127.0.0.1:$(LOCUST_PORT) --headless -u $(LOCUST_USERS) -r $(LOCUST_SPAWN_RATE) --run-time $(LOCUST_RUN_TIME) --html=$(LOCUST_DB_DIR)/report.html; \
|
|
kill $$PID 2>/dev/null || true; \
|
|
rm -rf $(LOCUST_DB_DIR)
|
|
|
|
clean:
|
|
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
find . -type f -name '*.pyc' -delete
|
|
rm -rf devplacepy.egg-info
|
|
rm -rf .venv
|
|
|
|
.PHONY: docker-build docker-up docker-down docker-logs docker-clean
|
|
|
|
docker-build:
|
|
docker compose build
|
|
|
|
docker-up:
|
|
docker compose up -d
|
|
|
|
docker-down:
|
|
docker compose down
|
|
|
|
docker-logs:
|
|
docker compose logs -f
|
|
|
|
docker-clean:
|
|
docker compose down -v
|