docs: reorganize documentation with i18n and Swagger API reference
- Add per-submodule docs structure (server-core, dashboard-ui, device-agent) - Restructure VitePress with i18n support (Indonesian default + English) - Add Swagger API reference pages with Swagger UI CDN embed - Create merge.js script for combining sidebar manifests - Integrate docs build into Docker (update.sh + nginx volume mount) - Add documentation section to root README
This commit is contained in:
@@ -221,6 +221,41 @@ For automated client deployment with the Device Agent:
|
||||
|
||||
---
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
Documentation is built with VitePress and served at `/docs/`.
|
||||
|
||||
### Local Development
|
||||
|
||||
```bash
|
||||
cd apps/docs
|
||||
npm install
|
||||
npm run docs:dev
|
||||
```
|
||||
|
||||
### Building Docs
|
||||
|
||||
```bash
|
||||
cd apps/docs
|
||||
npm run docs:build
|
||||
```
|
||||
|
||||
The output is in `apps/docs/.vitepress/dist/`.
|
||||
|
||||
### Structure
|
||||
|
||||
- `apps/docs/` — VitePress root (i18n: Indonesian + English)
|
||||
- `apps/server-core/docs/` — Backend API docs & guides
|
||||
- `apps/dashboard-ui/docs/` — Dashboard UI docs
|
||||
- `apps/device-agent/docs/` — Device Agent docs
|
||||
|
||||
### Languages
|
||||
|
||||
- **Bahasa Indonesia** (default): `/docs/`
|
||||
- **English**: `/docs/en/`
|
||||
|
||||
---
|
||||
|
||||
## 📁 File Structure
|
||||
|
||||
```
|
||||
|
||||
+1
-1
Submodule apps/dashboard-ui updated: d1ac7653f6...2dcab84274
+1
-1
Submodule apps/device-agent updated: 4f6277b5af...3f42833ed5
@@ -1,22 +1,50 @@
|
||||
import { defineConfig } from 'vitepress'
|
||||
|
||||
// Sidebar manifests from submodules
|
||||
import serverCoreSidebar from '../../server-core/docs/sidebar.json'
|
||||
import dashboardSidebar from '../../dashboard-ui/docs/sidebar.json'
|
||||
import agentSidebar from '../../device-agent/docs/sidebar.json'
|
||||
|
||||
export default defineConfig({
|
||||
title: 'NexusGuard Docs',
|
||||
description: 'Enterprise Zero-Trust SD-WAN Documentation',
|
||||
title: 'NexusGuard',
|
||||
description: 'Enterprise Zero-Trust SD-WAN Suite',
|
||||
base: '/docs/',
|
||||
cleanUrls: true,
|
||||
themeConfig: {
|
||||
sidebar: [
|
||||
{
|
||||
text: 'Guides',
|
||||
items: [
|
||||
{ text: 'Sign In', link: '/guides/sign-in' },
|
||||
{ text: 'Access Remote Server', link: '/guides/access-remote-server' },
|
||||
{ text: 'Add WireGuard Configuration', link: '/guides/add-wireguard-configuration' },
|
||||
{ text: 'Peers', link: '/guides/peers' },
|
||||
{ text: 'Email Service', link: '/guides/email-service' },
|
||||
{ text: 'WebHooks', link: '/guides/webhooks' },
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
locales: {
|
||||
root: {
|
||||
label: 'Bahasa Indonesia',
|
||||
lang: 'id',
|
||||
themeConfig: {
|
||||
sidebar: [
|
||||
serverCoreSidebar,
|
||||
dashboardSidebar,
|
||||
agentSidebar,
|
||||
],
|
||||
nav: [
|
||||
{ text: 'Beranda', link: '/' },
|
||||
{ text: 'Panduan', link: '/guides/' },
|
||||
{ text: 'API', link: '/api/' },
|
||||
{ text: 'GitHub', link: 'https://git.datadunia.com/nexusguard/Nexus-Guard-Suite' },
|
||||
],
|
||||
},
|
||||
},
|
||||
en: {
|
||||
label: 'English',
|
||||
lang: 'en',
|
||||
themeConfig: {
|
||||
sidebar: [
|
||||
serverCoreSidebar,
|
||||
dashboardSidebar,
|
||||
agentSidebar,
|
||||
],
|
||||
nav: [
|
||||
{ text: 'Home', link: '/en/' },
|
||||
{ text: 'Guides', link: '/en/guides/' },
|
||||
{ text: 'API', link: '/en/api/' },
|
||||
{ text: 'GitHub', link: 'https://git.datadunia.com/nexusguard/Nexus-Guard-Suite' },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# NexusGuard API Reference
|
||||
|
||||
This page provides interactive documentation for the NexusGuard Server Core API.
|
||||
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script setup>
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
onMounted(() => {
|
||||
// Load Swagger UI from CDN
|
||||
const script = document.createElement('script')
|
||||
script.src = 'https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js'
|
||||
script.onload = () => {
|
||||
window.SwaggerUIBundle({
|
||||
url: '/server-core/docs/swagger.json',
|
||||
dom_id: '#swagger-ui',
|
||||
presets: [
|
||||
window.SwaggerUIBundle.presets.apis,
|
||||
window.SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
],
|
||||
layout: 'BaseLayout'
|
||||
})
|
||||
}
|
||||
document.head.appendChild(script)
|
||||
|
||||
const link = document.createElement('link')
|
||||
link.rel = 'stylesheet'
|
||||
link.href = 'https://unpkg.com/swagger-ui-dist@5/swagger-ui.css'
|
||||
document.head.appendChild(link)
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,31 @@
|
||||
# Referensi API NexusGuard
|
||||
|
||||
Halaman ini menyediakan dokumentasi interaktif untuk API Server Core NexusGuard.
|
||||
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script setup>
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
onMounted(() => {
|
||||
const script = document.createElement('script')
|
||||
script.src = 'https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js'
|
||||
script.onload = () => {
|
||||
window.SwaggerUIBundle({
|
||||
url: '/server-core/docs/swagger.json',
|
||||
dom_id: '#swagger-ui',
|
||||
presets: [
|
||||
window.SwaggerUIBundle.presets.apis,
|
||||
window.SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
],
|
||||
layout: 'BaseLayout'
|
||||
})
|
||||
}
|
||||
document.head.appendChild(script)
|
||||
|
||||
const link = document.createElement('link')
|
||||
link.rel = 'stylesheet'
|
||||
link.href = 'https://unpkg.com/swagger-ui-dist@5/swagger-ui.css'
|
||||
document.head.appendChild(link)
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,26 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const submodules = [
|
||||
{ name: 'server-core', path: '../server-core/docs/sidebar.json' },
|
||||
{ name: 'dashboard-ui', path: '../dashboard-ui/docs/sidebar.json' },
|
||||
{ name: 'device-agent', path: '../device-agent/docs/sidebar.json' }
|
||||
];
|
||||
|
||||
const sidebar = [];
|
||||
|
||||
for (const mod of submodules) {
|
||||
const filePath = join(__dirname, mod.path);
|
||||
try {
|
||||
const content = JSON.parse(readFileSync(filePath, 'utf-8'));
|
||||
sidebar.push(content);
|
||||
console.error(`\u2713 Loaded ${mod.name}`);
|
||||
} catch (e) {
|
||||
console.error(`\u26A0 Skipping ${mod.name}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(sidebar, null, 2));
|
||||
Generated
+2552
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule apps/server-core updated: afd664d715...c861de2a43
@@ -61,6 +61,8 @@ services:
|
||||
VITE_API_BASE_URL: ${VITE_API_BASE_URL}
|
||||
ports:
|
||||
- "${WEB_PORT:-80}:80"
|
||||
volumes:
|
||||
- ./apps/docs/.vitepress/dist:/usr/share/nginx/html/docs:ro
|
||||
depends_on:
|
||||
- server-core
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -47,6 +47,15 @@ echo "[+] Syncing and updating submodules..."
|
||||
SUBMODULE_FAILED=false
|
||||
git submodule update --init --recursive --remote || { SUBMODULE_FAILED=true; echo "[!] Git submodule update skipped or failed."; }
|
||||
|
||||
# 2b. Build VitePress docs (non-blocking)
|
||||
echo "[+] Building VitePress documentation..."
|
||||
DOCS_BUILD_FAILED=false
|
||||
if [ -d "apps/docs" ]; then
|
||||
(cd apps/docs && npm install && npm run docs:build) || { DOCS_BUILD_FAILED=true; echo "[!] Docs build failed. Documentation may be stale. Continuing deployment..."; }
|
||||
else
|
||||
echo "[!] apps/docs directory not found. Skipping docs build."
|
||||
fi
|
||||
|
||||
# 3. Hitung state hash (git + .env) untuk deteksi perubahan
|
||||
CURRENT_HASH=$(echo "$(git rev-parse HEAD 2>/dev/null)$(git submodule status 2>/dev/null)$(sha256sum .env 2>/dev/null)" | sha256sum | cut -d" " -f1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user