From f78a99bbd426f2119afee1eb6833bbad4679120b Mon Sep 17 00:00:00 2001 From: Dmitrii Iurco Date: Wed, 22 Apr 2026 07:45:56 -0400 Subject: [PATCH] fix: Makefile supports docker compose v2 plugin and v1 standalone DC variable auto-detects available command at build time. Also fixes backup and dev targets that incorrectly used $(DC).yml. Co-Authored-By: Claude Sonnet 4.6 --- Makefile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 32dbe86..4115f3e 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ .PHONY: help start stop restart status logs clean setup init-peers build build-api build-webui +# Detect docker compose command (v2 plugin preferred, fallback to v1 standalone) +DC := $(shell docker compose version >/dev/null 2>&1 && echo "docker compose" || echo "docker-compose") + # Default target help: @echo "Personal Internet Cell - Management Commands" @@ -51,52 +54,52 @@ init-peers: # Management commands start: @echo "Starting Personal Internet Cell..." - docker-compose up -d + $(DC) up -d @echo "Services started. Check status with 'make status'" stop: @echo "Stopping Personal Internet Cell..." - docker-compose down + $(DC) down @echo "Services stopped." restart: @echo "Restarting Personal Internet Cell..." - docker-compose restart + $(DC) restart @echo "Services restarted." status: @echo "Personal Internet Cell Status:" @echo "================================" - docker-compose ps + $(DC) ps @echo "" @echo "API Status:" @curl -s http://localhost:3000/health || echo "API not responding" logs: @echo "Showing logs from all services..." - docker-compose logs -f + $(DC) logs -f # Individual service commands start-dns: @echo "Starting DNS service..." - docker-compose up -d dns + $(DC) up -d dns start-api: @echo "Starting API service..." - docker-compose up -d api + $(DC) up -d api start-wg: @echo "Starting WireGuard service..." - docker-compose up -d wireguard + $(DC) up -d wireguard start-webui: @echo "Starting WebUi service..." - docker-compose up -d webui + $(DC) up -d webui # Maintenance commands clean: @echo "Cleaning up containers and volumes..." - docker-compose down -v + $(DC) down -v docker system prune -f @echo "Cleanup complete." @@ -116,21 +119,21 @@ restore: # Development commands dev: @echo "Starting development environment..." - docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d + $(DC) -f docker-compose.yml -f docker-compose.dev.yml up -d build: @echo "Building API service..." - docker-compose build api + $(DC) build api build-api: @echo "Rebuilding API (no cache)..." - docker-compose build --no-cache api - docker-compose up -d api + $(DC) build --no-cache api + $(DC) up -d api build-webui: @echo "Rebuilding Web UI (no cache)..." - docker-compose build --no-cache webui - docker-compose up -d webui + $(DC) build --no-cache webui + $(DC) up -d webui # Testing commands test: