Files
Encelado/TradingBot/deployment/DEPLOYMENT_CHECKLIST.md
Alberto Balbo 92c8e57a8c Persistenza dati e logging avanzato con UI e Unraid
- Aggiunto TradeHistoryService per persistenza trade/posizioni attive su disco (JSON, auto-save/restore)
- Logging centralizzato (LoggingService) con livelli, categorie, simbolo e buffer circolare (500 log)
- Nuova pagina Logs: monitoraggio real-time, filtri avanzati, cancellazione log, colorazione livelli
- Sezione "Dati Persistenti" in Settings: conteggio trade, dimensione dati, reset con conferma modale
- Background service per salvataggio sicuro su shutdown/stop container
- Aggiornata sidebar, stili modali/bottoni danger, .gitignore e documentazione (README, CHANGELOG, UNRAID_INSTALL, checklist)
- Versione 1.3.0
2025-12-22 11:24:17 +01:00

7.3 KiB

?? TradingBot - Deployment Checklist

Checklist completa per deployment sicuro e corretto su Unraid.


? Pre-Deployment

Environment

  • Unraid 6.10+ installato e aggiornato
  • Docker service attivo e funzionante
  • Internet connesso e stabile
  • SSH access configurato
  • Backup Unraid recente disponibile

Network

  • Porta 8888 disponibile (o alternativa scelta)
  • Test porta: netstat -tulpn | grep :8888
  • Firewall configurato correttamente
  • IP Unraid noto: 192.168.30.23

Gitea Registry

  • Account Gitea attivo
  • Personal Access Token generato
  • Login test: docker login gitea.encke-hake.ts.net
  • Immagine disponibile in Packages

?? Installation

Template Setup

  • Template XML scaricato
    wget -O /boot/config/plugins/dockerMan/templates-user/TradingBot.xml \
      https://gitea.encke-hake.ts.net/Alby96/Encelado/raw/branch/main/TradingBot/deployment/unraid-template.xml
    
  • Template visibile in Unraid UI
  • Dropdown "TradingBot" disponibile

Container Configuration

  • Name: TradingBot
  • Repository: gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
  • Network: Bridge
  • Port Mapping: 8888:8080 (o custom)
    • Host Port: 8888 (modificabile)
    • Container Port: 8080 (FIXED)
  • Volume: /mnt/user/appdata/tradingbot:/app/data
    • Access: Read/Write
  • Environment Variables:
    • ASPNETCORE_ENVIRONMENT=Production
    • ASPNETCORE_URLS=http://+:8080
    • TZ=Europe/Rome

First Start

  • Click Apply
  • Container pulls image successfully
  • Container status: running
  • No errors in logs: docker logs TradingBot

? Post-Installation Verification

Container Health

  • Container running: docker ps | grep TradingBot
  • Port mapping correct: docker port TradingBot
    • Expected: 8080/tcp -> 0.0.0.0:8888
  • Logs healthy: docker logs TradingBot --tail 50

WebUI Access

  • WebUI icon visible in Unraid Docker tab
  • Click WebUI icon opens browser
  • Manual access works: http://192.168.30.23:8888
  • Dashboard loads completely
  • No JavaScript errors in browser console

Functionality Test

  • Bot can be started from UI
  • Market data updates (check Dashboard)
  • Settings can be modified and saved
  • Assets can be enabled/disabled
  • Trade history visible (if any previous data)

?? Persistence Verification

Data Directory

  • Volume created: ls -la /mnt/user/appdata/tradingbot/
  • Directory writable: touch /mnt/user/appdata/tradingbot/test && rm /mnt/user/appdata/tradingbot/test

Persistence Test

  1. Start bot and execute some trades
  2. Stop bot
  3. Verify files exist:
    ls -lh /mnt/user/appdata/tradingbot/
    # Should show:
    # - trade-history.json
    # - active-positions.json
    # - settings.json
    
  4. Stop container: docker stop TradingBot
  5. Start container: docker start TradingBot
  6. Verify data restored:
    • Trade count same in History page
    • Settings preserved
    • Active positions restored

Backup Test

  • Create backup:
    tar -czf tradingbot-backup-$(date +%Y%m%d).tar.gz \
      /mnt/user/appdata/tradingbot/
    
  • Backup file created successfully
  • Test restore (optional):
    tar -xzf tradingbot-backup-YYYYMMDD.tar.gz -C /tmp/
    # Verify files intact
    

?? Update Test

Update Procedure

  • Stop container
  • Force Update in Unraid UI
  • Wait for pull completion
  • Start container
  • Verify data persisted:
    • Trade history intact
    • Settings intact
    • Active positions intact

Rollback Test (Optional)

  • Tag current image before update
  • Test update to new version
  • If issues, rollback to previous tag
  • Verify data still intact

?? Security Check

Access Control

  • Port 8888 not exposed to internet
  • Only LAN/VPN access configured
  • No default passwords used

Data Protection

  • AppData directory permissions correct
    ls -la /mnt/user/appdata/ | grep tradingbot
    # Should be owned by appropriate user
    
  • Backup schedule configured (CA Backup plugin)
  • Backup retention policy set

Registry Security

  • Gitea login required for pulls
  • Personal Access Token secure
  • No credentials in logs

?? Monitoring Setup

Unraid Dashboard

  • Container appears in Docker tab
  • Auto-start enabled (optional)
  • Resource limits configured (optional):
    --cpus="2.0" --memory="1g"
    

Logs

  • Know how to access logs:
    • Unraid UI: Docker tab ? TradingBot ? Logs icon
    • CLI: docker logs TradingBot -f
  • No error messages in logs

Notifications

  • Unraid notifications enabled
  • Email/Telegram configured (optional)

?? Troubleshooting Checklist

If WebUI Not Accessible

  • Check container running: docker ps | grep TradingBot
  • Check port mapping: docker port TradingBot
  • Test localhost: curl http://localhost:8888/
  • Check firewall: iptables -L | grep 8888
  • Check logs for errors: docker logs TradingBot
  • Try different port if 8888 occupied

If Data Not Persisting

  • Volume mapping correct: docker inspect TradingBot | grep -A5 Mounts
  • Directory exists: ls -la /mnt/user/appdata/tradingbot/
  • Files being created: Monitor during bot run
  • Permissions correct: ls -la /mnt/user/appdata/tradingbot/

If Container Won't Start

  • Check image pulled: docker images | grep tradingbot
  • Check port not in use: netstat -tulpn | grep :8888
  • Check disk space: df -h
  • Review logs: docker logs TradingBot
  • Try manual start: docker start TradingBot

?? Post-Deployment Tasks

Documentation

  • Note custom port if not 8888
  • Document backup location
  • Save deployment date
  • Note Gitea image tag deployed

Monitoring

  • Add to monitoring dashboard (if any)
  • Set up health check alerts (optional)
  • Configure update notifications

User Training

  • Show how to access WebUI
  • Explain Settings page
  • Demonstrate how to view trades
  • Explain data management (clear data)

?? Success Criteria

All of the following must be true:

? Container running and healthy
? WebUI accessible and functional
? Bot can start/stop from UI
? Market data updates in real-time
? Trades can be executed
? Data persists across restarts
? Backup can be created
? No errors in logs
? Resource usage acceptable
? Update procedure tested


?? Support

If issues persist after completing this checklist:

  1. Check Documentation:

  2. Collect Diagnostic Info:

    # Container info
    docker ps -a | grep TradingBot
    docker logs TradingBot --tail 100 > /tmp/tradingbot-logs.txt
    docker inspect TradingBot > /tmp/tradingbot-inspect.json
    
    # System info
    df -h
    free -h
    netstat -tulpn | grep 8888
    
  3. Open Issue:


Last Updated: 2024-12-21
Version: 1.2.0
Status: ? Production Ready