Files
markbase/docs/core-doc/MAINTENANCE_GUIDE.md
Warren c28acd0512
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
feat: integrate CoreDoc documentation system
- 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
2026-10-25 23:17:56 +08:00

9.2 KiB

title, version, date, author, status
title version date author status
CoreDoc Maintenance Guide 1.0.0 2026-10-25 Momentry Core Team 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
  2. Documentation Updates
  3. WASM System Maintenance
  4. Server Maintenance
  5. Security Maintenance
  6. Performance Monitoring
  7. Backup and Recovery
  8. Troubleshooting

Daily Maintenance

Health Checks

Check Documentation Service:

# 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:

# 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

cd /Users/accusys/momentry_core/docs_v1.0/doc_wasm/modules/
vim 001_Auth_v1.3.5.md

Step 2: Commit Changes

git add 001_Auth_v1.3.5.md
git commit -m "docs: update Auth API documentation"
git push

Step 3: Verify Update

# 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:

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:

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:

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:

# 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

cd /Users/accusys/momentry_core/src/bin/docserver/
vim main.rs

Step 2: Rebuild

cd /Users/accusys/momentry_core
cargo build --release --bin docserver

Step 3: Restart Service

# Stop old service
lsof -ti :11438 | xargs kill -9

# Start new service
./target/release/docserver

Update Configuration

Environment Variables:

# 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:

# Restart service to apply
source .env.docserver
./target/release/docserver

Security Maintenance

Change Admin Password

Step 1: Update Environment

vim /Users/accusys/momentry_core/.env.docserver

# Change:
DOCSERVER_PASSWORD=newpassword123

Step 2: Restart Service

lsof -ti :11438 | xargs kill -9
source .env.docserver
./target/release/docserver

Step 3: Test New Password

# 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:

# CPU and memory
ps aux | grep docserver

# Network connections
lsof -i :11438

# File descriptors
lsof -p $(lsof -ti :11438) | wc -l

Documentation Size:

# 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:

# 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:

// 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:

# 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):

# 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:

# 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:

# 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:

# 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:


Issue 3: Authentication Failed

Symptoms:

  • 401 Unauthorized responses
  • Cannot access documentation

Diagnosis:

# 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:

# 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:

# 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:


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


Version History

Version Date Changes
1.0.0 2026-10-25 Initial maintenance guide