- Spostata tutta la configurazione di deployment in /deployment (docker-compose, unraid-template, guide) - Aggiunte e aggiornate guide dettagliate: publishing su Gitea, installazione Unraid, struttura progetto - Migliorato target MSBuild: publish automatico su Gitea Registry da Visual Studio, log dettagliati, condizioni più robuste - Aggiornato e ampliato .gitignore per escludere build, dati e file locali - Rimossi file obsoleti dalla root (ora tutto in /deployment) - Struttura più chiara, zero script esterni, documentazione completa e workflow di deploy semplificato
7.8 KiB
7.8 KiB
??? 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 serviceSimulatedMarketDataService.cs- Market data providerSimpleMovingAverageStrategy.cs- Trading strategySettingsService.cs- Settings persistenceTechnicalAnalysis.cs- Technical indicators- Interface definitions
/Models
Data models e DTOs:
Trade.cs- Trade execution modelMarketPrice.cs- Market data snapshotTradingSignal.cs- Strategy signalPortfolioStatistics.cs- Portfolio metricsAssetConfiguration.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 StudioUNRAID_INSTALL.md- Installazione su UnraidREADME.md- Indice deployment
Configuration
docker-compose.yml- Docker Compose setupunraid-template.xml- Unraid 1-click install template
/Properties
Visual Studio configuration:
PublishProfiles/
Docker.pubxml- Docker container publish profileFolderProfile.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
-
TradingBot.csproj- Contains
PushToGiteaRegistryMSBuild target - Hooks into
AfterTargets="DockerBuildImage" - Automatically tags and pushes to Gitea
- Contains
-
Properties/PublishProfiles/Docker.pubxml- Visual Studio publish profile
- Triggers Docker build
- Integrated with MSBuild post-build
-
Dockerfile- Multi-stage build (build ? publish ? final)
- Optimized for .NET 10 and Blazor Server
- Creates minimal production image
-
deployment/docker-compose.yml- Production deployment configuration
- Uses image from Gitea Registry
- Health checks and resource limits
-
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
- /README.md - Start here for project overview
- /deployment/PUBLISHING_GUIDE.md - Learn how to publish
- /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 filesbin/- Build output*.user- User-specific VS settingsdata/- 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! ??