Makefile 2.24 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
.PHONY: documentation
2

3
setup:
4
	bash server/envs/init.sh
5 6

clear_setup:
7 8
	rm server/envs/db.env
	rm server/envs/django.env
9 10

up: setup
11 12 13 14 15 16 17 18 19
	docker-compose up --build

dev: up

down_dev:
	docker-compose down

init_dev_data:
	docker-compose exec backend sh -c "cd backend && ./manage.py shell < init_dev_data.py"
20

Florent Chehab's avatar
Florent Chehab committed
21 22 23
init_prod_data:
	docker-compose $(prod_yml) exec backend sh -c "cd backend && ./manage.py shell < init_prod_data.py"

Florent Chehab's avatar
Florent Chehab committed
24 25
docker-pull:
	docker-compose pull
Florent Chehab's avatar
Florent Chehab committed
26

Florent Chehab's avatar
Florent Chehab committed
27 28 29
reformat_backend:
	docker-compose exec backend sh -c "cd backend && black ."

Florent Chehab's avatar
Florent Chehab committed
30
test_backend:
31
	docker-compose exec backend sh -c "cd backend && pytest --cov --cov-config .coveragerc --cov-report term   base_app/ backend_app/"
32

33
test_frontend:
34
	docker-compose exec frontend sh -c "cd frontend && yarn test"
35

36
check_backend:
Florent Chehab's avatar
Florent Chehab committed
37 38 39 40 41 42
	docker-compose exec backend sh -c "cd backend && ./manage.py check"

lint_backend:
	docker-compose exec backend sh -c "cd backend && flake8"

lint_frontend:
43
	docker-compose exec frontend sh -c "cd frontend && yarn lint"
Florent Chehab's avatar
Florent Chehab committed
44 45

build_frontend:
46
	docker-compose exec frontend sh -c "cd frontend && yarn build"
47

Florent Chehab's avatar
Florent Chehab committed
48
shell_backend:
49
	docker-compose exec backend sh -c "cd backend && bash"
50

Florent Chehab's avatar
Florent Chehab committed
51
shell_frontend:
52 53 54 55
	docker-compose exec frontend sh -c "cd frontend && sh"

django_shell:
	docker-compose exec backend sh -c "cd backend && ./manage.py shell"
56

57
# Create or update UML diagrams for the documentation
58
documentation:
59 60
	docker-compose exec backend bash -c "cd documentation && make extract_django"
	docker-compose exec gen_doc_uml bash -c "cd /usr/src/app/documentation && make convert_to_svg"
61

62
documentation_clean:
63
	docker-compose exec backend bash -c "cd documentation && make clean"
64 65 66 67 68 69

prod_yml = -f ./server/docker-compose.prod.yml

prod: setup
	$(info In production, we need to reset the webpack-stats.json file to make sure the front is up-to-date)
	sudo rm -f frontend/webpack-stats.json
Florent Chehab's avatar
Florent Chehab committed
70 71
	# Need higher compose timeout as the big map container can take a lot of time to wake up
	COMPOSE_HTTP_TIMEOUT=600 docker-compose $(prod_yml) up --build -d
72 73 74 75

down_prod:
	docker-compose $(prod_yml) down

76 77 78
prod_docker_logs:
	docker-compose $(prod_yml) logs

79 80 81 82 83
shell_prod_logs:
	docker-compose $(prod_yml) exec logs_rotation /bin/sh -c "cd /var/log && /bin/sh"

shell_backend_prod:
	docker-compose $(prod_yml) exec backend sh -c "cd backend && bash"