Add multi-mode HTML, Docker, Helm chart, and deploy script
All checks were successful
Build and Deploy / build (push) Successful in 46s
All checks were successful
Build and Deploy / build (push) Successful in 46s
- Add shop-mode.html and project-mode.html for separate calculation modes - Refactor index.html as a landing page for mode selection - Add Dockerfile with optimized nginx config and healthcheck - Add .dockerignore for cleaner Docker builds - Add deploy.sh for Helm/Kubernetes deployment automation - Add helm-chart/ with values.yaml, Chart.yaml, templates, and documentation - Update README.md with full instructions, features, and CI/CD examples
This commit is contained in:
345
README.md
345
README.md
@@ -1,77 +1,308 @@
|
||||
# Calcolatore Prezzi Software
|
||||
|
||||
Un'applicazione web per calcolare i prezzi di progetti software in base a diversi parametri e metodologie di stima.
|
||||
Sistema professionale per la creazione di preventivi software con due modalità operative:
|
||||
|
||||
- **Menu Principale** (`index.html`): Pagina di selezione della modalità con interfaccia intuitiva
|
||||
- **Modalità Progetto** (`project-mode.html`): Calcolo basato su ore, persone, milestone e regime fiscale italiano
|
||||
- **Modalità Negozio** (`shop-mode.html`): Calcolo basato su articoli, quantità e listino prezzi (come un e-commerce)
|
||||
|
||||
## Caratteristiche
|
||||
|
||||
- Interfaccia utente moderna e responsive
|
||||
- Calcolo automatico dei prezzi basato su parametri configurabili
|
||||
- Supporto per diverse metodologie di stima
|
||||
- Design ottimizzato per il mercato italiano
|
||||
### Modalità Standard
|
||||
|
||||
## Installazione e Utilizzo
|
||||
- ✅ Gestione team con tariffe personalizzate per membro
|
||||
- ✅ Calcolo milestone con assegnazione task a membri specifici
|
||||
- ✅ Supporto per diversi regimi fiscali italiani (Forfettario, Ordinario, SRL, SRLS, ecc.)
|
||||
- ✅ Calcolo automatico di IRPEF, IRES, IRAP, INPS
|
||||
- ✅ Generazione PDF per cliente e documento interno
|
||||
- ✅ Salvataggio e caricamento preventivi
|
||||
- ✅ Interfaccia responsive con Alpine.js e Tailwind CSS
|
||||
|
||||
### Utilizzo con Docker
|
||||
### Modalità Negozio
|
||||
|
||||
1. **Costruire l'immagine Docker:**
|
||||
```bash
|
||||
docker build -t git.commandware.com/dnviti/calcolatore_prezzi_software .
|
||||
```
|
||||
|
||||
2. **Eseguire il container:**
|
||||
```bash
|
||||
docker run -p 8080:80 git.commandware.com/dnviti/calcolatore_prezzi_software
|
||||
```
|
||||
|
||||
3. **Oppure utilizzare l'immagine dal registry:**
|
||||
```bash
|
||||
docker pull git.commandware.com/dnviti/calcolatore_prezzi_software:main
|
||||
docker run -p 8080:80 git.commandware.com/dnviti/calcolatore_prezzi_software:main
|
||||
```
|
||||
|
||||
3. **Accedere all'applicazione:**
|
||||
Aprire il browser e navigare a `http://localhost:8080`
|
||||
|
||||
### Sviluppo Locale
|
||||
|
||||
Per sviluppo locale, aprire semplicemente il file `index.html` in un browser web.
|
||||
|
||||
## Deployment
|
||||
|
||||
Il progetto include una pipeline CI/CD per Gitea che automaticamente:
|
||||
|
||||
- Costruisce l'immagine Docker
|
||||
- Pubblica sul registry Gitea (git.commandware.com)
|
||||
- Si attiva su push al branch `main` o su pull request
|
||||
|
||||
### Configurazione Secrets
|
||||
|
||||
Per utilizzare la pipeline, configurare i seguenti secrets nel repository Gitea:
|
||||
|
||||
- `GITEA_USERNAME`: Username Gitea
|
||||
- `GITEA_TOKEN`: Token di accesso Gitea con permessi di scrittura al registry
|
||||
- ✅ Gestione catalogo articoli con codici SKU
|
||||
- ✅ Calcolo prezzi unitari e quantità
|
||||
- ✅ Sconti per articolo
|
||||
- ✅ Gestione spese di spedizione
|
||||
- ✅ Calcolo IVA configurabile
|
||||
- ✅ Generazione PDF preventivo
|
||||
- ✅ Interfaccia intuitiva per vendita prodotti/servizi
|
||||
|
||||
## Struttura del Progetto
|
||||
|
||||
```
|
||||
.
|
||||
├── index.html # Applicazione web principale
|
||||
├── Dockerfile # Configurazione Docker
|
||||
├── .gitea/
|
||||
│ └── workflows/
|
||||
│ └── build.yml # Pipeline CI/CD
|
||||
└── README.md # Documentazione
|
||||
├── index.html # Menu principale per selezione modalità
|
||||
├── project-mode.html # Modalità progetto (ore/persone/milestone)
|
||||
├── shop-mode.html # Modalità negozio (articoli/quantità)
|
||||
├── Dockerfile # Build immagine Docker
|
||||
├── deploy.sh # Script deploy automatico
|
||||
├── .dockerignore # Ignore file per Docker
|
||||
└── helm-chart/ # Helm chart per Kubernetes
|
||||
├── Chart.yaml # Definizione chart
|
||||
├── values.yaml # Valori di configurazione
|
||||
├── README.md # Documentazione Helm
|
||||
├── .helmignore # Ignore file per Helm
|
||||
└── templates/ # Template Kubernetes
|
||||
├── _helpers.tpl # Helper functions
|
||||
├── configmap.yaml # ConfigMap per HTML
|
||||
└── NOTES.txt # Note post-install
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Utilizzo Locale
|
||||
|
||||
1. **Apri direttamente nel browser:**
|
||||
|
||||
```bash
|
||||
# Modalità standard
|
||||
firefox index.html
|
||||
|
||||
# Modalità negozio
|
||||
firefox shop-mode.html
|
||||
```
|
||||
|
||||
2. **Oppure con un server web locale:**
|
||||
|
||||
```bash
|
||||
# Python 3
|
||||
python3 -m http.server 8000
|
||||
|
||||
# PHP
|
||||
php -S localhost:8000
|
||||
|
||||
# Node.js (con http-server)
|
||||
npx http-server -p 8000
|
||||
```
|
||||
|
||||
Poi visita: `http://localhost:8000`
|
||||
|
||||
### Deploy con Docker
|
||||
|
||||
1. **Build dell'immagine:**
|
||||
|
||||
```bash
|
||||
docker build -t calcolatore-prezzi:latest .
|
||||
```
|
||||
|
||||
2. **Run del container:**
|
||||
|
||||
```bash
|
||||
docker run -d -p 8080:80 --name calcolatore calcolatore-prezzi:latest
|
||||
```
|
||||
|
||||
3. **Accesso:**
|
||||
```
|
||||
http://localhost:8080/ # Menu principale
|
||||
http://localhost:8080/project-mode.html # Modalità progetto
|
||||
http://localhost:8080/shop-mode.html # Modalità negozio
|
||||
```
|
||||
|
||||
### Deploy su Kubernetes con Helm
|
||||
|
||||
#### Prerequisiti
|
||||
|
||||
- Kubernetes cluster (1.19+)
|
||||
- Helm 3.0+
|
||||
- kubectl configurato
|
||||
|
||||
#### Deploy Rapido
|
||||
|
||||
1. **Aggiorna le dipendenze Helm:**
|
||||
|
||||
```bash
|
||||
cd helm-chart
|
||||
helm dependency update
|
||||
cd ..
|
||||
```
|
||||
|
||||
2. **Deploy con lo script automatico:**
|
||||
|
||||
```bash
|
||||
# Deploy base
|
||||
./deploy.sh
|
||||
|
||||
# Deploy in namespace specifico
|
||||
./deploy.sh -n production
|
||||
|
||||
# Deploy con valori personalizzati
|
||||
./deploy.sh -f values-prod.yaml -n production -t v1.0.0
|
||||
|
||||
# Upgrade deployment esistente
|
||||
./deploy.sh -u -n production -t v1.0.1
|
||||
```
|
||||
|
||||
3. **Deploy manuale con Helm:**
|
||||
```bash
|
||||
helm install calcolatore-prezzi ./helm-chart \
|
||||
--namespace production \
|
||||
--create-namespace \
|
||||
--set-file configMaps.html-content.data.index\.html=./index.html \
|
||||
--set-file configMaps.html-content.data.project-mode\.html=./project-mode.html \
|
||||
--set-file configMaps.html-content.data.shop-mode\.html=./shop-mode.html
|
||||
```
|
||||
|
||||
#### Configurazione Ingress
|
||||
|
||||
Modifica `helm-chart/values.yaml`:
|
||||
|
||||
```yaml
|
||||
ingress:
|
||||
enabled: true
|
||||
className: "nginx"
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
hosts:
|
||||
- host: calcolatore.tuodominio.com
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- secretName: calcolatore-tls
|
||||
hosts:
|
||||
- calcolatore.tuodominio.com
|
||||
```
|
||||
|
||||
#### Verifica Deploy
|
||||
|
||||
```bash
|
||||
# Stato dei pod
|
||||
kubectl get pods -n production
|
||||
|
||||
# Logs
|
||||
kubectl logs -n production -l app.kubernetes.io/name=calcolatore-prezzi -f
|
||||
|
||||
# Port-forward per test locale
|
||||
kubectl port-forward -n production svc/calcolatore-prezzi 8080:80
|
||||
```
|
||||
|
||||
## Helm Chart
|
||||
|
||||
Il chart utilizza [base-helm](https://git.commandware.com/GitOps/base-helm.git) come dipendenza comune per standardizzare le risorse Kubernetes.
|
||||
|
||||
### Parametri Principali
|
||||
|
||||
| Parametro | Descrizione | Default |
|
||||
| ------------------------- | ------------------- | ----------- |
|
||||
| `replicaCount` | Numero di repliche | `2` |
|
||||
| `image.repository` | Repository immagine | `nginx` |
|
||||
| `image.tag` | Tag immagine | `alpine` |
|
||||
| `service.type` | Tipo service | `ClusterIP` |
|
||||
| `service.port` | Porta service | `80` |
|
||||
| `ingress.enabled` | Abilita ingress | `true` |
|
||||
| `resources.limits.cpu` | Limite CPU | `200m` |
|
||||
| `resources.limits.memory` | Limite memoria | `256Mi` |
|
||||
| `autoscaling.enabled` | Abilita HPA | `false` |
|
||||
|
||||
Vedi `helm-chart/README.md` per la documentazione completa.
|
||||
|
||||
## CI/CD Examples
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
```yaml
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t registry.example.com/calcolatore:${{ github.sha }} .
|
||||
|
||||
- name: Push image
|
||||
run: docker push registry.example.com/calcolatore:${{ github.sha }}
|
||||
|
||||
- name: Deploy to Kubernetes
|
||||
run: |
|
||||
helm dependency update ./helm-chart
|
||||
./deploy.sh -u -n production -t ${{ github.sha }}
|
||||
```
|
||||
|
||||
### GitLab CI
|
||||
|
||||
```yaml
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
- helm dependency update ./helm-chart
|
||||
- ./deploy.sh -u -n production -t $CI_COMMIT_SHA
|
||||
only:
|
||||
- main
|
||||
```
|
||||
|
||||
## Tecnologie Utilizzate
|
||||
|
||||
- HTML5
|
||||
- CSS3 (Tailwind CSS)
|
||||
- JavaScript
|
||||
- Nginx (per serving statico)
|
||||
- Docker
|
||||
- Gitea Actions
|
||||
- **Frontend:** HTML5, CSS3, JavaScript (Vanilla + Alpine.js)
|
||||
- **Styling:** Tailwind CSS (via CDN)
|
||||
- **PDF Generation:** jsPDF
|
||||
- **Icons:** Font Awesome
|
||||
- **Containerization:** Docker
|
||||
- **Orchestration:** Kubernetes + Helm 3
|
||||
- **Web Server:** Nginx Alpine
|
||||
|
||||
## Funzionalità Aggiuntive
|
||||
|
||||
### Modalità Standard
|
||||
|
||||
- Calcolo dettagliato per regime fiscale italiano
|
||||
- Supporto INPS, rivalsa, ritenuta d'acconto
|
||||
- Gestione team con tariffe differenziate
|
||||
- Milestone con task assegnabili a membri specifici
|
||||
- Due PDF separati: cliente (pubblico) e interno (riservato)
|
||||
|
||||
### Modalità Negozio
|
||||
|
||||
- Gestione inventario articoli
|
||||
- Codici SKU personalizzabili
|
||||
- Sconti per singolo articolo
|
||||
- Calcolo spese di spedizione
|
||||
- IVA configurabile (0%, 4%, 10%, 22%)
|
||||
|
||||
## Browser Supportati
|
||||
|
||||
- Chrome/Chromium 90+
|
||||
- Firefox 88+
|
||||
- Safari 14+
|
||||
- Edge 90+
|
||||
|
||||
## Licenza
|
||||
|
||||
[Inserire informazioni sulla licenza]
|
||||
[Inserisci qui la tua licenza]
|
||||
|
||||
## Autore
|
||||
|
||||
[Il tuo nome]
|
||||
|
||||
## Supporto
|
||||
|
||||
Per problemi o domande, apri una issue nel repository.
|
||||
|
||||
## Contributing
|
||||
|
||||
Le pull request sono benvenute. Per modifiche importanti, apri prima una issue per discutere cosa vorresti cambiare.
|
||||
|
||||
---
|
||||
|
||||
**Note:**
|
||||
|
||||
- Questo progetto è pensato per il mercato italiano e include calcoli fiscali specifici
|
||||
- I calcoli fiscali sono indicativi e dovresti sempre consultare un commercialista
|
||||
- Il chart Helm usa base-helm come standard per deployment Kubernetes
|
||||
|
||||
Reference in New Issue
Block a user