Overview
CompuTécnicos uses Docker and Docker Compose to provide a consistent development and deployment environment. The application runs in isolated containers with all dependencies pre-configured.Architecture
The Docker setup consists of three main services:Services
app - PHP/Apache Application
app - PHP/Apache Application
- Image: PHP 8.2 with Apache
- Port: 8080 (configurable via
APP_PORT) - Features:
- PHP extensions: PDO, MySQLi, GD, Zip, Intl, mbstring, XML
- Composer for dependency management
- Apache with mod_rewrite enabled
- Persistent uploads and logs volumes
- Dependencies: dompdf, PhpSpreadsheet, Google API Client
db - MySQL Database
db - MySQL Database
- Image: MySQL 8.0
- Port: 3306 (configurable via
DB_PORT) - Features:
- UTF-8 (utf8mb4) character set
- Automatic schema initialization
- Health checks for reliable startup
- Persistent data volume
- Configuration: 64MB max packet size, native password authentication
phpmyadmin - Database Management
phpmyadmin - Database Management
- Image: phpMyAdmin latest
- Port: 8081 (configurable via
PMA_PORT) - Profile: dev (optional, for development only)
- Access: Web-based MySQL management interface
Environment Configuration
Environment Variables
The.env file controls all configuration aspects:
Creating Your Configuration
Docker Compose Commands
Basic Operations
Monitoring and Debugging
Database Management
Initial Setup
The database is automatically initialized when thedb container first starts:
- MySQL creates the
computecnicosdatabase - The init script at
database/computecnicos_full.sqlruns automatically - All tables, sample data, and indexes are created
Manual Database Operations
Database Schema
The complete schema includes:- Core Tables: usuarios, productos, categorias, marcas, pedidos
- Inventory: movimientos_inventario, proveedores
- E-commerce: carrito, detalle_pedido, pedido_estados
- Invoicing: facturas_electronicas, notas_credito
- Reviews: resenas, resenas_imagenes, comentarios_producto
- Authentication: password_resets, remember_tokens
- Media: imagenes_producto
Volumes and Persistence
Persistent Volumes
CompuTécnicos uses Docker volumes to persist important data:Volume Management
File Permissions
The application requires specific permissions for uploads and logs:These permissions are automatically set during container build, but you may need to fix them if you manually copy files.
Production Deployment
Pre-Deployment Checklist
Before deploying to production:Deployment Commands
Troubleshooting
Application Won’t Start
Database Connection Issues
Connection Refused
Connection Refused
Symptoms: Application shows “Connection refused” or can’t connect to database.Solutions:
- Wait for database health check to complete:
- Verify database container is healthy:
- Check database credentials in
.envmatch those inconfig/database.php
Access Denied
Access Denied
Symptoms: “Access denied for user” error.Solutions:
- Verify environment variables:
- Reset database with correct credentials:
Database Not Initialized
Database Not Initialized
Symptoms: Tables don’t exist or schema is missing.Solutions:
- Check if init script ran:
- Manually import schema:
Permission Issues
Performance Issues
Slow Container Startup
Slow Container Startup
- Increase Docker Desktop memory allocation (Settings → Resources)
- Use named volumes instead of bind mounts for better performance
- On Windows, ensure WSL 2 backend is enabled
High Resource Usage
High Resource Usage
- Limit MySQL memory usage in
docker-compose.yml: - Enable PHP OPcache for better performance (already configured)
Port Conflicts
If ports are already in use:.env
Advanced Configuration
Custom PHP Configuration
Editdocker/php/custom.ini to customize PHP settings:
docker/php/custom.ini
MySQL Tuning
For production, tune MySQL performance indocker-compose.yml:
Health Checks
Add health checks to yourdocker-compose.yml:
Best Practices
Security
- Use strong passwords in production
- Disable phpMyAdmin in production
- Enable HTTPS with valid certificates
- Keep Docker images updated
- Use secrets for sensitive data
Performance
- Enable OPcache (already configured)
- Use CDN for static assets
- Implement database indexing
- Monitor container resources
- Use production PHP INI settings
Reliability
- Set up automated backups
- Use health checks
- Implement log rotation
- Monitor disk space
- Test disaster recovery
Maintenance
- Regular security updates
- Monitor logs for errors
- Clean up old volumes
- Document configuration changes
- Keep dependencies updated
Next Steps
Configuration Guide
Configure PayPal, invoicing, and other integrations
Production Setup
Learn about production deployment strategies
API Documentation
Explore available APIs and endpoints
Admin Guide
Learn how to manage your store