Operations & Routines¶
Regular Tasks¶
| Task | Frequency | Responsible |
|---|---|---|
Check /health endpoint |
Daily | Monitoring system |
| Verify sync worker ran OK | Daily | Manual / Task Scheduler |
| Review chat logs | Weekly | Administrator |
| Check disk space (cache + logs) | Monthly | Administrator |
Start / Stop Chatbot API¶
Start:
Stop: Find the process ID and terminate:
Check status:
Manual Data Sync¶
Run the sync worker outside scheduled time:
Verify cache files were updated:
Get-ChildItem C:\ftp\sites\clubsite-4\API\chatbot\cache\*.json |
Select-Object Name, LastWriteTime, Length
Log Files¶
Chat interactions are logged to:
View last 20 interactions:
Installation on a New Server¶
# 1. Copy codebase to C:\ftp\sites\clubsite-4\
# 2. Run installation script
cd C:\ftp\sites\clubsite-4\API
.\INSTALL_CHATBOT_2.ps1
# 3. Fill in .env
notepad C:\ftp\sites\clubsite-4\API\chatbot\.env
# 4. Run sync
cd python
.\venv\Scripts\python.exe ..\chatbot\sync_worker.py
# 5. Start API
cd ..
.\START_CHATBOT_v2.ps1
# 6. Verify
Invoke-RestMethod http://127.0.0.1:8000/health
Updating Python Dependencies¶
cd C:\ftp\sites\clubsite-4\API\python
.\venv\Scripts\Activate.ps1
pip install -r ..\chatbot\requirements.txt --upgrade
Adding a New Club (Tenant)¶
- Set
boolChatbot = 1in theClubstable for the club - Verify the
clubFolderfield (used as cache filename) - Create an
AI_Chatbot_Settingsrow for the club - Run
sync_worker.pymanually - Verify
cache/{clubFolder}_context.json - Update
ALLOWED_TENANT_IDinAPI/python/app/app.py(temporary – removed in v2.1) - Restart uvicorn
- Integrate
ai_chatbot_loader.aspin the tenant folder
Log Rotation Routine¶
Logs are not rotated automatically. Recommended manual routine:
# Archive logs older than 90 days
$logDir = "C:\ftp\sites\clubsite-4\API\chatbot\logs"
$archiveDir = "C:\ftp\sites\clubsite-4\API\chatbot\logs\archive"
New-Item -ItemType Directory -Force $archiveDir
Get-ChildItem $logDir -Filter *.jsonl |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-90) } |
Move-Item -Destination $archiveDir