-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (61 loc) · 2.41 KB
/
Makefile
File metadata and controls
83 lines (61 loc) · 2.41 KB
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
80
81
82
83
PRE_COMMIT_VERSION ?= 4.3.0
.PHONY: init playwright test reinit check backup-database backup-file-storage backup restore-database restore-file-storage restore docs launch clean clean-all config get-backup-timestamp
init:
@test -d .venv || python3 -m venv .venv
.venv/bin/python -m pip install "pre-commit==$(PRE_COMMIT_VERSION)"
.venv/bin/pre-commit install
playwright: init
.venv/bin/python -m pip install playwright pytest pytest-playwright pytest-order requests pydantic
.venv/bin/playwright install
test: playwright
DEBUG=pw:api .venv/bin/pytest --capture=no --exitfirst
test-ui: playwright
DEBUG=pw:api .venv/bin/pytest --headed --capture=no --exitfirst
reinit:
rm -rf .venv
$(MAKE) init
install-loki-driver:
docker plugin ls --format '{{.Name}}' | grep -q 'loki:latest' || ./scripts/install-loki-driver.sh
docker plugin ls
check:
.venv/bin/pre-commit run --all-files
BACKUP_TIMESTAMP ?= $(shell date -u +%Y-%m-%d_%H-%M-%S_%Z)
get-backup-timestamp:
@echo $(BACKUP_TIMESTAMP)
backup-database:
mkdir -p ./backups
docker compose run -e BACKUP_TIMESTAMP=$(BACKUP_TIMESTAMP) --rm backup-database
backup-file-storage:
mkdir -p ./backups
docker compose run -e BACKUP_TIMESTAMP=$(BACKUP_TIMESTAMP) --rm backup-file-storage
backup: backup-database backup-file-storage
restore-database:
docker compose stop app
docker compose run --rm restore-database
docker compose start app
restore-file-storage:
docker compose stop app
docker compose run --rm restore-file-storage
docker compose start app
restore:
docker compose stop app
docker compose run --rm restore-database
docker compose run --rm restore-file-storage
docker compose start app
docs:
mkdir -p ./docs
docker compose run --rm compose-docs > docs/environment-variables.md
COMPOSE_CMD = docker compose -f docker-compose.yml -f overlays/traefik-dashboard/docker-compose.yml -f overlays/monitoring/docker-compose.yml -f overlays/profiling/docker-compose.yml -f overlays/glowroot/docker-compose.yml
launch: install-loki-driver
$(COMPOSE_CMD) up $(COMPOSE_OPTS)
clean:
$(COMPOSE_CMD) down --remove-orphans
clean-all:
@if [ -t 0 ]; then \
echo "WARNING: This will destroy all Docker volumes (database, file storage, monitoring data, etc.)."; \
echo "This action is irreversible."; \
read -p "Are you sure? [y/N] " confirm && [ "$$confirm" = "y" ] || (echo "Aborted." && exit 1); \
fi
$(COMPOSE_CMD) down --remove-orphans --volumes
config:
@$(COMPOSE_CMD) config