-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
60 lines (48 loc) · 1.77 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
include config.mk
##########################################################################
# MENU
##########################################################################
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
data/:
mkdir -p data/
env:
cp env.example env
.venv/: data/ env
python -m venv .venv/
source venv/bin/activate && pip install --upgrade pip
source venv/bin/activate && pip install -r requirements.txt
source venv/bin/activate && pip install -r requirements-dev.txt
source venv/bin/activate && pre-commit install
.PHONY: migrate
migrate: ## Run Django migrations
docker compose run -it --rm django ./manage.py migrate
.PHONY: superuser
superuser: ## Create a superuser
docker compose run -it --rm django ./manage.py createsuperuser
.PHONY: dev-bootstrap
dev-bootstrap: .venv/ ## Bootstrap the development environment
docker compose pull
docker compose build
docker compose up -d postgres
$(MAKE) migrate
$(MAKE) superuser
docker compose down
.PHONY: dev-start
dev-start: ## Start the development environment
docker compose up -d
sleep 5
curl --request PUT http://localhost:9000/testbucket
.PHONY: dev-stop
dev-stop: ## Stop the development environment
docker compose down
.PHONY: dev-restart-django
dev-restart-django: ## Restart the Django service
docker compose up -d --force-recreate django
.PHONY: snapshot-local-db
snapshot-local-db: ## Create a snapshot of the local database
docker compose exec postgres pg_dump -U postgres -Fc django_reference > django_reference.dump
.PHONY: restore-local-db
restore-local-db: ## Restore the local database from a snapshot
docker compose exec -T postgres pg_restore -U postgres -d django_reference < django_reference.dump