-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (59 loc) · 1.72 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
DC = docker compose
EXEC = docker exec -it
ENV = --env-file .env
APP_FILE = docker_compose/app.yaml
DB_FILE = docker_compose/db.yaml
REDIS_FILE = docker_compose/redis.yaml
APP_CONTAINER = app
DB_CONTAINER = postgres
REDIS_CONTAINER = redis-service
POSTGRES_USER = user # Change this to your user
POSTGRES_DB = code_to_cv_db # Change this to your database name
.PHONY: app
app:
$(DC) -f $(APP_FILE) $(ENV) up --build -d
.PHONY: app-down
app-down:
$(DC) -f $(APP_FILE) $(ENV) down --remove-orphans
.PHONY: app-exec
app-exec:
$(EXEC) $(APP_CONTAINER) bash
.PHONY: app-make-migrations
app-make-migrations:
$(EXEC) $(APP_CONTAINER) bash -c "alembic revision --autogenerate -m 'migration'"
.PHONY: app-migrate
app-migrate:
$(EXEC) $(APP_CONTAINER) bash -c "alembic upgrade head"
.PHONY: app-downgrade-migrations
app-downgrade-migrations:
$(EXEC) $(APP_CONTAINER) bash -c "alembic downgrade base"
.PHONY: app-create-superuser
app-create-superuser:
$(EXEC) $(APP_CONTAINER) bash -c "python3 app/users/actions/create_superuser.py"
.PHONY: app-logs
app-logs:
$(DC) -f $(APP_FILE) $(ENV) logs -f
.PHONY: db
db:
$(DC) -f $(DB_FILE) $(ENV) up --build -d
.PHONY: db-down
db-down:
$(DC) -f $(DB_FILE) $(ENV) down --remove-orphans
.PHONY: db-exec
db-exec:
$(EXEC) $(DB_CONTAINER) psql -U $(POSTGRES_USER) -d $(POSTGRES_DB)
.PHONY: db-logs
db-logs:
$(DC) -f $(DB_FILE) $(ENV) logs -f
.PHONY: redis-exec
redis-exec:
$(EXEC) $(REDIS_CONTAINER) redis-cli
.PHONY: all
all:
$(DC) -f $(APP_FILE) -f $(DB_FILE) -f $(REDIS_FILE) $(ENV) up --build -d
.PHONY: all-down
all-down:
$(DC) -f $(APP_FILE) -f $(DB_FILE) -f $(REDIS_FILE) $(ENV) down --remove-orphans
.PHONY: all-logs
all-logs:
$(DC) -f $(APP_FILE) -f $(DB_FILE) -f $(REDIS_FILE) $(ENV) logs -f