|
| 1 | +# Makefile — IT-Stack NEXTCLOUD (Module 06) |
| 2 | +.PHONY: help build install test test-lab-01 test-lab-02 test-lab-03 \ |
| 3 | + test-lab-04 test-lab-05 test-lab-06 deploy clean lint |
| 4 | + |
| 5 | +COMPOSE_STANDALONE = docker/docker-compose.standalone.yml |
| 6 | +COMPOSE_LAN = docker/docker-compose.lan.yml |
| 7 | +COMPOSE_ADVANCED = docker/docker-compose.advanced.yml |
| 8 | +COMPOSE_SSO = docker/docker-compose.sso.yml |
| 9 | +COMPOSE_INTEGRATION= docker/docker-compose.integration.yml |
| 10 | +COMPOSE_PRODUCTION = docker/docker-compose.production.yml |
| 11 | + |
| 12 | +help: ## Show this help |
| 13 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' |
| 14 | + |
| 15 | +build: ## Build Docker image |
| 16 | + docker build -t it-stack/nextcloud:latest . |
| 17 | + |
| 18 | +install: ## Start standalone (Lab 01) environment |
| 19 | + docker compose -f $$(COMPOSE_STANDALONE) up -d |
| 20 | + @echo "Waiting for nextcloud to be ready..." |
| 21 | + @sleep 10 |
| 22 | + @docker compose -f $$(COMPOSE_STANDALONE) ps |
| 23 | + |
| 24 | +test: test-lab-01 ## Run default test (Lab 01) |
| 25 | + |
| 26 | +test-lab-01: ## Lab 01 — Standalone |
| 27 | + @bash tests/labs/test-lab-06-01.sh |
| 28 | + |
| 29 | +test-lab-02: ## Lab 02 — External Dependencies |
| 30 | + @bash tests/labs/test-lab-06-02.sh |
| 31 | + |
| 32 | +test-lab-03: ## Lab 03 — Advanced Features |
| 33 | + @bash tests/labs/test-lab-06-03.sh |
| 34 | + |
| 35 | +test-lab-04: ## Lab 04 — SSO Integration |
| 36 | + @bash tests/labs/test-lab-06-04.sh |
| 37 | + |
| 38 | +test-lab-05: ## Lab 05 — Advanced Integration |
| 39 | + @bash tests/labs/test-lab-06-05.sh |
| 40 | + |
| 41 | +test-lab-06: ## Lab 06 — Production Deployment |
| 42 | + @bash tests/labs/test-lab-06-06.sh |
| 43 | + |
| 44 | +deploy: ## Deploy to target server (lab-app1) |
| 45 | + ansible-playbook -i ansible/inventory.yml ansible/playbooks/deploy-nextcloud.yml |
| 46 | + |
| 47 | +clean: ## Stop and remove all containers and volumes |
| 48 | + docker compose -f $$(COMPOSE_STANDALONE) down -v --remove-orphans |
| 49 | + docker compose -f $$(COMPOSE_LAN) down -v --remove-orphans 2>/dev/null || true |
| 50 | + docker compose -f $$(COMPOSE_ADVANCED) down -v --remove-orphans 2>/dev/null || true |
| 51 | + |
| 52 | +lint: ## Lint docker-compose and shell scripts |
| 53 | + docker compose -f $$(COMPOSE_STANDALONE) config -q |
| 54 | + @for f in tests/labs/*.sh; do shellcheck $$f; done |
0 commit comments