c28acd0512
- Add CoreDoc maintenance documentation (8 files) - Create route module for documentation serving - Set up static file structure with symbolic links - Support dual documentation systems (Legacy WASM + New Modular) Documentation includes: - README.md: System overview - DIRECTORY_STRUCTURE.md: Complete directory mapping - ARCHITECTURE.md: System design and data flow - MAINTENANCE_GUIDE.md: Daily maintenance procedures - INTEGRATION_GUIDE.md: Integration details - API_REFERENCE.md: All API endpoints - INTEGRATION_REPORT.md: Complete integration report - QUICK_START.md: Quick reference for team Route module: markbase-core/src/api/docs.rs - /docs/legacy/* → Legacy WASM system - /docs/api/* → API documentation - /docs/cli/* → CLI documentation Static files: - static/docs/legacy -> momentry_core/docs_v1.0/doc_wasm/ - static/docs/api -> momentry_core/docs_v1.0/API_WORKSPACE/ - static/docs/cli -> momentry_core/docs_v1.0/CLI_WORKSPACE/ Pending: Manual route addition to server.rs Team: Markbase team to complete integration
469 lines
9.2 KiB
Markdown
469 lines
9.2 KiB
Markdown
---
|
|
title: CoreDoc Maintenance Guide
|
|
version: 1.0.0
|
|
date: 2026-10-25
|
|
author: Momentry Core Team
|
|
status: Active
|
|
---
|
|
|
|
# CoreDoc Maintenance Guide
|
|
|
|
## Overview
|
|
|
|
This guide covers all maintenance tasks for the CoreDoc documentation system, including both legacy WASM and new modular documentation systems.
|
|
|
|
---
|
|
|
|
## Table of Contents
|
|
|
|
1. [Daily Maintenance](#daily-maintenance)
|
|
2. [Documentation Updates](#documentation-updates)
|
|
3. [WASM System Maintenance](#wasm-system-maintenance)
|
|
4. [Server Maintenance](#server-maintenance)
|
|
5. [Security Maintenance](#security-maintenance)
|
|
6. [Performance Monitoring](#performance-monitoring)
|
|
7. [Backup and Recovery](#backup-and-recovery)
|
|
8. [Troubleshooting](#troubleshooting)
|
|
|
|
---
|
|
|
|
## Daily Maintenance
|
|
|
|
### Health Checks
|
|
|
|
**Check Documentation Service**:
|
|
```bash
|
|
# Check if server is running
|
|
curl http://localhost:11438/docs/
|
|
|
|
# Check authentication
|
|
curl -u admin:admin123 http://localhost:11438/docs/legacy/
|
|
|
|
# Check WASM files
|
|
ls -lh /Users/accusys/momentry_core/docs_v1.0/doc_wasm/pkg/*.wasm
|
|
```
|
|
|
|
**Check Documentation Files**:
|
|
```bash
|
|
# Count documentation modules
|
|
ls /Users/accusys/momentry_core/docs_v1.0/doc_wasm/modules/*.md | wc -l
|
|
# Expected: 68
|
|
|
|
# Check recent changes
|
|
cd /Users/accusys/momentry_core/docs_v1.0/doc_wasm/modules/
|
|
git log --oneline -10
|
|
```
|
|
|
|
---
|
|
|
|
## Documentation Updates
|
|
|
|
### Update Legacy Documentation
|
|
|
|
**Step 1: Edit Document**
|
|
```bash
|
|
cd /Users/accusys/momentry_core/docs_v1.0/doc_wasm/modules/
|
|
vim 001_Auth_v1.3.5.md
|
|
```
|
|
|
|
**Step 2: Commit Changes**
|
|
```bash
|
|
git add 001_Auth_v1.3.5.md
|
|
git commit -m "docs: update Auth API documentation"
|
|
git push
|
|
```
|
|
|
|
**Step 3: Verify Update**
|
|
```bash
|
|
# Changes are immediately visible (no rebuild needed)
|
|
curl http://localhost:11438/docs/legacy/modules/001_Auth_v1.3.5.md
|
|
```
|
|
|
|
### Update New Modular Documentation
|
|
|
|
**API Documentation**:
|
|
```bash
|
|
cd /Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE/modules/
|
|
vim Auth_API.md
|
|
|
|
# Commit
|
|
git add Auth_API.md
|
|
git commit -m "docs(api): update Auth documentation"
|
|
git push
|
|
```
|
|
|
|
**CLI Documentation**:
|
|
```bash
|
|
cd /Users/accusys/momentry_core/docs_v1.0/CLI_WORKSPACE/modules/
|
|
vim Register_CLI.md
|
|
|
|
# Commit
|
|
git add Register_CLI.md
|
|
git commit -m "docs(cli): update Register documentation"
|
|
git push
|
|
```
|
|
|
|
---
|
|
|
|
## WASM System Maintenance
|
|
|
|
### Rebuild WASM Renderer
|
|
|
|
**When to Rebuild**:
|
|
- WASM source code changed
|
|
- Dependencies updated
|
|
- Performance optimization needed
|
|
|
|
**Build Steps**:
|
|
```bash
|
|
cd /Users/accusys/momentry_core/md_wasm
|
|
|
|
# Clean old build
|
|
cargo clean
|
|
|
|
# Build for WASM target
|
|
cargo build --target wasm32-unknown-unknown --release
|
|
|
|
# Generate JS bindings
|
|
wasm-bindgen \
|
|
--out-dir ../docs_v1.0/doc_wasm/pkg \
|
|
--target web \
|
|
target/wasm32-unknown-unknown/release/md_wasm.wasm
|
|
|
|
# Verify
|
|
ls -lh ../docs_v1.0/doc_wasm/pkg/md_wasm_bg.wasm
|
|
```
|
|
|
|
**Expected Output**:
|
|
```
|
|
-rw-r--r-- 1 user staff 291K Oct 25 12:22 md_wasm_bg.wasm
|
|
-rw-r--r-- 1 user staff 7.2K Oct 25 12:22 md_wasm.js
|
|
```
|
|
|
|
### WASM Performance Optimization
|
|
|
|
**Reduce WASM Size**:
|
|
```bash
|
|
# In md_wasm/Cargo.toml
|
|
[profile.release]
|
|
opt-level = "z" # Optimize for size
|
|
lto = true # Link-time optimization
|
|
codegen-units = 1 # Better optimization
|
|
|
|
# Rebuild
|
|
cargo build --target wasm32-unknown-unknown --release
|
|
```
|
|
|
|
**Expected Size Reduction**: ~20-30%
|
|
|
|
---
|
|
|
|
## Server Maintenance
|
|
|
|
### Update DocServer Code
|
|
|
|
**Step 1: Edit Source**
|
|
```bash
|
|
cd /Users/accusys/momentry_core/src/bin/docserver/
|
|
vim main.rs
|
|
```
|
|
|
|
**Step 2: Rebuild**
|
|
```bash
|
|
cd /Users/accusys/momentry_core
|
|
cargo build --release --bin docserver
|
|
```
|
|
|
|
**Step 3: Restart Service**
|
|
```bash
|
|
# Stop old service
|
|
lsof -ti :11438 | xargs kill -9
|
|
|
|
# Start new service
|
|
./target/release/docserver
|
|
```
|
|
|
|
### Update Configuration
|
|
|
|
**Environment Variables**:
|
|
```bash
|
|
# Edit .env.docserver
|
|
vim /Users/accusys/momentry_core/.env.docserver
|
|
|
|
# Example changes:
|
|
DOCSERVER_PORT=11438
|
|
DOCSERVER_USER=admin
|
|
DOCSERVER_PASSWORD=newpassword123
|
|
MOMENTRY_DOCS_DIR=/Users/accusys/momentry_core/docs_v1.0/doc_wasm
|
|
```
|
|
|
|
**Apply Changes**:
|
|
```bash
|
|
# Restart service to apply
|
|
source .env.docserver
|
|
./target/release/docserver
|
|
```
|
|
|
|
---
|
|
|
|
## Security Maintenance
|
|
|
|
### Change Admin Password
|
|
|
|
**Step 1: Update Environment**
|
|
```bash
|
|
vim /Users/accusys/momentry_core/.env.docserver
|
|
|
|
# Change:
|
|
DOCSERVER_PASSWORD=newpassword123
|
|
```
|
|
|
|
**Step 2: Restart Service**
|
|
```bash
|
|
lsof -ti :11438 | xargs kill -9
|
|
source .env.docserver
|
|
./target/release/docserver
|
|
```
|
|
|
|
**Step 3: Test New Password**
|
|
```bash
|
|
# Should fail
|
|
curl -u admin:admin123 http://localhost:11438/docs/
|
|
|
|
# Should succeed
|
|
curl -u admin:newpassword123 http://localhost:11438/docs/
|
|
```
|
|
|
|
### Security Audit Checklist
|
|
|
|
- [ ] Change default password
|
|
- [ ] Restrict network access (firewall)
|
|
- [ ] Enable HTTPS (reverse proxy)
|
|
- [ ] Monitor access logs
|
|
- [ ] Regular security updates
|
|
|
|
---
|
|
|
|
## Performance Monitoring
|
|
|
|
### Monitor Resource Usage
|
|
|
|
**Server Resources**:
|
|
```bash
|
|
# CPU and memory
|
|
ps aux | grep docserver
|
|
|
|
# Network connections
|
|
lsof -i :11438
|
|
|
|
# File descriptors
|
|
lsof -p $(lsof -ti :11438) | wc -l
|
|
```
|
|
|
|
**Documentation Size**:
|
|
```bash
|
|
# Total documentation size
|
|
du -sh /Users/accusys/momentry_core/docs_v1.0/doc_wasm/
|
|
|
|
# Individual module sizes
|
|
du -sh /Users/accusys/momentry_core/docs_v1.0/doc_wasm/modules/
|
|
```
|
|
|
|
### Performance Benchmarks
|
|
|
|
**Test Load Time**:
|
|
```bash
|
|
# Measure API response time
|
|
time curl -u admin:admin123 http://localhost:11438/docs/legacy/modules/001_Auth_v1.3.5.md
|
|
|
|
# Expected: < 50ms
|
|
```
|
|
|
|
**Test WASM Performance**:
|
|
```javascript
|
|
// In browser console
|
|
console.time('wasm-render');
|
|
const html = render(markdown_content);
|
|
console.timeEnd('wasm-render');
|
|
// Expected: < 100ms
|
|
```
|
|
|
|
---
|
|
|
|
## Backup and Recovery
|
|
|
|
### Backup Documentation
|
|
|
|
**Manual Backup**:
|
|
```bash
|
|
# Create backup
|
|
tar -czf coredoc_backup_$(date +%Y%m%d).tar.gz \
|
|
/Users/accusys/momentry_core/docs_v1.0/doc_wasm/ \
|
|
/Users/accusys/momentry_core/md_wasm/src/ \
|
|
/Users/accusys/momentry_core/src/bin/docserver/ \
|
|
/Users/accusys/momentry_core/.env.docserver
|
|
|
|
# Verify backup
|
|
tar -tzf coredoc_backup_*.tar.gz | head -10
|
|
```
|
|
|
|
**Automated Backup** (cron job):
|
|
```bash
|
|
# Add to crontab
|
|
0 2 * * * cd /Users/accusys/momentry_core && tar -czf ~/backups/coredoc_$(date +\%Y\%m\%d).tar.gz docs_v1.0/doc_wasm/ md_wasm/src/ src/bin/docserver/
|
|
```
|
|
|
|
### Recovery Procedure
|
|
|
|
**From Backup**:
|
|
```bash
|
|
# Extract backup
|
|
tar -xzf coredoc_backup_20261025.tar.gz
|
|
|
|
# Restore files
|
|
cp -r docs_v1.0/doc_wasm/ /Users/accusys/momentry_core/docs_v1.0/
|
|
cp -r md_wasm/src/ /Users/accusys/momentry_core/md_wasm/
|
|
cp -r src/bin/docserver/ /Users/accusys/momentry_core/src/bin/
|
|
|
|
# Restart server
|
|
./target/release/docserver
|
|
```
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
#### Issue 1: Server Not Starting
|
|
|
|
**Symptoms**:
|
|
- Port 11438 not listening
|
|
- Process exits immediately
|
|
|
|
**Diagnosis**:
|
|
```bash
|
|
# Check port availability
|
|
lsof -i :11438
|
|
|
|
# Check error logs
|
|
./target/release/docserver 2>&1 | tee error.log
|
|
```
|
|
|
|
**Solutions**:
|
|
- Kill existing process: `lsof -ti :11438 | xargs kill -9`
|
|
- Check environment variables
|
|
- Verify documentation directory exists
|
|
|
|
---
|
|
|
|
#### Issue 2: WASM Not Loading
|
|
|
|
**Symptoms**:
|
|
- Browser console shows "Failed to fetch module"
|
|
- Documentation not rendering
|
|
|
|
**Diagnosis**:
|
|
```bash
|
|
# Check WASM file exists
|
|
ls -la /Users/accusys/momentry_core/docs_v1.0/doc_wasm/pkg/md_wasm_bg.wasm
|
|
|
|
# Check file permissions
|
|
chmod 644 /Users/accusys/momentry_core/docs_v1.0/doc_wasm/pkg/*.wasm
|
|
```
|
|
|
|
**Solutions**:
|
|
- Rebuild WASM (see [WASM System Maintenance](#wasm-system-maintenance))
|
|
- Clear browser cache
|
|
- Check CORS headers
|
|
|
|
---
|
|
|
|
#### Issue 3: Authentication Failed
|
|
|
|
**Symptoms**:
|
|
- 401 Unauthorized responses
|
|
- Cannot access documentation
|
|
|
|
**Diagnosis**:
|
|
```bash
|
|
# Test authentication
|
|
curl -v -u admin:admin123 http://localhost:11438/docs/
|
|
```
|
|
|
|
**Solutions**:
|
|
- Check password in `.env.docserver`
|
|
- Restart server after changing credentials
|
|
- Clear browser credentials cache
|
|
|
|
---
|
|
|
|
#### Issue 4: Documentation Not Updated
|
|
|
|
**Symptoms**:
|
|
- Changes not visible
|
|
- Old content displayed
|
|
|
|
**Diagnosis**:
|
|
```bash
|
|
# Check file modification time
|
|
ls -la /Users/accusys/momentry_core/docs_v1.0/doc_wasm/modules/001_Auth_v1.3.5.md
|
|
|
|
# Check git status
|
|
cd /Users/accusys/momentry_core/docs_v1.0/doc_wasm/modules/
|
|
git status
|
|
```
|
|
|
|
**Solutions**:
|
|
- Clear browser cache (Ctrl+Shift+R)
|
|
- Restart server
|
|
- Verify git commits
|
|
|
|
---
|
|
|
|
### Performance Issues
|
|
|
|
#### Slow Page Load
|
|
|
|
**Diagnosis**:
|
|
```bash
|
|
# Check file sizes
|
|
ls -lh /Users/accusys/momentry_core/docs_v1.0/doc_wasm/pkg/*.wasm
|
|
|
|
# Check network latency
|
|
time curl http://localhost:11438/docs/legacy/modules/001_Auth_v1.3.5.md
|
|
```
|
|
|
|
**Solutions**:
|
|
- Optimize WASM size (see [WASM Performance Optimization](#wasm-performance-optimization))
|
|
- Enable gzip compression in server
|
|
- Use CDN for static files
|
|
|
|
---
|
|
|
|
## Maintenance Schedule
|
|
|
|
| Task | Frequency | Duration |
|
|
|------|-----------|----------|
|
|
| Health check | Daily | 5 minutes |
|
|
| Security audit | Weekly | 30 minutes |
|
|
| Backup | Daily (automated) | 5 minutes |
|
|
| WASM rebuild | Monthly or on changes | 10 minutes |
|
|
| Performance review | Monthly | 30 minutes |
|
|
| Documentation update | As needed | Variable |
|
|
|
|
---
|
|
|
|
## Related Documents
|
|
|
|
- [Architecture](./ARCHITECTURE.md) - Understanding the system
|
|
- [Integration Guide](./INTEGRATION_GUIDE.md) - Integrating with Markbase
|
|
- [API Reference](./API_REFERENCE.md) - All endpoints
|
|
|
|
---
|
|
|
|
## Version History
|
|
|
|
| Version | Date | Changes |
|
|
|---------|------|---------|
|
|
| 1.0.0 | 2026-10-25 | Initial maintenance guide | |