Phase 1: first-run setup wizard, bash installer, Docker profiles
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
# Provides easy commands for managing the cell
|
||||
|
||||
.PHONY: help start stop restart status logs clean setup check-deps init-peers \
|
||||
update reinstall uninstall \
|
||||
update reinstall uninstall install \
|
||||
build build-api build-webui \
|
||||
start-dns start-api start-wg start-webui \
|
||||
start-core start-dns start-api start-wg start-webui \
|
||||
backup restore \
|
||||
test test-all test-unit test-coverage test-api test-cli \
|
||||
test-phase1 test-phase2 test-phase3 test-phase4 test-all-phases \
|
||||
@@ -93,12 +93,12 @@ init-peers:
|
||||
|
||||
start:
|
||||
@echo "Starting Personal Internet Cell..."
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) up -d --build
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) --profile full up -d --build
|
||||
@echo "Services started. Check status with 'make status'"
|
||||
|
||||
stop:
|
||||
@echo "Stopping Personal Internet Cell..."
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) down
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) --profile full down
|
||||
@echo "Services stopped."
|
||||
|
||||
restart:
|
||||
@@ -135,17 +135,31 @@ update:
|
||||
$(MAKE) setup; \
|
||||
fi
|
||||
@echo "Rebuilding and restarting services..."
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) up -d --build
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) --profile full up -d --build
|
||||
@echo "Update complete. Run 'make status' to verify."
|
||||
|
||||
reinstall:
|
||||
@echo "Reinstalling Personal Internet Cell from scratch..."
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) down -v 2>/dev/null || true
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) --profile full down -v 2>/dev/null || true
|
||||
@sudo rm -rf config/ data/
|
||||
@$(MAKE) setup
|
||||
@$(MAKE) start
|
||||
@echo "Reinstall complete."
|
||||
|
||||
install:
|
||||
@if [ -f /opt/pic/.installed ] && [ "$(FORCE)" != "1" ]; then \
|
||||
echo "Already installed. Run 'make update' to update, or 'make install FORCE=1' to reinstall."; \
|
||||
exit 0; \
|
||||
fi
|
||||
@echo "Running setup..."
|
||||
@$(MAKE) setup
|
||||
@echo "Installing systemd unit..."
|
||||
@sudo cp scripts/pic.service /etc/systemd/system/pic.service
|
||||
@-sudo systemctl daemon-reload && sudo systemctl enable pic
|
||||
@sudo mkdir -p /opt/pic
|
||||
@sudo touch /opt/pic/.installed
|
||||
@echo "Installation complete. Run 'make start-core' to start core services."
|
||||
|
||||
uninstall:
|
||||
@echo ""
|
||||
@echo "This will stop and remove all containers."
|
||||
@@ -155,20 +169,24 @@ uninstall:
|
||||
case "$$ans" in \
|
||||
y|Y) \
|
||||
echo "Stopping containers and removing images..."; \
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) down -v --rmi all 2>/dev/null || true; \
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) --profile full down -v --rmi all 2>/dev/null || true; \
|
||||
echo "Deleting config/ and data/..."; \
|
||||
sudo rm -rf config/ data/; \
|
||||
echo "Uninstall complete. Git repo and scripts remain."; \
|
||||
;; \
|
||||
n|N|"") \
|
||||
echo "Stopping and removing containers (keeping images and data)..."; \
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) down 2>/dev/null || true; \
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) --profile full down 2>/dev/null || true; \
|
||||
echo "Done. Images, config/ and data/ are untouched. Run 'make start' to bring it back up."; \
|
||||
;; \
|
||||
*) \
|
||||
echo "Cancelled."; \
|
||||
;; \
|
||||
esac
|
||||
@-sudo systemctl disable pic 2>/dev/null || true
|
||||
@-sudo rm -f /etc/systemd/system/pic.service
|
||||
@-sudo rm -f /opt/pic/.installed
|
||||
@echo "Note: Data volumes were not deleted. To remove all data, manually delete config/ and data/."
|
||||
|
||||
# ── Build ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -188,17 +206,22 @@ build-webui:
|
||||
|
||||
# ── Individual services ───────────────────────────────────────────────────────
|
||||
|
||||
start-core:
|
||||
@echo "Starting core services (caddy, dns, wireguard, api, webui)..."
|
||||
PUID=$$(id -u) PGID=$$(id -g) $(DC) --profile core up -d --build
|
||||
@echo "Core services started. Run 'make start' to also bring up optional services."
|
||||
|
||||
start-dns:
|
||||
$(DC) up -d dns
|
||||
$(DC) --profile core up -d dns
|
||||
|
||||
start-api:
|
||||
$(DC) up -d api
|
||||
$(DC) --profile core up -d api
|
||||
|
||||
start-wg:
|
||||
$(DC) up -d wireguard
|
||||
$(DC) --profile core up -d wireguard
|
||||
|
||||
start-webui:
|
||||
$(DC) up -d webui
|
||||
$(DC) --profile core up -d webui
|
||||
|
||||
# ── Maintenance ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user