forked from vas3k/vas3k.club
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (63 loc) · 2.29 KB
/
Makefile
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
# Set the default goal if no targets were specified on the command line
.DEFAULT_GOAL = run
# Makes shell non-interactive and exit on any error
.SHELLFLAGS = -ec
PROJECT_NAME=vas3k_club
run-dev: ## Runs dev server
pipenv run python manage.py runserver 0.0.0.0:8000
run-queue: ## Runs task broker
pipenv run python manage.py qcluster
docker-run-queue:
python manage.py qcluster
run-uvicorn: ## Runs uvicorn (ASGI) server in managed mode
pipenv run uvicorn --fd 0 --lifespan off club.asgi:application
docker-run-dev: ## Runs dev server in docker
python ./utils/wait_for_postgres.py
python manage.py migrate
python manage.py update_tags
python manage.py runserver 0.0.0.0:8000
docker-run-production: ## Runs production server in docker
python3 manage.py migrate
gunicorn club.asgi:application -w 7 -k uvicorn.workers.UvicornWorker --bind=0.0.0.0:8814 --capture-output --log-level debug --access-logfile - --error-logfile -
help: ## Display this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[0;32m%-30s\033[0m %s\n", $$1, $$2}'
lint: ## Lint code with flake8
@pipenv run flake8 $(PROJECT_NAME)
requirements: ## Generate requirements.txt for production
pipenv lock --requirements > requirements.txt
dev_requirements: ## Generate dev_requirements.txt for development
pipenv lock --dev-only --requirements > dev_requirements.txt
migrate: ## Migrate database to the latest version
pipenv run python3 manage.py migrate
docker-migrate:
python3 manage.py migrate
build-frontend: ## Runs webpack
npm run --prefix frontend build
test:
pipenv run python3 manage.py test
test-ci: ## Run tests (intended for CI usage)
python3 manage.py test
psql:
psql -h localhost -p 5433 -d vas3k_club -U vas3k
redeploy:
npm run --prefix frontend build
docker-compose -f docker-compose.production.yml build club_app
docker-compose -f docker-compose.production.yml up --no-deps -d club_app
docker-compose -f docker-compose.production.yml build queue
docker-compose -f docker-compose.production.yml up --no-deps -d queue
docker image prune --force
.PHONY: \
docker-run-dev \
docker-run-production \
run-dev \
run-queue \
run-uvicorn \
requirements \
help \
lint \
migrate \
build-frontend \
test-ci \
redeploy-production