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
309 lines
7.8 KiB
Markdown
309 lines
7.8 KiB
Markdown
# Calcolatore Prezzi Software
|
|
|
|
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
|
|
|
|
### Modalità Standard
|
|
|
|
- ✅ 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
|
|
|
|
### Modalità Negozio
|
|
|
|
- ✅ 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 # 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
|
|
|
|
- **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
|
|
|
|
[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
|