Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -0,0 +1,288 @@
|
||||
# ?? 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
|
||||
```bash
|
||||
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`
|
||||
- No errors or exceptions
|
||||
- "Now listening on: http://[::]:8080"
|
||||
|
||||
### 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:
|
||||
```bash
|
||||
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:
|
||||
```bash
|
||||
tar -czf tradingbot-backup-$(date +%Y%m%d).tar.gz \
|
||||
/mnt/user/appdata/tradingbot/
|
||||
```
|
||||
- [ ] Backup file created successfully
|
||||
- [ ] Test restore (optional):
|
||||
```bash
|
||||
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
|
||||
```bash
|
||||
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**:
|
||||
- [UNRAID_INSTALL.md](UNRAID_INSTALL.md)
|
||||
- [CHANGELOG.md](../CHANGELOG.md)
|
||||
|
||||
2. **Collect Diagnostic Info**:
|
||||
```bash
|
||||
# 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**:
|
||||
- Repository: https://gitea.encke-hake.ts.net/Alby96/Encelado/issues
|
||||
- Include: Docker version, Unraid version, logs
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2024-12-21
|
||||
**Version**: 1.2.0
|
||||
**Status**: ? Production Ready
|
||||
@@ -0,0 +1,566 @@
|
||||
# ?? TradingBot - Installazione su Unraid (Senza Portainer)
|
||||
|
||||
## ? Installazione Diretta da Gitea Registry
|
||||
|
||||
Puoi installare TradingBot direttamente dall'Unraid Docker Manager usando il tuo Gitea Registry!
|
||||
|
||||
---
|
||||
|
||||
## ?? PREREQUISITI
|
||||
|
||||
### 1. Login Gitea Registry su Unraid
|
||||
|
||||
SSH su Unraid:
|
||||
|
||||
```bash
|
||||
ssh root@192.168.30.23 # O IP Tailscale
|
||||
|
||||
# Login al Gitea Registry
|
||||
docker login gitea.encke-hake.ts.net
|
||||
|
||||
# Username: Alby96
|
||||
# Password: [Personal Access Token Gitea]
|
||||
```
|
||||
|
||||
**Output atteso**:
|
||||
```
|
||||
Login Succeeded ?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ?? METODO 1: Template XML (Consigliato)
|
||||
|
||||
### Step 1: Copia Template su Unraid
|
||||
|
||||
```bash
|
||||
# Su Unraid
|
||||
mkdir -p /boot/config/plugins/dockerMan/templates-user
|
||||
|
||||
# Scarica template
|
||||
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
|
||||
```
|
||||
|
||||
### Step 2: Installa Container
|
||||
|
||||
1. Unraid WebUI ? **Docker** tab
|
||||
2. Click **Add Container** (in fondo)
|
||||
3. **Template**: Dropdown ? Seleziona **TradingBot**
|
||||
4. Configura parametri:
|
||||
|
||||
**Parametri Base**:
|
||||
- **Name**: `TradingBot` (già impostato)
|
||||
- **Repository**: `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest` (già impostato)
|
||||
|
||||
**Porta WebUI** (Visibile e Configurabile!):
|
||||
- **WebUI HTTP Port**: `8888` (porta default - cambia se occupata)
|
||||
- Questa è la porta HOST per accedere all'interfaccia web
|
||||
- La porta CONTAINER rimane sempre 8080 (non modificare)
|
||||
- Alternative comuni se 8888 occupata: `8881`, `9999`, `7777`
|
||||
|
||||
**Volume Dati** (?? IMPORTANTE per persistenza!):
|
||||
- **AppData**: `/mnt/user/appdata/tradingbot` (già impostato)
|
||||
- Questo volume salva:
|
||||
- Trade history (`trade-history.json`)
|
||||
- Posizioni attive (`active-positions.json`)
|
||||
- Settings applicazione (`settings.json`)
|
||||
- ? I dati sopravvivono a restart/update del container
|
||||
|
||||
**Variabili Ambiente** (Avanzate - espandi se necessario):
|
||||
- **ASPNETCORE_ENVIRONMENT**: `Production` (non modificare)
|
||||
- **ASPNETCORE_URLS**: `http://+:8080` (non modificare - porta interna container)
|
||||
- **TZ**: `Europe/Rome` (cambia per altro timezone)
|
||||
|
||||
5. Click **Apply**
|
||||
|
||||
Unraid farà:
|
||||
- ? Pull immagine da Gitea Registry
|
||||
- ? Crea container con nome "TradingBot"
|
||||
- ? Configura porta WebUI (default 8888 ? host, 8080 ? container)
|
||||
- ? **Crea volume persistente per dati**
|
||||
- ? Start automatico
|
||||
|
||||
### Step 3: Accedi WebUI
|
||||
|
||||
**Metodo A: Click su WebUI Icon** ??
|
||||
|
||||
1. **Docker tab** ? Trova container **TradingBot**
|
||||
2. Nella riga del container, a destra, vedrai l'**icona globe** ??
|
||||
3. Click sull'icona ? Si apre automaticamente `http://192.168.30.23:8888`
|
||||
|
||||
**Metodo B: URL Manuale**
|
||||
|
||||
```
|
||||
http://192.168.30.23:8888
|
||||
```
|
||||
|
||||
(Sostituisci `8888` con la porta HOST che hai configurato)
|
||||
|
||||
?? **IMPORTANTE**: La porta nel browser deve essere quella HOST (8888 default), NON la porta container (8080)
|
||||
|
||||
Dovresti vedere la **Dashboard TradingBot**! ??
|
||||
|
||||
---
|
||||
|
||||
## ?? PERSISTENZA DATI
|
||||
|
||||
### Come Funziona
|
||||
|
||||
TradingBot salva automaticamente tutti i dati in `/app/data` dentro il container, che viene mappato sul volume host `/mnt/user/appdata/tradingbot`.
|
||||
|
||||
**File salvati automaticamente**:
|
||||
```
|
||||
/mnt/user/appdata/tradingbot/
|
||||
??? trade-history.json # Storia completa trade
|
||||
??? active-positions.json # Posizioni attualmente aperte
|
||||
??? settings.json # Impostazioni applicazione
|
||||
```
|
||||
|
||||
**Salvataggio automatico**:
|
||||
- ? Ogni 30 secondi (mentre bot running)
|
||||
- ?? Immediato dopo ogni trade eseguito
|
||||
- ?? On-stop quando fermi il bot
|
||||
- ?? Graceful shutdown su Docker stop/restart
|
||||
|
||||
### Benefici
|
||||
|
||||
? **Zero perdita dati** - Anche in caso di crash
|
||||
? **Restore automatico** - Stato ripristinato al riavvio
|
||||
? **Update sicuri** - Dati preservati durante aggiornamenti
|
||||
? **Backup facile** - Basta copiare la cartella appdata
|
||||
|
||||
### Backup Dati
|
||||
|
||||
```bash
|
||||
# Backup manuale
|
||||
tar -czf tradingbot-backup-$(date +%Y%m%d).tar.gz \
|
||||
/mnt/user/appdata/tradingbot
|
||||
|
||||
# Restore
|
||||
tar -xzf tradingbot-backup-20241221.tar.gz \
|
||||
-C /mnt/user/appdata/
|
||||
```
|
||||
|
||||
### Gestione Dati (via WebUI)
|
||||
|
||||
Vai su **Settings** ? **Dati Persistenti**:
|
||||
- Visualizza numero trade salvati
|
||||
- Visualizza dimensione dati
|
||||
- Visualizza posizioni attive
|
||||
- **Cancella tutti i dati** (con conferma)
|
||||
|
||||
?? **Nota**: Puoi cancellare i dati solo se il bot è fermo.
|
||||
|
||||
---
|
||||
|
||||
## ?? METODO 2: Installazione Manuale
|
||||
|
||||
Se preferisci non usare template:
|
||||
|
||||
### Step 1: Unraid Docker Tab
|
||||
|
||||
1. **Docker** ? **Add Container**
|
||||
2. **Name**: `TradingBot`
|
||||
|
||||
### Step 2: Configurazione Base
|
||||
|
||||
**Repository**:
|
||||
```
|
||||
gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
||||
```
|
||||
|
||||
**Network Type**: `Bridge`
|
||||
|
||||
**Console shell command**: `Shell`
|
||||
|
||||
### Step 3: Port Mapping (?? CRITICO!)
|
||||
|
||||
Click **Add another Path, Port, Variable, Label or Device**
|
||||
|
||||
**Config Type**: `Port`
|
||||
- **Name**: `WebUI`
|
||||
- **Container Port**: `8080`
|
||||
- **Host Port**: `8888` ? **Cambia questa se occupata!**
|
||||
- **Connection Type**: `TCP`
|
||||
|
||||
?? **Se questo mapping non viene configurato, la WebUI non sarà accessibile!**
|
||||
|
||||
### Step 4: Volume Mapping (?? IMPORTANTE per persistenza!)
|
||||
|
||||
Click **Add another Path, Port, Variable, Label o Device**
|
||||
|
||||
**Config Type**: `Path`
|
||||
- **Name**: `AppData`
|
||||
- **Container Path**: `/app/data`
|
||||
- **Host Path**: `/mnt/user/appdata/tradingbot`
|
||||
- **Access Mode**: `Read/Write`
|
||||
|
||||
### Step 5: Environment Variables
|
||||
|
||||
**ASPNETCORE_ENVIRONMENT**:
|
||||
- **Name**: `ASPNETCORE_ENVIRONMENT`
|
||||
- **Value**: `Production`
|
||||
|
||||
**ASPNETCORE_URLS**:
|
||||
- **Name**: `ASPNETCORE_URLS`
|
||||
- **Value**: `http://+:8080`
|
||||
|
||||
**TZ** (Opzionale):
|
||||
- **Name**: `TZ`
|
||||
- **Value**: `Europe/Rome` (o tuo timezone)
|
||||
|
||||
### Step 6: Apply
|
||||
|
||||
Click **Apply** in fondo alla pagina.
|
||||
|
||||
---
|
||||
|
||||
## ?? AGGIORNAMENTO CONTAINER
|
||||
|
||||
### Via Unraid Docker Tab
|
||||
|
||||
1. **Docker** ? Trova **TradingBot**
|
||||
2. Click **icona Stop** (ferma container)
|
||||
3. Click **Force Update** (icona update con freccia circolare)
|
||||
4. Attendi pull dell'immagine aggiornata
|
||||
5. Click **icona Start** (avvia container)
|
||||
|
||||
Unraid farà:
|
||||
- ? Pull ultima immagine da Gitea
|
||||
- ? Ricrea container con nuova immagine
|
||||
- ? **Mantiene dati persistenti** (volume non viene toccato)
|
||||
- ? Mantiene configurazione (porta, variabili, etc.)
|
||||
|
||||
?? **I tuoi trade e impostazioni sono al sicuro durante gli update!**
|
||||
|
||||
### Automatico con User Scripts Plugin
|
||||
|
||||
Installa **User Scripts** plugin:
|
||||
|
||||
1. **Apps** ? Cerca "User Scripts"
|
||||
2. Installa
|
||||
|
||||
Crea script update:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Nome: Update TradingBot
|
||||
# Schedula: Weekly (ogni domenica alle 3:00 AM)
|
||||
|
||||
# Stop container
|
||||
docker stop TradingBot
|
||||
|
||||
# Pull latest image
|
||||
docker pull gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
||||
|
||||
# Start container (Unraid ricrea automaticamente)
|
||||
docker start TradingBot
|
||||
|
||||
# Notifica
|
||||
/usr/local/emhttp/webGui/scripts/notify -s "TradingBot Update" -d "Container aggiornato con successo!" -i "normal"
|
||||
|
||||
echo "Update completato alle $(date)"
|
||||
```
|
||||
|
||||
Schedula: Settimanale o manualmente quando serve.
|
||||
|
||||
---
|
||||
|
||||
## ??? CONFIGURAZIONE PORTA
|
||||
|
||||
### Cambiare Porta WebUI
|
||||
|
||||
La porta **default è 8888** (host) ? **8080** (container).
|
||||
|
||||
Se la porta 8888 è occupata o vuoi usarne un'altra:
|
||||
|
||||
#### **Via Template (Prima Installazione)**
|
||||
|
||||
Durante Step 2 dell'installazione:
|
||||
- **WebUI HTTP Port**: Cambia da `8888` a porta desiderata (es. `8881`, `9999`, `7777`)
|
||||
- ?? Modifica SOLO la porta HOST (a sinistra)
|
||||
- NON modificare la porta Container (deve restare 8080)
|
||||
|
||||
#### **Via Edit (Container Esistente)**
|
||||
|
||||
1. **Docker tab** ? Container **TradingBot**
|
||||
2. Click **Edit** (icona matita/wrench)
|
||||
3. Trova sezione **Port Mappings**
|
||||
4. Vedrai: **Host Port** `8888` ? **Container Port** `8080`
|
||||
5. Modifica **Host Port** (es. da `8888` a `8881`)
|
||||
6. **IMPORTANTE**: NON modificare **Container Port** (deve restare `8080`)
|
||||
7. Click **Apply** in fondo
|
||||
8. Container si riavvierà automaticamente
|
||||
|
||||
#### **Accesso con Nuova Porta**
|
||||
|
||||
```
|
||||
http://192.168.30.23:NUOVA_PORTA_HOST
|
||||
```
|
||||
|
||||
Esempio con porta `8881`:
|
||||
```
|
||||
http://192.168.30.23:8881
|
||||
```
|
||||
|
||||
### Porte Comuni Disponibili
|
||||
|
||||
Se `8888` è occupata, prova queste alternative:
|
||||
|
||||
| Porta | Uso Comune | Probabilità Libera |
|
||||
|-------|------------|-------------------|
|
||||
| `8881` | Alternative port | ????? Alta |
|
||||
| `9999` | Generic services | ???? Alta |
|
||||
| `7777` | Custom apps | ???? Alta |
|
||||
| `8889` | Next to 8888 | ??? Media |
|
||||
| `3000` | Dev servers | ?? Bassa (spesso occupata) |
|
||||
| `8080` | ? NON usare | Troppo comune, quasi sempre occupata |
|
||||
|
||||
**Check porta disponibile**:
|
||||
```bash
|
||||
# Su Unraid via SSH
|
||||
netstat -tulpn | grep :8888
|
||||
# Se restituisce risultato ? porta occupata
|
||||
# Se vuoto ? porta libera ?
|
||||
```
|
||||
|
||||
### Differenza HOST vs CONTAINER Port
|
||||
|
||||
?? **IMPORTANTE da capire**:
|
||||
|
||||
```
|
||||
HOST Port (8888) ? CONTAINER Port (8080)
|
||||
?? Porta su Unraid ?? Porta interna Docker
|
||||
?? Quella nel BROWSER ?? Fissa, NON modificare
|
||||
?? Configurabile ?? Hardcoded nell'app
|
||||
?? Esempio: 8888 ?? Sempre 8080
|
||||
```
|
||||
|
||||
**Esempio configurazione corretta**:
|
||||
```
|
||||
Browser: http://192.168.30.23:8888
|
||||
?? Usa porta HOST
|
||||
|
||||
Docker: 8888 (host) ? 8080 (container)
|
||||
?? Mapping ?? App interna
|
||||
```
|
||||
|
||||
**Cosa NON fare**:
|
||||
- ? Cambiare porta Container da 8080 a altro
|
||||
- ? Modificare `ASPNETCORE_URLS` (deve restare `http://+:8080`)
|
||||
- ? Usare porta Host 8080 (conflitto con container)
|
||||
|
||||
**Cosa puoi fare**:
|
||||
- ? Cambiare porta Host da 8888 a qualsiasi altra libera
|
||||
- ? Usare porta Host diversa per ogni app
|
||||
- ? Accedere con `http://IP:PORTA_HOST`
|
||||
|
||||
---
|
||||
|
||||
## ?? QUICK START COMPLETO
|
||||
|
||||
**Setup in 3 minuti**:
|
||||
|
||||
```bash
|
||||
# 1. Login (una volta)
|
||||
docker login gitea.encke-hake.ts.net
|
||||
|
||||
# 2. Download template
|
||||
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
|
||||
|
||||
# 3. Install via UI
|
||||
# Docker tab ? Add Container ? TradingBot template ? Apply
|
||||
|
||||
# 4. Access WebUI
|
||||
# Metodo A: Click icona ?? nella Docker tab
|
||||
# Metodo B: http://192.168.30.23:8888
|
||||
```
|
||||
|
||||
**?? TradingBot pronto su Unraid!**
|
||||
|
||||
---
|
||||
|
||||
## ?? Nota sulla Porta
|
||||
|
||||
**Default**: Porta HOST `8888` (invece di 8080)
|
||||
|
||||
**Perché 8888?**
|
||||
- Porta 8080 è troppo comune e spesso occupata
|
||||
- 8888 è quasi sempre libera su Unraid
|
||||
- Facile da ricordare (quattro 8)
|
||||
- WebUI icon funziona automaticamente
|
||||
|
||||
**Se 8888 è occupata**: Cambia in fase di installazione o dopo via Edit
|
||||
|
||||
---
|
||||
|
||||
## ?? ACCESSO WEBUI
|
||||
|
||||
### Locale (Unraid LAN)
|
||||
|
||||
```
|
||||
http://192.168.30.23:8888
|
||||
```
|
||||
|
||||
Sostituisci:
|
||||
- `192.168.30.23` con IP del tuo Unraid
|
||||
- `8888` con porta HOST configurata (se diversa)
|
||||
|
||||
### Via Tailscale
|
||||
|
||||
Se hai configurato Tailscale su Unraid:
|
||||
|
||||
```
|
||||
http://unraid.encke-hake.ts.net:8888
|
||||
```
|
||||
|
||||
### Via Hostname Unraid
|
||||
|
||||
Se hai configurato hostname:
|
||||
|
||||
```
|
||||
http://tower:8888
|
||||
```
|
||||
|
||||
(Sostituisci `tower` con hostname del tuo Unraid e `8888` con porta configurata)
|
||||
|
||||
### Reverse Proxy (Accesso HTTPS)
|
||||
|
||||
Se usi **Nginx Proxy Manager** o **Swag**:
|
||||
|
||||
```nginx
|
||||
# Nginx Proxy Manager
|
||||
Upstream: http://192.168.30.23:8888
|
||||
Domain: tradingbot.tuo-dominio.com
|
||||
SSL: Let's Encrypt
|
||||
```
|
||||
|
||||
Poi accedi via:
|
||||
```
|
||||
https://tradingbot.tuo-dominio.com
|
||||
```
|
||||
|
||||
?? **Nota**: Il reverse proxy si connette alla porta HOST (8888), non container (8080)
|
||||
|
||||
---
|
||||
|
||||
## ?? SICUREZZA
|
||||
|
||||
### Best Practices
|
||||
|
||||
? **Porta non esposta pubblicamente** (solo LAN o VPN)
|
||||
? **Volume dati protetto** (`/mnt/user/appdata/tradingbot/`)
|
||||
? **Registry privato** (Gitea richiede login)
|
||||
? **Certificati validi** (Tailscale)
|
||||
? **User non-root** (già configurato nel Dockerfile)
|
||||
? **Dati persistenti** backup-ready
|
||||
|
||||
---
|
||||
|
||||
## ?? CHECKLIST INSTALLAZIONE
|
||||
|
||||
### Pre-Install
|
||||
- [ ] Unraid 6.10+ installato
|
||||
- [ ] Docker service attivo
|
||||
- [ ] Porta 8888 (o alternativa) disponibile
|
||||
- [ ] `docker login gitea.encke-hake.ts.net` successful
|
||||
- [ ] Internet attivo per pull immagine
|
||||
|
||||
### Install
|
||||
- [ ] Template XML scaricato su Unraid
|
||||
- [ ] Container creato da template
|
||||
- [ ] Porta WebUI configurata (8888 host ? 8080 container)
|
||||
- [ ] Volume AppData creato (`/mnt/user/appdata/tradingbot`)
|
||||
- [ ] Container status: **running**
|
||||
|
||||
### Post-Install
|
||||
- [ ] WebUI accessibile (http://IP:8888)
|
||||
- [ ] Dashboard carica correttamente
|
||||
- [ ] Settings modificabili e salvabili
|
||||
- [ ] Bot avviabile dalla UI
|
||||
- [ ] Trade vengono salvati automaticamente
|
||||
- [ ] Dati persistono dopo restart
|
||||
|
||||
---
|
||||
|
||||
## ?? VANTAGGI UNRAID NATIVO
|
||||
|
||||
? **Zero dipendenze** (no Portainer, no docker-compose)
|
||||
? **WebUI Unraid integrata** (gestione familiare)
|
||||
? **Auto-start** (container parte con Unraid)
|
||||
? **Backup integrato** (con plugin CA)
|
||||
? **Update semplice** (2 click: Stop ? Update ? Start)
|
||||
? **Template riutilizzabile** (reinstall in 1 minuto)
|
||||
? **Dati persistenti** (trade e settings sopravvivono)
|
||||
? **Logs accessibili** dalla UI
|
||||
|
||||
---
|
||||
|
||||
## ?? WORKFLOW COMPLETO
|
||||
|
||||
### Sviluppo (PC)
|
||||
```
|
||||
1. ?? Visual Studio ? Codice
|
||||
2. ?? Build ? Publish (Docker profile)
|
||||
3. ? Automatico: Push Gitea Registry
|
||||
?? Tags: latest, 1.2.0, 1.2.0-YYYYMMDD
|
||||
4. ?? git push origin main --tags
|
||||
```
|
||||
|
||||
### Deploy (Unraid)
|
||||
```
|
||||
1. ?? Docker tab ? TradingBot
|
||||
2. ?? Stop
|
||||
3. ?? Force Update (pull latest)
|
||||
4. ?? Start
|
||||
5. ? Done! (~ 1 minuto)
|
||||
?? Dati automaticamente ripristinati
|
||||
```
|
||||
|
||||
**Tempo totale**: ~2 minuti dal commit al running!
|
||||
|
||||
---
|
||||
|
||||
## ?? RISORSE
|
||||
|
||||
### Links Utili
|
||||
|
||||
| Risorsa | URL |
|
||||
|---------|-----|
|
||||
| **Template XML** | `https://gitea.encke-hake.ts.net/Alby96/Encelado/raw/branch/main/TradingBot/deployment/unraid-template.xml` |
|
||||
| **Repository Git** | `https://gitea.encke-hake.ts.net/Alby96/Encelado` |
|
||||
| **Docker Image** | `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest` |
|
||||
| **Packages** | `https://gitea.encke-hake.ts.net/Alby96/Encelado/-/packages` |
|
||||
| **Support/Issues** | `https://gitea.encke-hake.ts.net/Alby96/Encelado/issues` |
|
||||
|
||||
### Comandi Utili
|
||||
|
||||
```bash
|
||||
# Status container
|
||||
docker ps -a | grep TradingBot
|
||||
|
||||
# Logs real-time
|
||||
docker logs -f TradingBot
|
||||
|
||||
# Statistics
|
||||
docker stats TradingBot --no-stream
|
||||
|
||||
# Restart
|
||||
docker restart TradingBot
|
||||
|
||||
# Update
|
||||
docker pull gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
||||
|
||||
# Remove (mantiene dati in /mnt/user/appdata/tradingbot)
|
||||
docker rm -f TradingBot
|
||||
|
||||
# Inspect persistent data
|
||||
ls -lh /mnt/user/appdata/tradingbot/
|
||||
cat /mnt/user/appdata/tradingbot/trade-history.json | jq
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**?? TradingBot v1.2.0 con persistenza completa pronto su Unraid!**
|
||||
@@ -0,0 +1,38 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
tradingbot:
|
||||
container_name: tradingbot
|
||||
image: gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
||||
ports:
|
||||
- "${EXTERNAL_PORT:-8080}:8080"
|
||||
volumes:
|
||||
- tradingbot-data:/app/data
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Production
|
||||
- ASPNETCORE_URLS=http://+:8080
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
networks:
|
||||
- tradingbot-network
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: '0.5'
|
||||
memory: 256M
|
||||
|
||||
volumes:
|
||||
tradingbot-data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
tradingbot-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0"?>
|
||||
<Container version="2">
|
||||
<Name>TradingBot</Name>
|
||||
<Repository>gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest</Repository>
|
||||
<Registry>https://gitea.encke-hake.ts.net</Registry>
|
||||
<Network>bridge</Network>
|
||||
<MyIP/>
|
||||
<Shell>sh</Shell>
|
||||
<Privileged>false</Privileged>
|
||||
<Support>https://gitea.encke-hake.ts.net/Alby96/Encelado</Support>
|
||||
<Project>https://gitea.encke-hake.ts.net/Alby96/Encelado</Project>
|
||||
<Overview>TradingBot - Automated Crypto Trading Bot con Blazor UI. Trading algoritmico, analisi tecnica e gestione portfolio.</Overview>
|
||||
<Category>Tools:Productivity Status:Stable</Category>
|
||||
<WebUI>http://[IP]:[PORT:8888]/</WebUI>
|
||||
<TemplateURL>https://gitea.encke-hake.ts.net/Alby96/Encelado/raw/branch/main/TradingBot/deployment/unraid-template.xml</TemplateURL>
|
||||
<Icon>https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/png/dotnet.png</Icon>
|
||||
<ExtraParams/>
|
||||
<PostArgs/>
|
||||
<CPUset/>
|
||||
<DateInstalled/>
|
||||
<DonateText/>
|
||||
<DonateLink/>
|
||||
<DonateImg/>
|
||||
<Requires/>
|
||||
|
||||
<!-- CRITICAL: Port Configuration - Must be visible -->
|
||||
<Config Name="WebUI Port" Target="8080" Default="8888" Mode="tcp" Description="Porta HTTP WebUI (Host:8888 -> Container:8080)" Type="Port" Display="always" Required="true" Mask="false">8888</Config>
|
||||
|
||||
<!-- Volume Configuration -->
|
||||
<Config Name="AppData" Target="/app/data" Default="/mnt/user/appdata/tradingbot" Mode="rw" Description="Directory dati persistenti" Type="Path" Display="always" Required="true" Mask="false">/mnt/user/appdata/tradingbot</Config>
|
||||
|
||||
<!-- Environment Variables -->
|
||||
<Config Name="ASPNETCORE_ENVIRONMENT" Target="ASPNETCORE_ENVIRONMENT" Default="Production" Mode="" Description="Runtime environment" Type="Variable" Display="advanced" Required="true" Mask="false">Production</Config>
|
||||
<Config Name="ASPNETCORE_URLS" Target="ASPNETCORE_URLS" Default="http://+:8080" Mode="" Description="Internal binding (do not change)" Type="Variable" Display="advanced" Required="true" Mask="false">http://+:8080</Config>
|
||||
<Config Name="TZ" Target="TZ" Default="Europe/Rome" Mode="" Description="Timezone" Type="Variable" Display="advanced" Required="false" Mask="false">Europe/Rome</Config>
|
||||
</Container>
|
||||
Reference in New Issue
Block a user