Refactor documentazione, versioning e deployment
- Riorganizzato README.md con badge versione, changelog, guida rapida e istruzioni semplificate per Docker/Unraid - Creato CHANGELOG.md secondo standard Keep a Changelog/SemVer - Aggiunto script bump-version.ps1 per gestione automatica versioni e tagging Git - Aggiornate guide deployment: PUBLISHING_GUIDE.md, UNRAID_INSTALL.md e README.md in /deployment - Modificato unraid-template.xml: porta WebUI configurabile (default 8888), volumi e variabili ambiente semplificati - Aggiornata PROJECT_STRUCTURE.md con nuova struttura e best practices - Migliorata chiarezza, professionalità e automazione del workflow di rilascio
This commit is contained in:
58
TradingBot/CHANGELOG.md
Normal file
58
TradingBot/CHANGELOG.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
Tutte le modifiche significative a TradingBot sono documentate qui.
|
||||||
|
|
||||||
|
Formato basato su [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), segue [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.1.0] - 2024-12-17
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Automated Deployment**: MSBuild post-build per push automatico su Gitea Registry
|
||||||
|
- **Multiple Docker Tags**: latest, version, version-date per ogni release
|
||||||
|
- **Versioning System**: Script PowerShell `bump-version.ps1` per gestione versioni
|
||||||
|
- **Unraid Support**: Template XML per installazione 1-click
|
||||||
|
- **Documentation**: Guide complete per deployment e versioning
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Riorganizzata struttura progetto (`/deployment`, `/docs`)
|
||||||
|
- Default WebUI port cambiato da 8080 a 8888
|
||||||
|
- Health check timing aumentato a 40s per startup Blazor
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- WebUI icon non visibile in Unraid Docker tab
|
||||||
|
- Port mapping non configurabile in template
|
||||||
|
- Template URL path corretto
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.0.0] - 2024-12-15
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Initial Release** di TradingBot
|
||||||
|
- Blazor Server UI con dashboard real-time
|
||||||
|
- Simple Moving Average (SMA) trading strategy
|
||||||
|
- 15 criptovalute supportate
|
||||||
|
- Simulazione market data per testing
|
||||||
|
- Trade history e statistics
|
||||||
|
- Settings persistenti via JSON
|
||||||
|
- Indicatori tecnici: SMA, EMA, RSI, MACD, Bollinger Bands
|
||||||
|
- Docker support con multi-stage build
|
||||||
|
- Health checks integrati
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Version Legend
|
||||||
|
|
||||||
|
- **Added**: Nuove features
|
||||||
|
- **Changed**: Modifiche a funzionalità esistenti
|
||||||
|
- **Deprecated**: Features da rimuovere
|
||||||
|
- **Removed**: Features rimosse
|
||||||
|
- **Fixed**: Bug fixes
|
||||||
|
- **Security**: Security fixes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[1.1.0]: https://gitea.encke-hake.ts.net/Alby96/Encelado/compare/v1.0.0...v1.1.0
|
||||||
|
[1.0.0]: https://gitea.encke-hake.ts.net/Alby96/Encelado/releases/tag/v1.0.0
|
||||||
@@ -5,414 +5,129 @@
|
|||||||
[](https://dotnet.microsoft.com/)
|
[](https://dotnet.microsoft.com/)
|
||||||
[](https://blazor.net/)
|
[](https://blazor.net/)
|
||||||
[](https://www.docker.com/)
|
[](https://www.docker.com/)
|
||||||
[](LICENSE)
|
[](https://gitea.encke-hake.ts.net/Alby96/Encelado/-/packages)
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Indice
|
|
||||||
|
|
||||||
- [Caratteristiche](#-caratteristiche)
|
|
||||||
- [Architettura](#-architettura)
|
|
||||||
- [Quick Start](#-quick-start)
|
|
||||||
- [Deployment](#-deployment)
|
|
||||||
- [Sviluppo](#-sviluppo)
|
|
||||||
- [Documentazione](#-documentazione)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ? Caratteristiche
|
## ? Caratteristiche
|
||||||
|
|
||||||
### ?? Trading Algoritmico
|
- **Trading Algoritmico**: Simple Moving Average (SMA) strategy
|
||||||
- **Simple Moving Average (SMA)** strategy integrata
|
- **Dashboard Blazor**: Real-time updates ogni 3 secondi
|
||||||
- **Analisi tecnica** in tempo reale
|
- **15 Criptovalute**: BTC, ETH, BNB, ADA, SOL, XRP, DOT, DOGE, AVAX, MATIC, LINK, LTC, UNI, ATOM, XLM
|
||||||
- **Gestione portfolio** automatizzata
|
- **Analisi Tecnica**: SMA, EMA, RSI, MACD, Bollinger Bands
|
||||||
- **Simulazione trading** senza rischi reali
|
- **Portfolio Management**: Gestione automatizzata posizioni
|
||||||
|
- **Docker Ready**: Container ottimizzato con health checks
|
||||||
### ?? Dashboard Interattiva
|
|
||||||
- **Blazor Server UI** reattiva e moderna
|
|
||||||
- **Real-time updates** ogni 3 secondi
|
|
||||||
- **Grafici** statistiche di performance
|
|
||||||
- **Gestione asset** con configurazione granulare
|
|
||||||
|
|
||||||
### ?? Gestione Completa
|
|
||||||
- **15 Criptovalute** supportate (BTC, ETH, BNB, etc.)
|
|
||||||
- **Configurazione per asset** (importo, strategia)
|
|
||||||
- **History completa** delle operazioni
|
|
||||||
- **Settings centralizzate** e persistenti
|
|
||||||
|
|
||||||
### ?? Docker-Ready
|
|
||||||
- **Container ottimizzato** per produzione
|
|
||||||
- **Health checks** integrati
|
|
||||||
- **Volume persistente** per dati
|
|
||||||
- **Gitea Registry** integration
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ??? Architettura
|
|
||||||
|
|
||||||
```
|
|
||||||
TradingBot/
|
|
||||||
??? Components/ # Blazor Components
|
|
||||||
? ??? Pages/ # Pagine (Dashboard, Market, etc.)
|
|
||||||
? ??? Layout/ # Layout e ReconnectModal
|
|
||||||
? ??? Shared/ # Componenti condivisi
|
|
||||||
??? Services/ # Business Logic
|
|
||||||
? ??? TradingBotService.cs # Core service
|
|
||||||
? ??? SimulatedMarketDataService.cs # Market data
|
|
||||||
? ??? SimpleMovingAverageStrategy.cs # Trading strategy
|
|
||||||
? ??? SettingsService.cs # Persistenza settings
|
|
||||||
? ??? TechnicalAnalysis.cs # Indicatori tecnici
|
|
||||||
??? Models/ # Data Models
|
|
||||||
? ??? Trade.cs
|
|
||||||
? ??? MarketPrice.cs
|
|
||||||
? ??? TradingSignal.cs
|
|
||||||
? ??? ...
|
|
||||||
??? wwwroot/ # Static assets
|
|
||||||
? ??? css/
|
|
||||||
? ??? lib/
|
|
||||||
??? Properties/ # Configuration
|
|
||||||
? ??? PublishProfiles/ # Docker publish profiles
|
|
||||||
? ??? launchSettings.json
|
|
||||||
??? docs/ # Documentation
|
|
||||||
? ??? deployment/ # Deployment guides
|
|
||||||
??? Dockerfile # Docker multi-stage build
|
|
||||||
??? docker-compose.yml # Compose configuration
|
|
||||||
??? Program.cs # App entry point
|
|
||||||
```
|
|
||||||
|
|
||||||
### ?? Data Flow
|
|
||||||
|
|
||||||
```
|
|
||||||
Market Data ? Analysis ? Signal ? Execution ? Portfolio Update ? UI Refresh
|
|
||||||
? ? ? ? ? ?
|
|
||||||
Simulated SMA Buy/Sell Simulated Statistics Dashboard
|
|
||||||
Prices Strategy Hold Trade Update Update
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ?? Quick Start
|
## ?? Quick Start
|
||||||
|
|
||||||
### Prerequisiti
|
### Locale (Development)
|
||||||
|
|
||||||
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
|
|
||||||
- [Docker Desktop](https://www.docker.com/products/docker-desktop) (per deployment)
|
|
||||||
- [Visual Studio 2022](https://visualstudio.microsoft.com/) (consigliato) o VS Code
|
|
||||||
|
|
||||||
### Esecuzione Locale
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone repository
|
|
||||||
git clone https://gitea.encke-hake.ts.net/Alby96/Encelado
|
git clone https://gitea.encke-hake.ts.net/Alby96/Encelado
|
||||||
cd Encelado/TradingBot
|
cd Encelado/TradingBot
|
||||||
|
|
||||||
# Restore dependencies
|
|
||||||
dotnet restore
|
|
||||||
|
|
||||||
# Run
|
|
||||||
dotnet run
|
dotnet run
|
||||||
|
|
||||||
# Oppure da Visual Studio:
|
|
||||||
# F5 (Debug) o Ctrl+F5 (senza debug)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Accedi a**: `http://localhost:5243`
|
Accedi a: `http://localhost:5243`
|
||||||
|
|
||||||
---
|
### Docker
|
||||||
|
|
||||||
## ?? Deployment
|
|
||||||
|
|
||||||
### ?? Docker
|
|
||||||
|
|
||||||
#### Build & Run Locale
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build image
|
|
||||||
docker build -t tradingbot:latest .
|
|
||||||
|
|
||||||
# Run container
|
|
||||||
docker run -d \
|
|
||||||
--name tradingbot \
|
|
||||||
-p 8080:8080 \
|
|
||||||
-v tradingbot-data:/app/data \
|
|
||||||
tradingbot:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
**Accedi a**: `http://localhost:8080`
|
|
||||||
|
|
||||||
#### Con Docker Compose
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
### ?? Unraid
|
|
||||||
|
|
||||||
Guida completa: [docs/deployment/UNRAID_NATIVE_INSTALL.md](docs/deployment/UNRAID_NATIVE_INSTALL.md)
|
|
||||||
|
|
||||||
**Quick Install**:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Login Gitea Registry
|
|
||||||
docker login gitea.encke-hake.ts.net
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Install via Unraid Docker UI
|
|
||||||
```
|
|
||||||
|
|
||||||
### ?? Gitea Container Registry
|
|
||||||
|
|
||||||
#### Publish da Visual Studio
|
|
||||||
|
|
||||||
1. **Build** ? **Configuration Manager** ? **Release**
|
|
||||||
2. **Build** ? **Publish TradingBot**
|
|
||||||
3. Seleziona profilo **"Docker"**
|
|
||||||
4. Click **"Publish"**
|
|
||||||
|
|
||||||
Visual Studio automaticamente:
|
|
||||||
- ? Build immagine Docker
|
|
||||||
- ? Tag per Gitea Registry
|
|
||||||
- ? Push su `gitea.encke-hake.ts.net/alby96/encelado/tradingbot`
|
|
||||||
|
|
||||||
#### Pull & Deploy
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
docker pull gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
||||||
docker run -d -p 8080:8080 gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
docker run -d -p 8888:8080 \
|
||||||
|
-v tradingbot-data:/app/data \
|
||||||
|
gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Accedi a: `http://localhost:8888`
|
||||||
|
|
||||||
|
### Unraid
|
||||||
|
|
||||||
|
Guida completa: [deployment/UNRAID_INSTALL.md](deployment/UNRAID_INSTALL.md)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Login Gitea Registry
|
||||||
|
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 Unraid Docker UI
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ?? Sviluppo
|
## ?? Versioning
|
||||||
|
|
||||||
### Struttura Progetto
|
### Current Version: `1.1.0`
|
||||||
|
|
||||||
- **`.NET 10`** - Latest .NET version
|
```powershell
|
||||||
- **`Blazor Server`** - Interactive server-side rendering
|
# Bug fix (1.1.0 ? 1.1.1)
|
||||||
- **`C# 14`** - Latest language features
|
.\bump-version.ps1 patch -Message "Fix memory leak"
|
||||||
- **`Bootstrap 5`** - Responsive UI framework
|
|
||||||
|
|
||||||
### Debug
|
# New feature (1.1.0 ? 1.2.0)
|
||||||
|
.\bump-version.ps1 minor -Message "Add RSI strategy"
|
||||||
|
|
||||||
#### Visual Studio
|
# Breaking change (1.1.0 ? 2.0.0)
|
||||||
|
.\bump-version.ps1 major -Message "New API"
|
||||||
```
|
|
||||||
1. Set startup profile: "TradingBot" (HTTP) o "Docker"
|
|
||||||
2. F5 per debug con breakpoints
|
|
||||||
3. Hot Reload abilitato per UI changes
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### VS Code
|
Vedi [CHANGELOG.md](CHANGELOG.md) per release notes complete.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ?? Publishing
|
||||||
|
|
||||||
|
### Da Visual Studio
|
||||||
|
|
||||||
|
1. **Build** ? **Configuration Manager** ? **Release**
|
||||||
|
2. **Build** ? **Publish TradingBot** ? Profilo **Docker**
|
||||||
|
3. Click **Publish**
|
||||||
|
|
||||||
|
Il sistema automaticamente:
|
||||||
|
- ? Build Docker image
|
||||||
|
- ? Tag: `latest`, `1.1.0`, `1.1.0-20241217`
|
||||||
|
- ? Push su Gitea Registry
|
||||||
|
|
||||||
|
### Deploy su Unraid
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install C# Dev Kit extension
|
# Docker tab ? TradingBot ? Stop ? Force Update ? Start
|
||||||
# Open folder in VS Code
|
|
||||||
code .
|
|
||||||
|
|
||||||
# F5 per debug
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Test Locale
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Run senza debug
|
|
||||||
dotnet run --no-build
|
|
||||||
|
|
||||||
# Watch mode (auto-rebuild on changes)
|
|
||||||
dotnet watch run
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build Configuration
|
|
||||||
|
|
||||||
- **Debug**: Development, verbose logging, no optimizations
|
|
||||||
- **Release**: Production-ready, optimized, Docker-compatible
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ?? Documentazione
|
## ?? Documentazione
|
||||||
|
|
||||||
### Guide Deployment
|
- **[UNRAID_INSTALL.md](deployment/UNRAID_INSTALL.md)** - Installazione completa su Unraid
|
||||||
|
- **[CHANGELOG.md](CHANGELOG.md)** - Release notes e versioni
|
||||||
- [**Unraid Native Install**](docs/deployment/UNRAID_NATIVE_INSTALL.md) - Installazione su Unraid senza Portainer
|
- **[Dockerfile](Dockerfile)** - Docker multi-stage build
|
||||||
- [**Docker Compose**](docker-compose.yml) - Configurazione Docker Compose
|
- **[docker-compose.yml](deployment/docker-compose.yml)** - Deploy con Compose
|
||||||
- [**Template Unraid**](deployment/unraid-template.xml) - Template XML per Unraid
|
|
||||||
|
|
||||||
### API & Architettura
|
|
||||||
|
|
||||||
#### Services
|
|
||||||
|
|
||||||
- **TradingBotService**: Core trading logic e portfolio management
|
|
||||||
- **SimulatedMarketDataService**: Generazione dati di mercato simulati
|
|
||||||
- **SimpleMovingAverageStrategy**: Strategia SMA per segnali trading
|
|
||||||
- **SettingsService**: Persistenza configurazioni utente
|
|
||||||
- **TechnicalAnalysis**: Calcolo indicatori tecnici (SMA, EMA, RSI, MACD)
|
|
||||||
|
|
||||||
#### Models
|
|
||||||
|
|
||||||
- **Trade**: Rappresenta un'operazione di trading
|
|
||||||
- **MarketPrice**: Snapshot prezzo e volume di un asset
|
|
||||||
- **TradingSignal**: Segnale generato dalla strategia (Buy/Sell/Hold)
|
|
||||||
- **PortfolioStatistics**: Statistiche aggregate del portfolio
|
|
||||||
- **AssetConfiguration**: Configurazione per singolo asset
|
|
||||||
|
|
||||||
### Configurazione
|
|
||||||
|
|
||||||
#### Environment Variables
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ASPNETCORE_ENVIRONMENT=Production # Development|Production
|
|
||||||
ASPNETCORE_URLS=http://+:8080 # Bind URL
|
|
||||||
EXTERNAL_PORT=8080 # External port (docker-compose)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Ports
|
|
||||||
|
|
||||||
- **5243**: HTTP (Development)
|
|
||||||
- **7241**: HTTPS (Development)
|
|
||||||
- **8080**: HTTP (Production/Docker)
|
|
||||||
|
|
||||||
#### Volumes
|
|
||||||
|
|
||||||
- **`/app/data`**: Persistenza dati (settings, trade history)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ?? Configurazione Avanzata
|
## ??? Tecnologie
|
||||||
|
|
||||||
### Custom Strategy
|
- **.NET 10** | **Blazor Server** | **C# 14**
|
||||||
|
- **Bootstrap 5.3** | **Docker** | **Gitea Registry**
|
||||||
Implementa `ITradingStrategy` per creare strategie personalizzate:
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
public class MyCustomStrategy : ITradingStrategy
|
|
||||||
{
|
|
||||||
public string Name => "My Custom Strategy";
|
|
||||||
|
|
||||||
public Task<TradingSignal> AnalyzeAsync(string symbol, List<MarketPrice> prices)
|
|
||||||
{
|
|
||||||
// Your strategy logic here
|
|
||||||
return Task.FromResult(new TradingSignal { ... });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Registra nel `Program.cs`:
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
builder.Services.AddSingleton<ITradingStrategy, MyCustomStrategy>();
|
|
||||||
```
|
|
||||||
|
|
||||||
### Asset Configuration
|
|
||||||
|
|
||||||
Modifica asset supportati in `TradingBotService.cs`:
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
private void InitializeAssetConfigurations()
|
|
||||||
{
|
|
||||||
AssetConfigurations.Add("MYNEWCOIN", new AssetConfiguration
|
|
||||||
{
|
|
||||||
Symbol = "MYNEWCOIN",
|
|
||||||
Name = "My New Coin",
|
|
||||||
TradingAmount = 1000,
|
|
||||||
IsEnabled = true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Features Roadmap
|
|
||||||
|
|
||||||
### ? Implementato
|
|
||||||
|
|
||||||
- [x] Dashboard con statistiche real-time
|
|
||||||
- [x] Simulazione trading multi-asset
|
|
||||||
- [x] Simple Moving Average strategy
|
|
||||||
- [x] Portfolio management
|
|
||||||
- [x] Trade history
|
|
||||||
- [x] Settings persistenti
|
|
||||||
- [x] Docker support
|
|
||||||
- [x] Unraid template
|
|
||||||
- [x] Gitea Registry integration
|
|
||||||
|
|
||||||
### ?? In Sviluppo
|
|
||||||
|
|
||||||
- [ ] Autenticazione utenti
|
|
||||||
- [ ] Strategie avanzate (RSI, MACD, Bollinger Bands)
|
|
||||||
- [ ] Backtesting su dati storici
|
|
||||||
- [ ] API REST per integrazione esterna
|
|
||||||
- [ ] Notifiche (email, Telegram)
|
|
||||||
- [ ] Grafici interattivi (ChartJS/ApexCharts)
|
|
||||||
|
|
||||||
### ?? Pianificato
|
|
||||||
|
|
||||||
- [ ] Integrazione exchange reali (Binance, Coinbase)
|
|
||||||
- [ ] Machine Learning per prediction
|
|
||||||
- [ ] Multi-utente con isolation
|
|
||||||
- [ ] Mobile app (MAUI)
|
|
||||||
- [ ] Advanced analytics dashboard
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ??? Tecnologie Utilizzate
|
|
||||||
|
|
||||||
### Backend
|
|
||||||
- **.NET 10** - Framework applicativo
|
|
||||||
- **ASP.NET Core** - Web server
|
|
||||||
- **C# 14** - Linguaggio programmazione
|
|
||||||
|
|
||||||
### Frontend
|
|
||||||
- **Blazor Server** - UI framework
|
|
||||||
- **Bootstrap 5.3** - CSS framework
|
|
||||||
- **Bootstrap Icons** - Iconografia
|
|
||||||
|
|
||||||
### Infrastructure
|
|
||||||
- **Docker** - Containerization
|
|
||||||
- **Gitea** - Git repository & Container Registry
|
|
||||||
- **Unraid** - Home server platform
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ?? License
|
## ?? License
|
||||||
|
|
||||||
Questo progetto è rilasciato sotto licenza MIT. Vedi [LICENSE](LICENSE) per dettagli.
|
MIT License - Copyright © 2024 Alby96
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Contributi
|
|
||||||
|
|
||||||
Contributi, issues e feature requests sono benvenuti!
|
|
||||||
|
|
||||||
1. Fork il progetto
|
|
||||||
2. Crea un feature branch (`git checkout -b feature/AmazingFeature`)
|
|
||||||
3. Commit le modifiche (`git commit -m 'Add AmazingFeature'`)
|
|
||||||
4. Push al branch (`git push origin feature/AmazingFeature`)
|
|
||||||
5. Apri una Pull Request
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ?? Autore
|
## ?? Autore
|
||||||
|
|
||||||
**Alberto** (Alby96)
|
**Alberto** (Alby96)
|
||||||
|
|
||||||
- Gitea: [@Alby96](https://gitea.encke-hake.ts.net/Alby96)
|
- Gitea: [@Alby96](https://gitea.encke-hake.ts.net/Alby96)
|
||||||
- Repository: [Encelado/TradingBot](https://gitea.encke-hake.ts.net/Alby96/Encelado)
|
- Repository: [Encelado/TradingBot](https://gitea.encke-hake.ts.net/Alby96/Encelado)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ?? Acknowledgments
|
**?? Happy Trading!**
|
||||||
|
|
||||||
- [Microsoft .NET](https://dotnet.microsoft.com/) - Amazing framework
|
|
||||||
- [Blazor](https://blazor.net/) - Modern web UI
|
|
||||||
- [Bootstrap](https://getbootstrap.com/) - Responsive design
|
|
||||||
- [Docker](https://www.docker.com/) - Containerization
|
|
||||||
- [Gitea](https://gitea.io/) - Self-hosted Git service
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Made with ?? for algorithmic trading enthusiasts**
|
|
||||||
|
|
||||||
?? **Happy Trading!**
|
|
||||||
|
|||||||
149
TradingBot/bump-version.ps1
Normal file
149
TradingBot/bump-version.ps1
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
# Version Bump Script
|
||||||
|
# Aggiorna automaticamente la versione nel .csproj e crea tag Git
|
||||||
|
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[ValidateSet('major', 'minor', 'patch')]
|
||||||
|
[string]$BumpType,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[string]$Message = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "========================================" -ForegroundColor Cyan
|
||||||
|
Write-Host "?? TradingBot Version Bump" -ForegroundColor Cyan
|
||||||
|
Write-Host "========================================" -ForegroundColor Cyan
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# Path al .csproj
|
||||||
|
$csprojPath = Join-Path $PSScriptRoot "TradingBot.csproj"
|
||||||
|
|
||||||
|
if (-not (Test-Path $csprojPath)) {
|
||||||
|
Write-Host "? File TradingBot.csproj non trovato!" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Leggi versione corrente
|
||||||
|
Write-Host "?? Reading current version..." -ForegroundColor Yellow
|
||||||
|
[xml]$csproj = Get-Content $csprojPath
|
||||||
|
$currentVersion = $csproj.Project.PropertyGroup.Version
|
||||||
|
|
||||||
|
if (-not $currentVersion) {
|
||||||
|
Write-Host "? Version not found in .csproj!" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host " Current version: $currentVersion" -ForegroundColor Gray
|
||||||
|
|
||||||
|
# Parse versione
|
||||||
|
$versionParts = $currentVersion.Split('.')
|
||||||
|
$major = [int]$versionParts[0]
|
||||||
|
$minor = [int]$versionParts[1]
|
||||||
|
$patch = [int]$versionParts[2]
|
||||||
|
|
||||||
|
# Bump versione
|
||||||
|
switch ($BumpType) {
|
||||||
|
'major' {
|
||||||
|
$major++
|
||||||
|
$minor = 0
|
||||||
|
$patch = 0
|
||||||
|
Write-Host " Bumping: MAJOR version (breaking changes)" -ForegroundColor Magenta
|
||||||
|
}
|
||||||
|
'minor' {
|
||||||
|
$minor++
|
||||||
|
$patch = 0
|
||||||
|
Write-Host " Bumping: MINOR version (new features)" -ForegroundColor Blue
|
||||||
|
}
|
||||||
|
'patch' {
|
||||||
|
$patch++
|
||||||
|
Write-Host " Bumping: PATCH version (bug fixes)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$newVersion = "$major.$minor.$patch"
|
||||||
|
$newAssemblyVersion = "$major.$minor.$patch.0"
|
||||||
|
|
||||||
|
Write-Host " New version: $newVersion" -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# Aggiorna .csproj
|
||||||
|
Write-Host "?? Updating TradingBot.csproj..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Update Version
|
||||||
|
$csproj.Project.PropertyGroup.Version = $newVersion
|
||||||
|
$csproj.Project.PropertyGroup.AssemblyVersion = $newAssemblyVersion
|
||||||
|
$csproj.Project.PropertyGroup.FileVersion = $newAssemblyVersion
|
||||||
|
|
||||||
|
# Save
|
||||||
|
$csproj.Save($csprojPath)
|
||||||
|
|
||||||
|
Write-Host " ? Updated Version: $newVersion" -ForegroundColor Green
|
||||||
|
Write-Host " ? Updated AssemblyVersion: $newAssemblyVersion" -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# Git commit
|
||||||
|
Write-Host "?? Creating Git commit..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
$commitMessage = if ($Message) {
|
||||||
|
"chore: Bump version to $newVersion - $Message"
|
||||||
|
} else {
|
||||||
|
"chore: Bump version to $newVersion"
|
||||||
|
}
|
||||||
|
|
||||||
|
git add $csprojPath
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "? Git add failed!" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
git commit -m $commitMessage
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "? Git commit failed!" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host " ? Committed: $commitMessage" -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# Git tag
|
||||||
|
Write-Host "??? Creating Git tag..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
$tagName = "v$newVersion"
|
||||||
|
$tagMessage = if ($Message) {
|
||||||
|
"Release $newVersion - $Message"
|
||||||
|
} else {
|
||||||
|
"Release $newVersion"
|
||||||
|
}
|
||||||
|
|
||||||
|
git tag -a $tagName -m $tagMessage
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "? Git tag failed!" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host " ? Created tag: $tagName" -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
Write-Host "========================================" -ForegroundColor Green
|
||||||
|
Write-Host "? Version bumped successfully!" -ForegroundColor Green
|
||||||
|
Write-Host "========================================" -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "?? Version: $currentVersion ? $newVersion" -ForegroundColor White
|
||||||
|
Write-Host "??? Git tag: $tagName" -ForegroundColor White
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "?? Next steps:" -ForegroundColor Cyan
|
||||||
|
Write-Host " 1. Push commit: git push origin main" -ForegroundColor White
|
||||||
|
Write-Host " 2. Push tag: git push origin $tagName" -ForegroundColor White
|
||||||
|
Write-Host " 3. Build & Publish: Visual Studio ? Publish (Docker profile)" -ForegroundColor White
|
||||||
|
Write-Host " 4. Deploy on Unraid" -ForegroundColor White
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "?? Or push both at once:" -ForegroundColor Cyan
|
||||||
|
Write-Host " git push origin main --tags" -ForegroundColor White
|
||||||
|
Write-Host ""
|
||||||
@@ -1,413 +0,0 @@
|
|||||||
# ?? Publishing Guide - TradingBot
|
|
||||||
|
|
||||||
Guida completa per pubblicare TradingBot su Gitea Container Registry usando **SOLO** Visual Studio e MSBuild integrato.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ? Setup Prerequisiti (Una Volta)
|
|
||||||
|
|
||||||
### 1. Login Gitea Registry
|
|
||||||
|
|
||||||
Apri PowerShell/Terminal:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
docker login gitea.encke-hake.ts.net
|
|
||||||
# Username: Alby96
|
|
||||||
# Password: [Personal Access Token Gitea]
|
|
||||||
```
|
|
||||||
|
|
||||||
Output:
|
|
||||||
```
|
|
||||||
Login Succeeded ?
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Verifica Docker Desktop
|
|
||||||
|
|
||||||
Assicurati che Docker Desktop sia in running:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
docker --version
|
|
||||||
# Docker version 24.x.x o superiore
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Publishing Workflow
|
|
||||||
|
|
||||||
### Metodo Unico: Visual Studio + MSBuild Automatico
|
|
||||||
|
|
||||||
#### Step 1: Seleziona Release Configuration
|
|
||||||
|
|
||||||
1. **Build menu** ? **Configuration Manager**
|
|
||||||
2. **Active solution configuration**: Seleziona **Release**
|
|
||||||
3. Click **Close**
|
|
||||||
|
|
||||||
#### Step 2: Publish con Profilo Docker
|
|
||||||
|
|
||||||
1. **Solution Explorer** ? Right-click **TradingBot**
|
|
||||||
2. Click **Publish...**
|
|
||||||
3. Seleziona profilo **"Docker"**
|
|
||||||
4. Click sul pulsante **"Publish"**
|
|
||||||
|
|
||||||
#### Step 3: Automatico! ?
|
|
||||||
|
|
||||||
Visual Studio esegue automaticamente:
|
|
||||||
|
|
||||||
```
|
|
||||||
1. ? Compila progetto in Release mode
|
|
||||||
2. ? Build immagine Docker (tradingbot:latest)
|
|
||||||
3. ? Post-build MSBuild target (AUTOMATICO):
|
|
||||||
- Verifica condizioni (Release + Docker profile)
|
|
||||||
- Tag gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
|
||||||
- Tag gitea.encke-hake.ts.net/alby96/encelado/tradingbot:1.0.0
|
|
||||||
- Push entrambi i tag su Gitea Registry
|
|
||||||
4. ? Mostra conferma nell'Output Window
|
|
||||||
```
|
|
||||||
|
|
||||||
?? **Tempo**: 3-5 minuti (prima volta), 1-2 minuti (successive)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Verifica Output
|
|
||||||
|
|
||||||
### Output Window
|
|
||||||
|
|
||||||
Durante il publish, monitora l'**Output Window**:
|
|
||||||
|
|
||||||
```
|
|
||||||
View ? Output (Ctrl+Alt+O)
|
|
||||||
Dropdown: "Build"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Dovresti vedere**:
|
|
||||||
|
|
||||||
```
|
|
||||||
========== Build started ==========
|
|
||||||
1> Building Docker image...
|
|
||||||
...
|
|
||||||
1> Successfully built abc123def456
|
|
||||||
1> Successfully tagged tradingbot:latest
|
|
||||||
|
|
||||||
========================================
|
|
||||||
?? Gitea Container Registry Push
|
|
||||||
========================================
|
|
||||||
|
|
||||||
??? Tagging images...
|
|
||||||
? Tagged successfully
|
|
||||||
|
|
||||||
?? Pushing to gitea.encke-hake.ts.net...
|
|
||||||
The push refers to repository [gitea.encke-hake.ts.net/alby96/encelado/tradingbot]
|
|
||||||
latest: digest: sha256:... size: 1234
|
|
||||||
|
|
||||||
========================================
|
|
||||||
? Successfully pushed to Gitea Registry!
|
|
||||||
========================================
|
|
||||||
|
|
||||||
?? Published images:
|
|
||||||
- gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
|
||||||
- gitea.encke-hake.ts.net/alby96/encelado/tradingbot:1.0.0
|
|
||||||
|
|
||||||
?? Verify at:
|
|
||||||
https://gitea.encke-hake.ts.net/Alby96/Encelado/-/packages
|
|
||||||
|
|
||||||
========== Publish: 1 succeeded ==========
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Verifica su Gitea
|
|
||||||
|
|
||||||
Dopo il publish, apri browser:
|
|
||||||
|
|
||||||
```
|
|
||||||
https://gitea.encke-hake.ts.net/Alby96/Encelado/-/packages
|
|
||||||
```
|
|
||||||
|
|
||||||
Dovresti vedere:
|
|
||||||
|
|
||||||
```
|
|
||||||
?? tradingbot
|
|
||||||
??? latest (280 MB)
|
|
||||||
? ??? Pushed 2 minutes ago
|
|
||||||
??? 1.0.0 (280 MB)
|
|
||||||
??? Pushed 2 minutes ago
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Aggiornamento Versione
|
|
||||||
|
|
||||||
### Incrementa Versione
|
|
||||||
|
|
||||||
Modifica `TradingBot.csproj`:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<PropertyGroup>
|
|
||||||
<Version>1.0.1</Version> <!-- Incrementa qui -->
|
|
||||||
<AssemblyVersion>1.0.1.0</AssemblyVersion>
|
|
||||||
<FileVersion>1.0.1.0</FileVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Publish Nuova Versione
|
|
||||||
|
|
||||||
Esegui di nuovo il workflow di publish. Verranno creati:
|
|
||||||
- `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest` (aggiornato)
|
|
||||||
- `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:1.0.1` (nuovo)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Come Funziona (Dettagli Tecnici)
|
|
||||||
|
|
||||||
### Post-Build MSBuild Target
|
|
||||||
|
|
||||||
Il file `TradingBot.csproj` contiene un target MSBuild che si attiva automaticamente:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<Target Name="PushToGiteaRegistry"
|
|
||||||
AfterTargets="Publish"
|
|
||||||
Condition="'$(Configuration)' == 'Release' And
|
|
||||||
'$(DOTNET_RUNNING_IN_CONTAINER)' != 'true' And
|
|
||||||
'$(DockerPublish)' == 'true'">
|
|
||||||
<!-- Tag e push automatici -->
|
|
||||||
</Target>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Condizioni di attivazione**:
|
|
||||||
1. ? Configuration = **Release**
|
|
||||||
2. ? Non siamo dentro un container Docker
|
|
||||||
3. ? Profilo Docker in uso (`DockerPublish='true'`)
|
|
||||||
|
|
||||||
**Cosa fa**:
|
|
||||||
1. Tag immagine locale `tradingbot:latest`
|
|
||||||
2. Tag con `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest`
|
|
||||||
3. Tag con `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:{Version}`
|
|
||||||
4. Push entrambi i tag su Gitea Registry
|
|
||||||
5. Mostra messaggi nell'Output Window
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Troubleshooting
|
|
||||||
|
|
||||||
### Errore: "docker: command not found"
|
|
||||||
|
|
||||||
**Causa**: Docker non in PATH o non installato
|
|
||||||
|
|
||||||
**Fix**:
|
|
||||||
1. Verifica Docker Desktop sia installato e running
|
|
||||||
2. Restart Visual Studio
|
|
||||||
3. Verifica in PowerShell: `docker --version`
|
|
||||||
|
|
||||||
### Errore: "unauthorized: authentication required"
|
|
||||||
|
|
||||||
**Causa**: Non loggato a Gitea Registry
|
|
||||||
|
|
||||||
**Fix**:
|
|
||||||
```powershell
|
|
||||||
docker logout gitea.encke-hake.ts.net
|
|
||||||
docker login gitea.encke-hake.ts.net
|
|
||||||
# Inserisci credenziali
|
|
||||||
```
|
|
||||||
|
|
||||||
### Errore: "denied: requested access to the resource is denied"
|
|
||||||
|
|
||||||
**Causa**: Permessi insufficienti o repository non esiste
|
|
||||||
|
|
||||||
**Fix**:
|
|
||||||
1. Verifica che il repository packages esista su Gitea
|
|
||||||
2. Verifica che il token abbia scope `write:packages`
|
|
||||||
3. Verifica username corretto nel `.csproj` (`ContainerRepository`)
|
|
||||||
|
|
||||||
### Post-Build Non Si Attiva
|
|
||||||
|
|
||||||
**Causa**: Condizioni non soddisfatte
|
|
||||||
|
|
||||||
**Fix - Verifica**:
|
|
||||||
1. ? **Configuration Manager** ? **Release** attivo
|
|
||||||
2. ? Profilo **"Docker"** selezionato (non altri profili)
|
|
||||||
3. ? Docker Desktop running
|
|
||||||
4. ? `docker login` eseguito
|
|
||||||
|
|
||||||
**Diagnosi**:
|
|
||||||
```powershell
|
|
||||||
# Verifica immagine locale esista dopo publish
|
|
||||||
docker images | findstr tradingbot
|
|
||||||
|
|
||||||
# Dovresti vedere: tradingbot latest ...
|
|
||||||
```
|
|
||||||
|
|
||||||
Se l'immagine locale esiste ma il push non parte:
|
|
||||||
- Controlla Output Window per messaggi di errore
|
|
||||||
- Verifica che `DockerPublish='true'` sia nel profilo Docker.pubxml
|
|
||||||
|
|
||||||
### Errore: "La ricompilazione non è riuscita"
|
|
||||||
|
|
||||||
**Causa**: Errore durante build o post-build
|
|
||||||
|
|
||||||
**Fix**:
|
|
||||||
1. **View** ? **Output** ? Dropdown: **Build**
|
|
||||||
2. Cerca errori specifici (linea rossa)
|
|
||||||
3. Se errore docker: verifica Docker Desktop running
|
|
||||||
4. Se errore MSBuild: verifica sintassi `.csproj`
|
|
||||||
|
|
||||||
**Clean & Rebuild**:
|
|
||||||
```
|
|
||||||
Build ? Clean Solution
|
|
||||||
Build ? Rebuild Solution
|
|
||||||
Build ? Publish (retry)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Checklist Publish
|
|
||||||
|
|
||||||
### Pre-Publish
|
|
||||||
- [ ] Docker Desktop running
|
|
||||||
- [ ] `docker login gitea.encke-hake.ts.net` successful
|
|
||||||
- [ ] Configuration Manager ? Release
|
|
||||||
- [ ] Codice committato su Git (opzionale ma consigliato)
|
|
||||||
|
|
||||||
### During Publish
|
|
||||||
- [ ] Visual Studio ? Build ? Publish
|
|
||||||
- [ ] Profilo "Docker" selezionato
|
|
||||||
- [ ] Build completa senza errori
|
|
||||||
- [ ] Output mostra "Successfully pushed to Gitea Registry!"
|
|
||||||
|
|
||||||
### Post-Publish
|
|
||||||
- [ ] Verifica su Gitea Packages
|
|
||||||
- [ ] Tag `latest` e versione presenti
|
|
||||||
- [ ] (Opzionale) Deploy su Unraid
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Best Practices
|
|
||||||
|
|
||||||
### Versioning
|
|
||||||
|
|
||||||
Usa [Semantic Versioning](https://semver.org/):
|
|
||||||
- **MAJOR**: Breaking changes (2.0.0)
|
|
||||||
- **MINOR**: New features (1.1.0)
|
|
||||||
- **PATCH**: Bug fixes (1.0.1)
|
|
||||||
|
|
||||||
### Git Workflow
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Sviluppo feature
|
|
||||||
git checkout -b feature/new-feature
|
|
||||||
|
|
||||||
# 2. Commit changes
|
|
||||||
git add .
|
|
||||||
git commit -m "feat: Add new feature"
|
|
||||||
|
|
||||||
# 3. Merge in main
|
|
||||||
git checkout main
|
|
||||||
git merge feature/new-feature
|
|
||||||
|
|
||||||
# 4. Tag release
|
|
||||||
git tag -a v1.0.1 -m "Release 1.0.1"
|
|
||||||
git push origin main --tags
|
|
||||||
|
|
||||||
# 5. Publish Docker image (Visual Studio)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
Prima di ogni publish:
|
|
||||||
1. Test locale (F5 in Debug)
|
|
||||||
2. Test in Docker locale (profilo Docker, F5)
|
|
||||||
3. Verifica funzionalità critiche
|
|
||||||
4. Publish su Gitea (Release mode)
|
|
||||||
5. Deploy su Unraid per test finale
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Workflow Completo: Dev ? Production
|
|
||||||
|
|
||||||
```
|
|
||||||
1. ?? Sviluppo in Visual Studio
|
|
||||||
?? F5 per test locale (HTTP profile)
|
|
||||||
?? F5 con Docker profile per test container
|
|
||||||
?? Commit su Git
|
|
||||||
|
|
||||||
2. ?? Build & Publish
|
|
||||||
?? Configuration ? Release
|
|
||||||
?? Build ? Publish (Docker profile)
|
|
||||||
?? MSBuild automatico: tag & push Gitea ?
|
|
||||||
|
|
||||||
3. ?? Verifica Gitea Packages
|
|
||||||
?? Browser: packages disponibili
|
|
||||||
|
|
||||||
4. ?? Deploy su Unraid
|
|
||||||
?? Docker tab ? Stop
|
|
||||||
?? Force Update (pull latest)
|
|
||||||
?? Start
|
|
||||||
|
|
||||||
5. ? Test in Production
|
|
||||||
?? http://192.168.30.23:8080
|
|
||||||
```
|
|
||||||
|
|
||||||
**Tempo totale**: ~10 minuti (compresi test)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Risorse
|
|
||||||
|
|
||||||
### File di Configurazione
|
|
||||||
|
|
||||||
- **`TradingBot.csproj`**: Contiene il post-build target `PushToGiteaRegistry`
|
|
||||||
- **`Properties/PublishProfiles/Docker.pubxml`**: Profilo publish Docker
|
|
||||||
- **`Dockerfile`**: Multi-stage build configuration
|
|
||||||
|
|
||||||
### Links Utili
|
|
||||||
|
|
||||||
- [MSBuild Targets](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets)
|
|
||||||
- [Docker CLI Reference](https://docs.docker.com/engine/reference/commandline/cli/)
|
|
||||||
- [Gitea Packages](https://docs.gitea.com/usage/packages/container)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Tips & Tricks
|
|
||||||
|
|
||||||
### Debug Post-Build Target
|
|
||||||
|
|
||||||
Per vedere cosa sta facendo il post-build:
|
|
||||||
|
|
||||||
1. **Output Window** ? Dropdown: **Build**
|
|
||||||
2. Cerca sezione:
|
|
||||||
```
|
|
||||||
========================================
|
|
||||||
?? Gitea Container Registry Push
|
|
||||||
========================================
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build Solo Docker (Senza Push)
|
|
||||||
|
|
||||||
Se vuoi solo buildare l'immagine senza push:
|
|
||||||
|
|
||||||
**Opzione 1**: Usa Debug mode
|
|
||||||
```
|
|
||||||
Configuration Manager ? Debug
|
|
||||||
Build ? Publish (Docker)
|
|
||||||
# Post-build NON si attiva (serve Release)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Opzione 2**: Build manuale
|
|
||||||
```powershell
|
|
||||||
docker build -t tradingbot:latest .
|
|
||||||
# Crea solo immagine locale
|
|
||||||
```
|
|
||||||
|
|
||||||
### Push Manuale (Se Serve)
|
|
||||||
|
|
||||||
Se hai già l'immagine locale e vuoi solo push:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
docker tag tradingbot:latest gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
|
||||||
docker push gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**?? Publish integrato completamente in Visual Studio!**
|
|
||||||
|
|
||||||
**Zero script esterni, tutto automatico con MSBuild!** ?
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
# ?? Deployment Resources
|
|
||||||
|
|
||||||
Questa cartella contiene tutti i file e le guide necessarie per il deployment di TradingBot.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Contenuto
|
|
||||||
|
|
||||||
### ?? Guide
|
|
||||||
|
|
||||||
- **[PUBLISHING_GUIDE.md](PUBLISHING_GUIDE.md)** - Guida completa per pubblicare su Gitea Registry da Visual Studio
|
|
||||||
- **[UNRAID_INSTALL.md](UNRAID_INSTALL.md)** - Installazione nativa su Unraid senza Portainer
|
|
||||||
|
|
||||||
### ?? Docker Files
|
|
||||||
|
|
||||||
- **[docker-compose.yml](docker-compose.yml)** - Configurazione Docker Compose per deploy rapido
|
|
||||||
- **[unraid-template.xml](unraid-template.xml)** - Template XML per installazione 1-click su Unraid
|
|
||||||
|
|
||||||
### ?? Dockerfile
|
|
||||||
|
|
||||||
Il `Dockerfile` principale si trova nella **root del progetto** per compatibilità con Visual Studio Container Tools.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Quick Start
|
|
||||||
|
|
||||||
### Publish da Visual Studio
|
|
||||||
|
|
||||||
```
|
|
||||||
1. Build ? Configuration Manager ? Release
|
|
||||||
2. Build ? Publish TradingBot
|
|
||||||
3. Seleziona profilo "Docker"
|
|
||||||
4. Click "Publish"
|
|
||||||
5. ? Automatico: Build + Push su Gitea Registry
|
|
||||||
```
|
|
||||||
|
|
||||||
**Guida dettagliata**: [PUBLISHING_GUIDE.md](PUBLISHING_GUIDE.md)
|
|
||||||
|
|
||||||
### Deploy su Unraid
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Login Gitea Registry
|
|
||||||
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 Docker tab
|
|
||||||
```
|
|
||||||
|
|
||||||
**Guida dettagliata**: [UNRAID_INSTALL.md](UNRAID_INSTALL.md)
|
|
||||||
|
|
||||||
### Deploy con Docker Compose
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Clone repository
|
|
||||||
git clone https://gitea.encke-hake.ts.net/Alby96/Encelado
|
|
||||||
cd Encelado/TradingBot/deployment
|
|
||||||
|
|
||||||
# Deploy
|
|
||||||
docker-compose up -d
|
|
||||||
|
|
||||||
# Accedi: http://localhost:8080
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Workflow Consigliato
|
|
||||||
|
|
||||||
```
|
|
||||||
Sviluppo (PC) Publish Deploy (Unraid)
|
|
||||||
????????????? ??????? ???????????????
|
|
||||||
|
|
||||||
Visual Studio ? Gitea Registry ? Unraid Docker
|
|
||||||
- Codice - Container - Pull image
|
|
||||||
- Test F5 - Versioning - Start
|
|
||||||
- Commit - Latest + v1.0.0 - WebUI ready
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Gestione Versioni
|
|
||||||
|
|
||||||
### File di Configurazione
|
|
||||||
|
|
||||||
La versione è definita in `TradingBot.csproj`:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<PropertyGroup>
|
|
||||||
<Version>1.0.0</Version>
|
|
||||||
</PropertyGroup>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tag Generati Automaticamente
|
|
||||||
|
|
||||||
Ogni publish crea 2 tag:
|
|
||||||
- `latest` - Sempre ultima versione
|
|
||||||
- `1.0.0` - Versione specifica
|
|
||||||
|
|
||||||
### Rollback
|
|
||||||
|
|
||||||
Per tornare a una versione precedente:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Su Unraid
|
|
||||||
docker pull gitea.encke-hake.ts.net/alby96/encelado/tradingbot:1.0.0
|
|
||||||
docker stop TradingBot
|
|
||||||
docker rm TradingBot
|
|
||||||
# Ricrea container con versione specifica
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Registry Access
|
|
||||||
|
|
||||||
### Gitea Container Registry
|
|
||||||
|
|
||||||
- **URL**: `gitea.encke-hake.ts.net`
|
|
||||||
- **Repository**: `alby96/encelado/tradingbot`
|
|
||||||
- **Auth**: Personal Access Token con scope `write:packages`
|
|
||||||
|
|
||||||
### Login
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker login gitea.encke-hake.ts.net
|
|
||||||
# Username: Alby96
|
|
||||||
# Password: [token]
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Risorse Aggiuntive
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
|
|
||||||
- [Dockerfile](../Dockerfile) - Multi-stage build configuration
|
|
||||||
- [README.md](../README.md) - Documentazione principale progetto
|
|
||||||
- [.dockerignore](../.dockerignore) - File esclusi dal build context
|
|
||||||
|
|
||||||
### Repository
|
|
||||||
|
|
||||||
- **Git**: `https://gitea.encke-hake.ts.net/Alby96/Encelado`
|
|
||||||
- **Packages**: `https://gitea.encke-hake.ts.net/Alby96/Encelado/-/packages`
|
|
||||||
- **Issues**: `https://gitea.encke-hake.ts.net/Alby96/Encelado/issues`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ? Checklist Deployment
|
|
||||||
|
|
||||||
### Setup Iniziale
|
|
||||||
- [ ] Docker Desktop installato e running
|
|
||||||
- [ ] Login Gitea Registry successful
|
|
||||||
- [ ] Unraid Docker service attivo (se deploy su Unraid)
|
|
||||||
|
|
||||||
### Ogni Deploy
|
|
||||||
- [ ] Codice committato su Git
|
|
||||||
- [ ] Versione incrementata (se necessario)
|
|
||||||
- [ ] Publish da Visual Studio successful
|
|
||||||
- [ ] Verifica packages su Gitea
|
|
||||||
- [ ] Pull & deploy su target environment
|
|
||||||
- [ ] Test funzionalità in production
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**?? Deployment semplificato e automatizzato!**
|
|
||||||
|
|
||||||
**No script esterni, tutto integrato in Visual Studio e MSBuild!** ?
|
|
||||||
@@ -53,17 +53,19 @@ wget -O /boot/config/plugins/dockerMan/templates-user/TradingBot.xml \
|
|||||||
- **Name**: `TradingBot` (già impostato)
|
- **Name**: `TradingBot` (già impostato)
|
||||||
- **Repository**: `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest` (già impostato)
|
- **Repository**: `gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest` (già impostato)
|
||||||
|
|
||||||
**Porta WebUI** (Importante!):
|
**Porta WebUI** (Visibile e Configurabile!):
|
||||||
- **WebUI Port**: `8080` (cambia se occupata, es. `8081`, `9000`, etc.)
|
- **WebUI HTTP Port**: `8888` (porta default - cambia se occupata)
|
||||||
- Questa è la porta per accedere all'interfaccia web
|
- 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**:
|
**Volume Dati**:
|
||||||
- **AppData**: `/mnt/user/appdata/tradingbot` (già impostato)
|
- **AppData**: `/mnt/user/appdata/tradingbot` (già impostato)
|
||||||
- Puoi cambiare se preferisci altra directory
|
- Puoi cambiare se preferisci altra directory
|
||||||
|
|
||||||
**Variabili Ambiente** (Avanzate - opzionali):
|
**Variabili Ambiente** (Avanzate - espandi se necessario):
|
||||||
- **ASPNETCORE_ENVIRONMENT**: `Production` (non modificare)
|
- **ASPNETCORE_ENVIRONMENT**: `Production` (non modificare)
|
||||||
- **ASPNETCORE_URLS**: `http://+:8080` (non modificare)
|
- **ASPNETCORE_URLS**: `http://+:8080` (non modificare - porta interna container)
|
||||||
- **TZ**: `Europe/Rome` (cambia per altro timezone)
|
- **TZ**: `Europe/Rome` (cambia per altro timezone)
|
||||||
|
|
||||||
5. Click **Apply**
|
5. Click **Apply**
|
||||||
@@ -71,25 +73,27 @@ wget -O /boot/config/plugins/dockerMan/templates-user/TradingBot.xml \
|
|||||||
Unraid farà:
|
Unraid farà:
|
||||||
- ? Pull immagine da Gitea Registry
|
- ? Pull immagine da Gitea Registry
|
||||||
- ? Crea container con nome "TradingBot"
|
- ? Crea container con nome "TradingBot"
|
||||||
- ? Configura porta WebUI (default 8080)
|
- ? Configura porta WebUI (default 8888 ? host, 8080 ? container)
|
||||||
- ? Crea volume per persistenza dati
|
- ? Crea volume per persistenza dati
|
||||||
- ? Start automatico
|
- ? Start automatico
|
||||||
|
|
||||||
### Step 3: Accedi WebUI
|
### Step 3: Accedi WebUI
|
||||||
|
|
||||||
**Metodo A: Click su WebUI Icon**
|
**Metodo A: Click su WebUI Icon** ??
|
||||||
|
|
||||||
1. **Docker tab** ? Trova container **TradingBot**
|
1. **Docker tab** ? Trova container **TradingBot**
|
||||||
2. Nella colonna "WebUI", click sull'**icona globe** ??
|
2. Nella riga del container, a destra, vedrai l'**icona globe** ??
|
||||||
3. Si aprirà la dashboard nel browser
|
3. Click sull'icona ? Si apre automaticamente `http://192.168.30.23:8888`
|
||||||
|
|
||||||
**Metodo B: URL Manuale**
|
**Metodo B: URL Manuale**
|
||||||
|
|
||||||
```
|
```
|
||||||
http://192.168.30.23:8080
|
http://192.168.30.23:8888
|
||||||
```
|
```
|
||||||
|
|
||||||
(Sostituisci `8080` con la porta che hai configurato)
|
(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**! ??
|
Dovresti vedere la **Dashboard TradingBot**! ??
|
||||||
|
|
||||||
@@ -215,413 +219,90 @@ Schedula: Settimanale o manualmente quando serve.
|
|||||||
|
|
||||||
### Cambiare Porta WebUI
|
### Cambiare Porta WebUI
|
||||||
|
|
||||||
Se la porta `8080` è già occupata o vuoi usarne un'altra:
|
La porta **default è 8888** (host) ? **8080** (container).
|
||||||
|
|
||||||
|
Se la porta 8888 è occupata o vuoi usarne un'altra:
|
||||||
|
|
||||||
#### **Via Template (Prima Installazione)**
|
#### **Via Template (Prima Installazione)**
|
||||||
|
|
||||||
Durante Step 2 dell'installazione:
|
Durante Step 2 dell'installazione:
|
||||||
- **WebUI Port**: Cambia da `8080` a porta desiderata (es. `8081`, `9000`, `8888`)
|
- **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)**
|
#### **Via Edit (Container Esistente)**
|
||||||
|
|
||||||
1. **Docker tab** ? Container **TradingBot**
|
1. **Docker tab** ? Container **TradingBot**
|
||||||
2. Click **Edit** (icona matita)
|
2. Click **Edit** (icona matita/wrench)
|
||||||
3. Trova sezione **Port Mappings**
|
3. Trova sezione **Port Mappings**
|
||||||
4. Modifica **Host Port** (es. da `8080` a `8081`)
|
4. Vedrai: **Host Port** `8888` ? **Container Port** `8080`
|
||||||
5. **IMPORTANTE**: Non modificare **Container Port** (deve restare `8080`)
|
5. Modifica **Host Port** (es. da `8888` a `8881`)
|
||||||
6. Click **Apply**
|
6. **IMPORTANTE**: NON modificare **Container Port** (deve restare `8080`)
|
||||||
7. Container si riavvierà automaticamente
|
7. Click **Apply** in fondo
|
||||||
|
8. Container si riavvierà automaticamente
|
||||||
|
|
||||||
#### **Accesso con Nuova Porta**
|
#### **Accesso con Nuova Porta**
|
||||||
|
|
||||||
```
|
```
|
||||||
http://192.168.30.23:NUOVA_PORTA
|
http://192.168.30.23:NUOVA_PORTA_HOST
|
||||||
```
|
```
|
||||||
|
|
||||||
Esempio con porta `8081`:
|
Esempio con porta `8881`:
|
||||||
```
|
```
|
||||||
http://192.168.30.23:8081
|
http://192.168.30.23:8881
|
||||||
```
|
```
|
||||||
|
|
||||||
### Porte Comuni Disponibili
|
### Porte Comuni Disponibili
|
||||||
|
|
||||||
Se `8080` è occupata, prova queste:
|
Se `8888` è occupata, prova queste alternative:
|
||||||
- `8081` - Spesso libera
|
|
||||||
- `9000` - Usata da Portainer ma se non hai Portainer è libera
|
| Porta | Uso Comune | Probabilità Libera |
|
||||||
- `8888` - Buona alternativa
|
|-------|------------|-------------------|
|
||||||
- `7070` - Altra opzione
|
| `8881` | Alternative port | ????? Alta |
|
||||||
- `3000` - Se libera
|
| `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**:
|
**Check porta disponibile**:
|
||||||
```bash
|
```bash
|
||||||
netstat -tulpn | grep :8080
|
# Su Unraid via SSH
|
||||||
# Se restituisce risultato, porta occupata
|
netstat -tulpn | grep :8888
|
||||||
# Se vuoto, porta libera
|
# Se restituisce risultato ? porta occupata
|
||||||
|
# Se vuoto ? porta libera ?
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
### Differenza HOST vs CONTAINER Port
|
||||||
|
|
||||||
## ?? GESTIONE CONTAINER
|
?? **IMPORTANTE da capire**:
|
||||||
|
|
||||||
### Start/Stop/Restart
|
|
||||||
|
|
||||||
**Docker tab** ? Container **TradingBot**:
|
|
||||||
- ?? **Start**: Avvia container
|
|
||||||
- ?? **Pause**: Pausa (mantiene in memoria)
|
|
||||||
- ?? **Stop**: Ferma completamente
|
|
||||||
- ?? **Restart**: Riavvia
|
|
||||||
- ??? **Remove**: Elimina container (dati persistenti restano)
|
|
||||||
|
|
||||||
### View Logs
|
|
||||||
|
|
||||||
**Docker tab** ? Container **TradingBot** ? Click **icona logs** (terminale)
|
|
||||||
|
|
||||||
Oppure via SSH:
|
|
||||||
```bash
|
|
||||||
docker logs TradingBot -f
|
|
||||||
# -f = follow (real-time)
|
|
||||||
# Ctrl+C per uscire
|
|
||||||
```
|
|
||||||
|
|
||||||
### Console Access
|
|
||||||
|
|
||||||
**Docker tab** ? Container **TradingBot** ? Click **icona console** (bash)
|
|
||||||
|
|
||||||
Oppure via SSH:
|
|
||||||
```bash
|
|
||||||
docker exec -it TradingBot sh
|
|
||||||
# sh invece di bash (Alpine Linux base)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Statistics
|
|
||||||
|
|
||||||
**Docker tab** ? Container **TradingBot** ? Click **icona stats** (grafico)
|
|
||||||
|
|
||||||
Mostra:
|
|
||||||
- **CPU**: Utilizzo percentuale
|
|
||||||
- **Memory**: RAM utilizzata/disponibile
|
|
||||||
- **Network I/O**: Traffico in/out
|
|
||||||
- **Block I/O**: Lettura/scrittura disco
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? ACCESSO WEBUI
|
|
||||||
|
|
||||||
### Locale (Unraid LAN)
|
|
||||||
|
|
||||||
```
|
```
|
||||||
http://192.168.30.23:8080
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
Sostituisci:
|
**Esempio configurazione corretta**:
|
||||||
- `192.168.30.23` con IP del tuo Unraid
|
|
||||||
- `8080` con porta configurata
|
|
||||||
|
|
||||||
### Via Tailscale
|
|
||||||
|
|
||||||
Se hai configurato Tailscale su Unraid:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
http://unraid.encke-hake.ts.net:8080
|
Browser: http://192.168.30.23:8888
|
||||||
|
?? Usa porta HOST
|
||||||
|
|
||||||
|
Docker: 8888 (host) ? 8080 (container)
|
||||||
|
?? Mapping ?? App interna
|
||||||
```
|
```
|
||||||
|
|
||||||
### Via Hostname Unraid
|
**Cosa NON fare**:
|
||||||
|
- ? Cambiare porta Container da 8080 a altro
|
||||||
Se hai configurato hostname:
|
- ? Modificare `ASPNETCORE_URLS` (deve restare `http://+:8080`)
|
||||||
|
- ? Usare porta Host 8080 (conflitto con container)
|
||||||
```
|
|
||||||
http://tower:8080
|
**Cosa puoi fare**:
|
||||||
```
|
- ? Cambiare porta Host da 8888 a qualsiasi altra libera
|
||||||
|
- ? Usare porta Host diversa per ogni app
|
||||||
(Sostituisci `tower` con hostname del tuo Unraid)
|
- ? Accedere con `http://IP:PORTA_HOST`
|
||||||
|
|
||||||
### Reverse Proxy (Accesso HTTPS)
|
|
||||||
|
|
||||||
Se usi **Nginx Proxy Manager** o **Swag**:
|
|
||||||
|
|
||||||
```nginx
|
|
||||||
# Nginx Proxy Manager
|
|
||||||
Upstream: http://192.168.30.23:8080
|
|
||||||
Domain: tradingbot.tuo-dominio.com
|
|
||||||
SSL: Let's Encrypt
|
|
||||||
```
|
|
||||||
|
|
||||||
Poi accedi via:
|
|
||||||
```
|
|
||||||
https://tradingbot.tuo-dominio.com
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? 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)
|
|
||||||
? **Health checks** attivi per monitoring
|
|
||||||
|
|
||||||
### Backup Dati
|
|
||||||
|
|
||||||
#### **Manuale**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Backup
|
|
||||||
tar -czf /mnt/user/backups/tradingbot-$(date +%Y%m%d).tar.gz \
|
|
||||||
/mnt/user/appdata/tradingbot
|
|
||||||
|
|
||||||
# Restore
|
|
||||||
tar -xzf /mnt/user/backups/tradingbot-20241217.tar.gz -C /mnt/user/appdata/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### **Con CA Backup Plugin**
|
|
||||||
|
|
||||||
1. **Apps** ? Installa "**CA Backup / Restore Appdata**"
|
|
||||||
2. **Settings** ? **CA Backup/Restore**
|
|
||||||
3. Aggiungi `/mnt/user/appdata/tradingbot` alla lista
|
|
||||||
4. Configura schedule automatico (es. giornaliero alle 2:00 AM)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? TROUBLESHOOTING
|
|
||||||
|
|
||||||
### WebUI Non Accessibile
|
|
||||||
|
|
||||||
**Checklist Diagnostica**:
|
|
||||||
|
|
||||||
1. ? **Container Running?**
|
|
||||||
```bash
|
|
||||||
docker ps | grep TradingBot
|
|
||||||
# Deve mostrare: Up X minutes (healthy)
|
|
||||||
```
|
|
||||||
|
|
||||||
2. ? **Porta Corretta?**
|
|
||||||
```bash
|
|
||||||
docker port TradingBot
|
|
||||||
# Output: 8080/tcp -> 0.0.0.0:8080
|
|
||||||
```
|
|
||||||
|
|
||||||
3. ? **Health Check?**
|
|
||||||
```bash
|
|
||||||
docker inspect TradingBot | grep -A5 Health
|
|
||||||
# Status deve essere "healthy"
|
|
||||||
```
|
|
||||||
|
|
||||||
4. ? **Test Locale**:
|
|
||||||
```bash
|
|
||||||
curl http://localhost:8080/
|
|
||||||
# Deve restituire HTML
|
|
||||||
```
|
|
||||||
|
|
||||||
5. ? **Check Logs**:
|
|
||||||
```bash
|
|
||||||
docker logs TradingBot --tail 50
|
|
||||||
# Cerca errori
|
|
||||||
```
|
|
||||||
|
|
||||||
**Soluzioni Comuni**:
|
|
||||||
|
|
||||||
#### Errore: "Cannot access WebUI"
|
|
||||||
|
|
||||||
**Causa**: Porta host occupata o container non started
|
|
||||||
|
|
||||||
**Fix**:
|
|
||||||
```bash
|
|
||||||
# 1. Verifica porta libera
|
|
||||||
netstat -tulpn | grep :8080
|
|
||||||
|
|
||||||
# 2. Se occupata, edit container e cambia porta
|
|
||||||
# Docker tab ? Edit ? Port 8080 ? 8081 ? Apply
|
|
||||||
|
|
||||||
# 3. Restart container
|
|
||||||
docker restart TradingBot
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Errore: "Connection refused"
|
|
||||||
|
|
||||||
**Causa**: Container started ma app non ready
|
|
||||||
|
|
||||||
**Fix**:
|
|
||||||
```bash
|
|
||||||
# Attendi 40 secondi (start period)
|
|
||||||
sleep 40
|
|
||||||
|
|
||||||
# Poi testa
|
|
||||||
curl http://192.168.30.23:8080/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Errore: "Unhealthy" status
|
|
||||||
|
|
||||||
**Causa**: Health check fallisce
|
|
||||||
|
|
||||||
**Fix**:
|
|
||||||
```bash
|
|
||||||
# Check logs per errori app
|
|
||||||
docker logs TradingBot
|
|
||||||
|
|
||||||
# Possibili cause:
|
|
||||||
# - Porta interna sbagliata in ASPNETCORE_URLS
|
|
||||||
# - App crashed al startup
|
|
||||||
# - Manca volume /app/data
|
|
||||||
|
|
||||||
# Ricrea container:
|
|
||||||
docker stop TradingBot
|
|
||||||
docker rm TradingBot
|
|
||||||
# Reinstalla da template
|
|
||||||
```
|
|
||||||
|
|
||||||
### Container Non Si Avvia
|
|
||||||
|
|
||||||
**Check logs**:
|
|
||||||
```bash
|
|
||||||
docker logs TradingBot
|
|
||||||
```
|
|
||||||
|
|
||||||
**Problemi comuni**:
|
|
||||||
|
|
||||||
#### Porta occupata
|
|
||||||
```
|
|
||||||
Error: address already in use
|
|
||||||
```
|
|
||||||
**Fix**: Cambia **Host Port** in configurazione container (Edit ? Port Mappings)
|
|
||||||
|
|
||||||
#### Pull failed
|
|
||||||
```
|
|
||||||
Error: unauthorized: authentication required
|
|
||||||
```
|
|
||||||
**Fix**:
|
|
||||||
```bash
|
|
||||||
docker login gitea.encke-hake.ts.net
|
|
||||||
# Inserisci credenziali
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Image not found
|
|
||||||
```
|
|
||||||
Error: manifest not found
|
|
||||||
```
|
|
||||||
**Fix**: Verifica immagine esista su Gitea Packages:
|
|
||||||
```
|
|
||||||
https://gitea.encke-hake.ts.net/Alby96/Encelado/-/packages
|
|
||||||
```
|
|
||||||
|
|
||||||
### Performance Issues
|
|
||||||
|
|
||||||
**Check risorse**:
|
|
||||||
```bash
|
|
||||||
docker stats TradingBot
|
|
||||||
```
|
|
||||||
|
|
||||||
**Limiti raccomandati**:
|
|
||||||
- **CPU**: 1-2 cores
|
|
||||||
- **Memory**: 512MB - 1GB
|
|
||||||
|
|
||||||
**Configura limiti** (Edit ? Extra Parameters):
|
|
||||||
```
|
|
||||||
--cpus="1.5" --memory="768m"
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? CHECKLIST INSTALLAZIONE
|
|
||||||
|
|
||||||
### Pre-Install
|
|
||||||
- [ ] Unraid 6.10+ installato
|
|
||||||
- [ ] Docker service attivo
|
|
||||||
- [ ] Porta 8080 (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
|
|
||||||
- [ ] Volume AppData creato
|
|
||||||
- [ ] Container status: **running**
|
|
||||||
|
|
||||||
### Post-Install
|
|
||||||
- [ ] Health check: **healthy** (dopo 40 sec)
|
|
||||||
- [ ] WebUI accessibile (http://IP:PORT)
|
|
||||||
- [ ] Dashboard carica correttamente
|
|
||||||
- [ ] Settings modificabili e salvabili
|
|
||||||
- [ ] Bot avviabile dalla UI
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? 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)
|
|
||||||
? **Health monitoring** integrato
|
|
||||||
? **Logs accessibili** dalla UI
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? WORKFLOW COMPLETO
|
|
||||||
|
|
||||||
### Sviluppo (PC)
|
|
||||||
```
|
|
||||||
1. ?? Visual Studio ? Codice
|
|
||||||
2. ?? Build ? Publish (Docker profile)
|
|
||||||
3. ? Automatico: Push Gitea Registry
|
|
||||||
4. ?? git push origin main
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deploy (Unraid)
|
|
||||||
```
|
|
||||||
1. ?? Docker tab ? TradingBot
|
|
||||||
2. ?? Stop
|
|
||||||
3. ?? Force Update (pull latest)
|
|
||||||
4. ?? Start
|
|
||||||
5. ? Done! (~ 1 minuto)
|
|
||||||
```
|
|
||||||
|
|
||||||
**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
|
|
||||||
|
|
||||||
# Health check
|
|
||||||
docker inspect TradingBot --format='{{.State.Health.Status}}'
|
|
||||||
|
|
||||||
# Restart
|
|
||||||
docker restart TradingBot
|
|
||||||
|
|
||||||
# Update
|
|
||||||
docker pull gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
|
|
||||||
|
|
||||||
# Remove (mantiene dati)
|
|
||||||
docker rm -f TradingBot
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -640,8 +321,73 @@ wget -O /boot/config/plugins/dockerMan/templates-user/TradingBot.xml \
|
|||||||
# 3. Install via UI
|
# 3. Install via UI
|
||||||
# Docker tab ? Add Container ? TradingBot template ? Apply
|
# Docker tab ? Add Container ? TradingBot template ? Apply
|
||||||
|
|
||||||
# 4. Access
|
# 4. Access WebUI
|
||||||
# Click WebUI icon or http://192.168.30.23:8080
|
# Metodo A: Click icona ?? nella Docker tab
|
||||||
|
# Metodo B: http://192.168.30.23:8888
|
||||||
```
|
```
|
||||||
|
|
||||||
**?? TradingBot pronto su Unraid!**
|
**?? 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)
|
||||||
|
|||||||
@@ -9,30 +9,28 @@
|
|||||||
<Privileged>false</Privileged>
|
<Privileged>false</Privileged>
|
||||||
<Support>https://gitea.encke-hake.ts.net/Alby96/Encelado</Support>
|
<Support>https://gitea.encke-hake.ts.net/Alby96/Encelado</Support>
|
||||||
<Project>https://gitea.encke-hake.ts.net/Alby96/Encelado</Project>
|
<Project>https://gitea.encke-hake.ts.net/Alby96/Encelado</Project>
|
||||||
<Overview>Automated Crypto Trading Bot con Blazor UI. Analisi tecnica, simulazione trading e gestione portfolio automatizzata.</Overview>
|
<Overview>TradingBot - Automated Crypto Trading Bot con Blazor UI. Trading algoritmico, analisi tecnica e gestione portfolio.</Overview>
|
||||||
<Category>Tools:Productivity Status:Stable</Category>
|
<Category>Tools:Productivity Status:Stable</Category>
|
||||||
<WebUI>http://[IP]:[PORT:8080]/</WebUI>
|
<WebUI>http://[IP]:[PORT:8888]/</WebUI>
|
||||||
<TemplateURL>https://gitea.encke-hake.ts.net/Alby96/Encelado/raw/branch/main/TradingBot/deployment/unraid-template.xml</TemplateURL>
|
<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>
|
<Icon>https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/png/dotnet.png</Icon>
|
||||||
<ExtraParams>--health-cmd="wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1" --health-interval=30s --health-timeout=3s --health-retries=3 --health-start-period=40s</ExtraParams>
|
<ExtraParams/>
|
||||||
<PostArgs/>
|
<PostArgs/>
|
||||||
<CPUset/>
|
<CPUset/>
|
||||||
<DateInstalled/>
|
<DateInstalled/>
|
||||||
<DonateText>Se trovi utile questo progetto, considera di supportare lo sviluppo!</DonateText>
|
<DonateText/>
|
||||||
<DonateLink/>
|
<DonateLink/>
|
||||||
<DonateImg/>
|
<DonateImg/>
|
||||||
<Requires/>
|
<Requires/>
|
||||||
|
|
||||||
<!-- Port Configuration -->
|
<!-- CRITICAL: Port Configuration - Must be visible -->
|
||||||
<Config Name="WebUI Port" Target="8080" Default="8080" Mode="tcp" Description="Porta HTTP per accedere alla WebUI (default: 8080)" Type="Port" Display="always-hide" Required="true" Mask="false">8080</Config>
|
<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 -->
|
<!-- Volume Configuration -->
|
||||||
<Config Name="AppData" Target="/app/data" Default="/mnt/user/appdata/tradingbot" Mode="rw" Description="Directory per persistenza dati (settings, trade history, logs)" Type="Path" Display="always-hide" Required="true" Mask="false">/mnt/user/appdata/tradingbot</Config>
|
<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 -->
|
<!-- Environment Variables -->
|
||||||
<Config Name="ASPNETCORE_ENVIRONMENT" Target="ASPNETCORE_ENVIRONMENT" Default="Production" Mode="" Description="Ambiente di esecuzione ASP.NET Core" Type="Variable" Display="advanced-hide" Required="true" Mask="false">Production</Config>
|
<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="ASPNETCORE_URLS" Target="ASPNETCORE_URLS" Default="http://+:8080" Mode="" Description="URL di binding interno (deve matchare la porta container)" Type="Variable" Display="advanced-hide" 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>
|
||||||
|
|
||||||
<Config Name="TZ" Target="TZ" Default="Europe/Rome" Mode="" Description="Timezone per log e timestamp" Type="Variable" Display="advanced-hide" Required="false" Mask="false">Europe/Rome</Config>
|
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -1,274 +0,0 @@
|
|||||||
# ??? Project Structure - TradingBot
|
|
||||||
|
|
||||||
Struttura organizzata del progetto TradingBot con separazione chiara tra codice, configurazione e deployment.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Root Directory
|
|
||||||
|
|
||||||
```
|
|
||||||
TradingBot/
|
|
||||||
??? ?? Components/ # Blazor Components
|
|
||||||
? ??? ?? Layout/ # Layout components
|
|
||||||
? ??? ?? Pages/ # Page components
|
|
||||||
? ??? ?? Shared/ # Shared components
|
|
||||||
??? ?? deployment/ # ?? Deployment resources
|
|
||||||
? ??? docker-compose.yml # Docker Compose configuration
|
|
||||||
? ??? unraid-template.xml # Unraid template
|
|
||||||
? ??? PUBLISHING_GUIDE.md # Publishing guide
|
|
||||||
? ??? UNRAID_INSTALL.md # Unraid installation guide
|
|
||||||
? ??? README.md # Deployment index
|
|
||||||
??? ?? Models/ # Data models
|
|
||||||
??? ?? Properties/ # Project properties
|
|
||||||
? ??? ?? PublishProfiles/ # Visual Studio publish profiles
|
|
||||||
? ? ??? Docker.pubxml # Docker publish profile
|
|
||||||
? ? ??? FolderProfile.pubxml # Folder publish profile
|
|
||||||
? ??? launchSettings.json # Launch configurations
|
|
||||||
??? ?? Services/ # Business logic services
|
|
||||||
??? ?? wwwroot/ # Static web assets
|
|
||||||
? ??? ?? css/ # Stylesheets
|
|
||||||
? ??? ?? lib/ # Client libraries
|
|
||||||
??? .dockerignore # Docker ignore patterns
|
|
||||||
??? .gitignore # Git ignore patterns
|
|
||||||
??? appsettings.json # Application settings
|
|
||||||
??? appsettings.Development.json # Development settings
|
|
||||||
??? Dockerfile # Docker multi-stage build
|
|
||||||
??? Program.cs # Application entry point
|
|
||||||
??? README.md # Project documentation
|
|
||||||
??? TradingBot.csproj # Project file with MSBuild targets
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Key Directories
|
|
||||||
|
|
||||||
### `/Components`
|
|
||||||
|
|
||||||
Blazor Server components organizzati per funzionalità:
|
|
||||||
|
|
||||||
- **Layout**: `MainLayout.razor`, `NavMenu.razor`, `ReconnectModal.razor`
|
|
||||||
- **Pages**: `Dashboard.razor`, `Market.razor`, `Portfolio.razor`, `Settings.razor`, `Strategies.razor`
|
|
||||||
- **Shared**: Componenti riutilizzabili
|
|
||||||
|
|
||||||
### `/Services`
|
|
||||||
|
|
||||||
Business logic e servizi core:
|
|
||||||
|
|
||||||
- `TradingBotService.cs` - Core trading service
|
|
||||||
- `SimulatedMarketDataService.cs` - Market data provider
|
|
||||||
- `SimpleMovingAverageStrategy.cs` - Trading strategy
|
|
||||||
- `SettingsService.cs` - Settings persistence
|
|
||||||
- `TechnicalAnalysis.cs` - Technical indicators
|
|
||||||
- Interface definitions
|
|
||||||
|
|
||||||
### `/Models`
|
|
||||||
|
|
||||||
Data models e DTOs:
|
|
||||||
|
|
||||||
- `Trade.cs` - Trade execution model
|
|
||||||
- `MarketPrice.cs` - Market data snapshot
|
|
||||||
- `TradingSignal.cs` - Strategy signal
|
|
||||||
- `PortfolioStatistics.cs` - Portfolio metrics
|
|
||||||
- `AssetConfiguration.cs` - Asset settings
|
|
||||||
- Enums (SignalType, TradeType, etc.)
|
|
||||||
|
|
||||||
### `/deployment` ??
|
|
||||||
|
|
||||||
**Nuova cartella organizzata** con tutti i file di deployment:
|
|
||||||
|
|
||||||
#### Guide
|
|
||||||
- `PUBLISHING_GUIDE.md` - Come pubblicare da Visual Studio
|
|
||||||
- `UNRAID_INSTALL.md` - Installazione su Unraid
|
|
||||||
- `README.md` - Indice deployment
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
- `docker-compose.yml` - Docker Compose setup
|
|
||||||
- `unraid-template.xml` - Unraid 1-click install template
|
|
||||||
|
|
||||||
### `/Properties`
|
|
||||||
|
|
||||||
Visual Studio configuration:
|
|
||||||
|
|
||||||
#### PublishProfiles/
|
|
||||||
- `Docker.pubxml` - Docker container publish profile
|
|
||||||
- `FolderProfile.pubxml` - Folder-based publish profile
|
|
||||||
|
|
||||||
#### Other
|
|
||||||
- `launchSettings.json` - Debug/run configurations (HTTP, HTTPS, Docker)
|
|
||||||
|
|
||||||
### `/wwwroot`
|
|
||||||
|
|
||||||
Static web assets:
|
|
||||||
|
|
||||||
- `/css` - Custom stylesheets
|
|
||||||
- `/lib` - Client libraries (Bootstrap, etc.)
|
|
||||||
- Static files (favicon, etc.)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Configuration Files
|
|
||||||
|
|
||||||
### Root Level
|
|
||||||
|
|
||||||
| File | Purpose |
|
|
||||||
|------|---------|
|
|
||||||
| `TradingBot.csproj` | Project file with MSBuild post-build targets |
|
|
||||||
| `Dockerfile` | Multi-stage Docker build configuration |
|
|
||||||
| `Program.cs` | Application startup and service registration |
|
|
||||||
| `appsettings.json` | Production configuration |
|
|
||||||
| `appsettings.Development.json` | Development overrides |
|
|
||||||
| `.dockerignore` | Files excluded from Docker build |
|
|
||||||
| `.gitignore` | Files excluded from Git |
|
|
||||||
| `README.md` | Main project documentation |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Deployment Flow
|
|
||||||
|
|
||||||
```
|
|
||||||
Source Code (/) ? Build ? Docker Image ? Gitea Registry ? Unraid
|
|
||||||
?
|
|
||||||
Post-Build MSBuild Target
|
|
||||||
(TradingBot.csproj)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Files Involved
|
|
||||||
|
|
||||||
1. **`TradingBot.csproj`**
|
|
||||||
- Contains `PushToGiteaRegistry` MSBuild target
|
|
||||||
- Hooks into `AfterTargets="DockerBuildImage"`
|
|
||||||
- Automatically tags and pushes to Gitea
|
|
||||||
|
|
||||||
2. **`Properties/PublishProfiles/Docker.pubxml`**
|
|
||||||
- Visual Studio publish profile
|
|
||||||
- Triggers Docker build
|
|
||||||
- Integrated with MSBuild post-build
|
|
||||||
|
|
||||||
3. **`Dockerfile`**
|
|
||||||
- Multi-stage build (build ? publish ? final)
|
|
||||||
- Optimized for .NET 10 and Blazor Server
|
|
||||||
- Creates minimal production image
|
|
||||||
|
|
||||||
4. **`deployment/docker-compose.yml`**
|
|
||||||
- Production deployment configuration
|
|
||||||
- Uses image from Gitea Registry
|
|
||||||
- Health checks and resource limits
|
|
||||||
|
|
||||||
5. **`deployment/unraid-template.xml`**
|
|
||||||
- Unraid Docker Manager template
|
|
||||||
- 1-click installation
|
|
||||||
- Pre-configured settings
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Documentation Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
/
|
|
||||||
??? README.md # Main project docs
|
|
||||||
??? deployment/
|
|
||||||
??? README.md # Deployment index
|
|
||||||
??? PUBLISHING_GUIDE.md # Publishing workflow
|
|
||||||
??? UNRAID_INSTALL.md # Unraid installation
|
|
||||||
```
|
|
||||||
|
|
||||||
### Reading Order
|
|
||||||
|
|
||||||
1. **[/README.md](../README.md)** - Start here for project overview
|
|
||||||
2. **[/deployment/PUBLISHING_GUIDE.md](../deployment/PUBLISHING_GUIDE.md)** - Learn how to publish
|
|
||||||
3. **[/deployment/UNRAID_INSTALL.md](../deployment/UNRAID_INSTALL.md)** - Deploy to Unraid
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Development Workflow
|
|
||||||
|
|
||||||
### Local Development
|
|
||||||
|
|
||||||
```
|
|
||||||
1. Open solution in Visual Studio
|
|
||||||
2. F5 to run (uses launchSettings.json ? "TradingBot" profile)
|
|
||||||
3. Edit code with Hot Reload enabled
|
|
||||||
4. Test changes at http://localhost:5243
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker Local Testing
|
|
||||||
|
|
||||||
```
|
|
||||||
1. Switch to "Docker" profile in toolbar dropdown
|
|
||||||
2. F5 to run in container
|
|
||||||
3. Test changes at http://localhost:8080
|
|
||||||
4. Debug with breakpoints (works in container!)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Publishing
|
|
||||||
|
|
||||||
```
|
|
||||||
1. Build ? Configuration Manager ? Release
|
|
||||||
2. Build ? Publish TradingBot
|
|
||||||
3. Select "Docker" profile
|
|
||||||
4. Click "Publish"
|
|
||||||
5. MSBuild post-build automatically pushes to Gitea
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Sensitive Files (Not in Git)
|
|
||||||
|
|
||||||
These files are in `.gitignore`:
|
|
||||||
|
|
||||||
- `obj/` - Build intermediate files
|
|
||||||
- `bin/` - Build output
|
|
||||||
- `*.user` - User-specific VS settings
|
|
||||||
- `data/` - Runtime data (settings, trades)
|
|
||||||
- `.vs/` - Visual Studio cache
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ? Organization Benefits
|
|
||||||
|
|
||||||
### Before
|
|
||||||
|
|
||||||
```
|
|
||||||
TradingBot/
|
|
||||||
??? build-push-dockerhub.sh ? Script esterno
|
|
||||||
??? push-to-gitea.ps1 ? Script esterno
|
|
||||||
??? publish-all.ps1 ? Script esterno
|
|
||||||
??? full-workflow.bat ? Script esterno
|
|
||||||
??? docker-compose.yml ? Disordinato in root
|
|
||||||
??? unraid-template.xml ? Disordinato in root
|
|
||||||
??? ... (altri file misti)
|
|
||||||
```
|
|
||||||
|
|
||||||
### After ?
|
|
||||||
|
|
||||||
```
|
|
||||||
TradingBot/
|
|
||||||
??? deployment/ ? Tutto organizzato
|
|
||||||
? ??? docker-compose.yml ? Deployment configs
|
|
||||||
? ??? unraid-template.xml ? Templates
|
|
||||||
? ??? PUBLISHING_GUIDE.md ? Documentation
|
|
||||||
? ??? UNRAID_INSTALL.md ? Documentation
|
|
||||||
? ??? README.md ? Index
|
|
||||||
??? TradingBot.csproj ? Post-build integrato
|
|
||||||
??? (codice sorgente organizzato) ? Struttura chiara
|
|
||||||
```
|
|
||||||
|
|
||||||
**Vantaggi**:
|
|
||||||
- ? **Zero script esterni** - Tutto in MSBuild
|
|
||||||
- ? **Organizzazione chiara** - Deployment separato
|
|
||||||
- ? **Facile navigazione** - Struttura logica
|
|
||||||
- ? **Manutenibilità** - File raggruppati per scopo
|
|
||||||
- ? **Visual Studio friendly** - Tutto integrato nell'IDE
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ?? Summary
|
|
||||||
|
|
||||||
**Struttura pulita e professionale con:**
|
|
||||||
- ?? Codice organizzato per funzionalità
|
|
||||||
- ?? Deployment resources in cartella dedicata
|
|
||||||
- ?? Documentazione completa e accessibile
|
|
||||||
- ?? MSBuild integration per publishing automatico
|
|
||||||
- ? Zero dipendenze da script esterni
|
|
||||||
|
|
||||||
**Tutto gestibile da Visual Studio!** ??
|
|
||||||
Reference in New Issue
Block a user