# Linux App Store - Kubernetes Deployment ## Deploy ### Prerequisiti - Cluster Kubernetes attivo (es. `10.66.200.x/24`) - kubectl configurato - Container registry privato (GitLab: `git.giaco.net`) - Personal Access Token per il registry ### Build e Deploy ```bash # Login al registry GitLab echo "" | docker login git.giaco.net -u capitano --password-stdin # Build l'immagine docker build -t git.giaco.net/capitano/webapplinux:latest . # Push su registry docker push git.giaco.net/capitano/webapplinux:latest # Deploy su Kubernetes kubectl apply -f k8s/namespace.yaml kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml kubectl apply -f k8s/ingress.yaml # Verifica kubectl get pods -n linuxwebapp kubectl get svc -n linuxwebapp kubectl get ingress -n linuxwebapp # Log kubectl logs -l app=linux-app-store -n linuxwebapp -f ``` ### Accesso al portale Il portale è accessibile tramite ingress nginx all'indirizzo: - **URL**: `http://apps.local/` Per raggiungerlo localmente, aggiungi una entry nel file `/etc/hosts`: ``` 10.66.200.211 apps.local ``` (sostituisci `10.66.200.211` con l'IP del tuo Ingress controller) ### File struttura ``` webapplinux/ ├── Dockerfile # Dockerfile Nginx ├── docker-compose.yml # Compose per sviluppo locale ├── nginx.conf # Configurazione Nginx ├── README.md # Questo file ├── frontend/ │ ├── index.html # Pagina principale │ ├── script.js # Logica OS detection & install │ └── apps.json # Database applicazioni └── k8s/ ├── namespace.yaml # Namespace linuxwebapp ├── deployment.yaml # Deployment (2 repliche, git registry) ├── service.yaml # Service (ClusterIP) └── ingress.yaml # Ingress (dominio apps.local) ``` ### Customizzazione 1. **Applicazioni**: Modifica `frontend/apps.json` per aggiungere/rimuovere app 2. **Nginx**: Aggiorna `nginx.conf` per routing personalizzato 3. **Risorse**: Modifica `k8s/deployment.yaml` per cpu/memory 4. **Immagine**: Cambia `image` nel deployment per usare un altro registry ### Rimozione ```bash kubectl delete -f k8s/ingress.yaml kubectl delete -f k8s/service.yaml kubectl delete -f k8s/deployment.yaml kubectl delete -f k8s/namespace.yaml ``` ### CI/CD Usa il file `.gitlab-ci.yml` (da creare) per automatizzare: 1. Build dell'immagine 2. Push su GitLab registry 3. Deploy automatico in Kubernetes