This repository has been archived by the owner on Jan 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (53 loc) · 1.67 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
SHELL = /bin/bash
LANG = en_US.utf-8
PYTHON = $(shell which python3 || which python)
export LANG
SCHEMA_FILES = $(shell find tds/schema/ tds/autogen/ -type f -name '*.py')
DATA_PY_FILES = $(shell find scripts/ -type f -name '*.py')
S3_BUCKET := $(shell grep S3_BUCKET api.env | cut -d '=' -f2)
.PHONY:init
init:
cp api.env.sample api.env
poetry install;
poetry run pre-commit install
.PHONY:tidy
tidy:
poetry run pre-commit run;
poetry run pylint ./tds ./migrations
.PHONY:test
test:
poetry run pytest
.PHONY:up
up:
docker compose --env-file api.env up -d;
.PHONY:build
build:
docker compose --env-file api.env up --build -d;
.PHONY: gen-migration
gen-migration:
@echo -n -e "\\nEnter a description of the migration: "; \
read message; \
docker compose --env-file api.env exec -u $${UID} api alembic -c migrations/alembic.ini revision --autogenerate -m "$${message:-$$(date -u +'%Y%m%d%H%M%S')}" | \
sed 's|/api/||'
.PHONY: run-migrations
run-migrations:
docker compose --env-file api.env build migrations --no-cache;
docker compose --env-file api.env start migrations;
.PHONY:populate
populate:up
poetry run python3 scripts/upload_demo_data.py || (sleep 3; docker compose logs api; false);
.PHONY:fake
fake:up
poetry run python3 scripts/upload_demo_data.py --fake
.PHONY:down
down:
docker compose --env-file api.env down;
.PHONY:db-clean
db-clean:
docker volume rm data-service_elasticsearch_data data-service_kibanadata data-service_tds_data data-service_neo4j_data
.PHONY:repopulate-db
repopulate-db:
# Check if we need to rebuild the .sql files by checking if any prerequisite files are newer than the .sql files
make down; \
make db-clean; \
SEED_DATA=true make up