diff --git a/AGENTS.md b/AGENTS.md index 8b7c9bb..83fc9b9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,8 +28,7 @@ NexusGuard SD-WAN Suite: Enterprise Zero-Trust SD-WAN with WireGuard tunneling, ├── docker-compose.yml # Production orchestration ├── docker-compose.dev.yml# Dev (air hot-reload) ├── Makefile # up/down/dev/migrate/reset-db -├── setup.sh # First-run: generate .env + random keys -├── update.sh # Docker update: pull/build/migrate +├── update.sh # Docker update: auto-generate .env + pull/build/migrate ├── nexusguard-install.sh # Native install (systemd + nginx) ├── nexusguard-uninstall.sh ├── .env.example # DB/JWT/SALT/VITE config template diff --git a/README.md b/README.md index 6b00a8b..ea9cdb7 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,17 @@ Clone this repository and start all services: ```bash git clone https://git.datadunia.com/nexusguard/Nexus-Guard-Suite.git cd Nexus-Guard-Suite -./setup.sh # Generate .env file automatically -# Edit .env with your configuration -bash update.sh # Pull, build, migrate, and start +bash update.sh # Auto-generates .env + pulls, builds, migrates, starts ``` The first run will automatically: -- Pull the latest code and build the Docker containers (via `update.sh`). +- Generate `.env` from `.env.example` with auto-generated JWT/SALT keys. +- Pull the latest code and build the Docker containers. - Auto-generate the **Local Primary Node** WireGuard keys on the first boot. - Create the database schema via automated migration. +Edit `.env` afterward to customize `DB_PASSWORD`, `API_PORT`, `VITE_API_BASE_URL`. + **Update Options:** ```bash bash update.sh # Smart update (only rebuild if changes detected) @@ -268,8 +269,7 @@ NexusGuard/ ├── bin/ # Built binaries (gitignored) ├── docker-compose.yml # Docker orchestration ├── docker-compose.dev.yml # Docker dev (hot-reload) -├── update.sh # Docker update script -├── setup.sh # Docker initial setup +├── update.sh # Docker update + auto-setup script ├── nexusguard-install.sh # Native install script ├── nexusguard-uninstall.sh # Native uninstall script ├── .env.example # Environment template diff --git a/docs/portfolio/README.md b/docs/portfolio/README.md index f10301c..611ae85 100644 --- a/docs/portfolio/README.md +++ b/docs/portfolio/README.md @@ -43,7 +43,6 @@ NexusGuard is a production-grade, zero-trust SD-WAN solution built with Go, Vue ```bash git clone https://git.datadunia.com/nexusguard/Nexus-Guard-Suite.git cd Nexus-Guard-Suite -./setup.sh bash update.sh ``` diff --git a/docs/portfolio/deployment.md b/docs/portfolio/deployment.md index 468385b..772cd4c 100644 --- a/docs/portfolio/deployment.md +++ b/docs/portfolio/deployment.md @@ -17,13 +17,7 @@ NexusGuard supports three deployment modes: Docker (recommended), native install git clone https://git.datadunia.com/nexusguard/Nexus-Guard-Suite.git cd Nexus-Guard-Suite -# Generate .env file -./setup.sh - -# Edit configuration -nano .env - -# Start all services +# Start all services (auto-generates .env on first run) bash update.sh ``` @@ -49,7 +43,7 @@ DB_NAME=nexusguard # Redis REDIS_ADDR=redis:6379 -# Security (auto-generated by setup.sh) +# Security (auto-generated by update.sh) JWT_SECRET= SERVER_SALT= diff --git a/docs/portfolio/features.md b/docs/portfolio/features.md index 4d592ab..790c8b6 100644 --- a/docs/portfolio/features.md +++ b/docs/portfolio/features.md @@ -246,7 +246,6 @@ Time-limited config sharing: ```bash git clone https://git.datadunia.com/nexusguard/Nexus-Guard-Suite.git cd Nexus-Guard-Suite -./setup.sh bash update.sh ``` diff --git a/docs/superpowers/specs/2026-06-21-nexusguard-portfolio-design.md b/docs/superpowers/specs/2026-06-21-nexusguard-portfolio-design.md index 503e250..1ee4d54 100644 --- a/docs/superpowers/specs/2026-06-21-nexusguard-portfolio-design.md +++ b/docs/superpowers/specs/2026-06-21-nexusguard-portfolio-design.md @@ -172,7 +172,7 @@ Technical and precise. Avoid marketing buzzwords. Focus on: **Content:** - Docker (Recommended): - - Quick start (setup.sh + update.sh) + - Quick start (bash update.sh) - Configuration (.env) - Makefile commands (up, down, logs, dev, migrate, reset-db) - Native Install: diff --git a/setup.sh b/setup.sh deleted file mode 100755 index 94092c1..0000000 --- a/setup.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -e - -echo "=========================================" -echo " NexusGuard SD-WAN: INITIAL SETUP " -echo "=========================================" - -# 1. Environment File Generation -if [ ! -f .env ]; then - echo "[!] .env file not found." - if [ -f .env.example ]; then - echo "[+] Auto-generating .env from .env.example..." - cp .env.example .env - - # Generate secure random hex keys - RANDOM_JWT=$(openssl rand -hex 32) - RANDOM_SALT=$(openssl rand -hex 32) - - sed -i "s/GantiDenganKunciRahasiaJWTUntukDashboard256Bit/$RANDOM_JWT/g" .env - sed -i "s/GantiDenganKunciGaramUntukWireGuard256Bit/$RANDOM_SALT/g" .env - - echo "[+] Secure cryptographic keys have been auto-generated!" - else - echo "[-] ERROR: .env.example is missing. Cannot generate .env." - exit 1 - fi -else - echo "[+] .env file already exists. Skipping environment generation." -fi - -# Make sure Docker Compose v2 is available -if ! docker compose version &> /dev/null; then - echo "[-] ERROR: docker compose (v2) is not available. Please install Docker and Docker Compose plugin." - exit 1 -fi - -echo "" -echo "=========================================" -echo " Setup complete! Next Steps: " -echo " 1. Open and review the '.env' file. " -echo " Make sure to change DB_PASSWORD, " -echo " API_PORT, and VITE_API_BASE_URL. " -echo " " -echo " 2. Run 'bash update.sh' to download the " -echo " latest code, build, and start the " -echo " system. The script will also run " -echo " database migrations automatically. " -echo " " -echo " 3. Create your Admin account: " -echo " docker exec -it nexus-guard-suite-server-core-1 ./server-core -create-admin -user \"admin\" -pass \"PasswordKuat123!\"" -echo "=========================================" diff --git a/update.sh b/update.sh index a265831..3b4354a 100755 --- a/update.sh +++ b/update.sh @@ -32,10 +32,28 @@ while [[ $# -gt 0 ]]; do esac done -# 1. Pastikan file env ada +# 1. Auto-generate .env jika belum ada (seamless first-run) if [ ! -f .env ]; then - echo "[-] ERROR: .env file not found. Please run ./setup.sh first to initialize configuration." - exit 1 + echo "[!] .env file not found." + if [ -f .env.example ]; then + echo "[+] Auto-generating .env from .env.example..." + cp .env.example .env + + # Generate secure random hex keys + RANDOM_JWT=$(openssl rand -hex 32) + RANDOM_SALT=$(openssl rand -hex 32) + + sed -i "s/GantiDenganKunciRahasiaJWTUntukDashboard256Bit/$RANDOM_JWT/g" .env + sed -i "s/GantiDenganKunciGaramUntukWireGuard256Bit/$RANDOM_SALT/g" .env + + echo "[+] Secure cryptographic keys have been auto-generated!" + echo "[+] Review .env file before continuing. Edit DB_PASSWORD, API_PORT, VITE_API_BASE_URL as needed." + else + echo "[-] ERROR: .env.example is missing. Cannot generate .env." + exit 1 + fi +else + echo "[+] .env file already exists. Skipping environment generation." fi # 2. Update Code dari Git (Main & Submodules)