Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

Latest commit

 

History

History
310 lines (234 loc) · 4.92 KB

File metadata and controls

310 lines (234 loc) · 4.92 KB

Quick Reference - PCNA System Commands

⚠️ Important Note

You're running as root user, so DO NOT use sudo - it's not needed and will cause "command not found" errors.


🎮 Service Control

Check Status

supervisorctl status

Restart Services

# Restart everything
supervisorctl restart all

# Restart individual services
supervisorctl restart backend
supervisorctl restart frontend
supervisorctl restart mongodb

Stop Services

supervisorctl stop all
supervisorctl stop backend
supervisorctl stop frontend

Start Services

supervisorctl start all
supervisorctl start backend
supervisorctl start frontend

Reload Configuration

supervisorctl reload
# or
supervisorctl reread && supervisorctl update

📊 System Health Checks

Quick Status Check

/app/scripts/status.sh

Manual Health Checks

# Backend health
curl http://localhost:8001/api/health

# System health
curl http://localhost:8001/api/system-health

# Active seeds
curl http://localhost:8001/api/seeds

# Topology
curl http://localhost:8001/api/topology

Test LLM Integration

curl -X POST http://localhost:8001/api/llm/chat \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Hello","provider":"openai","model":"gpt-5.2"}'

Run EDCM Analysis

curl http://localhost:8001/api/edcm/analyze

📜 View Logs

Backend Logs

# Error logs
tail -f /var/log/supervisor/backend.err.log

# Last 50 lines
tail -50 /var/log/supervisor/backend.err.log

# Output logs
tail -f /var/log/supervisor/backend.out.log

Frontend Logs

# Output logs
tail -f /var/log/supervisor/frontend.out.log

# Last 50 lines
tail -50 /var/log/supervisor/frontend.out.log

MongoDB Logs

tail -f /var/log/mongodb/mongod.log

All Supervisor Logs

tail -f /var/log/supervisor/supervisord.log

🔧 Troubleshooting

Service Won't Start

# Check status
supervisorctl status backend

# View error logs
tail -50 /var/log/supervisor/backend.err.log

# Restart
supervisorctl restart backend

Backend Issues

# Check if dependencies are installed
cd /app/backend
pip list | grep -E "fastapi|emergent"

# Reinstall dependencies
/app/scripts/install_backend.sh

# Restart
supervisorctl restart backend

Frontend Issues

# Check Node.js
node --version
yarn --version

# Reinstall dependencies
cd /app/frontend
rm -rf node_modules
yarn install

# Restart
supervisorctl restart frontend

MongoDB Issues

# Check if running
supervisorctl status mongodb

# Check logs
tail -50 /var/log/mongodb/mongod.log

# Ensure data directory exists
mkdir -p /data/db

# Restart
supervisorctl restart mongodb

Complete System Reset

# Stop all
supervisorctl stop all

# Wait
sleep 3

# Start all
supervisorctl start all

# Check status
supervisorctl status

🚀 Quick Start Commands

Start Everything

supervisorctl restart all
sleep 5
/app/scripts/status.sh

Check Everything

# System status
/app/scripts/status.sh

# Or use helper
/app/scripts/commands.sh

📍 Access URLs


📁 Important Paths

Code

  • Backend: /app/backend/
  • Frontend: /app/frontend/
  • Scripts: /app/scripts/

Logs

  • Backend: /var/log/supervisor/backend.err.log
  • Frontend: /var/log/supervisor/frontend.out.log
  • MongoDB: /var/log/mongodb/mongod.log

Configuration

  • Supervisor: /etc/supervisor/conf.d/pcna.conf
  • Backend env: /app/backend/.env
  • Frontend env: /app/frontend/.env

✅ Common Tasks

Update Backend Code

# Edit code in /app/backend/
# Backend auto-reloads (no restart needed)

Update Frontend Code

# Edit code in /app/frontend/src/
# Frontend hot-reloads (no restart needed)

Install New Python Package

cd /app/backend
pip install package-name
# Add to requirements.txt
supervisorctl restart backend

Install New Node Package

cd /app/frontend
yarn add package-name
# package.json auto-updates
supervisorctl restart frontend

View All Commands

/app/scripts/commands.sh

💡 Pro Tips

  1. No sudo needed - You're root, commands work directly
  2. Hot reload enabled - Most code changes apply automatically
  3. Check logs first - When debugging, always check logs
  4. Use helper scripts - /app/scripts/ has useful tools
  5. Status check - Run /app/scripts/status.sh anytime

🆘 Emergency Commands

Everything Broken?

supervisorctl restart all

Still Not Working?

supervisorctl stop all
sleep 5
supervisorctl start all
/app/scripts/status.sh

Need Full Restart?

supervisorctl reload

Remember: No sudo needed - you're already root!