This repository was archived by the owner on Mar 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (46 loc) · 2.14 KB
/
Makefile
File metadata and controls
64 lines (46 loc) · 2.14 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
.PHONY: up down backup restore test logs clean help
# Default environment file
ENV_FILE ?= .env
# Load environment if exists
ifneq (,$(wildcard $(ENV_FILE)))
include $(ENV_FILE)
export
endif
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
up: ## Start all services
docker compose up -d --wait
down: ## Stop all services
docker compose down
backup: ## Trigger a manual backup
docker compose exec backup /scripts/backup.sh
restore: ## Restore a backup (usage: make restore FILE=backups/2024/01/01/myapp_120000.sql.gz)
@if [ -z "$(FILE)" ]; then echo "Usage: make restore FILE=path/to/backup.sql.gz"; exit 1; fi
docker compose exec backup /scripts/restore.sh $(FILE)
test: ## Run integration tests
docker compose -f docker-compose.yml -f docker-compose.test.yml up -d --build --wait
./test/integration.sh
docker compose -f docker-compose.yml -f docker-compose.test.yml down -v
logs: ## Show logs from all services
docker compose logs -f
logs-backup: ## Show logs from backup service
docker compose logs -f backup
clean: ## Stop services and remove volumes
docker compose down -v --remove-orphans
docker compose -f docker-compose.yml -f docker-compose.test.yml down -v --remove-orphans 2>/dev/null || true
build: ## Build the backup image
docker compose build backup
shell-backup: ## Open a shell in the backup container
docker compose exec backup sh
shell-postgres: ## Open psql in the postgres container
docker compose exec postgres psql -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-myapp}
list-backups: ## List all backups in S3
docker compose exec backup mc ls --recursive s3/backups/
cleanup: ## Run retention cleanup
docker compose exec backup /scripts/cleanup.sh
cleanup-dry-run: ## Preview retention cleanup (no deletions)
docker compose exec -e RETENTION_DRY_RUN=true backup /scripts/cleanup.sh
test-retention: ## Run retention cleanup tests
docker compose -f docker-compose.yml -f docker-compose.test.yml up -d --build --wait
./test/test-retention.sh
docker compose -f docker-compose.yml -f docker-compose.test.yml down -v