9.2 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, user_setup, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | user_setup | must_haves | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-setup-git-foundation | 01 | execute | 1 |
|
true |
|
|
Purpose: Students need reliable tools to verify their Docker setup meets course requirements before starting labs, and a way to reset their environment between labs. Output: Three executable bash scripts (check-env.sh, validate-compose.sh, reset-env.sh) with clear error messages and appropriate exit codes.
<execution_context> @/home/luca/.claude/get-shit-done/workflows/execute-plan.md @/home/luca/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/STATE.md @.planning/ROADMAP.md @.planning/REQUIREMENTS.md @.planning/phases/01-setup-git-foundation/01-RESEARCH.md @.planning/phases/01-setup-git-foundation/01-VALIDATION.md @CLAUDE.md Task 1: Create environment check script (check-env.sh) scripts/check-env.sh Create bash script that verifies Docker environment meets course requirements. Script MUST include:- Standard header (per CLAUDE.md):
#!/bin/bash
# Laboratori Cloud - Environment Check Script
# Part of: "Corso Soluzioni Cloud"
#
# Description: Verifies Docker Engine >= 24.0, Compose V2, network utilities, and system resources
# Usage: ./scripts/check-env.sh
-
Docker Engine version check:
- Run
docker --versionto get version - Parse major version number
- Exit with error if < 24.0
- Clear message: "ERROR: Docker Engine >= 24.0 required. Found: X.Y.Z"
- Run
-
Docker Compose V2 check:
- Run
docker compose version(V2 syntax, notdocker-compose) - Exit with error if command not found
- Clear message: "ERROR: Docker Compose V2 required. Use 'docker compose' not 'docker-compose'"
- Run
-
Network utilities check:
- Check for
netcatornc - Check for
curl - Check for
ip(iproute2) - Exit with error listing missing utilities
- Check for
-
System resources check:
- Report available RAM (using
free -hor/proc/meminfo) - Report CPU cores (using
nproc) - Warn if RAM < 8GB (recommended: 16GB per RESEARCH.md)
- Report available RAM (using
-
Exit codes:
- 0: All checks pass
- 1: One or more checks fail
- Clear color-coded output (green for pass, red for fail)
-
Idempotency: Script can be run multiple times without side effects
DO NOT use interactive prompts. DO NOT require root. DO NOT modify system state. ./scripts/check-env.sh && echo "PASS" || echo "FAIL" Script exits 0 when Docker >= 24.0, Compose V2, and all utilities present. Script exits 1 with clear error message when any requirement missing. Script reports RAM and CPU resources accurately.
Task 2: Create compose validation script (validate-compose.sh) scripts/validate-compose.sh Create bash script that validates docker-compose.yml files before deployment. Script MUST include:- Standard header:
#!/bin/bash
# Laboratori Cloud - Docker Compose Validation Script
# Part of: "Corso Soluzioni Cloud"
#
# Description: Validates docker-compose.yml syntax using 'docker compose config'
# Usage: ./scripts/validate-compose.sh [path-to-compose-file]
-
Argument handling:
- Accept path to compose file as first argument
- If no argument, show usage message and exit 1
- If file doesn't exist, exit 1 with clear error
-
Validation logic:
- Run
docker compose -f [file] configto parse YAML - Exit 0 if config valid (YAML parses successfully)
- Exit 1 if config invalid (syntax errors, invalid directives)
- Run
-
Error reporting:
- Show docker compose error output on failure
- Clear message: "ERROR: docker-compose.yml validation failed"
-
Edge cases:
- Handle relative paths correctly
- Handle missing file gracefully
- Suppress docker compose verbose output unless error
DO NOT deploy containers. DO NOT pull images. Validation only. ./scripts/validate-compose.sh /dev/null 2>&1 | grep -i "usage|error" && echo "USAGE_SHOWN" || true Script shows usage when called without arguments. Script exits 1 when given non-existent file. Script exits 1 when given invalid YAML compose file. Script exits 0 when given valid docker-compose.yml.
Task 3: Create environment reset script (reset-env.sh) scripts/reset-env.sh Create bash script that cleans Docker environment between labs. Script MUST include:- Standard header:
#!/bin/bash
# Laboratori Cloud - Environment Reset Script
# Part of: "Corso Soluzioni Cloud"
#
# Description: Stops all containers, removes all networks and volumes (with confirmation)
# Usage: ./scripts/reset-env.sh [--dry-run]
-
Safety features (per CLAUDE.md "Safety First"):
- Default: Require user confirmation before destructive operations
- Support
--dry-runflag to show what would be deleted without actually deleting - Clear warning: "WARNING: This will stop ALL containers and remove ALL networks and volumes"
-
Cleanup operations in order:
- Stop all running containers (
docker stop $(docker ps -q)) - Remove all containers (
docker rm $(docker ps -aq)) - Remove all user-created networks (
docker network ls -qfilter out bridge/host/none) - Remove all volumes (with confirmation, separate from networks)
- Show count of objects removed
- Stop all running containers (
-
Exit codes:
- 0: Cleanup completed successfully
- 1: User cancelled or error occurred
-
Idempotency: Can be run safely on already-clean environment
-
Output:
- Show progress for each operation
- Clear summary of what was removed
- No error if nothing to remove
DO NOT remove Docker default networks (bridge, host, none). DO NOT remove Docker images. ./scripts/reset-env.sh --dry-run --dry-run flag shows what would be deleted without deleting. Default mode requires user confirmation. Script removes all containers, networks, and volumes when confirmed. Script preserves default Docker networks (bridge, host, none). Script exits 0 on successful cleanup.
After all tasks complete: 1. Run `./scripts/check-env.sh` — should report all requirements met 2. Run `./scripts/validate-compose.sh` without arguments — should show usage 3. Run `./scripts/reset-env.sh --dry-run` — should show what would be cleaned 4. Verify all scripts are executable (`ls -l scripts/`) 5. Verify scripts have standard headers per CLAUDE.mdCross-verification:
- check-env.sh validates SETUP-01 (Docker >= 24.0), SETUP-02 (network utilities), SETUP-03 (resources), SETUP-04 (verification script)
- validate-compose.sh validates INF-05 (compose validation before use)
<success_criteria>
- All three scripts exist in scripts/ directory and are executable
- check-env.sh accurately detects Docker Engine >= 24.0, Compose V2, and network utilities
- validate-compose.sh catches YAML syntax errors in docker-compose.yml files
- reset-env.sh provides safe cleanup with --dry-run flag
- All scripts follow CLAUDE.md standards (headers, error messages, exit codes) </success_criteria>