Files
homelab-infra/Makefile
James Thompson 28aa6e28fe Wokring traefik
With whoami and gitea working (although I haven't rebuilt yet)
2026-03-23 05:59:53 +00:00

88 lines
2.5 KiB
Makefile
Executable File

SERVICES=traefik whoami gitea nextcloud devbox
.PHONY: up down restart backup init-env env-sync docs generate-docs serve-docs logs status up-% down-%
up:
for svc in $(SERVICES); do \
if [ -f "$$svc/docker-compose.yml" ]; then \
echo "Starting $$svc..."; \
(cd $$svc && docker compose --env-file ../.env `if [ -f .env ]; then echo --env-file .env; fi` up -d); \
fi; \
done; \
up-%:
@svc=$*; \
if [ -f "$$svc/docker-compose.yml" ]; then \
echo "Starting $$svc..."; \
(cd $$svc && docker compose --env-file ../.env `if [ -f .env ]; then echo --env-file .env; fi` up -d); \
fi
down-%:
@svc=$*; \
if [ -f "$$svc/docker-compose.yml" ]; then \
echo "Stopping $$svc..."; \
(cd $$svc && docker compose down); \
fi
down:
@for svc in $(SERVICES); do \
if [ -f "$$svc/docker-compose.yml" ]; then \
echo "Stopping $$svc..."; \
(cd $$svc && docker compose down); \
fi; \
done
restart: down up
logs:
@echo "=== Traefik ===" && (cd traefik && docker compose logs --tail=10)
@echo "=== Gitea ===" && (cd gitea && docker compose logs --tail=10)
@echo "=== Nextcloud ===" && (cd nextcloud && docker compose logs --tail=10)
status:
@for svc in $(SERVICES); do \
if [ -f "$$svc/docker-compose.yml" ]; then \
echo "--- $$svc ---"; \
(cd $$svc && docker compose ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}"); \
fi; \
done
backup:
./backup.sh
init-env:
@echo "Initializing .env files from .env.example..."
@find . -path './.git' -prune -o -type f -name '.env.example' -print | while read -r example; do \
env_file="$${example%.example}"; \
if [ -f "$$env_file" ]; then \
echo "Skip (exists): $$env_file"; \
else \
cp "$$example" "$$env_file"; \
echo "Created: $$env_file"; \
fi; \
done
env-sync:
python3 scripts/check_env_sync.py --fix
generate-docs:
python3 scripts/generate_docs.py
docs: generate-docs
@command -v uvx >/dev/null 2>&1 || { \
echo "Error: uvx is not installed or not in PATH."; \
echo "Install with: curl -LsSf https://astral.sh/uv/install.sh | sh"; \
echo "Then run: source $$HOME/.local/bin/env"; \
exit 1; \
}
uvx --from mkdocs-material --with mkdocs-include-markdown-plugin mkdocs build
serve-docs: generate-docs
@command -v uvx >/dev/null 2>&1 || { \
echo "Error: uvx is not installed or not in PATH."; \
echo "Install with: curl -LsSf https://astral.sh/uv/install.sh | sh"; \
echo "Then run: source $$HOME/.local/bin/env"; \
exit 1; \
}
uvx --from mkdocs-material --with mkdocs-include-markdown-plugin mkdocs serve --dev-addr 0.0.0.0:8000