fix: config persistence, setup script, and install docs

- app.py: ConfigManager now uses CONFIG_DIR env var for config file path
  instead of hardcoded './config/cell_config.json' — config was being read
  from the image's working directory, making all settings writes ephemeral
  (lost on container restart)
- wireguard_manager: generate_config uses configured address/port instead of
  hardcoded 10.0.0.1 in DNAT rules and Address field
- scripts/setup_cell.py: full setup script — generates WireGuard keys (wg
  binary or Python cryptography fallback), writes wg0.conf and cell_config.json
  with correct _identity key; CELL_NAME / VPN_ADDRESS / WG_PORT env vars
- Makefile: setup target passes env vars through; build-api / build-webui targets
- README: replace install.sh references with make setup && make start

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 07:37:11 -04:00
parent 848f8cfc7c
commit 4ed2a6cbae
5 changed files with 307 additions and 139 deletions
+27 -8
View File
@@ -1,22 +1,28 @@
# Personal Internet Cell - Makefile
# Provides easy commands for managing the cell
.PHONY: help start stop restart status logs clean setup init-peers
.PHONY: help start stop restart status logs clean setup init-peers build build-api build-webui
# Default target
help:
@echo "Personal Internet Cell - Management Commands"
@echo ""
@echo "Setup:"
@echo " setup - Initial setup and configuration"
@echo " init-peers - Initialize peer configuration"
@echo "Setup (run once on a fresh host):"
@echo " setup - Create dirs, generate WireGuard keys, write configs, then: make start"
@echo " Env vars: CELL_NAME=mycell CELL_DOMAIN=cell VPN_ADDRESS=10.0.0.1/24 WG_PORT=51820"
@echo " init-peers - Reset peer list to empty"
@echo ""
@echo "Management:"
@echo " start - Start all services"
@echo " start - Start all services (docker compose up -d)"
@echo " stop - Stop all services"
@echo " restart - Restart all services"
@echo " status - Show status of all services"
@echo " logs - Show logs from all services"
@echo " status - Show container status + API health"
@echo " logs - Follow logs from all services"
@echo ""
@echo "Build:"
@echo " build - Rebuild API image"
@echo " build-api - Rebuild API image (no cache)"
@echo " build-webui - Rebuild Web UI image (no cache)"
@echo ""
@echo "Individual Services:"
@echo " start-dns - Start DNS service only"
@@ -31,8 +37,11 @@ help:
# Setup commands
setup:
@echo "Setting up Personal Internet Cell..."
CELL_NAME=$(or $(CELL_NAME),mycell) \
CELL_DOMAIN=$(or $(CELL_DOMAIN),cell) \
VPN_ADDRESS=$(or $(VPN_ADDRESS),10.0.0.1/24) \
WG_PORT=$(or $(WG_PORT),51820) \
python3 scripts/setup_cell.py
@echo "Setup complete!"
init-peers:
@echo "Initializing peer configuration..."
@@ -113,6 +122,16 @@ build:
@echo "Building API service..."
docker-compose build api
build-api:
@echo "Rebuilding API (no cache)..."
docker-compose build --no-cache api
docker-compose up -d api
build-webui:
@echo "Rebuilding Web UI (no cache)..."
docker-compose build --no-cache webui
docker-compose up -d webui
# Testing commands
test:
@echo "Running all unit and integration tests with pytest..."