chore: mark completed plan checklists (CORS, peer fix, deployment tools, phase 4.5)

This commit is contained in:
datadunia
2026-05-22 10:19:11 +07:00
parent 2ba5880a1b
commit 821169a179
4 changed files with 26 additions and 29 deletions
+4 -4
View File
@@ -2,7 +2,7 @@
## TODOs ## TODOs
- [ ] 1. Create Makefile with reset-db command - [x] 1. Create Makefile with reset-db command
**What to do**: **What to do**:
- Create `D:\www-project\NexusGuard\Makefile` with this content: - Create `D:\www-project\NexusGuard\Makefile` with this content:
@@ -42,7 +42,7 @@
**Recommended Agent Profile**: `build` (file creation + git) **Recommended Agent Profile**: `build` (file creation + git)
- [ ] 2. SSH: Migrate empty HWIDs to NULL + restart container - [x] 2. SSH: Migrate empty HWIDs to NULL + restart container
**What to do**: **What to do**:
- SSH into 172.20.8.191: - SSH into 172.20.8.191:
@@ -63,9 +63,9 @@
Expected Result: count = 0 Expected Result: count = 0
``` ```
- [ ] 3. Commit and push all changes (server-core HWID fix, frontend delete button, Makefile) - [x] 3. Commit and push all changes (server-core HWID fix, frontend delete button, Makefile)
- [ ] 4. Verify POST /api/v1/peers returns 201 - [x] 4. Verify POST /api/v1/peers returns 201
```bash ```bash
ssh root@172.20.8.191 'curl -s -X POST http://localhost:3000/api/v1/auth/login -H "Content-Type: application/json" -d "{\"username\":\"admin\",\"password\":\"...\"}"' ssh root@172.20.8.191 'curl -s -X POST http://localhost:3000/api/v1/auth/login -H "Content-Type: application/json" -d "{\"username\":\"admin\",\"password\":\"...\"}"'
+7 -10
View File
@@ -18,8 +18,7 @@ Current CORS config in `main.go:114-130`:
--- ---
## Task 1: Fix CORS config in `main.go` ## Task 1: Fix CORS config in `main.go`
- [x] **File**: `apps/server-core/main.go` lines 114-130
**File**: `apps/server-core/main.go` lines 114-130
**Replace** the current CORS block with: **Replace** the current CORS block with:
@@ -65,8 +64,7 @@ r.Use(cors.New(corsConfig))
--- ---
## Task 2: Add `CORS_ALLOWED_ORIGINS` to root `.env.example` ## Task 2: Add `CORS_ALLOWED_ORIGINS` to root `.env.example`
- [x] **File**: `.env.example`
**File**: `.env.example`
**Add** after `VITE_API_BASE_URL` line (section 5): **Add** after `VITE_API_BASE_URL` line (section 5):
@@ -85,8 +83,7 @@ SHARE_LINK_TTL=24h
--- ---
## Task 3: Add `CORS_ALLOWED_ORIGINS` to server-core `.env.example` ## Task 3: Add `CORS_ALLOWED_ORIGINS` to server-core `.env.example`
- [x] **File**: `apps/server-core/.env.example`
**File**: `apps/server-core/.env.example`
**Add** at the end: **Add** at the end:
@@ -105,7 +102,7 @@ SHARE_LINK_TTL=24h
## Final Verification Wave ## Final Verification Wave
- [ ] `go build ./...` passes in `apps/server-core/` - [x] `go build ./...` passes in `apps/server-core/`
- [ ] `CORS_ALLOWED_ORIGINS` present in root `.env.example` - [x] `CORS_ALLOWED_ORIGINS` present in root `.env.example`
- [ ] `CORS_ALLOWED_ORIGINS` present in `apps/server-core/.env.example` - [x] `CORS_ALLOWED_ORIGINS` present in `apps/server-core/.env.example`
- [ ] No other files reference `CORS_ALLOWED_ORIGINS` that need updating - [x] No other files reference `CORS_ALLOWED_ORIGINS` that need updating
@@ -24,7 +24,7 @@
## TODOs ## TODOs
- [ ] 1. Backend: Change HWID to `*string` in Device model - [x] 1. Backend: Change HWID to `*string` in Device model
**What to do**: **What to do**:
- Edit `apps/server-core/internal/models/models.go` line 60: - Edit `apps/server-core/internal/models/models.go` line 60:
@@ -46,7 +46,7 @@
Evidence: .sisyphus/evidence/task-1-build.txt Evidence: .sisyphus/evidence/task-1-build.txt
``` ```
- [ ] 2. Backend: Fix CreatePeer to not set empty HWID - [x] 2. Backend: Fix CreatePeer to not set empty HWID
**What to do**: **What to do**:
- Edit `apps/server-core/api/peers.go` — remove `HWID: ""` line (line 96) - Edit `apps/server-core/api/peers.go` — remove `HWID: ""` line (line 96)
@@ -63,14 +63,14 @@
Evidence: .sisyphus/evidence/task-2-build.txt Evidence: .sisyphus/evidence/task-2-build.txt
``` ```
- [ ] 3. Backend: Fix CreateDevice to not set empty HWID - [x] 3. Backend: Fix CreateDevice to not set empty HWID
**What to do**: **What to do**:
- Edit `apps/server-core/api/devices.go` — verify `Create` function (line 84-89) doesn't set HWID - Edit `apps/server-core/api/devices.go` — verify `Create` function (line 84-89) doesn't set HWID
- It currently doesn't set HWID at all, so with `*string` it will default to nil — correct - It currently doesn't set HWID at all, so with `*string` it will default to nil — correct
- Verify `Delete` function (line 235-255) already works — it does, no changes needed - Verify `Delete` function (line 235-255) already works — it does, no changes needed
- [ ] 4. Migration: Convert existing empty HWIDs to NULL on server - [x] 4. Migration: Convert existing empty HWIDs to NULL on server
**What to do**: **What to do**:
- SSH into 172.20.8.191 and run SQL against the postgres container: - SSH into 172.20.8.191 and run SQL against the postgres container:
@@ -100,7 +100,7 @@
Evidence: .sisyphus/evidence/task-4-peers-api.txt Evidence: .sisyphus/evidence/task-4-peers-api.txt
``` ```
- [ ] 5. Frontend: Add delete button to Devices.vue list - [x] 5. Frontend: Add delete button to Devices.vue list
**What to do**: **What to do**:
- Edit `apps/dashboard-ui/src/views/Devices.vue` - Edit `apps/dashboard-ui/src/views/Devices.vue`
@@ -137,7 +137,7 @@
Evidence: .sisyphus/evidence/task-5-tsc.txt Evidence: .sisyphus/evidence/task-5-tsc.txt
``` ```
- [ ] 6. Commit and push changes - [x] 6. Commit and push changes
**What to do**: **What to do**:
- Commit server-core changes - Commit server-core changes
@@ -147,8 +147,8 @@
## Success Criteria ## Success Criteria
- [ ] `go build ./...` passes - [x] `go build ./...` passes
- [ ] `vue-tsc --noEmit` passes - [x] `vue-tsc --noEmit` passes
- [ ] POST `/api/v1/peers` returns 201, not 500 - [x] POST `/api/v1/peers` returns 201, not 500
- [ ] Devices.vue has a delete button per row that works - [x] Devices.vue has a delete button per row that works
- [ ] Existing empty HWIDs migrated to NULL - [x] Existing empty HWIDs migrated to NULL
@@ -3,27 +3,27 @@
**Goal**: Transform the system from a single-node mockup into a true Multi-Server (WGDashboard-style) architecture, and harden the database startup mechanisms for production environments. **Goal**: Transform the system from a single-node mockup into a true Multi-Server (WGDashboard-style) architecture, and harden the database startup mechanisms for production environments.
## Task 4.5.1: Multi-Server Database & API ## Task 4.5.1: Multi-Server Database & API
- **Files**: `models.go`, `001_init.sql`, `api/servers.go`, `main.go` - [x] **Files**: `models.go`, `001_init.sql`, `api/servers.go`, `main.go`
- **Actions**: - **Actions**:
- Add `WgServerID` foreign key to the `Device` model. - Add `WgServerID` foreign key to the `Device` model.
- Implement full CRUD REST API for `WgServer` (`/api/v1/servers`) to allow Admin to register multiple public WireGuard nodes. - Implement full CRUD REST API for `WgServer` (`/api/v1/servers`) to allow Admin to register multiple public WireGuard nodes.
## Task 4.5.2: Provisioning API Multi-Node Fix ## Task 4.5.2: Provisioning API Multi-Node Fix
- **Files**: `api/provisioning.go`, `api/provisioning_test.go` - [x] **Files**: `api/provisioning.go`, `api/provisioning_test.go`
- **Actions**: - **Actions**:
- Remove the hardcoded `127.0.0.1:51820` fallback. - Remove the hardcoded `127.0.0.1:51820` fallback.
- During provisioning, fetch the exact `WgServer` related to the device. - During provisioning, fetch the exact `WgServer` related to the device.
- Return the true `Endpoint` and `PublicKey` of that specific node to the connecting agent. - Return the true `Endpoint` and `PublicKey` of that specific node to the connecting agent.
## Task 4.5.3: Dashboard UI - Nodes Management ## Task 4.5.3: Dashboard UI - Nodes Management
- **Files**: `src/views/Servers.vue`, `src/views/Devices.vue`, `src/api/servers.ts`, `src/App.vue` - [x] **Files**: `src/views/Servers.vue`, `src/views/Devices.vue`, `src/api/servers.ts`, `src/App.vue`
- **Actions**: - **Actions**:
- Build the "Nodes" page to manage external WireGuard servers. - Build the "Nodes" page to manage external WireGuard servers.
- Update the "Add Device" form to include a required dropdown where the Admin selects which Node the device will connect to. - Update the "Add Device" form to include a required dropdown where the Admin selects which Node the device will connect to.
- Update the Sidebar to reflect the new navigation. - Update the Sidebar to reflect the new navigation.
## Task 4.5.4: Production Readiness (Install Detection) ## Task 4.5.4: Production Readiness (Install Detection)
- **Files**: `main.go` - [x] **Files**: `main.go`
- **Actions**: - **Actions**:
- Add logic to verify if the DB is empty on startup. - Add logic to verify if the DB is empty on startup.
- Add `-migrate-prod` flag that uses the `goose` library to apply `001_init.sql` automatically in production without needing AutoMigrate. - Add `-migrate-prod` flag that uses the `goose` library to apply `001_init.sql` automatically in production without needing AutoMigrate.