# MED-002 Deployment Checklist ## Pre-Deployment Validation - [x] All 156 tests pass (15 new logging tests added) - [x] Code compiles and imports successfully - [x] Documentation created (LOGGING.md) - [x] Implementation summary created (MED-002_IMPLEMENTATION.md) - [x] Manual tests run successfully - [x] No breaking changes to existing functionality ## Deployment Steps ### 1. Code is Already Deployed ✅ All code changes are committed to the working directory on discord-coordinator (10.10.0.230): - `/opt/projects/claude-coordinator/claude_coordinator/logging_config.py` - `/opt/projects/claude-coordinator/claude_coordinator/bot.py` (updated) - `/opt/projects/claude-coordinator/tests/test_logging.py` - `/opt/projects/claude-coordinator/docs/LOGGING.md` ### 2. Log Directory Setup **Option A: Production Location (Requires Root)** ```bash sudo mkdir -p /var/log/claude-coordinator sudo chown discord-bot:discord-bot /var/log/claude-coordinator sudo chmod 755 /var/log/claude-coordinator ``` **Option B: User Location (Automatic)** ```bash # Will auto-create on first run: ~/.claude-coordinator/logs/ # No action needed ``` ### 3. Set Log Level (Optional) **Development (verbose):** ```bash export LOG_LEVEL=DEBUG ``` **Production (default):** ```bash export LOG_LEVEL=INFO # or leave unset for INFO default ``` ### 4. Restart Bot **If bot is running as systemd service:** ```bash systemctl --user restart claude-coordinator systemctl --user status claude-coordinator ``` **If bot is running manually:** ```bash # Stop existing process pkill -f "python.*claude_coordinator" # Start with new logging cd /opt/projects/claude-coordinator source .venv/bin/activate export DISCORD_TOKEN="your-token" export LOG_LEVEL=INFO python -m claude_coordinator.bot ``` ### 5. Verify Logging Works **Check log file created:** ```bash # For production location ls -la /var/log/claude-coordinator/ # For user location ls -la ~/.claude-coordinator/logs/ ``` **View real-time logs:** ```bash # Production tail -f /var/log/claude-coordinator/bot.log | jq . # User location tail -f ~/.claude-coordinator/logs/bot.log | jq . ``` **Test error tracking:** ```bash # Send a message that triggers an error (e.g., to unconfigured channel) # Verify error ID appears in Discord message and logs ``` ### 6. Monitor for Issues **First 30 minutes:** - Check logs are being written - Verify JSON format is valid - Confirm error messages appear in Discord - Test message processing still works **First 24 hours:** - Monitor for any unexpected errors - Verify log rotation settings work - Check disk space usage - Validate performance metrics ## Rollback Plan If issues occur, revert to backup: ```bash cd /opt/projects/claude-coordinator cp claude_coordinator/bot.py.backup claude_coordinator/bot.py rm claude_coordinator/logging_config.py # Restart bot ``` ## Post-Deployment Tasks - [ ] Monitor logs for 1-2 days - [ ] Set up automated alerting (if desired) - [ ] Document any production-specific observations - [ ] Consider external log aggregation setup ## Validation Commands ```bash # Test imports python -c "from claude_coordinator.logging_config import setup_logging; print('✓ OK')" # Run tests pytest tests/test_logging.py -v # Check log file exists ls -la ~/.claude-coordinator/logs/bot.log || ls -la /var/log/claude-coordinator/bot.log # Verify JSON format cat ~/.claude-coordinator/logs/bot.log | head -1 | jq . ``` ## Support If issues occur: 1. Check logs for error IDs 2. Review LOGGING.md documentation 3. Run manual test script: `python test_logging_manual.py` 4. Review MED-002_IMPLEMENTATION.md for details --- **Status**: Ready for deployment **Risk Level**: Low (backwards compatible, well tested) **Estimated Downtime**: None (restart only)