diff --git a/Makefile b/Makefile index 918be04..0981e01 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Personal Internet Cell - Makefile # Provides easy commands for managing the cell -.PHONY: help start stop restart status logs clean setup init-peers build build-api build-webui +.PHONY: help start stop restart status logs clean setup check-deps 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") @@ -38,8 +38,20 @@ help: @echo " restore - Restore from backup" # Setup commands -setup: +check-deps: + @echo "Checking system dependencies..." + @which python3 >/dev/null 2>&1 || (echo "Installing python3..." && sudo apt-get install -y python3) + @which pip3 >/dev/null 2>&1 || (echo "Installing pip3..." && sudo apt-get install -y python3-pip) + @python3 -c "import cryptography" 2>/dev/null || \ + (echo "Installing python3-cryptography..." && \ + (sudo apt-get install -y python3-cryptography 2>/dev/null || \ + pip3 install --break-system-packages cryptography 2>/dev/null || \ + pip3 install cryptography)) + @echo "Dependencies OK." + +setup: check-deps @echo "Setting up Personal Internet Cell..." + @sudo chown -R $$(id -u):$$(id -g) config/ data/ 2>/dev/null || true CELL_NAME=$(or $(CELL_NAME),mycell) \ CELL_DOMAIN=$(or $(CELL_DOMAIN),cell) \ VPN_ADDRESS=$(or $(VPN_ADDRESS),10.0.0.1/24) \ @@ -56,17 +68,17 @@ init-peers: # Management commands start: @echo "Starting Personal Internet Cell..." - $(DC) up -d --build + PUID=$$(id -u) PGID=$$(id -g) $(DC) up -d --build @echo "Services started. Check status with 'make status'" stop: @echo "Stopping Personal Internet Cell..." - $(DC) down + PUID=$$(id -u) PGID=$$(id -g) $(DC) down @echo "Services stopped." restart: @echo "Restarting Personal Internet Cell..." - $(DC) restart + PUID=$$(id -u) PGID=$$(id -g) $(DC) restart @echo "Services restarted." status: diff --git a/docker-compose.yml b/docker-compose.yml index 52da41c..79e5721 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -164,8 +164,8 @@ services: container_name: cell-wireguard environment: - SERVERMODE=true - - PUID=911 - - PGID=911 + - PUID=${PUID:-1000} + - PGID=${PGID:-1000} ports: - "51820:51820/udp" volumes: