diff --git a/README.md b/README.md new file mode 100644 index 0000000..abb4499 --- /dev/null +++ b/README.md @@ -0,0 +1,149 @@ +# Quality Recticel Application + +Production-ready Flask application for quality management and traceability. + +## 📋 Current Status (November 29, 2025) + +### ✅ Production Environment +- **Deployment**: Docker containerized with docker-compose +- **Web Server**: Gunicorn WSGI server (8 workers) +- **Database**: MariaDB 11.3 +- **Python**: 3.10-slim +- **Status**: Running and healthy on port 8781 + +### 🎨 Recent UI/UX Improvements + +#### Maintenance Card +- ✅ Dark mode support with CSS custom properties +- ✅ System storage information display (logs, database, backups) +- ✅ Database table management with drop functionality +- ✅ Improved visual hierarchy and spacing + +#### Backup Management +- ✅ Quick action buttons (Full Backup, Data-Only, Refresh) +- ✅ Per-table backup and restore functionality +- ✅ Collapsible table operations section +- ✅ Split layout: Schedule creation (1/3) + Active schedules (2/3) +- ✅ Modern card-based interface + +### 🔧 Technical Fixes +- ✅ Fixed database config loading to use `mariadb` Python module +- ✅ Corrected SQL syntax for reserved keyword `rows` +- ✅ All endpoints use proper config keys (`server_domain`, `username`, `database_name`) +- ✅ Storage paths configured for Docker environment (`/srv/quality_app/logs`, `/srv/quality_app/backups`) +- ✅ Resolved duplicate Flask route function names + +### 📂 Project Structure +``` +/srv/quality_app/ +├── py_app/ # Python application +│ ├── app/ # Flask application package +│ │ ├── __init__.py # App factory +│ │ ├── routes.py # Route handlers (5200+ lines) +│ │ ├── models.py # Database models +│ │ ├── database_backup.py # Backup management +│ │ └── templates/ # Jinja2 templates +│ │ └── settings.html # Settings & maintenance UI +│ ├── static/ # CSS, JS, images +│ ├── instance/ # Instance-specific config +│ ├── requirements.txt # Python dependencies +│ └── wsgi.py # WSGI entry point +├── backups/ # Database backups +├── logs/ # Application logs +├── documentation/ # Project documentation +├── docker-compose.yml # Container orchestration +├── Dockerfile # Multi-stage build +└── docker-entrypoint.sh # Container initialization + +``` + +### 🗄️ Database +- **Engine**: MariaDB 11.3 +- **Host**: db (Docker network) +- **Port**: 3306 +- **Database**: trasabilitate +- **Size monitoring**: Real-time via information_schema +- **Backup support**: Full, data-only, per-table + +### 🔐 Security & Access Control +- **Role-based access**: superadmin, admin, warehouse_manager, worker, etc. +- **Session management**: Flask sessions +- **Database operations**: Limited to superadmin/admin roles +- **Table operations**: Admin-plus decorator protection + +### 🚀 Deployment + +#### Start Application +```bash +cd /srv/quality_app +docker compose up -d +``` + +#### Stop Application +```bash +docker compose down +``` + +#### View Logs +```bash +docker logs quality-app --tail 100 -f +``` + +#### Rebuild After Changes +```bash +docker compose down +docker compose build +docker compose up -d +``` + +### 📊 API Endpoints (Maintenance) + +#### Storage Information +- `GET /api/maintenance/storage-info` - Get logs/database/backups sizes + +#### Database Tables +- `GET /api/maintenance/database-tables` - List all tables with stats +- `POST /api/maintenance/drop-table` - Drop a database table (dangerous) + +#### Per-Table Backups +- `POST /api/backup/table` - Backup single table +- `GET /api/backup/table-backups` - List table-specific backups +- `POST /api/restore/table` - Restore single table from backup + +### 🔍 Monitoring +- **Health Check**: Docker health checks via curl +- **Container Status**: `docker compose ps` +- **Application Logs**: `/srv/quality_app/logs/` (access.log, error.log) +- **Database Status**: Included in storage info + +### 📝 Recent Changes +**Commit**: `41f9caa` - Improve maintenance & backup UI with per-table operations +- Enhanced maintenance card with dark mode +- Added system storage monitoring +- Implemented per-table database operations +- Restructured backup UI with better organization +- Fixed database connectivity and SQL syntax issues + +### 🔄 Git Repository +- **Branch**: `docker_updates` +- **Remote**: https://gitea.moto-adv.com/ske087/quality_app.git +- **Status**: Up to date with origin + +### 🐛 Known Issues +None currently reported. + +### 📚 Documentation +Additional documentation available in `/srv/quality_app/documentation/`: +- Backup system guide +- Database structure +- Docker deployment +- Restore procedures + +### 👥 Development Team +- **Active Branch**: docker_updates +- **Last Updated**: November 29, 2025 +- **Deployment**: Production environment + +--- + +For more detailed information, see the documentation folder or contact the development team.