-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
73 lines (51 loc) · 2.11 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
export COMPOSE_FILE=deployment/docker-compose.yml
export COMPOSE_PROJECT_NAME=catalogue
export PROJECT_ID=catalogue
OPTS :=
help: ## Print this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
setup: pull build up db-restore migrate ## first setup
deploy: ## Build and push the to the private repo
docker-compose build uwsgi
docker tag catalogue_uwsgi:latest cr.kartoza.com/sansa_catalogue
docker push cr.kartoza.com/sansa_catalogue
pull: ## Pull pre-built images
docker-compose pull
build: ## Build base images
docker-compose build
db_up:
docker-compose up -d db
docker-compose run check_db
up: db_up ## Bring the containers up
docker-compose up -d devweb
prod_certs:
bash init-letsencrypt.sh
production_up: db_up
docker-compose up -d dbbackups
docker-compose up -d web
down: ## Bring down the containers
docker-compose down
run: ## Run Django Server
docker-compose exec devweb python manage.py runserver --verbosity 3 0.0.0.0:8080
restart: down up
clean: ## Cleanup local docker files for this project
docker-compose down --rmi all -v
-sudo rm -rf deployment/backups deployment/data deployment/logs deployment/media deployment/pg deployment/reports deployment/static
shell: ## Get into the django shell
docker-compose exec devweb bash
pyshell: ## Get into the django python shell
docker-compose exec devweb python manage.py shell
migrate: ## Run migrations
docker-compose exec devweb python manage.py migrate
makemigrations: ## Create migrations
docker-compose exec devweb python manage.py makemigrations
test: ## Run test cases
docker-compose exec devweb python manage.py test $(OPTS)
db-backup: ## Create a database backup
docker-compose exec db su - postgres -c "pg_dumpall" | gzip -9 > latest.sql.gz
db-restore: ## Restore a database backup
gzip -cd latest.sql.gz | docker exec -i $(PROJECT_ID)-db bash -c 'PGPASSWORD=docker psql -U docker -h localhost postgres'
db-shell:
docker-compose exec db bash
django-test:
@docker-compose exec devweb python manage.py test --noinput --verbosity 3 catalogue