-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (48 loc) · 1.71 KB
/
Makefile
File metadata and controls
60 lines (48 loc) · 1.71 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
.PHONY: help build up down restart logs shell clean
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## Build Docker containers
docker compose build
up: ## Start containers
docker compose up -d
down: ## Stop containers
docker compose down
restart: ## Restart containers
docker compose restart
logs: ## View container logs
docker compose logs -f
shell: ## Access web container shell
docker compose exec web bash
db-shell: ## Access MariaDB shell
docker compose exec db mariadb -u root -prootpassword divera_stein_sync
clean: ## Clean up containers and volumes
docker compose down -v
install: ## Initial installation
@echo "Creating .env file..."
@cp .env.example .env
@echo "Building containers..."
@make build
@echo "Starting services..."
@make up
@echo ""
@echo "Installation complete!"
@echo "Dashboard: http://localhost:8080"
@echo "phpMyAdmin: http://localhost:8081"
@echo ""
@echo "Please edit .env file with your API keys"
backup: ## Backup database
@mkdir -p backups
docker compose exec db mariadb-dump -u root -prootpassword divera_stein_sync > backups/backup_$(shell date +%Y%m%d_%H%M%S).sql
@echo "Backup created in backups/ directory"
restore: ## Restore database from latest backup
@latest_backup=$(ls -t backups/*.sql | head -1); \
if [ -z "$latest_backup" ]; then \
echo "No backup found in backups/ directory"; \
else \
echo "Restoring from $latest_backup..."; \
docker compose exec -T db mariadb -u root -prootpassword divera_stein_sync < $latest_backup; \
echo "Restore complete"; \
fi