docs: add native run guide and restore admin creation in setup.sh
This commit is contained in:
@@ -12,19 +12,50 @@ This suite contains three main components:
|
||||
|
||||
## 🚀 Deployment & Installation
|
||||
|
||||
### 1. Initial Setup
|
||||
### Option A: Docker (Recommended)
|
||||
Clone this repository and start all services:
|
||||
|
||||
```bash
|
||||
git clone https://git.datadunia.com/nexusguard/Nexus-Guard-Suite.git
|
||||
cd Nexus-Guard-Suite
|
||||
cp .env.example .env # Edit .env with your configuration
|
||||
make up # Start all services (PostgreSQL, Redis, Server-Core, Dashboard UI)
|
||||
./setup.sh # Generate .env file automatically
|
||||
# Edit .env with your configuration
|
||||
bash update.sh # Pull, build, migrate, and start
|
||||
```
|
||||
|
||||
The first run will automatically:
|
||||
- Create the database schema via GORM AutoMigrate.
|
||||
- Boot up all required infrastructure via Docker Compose.
|
||||
- Pull the latest code and build the Docker containers (via `update.sh`).
|
||||
- Auto-generate the **Local Primary Node** WireGuard keys on the first boot.
|
||||
- Create the database schema via automated migration.
|
||||
|
||||
### Option B: Native (Without Docker)
|
||||
|
||||
If you prefer to run the components directly on your host machine, you will need **Go 1.25+**, **Node.js 24+**, **PostgreSQL**, and **Redis**.
|
||||
|
||||
**1. Setup Database & Environment**
|
||||
Create a PostgreSQL database. Copy `.env.example` to `.env` and configure `DB_HOST`, `DB_USER`, `DB_PASSWORD`, and `DB_NAME` to point to your local database.
|
||||
|
||||
**2. Start Backend (Server Core)**
|
||||
```bash
|
||||
cd apps/server-core
|
||||
go mod download
|
||||
go run -tags dev .
|
||||
```
|
||||
*(The dev tag automatically runs migrations and provisions the local node)*
|
||||
|
||||
**3. Start Frontend (Dashboard UI)**
|
||||
```bash
|
||||
cd apps/dashboard-ui
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
**4. Create Admin Account**
|
||||
In a new terminal:
|
||||
```bash
|
||||
cd apps/server-core
|
||||
go run -tags dev . -create-admin -user "admin" -pass "YourNewSecurePassword123!"
|
||||
```
|
||||
|
||||
### 2. Quick Reference with Makefile
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ else
|
||||
echo "[+] .env file already exists. Skipping environment generation."
|
||||
fi
|
||||
|
||||
# Make sure Docker is available
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
echo "[-] ERROR: docker-compose is not installed. Please install Docker and Docker-Compose first."
|
||||
# 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
|
||||
|
||||
@@ -41,7 +41,11 @@ 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 './update.sh' to download the "
|
||||
echo " 2. Run 'bash update.sh' to download the "
|
||||
echo " latest code, build, and start the "
|
||||
echo " system. "
|
||||
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 "========================================="
|
||||
|
||||
@@ -30,7 +30,11 @@ docker compose build --build-arg VITE_API_BASE_URL=$VITE_API_BASE_URL
|
||||
echo "[+] Restarting containers..."
|
||||
docker compose up -d
|
||||
|
||||
# 5. Cleanup
|
||||
# 5. Run Database Migrations
|
||||
echo "[+] Running automated database migrations..."
|
||||
docker exec nexus-guard-suite-server-core-1 ./server-core -migrate-prod || echo "[!] Migration skipped or failed. It might not be needed."
|
||||
|
||||
# 6. Cleanup
|
||||
echo "[+] Cleaning up unused dangling images to free up space..."
|
||||
docker image prune -f
|
||||
|
||||
|
||||
Reference in New Issue
Block a user