feat(lab-04): complete Phase 5 - Storage & S3 lab

Phase Plan:
- 05-PLAN.md: Combined execution plan for efficiency
- 05-RESEARCH.md: Domain research on volumes and MinIO

Test Scripts (4):
- 01-volumes-test.sh: Volume persistence verification
- 02-minio-test.sh: MinIO S3 API testing
- 03-persistence-test.sh: Database persistence verification
- 99-final-verification.sh: End-to-end verification

Documentation (6 files):
Tutorial: Docker volumes, MinIO S3
How-to: Manage volumes
Reference: Volume syntax
Explanation: Storage↔S3 parallels

Infrastructure:
- docker-compose.yml: MinIO S3 + PostgreSQL + test container
- Named volumes: minio-data, db-data, test-data (INF-04 compliant)

Key concepts:
- Named volumes = EBS volumes
- MinIO = S3 bucket (100% API compatible)
- Data persistence across container lifecycle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-03 15:25:46 +02:00
parent 23a9ffe443
commit a021fe796b
12 changed files with 467 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
# Tutorial 1: Docker Volumes - Persistenza dei Dati
## Obiettivi
- Capire cosa sono i Docker Volumes
- Creare volumi named
- Montare volumi nei container
- Verificare la persistenza dei dati
## Cos'è un Docker Volume?
Un volume Docker è:
- **Storage persistente**: I dati sopravvivono al container
- **Managed**: Docker gestisce il filesystem
- **Named volume: Puoi riferirti per nome
## Parallelismo: Docker Volume = EBS Volume
| Docker | AWS EBS |
|--------|---------|
| docker volume create | aws ec2 create-volume |
| Named volume | Volume ID |
| Mount to container | Attach to instance |
| Data persists | Data persists independently |
## Esercizio
1. Crea un volume:
```bash
docker volume create my-data
```
2. Usa nel compose:
```yaml
volumes:
my-data:
driver: local
services:
app:
volumes:
- my-data:/app/data
```
3. Verifica persistenza:
```bash
docker compose up -d
docker exec lab04-test sh -c "echo 'test' > /data/file.txt"
docker compose down
docker compose up -d
docker exec lab04-test cat /data/file.txt # Dato presente!
```
## Comandi Utili
```bash
docker volume ls # Lista volumi
docker volume inspect <name> # Dettagli volume
docker volume rm <name> # Rimuovi volume
```
## Conclusione
I volumi Docker permettono la persistenza dei dati, esattamente come gli EBS volumes in AWS.

View File

@@ -0,0 +1,64 @@
# Tutorial 2: MinIO - Storage S3-Compatible
## Obiettivi
- Capire cosa è MinIO
- Deploy MinIO con Docker Compose
- Usare S3 API localmente
- Configurare client S3
## Cos'è MinIO?
MinIO è:
- **S3-compatible**: 100% compatibile con AWS S3 API
- **Local development**: S3 sul tuo computer
- **Open source**: Gratis e self-hosted
## Parallelismo: MinIO = S3
| Locale | Cloud |
|--------|-------|
| MinIO container | S3 bucket |
| http://localhost:9000 | https://s3.amazonaws.com |
| mc ls | aws s3 ls |
| minioadmin | AWS credentials |
## Configurazione
```yaml
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin123
ports:
- "9000:9000" # API
- "9001:9001" # Console
volumes:
- minio-data:/data
```
## Utilizzo
### Accesso Console
Apri: http://localhost:9001
Login: minioadmin / minioadmin123
### AWS CLI
```bash
aws s3 ls --endpoint-url http://localhost:9000
aws s3 mb s3://testbucket --endpoint-url http://localhost:9000
aws s3 cp file.txt s3://testbucket/ --endpoint-url http://localhost:9000
```
### Python (boto3)
```python
import boto3
s3 = boto3.client('s3', endpoint_url='http://localhost:9000',
aws_access_key_id='minioadmin',
aws_secret_access_key='minioadmin123')
s3.create_bucket(Bucket='testbucket')
```
## Conclusione
MinIO ti permette di sviluppare con S3 API localmente prima di deployare in AWS.